HomePhabricator

ELF: Add .interp synthetic sections first in createSyntheticSections().

Authored by pcc on Oct 1 2019, 9:10 AM.

Description

ELF: Add .interp synthetic sections first in createSyntheticSections().

Our .interp section is not a SyntheticSection. As a result, it terminates the
loop in removeUnusedSyntheticSections(). This has at least two consequences:

  • The synthetic .bss and .bss.rel.ro sections are always present in dynamically linked executables, even when they are not needed.
  • The synthetic .ARM.exidx (and possibly other) sections are always present in partitions other than the last one, even when not needed. .ARM.exidx in particular is problematic because it assumes that its list of code sections is non-empty in getLinkOrderDep(), which can lead to a crash if the partition does not have any code sections.

Fix these problems by moving the creation of the .interp sections to the
top of createSyntheticSections(). While here, make the code a little less
error-prone by changing the add() lambdas to take a SyntheticSection instead
of an InputSectionBase.

Differential Revision: https://reviews.llvm.org/D68256

llvm-svn: 373347

Details

Committed
pccOct 1 2019, 9:10 AM
Differential Revision
D68256: ELF: Add .interp synthetic sections first in createSyntheticSections().
Parents
rGe53680002228: [AMDGPU] Add VerifyScheduling support.
Branches
Unknown
Tags
Unknown