[lld] r315273 - [COFF] Don't error out on relocations to discarded sections in .eh_frame

Martin Storsjo via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 9 23:05:30 PDT 2017


Author: mstorsjo
Date: Mon Oct  9 23:05:29 2017
New Revision: 315273

URL: http://llvm.org/viewvc/llvm-project?rev=315273&view=rev
Log:
[COFF] Don't error out on relocations to discarded sections in .eh_frame

This allows linking code with dwarf exception handling.

Differential Revision: https://reviews.llvm.org/D38681

Modified:
    lld/trunk/COFF/Chunks.h
    lld/trunk/test/COFF/reloc-discarded-dwarf.s

Modified: lld/trunk/COFF/Chunks.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Chunks.h?rev=315273&r1=315272&r2=315273&view=diff
==============================================================================
--- lld/trunk/COFF/Chunks.h (original)
+++ lld/trunk/COFF/Chunks.h Mon Oct  9 23:05:29 2017
@@ -186,8 +186,10 @@ public:
     return SectionName == ".debug" || SectionName.startswith(".debug$");
   }
 
-  // True if this is a DWARF debug info chunk.
-  bool isDWARF() const { return SectionName.startswith(".debug_"); }
+  // True if this is a DWARF debug info or exception handling chunk.
+  bool isDWARF() const {
+    return SectionName.startswith(".debug_") || SectionName == ".eh_frame";
+  }
 
   // Allow iteration over the bodies of this chunk's relocated symbols.
   llvm::iterator_range<symbol_iterator> symbols() const {

Modified: lld/trunk/test/COFF/reloc-discarded-dwarf.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/reloc-discarded-dwarf.s?rev=315273&r1=315272&r2=315273&view=diff
==============================================================================
--- lld/trunk/test/COFF/reloc-discarded-dwarf.s (original)
+++ lld/trunk/test/COFF/reloc-discarded-dwarf.s Mon Oct  9 23:05:29 2017
@@ -13,3 +13,5 @@ f:
 
 	.section	.debug_info,"dr"
 	.quad	f
+	.section	.eh_frame,"dr"
+	.quad	f




More information about the llvm-commits mailing list