81 lines · plain
1# REQUIRES: x862# RUN: llvm-mc -triple i686-windows-msvc %s -filetype=obj -o %t.obj3# RUN: lld-link %t.obj -safeseh -out:%t.exe -opt:noref -entry:main4# RUN: llvm-readobj --coff-basereloc --coff-load-config --file-headers %t.exe | FileCheck %s --check-prefix=CHECK-NOGC5# RUN: lld-link %t.obj -safeseh -out:%t.exe -opt:noref -entry:main -debug:dwarf6# RUN: llvm-readobj --coff-basereloc --coff-load-config --file-headers %t.exe | FileCheck %s --check-prefix=CHECK-NOGC7# RUN: lld-link %t.obj -safeseh -out:%t.exe -opt:ref -entry:main8# RUN: llvm-readobj --coff-basereloc --coff-load-config --file-headers %t.exe | FileCheck %s --check-prefix=CHECK-GC9 10# __safe_se_handler_table needs to be relocated against ImageBase.11# check that the relocation is present.12#13# CHECK-NOGC-NOT: IMAGE_DLL_CHARACTERISTICS_NO_SEH14# CHECK-NOGC: BaseReloc [15# CHECK-NOGC: Entry {16# CHECK-NOGC: Type: HIGHLOW17# CHECK-NOGC: LoadConfig [18# CHECK-NOGC: Size: 0x4819# CHECK-NOGC: SEHandlerTable: 0x20# CHECK-NOGC: SEHandlerCount: 121# CHECK-NOGC: ]22# CHECK-NOGC: SEHTable [23# CHECK-NOGC-NEXT: 0x40100624# CHECK-NOGC-NEXT: ]25 26# If we enable GC, the exception handler should be removed, and we should add27# the DLL characteristic flag that indicates that there are no exception28# handlers in this DLL. The exception handler table in the load config should29# be empty and there should be no relocations for it.30#31# CHECK-GC: Characteristics [32# CHECK-GC: IMAGE_DLL_CHARACTERISTICS_NO_SEH33# CHECK-GC: ]34# CHECK-GC: BaseReloc [35# CHECK-GC-NEXT: ]36# CHECK-GC: LoadConfig [37# CHECK-GC: Size: 0x4838# CHECK-GC: SEHandlerTable: 0x039# CHECK-GC: SEHandlerCount: 040# CHECK-GC: ]41# CHECK-GC-NOT: SEHTable42 43 44 .def @feat.00;45 .scl 3;46 .type 0;47 .endef48 .globl @feat.0049@feat.00 = 150 51 .def _main;52 .scl 2;53 .type 32;54 .endef55 .section .text,"xr",one_only,_main56 .globl _main57_main:58 movl $42, %eax59 ret60 61# This handler can be GCd, which will make the safeseh table empty, so it should62# appear null.63 .def _my_handler;64 .scl 3;65 .type 32;66 .endef67 .section .text,"xr",one_only,_my_handler68_my_handler:69 ret70 71.safeseh _my_handler72 73 74 .section .rdata,"dr"75.globl __load_config_used76__load_config_used:77 .long 7278 .fill 60, 1, 079 .long ___safe_se_handler_table80 .long ___safe_se_handler_count81