mirror of
https://github.com/golang/go
synced 2024-11-17 21:04:43 -07:00
cmd/go, cmd/link: enable -buildmode=c-shared on linux/386
All the heavy lifting was done by Michael Hudson-Doyle. Change-Id: I176f15581055078854c2ad9a5807c4dcf0f8d8c5 Reviewed-on: https://go-review.googlesource.com/17074 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
3af29fb858
commit
cbc55971e2
@ -350,7 +350,7 @@ func buildModeInit() {
|
||||
codegenArg = "-fPIC"
|
||||
} else {
|
||||
switch platform {
|
||||
case "linux/amd64", "linux/arm", "linux/arm64",
|
||||
case "linux/amd64", "linux/arm", "linux/arm64", "linux/386",
|
||||
"android/amd64", "android/arm":
|
||||
codegenArg = "-shared"
|
||||
case "darwin/amd64":
|
||||
|
@ -318,7 +318,9 @@ func (mode *BuildMode) Set(s string) error {
|
||||
}
|
||||
*mode = BuildmodeCArchive
|
||||
case "c-shared":
|
||||
if goarch != "amd64" && goarch != "arm" && goarch != "arm64" {
|
||||
switch goarch {
|
||||
case "386", "amd64", "arm", "arm64":
|
||||
default:
|
||||
return badmode()
|
||||
}
|
||||
*mode = BuildmodeCShared
|
||||
@ -1696,7 +1698,8 @@ func stkcheck(up *Chain, depth int) int {
|
||||
// should never be called directly.
|
||||
// only diagnose the direct caller.
|
||||
// TODO(mwhudson): actually think about this.
|
||||
if depth == 1 && s.Type != obj.SXREF && !DynlinkingGo() && Buildmode != BuildmodePIE {
|
||||
if depth == 1 && s.Type != obj.SXREF && !DynlinkingGo() &&
|
||||
Buildmode != BuildmodePIE && Buildmode != BuildmodeCShared {
|
||||
Diag("call to external function %s", s.Name)
|
||||
}
|
||||
return -1
|
||||
|
@ -51,7 +51,7 @@ func addcall(ctxt *ld.Link, s *ld.LSym, t *ld.LSym) {
|
||||
}
|
||||
|
||||
func gentext() {
|
||||
if !ld.DynlinkingGo() && ld.Buildmode != ld.BuildmodePIE {
|
||||
if !ld.DynlinkingGo() && ld.Buildmode != ld.BuildmodePIE && ld.Buildmode != ld.BuildmodeCShared {
|
||||
return
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user