mirror of
https://github.com/golang/go
synced 2024-11-23 12:50:12 -07:00
all: add GOOS=ios GOARCH=amd64 target for the ios simulator
The Go toolchain has supported the simulator for years, but always in buildmode=c-archive which is intrinsically externally linked and PIE. This CL moves that support from GOOS=darwin GOARCH=amd64 -tags=ios to just GOOS=ios GOARCH=amd64 to match the change for iOS devices. This change also forces external linking and defaults to buildmode=pie to support Go binaries in the default buildmode to run on the simulator. CL 255257 added the necessary support to the exec wrapper. Updates #38485 Fixes #42100 Change-Id: I6e6ee0e8d421be53b31e3d403880e5b9b880d031 Reviewed-on: https://go-review.googlesource.com/c/go/+/263798 Reviewed-by: Austin Clements <austin@google.com> Reviewed-by: Cherry Zhang <cherryyz@google.com> Trust: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
parent
f8aecbbff5
commit
431d58da69
1
src/cmd/dist/build.go
vendored
1
src/cmd/dist/build.go
vendored
@ -1557,6 +1557,7 @@ var cgoEnabled = map[string]bool{
|
||||
"android/arm": true,
|
||||
"android/arm64": true,
|
||||
"ios/arm64": true,
|
||||
"ios/amd64": true,
|
||||
"js/wasm": false,
|
||||
"netbsd/386": true,
|
||||
"netbsd/amd64": true,
|
||||
|
@ -1966,7 +1966,9 @@ func externalLinkingForced(p *Package) bool {
|
||||
if cfg.BuildContext.GOARCH != "arm64" {
|
||||
return true
|
||||
}
|
||||
case "darwin", "ios":
|
||||
case "ios":
|
||||
return true
|
||||
case "darwin":
|
||||
if cfg.BuildContext.GOARCH == "arm64" {
|
||||
return true
|
||||
}
|
||||
|
@ -168,7 +168,10 @@ func buildModeInit() {
|
||||
ldBuildmode = "pie"
|
||||
case "windows":
|
||||
ldBuildmode = "pie"
|
||||
case "darwin", "ios":
|
||||
case "ios":
|
||||
codegenArg = "-shared"
|
||||
ldBuildmode = "pie"
|
||||
case "darwin":
|
||||
switch cfg.Goarch {
|
||||
case "arm64":
|
||||
codegenArg = "-shared"
|
||||
|
@ -88,6 +88,7 @@ func BuildModeSupported(compiler, buildmode, goos, goarch string) bool {
|
||||
"android/amd64", "android/arm", "android/arm64", "android/386",
|
||||
"freebsd/amd64",
|
||||
"darwin/amd64", "darwin/arm64",
|
||||
"ios/amd64", "ios/arm64",
|
||||
"aix/ppc64",
|
||||
"windows/386", "windows/amd64", "windows/arm":
|
||||
return true
|
||||
|
@ -42,13 +42,7 @@ func (mode *BuildMode) Set(s string) error {
|
||||
*mode = BuildModeExe
|
||||
case "pie":
|
||||
switch objabi.GOOS {
|
||||
case "aix", "android", "linux", "windows":
|
||||
case "darwin":
|
||||
switch objabi.GOARCH {
|
||||
case "amd64", "arm64":
|
||||
default:
|
||||
return badmode()
|
||||
}
|
||||
case "aix", "android", "linux", "windows", "darwin", "ios":
|
||||
case "freebsd":
|
||||
switch objabi.GOARCH {
|
||||
case "amd64":
|
||||
|
14
src/runtime/rt0_ios_amd64.s
Normal file
14
src/runtime/rt0_ios_amd64.s
Normal file
@ -0,0 +1,14 @@
|
||||
// Copyright 2020 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
#include "textflag.h"
|
||||
|
||||
// internal linking executable entry point.
|
||||
// ios/amd64 only supports external linking.
|
||||
TEXT _rt0_amd64_ios(SB),NOSPLIT|NOFRAME,$0
|
||||
UNDEF
|
||||
|
||||
// library entry point.
|
||||
TEXT _rt0_amd64_ios_lib(SB),NOSPLIT|NOFRAME,$0
|
||||
JMP _rt0_amd64_darwin_lib(SB)
|
Loading…
Reference in New Issue
Block a user