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/LinkerScript.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/LinkerScript.cpp')
-rw-r--r-- | lld/ELF/LinkerScript.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp index 9c35bb78ce1..d1898624a0a 100644 --- a/lld/ELF/LinkerScript.cpp +++ b/lld/ELF/LinkerScript.cpp @@ -415,18 +415,18 @@ LinkerScript::computeInputSections(const InputSectionDescription *Cmd) { void LinkerScript::discard(ArrayRef<InputSection *> V) { for (InputSection *S : V) { - if (S == InX::ShStrTab || S == InX::Dynamic || S == InX::DynSymTab || - S == InX::DynStrTab || S == InX::RelaPlt || S == InX::RelaDyn || - S == InX::RelrDyn) + if (S == In.ShStrTab || S == In.Dynamic || S == In.DynSymTab || + S == In.DynStrTab || S == In.RelaPlt || S == In.RelaDyn || + S == In.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 == InX::GnuHashTab) - InX::GnuHashTab = nullptr; - if (S == InX::HashTab) - InX::HashTab = nullptr; + if (S == In.GnuHashTab) + In.GnuHashTab = nullptr; + if (S == In.HashTab) + In.HashTab = nullptr; S->Assigned = false; S->Live = false; |