[PATCH] D23201: [ELF] - Fix for: error "invalid section index: xxx" when linking FreeBSD kernel.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 10 11:13:20 PDT 2016


ruiu added inline comments.

================
Comment at: ELF/InputFiles.cpp:279-280
@@ +278,4 @@
+    // situation properly.
+    if (Sec.sh_type == SHT_SYMTAB || Sec.sh_type == SHT_STRTAB ||
+        Sec.sh_type == SHT_RELA || Sec.sh_type == SHT_RELA)
+      if (!Sections[I])
----------------
Hmm, why did you add more conditions?

================
Comment at: ELF/Writer.cpp:100-101
@@ -99,3 +99,4 @@
 template <class ELFT> void elf::reportDiscarded(InputSectionBase<ELFT> *IS) {
-  if (!Config->PrintGcSections || !IS || IS->Live)
+  if (!Config->PrintGcSections || !IS || IS->Live ||
+      IS == &InputSection<ELFT>::Discarded)
     return;
----------------
Why did you have to make a change to this code?


https://reviews.llvm.org/D23201





More information about the llvm-commits mailing list