[PATCH] D28612: [ELF] - Added support for --emit-relocs.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 26 01:38:12 PST 2017


grimar added inline comments.


================
Comment at: ELF/InputSection.cpp:45-56
+// Returns if GC should be enabled for section. We do not run GC for
+// non-allocatable sections, which typically contain debugging information.
+// REL[A] sections are not allocatable, but we do GC for them, because them are
+// dependent on section they relocate, we do not want them be live
+// unconditionally. That is used for --emit-relocs.
+bool lld::shouldGC(uint64_t Flags, uint32_t Type) {
+  if (!Config->GcSections)
----------------
ruiu wrote:
> Exporting this as a global function is probably not a good idea. Whether a section could be discarded or never be discarded can be decided when the section is instantiated (because the decision depends only on `Sec->Type`, `Config->GcSections` and its section name, all of which are available at the constructor.)
> 
> So, the right way of doing it is to set `Live` bit in the ctor if it should never be GC'ed.
That looks good idea, I prepared patch D29170.


https://reviews.llvm.org/D28612





More information about the llvm-commits mailing list