diff mbox series

libgo patch committed: Restore passing D to ar

Message ID CAOyqgcUVKFEq1aOEe8y5JPHfgkq63s2wxOorCq96rLU6xynYYw@mail.gmail.com
State New
Headers show
Series libgo patch committed: Restore passing D to ar | expand

Commit Message

Ian Lance Taylor March 1, 2019, 10:22 p.m. UTC
In the update of libgo to Go1.12beta2 I accidentally lost the code
that passes D to the ar program.  This patch restores it.
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 269315)
+++ gcc/go/gofrontend/MERGE	(working copy)
@@ -1,4 +1,4 @@ 
-805c82cc141c593ea2f27d8614ecd204e2b5e76e
+a72eca1f435002076655fd6a54ce869ac39856dc
 
 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 269299)
+++ libgo/go/cmd/go/internal/work/gccgo.go	(working copy)
@@ -205,11 +205,14 @@  func (tools gccgoToolchain) pack(b *Buil
 	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.
 		arArgs = []string{"-X64"}
 	}
-
-	return b.run(a, p.Dir, p.ImportPath, nil, tools.ar(), arArgs, "rc", mkAbs(objdir, afile), absOfiles)
+	absAfile := mkAbs(objdir, afile)
+	// Try with D modifier first, then without if that fails.
+	if b.run(a, p.Dir, p.ImportPath, nil, tools.ar(), arArgs, "rcD", absAfile, absOfiles) != nil {
+		return b.run(a, p.Dir, p.ImportPath, nil, tools.ar(), arArgs, "rc", absAfile, absOfiles)
+	}
+	return nil
 }
 
 func (tools gccgoToolchain) link(b *Builder, root *Action, out, importcfg string, allactions []*Action, buildmode, desc string) error {