summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2017-02-15 01:29:23 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2017-02-15 01:29:23 +0000
commitf340ca896312352c403daef8364ebd40a3783a0b (patch)
treeb9134abd5d4749e8743a69a78812e3ecfa089074
parentc3fc8265a36182f55b077da6649d40eb3e29081b (diff)
downloadbcm5719-llvm-f340ca896312352c403daef8364ebd40a3783a0b.tar.gz
bcm5719-llvm-f340ca896312352c403daef8364ebd40a3783a0b.zip
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. llvm-svn: 295141
-rw-r--r--lld/ELF/OutputSections.cpp2
-rw-r--r--lld/test/ELF/invalid-fde-rel.s8
2 files changed, 7 insertions, 3 deletions
diff --git a/lld/ELF/OutputSections.cpp b/lld/ELF/OutputSections.cpp
index 9e638ad17de..25ea64a3068 100644
--- a/lld/ELF/OutputSections.cpp
+++ b/lld/ELF/OutputSections.cpp
@@ -316,7 +316,7 @@ bool EhOutputSection<ELFT>::isFdeLive(EhSectionPiece &Piece,
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);
diff --git a/lld/test/ELF/invalid-fde-rel.s b/lld/test/ELF/invalid-fde-rel.s
index 9fb73d2158d..f43b9da3003 100644
--- a/lld/test/ELF/invalid-fde-rel.s
+++ b/lld/test/ELF/invalid-fde-rel.s
@@ -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
OpenPOWER on IntegriCloud