diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2017-11-23 00:24:21 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2017-11-23 00:24:21 +0000 |
commit | 02dc624e21bad3e1080d11b466ec0a927489330c (patch) | |
tree | 1eb5e5702855281ed05d4fca66ee5d21676dbc10 | |
parent | f6f28ab80749be4d221fc866e5b92c0265725cc4 (diff) | |
download | gcc-02dc624e21bad3e1080d11b466ec0a927489330c.zip gcc-02dc624e21bad3e1080d11b466ec0a927489330c.tar.gz gcc-02dc624e21bad3e1080d11b466ec0a927489330c.tar.bz2 |
cmd/go, go/internal/gccgoimporter: pass -X to ar on AIX
Reviewed-on: https://go-review.googlesource.com/72930
From-SVN: r255090
-rw-r--r-- | gcc/go/gofrontend/MERGE | 2 | ||||
-rw-r--r-- | libgo/go/cmd/go/internal/work/build.go | 9 | ||||
-rw-r--r-- | libgo/go/go/internal/gccgoimporter/importer.go | 6 |
3 files changed, 13 insertions, 4 deletions
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index 0bd1dab..8141a4e 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -1db7dc97d01ee230ff4874ce1c9775a24ffd16ac +57adb928c3cc61ac8fa47554394670a1c455afc2 The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/libgo/go/cmd/go/internal/work/build.go b/libgo/go/cmd/go/internal/work/build.go index 562730b..75f3c1a 100644 --- a/libgo/go/cmd/go/internal/work/build.go +++ b/libgo/go/cmd/go/internal/work/build.go @@ -2757,7 +2757,14 @@ func (gccgoToolchain) pack(b *Builder, p *load.Package, objDir, afile string, of absAfile := mkAbs(objDir, afile) // Try with D modifier first, then without if that fails. if b.run(p.Dir, p.ImportPath, nil, "ar", "rcD", absAfile, absOfiles) != nil { - return b.run(p.Dir, p.ImportPath, nil, "ar", "rc", absAfile, absOfiles) + 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(p.Dir, p.ImportPath, nil, "ar", "-X64", "rc", absAfile, absOfiles) + } else { + return b.run(p.Dir, p.ImportPath, nil, "ar", "rc", absAfile, absOfiles) + } } return nil } diff --git a/libgo/go/go/internal/gccgoimporter/importer.go b/libgo/go/go/internal/gccgoimporter/importer.go index ee573ff..923f368 100644 --- a/libgo/go/go/internal/gccgoimporter/importer.go +++ b/libgo/go/go/internal/gccgoimporter/importer.go @@ -104,12 +104,14 @@ func openExportFile(fpath string) (reader io.ReadSeeker, closer io.Closer, err e // TODO(pcc): Read the archive directly instead of using "ar". f.Close() closer = nil + var cmd *exec.Cmd - cmd := exec.Command("ar", "p", fpath) if runtime.GOOS == "aix" && runtime.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. - cmd.Env = append(os.Environ(), "OBJECT_MODE=64") + cmd = exec.Command("ar", "-X64", "p", fpath) + } else { + cmd = exec.Command("ar", "p", fpath) } var out []byte out, err = cmd.Output() |