go: cmd/go: Segfault on ppc64le during Go 1.18 build on Alpine Linux

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

$ go version
go version go1.18 linux/ppc64le

Does this issue reproduce with the latest release?

Yes.

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

Since the Go build itself fails, I cannot provide this information. I am using Alpine Linux Edge (which uses musl libc) on ppc64le. I added the go env output for Go 1.17 (which compiles fine on ppc64le Alpine Linux Edge) below.

go env Output
$ go env
$ go env
GO111MODULE=""
GOARCH="ppc64le"
GOBIN=""
GOCACHE="/home/buildozer/.cache/go-build"
GOENV="/home/buildozer/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="ppc64le"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/buildozer/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/buildozer/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/home/buildozer/aports/community/go/src/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/buildozer/aports/community/go/src/go/pkg/tool/linux_ppc64le"
GOVCS=""
GOVERSION="go1.17.8"
GCCGO="gccgo"
GOPPC64="power8"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
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 -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build2007078828=/tmp/go-build -gno-record-gcc-switches

What did you do?

I am working on upgrading the Alpine Linux Go package from 1.17.8 to 1.18. While doing so, I noticed that 1.18 fails to compile on our ppc64le CI. On all other architectures supported by Alpine (aarch64, armhf, armv7, s390x, x86 and x86_64) Go 1.18 builds fine and passes all tests. I would also like to point out that Go 1.17.8 compiles fine and passes tests on ppc64le Alpine Linux.

I assume the Go 1.18 build has been tested on a glibc-based Linux system before? For this reason, I suspect that this might be related to musl libc. In order to reproduce this issue it should be sufficient to run ./make.bash on a ppc64le-based Alpine Linux Edge system (see our build receipe for details).

What did you expect to see?

A successful Go build.

What did you see instead?

A segfault while compile cmd/go:

…
cmd/go/internal/generate
cmd/go/internal/get
cmd/go/internal/run
cmd/go/internal/list
cmd/go/internal/modget
cmd/go/internal/test
cmd/go/internal/vet
cmd/go/internal/bug
cmd/go
go tool dist: FAILED: /builds/alpine/aports/community/go/src/go/bin/go list -gcflags=all= -ldflags=all= -f={{if .Stale}}	STALE {{.ImportPath}}: {{.StaleReason}}{{end}} std cmd: signal: segmentation fault (core dumped)

Full build log with ./make.bash -v from our Alpine ppc64le CI: alpine-linux-edge-ppc64le-go-1.18.txt

Since Go 1.17.8 builds fine, I think this a regression introduced in Go 1.18. Any ideas what might be causing this?

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 17 (11 by maintainers)

Commits related to this issue

Most upvoted comments

Change https://go.dev/cl/394654 mentions this issue: runtime: make static/dynamic detection work with musl on ppc64le

User could pass -ldflags=-linkmode=external. If you want to change the default, you could do something like https://cs.opensource.google/go/go/+/master:src/cmd/link/internal/ld/config.go;l=215 , adding little endian PPC64 there as well. However it would be nice if we could support the musl startup code. Could we support both at same time? I guess it is fine to support redundant arguments.

Yeah, it is probably better as a separate issue. @nmeum when you open a new issue, could you include the command you used to run “go build”? Thanks.

I think this is a separate issue. I would prefer a separate issue. Thanks.