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/compile: sigill in go_bootstrap on openbsd/arm64 #64261

Closed
rpn32 opened this issue Nov 19, 2023 · 2 comments
Closed

cmd/compile: sigill in go_bootstrap on openbsd/arm64 #64261

rpn32 opened this issue Nov 19, 2023 · 2 comments
Labels
arch-arm64 compiler/runtime Issues related to the Go compiler and/or runtime. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-OpenBSD

Comments

@rpn32
Copy link

rpn32 commented Nov 19, 2023

What version of Go are you using (go version)?

$ go version
go version go1.21.3 openbsd/arm64

Does this issue reproduce with the latest release?

Yes, both go1.21.4 and master (commit: aa9dd50)

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=''
GOARCH='arm64'
GOBIN=''
GOCACHE='/home/r/.cache/go-build'
GOENV='/home/r/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='arm64'
GOHOSTOS='openbsd'
GOINSECURE=''
GOMODCACHE='/home/r/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='openbsd'
GOPATH='/home/r/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/openbsd_arm64'
GOVCS=''
GOVERSION='go1.21.3'
GCCGO='gccgo'
AR='ar'
CC='cc'
CXX='c++'
CGO_ENABLED='1'
GOMOD='/dev/null'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -pthread -fno-caret-diagnostics -Qunused-arguments -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build930530136=/tmp/go-build -gno-record-gcc-switches'

What did you do?

I tried building go from source with the following setup:

OpenBSD -current (18-Nov-2023)
QEMU master (commit: 34a5cb6d)
MacOS 14.1.1 (23B2082)
Apple M3 Max

sudo qemu-system-aarch64 \
-machine virt \
-cpu host \
-accel hvf \
-smp 4 \
-m 4096 \
-drive file=$disk,if=virtio,index=0,media=disk,format=qcow2 \
-drive file=$image,if=virtio,index=1,media=cdrom \
-nographic \
-nic vmnet-shared,mac=$mac,model=virtio-net-pci \
-bios /usr/local/share/qemu/edk2-aarch64-code.fd \
-serial pty \
-monitor none

What did you expect to see?

I expected a successful build.

What did you see instead?

./all.bash

Building Go cmd/dist using /usr/local/go. (go1.21.3 openbsd/arm64)
Building Go toolchain1 using /usr/local/go.
Building Go bootstrap cmd/go (go_bootstrap) using Go toolchain1.
Building Go toolchain2 using go_bootstrap and Go toolchain1.
go tool dist: FAILED: /home/r/src/go/pkg/tool/openbsd_arm64/go_bootstrap install -pgo=off cmd/asm cmd/cgo cmd/compile cmd/link: signal: illegal instruction (core dumped)


lldb go_bootstrap

* thread #1, stop reason = signal SIGILL
    frame #0: 0x00000000000800f0 go_bootstrap`_rt0_arm64_openbsd
go_bootstrap`_rt0_arm64_openbsd:
->  0x800f0 <+0>:  ldr    x0, [sp]
    0x800f4 <+4>:  add    x1, sp, #0x8
    0x800f8 <+8>:  bl     0x80100                   ; main
    0x800fc <+12>: udf    #0x0
@seankhliao seankhliao added OS-OpenBSD NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. arch-arm64 labels Nov 19, 2023
@seankhliao seankhliao changed the title go_bootstrap: illegal instruction (core dumped) on openbsd/arm64 cmd/compile: sigill in go_bootstrap on openbsd/arm64 Nov 19, 2023
@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Nov 19, 2023
@seankhliao
Copy link
Member

cc @golang/openbsd

@rpn32
Copy link
Author

rpn32 commented Nov 20, 2023

I've investigated further and applying the patches from the openbsd ports tree prevents go_bootstrap from failing.

This just happened to be a case where platform specific patches haven't been merged with upstream.

@rpn32 rpn32 closed this as completed Nov 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arch-arm64 compiler/runtime Issues related to the Go compiler and/or runtime. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-OpenBSD
Projects
None yet
Development

No branches or pull requests

3 participants