[PATCH] D37561: [ELF] - Don't crash when --emit-relocs is used with --gc-sections

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 8 00:51:21 PDT 2017


grimar added a comment.

In https://reviews.llvm.org/D37561#863647, @ruiu wrote:

> I don't think this patch addresses the root cause of the issue. All sections passed to `addInputSec` should be live. If it should be considered dead by gc, it should be marked as such before reaching here. This patch seems to hide the issue instead of fixing it.


If that whould be true, then why first lines of 'addInputSec' returns (and report discarded sections actually) when sections are not live ?

  void OutputSectionFactory::addInputSec(InputSectionBase *IS,
                                         StringRef OutsecName,
                                         OutputSection *&Sec) {
    if (!IS->Live) {
      reportDiscarded(IS);
      return;
    }


https://reviews.llvm.org/D37561





More information about the llvm-commits mailing list