[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
Fri Aug 5 05:42:29 PDT 2016


grimar created this revision.
grimar added reviewers: ruiu, rafael.
grimar added subscribers: llvm-commits, grimar.

This is PR28868. More details on a bug page.
Patch fixes the issue by ignoring such "zero" sections.

https://reviews.llvm.org/D23201

Files:
  InputFiles.cpp

Index: InputFiles.cpp
===================================================================
--- InputFiles.cpp
+++ InputFiles.cpp
@@ -339,10 +339,10 @@
   uint32_t Index = this->getSectionIndex(Sym);
   if (Index == 0)
     return nullptr;
-  if (Index >= Sections.size() || !Sections[Index])
+  if (Index >= Sections.size())
     fatal(getFilename(this) + ": invalid section index: " + Twine(Index));
   InputSectionBase<ELFT> *S = Sections[Index];
-  if (S == &InputSectionBase<ELFT>::Discarded)
+  if (!S || S == &InputSectionBase<ELFT>::Discarded)
     return S;
   return S->Repl;
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23201.66932.patch
Type: text/x-patch
Size: 599 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160805/48c8b56b/attachment.bin>


More information about the llvm-commits mailing list