-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/link: regression on some distros for ppc64le with CL 130316 #27510
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
Comments
Hmm this doesn't reproduce for me on Ubuntu 18.04. I can't really see why that commit would break things here, I guess one would need to dump out the command line the linker is using to test compat and see why it fails... |
This only fails for me on Debian 9. The -no-pie option was passed to the linker due to this issue #17847 but now it is removed. |
As I show above, before this commit, gcc was passing -no-pie to the external linker but after this commit it does not. At some point gcc started passing -pie by default to ld so golang had to pass -no-pie to override it. |
Please use the go tool's CL 130316 was not supposed to change whether we pass |
Distros with binutils 2.29 or later don't fail. Debian 9 is the only one I found with 2.28. Perhaps a fix went in after 2.28 to fix a problem. I will try to track that down further. This CL removes the -no-pie when invoking the external linker. Is that the correct/expected behavior? |
I posted that last one before seeing your most recent comment. Here is what I see when I hack into cmd/dist/test.go to add the -x option to the go build command (or is there any easier way to do that? Sure would help in debugging.) /home/boger/golang/base/go/pkg/tool/linux_ppc64le/link -o $WORK/b001/exe/a.out -importcfg $WORK/b001/importcfg.link -buildmode=exe -buildid=yOqLpa4EXqY0Lp2pUyTE/7HIRw7u34JSv5mK_5IeT/KNTcbpoY3nfiB17VRqFN/yOqLpa4EXqY0Lp2pUyTE -extld=gcc $WORK/b001/pkg.a I don't see -extldflags. I think -no-pie gets set in this code in cmd/link/internal/ld/lib.go, not because it was passed as an argument to the linker.
|
The only effect of CL 130316 that apparently caused this problem was to add the value of In the comment above you are quoting the old code. That's not what the linker code looks like now or in 1.11. Can you change |
When linkerFlagSupported was changed to pass extra linker options when linking trivial.c, this happens on Debian 9/binutils 2.28:
So that causes linkerFlagSupported to return false for -no-pie since it contains the undefined string and -no-pie doesn't get added to the list of flags for ld. I don't know why the linker error message from within linkerFlagSupported does not occur for other distros/binutils,. It is passing the same options to linkerFlagSupported on another system I tried. |
@laboger Thanks. Working on a patch. |
Change https://golang.org/cl/134057 mentions this issue: |
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:
commit 6417e91:
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.
The text was updated successfully, but these errors were encountered: