]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: default to PIE linking on darwin/amd64
authorCherry Mui <cherryyz@google.com>
Fri, 16 Sep 2022 22:10:56 +0000 (18:10 -0400)
committerCherry Mui <cherryyz@google.com>
Fri, 4 Aug 2023 15:41:19 +0000 (15:41 +0000)
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>

src/cmd/cgo/internal/test/issue4029.c
src/cmd/cgo/internal/test/issue4029.go
src/cmd/cgo/internal/test/issue4029w.go
src/internal/platform/supported.go

index 212d6922f8d562c00de87b57f947259895416824..7a8fdc11b48c770a75bae61d6c2bfc66df920552 100644 (file)
@@ -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>
index 686b7679f33a1bc14803a365406a1ffa8f370ee6..506c999bdb4984627e752beaf87d1bd12bfd6594 100644 (file)
@@ -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
 
index 91dad6abcb762734c6c5f18964a55d5bf505015a..aa4c2f59bd9be0d5b5361875e01562edef901d9c 100644 (file)
@@ -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
 
index 230a952d2dcd32811736a06a829169b2fba51826..7fc3bfd25d71c0aabe3c6aed015c1899b12feb36 100644 (file)
@@ -245,7 +245,7 @@ func DefaultPIE(goos, goarch string, isRace bool) bool {
                }
                return true
        case "darwin":
-               return goarch == "arm64"
+               return true
        }
        return false
 }