]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: implement -buildmode=plugin for s390x
authorBill O'Farrell <billo@ca.ibm.com>
Fri, 24 Feb 2017 22:03:06 +0000 (17:03 -0500)
committerMichael Munday <munday@ca.ibm.com>
Sat, 25 Feb 2017 14:31:10 +0000 (14:31 +0000)
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: Brad Fitzpatrick <bradfitz@golang.org>
src/cmd/dist/test.go
src/cmd/go/internal/work/build.go
src/cmd/link/internal/ld/config.go
src/cmd/link/internal/s390x/asm.go

index fd011e11935b2b16600a95f3caf0834fa37084c7..ef884625a61e2730517c1baa715153ef97f48e6a 100644 (file)
@@ -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
index e02b5f9025fb7d41ab3c313446b0565850d5c98b..060fbd419da1840aab9898961a49fba3691a533a 100644 (file)
@@ -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)
index 2656c243174384876c921757a36471b7fb2b29f2..fd9119bcaae4e78162ebb5672aa76b1d6b0358be 100644 (file)
@@ -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()
                        }
index 4a5f48c6f0f2df5454675388e8fe5e5eb180127e..a9bb26145b9ce114903712217d6ad159485d2e13 100644 (file)
@@ -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