]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile, cmd/go: generate position independent code with -buildmode=c-shared...
authorMichael Hudson-Doyle <michael.hudson@canonical.com>
Tue, 1 Sep 2015 02:03:38 +0000 (14:03 +1200)
committerMichael Hudson-Doyle <michael.hudson@canonical.com>
Fri, 4 Sep 2015 07:08:09 +0000 (07:08 +0000)
All the code was there to do this, it just wasn't hooked up.

Fixes #10914

Change-Id: Ide8f9bbe50fecb5d11cd579915ee98d4c7efe403
Reviewed-on: https://go-review.googlesource.com/14142
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/cmd/compile/internal/gc/lex.go
src/cmd/go/build.go

index 09a44b28e6bba07f1e6896f93de01d9ab2d5a1ef..8e762d0ed3910d438484ecb9d4063fefe0e39077 100644 (file)
@@ -237,9 +237,11 @@ func Main() {
        obj.Flagcount("y", "debug declarations in canned imports (with -d)", &Debug['y'])
        var flag_shared int
        var flag_dynlink bool
+       if Thearch.Thechar == '6' || Thearch.Thechar == '5' {
+               obj.Flagcount("shared", "generate code that can be linked into a shared library", &flag_shared)
+       }
        if Thearch.Thechar == '6' {
                obj.Flagcount("largemodel", "generate code that assumes a large memory model", &flag_largemodel)
-               obj.Flagcount("shared", "generate code that can be linked into a shared library", &flag_shared)
                flag.BoolVar(&flag_dynlink, "dynlink", false, "support references to Go symbols defined in other shared libraries")
        }
        obj.Flagstr("cpuprofile", "write cpu profile to `file`", &cpuprofile)
index 0b147252ec1a4c04ad210f51d8d8ffa510adf483..df7433859380c0079b312468f6322aa843621680 100644 (file)
@@ -344,12 +344,9 @@ func buildModeInit() {
                        codegenArg = "-fPIC"
                } else {
                        switch platform {
-                       case "linux/amd64":
+                       case "linux/amd64", "linux/arm", "android/arm":
                                codegenArg = "-shared"
-                       case "linux/arm":
-                               buildAsmflags = append(buildAsmflags, "-shared")
                        case "darwin/amd64":
-                       case "android/arm":
                        default:
                                fatalf("-buildmode=c-shared not supported on %s\n", platform)
                        }