2 # RUN: llvm-mc -triple i686-windows-msvc %s -filetype=obj -o %t.obj
3 # RUN: lld-link %t.obj -safeseh -out:%t.exe -opt:noref -entry:main
4 # RUN: llvm-readobj --coff-basereloc --coff-load-config --file-headers %t.exe | FileCheck %s --check-prefix=CHECK-NOGC
5 # RUN: lld-link %t.obj -safeseh -out:%t.exe -opt:noref -entry:main -debug:dwarf
6 # RUN: llvm-readobj --coff-basereloc --coff-load-config --file-headers %t.exe | FileCheck %s --check-prefix=CHECK-NOGC
7 # RUN: lld-link %t.obj -safeseh -out:%t.exe -opt:ref -entry:main
8 # RUN: llvm-readobj --coff-basereloc --coff-load-config --file-headers %t.exe | FileCheck %s --check-prefix=CHECK-GC
10 # __safe_se_handler_table needs to be relocated against ImageBase.
11 # check that the relocation is present.
13 # CHECK-NOGC-NOT: IMAGE_DLL_CHARACTERISTICS_NO_SEH
14 # CHECK-NOGC: BaseReloc [
16 # CHECK-NOGC: Type: HIGHLOW
17 # CHECK-NOGC: LoadConfig [
18 # CHECK-NOGC: Size: 0x48
19 # CHECK-NOGC: SEHandlerTable: 0x
20 # CHECK-NOGC: SEHandlerCount: 1
22 # CHECK-NOGC: SEHTable [
23 # CHECK-NOGC-NEXT: 0x401006
26 # If we enable GC, the exception handler should be removed, and we should add
27 # the DLL characteristic flag that indicates that there are no exception
28 # handlers in this DLL. The exception handler table in the load config should
29 # be empty and there should be no relocations for it.
31 # CHECK-GC: Characteristics [
32 # CHECK-GC: IMAGE_DLL_CHARACTERISTICS_NO_SEH
34 # CHECK-GC: BaseReloc [
36 # CHECK-GC: LoadConfig [
37 # CHECK-GC: Size: 0x48
38 # CHECK-GC: SEHandlerTable: 0x0
39 # CHECK-GC: SEHandlerCount: 0
41 # CHECK-GC-NOT: SEHTable
55 .section .text,"xr",one_only,_main
61 # This handler can be GCd, which will make the safeseh table empty, so it should
67 .section .text,"xr",one_only,_my_handler
75 .globl __load_config_used
79 .long ___safe_se_handler_table
80 .long ___safe_se_handler_count