Skip to content

Commit f7e6ab4

Browse files
committed
all: remove scattered remnants of darwin/arm
This removes all conditions and conditional code (that I could find) that depended on darwin/arm. Fixes #35439 (since that only happened on darwin/arm) Fixes #37611. Change-Id: Ia4c32a5a4368ed75231075832b0b5bfb1ad11986 Reviewed-on: https://go-review.googlesource.com/c/go/+/227198 Run-TryBot: Austin Clements <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Cherry Zhang <[email protected]>
1 parent da8591b commit f7e6ab4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+81
-174
lines changed

Diff for: misc/cgo/test/pkg_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ func TestCrossPackageTests(t *testing.T) {
3232
t.Skip("Can't exec cmd/go subprocess on Android.")
3333
case "darwin":
3434
switch runtime.GOARCH {
35-
case "arm", "arm64":
35+
case "arm64":
3636
t.Skip("Can't exec cmd/go subprocess on iOS.")
3737
}
3838
}

Diff for: misc/cgo/test/sigaltstack.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ import (
6262

6363
func testSigaltstack(t *testing.T) {
6464
switch {
65-
case runtime.GOOS == "solaris", runtime.GOOS == "illumos", runtime.GOOS == "darwin" && (runtime.GOARCH == "arm" || runtime.GOARCH == "arm64"):
65+
case runtime.GOOS == "solaris", runtime.GOOS == "illumos", runtime.GOOS == "darwin" && runtime.GOARCH == "arm64":
6666
t.Skipf("switching signal stack not implemented on %s/%s", runtime.GOOS, runtime.GOARCH)
6767
case runtime.GOOS == "darwin" && runtime.GOARCH == "386":
6868
t.Skipf("sigaltstack fails on darwin/386")

Diff for: misc/cgo/test/testx.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ func Add(x int) {
159159
}
160160

161161
func testCthread(t *testing.T) {
162-
if runtime.GOOS == "darwin" && (runtime.GOARCH == "arm" || runtime.GOARCH == "arm64") {
162+
if runtime.GOOS == "darwin" && runtime.GOARCH == "arm64" {
163163
t.Skip("the iOS exec wrapper is unable to properly handle the panic from Add")
164164
}
165165
sum.i = 0

Diff for: misc/cgo/testcarchive/carchive_test.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ func testMain(m *testing.M) int {
134134
} else {
135135
switch GOOS {
136136
case "darwin":
137-
if GOARCH == "arm" || GOARCH == "arm64" {
137+
if GOARCH == "arm64" {
138138
libbase += "_shared"
139139
}
140140
case "dragonfly", "freebsd", "linux", "netbsd", "openbsd", "solaris", "illumos":
@@ -305,7 +305,7 @@ func TestEarlySignalHandler(t *testing.T) {
305305
switch GOOS {
306306
case "darwin":
307307
switch GOARCH {
308-
case "arm", "arm64":
308+
case "arm64":
309309
t.Skipf("skipping on %s/%s; see https://golang.org/issue/13701", GOOS, GOARCH)
310310
}
311311
case "windows":
@@ -487,7 +487,7 @@ func checkSignalForwardingTest(t *testing.T) {
487487
switch GOOS {
488488
case "darwin":
489489
switch GOARCH {
490-
case "arm", "arm64":
490+
case "arm64":
491491
t.Skipf("skipping on %s/%s; see https://golang.org/issue/13701", GOOS, GOARCH)
492492
}
493493
case "windows":
@@ -603,7 +603,7 @@ func TestExtar(t *testing.T) {
603603
if runtime.Compiler == "gccgo" {
604604
t.Skip("skipping -extar test when using gccgo")
605605
}
606-
if runtime.GOOS == "darwin" && (runtime.GOARCH == "arm" || runtime.GOARCH == "arm64") {
606+
if runtime.GOOS == "darwin" && runtime.GOARCH == "arm64" {
607607
t.Skip("shell scripts are not executable on iOS hosts")
608608
}
609609

Diff for: misc/cgo/testcshared/cshared_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ func testMain(m *testing.M) int {
108108
libgodir := GOOS + "_" + GOARCH
109109
switch GOOS {
110110
case "darwin":
111-
if GOARCH == "arm" || GOARCH == "arm64" {
111+
if GOARCH == "arm64" {
112112
libgodir += "_shared"
113113
}
114114
case "dragonfly", "freebsd", "linux", "netbsd", "openbsd", "solaris", "illumos":

Diff for: misc/cgo/testso/so_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import (
2020
func requireTestSOSupported(t *testing.T) {
2121
t.Helper()
2222
switch runtime.GOARCH {
23-
case "arm", "arm64":
23+
case "arm64":
2424
if runtime.GOOS == "darwin" {
2525
t.Skip("No exec facility on iOS.")
2626
}

Diff for: misc/cgo/testsovar/so_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import (
2020
func requireTestSOSupported(t *testing.T) {
2121
t.Helper()
2222
switch runtime.GOARCH {
23-
case "arm", "arm64":
23+
case "arm64":
2424
if runtime.GOOS == "darwin" {
2525
t.Skip("No exec facility on iOS.")
2626
}

Diff for: misc/ios/clangwrap.sh

+1-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ export IPHONEOS_DEPLOYMENT_TARGET=5.1
88
# cmd/cgo doesn't support llvm-gcc-4.2, so we have to use clang.
99
CLANG=`xcrun --sdk $SDK --find clang`
1010

11-
if [ "$GOARCH" == "arm" ]; then
12-
CLANGARCH="armv7"
13-
elif [ "$GOARCH" == "arm64" ]; then
11+
if [ "$GOARCH" == "arm64" ]; then
1412
CLANGARCH="arm64"
1513
else
1614
echo "unknown GOARCH=$GOARCH" >&2

Diff for: src/buildall.bash

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ gettargets() {
4242
}
4343

4444
selectedtargets() {
45-
gettargets | egrep -v 'android-arm|darwin-arm' | egrep "$pattern"
45+
gettargets | egrep -v 'android-arm|darwin-arm64' | egrep "$pattern"
4646
}
4747

4848
# put linux first in the target list to get all the architectures up front.

Diff for: src/cmd/dist/build.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -1461,8 +1461,8 @@ func wrapperPathFor(goos, goarch string) string {
14611461
if gohostos != "android" {
14621462
return pathf("%s/misc/android/go_android_exec.go", goroot)
14631463
}
1464-
case goos == "darwin" && (goarch == "arm" || goarch == "arm64"):
1465-
if gohostos != "darwin" || (gohostarch != "arm" && gohostarch != "arm64") {
1464+
case goos == "darwin" && goarch == "arm64":
1465+
if gohostos != "darwin" || gohostarch != "arm64" {
14661466
return pathf("%s/misc/ios/go_darwin_arm_exec.go", goroot)
14671467
}
14681468
}

Diff for: src/cmd/dist/test.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -887,7 +887,7 @@ func (t *tester) addCmd(dt *distTest, dir string, cmdline ...interface{}) *exec.
887887
}
888888

889889
func (t *tester) iOS() bool {
890-
return goos == "darwin" && (goarch == "arm" || goarch == "arm64")
890+
return goos == "darwin" && goarch == "arm64"
891891
}
892892

893893
func (t *tester) out(v string) {
@@ -902,7 +902,7 @@ func (t *tester) extLink() bool {
902902
switch pair {
903903
case "aix-ppc64",
904904
"android-arm", "android-arm64",
905-
"darwin-386", "darwin-amd64", "darwin-arm", "darwin-arm64",
905+
"darwin-386", "darwin-amd64", "darwin-arm64",
906906
"dragonfly-amd64",
907907
"freebsd-386", "freebsd-amd64", "freebsd-arm",
908908
"linux-386", "linux-amd64", "linux-arm", "linux-arm64", "linux-ppc64le", "linux-mips64", "linux-mips64le", "linux-mips", "linux-mipsle", "linux-s390x",
@@ -927,7 +927,7 @@ func (t *tester) internalLink() bool {
927927
if goos == "android" {
928928
return false
929929
}
930-
if goos == "darwin" && (goarch == "arm" || goarch == "arm64") {
930+
if t.iOS() {
931931
return false
932932
}
933933
// Internally linking cgo is incomplete on some architectures.
@@ -963,7 +963,7 @@ func (t *tester) supportedBuildmode(mode string) bool {
963963
}
964964
switch pair {
965965
case "aix-ppc64",
966-
"darwin-386", "darwin-amd64", "darwin-arm", "darwin-arm64",
966+
"darwin-386", "darwin-amd64", "darwin-arm64",
967967
"linux-amd64", "linux-386", "linux-ppc64le", "linux-s390x",
968968
"freebsd-amd64",
969969
"windows-amd64", "windows-386":

Diff for: src/cmd/dist/util.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -383,8 +383,8 @@ func xsamefile(f1, f2 string) bool {
383383
}
384384

385385
func xgetgoarm() string {
386-
if goos == "darwin" || goos == "android" {
387-
// Assume all darwin/arm and android devices have VFPv3.
386+
if goos == "android" {
387+
// Assume all android devices have VFPv3.
388388
// These ports are also mostly cross-compiled, so it makes little
389389
// sense to auto-detect the setting.
390390
return "7"

Diff for: src/cmd/doc/doc_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ func TestMain(m *testing.M) {
3636
}
3737

3838
func maybeSkip(t *testing.T) {
39-
if runtime.GOOS == "darwin" && strings.HasPrefix(runtime.GOARCH, "arm") {
40-
t.Skip("darwin/arm does not have a full file tree")
39+
if runtime.GOOS == "darwin" && runtime.GOARCH == "arm64" {
40+
t.Skip("darwin/arm64 does not have a full file tree")
4141
}
4242
}
4343

Diff for: src/cmd/go/go_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ func init() {
6161
canRun = false
6262
case "darwin":
6363
switch runtime.GOARCH {
64-
case "arm", "arm64":
64+
case "arm64":
6565
canRun = false
6666
}
6767
case "linux":

Diff for: src/cmd/go/internal/load/pkg.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -1940,8 +1940,7 @@ func externalLinkingForced(p *Package) bool {
19401940
return true
19411941
}
19421942
case "darwin":
1943-
switch cfg.BuildContext.GOARCH {
1944-
case "arm", "arm64":
1943+
if cfg.BuildContext.GOARCH == "arm64" {
19451944
return true
19461945
}
19471946
}

Diff for: src/cmd/go/internal/work/build_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ func pkgImportPath(pkgpath string) *load.Package {
222222
func TestRespectSetgidDir(t *testing.T) {
223223
switch runtime.GOOS {
224224
case "darwin":
225-
if runtime.GOARCH == "arm" || runtime.GOARCH == "arm64" {
225+
if runtime.GOARCH == "arm64" {
226226
t.Skip("can't set SetGID bit with chmod on iOS")
227227
}
228228
case "windows", "plan9":

Diff for: src/cmd/go/internal/work/init.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ func buildModeInit() {
117117
switch cfg.Goos {
118118
case "darwin":
119119
switch cfg.Goarch {
120-
case "arm", "arm64":
120+
case "arm64":
121121
codegenArg = "-shared"
122122
}
123123

@@ -151,7 +151,7 @@ func buildModeInit() {
151151
ldBuildmode = "pie"
152152
case "darwin":
153153
switch cfg.Goarch {
154-
case "arm", "arm64":
154+
case "arm64":
155155
codegenArg = "-shared"
156156
}
157157
fallthrough

Diff for: src/cmd/internal/sys/supported.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ func MustLinkExternal(goos, goarch string) bool {
3939
return true
4040
}
4141
case "darwin":
42-
if goarch == "arm" || goarch == "arm64" {
42+
if goarch == "arm64" {
4343
return true
4444
}
4545
}

Diff for: src/cmd/link/internal/arm/asm.go

-16
Original file line numberDiff line numberDiff line change
@@ -789,11 +789,6 @@ func asmb(ctxt *ld.Link) {
789789
}
790790

791791
func asmb2(ctxt *ld.Link) {
792-
machlink := uint32(0)
793-
if ctxt.HeadType == objabi.Hdarwin {
794-
machlink = uint32(ld.Domacholink(ctxt))
795-
}
796-
797792
/* output symbol table */
798793
ld.Symsize = 0
799794

@@ -811,9 +806,6 @@ func asmb2(ctxt *ld.Link) {
811806
case objabi.Hplan9:
812807
symo = uint32(ld.Segdata.Fileoff + ld.Segdata.Filelen)
813808

814-
case objabi.Hdarwin:
815-
symo = uint32(ld.Segdwarf.Fileoff + uint64(ld.Rnd(int64(ld.Segdwarf.Filelen), int64(*ld.FlagRound))) + uint64(machlink))
816-
817809
case objabi.Hwindows:
818810
symo = uint32(ld.Segdwarf.Fileoff + ld.Segdwarf.Filelen)
819811
symo = uint32(ld.Rnd(int64(symo), ld.PEFILEALIGN))
@@ -845,11 +837,6 @@ func asmb2(ctxt *ld.Link) {
845837

846838
case objabi.Hwindows:
847839
// Do nothing
848-
849-
case objabi.Hdarwin:
850-
if ctxt.LinkMode == ld.LinkExternal {
851-
ld.Machoemitreloc(ctxt)
852-
}
853840
}
854841
}
855842

@@ -872,9 +859,6 @@ func asmb2(ctxt *ld.Link) {
872859
objabi.Hopenbsd:
873860
ld.Asmbelf(ctxt, int64(symo))
874861

875-
case objabi.Hdarwin:
876-
ld.Asmbmacho(ctxt)
877-
878862
case objabi.Hwindows:
879863
ld.Asmbpe(ctxt)
880864
}

Diff for: src/cmd/link/internal/arm/obj.go

-9
Original file line numberDiff line numberDiff line change
@@ -100,15 +100,6 @@ func archinit(ctxt *ld.Link) {
100100
*ld.FlagRound = 0x10000
101101
}
102102

103-
case objabi.Hdarwin: /* apple MACH */
104-
ld.HEADR = ld.INITIAL_MACHO_HEADR
105-
if *ld.FlagTextAddr == -1 {
106-
*ld.FlagTextAddr = 4096 + int64(ld.HEADR)
107-
}
108-
if *ld.FlagRound == -1 {
109-
*ld.FlagRound = 4096
110-
}
111-
112103
case objabi.Hwindows: /* PE executable */
113104
// ld.HEADR, ld.FlagTextAddr, ld.FlagRound are set in ld.Peinit
114105
return

Diff for: src/cmd/link/internal/ld/sym.go

-3
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,6 @@ func (ctxt *Link) computeTLSOffset() {
106106
case sys.AMD64:
107107
ctxt.Tlsoffset = 0x30
108108

109-
case sys.ARM:
110-
ctxt.Tlsoffset = 0 // dummy value, not needed
111-
112109
case sys.ARM64:
113110
ctxt.Tlsoffset = 0 // dummy value, not needed
114111
}

Diff for: src/cmd/oldlink/internal/arm/asm.go

-25
Original file line numberDiff line numberDiff line change
@@ -618,15 +618,6 @@ func archreloc(ctxt *ld.Link, r *sym.Reloc, s *sym.Symbol, val int64) (int64, bo
618618
}
619619
r.Xsym = rs
620620

621-
// ld64 for arm seems to want the symbol table to contain offset
622-
// into the section rather than pseudo virtual address that contains
623-
// the section load address.
624-
// we need to compensate that by removing the instruction's address
625-
// from addend.
626-
if ctxt.HeadType == objabi.Hdarwin {
627-
r.Xadd -= ld.Symaddr(s) + int64(r.Off)
628-
}
629-
630621
if r.Xadd/4 > 0x7fffff || r.Xadd/4 < -0x800000 {
631622
ld.Errorf(s, "direct call too far %d", r.Xadd/4)
632623
}
@@ -789,11 +780,6 @@ func asmb(ctxt *ld.Link) {
789780
}
790781

791782
func asmb2(ctxt *ld.Link) {
792-
machlink := uint32(0)
793-
if ctxt.HeadType == objabi.Hdarwin {
794-
machlink = uint32(ld.Domacholink(ctxt))
795-
}
796-
797783
/* output symbol table */
798784
ld.Symsize = 0
799785

@@ -811,9 +797,6 @@ func asmb2(ctxt *ld.Link) {
811797
case objabi.Hplan9:
812798
symo = uint32(ld.Segdata.Fileoff + ld.Segdata.Filelen)
813799

814-
case objabi.Hdarwin:
815-
symo = uint32(ld.Segdwarf.Fileoff + uint64(ld.Rnd(int64(ld.Segdwarf.Filelen), int64(*ld.FlagRound))) + uint64(machlink))
816-
817800
case objabi.Hwindows:
818801
symo = uint32(ld.Segdwarf.Fileoff + ld.Segdwarf.Filelen)
819802
symo = uint32(ld.Rnd(int64(symo), ld.PEFILEALIGN))
@@ -845,11 +828,6 @@ func asmb2(ctxt *ld.Link) {
845828

846829
case objabi.Hwindows:
847830
// Do nothing
848-
849-
case objabi.Hdarwin:
850-
if ctxt.LinkMode == ld.LinkExternal {
851-
ld.Machoemitreloc(ctxt)
852-
}
853831
}
854832
}
855833

@@ -872,9 +850,6 @@ func asmb2(ctxt *ld.Link) {
872850
objabi.Hopenbsd:
873851
ld.Asmbelf(ctxt, int64(symo))
874852

875-
case objabi.Hdarwin:
876-
ld.Asmbmacho(ctxt)
877-
878853
case objabi.Hwindows:
879854
ld.Asmbpe(ctxt)
880855
}

Diff for: src/cmd/oldlink/internal/arm/obj.go

-9
Original file line numberDiff line numberDiff line change
@@ -100,15 +100,6 @@ func archinit(ctxt *ld.Link) {
100100
*ld.FlagRound = 0x10000
101101
}
102102

103-
case objabi.Hdarwin: /* apple MACH */
104-
ld.HEADR = ld.INITIAL_MACHO_HEADR
105-
if *ld.FlagTextAddr == -1 {
106-
*ld.FlagTextAddr = 4096 + int64(ld.HEADR)
107-
}
108-
if *ld.FlagRound == -1 {
109-
*ld.FlagRound = 4096
110-
}
111-
112103
case objabi.Hwindows: /* PE executable */
113104
// ld.HEADR, ld.FlagTextAddr, ld.FlagRound are set in ld.Peinit
114105
return

Diff for: src/cmd/oldlink/internal/ld/sym.go

-3
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,6 @@ func (ctxt *Link) computeTLSOffset() {
104104
case sys.AMD64:
105105
ctxt.Tlsoffset = 0x30
106106

107-
case sys.ARM:
108-
ctxt.Tlsoffset = 0 // dummy value, not needed
109-
110107
case sys.ARM64:
111108
ctxt.Tlsoffset = 0 // dummy value, not needed
112109
}

Diff for: src/crypto/x509/root_darwin_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616

1717
func TestSystemRoots(t *testing.T) {
1818
switch runtime.GOARCH {
19-
case "arm", "arm64":
19+
case "arm64":
2020
t.Skipf("skipping on %s/%s, no system root", runtime.GOOS, runtime.GOARCH)
2121
}
2222

0 commit comments

Comments
 (0)