Skip to content

Commit ab0f045

Browse files
Bryan C. Millsgopherbot
Bryan C. Mills
authored andcommitted
cmd/dist,internal/platform: reenable the c-archive build mode on ios
Also fix misc/cgo/testcarchive to provide a missing CoreFoundation dependency at link time. Fixes #58221. Updates #58172. Updates #58225. Change-Id: Ib8b6e52ed2914596615da4c427df2fe984722de6 Reviewed-on: https://go-review.googlesource.com/c/go/+/463752 Run-TryBot: Bryan Mills <[email protected]> Auto-Submit: Bryan Mills <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Cherry Mui <[email protected]>
1 parent 6224db9 commit ab0f045

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

misc/cgo/testcarchive/carchive_test.go

+9
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,15 @@ func testMain(m *testing.M) int {
132132
// in .text section.
133133
cc = append(cc, "-Wl,-bnoobjreorder")
134134
}
135+
if GOOS == "ios" {
136+
// Linking runtime/cgo on ios requires the CoreFoundation framework because
137+
// x_cgo_init uses CoreFoundation APIs to switch directory to the app root.
138+
//
139+
// TODO(#58225): This special case probably should not be needed.
140+
// runtime/cgo is a very low-level package, and should not provide
141+
// high-level behaviors like changing the current working directory at init.
142+
cc = append(cc, "-framework", "CoreFoundation")
143+
}
135144
libbase := GOOS + "_" + GOARCH
136145
if runtime.Compiler == "gccgo" {
137146
libbase = "gccgo_" + libgodir + "_fPIC"

src/cmd/dist/test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1143,7 +1143,7 @@ func (t *tester) supportedBuildmode(mode string) bool {
11431143
return false
11441144
}
11451145
switch goos {
1146-
case "aix", "darwin", "windows":
1146+
case "aix", "darwin", "ios", "windows":
11471147
return true
11481148
case "linux":
11491149
switch goarch {

src/internal/platform/supported.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ func BuildModeSupported(compiler, buildmode, goos, goarch string) bool {
101101

102102
case "c-archive":
103103
switch goos {
104-
case "aix", "darwin", "windows":
104+
case "aix", "darwin", "ios", "windows":
105105
return true
106106
case "linux":
107107
switch goarch {

0 commit comments

Comments
 (0)