Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/go: cannot build valid bootstrap for GOOS=ios GOARCH=arm64 #49842

Closed
changkun opened this issue Nov 29, 2021 · 3 comments
Closed

cmd/go: cannot build valid bootstrap for GOOS=ios GOARCH=arm64 #49842

changkun opened this issue Nov 29, 2021 · 3 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@changkun
Copy link
Member

Host:

$ uname -a
Darwin changkun.local 21.1.0 Darwin Kernel Version 21.1.0: Wed Oct 13 17:33:24 PDT 2021; root:xnu-8019.41.5~1/RELEASE_ARM64_T8101 arm64

Build a bootstrap for GOOS=ios GOARCH=arm64 in $GOROOT/src:

GOOS=ios GOARCH=arm64 CGO_ENABLED=1 ./bootstrap.bash
  • Tested Case 1: Use go1.15.15.darwin.amd64 to build go1.16.10.darwin.arm64
Output
$ GOOS=ios GOARCH=arm64 CGO_ENABLED=1 ./bootstrap.bash                                                                                                                                                       [9:12:54]
#### Copying to ../../go-ios-arm64-bootstrap

Cleaning ../../go-ios-arm64-bootstrap

Building ../../go-ios-arm64-bootstrap

Building Go cmd/dist using /Users/changkun/goes/go1.15.15-amd64. (go1.15.15 darwin/amd64)
Building Go toolchain1 using /Users/changkun/goes/go1.15.15-amd64.
Building Go bootstrap cmd/go (go_bootstrap) using Go toolchain1.
Building Go toolchain2 using go_bootstrap and Go toolchain1.
Building Go toolchain3 using go_bootstrap and Go toolchain2.
Building packages and commands for host, darwin/amd64.
Building packages and commands for target, ios/arm64.

runtime/cgo

gcc_arm64.S:28:16: error: brackets expression not supported on this target
stp x29, x30, [sp, #-96]!
^
gcc_arm64.S:32:2: error: unknown use of instruction mnemonic without a size suffix
mov x29, sp
^
gcc_arm64.S:34:16: error: brackets expression not supported on this target
stp x19, x20, [sp, #80]
^
gcc_arm64.S:37:16: error: brackets expression not supported on this target
stp x21, x22, [sp, #64]
^
gcc_arm64.S:40:16: error: brackets expression not supported on this target
stp x23, x24, [sp, #48]
^
gcc_arm64.S:43:16: error: brackets expression not supported on this target
stp x25, x26, [sp, #32]
^
gcc_arm64.S:46:16: error: brackets expression not supported on this target
stp x27, x28, [sp, #16]
^
gcc_arm64.S:50:2: error: unknown use of instruction mnemonic without a size suffix
mov x19, x0
^
gcc_arm64.S:51:2: error: unknown use of instruction mnemonic without a size suffix
mov x20, x1
^
gcc_arm64.S:52:2: error: unknown use of instruction mnemonic without a size suffix
mov x0, x2
^
gcc_arm64.S:54:2: error: invalid instruction mnemonic 'blr'
blr x20
^~~
gcc_arm64.S:55:2: error: invalid instruction mnemonic 'blr'
blr x19
^~~
gcc_arm64.S:57:16: error: brackets expression not supported on this target
ldp x27, x28, [sp, #16]
^
gcc_arm64.S:60:16: error: brackets expression not supported on this target
ldp x25, x26, [sp, #32]
^
gcc_arm64.S:63:16: error: brackets expression not supported on this target
ldp x23, x24, [sp, #48]
^
gcc_arm64.S:66:16: error: brackets expression not supported on this target
ldp x21, x22, [sp, #64]
^
gcc_arm64.S:69:16: error: brackets expression not supported on this target
ldp x19, x20, [sp, #80]
^
gcc_arm64.S:72:16: error: brackets expression not supported on this target
ldp x29, x30, [sp], #96

  • Tested Case 2: Use go1.16.darwin.amd64 to build go1.16.10.darwin.arm64
Output
$ GOOS=ios GOARCH=arm64 CGO_ENABLED=1 ./bootstrap.bash                                                                                                                                                       [9:15:48]
#### Copying to ../../go-ios-arm64-bootstrap

Cleaning ../../go-ios-arm64-bootstrap

Building ../../go-ios-arm64-bootstrap

Building Go cmd/dist using /Users/changkun/goes/go1.16-amd64. (go1.16 darwin/amd64)
Building Go toolchain1 using /Users/changkun/goes/go1.16-amd64.
Building Go bootstrap cmd/go (go_bootstrap) using Go toolchain1.
Building Go toolchain2 using go_bootstrap and Go toolchain1.
Building Go toolchain3 using go_bootstrap and Go toolchain2.
Building packages and commands for host, darwin/amd64.
Building packages and commands for target, ios/arm64.

runtime/cgo

gcc_arm64.S:28:16: error: brackets expression not supported on this target
stp x29, x30, [sp, #-96]!
^
gcc_arm64.S:32:2: error: unknown use of instruction mnemonic without a size suffix
mov x29, sp
^
gcc_arm64.S:34:16: error: brackets expression not supported on this target
stp x19, x20, [sp, #80]
^
gcc_arm64.S:37:16: error: brackets expression not supported on this target
stp x21, x22, [sp, #64]
^
gcc_arm64.S:40:16: error: brackets expression not supported on this target
stp x23, x24, [sp, #48]
^
gcc_arm64.S:43:16: error: brackets expression not supported on this target
stp x25, x26, [sp, #32]
^
gcc_arm64.S:46:16: error: brackets expression not supported on this target
stp x27, x28, [sp, #16]
^
gcc_arm64.S:50:2: error: unknown use of instruction mnemonic without a size suffix
mov x19, x0
^
gcc_arm64.S:51:2: error: unknown use of instruction mnemonic without a size suffix
mov x20, x1
^
gcc_arm64.S:52:2: error: unknown use of instruction mnemonic without a size suffix
mov x0, x2
^
gcc_arm64.S:54:2: error: invalid instruction mnemonic 'blr'
blr x20
^~~
gcc_arm64.S:55:2: error: invalid instruction mnemonic 'blr'
blr x19
^~~
gcc_arm64.S:57:16: error: brackets expression not supported on this target
ldp x27, x28, [sp, #16]
^
gcc_arm64.S:60:16: error: brackets expression not supported on this target
ldp x25, x26, [sp, #32]
^
gcc_arm64.S:63:16: error: brackets expression not supported on this target
ldp x23, x24, [sp, #48]
^
gcc_arm64.S:66:16: error: brackets expression not supported on this target
ldp x21, x22, [sp, #64]
^
gcc_arm64.S:69:16: error: brackets expression not supported on this target
ldp x19, x20, [sp, #80]
^
gcc_arm64.S:72:16: error: brackets expression not supported on this target
ldp x29, x30, [sp], #96
^
go tool dist: FAILED: /Users/changkun/goes/go-ios-arm64-bootstrap/pkg/tool/darwin_amd64/go_bootstrap install -gcflags=all= -ldflags=all= std cmd: exit status 2

  • Tested Case 3: Use go1.16.darwin.arm64 to build go1.16.10.darwin.arm64
Output
$ GOOS=ios GOARCH=arm64 CGO_ENABLED=1 ./bootstrap.bash                                                                                                                                                       [9:18:24]
#### Copying to ../../go-ios-arm64-bootstrap

Cleaning ../../go-ios-arm64-bootstrap

Building ../../go-ios-arm64-bootstrap

Building Go cmd/dist using /Users/changkun/goes/go1.16-arm64. (go1.16 darwin/arm64)
Building Go toolchain1 using /Users/changkun/goes/go1.16-arm64.
Building Go bootstrap cmd/go (go_bootstrap) using Go toolchain1.
Building Go toolchain2 using go_bootstrap and Go toolchain1.
Building Go toolchain3 using go_bootstrap and Go toolchain2.
Building packages and commands for host, darwin/arm64.
Building packages and commands for target, ios/arm64.

cmd/addr2line

/Users/changkun/goes/go-ios-arm64-bootstrap/pkg/tool/darwin_arm64/link: /Users/changkun/goes/go-ios-arm64-bootstrap/pkg/tool/darwin_arm64/link: combining dwarf failed: unknown load command 0x80000034 (2147483700)

cmd/buildid

/Users/changkun/goes/go-ios-arm64-bootstrap/pkg/tool/darwin_arm64/link: /Users/changkun/goes/go-ios-arm64-bootstrap/pkg/tool/darwin_arm64/link: combining dwarf failed: unknown load command 0x80000034 (2147483700)

cmd/api

/Users/changkun/goes/go-ios-arm64-bootstrap/pkg/tool/darwin_arm64/link: /Users/changkun/goes/go-ios-arm64-bootstrap/pkg/tool/darwin_arm64/link: combining dwarf failed: unknown load command 0x80000034 (2147483700)

cmd/cgo

/Users/changkun/goes/go-ios-arm64-bootstrap/pkg/tool/darwin_arm64/link: /Users/changkun/goes/go-ios-arm64-bootstrap/pkg/tool/darwin_arm64/link: combining dwarf failed: unknown load command 0x80000034 (2147483700)

cmd/cover

/Users/changkun/goes/go-ios-arm64-bootstrap/pkg/tool/darwin_arm64/link: /Users/changkun/goes/go-ios-arm64-bootstrap/pkg/tool/darwin_arm64/link: combining dwarf failed: unknown load command 0x80000034 (2147483700)

cmd/fix

/Users/changkun/goes/go-ios-arm64-bootstrap/pkg/tool/darwin_arm64/link: /Users/changkun/goes/go-ios-arm64-bootstrap/pkg/tool/darwin_arm64/link: combining dwarf failed: unknown load command 0x80000034 (2147483700)

cmd/doc

/Users/changkun/goes/go-ios-arm64-bootstrap/pkg/tool/darwin_arm64/link: /Users/changkun/goes/go-ios-arm64-bootstrap/pkg/tool/darwin_arm64/link: combining dwarf failed: unknown load command 0x80000034 (2147483700)

cmd/dist

/Users/changkun/goes/go-ios-arm64-bootstrap/pkg/tool/darwin_arm64/link: /Users/changkun/goes/go-ios-arm64-bootstrap/pkg/tool/darwin_arm64/link: combining dwarf failed: unknown load command 0x80000034 (2147483700)

cmd/asm

/Users/changkun/goes/go-ios-arm64-bootstrap/pkg/tool/darwin_arm64/link: /Users/changkun/goes/go-ios-arm64-bootstrap/pkg/tool/darwin_arm64/link: combining dwarf failed: unknown load command 0x80000034 (2147483700)

cmd/gofmt

/Users/changkun/goes/go-ios-arm64-bootstrap/pkg/tool/darwin_arm64/link: /Users/changkun/goes/go-ios-arm64-bootstrap/pkg/tool/darwin_arm64/link: combining dwarf failed: unknown load command 0x80000034 (2147483700)

cmd/pack

/Users/changkun/goes/go-ios-arm64-bootstrap/pkg/tool/darwin_arm64/link: /Users/changkun/goes/go-ios-arm64-bootstrap/pkg/tool/darwin_arm64/link: combining dwarf failed: unknown load command 0x80000034 (2147483700)

cmd/nm

/Users/changkun/goes/go-ios-arm64-bootstrap/pkg/tool/darwin_arm64/link: /Users/changkun/goes/go-ios-arm64-bootstrap/pkg/tool/darwin_arm64/link: combining dwarf failed: unknown load command 0x80000034 (2147483700)

cmd/objdump

/Users/changkun/goes/go-ios-arm64-bootstrap/pkg/tool/darwin_arm64/link: /Users/changkun/goes/go-ios-arm64-bootstrap/pkg/tool/darwin_arm64/link: combining dwarf failed: unknown load command 0x80000034 (2147483700)

cmd/test2json

/Users/changkun/goes/go-ios-arm64-bootstrap/pkg/tool/darwin_arm64/link: /Users/changkun/goes/go-ios-arm64-bootstrap/pkg/tool/darwin_arm64/link: combining dwarf failed: unknown load command 0x80000034 (2147483700)

cmd/vet

/Users/changkun/goes/go-ios-arm64-bootstrap/pkg/tool/darwin_arm64/link: /Users/changkun/goes/go-ios-arm64-bootstrap/pkg/tool/darwin_arm64/link: combining dwarf failed: unknown load command 0x80000034 (2147483700)

cmd/trace

/Users/changkun/goes/go-ios-arm64-bootstrap/pkg/tool/darwin_arm64/link: /Users/changkun/goes/go-ios-arm64-bootstrap/pkg/tool/darwin_arm64/link: combining dwarf failed: unknown load command 0x80000034 (2147483700)

cmd/pprof

/Users/changkun/goes/go-ios-arm64-bootstrap/pkg/tool/darwin_arm64/link: /Users/changkun/goes/go-ios-arm64-bootstrap/pkg/tool/darwin_arm64/link: combining dwarf failed: unknown load command 0x80000034 (2147483700)

cmd/link

/Users/changkun/goes/go-ios-arm64-bootstrap/pkg/tool/darwin_arm64/link: /Users/changkun/goes/go-ios-arm64-bootstrap/pkg/tool/darwin_arm64/link: combining dwarf failed: unknown load command 0x80000034 (2147483700)

cmd/go

/Users/changkun/goes/go-ios-arm64-bootstrap/pkg/tool/darwin_arm64/link: /Users/changkun/goes/go-ios-arm64-bootstrap/pkg/tool/darwin_arm64/link: combining dwarf failed: unknown load command 0x80000034 (2147483700)
^C

  • Tested Case 4: Use go1.16.darwin.amd64 to build go1.17.3.darwin.arm64
Output
$ GOOS=ios GOARCH=arm64 CGO_ENABLED=1 ./bootstrap.bash                                                                               [9:28:09]
#### Copying to ../../go-ios-arm64-bootstrap

Cleaning ../../go-ios-arm64-bootstrap

Building ../../go-ios-arm64-bootstrap

Building Go cmd/dist using /Users/changkun/goes/go1.16-amd64. (go1.16 darwin/amd64)
Building Go toolchain1 using /Users/changkun/goes/go1.16-amd64.
Building Go bootstrap cmd/go (go_bootstrap) using Go toolchain1.
Building Go toolchain2 using go_bootstrap and Go toolchain1.
Building Go toolchain3 using go_bootstrap and Go toolchain2.
Building packages and commands for host, darwin/amd64.
Building packages and commands for target, ios/arm64.

runtime/cgo

gcc_arm64.S:28:16: error: brackets expression not supported on this target
stp x29, x30, [sp, #-96]!
^
gcc_arm64.S:32:2: error: unknown use of instruction mnemonic without a size suffix
mov x29, sp
^
gcc_arm64.S:34:16: error: brackets expression not supported on this target
stp x19, x20, [sp, #80]
^
gcc_arm64.S:37:16: error: brackets expression not supported on this target
stp x21, x22, [sp, #64]
^
gcc_arm64.S:40:16: error: brackets expression not supported on this target
stp x23, x24, [sp, #48]
^
gcc_arm64.S:43:16: error: brackets expression not supported on this target
stp x25, x26, [sp, #32]
^
gcc_arm64.S:46:16: error: brackets expression not supported on this target
stp x27, x28, [sp, #16]
^
gcc_arm64.S:50:2: error: unknown use of instruction mnemonic without a size suffix
mov x19, x0
^
gcc_arm64.S:51:2: error: unknown use of instruction mnemonic without a size suffix
mov x20, x1
^
gcc_arm64.S:52:2: error: unknown use of instruction mnemonic without a size suffix
mov x0, x2
^
gcc_arm64.S:54:2: error: invalid instruction mnemonic 'blr'
blr x20
^~~
gcc_arm64.S:55:2: error: invalid instruction mnemonic 'blr'
blr x19
^~~
gcc_arm64.S:57:16: error: brackets expression not supported on this target
ldp x27, x28, [sp, #16]
^
gcc_arm64.S:60:16: error: brackets expression not supported on this target
ldp x25, x26, [sp, #32]
^
gcc_arm64.S:63:16: error: brackets expression not supported on this target
ldp x23, x24, [sp, #48]
^
gcc_arm64.S:66:16: error: brackets expression not supported on this target
ldp x21, x22, [sp, #64]
^
gcc_arm64.S:69:16: error: brackets expression not supported on this target
ldp x19, x20, [sp, #80]
^
gcc_arm64.S:72:16: error: brackets expression not supported on this target
ldp x29, x30, [sp], #96

  • Tested Case 5: Use go1.16.darwin.arm64 to build go1.17.3.darwin.arm64
Output
$ GOOS=ios GOARCH=arm64 CGO_ENABLED=1 ./bootstrap.bash                                                                                                                                                       [9:20:41]
#### Copying to ../../go-ios-arm64-bootstrap

Cleaning ../../go-ios-arm64-bootstrap

Building ../../go-ios-arm64-bootstrap

Building Go cmd/dist using /Users/changkun/goes/go1.16-arm64. (go1.16 darwin/arm64)
Building Go toolchain1 using /Users/changkun/goes/go1.16-arm64.
Building Go bootstrap cmd/go (go_bootstrap) using Go toolchain1.
Building Go toolchain2 using go_bootstrap and Go toolchain1.
Building Go toolchain3 using go_bootstrap and Go toolchain2.
Building packages and commands for host, darwin/arm64.
Building packages and commands for target, ios/arm64.

Bootstrap toolchain for ios/arm64 installed in /Users/changkun/goes/go-ios-arm64-bootstrap.
Building tbz.
-rw-r--r-- 1 changkun admin 136713892 Nov 29 09:22 /Users/changkun/goes/go-ios-arm64-bootstrap.tbz
$ scp ../../go-ios-arm64-bootstrap.tbz ios:/var/root
go-ios-arm64-bootstrap.tbz 100% 130MB 3.4MB/s 00:38
$ ios tar xjf go-ios-arm64-bootstrap.tbz
$ ios find go-ios-arm64-bootstrap -executable -type f | ios xargs -n1 ldid -S
$ ios go-ios-arm64-bootstrap/bin/go version
dyld: in '/private/var/root/go-ios-arm64-bootstrap/bin/go' segment filesize exceeds vmsize

Case 5 can build a bootstrap successfully but cannot execute the go command on iOS, the key error message:

$ ios go-ios-arm64-bootstrap/bin/go version
dyld: in '/private/var/root/go-ios-arm64-bootstrap/bin/go' segment filesize exceeds vmsize
@changkun changkun changed the title cmd/go: cannot build valid bootstrap for GOOS=ios GOARCH=amd64 cmd/go: cannot build valid bootstrap for GOOS=ios GOARCH=arm64 Nov 29, 2021
@cherrymui
Copy link
Member

Have you tried setting CC_FOR_TARGET=GOROOT/misc/ios/clangwrap.sh ? See also https://cs.opensource.google/go/go/+/master:misc/ios/README

@mknyszek mknyszek added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Nov 30, 2021
@mknyszek mknyszek added this to the Backlog milestone Nov 30, 2021
@mknyszek
Copy link
Contributor

Is this an issue at tip?

@cherrymui is cmd/go the right place for this?

@changkun
Copy link
Member Author

Thanks a lot! That's the missing setting. Let's see if the new bootstrap could fix failures on the iOS builders, such as https://build.golang.org/log/1506b5dc8e4ce7c3722f5a44bc3de9ea2270818a.

Close for now.

@golang golang locked and limited conversation to collaborators Nov 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

4 participants