Skip to content

Commit d90a57f

Browse files
dmitshurgopherbot
authored andcommitted
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 <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Auto-Submit: Dmitri Shuralyov <[email protected]> Reviewed-by: Cherry Mui <[email protected]>
1 parent b19164d commit d90a57f

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -478,13 +478,11 @@ func (ctxt *Link) domacho() {
478478
if ctxt.LinkMode == LinkInternal && machoPlatform == PLATFORM_MACOS {
479479
var version uint32
480480
switch ctxt.Arch.Family {
481-
case sys.AMD64:
481+
case sys.ARM64, sys.AMD64:
482482
// This must be fairly recent for Apple signing (go.dev/issue/30488).
483483
// Having too old a version here was also implicated in some problems
484484
// calling into macOS libraries (go.dev/issue/56784).
485485
// In general this can be the most recent supported macOS version.
486-
version = 10<<16 | 13<<8 | 0<<0 // 10.13.0
487-
case sys.ARM64:
488486
version = 11<<16 | 0<<8 | 0<<0 // 11.0.0
489487
}
490488
ml := newMachoLoad(ctxt.Arch, LC_BUILD_VERSION, 4)

src/cmd/link/link_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -388,9 +388,9 @@ func TestMachOBuildVersion(t *testing.T) {
388388
found := false
389389
const LC_BUILD_VERSION = 0x32
390390
checkMin := func(ver uint32) {
391-
major, minor := (ver>>16)&0xff, (ver>>8)&0xff
392-
if major != 10 || minor < 9 {
393-
t.Errorf("LC_BUILD_VERSION version %d.%d < 10.9", major, minor)
391+
major, minor, patch := (ver>>16)&0xff, (ver>>8)&0xff, (ver>>0)&0xff
392+
if major < 11 {
393+
t.Errorf("LC_BUILD_VERSION version %d.%d.%d < 11.0.0", major, minor, patch)
394394
}
395395
}
396396
for _, cmd := range exem.Loads {

0 commit comments

Comments
 (0)