From 67dd3415c05f0dff4562127cdda2f31308cde245 Mon Sep 17 00:00:00 2001 From: Martin Storsjo Date: Tue, 10 Oct 2017 06:05:29 +0000 Subject: [PATCH] [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 llvm-svn: 315273 --- lld/COFF/Chunks.h | 6 ++++-- lld/test/COFF/reloc-discarded-dwarf.s | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lld/COFF/Chunks.h b/lld/COFF/Chunks.h index e93737399bb3..e81b89240e0d 100644 --- a/lld/COFF/Chunks.h +++ b/lld/COFF/Chunks.h @@ -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 symbols() const { diff --git a/lld/test/COFF/reloc-discarded-dwarf.s b/lld/test/COFF/reloc-discarded-dwarf.s index d779d2f5b8fc..14dc5948b32a 100644 --- a/lld/test/COFF/reloc-discarded-dwarf.s +++ b/lld/test/COFF/reloc-discarded-dwarf.s @@ -13,3 +13,5 @@ f: .section .debug_info,"dr" .quad f + .section .eh_frame,"dr" + .quad f -- 2.34.1