aboutsummaryrefslogtreecommitdiff
path: root/src/cmd
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2026-03-11 12:52:44 -0400
committerGopher Robot <gobot@golang.org>2026-03-11 13:44:26 -0700
commit3d7681ebab6fca8f859d8fc7d6c02c90ef379c05 (patch)
treed651213fe0c096462d5845e404dc51b244381b46 /src/cmd
parenta8f99ef1f6e550d5d73e9c8f792337ad001bdcf4 (diff)
downloadgo-3d7681ebab6fca8f859d8fc7d6c02c90ef379c05.tar.xz
cmd/link: fix macOS 13 build
Write our own load command for macOS builds, to make sure we can put the versions in. Builds on older macOS were seeing an LC_VERSION_MIN instead and scribbling over fields that didn't exist. Fixes #78070. Change-Id: If338d0506b1156b133253e496f29818a29a22a91 Reviewed-on: https://go-review.googlesource.com/c/go/+/754241 Reviewed-by: Cherry Mui <cherryyz@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Russ Cox <rsc@golang.org>
Diffstat (limited to 'src/cmd')
-rw-r--r--src/cmd/link/internal/ld/macho.go9
1 files changed, 2 insertions, 7 deletions
diff --git a/src/cmd/link/internal/ld/macho.go b/src/cmd/link/internal/ld/macho.go
index 8090ee4d8e..5e7b5de781 100644
--- a/src/cmd/link/internal/ld/macho.go
+++ b/src/cmd/link/internal/ld/macho.go
@@ -461,14 +461,9 @@ func (ctxt *Link) domacho() {
if err != nil {
Exitf("%v", err)
}
- if load != nil {
- machoPlatform = load.platform
+ if load != nil && load.platform != PLATFORM_MACOS {
ml := newMachoLoad(ctxt.Arch, load.cmd.type_, uint32(len(load.cmd.data)))
copy(ml.data, load.cmd.data)
- if machoPlatform == PLATFORM_MACOS {
- ml.data[1] = macOS.version()
- ml.data[2] = macSDK.version()
- }
break
}
}
@@ -477,7 +472,7 @@ func (ctxt *Link) domacho() {
if buildcfg.GOOS == "ios" {
machoPlatform = PLATFORM_IOS
}
- if ctxt.LinkMode == LinkInternal && machoPlatform == PLATFORM_MACOS {
+ if load == nil && machoPlatform == PLATFORM_MACOS {
ml := newMachoLoad(ctxt.Arch, imacho.LC_BUILD_VERSION, 4)
ml.data[0] = uint32(machoPlatform)
ml.data[1] = macOS.version()