mirror of https://github.com/golang/go.git
cmd/go: default to PIE linking on darwin/amd64
The recent version of darwin linker ld64 emits an warning about deprecation of the -no_pie flag. Further, the new darwin linker ld-prime ignores -no_pie flag and generates a PIE binary anyway. Switch to building PIE binaries by default. Updates #54482. Updates #61229. Change-Id: I81294dcd07a368a20e1349d56556ee2fdcb8df44 Reviewed-on: https://go-review.googlesource.com/c/go/+/461697 Run-TryBot: Cherry Mui <cherryyz@google.com> Reviewed-by: Than McIntosh <thanm@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
parent
74caf475e3
commit
f7b4f02ba0
|
|
@ -2,7 +2,7 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build !windows && !static && (!darwin || (!internal_pie && !arm64))
|
||||
//go:build !windows && !static && !(darwin && internal)
|
||||
|
||||
#include <stdint.h>
|
||||
#include <dlfcn.h>
|
||||
|
|
|
|||
|
|
@ -2,11 +2,10 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build !windows && !static && (!darwin || (!internal_pie && !arm64))
|
||||
//go:build !windows && !static && !(darwin && internal)
|
||||
|
||||
// Excluded in darwin internal linking PIE mode, as dynamic export is not
|
||||
// supported.
|
||||
// Excluded in internal linking mode on darwin/arm64, as it is always PIE.
|
||||
// Excluded in darwin internal linking PIE (which is the default) mode,
|
||||
// as dynamic export is not supported.
|
||||
|
||||
package cgotest
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build windows || static || (darwin && internal_pie) || (darwin && arm64)
|
||||
//go:build windows || static || (darwin && internal)
|
||||
|
||||
package cgotest
|
||||
|
||||
|
|
|
|||
|
|
@ -245,7 +245,7 @@ func DefaultPIE(goos, goarch string, isRace bool) bool {
|
|||
}
|
||||
return true
|
||||
case "darwin":
|
||||
return goarch == "arm64"
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue