Skip to content

Commit

Permalink
Revert "[LLD][ELF][ARM] Fix ARM Exidx order for non monotonic section…
Browse files Browse the repository at this point in the history
… order"

This reverts commit f969c2a.

There are some msan buildbot failures sanitzer-x86_64-linux-fast that
I need to investigate.

Differential Revision: https://reviews.llvm.org/D78422
  • Loading branch information
smithp35 committed Apr 23, 2020
1 parent 022ba50 commit 1ca16fc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 69 deletions.
4 changes: 2 additions & 2 deletions lld/ELF/SyntheticSections.cpp
Expand Up @@ -3363,14 +3363,14 @@ void ARMExidxSyntheticSection::finalizeContents() {

// Sort the executable sections that may or may not have associated
// .ARM.exidx sections by order of ascending address. This requires the
// relative positions of InputSections and OutputSections to be known.
// relative positions of InputSections to be known.
auto compareByFilePosition = [](const InputSection *a,
const InputSection *b) {
OutputSection *aOut = a->getParent();
OutputSection *bOut = b->getParent();

if (aOut != bOut)
return aOut->addr < bOut->addr;
return aOut->sectionIndex < bOut->sectionIndex;
return a->outSecOff < b->outSecOff;
};
llvm::stable_sort(executableSections, compareByFilePosition);
Expand Down
16 changes: 6 additions & 10 deletions lld/ELF/Writer.cpp
Expand Up @@ -1604,11 +1604,6 @@ template <class ELFT> void Writer<ELFT>::resolveShfLinkOrder() {
}
}

static void finalizeSynthetic(SyntheticSection *sec) {
if (sec && sec->isNeeded() && sec->getParent())
sec->finalizeContents();
}

// We need to generate and finalize the content that depends on the address of
// InputSections. As the generation of the content may also alter InputSection
// addresses we must converge to a fixed point. We do that here. See the comment
Expand All @@ -1618,11 +1613,6 @@ template <class ELFT> void Writer<ELFT>::finalizeAddressDependentContent() {
AArch64Err843419Patcher a64p;
ARMErr657417Patcher a32p;
script->assignAddresses();
// .ARM.exidx does not require precise addresses, but it does require the
// relative addresses of OutputSections because linker scripts can assign
// Virtual Addresses to OutputSections that are not monotonically increasing.
for (Partition &part : partitions)
finalizeSynthetic(part.armExidx);

// Converts call x@GDPLT to call __tls_get_addr
if (config->emachine == EM_HEXAGON)
Expand Down Expand Up @@ -1772,6 +1762,11 @@ template <class ELFT> void Writer<ELFT>::optimizeBasicBlockJumps() {
}
}

static void finalizeSynthetic(SyntheticSection *sec) {
if (sec && sec->isNeeded() && sec->getParent())
sec->finalizeContents();
}

// In order to allow users to manipulate linker-synthesized sections,
// we had to add synthetic sections to the input section list early,
// even before we make decisions whether they are needed. This allows
Expand Down Expand Up @@ -2040,6 +2035,7 @@ template <class ELFT> void Writer<ELFT>::finalizeSections() {
// Dynamic section must be the last one in this list and dynamic
// symbol table section (dynSymTab) must be the first one.
for (Partition &part : partitions) {
finalizeSynthetic(part.armExidx);
finalizeSynthetic(part.dynSymTab);
finalizeSynthetic(part.gnuHashTab);
finalizeSynthetic(part.hashTab);
Expand Down
57 changes: 0 additions & 57 deletions lld/test/ELF/arm-exidx-script-order.s

This file was deleted.

0 comments on commit 1ca16fc

Please sign in to comment.