-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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/dist: misc/cgo/test: incorrect pie options used for ppc64x #21954
Comments
Why would the failures only occur on Ubuntu? Is there some difference in the default system linker? |
In any case I agree that this test seems a bit dubious and that it should probably be using |
(The -pie tests were added in https://golang.org/cl/6280). |
If I try to build these tests with -buildmode=pie it does build the test and it says it passes but I get this warning. Not sure if it matters: searching for runtime.a in $WORK/_/home/boger/golang/go1.9/go/misc/cgo/nocgo/test/runtime.a My toolchain doesn't have a pkg/linux_ppc64le_shared directory and I'm not sure what causes it to get built. I went looking for that directory on various systems and golang builds I've done and see that it is there sometimes but not others and I'm not aware of what I might have done to cause it to be created and populated. |
I don't know why this failure only happens on Ubuntu 16.04. I built on a 17.04 as well as earlier Ubuntu versions, and some RHEL 7.x systems and they all worked. 16.04 has 2.26.1, 17.04 has 2.28. I believe the message comes from the dynamic linker at runtime so maybe the glibc version is a factor. Once I noticed that the testscase is not using valid linker options for ppc64le, I no longer thought it was important why it failed, especially since it did not seem easy for me to figure that out. |
Change https://golang.org/cl/66870 mentions this issue: |
with latest code, following tests are passed:
But breaking later in the code:
|
created #22126 to track above issue. |
Change https://golang.org/cl/73970 mentions this issue: |
…=-pie Errors occur in runtime test testCgoPprofPIE when the test is built by passing -pie to the external linker with code that was not built as PIC. This occurs on ppc64le because non-PIC is the default, and fails only on newer distros where the address range used for programs is high enough to cause relocation overflow. This test should be built with -buildmode=pie since that correctly generates PIC with -pie. Related issues are #21954 and #22126. Updates #22459 Change-Id: Ib641440bc9f94ad2b97efcda14a4b482647be8f7 Reviewed-on: https://go-review.googlesource.com/73970 Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
What version of Go are you using (go version)?
go version go1.9 linux/ppc64le and go upstream
Does this issue reproduce with the latest release?
Yes, but the failures only happen on Unbuntu 16.04 and no other distro we've tried.
What operating system and processor architecture are you using (go env)?
Failures have only been seen on Ubuntu 16.04.
ppc64le
When building golang with ./all.bash, failures occur in some tests in misc/cgo/test with errors like this:
error while loading shared libraries: R_PPC64_ADDR16_HA re136cd776c for symbol `' out of range
After digging through cmd/dist/test.go I found that the failures occurred only when the tests were built with the external linker when passing -pie as a flag to the external linker. For example in misc/cgo/nocgo I can build the test by hand:
go test -ldflags '-linkmode=external "-extldflags=-pie"' -c
./nocgo.test
./nocgo.test: error while loading shared libraries: R_PPC64_ADDR16_HA re136cd776c for symbol `' out of range
According to the linker documentation -pie should only be used with position independent code, but for ppc64x, it is not PIC by default. Either these tests should not be built and run on ppc64x with these options, or different options should be used. It seems like -buildmode=pie is what should be used here because that will build PIC but I tried that and that resulted in different build errors which I haven't investigated yet.
The text was updated successfully, but these errors were encountered: