diff mbox series

libgo patch committed: suppress "ar rcD" and "-zdefs" on AIX

Message ID CAOyqgcWDO2gipCLLsrrTp32=1QHbMRf_jedNS6=-29jUUQRkAg@mail.gmail.com
State New
Headers show
Series libgo patch committed: suppress "ar rcD" and "-zdefs" on AIX | expand

Commit Message

Ian Lance Taylor April 17, 2018, 8:10 p.m. UTC
This patch by Tony Reix fixes invocations of ar and ld on AIX.
Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu.  Committed
to mainline.

Ian
diff mbox series

Patch

Index: gcc/go/gofrontend/MERGE
===================================================================
--- gcc/go/gofrontend/MERGE	(revision 259359)
+++ gcc/go/gofrontend/MERGE	(working copy)
@@ -1,4 +1,4 @@ 
-3aa5fc91094c5f24b26747ec176ad44cde784fc7
+2c7093358e5f5ebeb102d44d1036ca0a807d46a5
 
 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/gccgo.go
===================================================================
--- libgo/go/cmd/go/internal/work/gccgo.go	(revision 259359)
+++ libgo/go/cmd/go/internal/work/gccgo.go	(working copy)
@@ -190,15 +190,15 @@  func (gccgoToolchain) pack(b *Builder, a
 	}
 	absAfile := mkAbs(objdir, afile)
 	// Try with D modifier first, then without if that fails.
-	if b.run(a, p.Dir, p.ImportPath, nil, "ar", "rcD", absAfile, absOfiles) != nil {
+	if cfg.Goos == "aix" || b.run(a, p.Dir, p.ImportPath, nil, "ar", "rcD", absAfile, absOfiles) != nil {
+		var arArgs []string
 		if cfg.Goos == "aix" && cfg.Goarch == "ppc64" {
 			// AIX puts both 32-bit and 64-bit objects in the same archive.
 			// Tell the AIX "ar" command to only care about 64-bit objects.
 			// AIX "ar" command does not know D option.
-			return b.run(a, p.Dir, p.ImportPath, nil, "ar", "-X64", "rc", absAfile, absOfiles)
-		} else {
-			return b.run(a, p.Dir, p.ImportPath, nil, "ar", "rc", absAfile, absOfiles)
+			arArgs = append(arArgs, "-X64")
 		}
+		return b.run(a, p.Dir, p.ImportPath, nil, "ar", "rc", arArgs, absAfile, absOfiles)
 	}
 	return nil
 }
@@ -466,7 +466,10 @@  func (tools gccgoToolchain) link(b *Buil
 		ldflags = append(ldflags, goLibBegin...)
 		ldflags = append(ldflags, "-lgo", "-lgcc_s", "-lgcc", "-lc", "-lgcc")
 	case "shared":
-		ldflags = append(ldflags, "-zdefs", "-shared", "-nostdlib", "-lgo", "-lgcc_s", "-lgcc", "-lc")
+		if cfg.Goos != "aix" {
+			ldflags = append(ldflags, "-zdefs")
+		}
+		ldflags = append(ldflags, "-shared", "-nostdlib", "-lgo", "-lgcc_s", "-lgcc", "-lc")
 
 	case "pie":
 		ldflags = append(ldflags, "-pie")