diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2019-06-07 17:57:58 +0000 |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2019-06-07 17:57:58 +0000 |
commit | 02828985868ca5c9788824077d74a6d674a686e2 (patch) | |
tree | 093fa4773d81e7d2b0caf461667e722418677178 /lld/ELF/LinkerScript.cpp | |
parent | 8d58a98c594bb472b01158ba825cd632650ec2be (diff) | |
download | bcm5719-llvm-02828985868ca5c9788824077d74a6d674a686e2.tar.gz bcm5719-llvm-02828985868ca5c9788824077d74a6d674a686e2.zip |
ELF: Create synthetic sections for loadable partitions.
We create several types of synthetic sections for loadable partitions, including:
- The dynamic symbol table. This allows code outside of the loadable partitions
to find entry points with dlsym.
- Creating a dynamic symbol table also requires the creation of several other
synthetic sections for the partition, such as the dynamic table and hash table
sections.
- The partition's ELF header is represented as a synthetic section in the
combined output file, and will be used by llvm-objcopy to extract partitions.
Differential Revision: https://reviews.llvm.org/D62350
llvm-svn: 362819
Diffstat (limited to 'lld/ELF/LinkerScript.cpp')
-rw-r--r-- | lld/ELF/LinkerScript.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp index 24c4fb8de46..b964a542015 100644 --- a/lld/ELF/LinkerScript.cpp +++ b/lld/ELF/LinkerScript.cpp @@ -413,16 +413,16 @@ LinkerScript::computeInputSections(const InputSectionDescription *Cmd) { void LinkerScript::discard(ArrayRef<InputSection *> V) { for (InputSection *S : V) { - if (S == In.ShStrTab || S == In.RelaDyn || S == In.RelrDyn) + if (S == In.ShStrTab || S == Main->RelaDyn || S == Main->RelrDyn) error("discarding " + S->Name + " section is not allowed"); // You can discard .hash and .gnu.hash sections by linker scripts. Since // they are synthesized sections, we need to handle them differently than // other regular sections. - if (S == In.GnuHashTab) - In.GnuHashTab = nullptr; - if (S == In.HashTab) - In.HashTab = nullptr; + if (S == Main->GnuHashTab) + Main->GnuHashTab = nullptr; + if (S == Main->HashTab) + Main->HashTab = nullptr; S->Assigned = false; S->markDead(); @@ -904,6 +904,8 @@ void LinkerScript::adjustSectionsBeforeSorting() { if (IsEmpty && isDiscardable(*Sec)) { Sec->markDead(); Cmd = nullptr; + } else if (!Sec->isLive()) { + Sec->markLive(); } } |