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/cgo: linux-{386,amd64}-clang and linux-arm builders failing #26197

Closed
mundaym opened this issue Jul 3, 2018 · 7 comments

Comments

@mundaym
Copy link
Member

commented Jul 3, 2018

Appears to have been triggered by CL 89655.

linux-386-clang: https://build.golang.org/log/0bef8033f7380e36756d6ce63cdec841108010de

# _/workdir/go/misc/cgo/test.test
/workdir/go/pkg/tool/linux_386/link: running /usr/bin/clang failed: exit status 1
/usr/bin/ld: dynamic STT_GNU_IFUNC symbol `strcmp' with pointer equality in `/usr/bin/../lib/gcc/x86_64-linux-gnu/4.9/../../../../lib32/libc.a(strcmp.o)' can not be used when making an executable; recompile with -fPIE and relink with -pie
clang: error: linker command failed with exit code 1 (use -v to see invocation)

FAIL	_/workdir/go/misc/cgo/test [build failed]

linux-amd64-clang: https://build.golang.org/log/c233d2a2dd1486978f0030a3aec3a656340c5aa5

# _/workdir/go/misc/cgo/test.test
/workdir/go/pkg/tool/linux_amd64/link: running /usr/bin/clang failed: exit status 1
/usr/bin/ld: dynamic STT_GNU_IFUNC symbol `strcmp' with pointer equality in `/usr/bin/../lib/gcc/x86_64-linux-gnu/4.9/../../../x86_64-linux-gnu/libc.a(strcmp.o)' can not be used when making an executable; recompile with -fPIE and relink with -pie
clang: error: linker command failed with exit code 1 (use -v to see invocation)

FAIL	_/workdir/go/misc/cgo/test [build failed]

linux-arm: https://build.golang.org/log/d34739a782a08aed7a8ca08f130d35a7ec2767cb

# _/workdir/go/misc/cgo/test
/usr/bin/ld: /usr/lib/gcc/arm-linux-gnueabihf/5/crtbeginT.o: relocation R_ARM_THM_MOVW_ABS_NC against `a local symbol' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/arm-linux-gnueabihf/5/crtbeginT.o: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
FAIL	_/workdir/go/misc/cgo/test [build failed]

@mundaym mundaym added this to the Go1.11 milestone Jul 3, 2018

@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

commented Jul 3, 2018

The problem with clang is that passing -rdynamic clang is causing it to pass -export-dynamic to /usr/bin/ld which is causing the linker to report this error.

@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

commented Jul 3, 2018

And in fact there is code in cmd/link to handle exactly this case, but it only applies to -extldflags, not to CGO_LDFLAGS.

@gopherbot

This comment has been minimized.

Copy link

commented Jul 3, 2018

Change https://golang.org/cl/122135 mentions this issue: cmd/link: remove -rdynamic if -static appears in cgo LDFLAGS

@gopherbot

This comment has been minimized.

Copy link

commented Jul 3, 2018

Change https://golang.org/cl/122155 mentions this issue: cmd/go: don't pass both -static and -pie to cgo compiler

gopherbot pushed a commit that referenced this issue Jul 4, 2018
cmd/link: remove -rdynamic if -static appears in cgo LDFLAGS
We already remove -rdynamic if -static appears in -extldflags.
Extend that to apply to CGO_LDFLAGS and #cgo LDFLAGS as well.

Updates #26197

Change-Id: Ibb62d1b20726916a12fd889acb05c1c559a5ace2
Reviewed-on: https://go-review.googlesource.com/122135
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>

@gopherbot gopherbot closed this in 36c6230 Jul 4, 2018

@zhangyoufu

This comment has been minimized.

Copy link

commented Jul 4, 2018

When the glibc library is built with --enable-static-pie the resulting libc.a is usable with GCC 8 and above to create static PIE executables using the GCC option '-static-pie'. This feature is currently supported on i386, x86_64 and x32 with binutils 2.29 or later, and on aarch64 with binutils 2.30 or later.

Any plan on support static pie executable?

@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

commented Jul 4, 2018

@zhangyoufu I don't think that has anything to do with this issue, which is about some failing tests. Please ask on a forum; see https://golang.org/wiki/Questions . Thanks.

@gopherbot

This comment has been minimized.

Copy link

commented Jul 4, 2018

Change https://golang.org/cl/122196 mentions this issue: cmd/cgo: mark C result as written for msan

robertgzr added a commit to balena-os/balena-engine that referenced this issue Mar 5, 2019
hack/make: Do not set -buildmode=pie
I get this build failure on arm architectures:
```
/usr/local/go/pkg/tool/linux_arm/link: running gcc failed: exit status 1
/usr/bin/ld: /usr/lib/gcc/arm-linux-gnueabihf/6/../../../arm-linux-gnueabihf/libpthread.a(pthread_create.o): relocation R_ARM_THM_MOVW_ABS_NC against `a local symbol' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/arm-linux-gnueabihf/6/../../../arm-linux-gnueabihf/libpthread.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
```
which looks a lot like golang/go#26197

Signed-off-by: Robert Günzler <robertg@balena.io>

@golang golang locked and limited conversation to collaborators Jul 4, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
4 participants
You can’t perform that action at this time.