public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* libgo patch committed: Allow buildmode c-archive on ppc64
@ 2018-12-03 20:25 Ian Lance Taylor
  0 siblings, 0 replies; only message in thread
From: Ian Lance Taylor @ 2018-12-03 20:25 UTC (permalink / raw)
  To: gcc-patches, gofrontend-dev

[-- Attachment #1: Type: text/plain, Size: 637 bytes --]

This libgo patch by Lynn Boger changes the go tool to allow buildmode
c-archive for gccgo on ppc64.  In buildmodeinit, the c-archive
buildmode is flagged as invalid on GNU/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 GNU/Linux ppc64.  This is for https://golang.org/issue/29046.
Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu.  Committed
to mainline.

Ian

[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 1795 bytes --]

Index: gcc/go/gofrontend/MERGE
===================================================================
--- gcc/go/gofrontend/MERGE	(revision 266573)
+++ gcc/go/gofrontend/MERGE	(working copy)
@@ -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: libgo/go/cmd/go/internal/work/init.go
===================================================================
--- libgo/go/cmd/go/internal/work/init.go	(revision 266510)
+++ libgo/go/cmd/go/internal/work/init.go	(working copy)
@@ -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"

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-12-03 20:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-03 20:25 libgo patch committed: Allow buildmode c-archive on ppc64 Ian Lance Taylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).