1# REQUIRES: x86
2# RUN: grep -B99999 [S]PLITMARKER %s | llvm-mc -triple x86_64-windows-msvc -filetype=obj -o %t1.obj
3# RUN: grep -A99999 [S]PLITMARKER %s | llvm-mc -triple x86_64-windows-msvc -filetype=obj -o %t2.obj
4# RUN: lld-link %t1.obj %t2.obj -guard:nolongjmp -out:%t.exe -entry:main -opt:noref
5# RUN: llvm-readobj --file-headers --coff-load-config %t.exe | FileCheck %s
6
7# CHECK: ImageBase: 0x140000000
8# CHECK: LoadConfig [
9# CHECK:   SEHandlerTable: 0x0
10# CHECK:   SEHandlerCount: 0
11# CHECK:   GuardCFCheckFunction: 0x0
12# CHECK:   GuardCFCheckDispatch: 0x0
13# CHECK:   GuardCFFunctionTable: 0x14000{{.*}}
14# CHECK:   GuardCFFunctionCount: 3
15# CHECK:   GuardFlags: 0x500
16# CHECK:   GuardAddressTakenIatEntryTable: 0x0
17# CHECK:   GuardAddressTakenIatEntryCount: 0
18# CHECK:   GuardLongJumpTargetTable: 0x0
19# CHECK:   GuardLongJumpTargetCount: 0
20# CHECK: ]
21# CHECK:      GuardFidTable [
22# CHECK-NEXT:   0x14000{{.*}}
23# CHECK-NEXT:   0x14000{{.*}}
24# CHECK-NEXT:   0x14000{{.*}}
25# CHECK-NEXT: ]
26
27
28# Indicate that no gfids are present. All symbols used by relocations in this
29# file will be considered address-taken.
30        .def     @feat.00; .scl    3; .type   0; .endef
31        .globl  @feat.00
32@feat.00 = 0
33
34        .def     main; .scl    2; .type   32; .endef
35        .section        .text,"xr",one_only,main
36        .globl  main
37main:
38        subq $8, %rsp
39        leaq foo(%rip), %rdx
40        callq bar
41        movl $0, %eax
42        addq $8, %rsp
43        retq
44
45# Should not appear in gfids table.
46        .def     baz; .scl    2; .type   32; .endef
47        .section        .text,"xr",one_only,baz
48        .globl  baz
49baz:
50        mov $1, %eax
51        retq
52
53        .def     qux; .scl    2; .type   32; .endef
54        .section        .text,"xr",one_only,qux
55        .globl  qux
56qux:
57        mov $2, %eax
58        retq
59
60        .def     quxx; .scl    2; .type   32; .endef
61        .section        .text,"xr",one_only,quxx
62        .globl  quxx
63quxx:
64        mov $3, %eax
65        retq
66
67# Load config.
68        .section .rdata,"dr"
69.globl _load_config_used
70_load_config_used:
71        .long 256
72        .fill 124, 1, 0
73        .quad __guard_fids_table
74        .quad __guard_fids_count
75        .long __guard_flags
76        .fill 128, 1, 0
77
78# SPLITMARKER
79
80# Indicate that gfids are present. This file does not take any addresses.
81        .def     @feat.00; .scl    3; .type   0; .endef
82        .globl  @feat.00
83@feat.00 = 0x800
84
85        .def     foo; .scl    2; .type   32; .endef
86        .section        .text,"xr",one_only,foo
87        .global foo
88foo:
89        movl $42, %eax
90        retq
91
92        .def     bar; .scl    2; .type   32; .endef
93        .section        .text,"xr",one_only,bar
94        .global bar
95bar:
96        movl $13, %eax
97        retq
98