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 when building golang.org/x/sys/unix on openbsd/arm64 #42517

Open
vext01 opened this issue Nov 11, 2020 · 4 comments
Open
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
Milestone

Comments

@vext01
Copy link

vext01 commented Nov 11, 2020

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

$ go version
go version go1.15.2 openbsd/arm64

Does this issue reproduce with the latest release?

I don't know. I noticed the issue here. I then cloned this repo and ran go build in the unix directory. The problem can be reproduced there.

(sorry, I am unfamiliar with go stuff. I'm just trying to get syncthing working on OpenBSD/arm64).

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

go env Output
$ go env
GO111MODULE=""
GOARCH="arm64"
GOBIN=""
GOCACHE="/home/edd/.cache/go-build"
GOENV="/home/edd/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="arm64"
GOHOSTOS="openbsd"
GOINSECURE=""
GOMODCACHE="/home/edd/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="openbsd"
GOPATH="/home/edd/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/openbsd_arm64"
GCCGO="gccgo"
AR="ar"
CC="cc"
CXX="c++"
CGO_ENABLED="1"
GOMOD="/home/edd/go/src/golang.org/x/sys/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build514952510=/tmp/go-build -gno-record-gcc-switches"

The machine is a raspberry pi 4.

What did you do?

I cloned this repo and ran go build in the unix directory.

What did you expect to see?

Successful build.

What did you see instead?

$ go build
# golang.org/x/sys/unix
SIGILL: illegal instruction
PC=0x353244 m=0 sigcode=1
instruction bytes: 0x88 0x8 0x40 0xf9 0x88 0xc6 0xff 0xb5 0xe2 0x7 0x0 0xf9 0xc0 0x99 0x80 0xd2

goroutine 36 [running]:
cmd/compile/internal/ssa.rewriteValueARM64_OpARM64CSEL(0x4000dcdc68, 0xffffffffffffff01)
	/usr/local/go/src/cmd/compile/internal/ssa/rewriteARM64.go:3186 +0x784 fp=0x4001221c40 sp=0x4001221bd0 pc=0x353244
cmd/compile/internal/ssa.rewriteValueARM64(0x4000dcdc68, 0x0)
	/usr/local/go/src/cmd/compile/internal/ssa/rewriteARM64.go:69 +0x1590 fp=0x4001221c60 sp=0x4001221c40 pc=0x34b200
cmd/compile/internal/ssa.applyRewrite(0x40006da000, 0x766ac0, 0x766b40)
	/usr/local/go/src/cmd/compile/internal/ssa/rewrite.go:109 +0x390 fp=0x4001222010 sp=0x4001221c60 pc=0x268250
cmd/compile/internal/ssa.lower(0x40006da000)
	/usr/local/go/src/cmd/compile/internal/ssa/lower.go:10 +0x34 fp=0x4001222040 sp=0x4001222010 pc=0x243984
cmd/compile/internal/ssa.Compile(0x40006da000)
	/usr/local/go/src/cmd/compile/internal/ssa/compile.go:93 +0x7ec fp=0x4001225d10 sp=0x4001222040 pc=0x2170fc
cmd/compile/internal/gc.buildssa(0x4000492000, 0x1, 0x0)
	/usr/local/go/src/cmd/compile/internal/gc/ssa.go:460 +0xbd0 fp=0x4001225eb0 sp=0x4001225d10 pc=0x5c71c0
cmd/compile/internal/gc.compileSSA(0x4000492000, 0x1)
	/usr/local/go/src/cmd/compile/internal/gc/pgen.go:317 +0x34 fp=0x4001225f90 sp=0x4001225eb0 pc=0x597564
cmd/compile/internal/gc.compileFunctions.func2(0x40010d97a0, 0x40010cf310, 0x1)
	/usr/local/go/src/cmd/compile/internal/gc/pgen.go:382 +0x34 fp=0x4001225fc0 sp=0x4001225f90 pc=0x649214
runtime.goexit()
	/usr/local/go/src/runtime/asm_arm64.s:1136 +0x4 fp=0x4001225fc0 sp=0x4001225fc0 pc=0x6f334
created by cmd/compile/internal/gc.compileFunctions
	/usr/local/go/src/cmd/compile/internal/gc/pgen.go:380 +0x130

goroutine 1 [chan send]:
cmd/compile/internal/gc.compileFunctions()
	/usr/local/go/src/cmd/compile/internal/gc/pgen.go:388 +0x194
cmd/compile/internal/gc.Main(0x7663e0)
	/usr/local/go/src/cmd/compile/internal/gc/main.go:757 +0x37b0
main.main()
	/usr/local/go/src/cmd/compile/main.go:52 +0xb0

goroutine 37 [runnable]:
cmd/compile/internal/ssa.rewriteValueARM64_OpARM64MADD(0x4000e1c9e0, 0x4000e1f000)
	/usr/local/go/src/cmd/compile/internal/ssa/rewriteARM64.go:4876 +0x1164
cmd/compile/internal/ssa.rewriteValueARM64(0x4000e1c9e0, 0x0)
	/usr/local/go/src/cmd/compile/internal/ssa/rewriteARM64.go:155 +0x558
cmd/compile/internal/ssa.applyRewrite(0x40000fc000, 0x766ac0, 0x766b40)
	/usr/local/go/src/cmd/compile/internal/ssa/rewrite.go:109 +0x390
cmd/compile/internal/ssa.lower(0x40000fc000)
	/usr/local/go/src/cmd/compile/internal/ssa/lower.go:10 +0x34
cmd/compile/internal/ssa.Compile(0x40000fc000)
	/usr/local/go/src/cmd/compile/internal/ssa/compile.go:93 +0x7ec
cmd/compile/internal/gc.buildssa(0x4000892c60, 0x2, 0x0)
	/usr/local/go/src/cmd/compile/internal/gc/ssa.go:460 +0xbd0
cmd/compile/internal/gc.compileSSA(0x4000892c60, 0x2)
	/usr/local/go/src/cmd/compile/internal/gc/pgen.go:317 +0x34
cmd/compile/internal/gc.compileFunctions.func2(0x40010d97a0, 0x40010cf310, 0x2)
	/usr/local/go/src/cmd/compile/internal/gc/pgen.go:382 +0x34
created by cmd/compile/internal/gc.compileFunctions
	/usr/local/go/src/cmd/compile/internal/gc/pgen.go:380 +0x130

goroutine 35 [runnable]:
cmd/compile/internal/ssa.liveValues(0x40004ee000, 0x40010c44c0, 0x12, 0x12, 0x400101a120, 0x88, 0x88, 0x40011b2000, 0x1f, 0x40)
	/usr/local/go/src/cmd/compile/internal/ssa/deadcode.go:153 +0xc24
cmd/compile/internal/ssa.deadcode(0x40004ee000)
	/usr/local/go/src/cmd/compile/internal/ssa/deadcode.go:215 +0x1d8
cmd/compile/internal/ssa.Compile(0x40004ee000)
	/usr/local/go/src/cmd/compile/internal/ssa/compile.go:93 +0x7ec
cmd/compile/internal/gc.buildssa(0x40008ba000, 0x0, 0x0)
	/usr/local/go/src/cmd/compile/internal/gc/ssa.go:460 +0xbd0
cmd/compile/internal/gc.compileSSA(0x40008ba000, 0x0)
	/usr/local/go/src/cmd/compile/internal/gc/pgen.go:317 +0x34
cmd/compile/internal/gc.compileFunctions.func2(0x40010d97a0, 0x40010cf310, 0x0)
	/usr/local/go/src/cmd/compile/internal/gc/pgen.go:382 +0x34
created by cmd/compile/internal/gc.compileFunctions
	/usr/local/go/src/cmd/compile/internal/gc/pgen.go:380 +0x130

goroutine 38 [runnable]:
cmd/compile/internal/ssa.rewriteValueARM64(0x4000e6c1d8, 0x0)
	/usr/local/go/src/cmd/compile/internal/ssa/rewriteARM64.go:8 +0x39f0
cmd/compile/internal/ssa.applyRewrite(0x4000feb340, 0x766ac0, 0x766b40)
	/usr/local/go/src/cmd/compile/internal/ssa/rewrite.go:109 +0x390
cmd/compile/internal/ssa.lower(0x4000feb340)
	/usr/local/go/src/cmd/compile/internal/ssa/lower.go:10 +0x34
cmd/compile/internal/ssa.Compile(0x4000feb340)
	/usr/local/go/src/cmd/compile/internal/ssa/compile.go:93 +0x7ec
cmd/compile/internal/gc.buildssa(0x400080c2c0, 0x3, 0x0)
	/usr/local/go/src/cmd/compile/internal/gc/ssa.go:460 +0xbd0
cmd/compile/internal/gc.compileSSA(0x400080c2c0, 0x3)
	/usr/local/go/src/cmd/compile/internal/gc/pgen.go:317 +0x34
cmd/compile/internal/gc.compileFunctions.func2(0x40010d97a0, 0x40010cf310, 0x3)
	/usr/local/go/src/cmd/compile/internal/gc/pgen.go:382 +0x34
created by cmd/compile/internal/gc.compileFunctions
	/usr/local/go/src/cmd/compile/internal/gc/pgen.go:380 +0x130

r0      0x4000dcdc68
r1      0x3
r2      0x4000dcdc68
r3      0x4000dcff68
r4      0x4000dd11c8
r5      0x4000dceec8
r6      0x709060
r7      0x40006d8028
r8      0x473
r9      0x1
r10     0x1
r11     0x4000dcdaa8
r12     0x4e9
r13     0x1ffffffffffffff
r14     0xff
r15     0x0
r16     0x39
r17     0x18
r18     0x0
r19     0x8
r20     0x4001221c48
r21     0x400064c400
r22     0x6
r23     0x6
r24     0x0
r25     0x4000dd0128
r26     0x766b40
r27     0xc5c3d0
r28     0x40003e9800
r29     0x0
lr      0x34b200
sp      0x4001221bd0
pc      0x353244
fault   0x353244

It seems non-deterministic. I had to restart the machine to reproduce it this time.

@gopherbot gopherbot added this to the Unreleased milestone Nov 11, 2020
@bcmills
Copy link
Contributor

bcmills commented Nov 12, 2020

Note that the openbsd/arm64 platform is not yet supported (see #31656).

CC @4a6f656c

@bcmills bcmills added arch-arm64 OS-OpenBSD NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Nov 12, 2020
@bcmills bcmills changed the title x/sys: Fails to build on OpenBSD/arm64. cmd/compile: SIGILL when building golang.org/x/sys/unix on openbsd/arm64 Nov 12, 2020
@vext01
Copy link
Author

vext01 commented Nov 13, 2020

Note that the openbsd/arm64 platform is not yet supported

Ah. I see.

I hope it will be one day, so that syncthing can run on raspberry pi + openbsd.

@4a6f656c
Copy link
Contributor

@vext01 I highly doubt this is related to Go itself - the openbsd/arm64 builder (on a pine64 board) runs and builds code (including x/sys/unix) without hitting SIGILL. I suspect it is more likely related to OpenBSD instability on rpi (or potentially a hardware issue). I'm not sure what version of OpenBSD you're running, but a current snapshot is probably going to be preferable here.

@vext01
Copy link
Author

vext01 commented Nov 18, 2020

@4a6f656c That was a -current snapshot.

It could be rpi related. I'm not sure.

@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Jul 13, 2022
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
Status: Triage Backlog
Development

No branches or pull requests

4 participants