]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
cmd/go: pass -X64 to ar on aix/ppc64
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 5 Mar 2019 22:40:21 +0000 (22:40 +0000)
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 5 Mar 2019 22:40:21 +0000 (22:40 +0000)
    On aix/ppc64, ar tool must always have -X64 argument if it aims to
    create 64 bits archives.

    Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/165317

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

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

index b80033039df30be110ec4ba0365e98fb98331746..3315957aea5496f1455d9509e0bc518a8004f4b4 100644 (file)
@@ -1,4 +1,4 @@
-3ae3024cae07fe7e85968ad2583add350616b296
+14e48e756af205a68374c872f3bd03d62ccd70bb
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
index cb7d560f5cffa0c1553d51946e2be5197fd6cf7e..a0eb2d3a8605c5e89fbb209fd478d47bcae752de 100644 (file)
@@ -278,6 +278,13 @@ func (tools gccgoToolchain) link(b *Builder, root *Action, out, importcfg string
                return 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.
+               arArgs = []string{"-X64"}
+       }
+
        newID := 0
        readAndRemoveCgoFlags := func(archive string) (string, error) {
                newID++
@@ -293,11 +300,11 @@ func (tools gccgoToolchain) link(b *Builder, root *Action, out, importcfg string
                        b.Showcmd("", "ar d %s _cgo_flags", newArchive)
                        return "", nil
                }
-               err := b.run(root, root.Objdir, desc, nil, tools.ar(), "x", newArchive, "_cgo_flags")
+               err := b.run(root, root.Objdir, desc, nil, tools.ar(), arArgs, "x", newArchive, "_cgo_flags")
                if err != nil {
                        return "", err
                }
-               err = b.run(root, ".", desc, nil, tools.ar(), "d", newArchive, "_cgo_flags")
+               err = b.run(root, ".", desc, nil, tools.ar(), arArgs, "d", newArchive, "_cgo_flags")
                if err != nil {
                        return "", err
                }
@@ -516,7 +523,7 @@ func (tools gccgoToolchain) link(b *Builder, root *Action, out, importcfg string
 
        switch buildmode {
        case "c-archive":
-               if err := b.run(root, ".", desc, nil, tools.ar(), "rc", realOut, out); err != nil {
+               if err := b.run(root, ".", desc, nil, tools.ar(), arArgs, "rc", realOut, out); err != nil {
                        return err
                }
        }