[lld] r295141 - Make lld able to handle gold's -r output.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 14 17:29:24 PST 2017


Author: rafael
Date: Tue Feb 14 19:29:23 2017
New Revision: 295141

URL: http://llvm.org/viewvc/llvm-project?rev=295141&view=rev
Log:
Make lld able to handle gold's -r output.

This is still not sufficient for lld to handle its own output when a
fde points to a discarded section. I am investigating if it is better
to change the -r output or make lld able to read the current version.

Modified:
    lld/trunk/ELF/OutputSections.cpp
    lld/trunk/test/ELF/invalid-fde-rel.s

Modified: lld/trunk/ELF/OutputSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/OutputSections.cpp?rev=295141&r1=295140&r2=295141&view=diff
==============================================================================
--- lld/trunk/ELF/OutputSections.cpp (original)
+++ lld/trunk/ELF/OutputSections.cpp Tue Feb 14 19:29:23 2017
@@ -316,7 +316,7 @@ bool EhOutputSection<ELFT>::isFdeLive(Eh
   auto *Sec = cast<EhInputSection<ELFT>>(Piece.ID);
   unsigned FirstRelI = Piece.FirstRelocation;
   if (FirstRelI == (unsigned)-1)
-    fatal(toString(Sec) + ": FDE doesn't reference another section");
+    return false;
   const RelTy &Rel = Rels[FirstRelI];
   SymbolBody &B = Sec->getFile()->getRelocTargetSym(Rel);
   auto *D = dyn_cast<DefinedRegular<ELFT>>(&B);

Modified: lld/trunk/test/ELF/invalid-fde-rel.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/invalid-fde-rel.s?rev=295141&r1=295140&r2=295141&view=diff
==============================================================================
--- lld/trunk/test/ELF/invalid-fde-rel.s (original)
+++ lld/trunk/test/ELF/invalid-fde-rel.s Tue Feb 14 19:29:23 2017
@@ -1,7 +1,11 @@
 // REQUIRES: x86
 
 // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t
-// RUN: not ld.lld %t -o %t2 2>&1 | FileCheck %s
+// RUN: ld.lld %t -o %t2
+// RUN: llvm-objdump -h %t2 | FileCheck %s
+
+// This resembles what gold -r produces when it discards the section
+// the fde points to.
 
         .section .eh_frame
         .long 0x14
@@ -29,4 +33,4 @@
         .long 0x0
         .long 0x0
 
-// CHECK: FDE doesn't reference another section
+// CHECK:  1 .eh_frame     00000018




More information about the llvm-commits mailing list