-
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/link: unexpected trampoline error on ppc64le musl with -buildmode=pie #52337
Comments
@pmur |
This re-enables 866f2e1. While Go 1.18.1 fixed the initial linking error we encountered with Go 1.18 on ppc64le it seems there are two more regressions with -buildmode=pie and CGO_CFLAGS=-Os. See: * golang/go#52336 * golang/go#52337 Forcing external link mode seems to be a workaround for now. Fixes #13692
Yes, we should be generating TOC-relative trampolines when internal linking PIE. I will prepare a patch. |
Change https://go.dev/cl/400234 mentions this issue: |
I'm working on backporting the patch that fixes this issue to golang 1.18.2, but I'm experiencing some problems. Maybe someone will have an idea here. FWIW, I'm working on backporting this patch into Ubuntu's golang for its Kinetic series (development release), because the golang currently shipped is affected by this bug on ppc64le (which is ultimately impacting other software that use PIE during build). After backporting this patch, the bug seems to be resolved for those software and I can get a build to complete; however, I start experiencing problems when I try to build golang 1.18.2 with itself (containing the patch mentioned above):
I'm trying to understand what's going on bug my golang-fu is not great. I cloned this repository and analysed the commits that differ between Maybe I'm missing something here. FWIW, I'm not compiling golang with PIE. I'm happy to provide more info if needed, and/or to file a new bug if that's deemed necessary. Thanks in advance. |
Hi @sergiodj, I'll check to make sure there aren't any soft-dependencies which also need backported. That test is one which forces trampoline generation while using -buildmode=pie. Maybe this is enough justification for a backport? @gopherbot please consider this for backporting to 1.18. |
Backport issue(s) opened: #53107 (for 1.18). Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://go.dev/wiki/MinorReleases. |
Hey @pmur, thanks for looking into this. I will try to block some time during the day today to continue the investigation as well, and will let you know if I find something. |
Ah, you will need to backport https://go-review.googlesource.com/c/go/+/400574 too. That should unblock you. It is a soft-dependency. @cherrymui provided the justification for the backport is OK, is your change OK to include in a backport? |
@pmur yeah, I think so. Thanks for looking into it. |
@pmur Aha, thank you for the pointer. Indeed, after backporting the patch you mentioned I can now build golang itself. Thanks! |
This is (probably) related to #52336 and #51787.
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
)?go env
OutputWhat did you do?
This is issue we encountered when packaging Go software for Alpine Linux Edge ppc64le. On all other architectures, supported by Alpine, the affected Go software builds fine but on ppc64le it fails with a "unexpected trampoline for shared or dynamic linking" error (see also #52336 and #51787).
This issue can only be reproduced with
-buildmode=pie
.One software where this can be reproduced is vault (I have not yet been able to create a minimal example):
See also #51787 (comment)
What did you expect to see?
A successful build.
What did you see instead?
The following error message:
CC: @pmur, @cherrymui
The text was updated successfully, but these errors were encountered: