[PATCH] D16898: Don't push relocation sections onto InputSection<ELFT>::Discarded.RelocSections

Sean Silva via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 4 13:45:27 PST 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL259831: Don't push relocation sections onto InputSection<ELFT>::Discarded.RelocSections (authored by silvas).

Changed prior to commit:
  http://reviews.llvm.org/D16898?vs=46954&id=46958#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D16898

Files:
  lld/trunk/ELF/InputFiles.cpp
  lld/trunk/test/ELF/Inputs/llvm33-rela-outside-group.o
  lld/trunk/test/ELF/llvm33-rela-outside-group.s

Index: lld/trunk/test/ELF/llvm33-rela-outside-group.s
===================================================================
--- lld/trunk/test/ELF/llvm33-rela-outside-group.s
+++ lld/trunk/test/ELF/llvm33-rela-outside-group.s
@@ -0,0 +1,11 @@
+// Input file generated with:
+// llvm33/llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %S/Inputs/llvm33-rela-outside-group.o
+//
+// RUN: ld.lld -shared %S/Inputs/llvm33-rela-outside-group.o %S/Inputs/llvm33-rela-outside-group.o
+
+	.global bar
+	.weak	_Z3fooIiEvv
+
+	.section	.text._Z3fooIiEvv,"axG", at progbits,_Z3fooIiEvv,comdat
+_Z3fooIiEvv:
+	callq	bar
Index: lld/trunk/ELF/InputFiles.cpp
===================================================================
--- lld/trunk/ELF/InputFiles.cpp
+++ lld/trunk/ELF/InputFiles.cpp
@@ -214,6 +214,11 @@
         fatal("Invalid relocated section index");
       InputSectionBase<ELFT> *RelocatedSection =
           Sections[RelocatedSectionIndex];
+      // Strictly speaking, a relocation section must be included in the
+      // group of the section it relocates. However, LLVM 3.3 and earlier
+      // would fail to do so, so we gracefully handle that case.
+      if (RelocatedSection == &InputSection<ELFT>::Discarded)
+        continue;
       if (!RelocatedSection)
         fatal("Unsupported relocation reference");
       if (auto *S = dyn_cast<InputSection<ELFT>>(RelocatedSection)) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D16898.46958.patch
Type: text/x-patch
Size: 1396 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160204/5ef1773e/attachment.bin>


More information about the llvm-commits mailing list