]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
cmd/go: allow buildmode c-archive for gccgo on ppc64
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 3 Dec 2018 20:25:11 +0000 (20:25 +0000)
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 3 Dec 2018 20:25:11 +0000 (20:25 +0000)
    In buildmodeinit, the c-archive buildmode is flagged as invalid
    on linux/ppc64 for gccgo when it should be valid. This happens
    because the check against the gccgo flag is done after the checks
    for valid GOOS/GOARCH pairs instead of before as is done for all
    other buildmode cases in this switch. This corrects the problem and
    allows several of the gccgo gotools testcases to pass on linux/ppc64.

    Updates #29046

    Reviewed-on: https://go-review.googlesource.com/c/152137

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@266764 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/go/gofrontend/MERGE
libgo/go/cmd/go/internal/work/init.go

index 74806a23cbeedee124d53c8c2b98c778a90841a1..07381f423b21b16f01cc9078975812939cba3f89 100644 (file)
@@ -1,4 +1,4 @@
-a8f768d68760768da5e86a8e63ef1ad5691c3ae8
+9e016dfe198152f870005ac844fe22c02e5349e3
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
index de0cd4282b369761bd7e7e97ec16aa516a65a516..56f1ff229cb120597de61d870c280dd33059a7e1 100644 (file)
@@ -85,23 +85,24 @@ func buildModeInit() {
                pkgsFilter = pkgsNotMain
        case "c-archive":
                pkgsFilter = oneMainPkg
-               switch platform {
-               case "darwin/arm", "darwin/arm64":
-                       codegenArg = "-shared"
-               default:
-                       switch cfg.Goos {
-                       case "dragonfly", "freebsd", "linux", "netbsd", "openbsd", "solaris":
-                               if platform == "linux/ppc64" {
-                                       base.Fatalf("-buildmode=c-archive not supported on %s\n", platform)
-                               }
-                               // Use -shared so that the result is
-                               // suitable for inclusion in a PIE or
-                               // shared library.
-                               codegenArg = "-shared"
-                       }
-               }
                if gccgo {
                        codegenArg = "-fPIC"
+               } else {
+                       switch platform {
+                       case "darwin/arm", "darwin/arm64":
+                               codegenArg = "-shared"
+                       default:
+                               switch cfg.Goos {
+                               case "dragonfly", "freebsd", "linux", "netbsd", "openbsd", "solaris":
+                                       if platform == "linux/ppc64" {
+                                               base.Fatalf("-buildmode=c-archive not supported on %s\n", platform)
+                                       }
+                                       // Use -shared so that the result is
+                                       // suitable for inclusion in a PIE or
+                                       // shared library.
+                                       codegenArg = "-shared"
+                               }
+                       }
                }
                cfg.ExeSuffix = ".a"
                ldBuildmode = "c-archive"