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() { ...@@ -350,7 +350,7 @@ func buildModeInit() {
codegenArg = "-fPIC" codegenArg = "-fPIC"
} else { } else {
switch platform { switch platform {
case "linux/amd64", "linux/arm", "linux/arm64", case "linux/amd64", "linux/arm", "linux/arm64", "linux/386",
"android/amd64", "android/arm": "android/amd64", "android/arm":
codegenArg = "-shared" codegenArg = "-shared"
case "darwin/amd64": case "darwin/amd64":
......
...@@ -318,7 +318,9 @@ func (mode *BuildMode) Set(s string) error { ...@@ -318,7 +318,9 @@ func (mode *BuildMode) Set(s string) error {
} }
*mode = BuildmodeCArchive *mode = BuildmodeCArchive
case "c-shared": case "c-shared":
if goarch != "amd64" && goarch != "arm" && goarch != "arm64" { switch goarch {
case "386", "amd64", "arm", "arm64":
default:
return badmode() return badmode()
} }
*mode = BuildmodeCShared *mode = BuildmodeCShared
...@@ -1696,7 +1698,8 @@ func stkcheck(up *Chain, depth int) int { ...@@ -1696,7 +1698,8 @@ func stkcheck(up *Chain, depth int) int {
// should never be called directly. // should never be called directly.
// only diagnose the direct caller. // only diagnose the direct caller.
// TODO(mwhudson): actually think about this. // 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) Diag("call to external function %s", s.Name)
} }
return -1 return -1
......
...@@ -51,7 +51,7 @@ func addcall(ctxt *ld.Link, s *ld.LSym, t *ld.LSym) { ...@@ -51,7 +51,7 @@ func addcall(ctxt *ld.Link, s *ld.LSym, t *ld.LSym) {
} }
func gentext() { func gentext() {
if !ld.DynlinkingGo() && ld.Buildmode != ld.BuildmodePIE { if !ld.DynlinkingGo() && ld.Buildmode != ld.BuildmodePIE && ld.Buildmode != ld.BuildmodeCShared {
return 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