From 4a5b99c3a81dab8f389123f6e53ad879bbf6ed42 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Tue, 24 Oct 2017 21:14:39 -0400 Subject: [PATCH] cmd/link: only adjust pagezero for iOS on darwin/arm64 MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The new pagezero_size introduced by CL 72730 breaks on 32-bit systems, since it is 2³². Restrict the change to darwin/arm64, since it is intended for iOS only. We could plausibly allow GOARCH=amd64 as well, but without a compelling reason, changing the zero page size doesn't seem worth the risk. Change-Id: I5d6adcbaff8d0e5b169ff13512f188332cc7ed9a Reviewed-on: https://go-review.googlesource.com/73250 Run-TryBot: Russ Cox Run-TryBot: David Crawshaw Reviewed-by: David Crawshaw --- src/cmd/link/internal/ld/lib.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/cmd/link/internal/ld/lib.go b/src/cmd/link/internal/ld/lib.go index 26ce209f1c..377b4a4df2 100644 --- a/src/cmd/link/internal/ld/lib.go +++ b/src/cmd/link/internal/ld/lib.go @@ -1105,10 +1105,13 @@ func (ctxt *Link) hostlink() { switch ctxt.BuildMode { case BuildModeExe: if ctxt.HeadType == objabi.Hdarwin { - // __PAGEZERO segment size determined empirically. - // XCode 9.0.1 successfully uploads an iOS app with this value. - // Also works for macOS apps. - argv = append(argv, "-Wl,-pagezero_size,100000000") + if ctxt.Arch.Family == sys.ARM64 { + // __PAGEZERO segment size determined empirically. + // XCode 9.0.1 successfully uploads an iOS app with this value. + argv = append(argv, "-Wl,-pagezero_size,100000000") + } else { + argv = append(argv, "-Wl,-pagezero_size,4000000") + } } case BuildModePIE: // ELF. -- 2.48.1