diff options
author | Rui Ueyama <ruiu@google.com> | 2018-09-25 19:26:58 +0000 |
---|---|---|
committer | Rui Ueyama <ruiu@google.com> | 2018-09-25 19:26:58 +0000 |
commit | 4e247522ac8dc1ee1046df2c54c84e6bcc2bc1a9 (patch) | |
tree | 6d2e620d2dc827cdfae55f995563308d309e7320 /lld/ELF/OutputSections.cpp | |
parent | 10c11b867a045ee6f5ada9b741dbf2929d8d7ae0 (diff) | |
download | bcm5719-llvm-4e247522ac8dc1ee1046df2c54c84e6bcc2bc1a9.tar.gz bcm5719-llvm-4e247522ac8dc1ee1046df2c54c84e6bcc2bc1a9.zip |
Reset input section pointers to null on each linker invocation.
Previously, if you invoke lld's `main` more than once in the same process,
the second invocation could fail or produce a wrong result due to a stale
pointer values of the previous run.
Differential Revision: https://reviews.llvm.org/D52506
llvm-svn: 343009
Diffstat (limited to 'lld/ELF/OutputSections.cpp')
-rw-r--r-- | lld/ELF/OutputSections.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lld/ELF/OutputSections.cpp b/lld/ELF/OutputSections.cpp index 8253b18b486..0e8e406b91d 100644 --- a/lld/ELF/OutputSections.cpp +++ b/lld/ELF/OutputSections.cpp @@ -270,13 +270,13 @@ static void finalizeShtGroup(OutputSection *OS, // sh_link field for SHT_GROUP sections should contain the section index of // the symbol table. - OS->Link = InX::SymTab->getParent()->SectionIndex; + OS->Link = In.SymTab->getParent()->SectionIndex; // sh_info then contain index of an entry in symbol table section which // provides signature of the section group. ObjFile<ELFT> *Obj = Section->getFile<ELFT>(); ArrayRef<Symbol *> Symbols = Obj->getSymbols(); - OS->Info = InX::SymTab->getSymbolIndex(Symbols[Section->Info]); + OS->Info = In.SymTab->getSymbolIndex(Symbols[Section->Info]); } template <class ELFT> void OutputSection::finalize() { @@ -308,7 +308,7 @@ template <class ELFT> void OutputSection::finalize() { if (isa<SyntheticSection>(First)) return; - Link = InX::SymTab->getParent()->SectionIndex; + Link = In.SymTab->getParent()->SectionIndex; // sh_info for SHT_REL[A] sections should contain the section header index of // the section to which the relocation applies. InputSectionBase *S = First->getRelocatedSection(); |