Commit cbc55971 authored by Hyang-Ah Hana Kim's avatar Hyang-Ah Hana Kim

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/17074Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 3af29fb8
......@@ -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
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment