Page MenuHomePhabricator

[PPC64] Update LocalEntry from assigned symbols
Needs ReviewPublic

Authored by luporl on Jan 11 2019, 3:25 AM.

Details

Summary

On PowerPC64 ELFv2 ABI, functions may have 2 entry points: global and local.
The local entry point location of a function is stored in the st_other field of the symbol, as an offset relative to the global entry point.

In order to make symbol assignments (e.g. .equ/.set) work properly with this, PPCTargetELFStreamer already copies the local entry bits from the source symbol to the destination one, on emitAssignment(). The problem is that this copy is performed only at the assignment location, where the source symbol may not yet have processed the .localentry directive, that sets the local entry. This may cause the destination symbol to end up with wrong local entry information. Other symbol info is not affected by this because, in this case, the destination symbol value is actually a symbol reference.

This change keeps track of these assignments, and update all needed st_other fields when finish() is called.

Diff Detail

Event Timeline

luporl created this revision.Jan 11 2019, 3:25 AM
luporl edited the summary of this revision. (Show Details)Jan 11 2019, 3:48 AM
luporl added reviewers: labath, clayborg.
luporl added subscribers: lbianc, leitao.
labath resigned from this revision.Jan 11 2019, 4:18 AM

I suggest having this reviewed by the PPC target owner in llvm.

luporl edited reviewers, added: hfinkel; removed: labath, clayborg.Jan 11 2019, 4:21 AM
luporl added a subscriber: labath.

I suggest having this reviewed by the PPC target owner in llvm.

Ok, thanks, sorry.

One particular place this is needed is to handle FreeBSD powerpc64 (ELFv2 experimental) libc's weak symbols / symbol aliasing, especially when using LLD (in my experience, binutils ld will partially compensate for this issue.)

Herald added a project: Restricted Project. · View Herald TranscriptThu, Feb 21, 11:42 AM