Index: COFF/Chunks.h =================================================================== --- COFF/Chunks.h +++ COFF/Chunks.h @@ -188,6 +188,9 @@ return SectionName.startswith(".debug_") || SectionName == ".eh_frame"; } + // True if this is a SEH handler registration chunk. + bool isSXData() const { return SectionName == ".sxdata"; } + // Allow iteration over the bodies of this chunk's relocated symbols. llvm::iterator_range symbols() const { return llvm::make_range(symbol_iterator(File, Relocs.begin()), Index: COFF/Writer.cpp =================================================================== --- COFF/Writer.cpp +++ COFF/Writer.cpp @@ -606,12 +606,12 @@ if (isa(Def)) return None; - // Don't write dead symbols or symbols in codeview sections to the symbol - // table. + // Don't write dead symbols or symbols in codeview or sxdata sections to the + // symbol table. if (!Def->isLive()) return None; if (auto *D = dyn_cast(Def)) - if (D->getChunk()->isCodeView()) + if (D->getChunk()->isCodeView() || D->getChunk()->isSXData()) return None; coff_symbol16 Sym; Index: test/COFF/safeseh.s =================================================================== --- test/COFF/safeseh.s +++ test/COFF/safeseh.s @@ -1,6 +1,8 @@ # RUN: llvm-mc -triple i686-windows-msvc %s -filetype=obj -o %t.obj # RUN: lld-link %t.obj -safeseh -out:%t.exe -opt:noref -entry:main # RUN: llvm-readobj -coff-basereloc -coff-load-config -file-headers %t.exe | FileCheck %s --check-prefix=CHECK-NOGC +# RUN: lld-link %t.obj -safeseh -out:%t.exe -opt:noref -entry:main -debug:dwarf +# RUN: llvm-readobj -coff-basereloc -coff-load-config -file-headers %t.exe | FileCheck %s --check-prefix=CHECK-NOGC # RUN: lld-link %t.obj -safeseh -out:%t.exe -opt:ref -entry:main # RUN: llvm-readobj -coff-basereloc -coff-load-config -file-headers %t.exe | FileCheck %s --check-prefix=CHECK-GC @@ -13,7 +15,7 @@ # CHECK-NOGC: Type: HIGHLOW # CHECK-NOGC: LoadConfig [ # CHECK-NOGC: Size: 0x48 -# CHECK-NOGC: SEHandlerTable: 0x402048 +# CHECK-NOGC: SEHandlerTable: 0x # CHECK-NOGC: SEHandlerCount: 1 # CHECK-NOGC: ] # CHECK-NOGC: SEHTable [