diff options
| author | Peter Collingbourne <peter@pcc.me.uk> | 2019-05-29 03:55:20 +0000 |
|---|---|---|
| committer | Peter Collingbourne <peter@pcc.me.uk> | 2019-05-29 03:55:20 +0000 |
| commit | ba2816be824adfa7171d14d472ad645ab9edc5b3 (patch) | |
| tree | ffe958d132adafd0d6477f42a1c38055e5345dfb /lld/ELF/InputSection.cpp | |
| parent | e8698ead9dd12252dab26a3412788e14303d634d (diff) | |
| download | bcm5719-llvm-ba2816be824adfa7171d14d472ad645ab9edc5b3.tar.gz bcm5719-llvm-ba2816be824adfa7171d14d472ad645ab9edc5b3.zip | |
ELF: Add basic partition data structures and behaviours.
This change causes us to read partition specifications from partition
specification sections and split output sections into partitions according
to their reachability from partition entry points.
This is only the first step towards a full implementation of partitions. Later
changes will add additional synthetic sections to each partition so that
they can be loaded independently.
Differential Revision: https://reviews.llvm.org/D60353
llvm-svn: 361925
Diffstat (limited to 'lld/ELF/InputSection.cpp')
| -rw-r--r-- | lld/ELF/InputSection.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/lld/ELF/InputSection.cpp b/lld/ELF/InputSection.cpp index 9075568f8c1..2ff6b4800b7 100644 --- a/lld/ELF/InputSection.cpp +++ b/lld/ELF/InputSection.cpp @@ -443,7 +443,7 @@ void InputSection::copyRelocations(uint8_t *Buf, ArrayRef<RelTy> Rels) { continue; } SectionBase *Section = D->Section->Repl; - if (!Section->Live) { + if (!Section->isLive()) { P->setSymbolAndType(0, 0, false); continue; } @@ -1095,8 +1095,19 @@ template <class ELFT> void InputSection::writeTo(uint8_t *Buf) { void InputSection::replace(InputSection *Other) { Alignment = std::max(Alignment, Other->Alignment); + + // When a section is replaced with another section that was allocated to + // another partition, the replacement section (and its associated sections) + // need to be placed in the main partition so that both partitions will be + // able to access it. + if (Partition != Other->Partition) { + Partition = 1; + for (InputSection *IS : DependentSections) + IS->Partition = 1; + } + Other->Repl = Repl; - Other->Live = false; + Other->markDead(); } template <class ELFT> |

