Skip to content

Commit

Permalink
[release-branch.go1.21] cmd/link: suppress -bind_at_load deprecation …
Browse files Browse the repository at this point in the history
…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 #62598.

Change-Id: I4b8a6f864a460c40dc38adbb533f664f7fd5343c
Reviewed-on: https://go-review.googlesource.com/c/go/+/508696
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cherry Mui <cherryyz@google.com>
(cherry picked from commit 040dbf9)
Reviewed-on: https://go-review.googlesource.com/c/go/+/527817
  • Loading branch information
cherrymui committed Sep 21, 2023
1 parent 9bec49c commit fc57cc3
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/cmd/link/internal/ld/lib.go
Expand Up @@ -1902,6 +1902,16 @@ func (ctxt *Link) hostlink() {
out = append(out[:i], out[i+len(noPieWarning):]...)
}
}
if ctxt.IsDarwin() {
const bindAtLoadWarning = "ld: warning: -bind_at_load is deprecated on macOS\n"
if i := bytes.Index(out, []byte(bindAtLoadWarning)); i >= 0 {
// -bind_at_load is deprecated with ld-prime, but needed for
// correctness with older versions of ld64. Swallow the warning.
// TODO: maybe pass -bind_at_load conditionally based on C
// linker version.
out = append(out[:i], out[i+len(bindAtLoadWarning):]...)
}
}
ctxt.Logf("%s", out)
}

Expand Down

0 comments on commit fc57cc3

Please sign in to comment.