[lld] r304243 - Check Live instead of the section type.
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Tue May 30 13:40:03 PDT 2017
Author: rafael
Date: Tue May 30 15:40:03 2017
New Revision: 304243
URL: http://llvm.org/viewvc/llvm-project?rev=304243&view=rev
Log:
Check Live instead of the section type.
By the time we get here all live sections should have been combined
into InputSections.
Modified:
lld/trunk/ELF/LinkerScript.cpp
lld/trunk/ELF/OutputSections.cpp
lld/trunk/ELF/OutputSections.h
Modified: lld/trunk/ELF/LinkerScript.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.cpp?rev=304243&r1=304242&r2=304243&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.cpp (original)
+++ lld/trunk/ELF/LinkerScript.cpp Tue May 30 15:40:03 2017
@@ -291,11 +291,13 @@ LinkerScript::computeInputSections(const
size_t SizeBefore = Ret.size();
for (InputSectionBase *Sec : InputSections) {
- if (!isa<InputSection>(Sec))
+ if (Sec->Assigned)
continue;
- if (Sec->Assigned)
+ if (!Sec->Live) {
+ reportDiscarded(Sec);
continue;
+ }
// For -emit-relocs we have to ignore entries like
// .rela.dyn : { *(.rela.data) }
Modified: lld/trunk/ELF/OutputSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/OutputSections.cpp?rev=304243&r1=304242&r2=304243&view=diff
==============================================================================
--- lld/trunk/ELF/OutputSections.cpp (original)
+++ lld/trunk/ELF/OutputSections.cpp Tue May 30 15:40:03 2017
@@ -351,7 +351,7 @@ static bool canMergeToProgbits(unsigned
Type == SHT_NOTE;
}
-static void reportDiscarded(InputSectionBase *IS) {
+void elf::reportDiscarded(InputSectionBase *IS) {
if (!Config->PrintGcSections)
return;
message("removing unused section from '" + IS->Name + "' in file '" +
Modified: lld/trunk/ELF/OutputSections.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/OutputSections.h?rev=304243&r1=304242&r2=304243&view=diff
==============================================================================
--- lld/trunk/ELF/OutputSections.h (original)
+++ lld/trunk/ELF/OutputSections.h Tue May 30 15:40:03 2017
@@ -149,6 +149,7 @@ private:
};
uint64_t getHeaderSize();
+void reportDiscarded(InputSectionBase *IS);
} // namespace elf
} // namespace lld
More information about the llvm-commits
mailing list