diff options
| author | Paul E. Murphy <murp@ibm.com> | 2024-03-12 15:00:08 -0500 |
|---|---|---|
| committer | Paul Murphy <murp@ibm.com> | 2024-03-19 20:54:08 +0000 |
| commit | d2eb72fcff90d1c01fb2336a4c6f0f7fd7e01cbc (patch) | |
| tree | 64b6e6ac35737c2837eae5f0abb2b78331f0cd83 /src/cmd/link/internal | |
| parent | 99522de1c38e4915e061cd2dac7d34ee888c8318 (diff) | |
| download | go-d2eb72fcff90d1c01fb2336a4c6f0f7fd7e01cbc.tar.xz | |
cmd/internal/obj/ppc64: don't modify runtime.elf_* symbols
The runtime.elf_* symbols are assembly functions which are used
to support the gcc/llvm -Os option when used with cgo.
When compiling Go for shared code, we attempt to strip out the
TOC regenation code added by the go assembler for these symbols.
This causes the symbol to no longer appear as an assembly
function which causes problems later on when handling other
implicit symbols.
Avoid adding a TOC regeneration prologue to these functions
to avoid this issue.
Fixes #66265
Change-Id: Icbf8e4438d177082a57bb228e39b232e7a0d7ada
Reviewed-on: https://go-review.googlesource.com/c/go/+/571835
Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Paul Murphy <murp@ibm.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Diffstat (limited to 'src/cmd/link/internal')
| -rw-r--r-- | src/cmd/link/internal/ppc64/asm.go | 17 |
1 files changed, 1 insertions, 16 deletions
diff --git a/src/cmd/link/internal/ppc64/asm.go b/src/cmd/link/internal/ppc64/asm.go index 09647d84b1..de5614e92a 100644 --- a/src/cmd/link/internal/ppc64/asm.go +++ b/src/cmd/link/internal/ppc64/asm.go @@ -474,24 +474,9 @@ func rewriteABIFuncReloc(ctxt *ld.Link, ldr *loader.Loader, tname string, r load r.SetAdd(int64((n - minReg) * offMul)) firstUse = !ldr.AttrReachable(ts) if firstUse { - ldr.SetAttrReachable(ts, true) // This function only becomes reachable now. It has been dropped from // the text section (it was unreachable until now), it needs included. - // - // Similarly, TOC regeneration should not happen for these functions, - // remove it from this save/restore function. - if ldr.AttrShared(ts) { - sb := ldr.MakeSymbolUpdater(ts) - sb.SetData(sb.Data()[8:]) - sb.SetSize(sb.Size() - 8) - relocs := sb.Relocs() - // Only one PCREL reloc to .TOC. should be present. - if relocs.Count() != 1 { - log.Fatalf("Unexpected number of relocs in %s\n", ldr.SymName(ts)) - } - sb.ResetRelocs() - - } + ldr.SetAttrReachable(ts, true) } return ts, firstUse } |
