Skip to content

Commit 040dbf9

Browse files
committed
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. For #61229. 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]>
1 parent 91bea5a commit 040dbf9

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

  • src/cmd/link/internal/ld

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1903,6 +1903,16 @@ func (ctxt *Link) hostlink() {
19031903
out = append(out[:i], out[i+len(noPieWarning):]...)
19041904
}
19051905
}
1906+
if ctxt.IsDarwin() {
1907+
const bindAtLoadWarning = "ld: warning: -bind_at_load is deprecated on macOS\n"
1908+
if i := bytes.Index(out, []byte(bindAtLoadWarning)); i >= 0 {
1909+
// -bind_at_load is deprecated with ld-prime, but needed for
1910+
// correctness with older versions of ld64. Swallow the warning.
1911+
// TODO: maybe pass -bind_at_load conditionally based on C
1912+
// linker version.
1913+
out = append(out[:i], out[i+len(bindAtLoadWarning):]...)
1914+
}
1915+
}
19061916
ctxt.Logf("%s", out)
19071917
}
19081918

0 commit comments

Comments
 (0)