[PATCH] D38724: [ELF] - Do not collect SHT_REL[A] sections unconditionally when --gc-sections and --emit-relocs used together.
Rui Ueyama via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 10 13:07:11 PDT 2017
ruiu added inline comments.
================
Comment at: ELF/InputSection.cpp:81
// GCed) by default. If a section can be GCed, this function returns false.
-static bool isLiveByDefault(uint64_t Flags, uint32_t Type) {
+bool elf::isLiveByDefault(uint64_t Flags, uint32_t Type) {
// If GC is enabled, all memory-mapped sections are subject of GC.
----------------
I don't think we want to export this function. Can you move this function to MarkLive.cpp, and leave Live uninitialized in this file? If GC is disabled, you can visit all sections to turn Live bits on in MarkLive.cpp.
================
Comment at: ELF/InputSection.h:362-363
+// Returns true if section with given Flags and Type should be
+// live for GC by default.
+bool isLiveByDefault(uint64_t Flags, uint32_t Type);
----------------
Returns true if a given section is a subject of garbage collection.
================
Comment at: ELF/InputSection.h:364
+// live for GC by default.
+bool isLiveByDefault(uint64_t Flags, uint32_t Type);
+
----------------
isLiveByDefault is not a good name as a non-file-scoped function name. I'd name this canBeCollected.
https://reviews.llvm.org/D38724
More information about the llvm-commits
mailing list