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

runtime/cgo(.text): unknown symbol __stack_chk_fail_local in pcrel (regression in 1.19 when building for i686) #54313

Closed
kanavin opened this issue Aug 6, 2022 · 13 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@kanavin
Copy link

kanavin commented Aug 6, 2022

1.19 no longer builds for i686 targets (where 1.18 was working fine):

# cmd/trace
runtime/cgo(.text): unknown symbol __stack_chk_fail_local in pcrel
runtime/cgo(.text): unknown symbol __stack_chk_fail_local in pcrel
runtime/cgo(.text): unknown symbol __stack_chk_fail_local in pcrel
runtime/cgo(.text): unknown symbol __stack_chk_fail_local in pcrel
runtime/cgo(.text): unknown symbol __stack_chk_fail_local in pcrel
runtime/cgo(.text): relocation target __stack_chk_fail_local not defined
runtime/cgo(.text): relocation target __stack_chk_fail_local not defined
# cmd/pprof
runtime/cgo(.text): unknown symbol __stack_chk_fail_local in pcrel
runtime/cgo(.text): unknown symbol __stack_chk_fail_local in pcrel
runtime/cgo(.text): unknown symbol __stack_chk_fail_local in pcrel
runtime/cgo(.text): unknown symbol __stack_chk_fail_local in pcrel
runtime/cgo(.text): unknown symbol __stack_chk_fail_local in pcrel
runtime/cgo(.text): relocation target __stack_chk_fail_local not defined
runtime/cgo(.text): relocation target __stack_chk_fail_local not defined
# cmd/go
runtime/cgo(.text): unknown symbol __stack_chk_fail_local in pcrel
runtime/cgo(.text): unknown symbol __stack_chk_fail_local in pcrel
runtime/cgo(.text): unknown symbol __stack_chk_fail_local in pcrel
runtime/cgo(.text): unknown symbol __stack_chk_fail_local in pcrel
runtime/cgo(.text): unknown symbol __stack_chk_fail_local in pcrel
runtime/cgo(.text): relocation target __stack_chk_fail_local not defined
runtime/cgo(.text): relocation target __stack_chk_fail_local not defined

CGO_CFLAGS=-fno-stack-protector is a workaround.

See here for others having the same issue:
#52919

@ianlancetaylor
Copy link
Contributor

Please fill out the issue template. Or at least tell us your GOOS and GOARCH values. Thanks.

@seankhliao seankhliao added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Aug 7, 2022
@zhsj
Copy link
Contributor

zhsj commented Aug 7, 2022

It's caused by C flags -fstack-protector-strong

go env

GO111MODULE="on"
GOARCH="386"
GOBIN=""
GOCACHE="/root/.cache/go-build"
GOENV="/root/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="386"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/work/gopath/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/work/gopath/"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/lib/go-1.19"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go-1.19/pkg/tool/linux_386"
GOVCS=""
GOVERSION="go1.19"
GCCGO="gccgo"
GO386="softfloat"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/work/gopath/src/github.com/ClusterHQ/flocker-go/go.mod"
GOWORK=""
CGO_CFLAGS="-fstack-protector-strong"
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-build3479471873=/tmp/go-build -gno-record-gcc-switches"

go build works, but go test fails.

root@f4fdf4ead70c:/work/gopath/src/github.com/ClusterHQ/flocker-go# go build ./...
root@f4fdf4ead70c:/work/gopath/src/github.com/ClusterHQ/flocker-go# go test ./...
# github.com/ClusterHQ/flocker-go.test
runtime/cgo(.text): unknown symbol __stack_chk_fail_local in pcrel
runtime/cgo(.text): unknown symbol __stack_chk_fail_local in pcrel
runtime/cgo(.text): unknown symbol __stack_chk_fail_local in pcrel
runtime/cgo(.text): unknown symbol __stack_chk_fail_local in pcrel
runtime/cgo(.text): unknown symbol __stack_chk_fail_local in pcrel
runtime/cgo(.text): relocation target __stack_chk_fail_local not defined
runtime/cgo(.text): relocation target __stack_chk_fail_local not defined
FAIL    github.com/ClusterHQ/flocker-go [build failed]
FAIL

-fstack-protector-strong works on go1.18.

@kanavin
Copy link
Author

kanavin commented Aug 7, 2022

Please fill out the issue template. Or at least tell us your GOOS and GOARCH values. Thanks.

Apologies. Does the above clarify matters?

@ianlancetaylor
Copy link
Contributor

@kanavin Thanks. Does https://go.dev/cl/421935 fix the problem for you?

@gopherbot
Copy link
Contributor

Change https://go.dev/cl/421935 mentions this issue: runtime/cgo: add -fno-stack-protector to CFLAGS

@kanavin
Copy link
Author

kanavin commented Aug 8, 2022

@kanavin Thanks. Does https://go.dev/cl/421935 fix the problem for you?

Thanks, it does.

@dmitshur dmitshur added this to the Go1.20 milestone Aug 8, 2022
@dmitshur dmitshur added NeedsFix The path to resolution is known, but the work has not been done. and removed WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. labels Aug 8, 2022
jproberts pushed a commit to jproberts/go that referenced this issue Aug 10, 2022
Some compilers default to having -fstack-protector on, which breaks
when using internal linking because the linker doesn't know how to
find the support functions.

Fixes golang#52919
Fixes golang#54313

Change-Id: I6f51d5e906503f61fc768ad8e30c163bad135087
Reviewed-on: https://go-review.googlesource.com/c/go/+/421935
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
i404788 added a commit to i404788/seaweedfs-csi-driver that referenced this issue Aug 21, 2022
tmm1 pushed a commit to fancybits/go that referenced this issue Aug 30, 2022
Some compilers default to having -fstack-protector on, which breaks
when using internal linking because the linker doesn't know how to
find the support functions.

Fixes golang#52919
Fixes golang#54313

Change-Id: I6f51d5e906503f61fc768ad8e30c163bad135087
Reviewed-on: https://go-review.googlesource.com/c/go/+/421935
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
(cherry picked from commit 365ca69)
@tmm1
Copy link
Contributor

tmm1 commented Aug 30, 2022

Can this be backported to 1.19?

@gopherbot please backport this issue to go1.19

@gopherbot
Copy link
Contributor

Backport issue(s) opened: #54764 (for 1.19).

Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://go.dev/wiki/MinorReleases.

@heschi
Copy link
Contributor

heschi commented Aug 31, 2022

This only affects 386? Does it need a backport to 1.18?

@tmm1
Copy link
Contributor

tmm1 commented Aug 31, 2022

Yes only i386 builds are affected.

go1.18 is not affected.

svenklemm added a commit to timescale/timescaledb-docker that referenced this issue Oct 6, 2022
Use go 1.18.7 to work around build problem in go with
-fstack-protector-strong

golang/go#54313
@gopherbot
Copy link
Contributor

Change https://go.dev/cl/456855 mentions this issue: os/user,net: add -fno-stack-protector to CFLAGS

gopherbot pushed a commit that referenced this issue Dec 16, 2022
Some compilers default to having -fstack-protector on, which breaks
when using internal linking because the linker doesn't know how to
find the support functions.

Updates #52919.
Updates #54313.
Fixes #57261.

Change-Id: Iaae731851407af4521fff2dfefc5b7e3e92cf284
Reviewed-on: https://go-review.googlesource.com/c/go/+/456855
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
@gopherbot
Copy link
Contributor

Change https://go.dev/cl/466936 mentions this issue: cmd/link: try libspp_nonshared.a when looking for "__stack_chk_fail_local"

@gopherbot
Copy link
Contributor

Change https://go.dev/cl/466935 mentions this issue: cmd/cgo: add -fno-stack-protector to CFLAGS (again)

gopherbot pushed a commit that referenced this issue Feb 10, 2023
Add -fno-stack-protector back to the default set of CFLAGS for cgo, so
as to avoid problems with internal linking locating the library
containing the "__stack_chk_fail_local" support function that some
compilers emit (the specific archive can vary based on GOOS).

Updates #52919.
Updates #54313.
Updates #57261.
Updates #58385.

Change-Id: I4591bfb15501f04b7afe1fcd50c4fb93c86db63d
Reviewed-on: https://go-review.googlesource.com/c/go/+/466935
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
gopherbot pushed a commit that referenced this issue Feb 10, 2023
…ocal"

Update the code that tries to satisfy unresolved references to
"__stack_chk_fail_local" to look for "libssp_nonshared.a" in addition
to "libc_nonshared.a" (the former archive is the correct place on
Alpine).

Updates #52919.
Updates #54313.
Updates #57261.
Fixes #58385.

Change-Id: Id6cd3ebb4d5388df50a838e6efa5e5b683545b01
Reviewed-on: https://go-review.googlesource.com/c/go/+/466936
Run-TryBot: Than McIntosh <thanm@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
johanbrandhorst pushed a commit to Pryz/go that referenced this issue Feb 12, 2023
Add -fno-stack-protector back to the default set of CFLAGS for cgo, so
as to avoid problems with internal linking locating the library
containing the "__stack_chk_fail_local" support function that some
compilers emit (the specific archive can vary based on GOOS).

Updates golang#52919.
Updates golang#54313.
Updates golang#57261.
Updates golang#58385.

Change-Id: I4591bfb15501f04b7afe1fcd50c4fb93c86db63d
Reviewed-on: https://go-review.googlesource.com/c/go/+/466935
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
johanbrandhorst pushed a commit to Pryz/go that referenced this issue Feb 12, 2023
…ocal"

Update the code that tries to satisfy unresolved references to
"__stack_chk_fail_local" to look for "libssp_nonshared.a" in addition
to "libc_nonshared.a" (the former archive is the correct place on
Alpine).

Updates golang#52919.
Updates golang#54313.
Updates golang#57261.
Fixes golang#58385.

Change-Id: Id6cd3ebb4d5388df50a838e6efa5e5b683545b01
Reviewed-on: https://go-review.googlesource.com/c/go/+/466936
Run-TryBot: Than McIntosh <thanm@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
@golang golang locked and limited conversation to collaborators Feb 9, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

8 participants