[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
Sun Oct 22 20:00:12 PDT 2017


ruiu added inline comments.


================
Comment at: ELF/MarkLive.cpp:228
     if (auto *MS = dyn_cast<MergeInputSection>(Sec))
       MS->markLiveAt(Offset);
 
----------------
I took time to investigate this, and looks like the easiest way of doing this is to change

   void markLiveAt(uint64_t Offset) {
    assert(this->Flags & llvm::ELF::SHF_ALLOC);
    LiveOffsets.insert(Offset);
   }

to

  void markLiveAt(uint64_t Offset) {
    if (this->Flags & llvm::ELF::SHF_ALLOC)
      LiveOffsets.insert(Offset);
   }


https://reviews.llvm.org/D38724





More information about the llvm-commits mailing list