Skip to content

misc/cgo/testsigfwd: Test fails starting with 1.19 on x86 Alpine Linux #54422

@nmeum

Description

@nmeum

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

$ go version
go version go1.19 linux/386

Does this issue reproduce with the latest release?

Yes.

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

go env Output
$ go env
GO111MODULE=""
GOARCH="386"
GOBIN="/home/buildozer/src/aports/community/go/src/go/bin"
GOCACHE="/home/buildozer/.cache/go-build"
GOENV="/home/buildozer/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS="-buildmode=pie -modcacherw"
GOHOSTARCH="386"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/buildozer/.local/share/go/modcache"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/buildozer/src/aports/community/go/src"
GOPRIVATE=""
GOPROXY="direct"
GOROOT="/home/buildozer/src/aports/community/go/src/go"
GOSUMDB="off"
GOTMPDIR=""
GOTOOLDIR="/home/buildozer/src/aports/community/go/src/go/pkg/tool/linux_386"
GOVCS=""
GOVERSION="go1.19"
GCCGO="gccgo"
GO386="sse2"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m32 -pthread -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build1188913618=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Compiled Go from source using ./make.bash on x86 Alpine Linux Edge with 365ca69 backported. Afterwards, invoked the test suite using ./run.bash -run='!(^cgo_test$)' (cgo tests are known to fail on Alpine due to #39857).

What did you expect to see?

Successful test run.

What did you see instead?

A test failure of ../misc/cgo/testsigfwd:

##### ../misc/cgo/testsigfwd
# misc/cgo/testsigfwd
cgo: cannot load DWARF output from $WORK/b001//_cgo_.o: zlib: invalid header
2022/08/12 18:10:59 Failed: exit status 2

Full build log: alpine-linux-x86-edge-go-1.19.txt

I am aware that Alpine/musl is not fully supported by the test suite (see #19938 etc.), however, I am still reporting this as the test case passed with Go 1.18 (and also passes on all other architectures supported by Alpine). Furthermore, this seems to be related to #52919 and #54313 as the test case passes successfully with the following change (as discussed in the referenced issues, Alpine uses -fstack-protector by default):

diff -upr go.orig/misc/cgo/testsigfwd/main.go go/misc/cgo/testsigfwd/main.go
--- go.orig/misc/cgo/testsigfwd/main.go	2022-08-12 20:28:17.222319036 +0200
+++ go/misc/cgo/testsigfwd/main.go	2022-08-12 20:28:45.752384953 +0200
@@ -7,7 +7,7 @@ package main
 import "fmt"
 
 /*
-#cgo CFLAGS: -pthread
+#cgo CFLAGS: -pthread -fno-stack-protector
 #cgo LDFLAGS: -pthread
 
 #include <signal.h>

If -fstack-protector is generally unsupported on all Go architectures, then I would suggest having cgo add that to the compiler flags by default unconditionally. If it is just about this test case it would also be sufficient to commit the diff from above (with this diff the run.bash invocation from above succeeds). However, I don't fully understand why it worked prior to Go 1.19 without -fno-stack-protector.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.WaitingForInfoIssue is not actionable because of missing required information, which needs to be provided.compiler/runtimeIssues related to the Go compiler and/or runtime.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions