From aeb4b7d217dae0ad2d29a5aa9a67cf2309432522 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Tue, 23 May 2017 22:54:06 +0000 Subject: Clear OutSec->Sections. Once the dummy linker script is created, we want it to be used for everything to avoid having two redundant representations that can get out of sync. We were already clearing OutputSections. With this patch we clear the Sections vector of every OutputSection. llvm-svn: 303703 --- lld/ELF/MapFile.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'lld/ELF/MapFile.cpp') diff --git a/lld/ELF/MapFile.cpp b/lld/ELF/MapFile.cpp index 7b82eceba02..806e99e3d9d 100644 --- a/lld/ELF/MapFile.cpp +++ b/lld/ELF/MapFile.cpp @@ -132,12 +132,17 @@ void elf::writeMapFile(llvm::ArrayRef Script) { OS << OSec->Name << '\n'; // Dump symbols for each input section. - for (InputSection *IS : OSec->Sections) { - writeHeader(OS, OSec->Addr + IS->OutSecOff, IS->getSize(), - IS->Alignment); - OS << indent(1) << toString(IS) << '\n'; - for (DefinedRegular *Sym : SectionSyms[IS]) - OS << SymStr[Sym] << '\n'; + for (BaseCommand *Base : Cmd->Commands) { + auto *ISD = dyn_cast(Base); + if (!ISD) + continue; + for (InputSection *IS : ISD->Sections) { + writeHeader(OS, OSec->Addr + IS->OutSecOff, IS->getSize(), + IS->Alignment); + OS << indent(1) << toString(IS) << '\n'; + for (DefinedRegular *Sym : SectionSyms[IS]) + OS << SymStr[Sym] << '\n'; + } } } } -- cgit v1.2.3