Commit a6b480bc authored by Bill O'Farrell's avatar Bill O'Farrell Committed by Michael Munday

cmd/go: implement -buildmode=plugin for s390x

Simple change to allow plugins for linux on s390x

Change-Id: I5c262ab81aac10d1dcb03381a48e5b9694b7a87a
Reviewed-on: https://go-review.googlesource.com/37451
Run-TryBot: Michael Munday <munday@ca.ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
parent febafe60
......@@ -785,7 +785,7 @@ func (t *tester) supportedBuildmode(mode string) bool {
// linux-arm64 is missing because it causes the external linker
// to crash, see https://golang.org/issue/17138
switch pair {
case "linux-386", "linux-amd64", "linux-arm":
case "linux-386", "linux-amd64", "linux-arm", "linux-s390x":
return true
}
return false
......
......@@ -347,7 +347,7 @@ func BuildModeInit() {
codegenArg = "-fPIC"
} else {
switch platform {
case "linux/amd64", "linux/arm", "linux/arm64", "linux/386",
case "linux/amd64", "linux/arm", "linux/arm64", "linux/386", "linux/s390x",
"android/amd64", "android/arm", "android/arm64", "android/386":
default:
base.Fatalf("-buildmode=plugin not supported on %s\n", platform)
......
......@@ -84,7 +84,7 @@ func (mode *BuildMode) Set(s string) error {
switch obj.GOOS {
case "linux":
switch obj.GOARCH {
case "386", "amd64", "arm", "arm64":
case "386", "amd64", "arm", "arm64", "s390x":
default:
return badmode()
}
......
......@@ -52,7 +52,7 @@ func gentext(ctxt *ld.Link) {
return
}
addmoduledata := ctxt.Syms.Lookup("runtime.addmoduledata", 0)
if addmoduledata.Type == obj.STEXT {
if addmoduledata.Type == obj.STEXT && ld.Buildmode != ld.BuildmodePlugin {
// we're linking a module containing the runtime -> no need for
// an init function
return
......@@ -89,7 +89,9 @@ func gentext(ctxt *ld.Link) {
// undef (for debugging)
ld.Adduint32(ctxt, initfunc, 0)
if ld.Buildmode == ld.BuildmodePlugin {
ctxt.Textp = append(ctxt.Textp, addmoduledata)
}
ctxt.Textp = append(ctxt.Textp, initfunc)
initarray_entry := ctxt.Syms.Lookup("go.link.addmoduledatainit", 0)
initarray_entry.Attr |= ld.AttrLocal
......
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