Skip to content

Commit 2b9596c

Browse files
committed
[release-branch.go1.18] cmd/link: suppress -no_pie deprecation warning on darwin
Apparently the new darwin linker starts to emit a warning about -no_pie deprecation. Maybe we want to switch to PIE by default. For now, suppress the warning. This also makes it easier for backporting to previous releases. Fixes #55113. Updates #55112, #54482. Change-Id: I1a3b74c237a9d00ec3b030fc3a9940a31e5cd37e Reviewed-on: https://go-review.googlesource.com/c/go/+/430937 Run-TryBot: Cherry Mui <[email protected]> Reviewed-by: Than McIntosh <[email protected]> TryBot-Result: Gopher Robot <[email protected]> (cherry picked from commit 706d84f) Reviewed-on: https://go-review.googlesource.com/c/go/+/431518 Reviewed-by: Austin Clements <[email protected]>
1 parent c8e1cf4 commit 2b9596c

File tree

1 file changed

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

1 file changed

+7
-0
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1659,6 +1659,13 @@ func (ctxt *Link) hostlink() {
16591659
if len(out) > 0 {
16601660
// always print external output even if the command is successful, so that we don't
16611661
// swallow linker warnings (see https://golang.org/issue/17935).
1662+
if ctxt.IsDarwin() && ctxt.IsAMD64() {
1663+
const noPieWarning = "ld: warning: -no_pie is deprecated when targeting new OS versions\n"
1664+
if i := bytes.Index(out, []byte(noPieWarning)); i >= 0 {
1665+
// swallow -no_pie deprecation warning, issue 54482
1666+
out = append(out[:i], out[i+len(noPieWarning):]...)
1667+
}
1668+
}
16621669
ctxt.Logf("%s", out)
16631670
}
16641671

0 commit comments

Comments
 (0)