This is an archive of the discontinued LLVM Phabricator instance.

ELF: Allow thunks to change size. NFCI.
ClosedPublic

Authored by pcc on Mar 27 2018, 3:39 PM.

Diff Detail

Repository
rL LLVM

Event Timeline

pcc created this revision.Mar 27 2018, 3:39 PM
ruiu added inline comments.Mar 27 2018, 7:24 PM
lld/ELF/Thunks.cpp
146 ↗(On Diff #140014)

auto -> Defined

346–349 ↗(On Diff #140014)

Perhaps a personal preference, but I'd use a temporary variable like this

Defined *D = addSymbol(...);
D->StOther |= ...;
lld/ELF/Thunks.h
59 ↗(On Diff #140014)

Can you add a comment somewhere why you could have more than one symbol for one thunk?

peter.smith added inline comments.Mar 28 2018, 3:59 AM
lld/ELF/Relocations.cpp
1361 ↗(On Diff #140014)

With assignOffsets() this line may no longer be required. From memory it was used when a thunk was added in a later pass to a pre-existing ThunkSection and if there were no other thunk sections added we reported no addresses changed. It looks like assignOffsets() would catch this.

lld/ELF/Thunks.h
54 ↗(On Diff #140014)

Perhaps getThunkTarget() or getThunkTargetSym() as this would reinforce the 1 target of the Thunk.

59 ↗(On Diff #140014)

I think that the extra symbols are to account for the presence of Arm/Thumb mapping symbols. These are aids for disassembly and aren't part of the interface. There will only ever be one "Thunk Symbol". Perhaps the comment on addSymbols() should say something like "All thunks must define a symbol, known as the thunk symbol, so that we can redirect relocations to it. The thunk may define additional symbols, but these are never targets for relocations.

pcc updated this revision to Diff 140140.Mar 28 2018, 2:26 PM
pcc marked 6 inline comments as done.
  • Address review comments

Thanks, I'm happy with the changes.

ruiu accepted this revision.Mar 29 2018, 2:08 PM

LGTM

This revision is now accepted and ready to land.Mar 29 2018, 2:08 PM
This revision was automatically updated to reflect the committed changes.