aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCherry Mui <cherryyz@google.com>2022-09-14 21:01:04 -0400
committerCherry Mui <cherryyz@google.com>2022-09-21 21:01:20 +0000
commit2b9596cb9b2726efa3c5fb0717f117ae10e8b9f6 (patch)
tree6aaf337b329c700705c10ce093c9bd33260ec8aa
parentc8e1cf49d187e9749e4dfbed5bd81d8b9b3c3307 (diff)
downloadgo-2b9596cb9b2726efa3c5fb0717f117ae10e8b9f6.tar.gz
go-2b9596cb9b2726efa3c5fb0717f117ae10e8b9f6.zip
[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 <cherryyz@google.com> Reviewed-by: Than McIntosh <thanm@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> (cherry picked from commit 706d84fca2b36fdf670a0d921e6a8a3b481eaa05) Reviewed-on: https://go-review.googlesource.com/c/go/+/431518 Reviewed-by: Austin Clements <austin@google.com>
-rw-r--r--src/cmd/link/internal/ld/lib.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/cmd/link/internal/ld/lib.go b/src/cmd/link/internal/ld/lib.go
index 5fb0b3d21f..239e2dd4ef 100644
--- a/src/cmd/link/internal/ld/lib.go
+++ b/src/cmd/link/internal/ld/lib.go
@@ -1659,6 +1659,13 @@ func (ctxt *Link) hostlink() {
if len(out) > 0 {
// always print external output even if the command is successful, so that we don't
// swallow linker warnings (see https://golang.org/issue/17935).
+ if ctxt.IsDarwin() && ctxt.IsAMD64() {
+ const noPieWarning = "ld: warning: -no_pie is deprecated when targeting new OS versions\n"
+ if i := bytes.Index(out, []byte(noPieWarning)); i >= 0 {
+ // swallow -no_pie deprecation warning, issue 54482
+ out = append(out[:i], out[i+len(noPieWarning):]...)
+ }
+ }
ctxt.Logf("%s", out)
}