1# REQUIRES: x86 2# RUN: llvm-mc -triple i686-windows-msvc %s -filetype=obj -o %t.obj 3# RUN: not lld-link %t.obj -safeseh -out:%t.exe -entry:main 2>&1 | FileCheck %s --check-prefix=ERROR 4# safe seh should be on by default. 5# RUN: not lld-link %t.obj -out:%t.exe -entry:main 2>&1 | FileCheck %s --check-prefix=ERROR 6# RUN: lld-link %t.obj -safeseh:no -out:%t.exe -entry:main 7# RUN: llvm-readobj --file-headers --coff-load-config %t.exe | FileCheck %s 8# -lldmingw should also turn off safeseh by default. 9# RUN: lld-link %t.obj -lldmingw -out:%t.exe -entry:main 10# RUN: llvm-readobj --file-headers --coff-load-config %t.exe | FileCheck %s 11 12# ERROR: /safeseh: {{.*}}safeseh-no.s.tmp.obj is not compatible with SEH 13 14# CHECK: Characteristics [ 15# CHECK-NOT: IMAGE_DLL_CHARACTERISTICS_NO_SEH 16# CHECK: ] 17# CHECK: LoadConfig [ 18# CHECK: Size: 0x48 19# CHECK: SEHandlerTable: 0x0 20# CHECK: SEHandlerCount: 0 21# CHECK: ] 22# CHECK-NOT: SEHTable 23 24 25# Explicitly mark the object as not having safeseh. LLD should error unless 26# -safeseh:no is passed. 27 .def @feat.00; .scl 3; .type 0; .endef 28 .globl @feat.00 29@feat.00 = 0 30 31 .def _main; 32 .scl 2; 33 .type 32; 34 .endef 35 .section .text,"xr",one_only,_main 36 .globl _main 37_main: 38 movl $42, %eax 39 ret 40 41# Add a handler to create an .sxdata section, which -safeseh:no should ignore. 42 .def _my_handler; .scl 3; .type 32; 43 .endef 44 .section .text,"xr",one_only,_my_handler 45_my_handler: 46 ret 47.safeseh _my_handler 48 49 50 .section .rdata,"dr" 51.globl __load_config_used 52__load_config_used: 53 .long 72 54 .fill 60, 1, 0 55 .long ___safe_se_handler_table 56 .long ___safe_se_handler_count 57 58