Skip to content

Commit

Permalink
all: remove scattered remnants of darwin/arm
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
aclements committed Apr 8, 2020
1 parent da8591b commit f7e6ab4
Show file tree
Hide file tree
Showing 50 changed files with 81 additions and 174 deletions.
2 changes: 1 addition & 1 deletion misc/cgo/test/pkg_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func TestCrossPackageTests(t *testing.T) {
t.Skip("Can't exec cmd/go subprocess on Android.")
case "darwin":
switch runtime.GOARCH {
case "arm", "arm64":
case "arm64":
t.Skip("Can't exec cmd/go subprocess on iOS.")
}
}
Expand Down
2 changes: 1 addition & 1 deletion misc/cgo/test/sigaltstack.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ import (

func testSigaltstack(t *testing.T) {
switch {
case runtime.GOOS == "solaris", runtime.GOOS == "illumos", runtime.GOOS == "darwin" && (runtime.GOARCH == "arm" || runtime.GOARCH == "arm64"):
case runtime.GOOS == "solaris", runtime.GOOS == "illumos", runtime.GOOS == "darwin" && runtime.GOARCH == "arm64":
t.Skipf("switching signal stack not implemented on %s/%s", runtime.GOOS, runtime.GOARCH)
case runtime.GOOS == "darwin" && runtime.GOARCH == "386":
t.Skipf("sigaltstack fails on darwin/386")
Expand Down
2 changes: 1 addition & 1 deletion misc/cgo/test/testx.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ func Add(x int) {
}

func testCthread(t *testing.T) {
if runtime.GOOS == "darwin" && (runtime.GOARCH == "arm" || runtime.GOARCH == "arm64") {
if runtime.GOOS == "darwin" && runtime.GOARCH == "arm64" {
t.Skip("the iOS exec wrapper is unable to properly handle the panic from Add")
}
sum.i = 0
Expand Down
8 changes: 4 additions & 4 deletions misc/cgo/testcarchive/carchive_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ func testMain(m *testing.M) int {
} else {
switch GOOS {
case "darwin":
if GOARCH == "arm" || GOARCH == "arm64" {
if GOARCH == "arm64" {
libbase += "_shared"
}
case "dragonfly", "freebsd", "linux", "netbsd", "openbsd", "solaris", "illumos":
Expand Down Expand Up @@ -305,7 +305,7 @@ func TestEarlySignalHandler(t *testing.T) {
switch GOOS {
case "darwin":
switch GOARCH {
case "arm", "arm64":
case "arm64":
t.Skipf("skipping on %s/%s; see https://golang.org/issue/13701", GOOS, GOARCH)
}
case "windows":
Expand Down Expand Up @@ -487,7 +487,7 @@ func checkSignalForwardingTest(t *testing.T) {
switch GOOS {
case "darwin":
switch GOARCH {
case "arm", "arm64":
case "arm64":
t.Skipf("skipping on %s/%s; see https://golang.org/issue/13701", GOOS, GOARCH)
}
case "windows":
Expand Down Expand Up @@ -603,7 +603,7 @@ func TestExtar(t *testing.T) {
if runtime.Compiler == "gccgo" {
t.Skip("skipping -extar test when using gccgo")
}
if runtime.GOOS == "darwin" && (runtime.GOARCH == "arm" || runtime.GOARCH == "arm64") {
if runtime.GOOS == "darwin" && runtime.GOARCH == "arm64" {
t.Skip("shell scripts are not executable on iOS hosts")
}

Expand Down
2 changes: 1 addition & 1 deletion misc/cgo/testcshared/cshared_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ func testMain(m *testing.M) int {
libgodir := GOOS + "_" + GOARCH
switch GOOS {
case "darwin":
if GOARCH == "arm" || GOARCH == "arm64" {
if GOARCH == "arm64" {
libgodir += "_shared"
}
case "dragonfly", "freebsd", "linux", "netbsd", "openbsd", "solaris", "illumos":
Expand Down
2 changes: 1 addition & 1 deletion misc/cgo/testso/so_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
func requireTestSOSupported(t *testing.T) {
t.Helper()
switch runtime.GOARCH {
case "arm", "arm64":
case "arm64":
if runtime.GOOS == "darwin" {
t.Skip("No exec facility on iOS.")
}
Expand Down
2 changes: 1 addition & 1 deletion misc/cgo/testsovar/so_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
func requireTestSOSupported(t *testing.T) {
t.Helper()
switch runtime.GOARCH {
case "arm", "arm64":
case "arm64":
if runtime.GOOS == "darwin" {
t.Skip("No exec facility on iOS.")
}
Expand Down
4 changes: 1 addition & 3 deletions misc/ios/clangwrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ export IPHONEOS_DEPLOYMENT_TARGET=5.1
# cmd/cgo doesn't support llvm-gcc-4.2, so we have to use clang.
CLANG=`xcrun --sdk $SDK --find clang`

if [ "$GOARCH" == "arm" ]; then
CLANGARCH="armv7"
elif [ "$GOARCH" == "arm64" ]; then
if [ "$GOARCH" == "arm64" ]; then
CLANGARCH="arm64"
else
echo "unknown GOARCH=$GOARCH" >&2
Expand Down
2 changes: 1 addition & 1 deletion src/buildall.bash
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ gettargets() {
}

selectedtargets() {
gettargets | egrep -v 'android-arm|darwin-arm' | egrep "$pattern"
gettargets | egrep -v 'android-arm|darwin-arm64' | egrep "$pattern"
}

# put linux first in the target list to get all the architectures up front.
Expand Down
4 changes: 2 additions & 2 deletions src/cmd/dist/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -1461,8 +1461,8 @@ func wrapperPathFor(goos, goarch string) string {
if gohostos != "android" {
return pathf("%s/misc/android/go_android_exec.go", goroot)
}
case goos == "darwin" && (goarch == "arm" || goarch == "arm64"):
if gohostos != "darwin" || (gohostarch != "arm" && gohostarch != "arm64") {
case goos == "darwin" && goarch == "arm64":
if gohostos != "darwin" || gohostarch != "arm64" {
return pathf("%s/misc/ios/go_darwin_arm_exec.go", goroot)
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/cmd/dist/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -887,7 +887,7 @@ func (t *tester) addCmd(dt *distTest, dir string, cmdline ...interface{}) *exec.
}

func (t *tester) iOS() bool {
return goos == "darwin" && (goarch == "arm" || goarch == "arm64")
return goos == "darwin" && goarch == "arm64"
}

func (t *tester) out(v string) {
Expand All @@ -902,7 +902,7 @@ func (t *tester) extLink() bool {
switch pair {
case "aix-ppc64",
"android-arm", "android-arm64",
"darwin-386", "darwin-amd64", "darwin-arm", "darwin-arm64",
"darwin-386", "darwin-amd64", "darwin-arm64",
"dragonfly-amd64",
"freebsd-386", "freebsd-amd64", "freebsd-arm",
"linux-386", "linux-amd64", "linux-arm", "linux-arm64", "linux-ppc64le", "linux-mips64", "linux-mips64le", "linux-mips", "linux-mipsle", "linux-s390x",
Expand All @@ -927,7 +927,7 @@ func (t *tester) internalLink() bool {
if goos == "android" {
return false
}
if goos == "darwin" && (goarch == "arm" || goarch == "arm64") {
if t.iOS() {
return false
}
// Internally linking cgo is incomplete on some architectures.
Expand Down Expand Up @@ -963,7 +963,7 @@ func (t *tester) supportedBuildmode(mode string) bool {
}
switch pair {
case "aix-ppc64",
"darwin-386", "darwin-amd64", "darwin-arm", "darwin-arm64",
"darwin-386", "darwin-amd64", "darwin-arm64",
"linux-amd64", "linux-386", "linux-ppc64le", "linux-s390x",
"freebsd-amd64",
"windows-amd64", "windows-386":
Expand Down
4 changes: 2 additions & 2 deletions src/cmd/dist/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -383,8 +383,8 @@ func xsamefile(f1, f2 string) bool {
}

func xgetgoarm() string {
if goos == "darwin" || goos == "android" {
// Assume all darwin/arm and android devices have VFPv3.
if goos == "android" {
// Assume all android devices have VFPv3.
// These ports are also mostly cross-compiled, so it makes little
// sense to auto-detect the setting.
return "7"
Expand Down
4 changes: 2 additions & 2 deletions src/cmd/doc/doc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ func TestMain(m *testing.M) {
}

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

Expand Down
2 changes: 1 addition & 1 deletion src/cmd/go/go_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func init() {
canRun = false
case "darwin":
switch runtime.GOARCH {
case "arm", "arm64":
case "arm64":
canRun = false
}
case "linux":
Expand Down
3 changes: 1 addition & 2 deletions src/cmd/go/internal/load/pkg.go
Original file line number Diff line number Diff line change
Expand Up @@ -1940,8 +1940,7 @@ func externalLinkingForced(p *Package) bool {
return true
}
case "darwin":
switch cfg.BuildContext.GOARCH {
case "arm", "arm64":
if cfg.BuildContext.GOARCH == "arm64" {
return true
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/go/internal/work/build_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ func pkgImportPath(pkgpath string) *load.Package {
func TestRespectSetgidDir(t *testing.T) {
switch runtime.GOOS {
case "darwin":
if runtime.GOARCH == "arm" || runtime.GOARCH == "arm64" {
if runtime.GOARCH == "arm64" {
t.Skip("can't set SetGID bit with chmod on iOS")
}
case "windows", "plan9":
Expand Down
4 changes: 2 additions & 2 deletions src/cmd/go/internal/work/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ func buildModeInit() {
switch cfg.Goos {
case "darwin":
switch cfg.Goarch {
case "arm", "arm64":
case "arm64":
codegenArg = "-shared"
}

Expand Down Expand Up @@ -151,7 +151,7 @@ func buildModeInit() {
ldBuildmode = "pie"
case "darwin":
switch cfg.Goarch {
case "arm", "arm64":
case "arm64":
codegenArg = "-shared"
}
fallthrough
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/internal/sys/supported.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func MustLinkExternal(goos, goarch string) bool {
return true
}
case "darwin":
if goarch == "arm" || goarch == "arm64" {
if goarch == "arm64" {
return true
}
}
Expand Down
16 changes: 0 additions & 16 deletions src/cmd/link/internal/arm/asm.go
Original file line number Diff line number Diff line change
Expand Up @@ -789,11 +789,6 @@ func asmb(ctxt *ld.Link) {
}

func asmb2(ctxt *ld.Link) {
machlink := uint32(0)
if ctxt.HeadType == objabi.Hdarwin {
machlink = uint32(ld.Domacholink(ctxt))
}

/* output symbol table */
ld.Symsize = 0

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

case objabi.Hdarwin:
symo = uint32(ld.Segdwarf.Fileoff + uint64(ld.Rnd(int64(ld.Segdwarf.Filelen), int64(*ld.FlagRound))) + uint64(machlink))

case objabi.Hwindows:
symo = uint32(ld.Segdwarf.Fileoff + ld.Segdwarf.Filelen)
symo = uint32(ld.Rnd(int64(symo), ld.PEFILEALIGN))
Expand Down Expand Up @@ -845,11 +837,6 @@ func asmb2(ctxt *ld.Link) {

case objabi.Hwindows:
// Do nothing

case objabi.Hdarwin:
if ctxt.LinkMode == ld.LinkExternal {
ld.Machoemitreloc(ctxt)
}
}
}

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

case objabi.Hdarwin:
ld.Asmbmacho(ctxt)

case objabi.Hwindows:
ld.Asmbpe(ctxt)
}
Expand Down
9 changes: 0 additions & 9 deletions src/cmd/link/internal/arm/obj.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,6 @@ func archinit(ctxt *ld.Link) {
*ld.FlagRound = 0x10000
}

case objabi.Hdarwin: /* apple MACH */
ld.HEADR = ld.INITIAL_MACHO_HEADR
if *ld.FlagTextAddr == -1 {
*ld.FlagTextAddr = 4096 + int64(ld.HEADR)
}
if *ld.FlagRound == -1 {
*ld.FlagRound = 4096
}

case objabi.Hwindows: /* PE executable */
// ld.HEADR, ld.FlagTextAddr, ld.FlagRound are set in ld.Peinit
return
Expand Down
3 changes: 0 additions & 3 deletions src/cmd/link/internal/ld/sym.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,6 @@ func (ctxt *Link) computeTLSOffset() {
case sys.AMD64:
ctxt.Tlsoffset = 0x30

case sys.ARM:
ctxt.Tlsoffset = 0 // dummy value, not needed

case sys.ARM64:
ctxt.Tlsoffset = 0 // dummy value, not needed
}
Expand Down
25 changes: 0 additions & 25 deletions src/cmd/oldlink/internal/arm/asm.go
Original file line number Diff line number Diff line change
Expand Up @@ -618,15 +618,6 @@ func archreloc(ctxt *ld.Link, r *sym.Reloc, s *sym.Symbol, val int64) (int64, bo
}
r.Xsym = rs

// ld64 for arm seems to want the symbol table to contain offset
// into the section rather than pseudo virtual address that contains
// the section load address.
// we need to compensate that by removing the instruction's address
// from addend.
if ctxt.HeadType == objabi.Hdarwin {
r.Xadd -= ld.Symaddr(s) + int64(r.Off)
}

if r.Xadd/4 > 0x7fffff || r.Xadd/4 < -0x800000 {
ld.Errorf(s, "direct call too far %d", r.Xadd/4)
}
Expand Down Expand Up @@ -789,11 +780,6 @@ func asmb(ctxt *ld.Link) {
}

func asmb2(ctxt *ld.Link) {
machlink := uint32(0)
if ctxt.HeadType == objabi.Hdarwin {
machlink = uint32(ld.Domacholink(ctxt))
}

/* output symbol table */
ld.Symsize = 0

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

case objabi.Hdarwin:
symo = uint32(ld.Segdwarf.Fileoff + uint64(ld.Rnd(int64(ld.Segdwarf.Filelen), int64(*ld.FlagRound))) + uint64(machlink))

case objabi.Hwindows:
symo = uint32(ld.Segdwarf.Fileoff + ld.Segdwarf.Filelen)
symo = uint32(ld.Rnd(int64(symo), ld.PEFILEALIGN))
Expand Down Expand Up @@ -845,11 +828,6 @@ func asmb2(ctxt *ld.Link) {

case objabi.Hwindows:
// Do nothing

case objabi.Hdarwin:
if ctxt.LinkMode == ld.LinkExternal {
ld.Machoemitreloc(ctxt)
}
}
}

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

case objabi.Hdarwin:
ld.Asmbmacho(ctxt)

case objabi.Hwindows:
ld.Asmbpe(ctxt)
}
Expand Down
9 changes: 0 additions & 9 deletions src/cmd/oldlink/internal/arm/obj.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,6 @@ func archinit(ctxt *ld.Link) {
*ld.FlagRound = 0x10000
}

case objabi.Hdarwin: /* apple MACH */
ld.HEADR = ld.INITIAL_MACHO_HEADR
if *ld.FlagTextAddr == -1 {
*ld.FlagTextAddr = 4096 + int64(ld.HEADR)
}
if *ld.FlagRound == -1 {
*ld.FlagRound = 4096
}

case objabi.Hwindows: /* PE executable */
// ld.HEADR, ld.FlagTextAddr, ld.FlagRound are set in ld.Peinit
return
Expand Down
3 changes: 0 additions & 3 deletions src/cmd/oldlink/internal/ld/sym.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,6 @@ func (ctxt *Link) computeTLSOffset() {
case sys.AMD64:
ctxt.Tlsoffset = 0x30

case sys.ARM:
ctxt.Tlsoffset = 0 // dummy value, not needed

case sys.ARM64:
ctxt.Tlsoffset = 0 // dummy value, not needed
}
Expand Down
2 changes: 1 addition & 1 deletion src/crypto/x509/root_darwin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (

func TestSystemRoots(t *testing.T) {
switch runtime.GOARCH {
case "arm", "arm64":
case "arm64":
t.Skipf("skipping on %s/%s, no system root", runtime.GOOS, runtime.GOARCH)
}

Expand Down
Loading

0 comments on commit f7e6ab4

Please sign in to comment.