Skip to content

Commit 83dce45

Browse files
committed
[release-branch.go1.20] cmd/link: suppress -bind_at_load deprecation warning for ld-prime
ld-prime emits a deprecation warning for -bind_at_load. The flag is needed for plugins to not deadlock (#38824) when linking with older darwin linker. It is supposedly not needed with newer linker when chained fixups are used. For now, we always pass it, and suppress the warning. Updates #61229. For #62597. Change-Id: I4b8a6f864a460c40dc38adbb533f664f7fd5343c Reviewed-on: https://go-review.googlesource.com/c/go/+/508696 Reviewed-by: Than McIntosh <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Run-TryBot: Cherry Mui <[email protected]> (cherry picked from commit 040dbf9) Reviewed-on: https://go-review.googlesource.com/c/go/+/527798
1 parent 08c544d commit 83dce45

File tree

1 file changed

+10
-0
lines changed
  • src/cmd/link/internal/ld

1 file changed

+10
-0
lines changed

src/cmd/link/internal/ld/lib.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1842,6 +1842,16 @@ func (ctxt *Link) hostlink() {
18421842
out = append(out[:i], out[i+len(noPieWarning):]...)
18431843
}
18441844
}
1845+
if ctxt.IsDarwin() {
1846+
const bindAtLoadWarning = "ld: warning: -bind_at_load is deprecated on macOS\n"
1847+
if i := bytes.Index(out, []byte(bindAtLoadWarning)); i >= 0 {
1848+
// -bind_at_load is deprecated with ld-prime, but needed for
1849+
// correctness with older versions of ld64. Swallow the warning.
1850+
// TODO: maybe pass -bind_at_load conditionally based on C
1851+
// linker version.
1852+
out = append(out[:i], out[i+len(bindAtLoadWarning):]...)
1853+
}
1854+
}
18451855
ctxt.Logf("%s", out)
18461856
}
18471857

0 commit comments

Comments
 (0)