2 # RUN: llvm-mc -triple x86_64-windows-msvc %s -filetype=obj -o %t.obj
3 # RUN: lld-link %t.obj -guard:cf -out:%t.exe -entry:main
4 # RUN: llvm-readobj -file-headers -coff-load-config %t.exe | FileCheck %s
6 # CHECK: ImageBase: 0x140000000
8 # CHECK: SEHandlerTable: 0x0
9 # CHECK: SEHandlerCount: 0
10 # CHECK: GuardCFCheckFunction: 0x0
11 # CHECK: GuardCFCheckDispatch: 0x0
12 # CHECK: GuardCFFunctionTable: 0x14000{{.*}}
13 # CHECK: GuardCFFunctionCount: 1
14 # CHECK: GuardFlags: 0x10500
15 # CHECK: GuardAddressTakenIatEntryTable: 0x0
16 # CHECK: GuardAddressTakenIatEntryCount: 0
17 # CHECK: GuardLongJumpTargetTable: 0x14000{{.*}}
18 # CHECK: GuardLongJumpTargetCount: 1
20 # CHECK: GuardLJmpTable [
21 # CHECK-NEXT: 0x14000{{.*}}
25 # This assembly is reduced from C code like:
28 # void g() { longjmp(buf, 1); }
36 # We need @feat.00 to have 0x800 to indicate /guard:cf.
43 .def f; .scl 2; .type 32; .endef
64 # Record the longjmp target.
65 .section .gljmp$y,"dr"
69 # Provide setjmp/longjmp stubs.
70 .def _setjmp; .scl 2; .type 32; .endef
75 .def longjmp; .scl 2; .type 32; .endef
80 .def main; .scl 2; .type 32; .endef
81 .globl main # -- Begin function main
89 .comm buf,256,4 # @buf
92 .globl _load_config_used
96 .quad __guard_fids_table
97 .quad __guard_fids_count
100 .quad __guard_iat_table
101 .quad __guard_iat_count
102 .quad __guard_longjmp_table
103 .quad __guard_fids_count