aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/link/internal/ld/lib.go
diff options
context:
space:
mode:
authorCherry Mui <cherryyz@google.com>2024-10-22 12:02:02 -0400
committerCherry Mui <cherryyz@google.com>2024-10-24 19:25:58 +0000
commit15c558016088d6aaf103b4f0fd2b716a4573e5a2 (patch)
tree1bb0713193e2f379439fa1c004158a16e706750c /src/cmd/link/internal/ld/lib.go
parentc2b580a47467e6236f1b9f2f7f72e6ada3a79806 (diff)
downloadgo-15c558016088d6aaf103b4f0fd2b716a4573e5a2.tar.xz
cmd/link: don't pass --build-id if C linker doesn't support it
On Solaris the default (non-GNU) C linker doesn't support the --build-id flag (and I'm not aware of any alternative). So check that the linker supports the flag before passing it. Updates #41004, #63934. Cq-Include-Trybots: luci.golang.try:gotip-solaris-amd64 Change-Id: I4379e5bf6eb495154d663ac4ed802ecb11fcf91c Reviewed-on: https://go-review.googlesource.com/c/go/+/621639 Reviewed-by: Ian Lance Taylor <iant@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Diffstat (limited to 'src/cmd/link/internal/ld/lib.go')
-rw-r--r--src/cmd/link/internal/ld/lib.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cmd/link/internal/ld/lib.go b/src/cmd/link/internal/ld/lib.go
index a9eda54713..0c37a1dc1f 100644
--- a/src/cmd/link/internal/ld/lib.go
+++ b/src/cmd/link/internal/ld/lib.go
@@ -1701,7 +1701,7 @@ func (ctxt *Link) hostlink() {
argv = append(argv, "-fuse-ld="+altLinker)
}
- if ctxt.IsELF {
+ if ctxt.IsELF && linkerFlagSupported(ctxt.Arch, argv[0], "", "-Wl,--build-id=0x1234567890abcdef") { // Solaris ld doesn't support --build-id.
if len(buildinfo) > 0 {
argv = append(argv, fmt.Sprintf("-Wl,--build-id=0x%x", buildinfo))
} else if *flagHostBuildid == "none" {