fe44a531e0
Summary: Fixes PR41828. Before this, LLD always emitted SafeSEH chunks and defined __safe_se_handler_table & size. Now, /safeseh:no leaves those undefined. Additionally, we were checking for the safeseh @feat.00 flag in two places: once to emit errors, and once during safeseh table construction. The error was set up to be off by default, but safeseh is supposed to be on by default. I combined the two checks, so now LLD emits an error if an input object lacks @feat.00 and safeseh is enabled. This caused the majority of 32-bit LLD tests to fail, since many test input object files lack @feat.00 symbols. I explicitly added -safeseh:no to those tests to preserve behavior. Finally, LLD no longer sets IMAGE_DLL_CHARACTERISTICS_NO_SEH if any input file wasn't compiled for safeseh. Reviewers: mstorsjo, ruiu, thakis Reviewed By: ruiu, thakis Subscribers: llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D63570 llvm-svn: 366238
87 lines
2.9 KiB
YAML
87 lines
2.9 KiB
YAML
# RUN: yaml2obj %s -o %t.obj
|
|
# RUN: lld-link -safeseh:no -debug -entry:main -out:%t.exe -pdb:%t.pdb %t.obj
|
|
# RUN: llvm-pdbutil dump -globals %t.pdb | FileCheck %s
|
|
|
|
# There is an S_GDATA32 symbol record with .secrel32 and .secidx relocations in
|
|
# it in this debug info. This is similar to the relocations in the loadcfg.obj
|
|
# file in the MSVC CRT. We need to make sure that our relocation logic matches
|
|
# MSVC's for these absolute, linker-provided symbols.
|
|
|
|
# CHECK: Global Symbols
|
|
# CHECK-NEXT: ============================================================
|
|
# CHECK-NEXT: Records
|
|
# CHECK-NEXT: 20 | S_GDATA32 [size = 40] `___safe_se_handler_table`
|
|
# CHECK-NEXT: type = 0x0022 (unsigned long), addr = 0003:0000
|
|
|
|
--- !COFF
|
|
header:
|
|
Machine: IMAGE_FILE_MACHINE_I386
|
|
Characteristics: [ ]
|
|
sections:
|
|
- Name: '.debug$S'
|
|
Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
|
|
Alignment: 1
|
|
Subsections:
|
|
- !Symbols
|
|
Records:
|
|
- Kind: S_GDATA32
|
|
DataSym:
|
|
Type: 34
|
|
DisplayName: ___safe_se_handler_table
|
|
- !StringTable
|
|
Strings:
|
|
Relocations:
|
|
- VirtualAddress: 20
|
|
SymbolName: ___safe_se_handler_table
|
|
Type: IMAGE_REL_I386_SECREL
|
|
- VirtualAddress: 24
|
|
SymbolName: ___safe_se_handler_table
|
|
Type: IMAGE_REL_I386_SECTION
|
|
- Name: '.text$mn'
|
|
Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
|
|
Alignment: 16
|
|
SectionData: 488D0500000000C3
|
|
Relocations:
|
|
- VirtualAddress: 3
|
|
SymbolName: ___safe_se_handler_table
|
|
Type: IMAGE_REL_I386_REL32
|
|
symbols:
|
|
- Name: '.debug$S'
|
|
Value: 0
|
|
SectionNumber: 1
|
|
SimpleType: IMAGE_SYM_TYPE_NULL
|
|
ComplexType: IMAGE_SYM_DTYPE_NULL
|
|
StorageClass: IMAGE_SYM_CLASS_STATIC
|
|
SectionDefinition:
|
|
Length: 372
|
|
NumberOfRelocations: 6
|
|
NumberOfLinenumbers: 0
|
|
CheckSum: 0
|
|
Number: 0
|
|
- Name: '.text$mn'
|
|
Value: 0
|
|
SectionNumber: 2
|
|
SimpleType: IMAGE_SYM_TYPE_NULL
|
|
ComplexType: IMAGE_SYM_DTYPE_NULL
|
|
StorageClass: IMAGE_SYM_CLASS_STATIC
|
|
SectionDefinition:
|
|
Length: 8
|
|
NumberOfRelocations: 1
|
|
NumberOfLinenumbers: 0
|
|
CheckSum: 1092178131
|
|
Number: 0
|
|
- Name: _main
|
|
Value: 0
|
|
SectionNumber: 2
|
|
SimpleType: IMAGE_SYM_TYPE_NULL
|
|
ComplexType: IMAGE_SYM_DTYPE_FUNCTION
|
|
StorageClass: IMAGE_SYM_CLASS_EXTERNAL
|
|
- Name: ___safe_se_handler_table
|
|
Value: 0
|
|
SectionNumber: 0
|
|
SimpleType: IMAGE_SYM_TYPE_NULL
|
|
ComplexType: IMAGE_SYM_DTYPE_NULL
|
|
StorageClass: IMAGE_SYM_CLASS_EXTERNAL
|
|
...
|
|
|