This is an archive of the discontinued LLVM Phabricator instance.

[LLD][ELF] Mark ARM Exceptions that refer to folded code as not live
ClosedPublic

Authored by peter.smith on Apr 11 2017, 5:51 AM.

Details

Summary

ARM Exception Index Table sections .ARM.exidx have an implicit dependency on code sections via SHF_LINK_ORDER. When code sections are folded by ICF we must mark the unique .ARM.exidx table that describes it as not live to prevent an illegal entry in the exception table.

Note that we do not try and follow the relocations from the .ARM.exidx section to the .ARM.extab sections to mark these as not live. Leaving these sections is not a correctness problem. In theory these could be removed via an application of garbage collection.

Fixes https://bugs.llvm.org/show_bug.cgi?id=32614

Diff Detail

Repository
rL LLVM

Event Timeline

peter.smith created this revision.Apr 11 2017, 5:51 AM
ruiu edited edge metadata.Apr 12 2017, 1:56 PM

LGTM. I thought for a while to try to find a better way, but looks like this is the simplest way of doing it.

ELF/ICF.cpp
382–391 ↗(On Diff #94806)

Looks like this can be

if (Config->EMachine == EM_ARM)
  for (InputSectionBase *Sec : InputSections)
    if (auto *S = dyn_cast<InputSection>(Sec))
      if (S->Flags & SHF_LINK_ORDER)
        S->getLinkOrderDep()->Live = S->Live;
This revision was automatically updated to reflect the committed changes.