Description
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (go version
)?
upstream tip
Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (go env
)?
ppc64le Debian 9
What did you do?
Built golang using all.bash
What did you expect to see?
All tests passed
What did you see instead?
~/golang/test/go/src$ go tool dist test testso
../misc/cgo/testso
./main.exe: error while loading shared libraries: R_PPC64_ADDR16_HA re113298fa4 for symbol `' out of range
2018/09/04 19:10:02 Failed: exit status 127
This does not fail in the go 1.11 branch, and I tracked it down the commit 6417e91.
The commit mentioned above is dropping the -no-pie option, which is the cause of the failure.
commit 247b034:
go tool dist test testso
##### ../misc/cgo/testso
# command-line-arguments
HEADER = -H5 -T0x11000 -D0x0 -R0x10000
0.00 deadcode
0.01 pclntab=247478 bytes, funcdata total 46718 bytes
0.01 dodata
0.01 dwarf
0.02 symsize = 0
0.03 reloc
0.04 asmb
0.04 datblk
0.05 sym
0.05 elfsym
0.05 symsize = 32880
0.05 symsize = 33312
0.06 header
0.17 host link: "gcc" "-m64" "-o" "/tmp/go-build620912334/b001/exe/a.out" "-rdynamic" "-Wl,--compress-debug-sections=zlib-gnu" "/tmp/go-link-627000385/go.o" "/tmp/go-link-627000385/000000.o" "/tmp/go-link-627000385/000001.o" "/tmp/go-link-627000385/000002.o" "/tmp/go-link-627000385/000003.o" "/tmp/go-link-627000385/000004.o" "/tmp/go-link-627000385/000005.o" "/tmp/go-link-627000385/000006.o" "/tmp/go-link-627000385/000007.o" "/tmp/go-link-627000385/000008.o" "/tmp/go-link-627000385/000009.o" "/tmp/go-link-627000385/000010.o" "/tmp/go-link-627000385/000011.o" "/tmp/go-link-627000385/000012.o" "/tmp/go-link-627000385/000013.o" "-g" "-O2" "-L/home/boger/golang/test/go/misc/cgo/testso" "-lcgosotest" "-g" "-O2" "-lpthread" "-no-pie"
0.27 cpu time
23451 symbols
26908 liveness data
ALL TESTS PASSED (some were excluded)
commit 6417e91:
go tool dist test testso
##### ../misc/cgo/testso
# command-line-arguments
HEADER = -H5 -T0x11000 -D0x0 -R0x10000
0.00 deadcode
0.01 pclntab=247478 bytes, funcdata total 46718 bytes
0.01 dodata
0.01 dwarf
0.02 symsize = 0
0.05 reloc
0.05 asmb
0.05 datblk
0.06 sym
0.06 elfsym
0.06 symsize = 32880
0.06 symsize = 33312
0.07 header
0.22 host link: "gcc" "-m64" "-o" "/tmp/go-build377553058/b001/exe/a.out" "-rdynamic" "/tmp/go-link-215391806/go.o" "/tmp/go-link-215391806/000000.o" "/tmp/go-link-215391806/000001.o" "/tmp/go-link-215391806/000002.o" "/tmp/go-link-215391806/000003.o" "/tmp/go-link-215391806/000004.o" "/tmp/go-link-215391806/000005.o" "/tmp/go-link-215391806/000006.o" "/tmp/go-link-215391806/000007.o" "/tmp/go-link-215391806/000008.o" "/tmp/go-link-215391806/000009.o" "/tmp/go-link-215391806/000010.o" "/tmp/go-link-215391806/000011.o" "/tmp/go-link-215391806/000012.o" "/tmp/go-link-215391806/000013.o" "-g" "-O2" "-L/home/boger/golang/test/go/misc/cgo/testso" "-lcgosotest" "-g" "-O2" "-lpthread"
0.29 cpu time
23451 symbols
26908 liveness data
./main.exe: error while loading shared libraries: R_PPC64_ADDR16_HA re10f2f8fa4 for symbol `' out of range
2018/09/05 09:53:14 Failed: exit status 127
We've seen similar problems in the past related to the use of the -pie option. In some distros, gcc uses -pie by default, so golang should be passing -no-pie to the external linker.
There were similar error messages with issue #21954.