diff options
Diffstat (limited to 'src/cmd')
24 files changed, 48 insertions, 29 deletions
diff --git a/src/cmd/cgo/gcc.go b/src/cmd/cgo/gcc.go index 730db44990..111a309eb5 100644 --- a/src/cmd/cgo/gcc.go +++ b/src/cmd/cgo/gcc.go @@ -298,7 +298,7 @@ func (p *Package) guessKinds(f *File) []*Name { continue } - if goos == "darwin" && strings.HasSuffix(n.C, "Ref") { + if (goos == "darwin" || goos == "ios") && strings.HasSuffix(n.C, "Ref") { // For FooRef, find out if FooGetTypeID exists. s := n.C[:len(n.C)-3] + "GetTypeID" n := &Name{Go: s, C: s} @@ -3075,7 +3075,7 @@ func (c *typeConv) badCFType(dt *dwarf.TypedefType) bool { // We identify the correct set of types as those ending in Ref and for which // there exists a corresponding GetTypeID function. // See comment below for details about the bad pointers. - if goos != "darwin" { + if goos != "darwin" && goos != "ios" { return false } s := dt.Name diff --git a/src/cmd/compile/internal/arm64/ggen.go b/src/cmd/compile/internal/arm64/ggen.go index f698919e9b..f3fec03854 100644 --- a/src/cmd/compile/internal/arm64/ggen.go +++ b/src/cmd/compile/internal/arm64/ggen.go @@ -11,7 +11,7 @@ import ( "cmd/internal/objabi" ) -var darwin = objabi.GOOS == "darwin" +var darwin = objabi.GOOS == "darwin" || objabi.GOOS == "ios" func padframe(frame int64) int64 { // arm64 requires that the frame size (not counting saved FP&LR) diff --git a/src/cmd/compile/internal/ssa/config.go b/src/cmd/compile/internal/ssa/config.go index 4b2f06def1..7f01f8047f 100644 --- a/src/cmd/compile/internal/ssa/config.go +++ b/src/cmd/compile/internal/ssa/config.go @@ -248,7 +248,7 @@ func NewConfig(arch string, types Types, ctxt *obj.Link, optimize bool) *Config c.FPReg = framepointerRegARM64 c.LinkReg = linkRegARM64 c.hasGReg = true - c.noDuffDevice = objabi.GOOS == "darwin" // darwin linker cannot handle BR26 reloc with non-zero addend + c.noDuffDevice = objabi.GOOS == "darwin" || objabi.GOOS == "ios" // darwin linker cannot handle BR26 reloc with non-zero addend case "ppc64": c.BigEndian = true fallthrough diff --git a/src/cmd/dist/build.go b/src/cmd/dist/build.go index 397b3bb88f..3ac742fa55 100644 --- a/src/cmd/dist/build.go +++ b/src/cmd/dist/build.go @@ -80,6 +80,7 @@ var okgoos = []string{ "darwin", "dragonfly", "illumos", + "ios", "js", "linux", "android", @@ -970,7 +971,10 @@ func matchtag(tag string) bool { } return !matchtag(tag[1:]) } - return tag == "gc" || tag == goos || tag == goarch || tag == "cmd_go_bootstrap" || tag == "go1.1" || (goos == "android" && tag == "linux") || (goos == "illumos" && tag == "solaris") + return tag == "gc" || tag == goos || tag == goarch || tag == "cmd_go_bootstrap" || tag == "go1.1" || + (goos == "android" && tag == "linux") || + (goos == "illumos" && tag == "solaris") || + (goos == "ios" && tag == "darwin") } // shouldbuild reports whether we should build this file. @@ -984,7 +988,7 @@ func shouldbuild(file, pkg string) bool { name := filepath.Base(file) excluded := func(list []string, ok string) bool { for _, x := range list { - if x == ok || (ok == "android" && x == "linux") || (ok == "illumos" && x == "solaris") { + if x == ok || (ok == "android" && x == "linux") || (ok == "illumos" && x == "solaris") || (ok == "ios" && x == "darwin") { continue } i := strings.Index(name, x) @@ -1462,7 +1466,7 @@ func wrapperPathFor(goos, goarch string) string { if gohostos != "android" { return pathf("%s/misc/android/go_android_exec.go", goroot) } - case goos == "darwin" && goarch == "arm64": + case (goos == "darwin" || goos == "ios") && goarch == "arm64": if gohostos != "darwin" || gohostarch != "arm64" { return pathf("%s/misc/ios/go_darwin_arm_exec.go", goroot) } @@ -1541,6 +1545,7 @@ var cgoEnabled = map[string]bool{ "android/amd64": true, "android/arm": true, "android/arm64": true, + "ios/arm64": true, "js/wasm": false, "netbsd/386": true, "netbsd/amd64": true, diff --git a/src/cmd/dist/test.go b/src/cmd/dist/test.go index 5ea5c81656..f953a76963 100644 --- a/src/cmd/dist/test.go +++ b/src/cmd/dist/test.go @@ -464,7 +464,7 @@ func (t *tester) registerTests() { } // Test the ios build tag on darwin/amd64 for the iOS simulator. - if goos == "darwin" && !t.iOS() { + if goos == "darwin" && goarch == "amd64" { t.tests = append(t.tests, distTest{ name: "amd64ios", heading: "ios tag on darwin/amd64", @@ -903,7 +903,7 @@ func (t *tester) addCmd(dt *distTest, dir string, cmdline ...interface{}) *exec. } func (t *tester) iOS() bool { - return goos == "darwin" && goarch == "arm64" + return (goos == "darwin" || goos == "ios") && goarch == "arm64" } func (t *tester) out(v string) { @@ -943,7 +943,10 @@ func (t *tester) internalLink() bool { if goos == "android" { return false } - if t.iOS() { + if goos == "ios" { + return false + } + if goos == "darwin" && goarch == "arm64" { return false } // Internally linking cgo is incomplete on some architectures. diff --git a/src/cmd/doc/doc_test.go b/src/cmd/doc/doc_test.go index f13d917634..47602833d3 100644 --- a/src/cmd/doc/doc_test.go +++ b/src/cmd/doc/doc_test.go @@ -36,8 +36,8 @@ func TestMain(m *testing.M) { } func maybeSkip(t *testing.T) { - if runtime.GOOS == "darwin" && runtime.GOARCH == "arm64" { - t.Skip("darwin/arm64 does not have a full file tree") + if (runtime.GOOS == "darwin" || runtime.GOOS == "ios") && runtime.GOARCH == "arm64" { + t.Skip("iOS does not have a full file tree") } } diff --git a/src/cmd/go/alldocs.go b/src/cmd/go/alldocs.go index 804ca9e5a5..4bc87008ff 100644 --- a/src/cmd/go/alldocs.go +++ b/src/cmd/go/alldocs.go @@ -1608,6 +1608,9 @@ // Using GOOS=illumos matches build tags and files as for GOOS=solaris // in addition to illumos tags and files. // +// Using GOOS=ios matches build tags and files as for GOOS=darwin +// in addition to ios tags and files. +// // To keep a file from being considered for the build: // // // +build ignore diff --git a/src/cmd/go/go_test.go b/src/cmd/go/go_test.go index 021930a8a8..66a52c86ad 100644 --- a/src/cmd/go/go_test.go +++ b/src/cmd/go/go_test.go @@ -58,7 +58,7 @@ func init() { switch runtime.GOOS { case "android", "js": canRun = false - case "darwin": + case "darwin", "ios": switch runtime.GOARCH { case "arm64": canRun = false diff --git a/src/cmd/go/internal/bug/bug.go b/src/cmd/go/internal/bug/bug.go index 52bd40f2fb..07e3516855 100644 --- a/src/cmd/go/internal/bug/bug.go +++ b/src/cmd/go/internal/bug/bug.go @@ -105,7 +105,7 @@ func printGoDetails(w io.Writer) { func printOSDetails(w io.Writer) { switch runtime.GOOS { - case "darwin": + case "darwin", "ios": printCmdOut(w, "uname -v: ", "uname", "-v") printCmdOut(w, "", "sw_vers") case "linux": diff --git a/src/cmd/go/internal/help/helpdoc.go b/src/cmd/go/internal/help/helpdoc.go index e1f0521ea4..0ae5fd7ca9 100644 --- a/src/cmd/go/internal/help/helpdoc.go +++ b/src/cmd/go/internal/help/helpdoc.go @@ -838,6 +838,9 @@ in addition to android tags and files. Using GOOS=illumos matches build tags and files as for GOOS=solaris in addition to illumos tags and files. +Using GOOS=ios matches build tags and files as for GOOS=darwin +in addition to ios tags and files. + To keep a file from being considered for the build: // +build ignore diff --git a/src/cmd/go/internal/imports/build.go b/src/cmd/go/internal/imports/build.go index eb070eef4c..50aeabc578 100644 --- a/src/cmd/go/internal/imports/build.go +++ b/src/cmd/go/internal/imports/build.go @@ -141,6 +141,9 @@ func matchTag(name string, tags map[string]bool, want bool) bool { if name == "solaris" { have = have || tags["illumos"] } + if name == "darwin" { + have = have || tags["ios"] + } return have == want } @@ -158,6 +161,7 @@ func matchTag(name string, tags map[string]bool, want bool) bool { // Exceptions: // if GOOS=android, then files with GOOS=linux are also matched. // if GOOS=illumos, then files with GOOS=solaris are also matched. +// if GOOS=ios, then files with GOOS=darwin are also matched. // // If tags["*"] is true, then MatchFile will consider all possible // GOOS and GOARCH to be available and will consequently @@ -208,6 +212,7 @@ var KnownOS = map[string]bool{ "freebsd": true, "hurd": true, "illumos": true, + "ios": true, "js": true, "linux": true, "nacl": true, // legacy; don't remove diff --git a/src/cmd/go/internal/load/pkg.go b/src/cmd/go/internal/load/pkg.go index 1cbd7962e7..5cc77915e7 100644 --- a/src/cmd/go/internal/load/pkg.go +++ b/src/cmd/go/internal/load/pkg.go @@ -1950,7 +1950,7 @@ func externalLinkingForced(p *Package) bool { if cfg.BuildContext.GOARCH != "arm64" { return true } - case "darwin": + case "darwin", "ios": if cfg.BuildContext.GOARCH == "arm64" { return true } diff --git a/src/cmd/go/internal/work/build_test.go b/src/cmd/go/internal/work/build_test.go index c33de2635d..afed0fba72 100644 --- a/src/cmd/go/internal/work/build_test.go +++ b/src/cmd/go/internal/work/build_test.go @@ -221,7 +221,7 @@ func pkgImportPath(pkgpath string) *load.Package { // See https://golang.org/issue/18878. func TestRespectSetgidDir(t *testing.T) { switch runtime.GOOS { - case "darwin": + case "darwin", "ios": if runtime.GOARCH == "arm64" { t.Skip("can't set SetGID bit with chmod on iOS") } diff --git a/src/cmd/go/internal/work/exec.go b/src/cmd/go/internal/work/exec.go index afd6fd6d3f..51fc2b588d 100644 --- a/src/cmd/go/internal/work/exec.go +++ b/src/cmd/go/internal/work/exec.go @@ -2424,7 +2424,7 @@ func (b *Builder) compilerCmd(compiler []string, incdir, workdir string) []strin // On OS X, some of the compilers behave as if -fno-common // is always set, and the Mach-O linker in 6l/8l assumes this. // See https://golang.org/issue/3253. - if cfg.Goos == "darwin" { + if cfg.Goos == "darwin" || cfg.Goos == "ios" { a = append(a, "-fno-common") } diff --git a/src/cmd/go/internal/work/init.go b/src/cmd/go/internal/work/init.go index 42692acd3b..b0d6133768 100644 --- a/src/cmd/go/internal/work/init.go +++ b/src/cmd/go/internal/work/init.go @@ -121,7 +121,7 @@ func buildModeInit() { codegenArg = "-fPIC" } else { switch cfg.Goos { - case "darwin": + case "darwin", "ios": switch cfg.Goarch { case "arm64": codegenArg = "-shared" @@ -157,7 +157,7 @@ func buildModeInit() { ldBuildmode = "pie" case "windows": ldBuildmode = "pie" - case "darwin": + case "darwin", "ios": switch cfg.Goarch { case "arm64": codegenArg = "-shared" diff --git a/src/cmd/internal/archive/archive_test.go b/src/cmd/internal/archive/archive_test.go index 1468a58210..cb4eb842b4 100644 --- a/src/cmd/internal/archive/archive_test.go +++ b/src/cmd/internal/archive/archive_test.go @@ -243,7 +243,7 @@ func TestParseCGOArchive(t *testing.T) { c1 := "c1" c2 := "c2" switch runtime.GOOS { - case "darwin": + case "darwin", "ios": c1 = "_" + c1 c2 = "_" + c2 case "windows": @@ -275,7 +275,7 @@ func TestParseCGOArchive(t *testing.T) { obj := io.NewSectionReader(f, e.Offset, e.Size) switch runtime.GOOS { - case "darwin": + case "darwin", "ios": mf, err := macho.NewFile(obj) if err != nil { t.Fatal(err) diff --git a/src/cmd/internal/dwarf/dwarf.go b/src/cmd/internal/dwarf/dwarf.go index 6ab83639ac..b2fd5262bb 100644 --- a/src/cmd/internal/dwarf/dwarf.go +++ b/src/cmd/internal/dwarf/dwarf.go @@ -378,7 +378,7 @@ func expandPseudoForm(form uint8) uint8 { return form } expandedForm := DW_FORM_udata - if objabi.GOOS == "darwin" { + if objabi.GOOS == "darwin" || objabi.GOOS == "ios" { expandedForm = DW_FORM_data4 } return uint8(expandedForm) diff --git a/src/cmd/internal/objabi/head.go b/src/cmd/internal/objabi/head.go index 95b8db3809..48ff292307 100644 --- a/src/cmd/internal/objabi/head.go +++ b/src/cmd/internal/objabi/head.go @@ -54,7 +54,7 @@ func (h *HeadType) Set(s string) error { switch s { case "aix": *h = Haix - case "darwin": + case "darwin", "ios": *h = Hdarwin case "dragonfly": *h = Hdragonfly diff --git a/src/cmd/internal/objabi/util.go b/src/cmd/internal/objabi/util.go index d2d6fdbda8..b81b73a022 100644 --- a/src/cmd/internal/objabi/util.go +++ b/src/cmd/internal/objabi/util.go @@ -139,7 +139,7 @@ func init() { } // Note: must agree with runtime.framepointer_enabled. -var Framepointer_enabled = GOARCH == "amd64" || GOARCH == "arm64" && (GOOS == "linux" || GOOS == "darwin") +var Framepointer_enabled = GOARCH == "amd64" || GOARCH == "arm64" && (GOOS == "linux" || GOOS == "darwin" || GOOS == "ios") func addexp(s string) { // Could do general integer parsing here, but the runtime copy doesn't yet. diff --git a/src/cmd/internal/sys/supported.go b/src/cmd/internal/sys/supported.go index c27b3b986d..b2b3b02bf6 100644 --- a/src/cmd/internal/sys/supported.go +++ b/src/cmd/internal/sys/supported.go @@ -38,7 +38,7 @@ func MustLinkExternal(goos, goarch string) bool { if goarch != "arm64" { return true } - case "darwin": + case "darwin", "ios": if goarch == "arm64" { return true } diff --git a/src/cmd/link/internal/ld/ar.go b/src/cmd/link/internal/ld/ar.go index 52adbc3bab..e4fd591676 100644 --- a/src/cmd/link/internal/ld/ar.go +++ b/src/cmd/link/internal/ld/ar.go @@ -170,7 +170,7 @@ func readArmap(filename string, f *bio.Reader, arhdr ArHdr) archiveMap { // For Mach-O and PE/386 files we strip a leading // underscore from the symbol name. - if objabi.GOOS == "darwin" || (objabi.GOOS == "windows" && objabi.GOARCH == "386") { + if objabi.GOOS == "darwin" || objabi.GOOS == "ios" || (objabi.GOOS == "windows" && objabi.GOARCH == "386") { if name[0] == '_' && len(name) > 1 { name = name[1:] } diff --git a/src/cmd/link/internal/ld/config.go b/src/cmd/link/internal/ld/config.go index 2373b500e3..9aa59fa3e3 100644 --- a/src/cmd/link/internal/ld/config.go +++ b/src/cmd/link/internal/ld/config.go @@ -51,7 +51,7 @@ func (mode *BuildMode) Set(s string) error { *mode = BuildModePIE case "c-archive": switch objabi.GOOS { - case "aix", "darwin", "linux": + case "aix", "darwin", "ios", "linux": case "freebsd": switch objabi.GOARCH { case "amd64": diff --git a/src/cmd/link/internal/ld/outbuf_test.go b/src/cmd/link/internal/ld/outbuf_test.go index db0a92485e..e6643da396 100644 --- a/src/cmd/link/internal/ld/outbuf_test.go +++ b/src/cmd/link/internal/ld/outbuf_test.go @@ -17,7 +17,7 @@ func TestMMap(t *testing.T) { switch runtime.GOOS { default: t.Skip("unsupported OS") - case "aix", "darwin", "dragonfly", "freebsd", "linux", "netbsd", "openbsd", "windows": + case "aix", "darwin", "ios", "dragonfly", "freebsd", "linux", "netbsd", "openbsd", "windows": } dir, err := ioutil.TempDir("", "TestMMap") if err != nil { diff --git a/src/cmd/nm/nm_test.go b/src/cmd/nm/nm_test.go index 5d7fff0f99..413a4eb06f 100644 --- a/src/cmd/nm/nm_test.go +++ b/src/cmd/nm/nm_test.go @@ -283,7 +283,7 @@ func testGoLib(t *testing.T, iscgo bool) { if iscgo { syms = append(syms, symType{"B", "mylib.TestCgodata", false, false}) syms = append(syms, symType{"T", "mylib.TestCgofunc", false, false}) - if runtime.GOOS == "darwin" || (runtime.GOOS == "windows" && runtime.GOARCH == "386") { + if runtime.GOOS == "darwin" || runtime.GOOS == "ios" || (runtime.GOOS == "windows" && runtime.GOARCH == "386") { syms = append(syms, symType{"D", "_cgodata", true, false}) syms = append(syms, symType{"T", "_cgofunc", true, false}) } else if runtime.GOOS == "aix" { |
