From: Clément Chigot Date: Tue, 9 Nov 2021 09:01:05 +0000 (+0100) Subject: cmd/link: fix GCC startfiles names on AIX X-Git-Tag: go1.18beta1~433 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=01103d533a086afd6c06f3eec5057d46f117d2ff;p=gostls13.git cmd/link: fix GCC startfiles names on AIX Since GCC version 11, the 64-bit version of GCC starting files are now suffixed by "_64" instead of being stored without suffix under "ppc64" multilib directory. Change-Id: Ibe53521ed24d36e5f6282e3574849b9ae11a1e9a Reviewed-on: https://go-review.googlesource.com/c/go/+/362594 Reviewed-by: Cherry Mui Run-TryBot: Cherry Mui TryBot-Result: Go Bot Trust: Ian Lance Taylor --- diff --git a/src/cmd/link/internal/ld/lib.go b/src/cmd/link/internal/ld/lib.go index 01ab6474b8..91665b2ebb 100644 --- a/src/cmd/link/internal/ld/lib.go +++ b/src/cmd/link/internal/ld/lib.go @@ -1499,8 +1499,19 @@ func (ctxt *Link) hostlink() { } return strings.Trim(string(out), "\n") } - argv = append(argv, getPathFile("crtcxa.o")) - argv = append(argv, getPathFile("crtdbase.o")) + // Since GCC version 11, the 64-bit version of GCC starting files + // are now suffixed by "_64". Even under "-maix64" multilib directory + // "crtcxa.o" is 32-bit. + crtcxa := getPathFile("crtcxa_64.o") + if !filepath.IsAbs(crtcxa) { + crtcxa = getPathFile("crtcxa.o") + } + crtdbase := getPathFile("crtdbase_64.o") + if !filepath.IsAbs(crtdbase) { + crtdbase = getPathFile("crtdbase.o") + } + argv = append(argv, crtcxa) + argv = append(argv, crtdbase) } if ctxt.linkShared {