This is an archive of the discontinued LLVM Phabricator instance.

[LLD][ELF] Eliminate symbols of merged .ARM.exidx sections.
ClosedPublic

Authored by ikudrin on Apr 24 2020, 11:00 AM.

Details

Summary

GNU tools generate mapping symbols "$d" for .ARM.exidx sections. The symbols are added to the symbol table much earlier than the merging takes place, and after that, they become dangling. Before the patch, LLD output those symbols as SHN_ABS with the value of 0. The patch removes such symbols from the symbol table.

Diff Detail

Event Timeline

ikudrin created this revision.Apr 24 2020, 11:00 AM
MaskRay edited reviewers, added: psmith; removed: peter.smith.Apr 24 2020, 12:29 PM

Thanks for the patch. I think what you have looks like it will work.

I'm thinking that there may be a simpler option. As the .ARM.exidx is only accessed via the linker defined start and end symbols and mapping symbols are optional for sections containing data; we can either not add any symbols from .ARM.exidx sections to the symbol table, or strip all of them rather than having to select just the ones defined in the merged sections. Maybe worth seeing if that is possible?

(a minor general comment about the code from me).

lld/ELF/SyntheticSections.cpp
2034 ↗(On Diff #259934)

I think you wanted to use cast:

auto *d = cast<Defined>(s.sym);
ikudrin updated this revision to Diff 260246.Apr 27 2020, 2:27 AM
  • Reworked the patch so that the local symbols for .ARM.exidx sections are not added to the symbols table. Thanks for the suggestion, @psmith!
psmith accepted this revision.Apr 27 2020, 9:52 AM

Thanks for the update, I'm happy with that. Will be worth seeing if MaskRay or George have any final comments.

This revision is now accepted and ready to land.Apr 27 2020, 9:52 AM
MaskRay added inline comments.Apr 28 2020, 12:31 AM
lld/test/ELF/arm-exidx-mapping-symbols.s
2

///

24

,"ax"

MaskRay accepted this revision.Apr 28 2020, 12:31 AM
MaskRay added inline comments.
lld/test/ELF/arm-exidx-mapping-symbols.s
16

///

This revision was automatically updated to reflect the committed changes.