]> Cypherpunks.ru repositories - gostls13.git/commitdiff
cmd/dist,internal/platform: reenable the c-archive build mode on ios
authorBryan C. Mills <bcmills@google.com>
Wed, 1 Feb 2023 17:33:11 +0000 (12:33 -0500)
committerGopher Robot <gobot@golang.org>
Wed, 1 Feb 2023 19:47:35 +0000 (19:47 +0000)
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 <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
misc/cgo/testcarchive/carchive_test.go
src/cmd/dist/test.go
src/internal/platform/supported.go

index 30e12be6c64bb6b5348ac24049740b42bc6ef527..8a39c24a6dcc1134fea38447d92e95c35137cf24 100644 (file)
@@ -132,6 +132,15 @@ func testMain(m *testing.M) int {
                // in .text section.
                cc = append(cc, "-Wl,-bnoobjreorder")
        }
+       if GOOS == "ios" {
+               // Linking runtime/cgo on ios requires the CoreFoundation framework because
+               // x_cgo_init uses CoreFoundation APIs to switch directory to the app root.
+               //
+               // TODO(#58225): This special case probably should not be needed.
+               // runtime/cgo is a very low-level package, and should not provide
+               // high-level behaviors like changing the current working directory at init.
+               cc = append(cc, "-framework", "CoreFoundation")
+       }
        libbase := GOOS + "_" + GOARCH
        if runtime.Compiler == "gccgo" {
                libbase = "gccgo_" + libgodir + "_fPIC"
index b540984e38f0bb2920367aa84922d7fff5aca0f5..35a9b50a7006f0217df7ccd57a8da05eac37d57d 100644 (file)
@@ -1143,7 +1143,7 @@ func (t *tester) supportedBuildmode(mode string) bool {
                        return false
                }
                switch goos {
-               case "aix", "darwin", "windows":
+               case "aix", "darwin", "ios", "windows":
                        return true
                case "linux":
                        switch goarch {
index 857aff4d947a791d08e08fbaa61a0c367fbbe4c2..4c75b1d849b0c5eebcee0b85b6e21c041909bcce 100644 (file)
@@ -101,7 +101,7 @@ func BuildModeSupported(compiler, buildmode, goos, goarch string) bool {
 
        case "c-archive":
                switch goos {
-               case "aix", "darwin", "windows":
+               case "aix", "darwin", "ios", "windows":
                        return true
                case "linux":
                        switch goarch {