[PATCH] D15327: [ELF] - Implemented --print-gc-sections command line argument.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 8 09:42:03 PST 2015
ruiu added inline comments.
================
Comment at: ELF/Writer.cpp:537
@@ -534,1 +536,3 @@
template <class ELFT>
+bool Writer<ELFT>::reportDiscarded(
+ InputSectionBase<ELFT> *IS,
----------------
If a function does not refer any member variable of a class, non-member function is preferred over member function.
================
Comment at: ELF/Writer.cpp:541-542
@@ +540,4 @@
+ if (Config->PrintGcSections && IS && !IS->isLive())
+ warning(Twine("removing unused section from '") + IS->getSectionName() +
+ "' in file '" + File->getName() + "'");
+ return true;
----------------
Since this is not a warning, don't use warning(). Instead, write the message out to llvm::errs().
================
Comment at: ELF/Writer.cpp:579-580
@@ -566,4 +578,4 @@
for (InputSectionBase<ELFT> *C : F->getSections()) {
- if (isDiscarded(C))
+ if (isDiscarded(C) && reportDiscarded(C, F))
continue;
const Elf_Shdr *H = C->getSectionHdr();
----------------
if (isDiscarded(C)) {
reportDiscarded(C, F);
continue;
}
http://reviews.llvm.org/D15327
More information about the llvm-commits
mailing list