Skip to content

Commit 99dbeeb

Browse files
cherrymuibradfitz
authored andcommitted
[release-branch.go1.21] 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 (golang#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 golang#61229. For golang#62598. 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/+/527817
1 parent 9d6d233 commit 99dbeeb

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
@@ -1902,6 +1902,16 @@ func (ctxt *Link) hostlink() {
19021902
out = append(out[:i], out[i+len(noPieWarning):]...)
19031903
}
19041904
}
1905+
if ctxt.IsDarwin() {
1906+
const bindAtLoadWarning = "ld: warning: -bind_at_load is deprecated on macOS\n"
1907+
if i := bytes.Index(out, []byte(bindAtLoadWarning)); i >= 0 {
1908+
// -bind_at_load is deprecated with ld-prime, but needed for
1909+
// correctness with older versions of ld64. Swallow the warning.
1910+
// TODO: maybe pass -bind_at_load conditionally based on C
1911+
// linker version.
1912+
out = append(out[:i], out[i+len(bindAtLoadWarning):]...)
1913+
}
1914+
}
19051915
ctxt.Logf("%s", out)
19061916
}
19071917

0 commit comments

Comments
 (0)