cmd/cgo: cannot link (cgo) on linux/arm with -no-pie
#45940
Labels
arch-arm
Issues solely affecting the 32-bit arm architecture.
compiler/runtime
Issues related to the Go compiler and/or runtime.
NeedsFix
The path to resolution is known, but the work has not been done.
Milestone
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?linux/arm
go env
OutputWhat did you do?
compiling a go-module with cgo and .cxx (swig generated) with the following command on linux/arm:
CGO_LDFLAGS="-no-pie" go build \ -v -x \ main.go
What did you expect to see?
the cxx compiler (g++) command as a linker frontend is started with the
-no-pie
parameter and the without the-pie
paramaterWhat did you see instead?
as you can see, g++ ist started with
-no-pie
and-pie
. the second ond overwrites the first one. But my static library (mylib1) is compiled without-fPIC
, so the command fails with "/usr/bin/ld: somefancyapp/libs/linux/arm/libmylib1.a(lib1.o): relocation R_ARM_MOVW_ABS_NC against `a local symbol' can not be used when making a shared object; recompile with -fPIC"The reason
In the toolchain is a hardcoded condition wich add's
-pie
to the command.I can't find any reason for the statement we need to use -pie for Linux/ARM to get accurate imported sym.
Additionaly i checked out the master branch, uncommented ot this lines, build a local patched go toolchain.
Compiling and testing my app with the patched toolchain works well.
The text was updated successfully, but these errors were encountered: