Skip to content
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 [1.18 backport] #53107

Closed
gopherbot opened this issue May 27, 2022 · 4 comments
Labels
CherryPickApproved Used during the release process for point releases FrozenDueToAge
Milestone

Comments

@gopherbot
Copy link

@pmur requested issue #52337 to be considered for backport to the next 1.18 minor release.

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.

@gopherbot gopherbot added the CherryPickCandidate Used during the release process for point releases label May 27, 2022
@gopherbot gopherbot added this to the Go1.18.3 milestone May 27, 2022
@gopherbot
Copy link
Author

Change https://go.dev/cl/409074 mentions this issue: [release-branch.go1.18] cmd/link: use TOC-relative trampolines on PPC64 when needed

@gopherbot
Copy link
Author

Change https://go.dev/cl/409075 mentions this issue: [release-branch.go1.18] cmd/link: use TOC-relative trampolines on PPC64 when needed

@gopherbot
Copy link
Author

Change https://go.dev/cl/408820 mentions this issue: [release-branch.go1.18] cmd/link: preserve symbol attributes when cloning to external

@dmitshur dmitshur changed the title cmd/go: unexpected trampoline error on ppc64le musl with -buildmode=pie [1.18 backport] cmd/link: unexpected trampoline error on ppc64le musl with -buildmode=pie [1.18 backport] Jun 1, 2022
@dmitshur dmitshur modified the milestones: Go1.18.3, Go1.18.4 Jun 1, 2022
@heschi heschi added the CherryPickApproved Used during the release process for point releases label Jun 15, 2022
@gopherbot gopherbot removed the CherryPickCandidate Used during the release process for point releases label Jun 15, 2022
@gopherbot
Copy link
Author

Closed by merging b80ae10 to release-branch.go1.18.

gopherbot pushed a commit that referenced this issue Jul 6, 2022
…ning to external

There are some symbol attributes that are encoded in the object
file. Currently, they are lost when cloning a symbol to external.
Copy them over.

Also delete CopyAttributes as it is no longer called anywhere.

For #53107. Backporting this CL as the fix of #53107 depends on
it.

Change-Id: I1497e3223a641704bf35aa3e904dd0eda2f8ec3e
Reviewed-on: https://go-review.googlesource.com/c/go/+/400574
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
(cherry picked from commit df08c9a)
Reviewed-on: https://go-review.googlesource.com/c/go/+/408820
gopherbot pushed a commit that referenced this issue Jul 6, 2022
…64 when needed

When linking a PIE binary with the internal linker, TOC relative
relocations need to be generated. Update trampolines to indirect
call using R12 to more closely match the AIX/ELFv2 regardless of
buildmode, and work with position-indepdent code.

Likewise, update the check for offseting R_CALLPOWER relocs to
make a local call. It should be checking ldr.AttrExternal, not
ldr.IsExternal. This offset should not be adjusted for external
(non-go) object files, it is handled when ELF reloc are translated
into go relocs.

And, update trampoline tests to verify these are generated correctly
and produce a working binary using -buildmode=pie on ppc64le.

Fixes #53107

Change-Id: I8a2dea06c3237bdf0e87888b56a17b6c4c99a7de
Reviewed-on: https://go-review.googlesource.com/c/go/+/400234
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Paul Murphy <murp@ibm.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-on: https://go-review.googlesource.com/c/go/+/409075
Run-TryBot: Cherry Mui <cherryyz@google.com>
bradfitz pushed a commit to tailscale/go that referenced this issue Jul 14, 2022
…ning to external

There are some symbol attributes that are encoded in the object
file. Currently, they are lost when cloning a symbol to external.
Copy them over.

Also delete CopyAttributes as it is no longer called anywhere.

For golang#53107. Backporting this CL as the fix of golang#53107 depends on
it.

Change-Id: I1497e3223a641704bf35aa3e904dd0eda2f8ec3e
Reviewed-on: https://go-review.googlesource.com/c/go/+/400574
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
(cherry picked from commit df08c9a)
Reviewed-on: https://go-review.googlesource.com/c/go/+/408820
bradfitz pushed a commit to tailscale/go that referenced this issue Jul 14, 2022
…64 when needed

When linking a PIE binary with the internal linker, TOC relative
relocations need to be generated. Update trampolines to indirect
call using R12 to more closely match the AIX/ELFv2 regardless of
buildmode, and work with position-indepdent code.

Likewise, update the check for offseting R_CALLPOWER relocs to
make a local call. It should be checking ldr.AttrExternal, not
ldr.IsExternal. This offset should not be adjusted for external
(non-go) object files, it is handled when ELF reloc are translated
into go relocs.

And, update trampoline tests to verify these are generated correctly
and produce a working binary using -buildmode=pie on ppc64le.

Fixes golang#53107

Change-Id: I8a2dea06c3237bdf0e87888b56a17b6c4c99a7de
Reviewed-on: https://go-review.googlesource.com/c/go/+/400234
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Paul Murphy <murp@ibm.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-on: https://go-review.googlesource.com/c/go/+/409075
Run-TryBot: Cherry Mui <cherryyz@google.com>
@golang golang locked and limited conversation to collaborators Jul 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
CherryPickApproved Used during the release process for point releases FrozenDueToAge
Projects
None yet
Development

No branches or pull requests

3 participants