[PATCH] D23201: [ELF] - Fix for: error "invalid section index: xxx" when linking FreeBSD kernel.
George Rimar via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 11 01:18:09 PDT 2016
grimar 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])
----------------
ruiu wrote:
> Hmm, why did you add more conditions?
Because hpt27xx_lib.o which initially was the reason to fix all of that
contains section symbols associated with
.rela.text, .rela.rodata, .rela.data, .rela.eh_frame, .shstrtab, .symtab, .strtab
See https://llvm.org/bugs/show_bug.cgi?id=28868
Testcase also has them:
- Type: STT_SECTION
Section: .rela.text
- Type: STT_SECTION
Section: .shstrtab
- Type: STT_SECTION
Section: .symtab
- Type: STT_SECTION
Section: .strtab
================
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;
----------------
ruiu wrote:
> Why did you have to make a change to this code?
Because since these sections are mo more nullptr, but discarded, the code below is executed
and it is not possible to call IS->getFile()->getName() when IS is InputSection<ELFT>::Discarded,
because File member is null.
https://reviews.llvm.org/D23201
More information about the llvm-commits
mailing list