From 4e247522ac8dc1ee1046df2c54c84e6bcc2bc1a9 Mon Sep 17 00:00:00 2001 From: Rui Ueyama Date: Tue, 25 Sep 2018 19:26:58 +0000 Subject: 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 --- lld/ELF/MapFile.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lld/ELF/MapFile.cpp') diff --git a/lld/ELF/MapFile.cpp b/lld/ELF/MapFile.cpp index 54fddfb7b29..870705cd142 100644 --- a/lld/ELF/MapFile.cpp +++ b/lld/ELF/MapFile.cpp @@ -126,7 +126,7 @@ static void printEhFrame(raw_ostream &OS, OutputSection *OSec) { }; // Gather section pieces. - for (const CieRecord *Rec : InX::EhFrame->getCieRecords()) { + for (const CieRecord *Rec : In.EhFrame->getCieRecords()) { Add(*Rec->Cie); for (const EhSectionPiece *Fde : Rec->Fdes) Add(*Fde); @@ -181,7 +181,7 @@ void elf::writeMapFile() { for (BaseCommand *Base : OSec->SectionCommands) { if (auto *ISD = dyn_cast(Base)) { for (InputSection *IS : ISD->Sections) { - if (IS == InX::EhFrame) { + if (IS == In.EhFrame) { printEhFrame(OS, OSec); continue; } -- cgit v1.2.3