58 lines · plain
1# REQUIRES: x862# RUN: llvm-mc -triple i686-windows-msvc %s -filetype=obj -o %t.obj3# RUN: not lld-link %t.obj -safeseh -out:%t.exe -entry:main 2>&1 | FileCheck %s --check-prefix=ERROR4# 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=ERROR6# RUN: lld-link %t.obj -safeseh:no -out:%t.exe -entry:main7# RUN: llvm-readobj --file-headers --coff-load-config %t.exe | FileCheck %s8# -lldmingw should also turn off safeseh by default.9# RUN: lld-link %t.obj -lldmingw -out:%t.exe -entry:main10# RUN: llvm-readobj --file-headers --coff-load-config %t.exe | FileCheck %s11 12# ERROR: /safeseh: {{.*}}safeseh-no.s.tmp.obj is not compatible with SEH13 14# CHECK: Characteristics [15# CHECK-NOT: IMAGE_DLL_CHARACTERISTICS_NO_SEH16# CHECK: ]17# CHECK: LoadConfig [18# CHECK: Size: 0x4819# CHECK: SEHandlerTable: 0x020# CHECK: SEHandlerCount: 021# CHECK: ]22# CHECK-NOT: SEHTable23 24 25# Explicitly mark the object as not having safeseh. LLD should error unless26# -safeseh:no is passed.27 .def @feat.00; .scl 3; .type 0; .endef28 .globl @feat.0029@feat.00 = 030 31 .def _main;32 .scl 2;33 .type 32;34 .endef35 .section .text,"xr",one_only,_main36 .globl _main37_main:38 movl $42, %eax39 ret40 41# Add a handler to create an .sxdata section, which -safeseh:no should ignore.42 .def _my_handler; .scl 3; .type 32;43 .endef44 .section .text,"xr",one_only,_my_handler45_my_handler:46 ret47.safeseh _my_handler48 49 50 .section .rdata,"dr"51.globl __load_config_used52__load_config_used:53 .long 7254 .fill 60, 1, 055 .long ___safe_se_handler_table56 .long ___safe_se_handler_count57 58