aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDmitri Shuralyov <dmitshur@golang.org>2024-02-14 11:52:22 -0500
committerGopher Robot <gobot@golang.org>2024-02-14 20:25:19 +0000
commitd90a57ffe8ad8f3cb0137822a768ae48cf80a09d (patch)
tree3655e196f50674029c168ceb37a3dda127ce1330 /src
parentb19164d5b4278b1e27fd0bd43011c6d05f9b8047 (diff)
downloadgo-d90a57ffe8ad8f3cb0137822a768ae48cf80a09d.tar.xz
cmd/link/internal/ld: unify OS/SDK versions for macOS linking
Go 1.23 will require macOS 11 Big Sur or later, even on AMD64. The comment here suggests the main requirement for the OS and SDK version is to be recent enough not to break Apple signing, and recent enough not to cause other problems. For now, this CL simplifies the code by merging the ARM64 and AMD64 cases into one, given 1.23 will be the first Go release with a common minimum macOS version for both architectures so there's no need to treat them separately here. For #64207. Change-Id: I821fcb9a2a316de0703833c8a75abcbaa10b17a3 Cq-Include-Trybots: luci.golang.try:gotip-darwin-amd64_11,gotip-darwin-amd64_14,gotip-darwin-arm64_11,gotip-darwin-arm64_13 Reviewed-on: https://go-review.googlesource.com/c/go/+/563857 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/cmd/link/internal/ld/macho.go4
-rw-r--r--src/cmd/link/link_test.go6
2 files changed, 4 insertions, 6 deletions
diff --git a/src/cmd/link/internal/ld/macho.go b/src/cmd/link/internal/ld/macho.go
index fc38b0d99d..91e908c97f 100644
--- a/src/cmd/link/internal/ld/macho.go
+++ b/src/cmd/link/internal/ld/macho.go
@@ -478,13 +478,11 @@ func (ctxt *Link) domacho() {
if ctxt.LinkMode == LinkInternal && machoPlatform == PLATFORM_MACOS {
var version uint32
switch ctxt.Arch.Family {
- case sys.AMD64:
+ case sys.ARM64, sys.AMD64:
// This must be fairly recent for Apple signing (go.dev/issue/30488).
// Having too old a version here was also implicated in some problems
// calling into macOS libraries (go.dev/issue/56784).
// In general this can be the most recent supported macOS version.
- version = 10<<16 | 13<<8 | 0<<0 // 10.13.0
- case sys.ARM64:
version = 11<<16 | 0<<8 | 0<<0 // 11.0.0
}
ml := newMachoLoad(ctxt.Arch, LC_BUILD_VERSION, 4)
diff --git a/src/cmd/link/link_test.go b/src/cmd/link/link_test.go
index 897607c4fa..7029d3213f 100644
--- a/src/cmd/link/link_test.go
+++ b/src/cmd/link/link_test.go
@@ -388,9 +388,9 @@ func TestMachOBuildVersion(t *testing.T) {
found := false
const LC_BUILD_VERSION = 0x32
checkMin := func(ver uint32) {
- major, minor := (ver>>16)&0xff, (ver>>8)&0xff
- if major != 10 || minor < 9 {
- t.Errorf("LC_BUILD_VERSION version %d.%d < 10.9", major, minor)
+ major, minor, patch := (ver>>16)&0xff, (ver>>8)&0xff, (ver>>0)&0xff
+ if major < 11 {
+ t.Errorf("LC_BUILD_VERSION version %d.%d.%d < 11.0.0", major, minor, patch)
}
}
for _, cmd := range exem.Loads {