2 # RUN: llvm-mc -triple x86_64-pc-win32 %s -filetype=obj -o %t.obj
3 # RUN: lld-link %t.obj -guard:cf -out:%t.exe -entry:main
4 # RUN: llvm-readobj --coff-load-config %t.exe | FileCheck %s --check-prefix=CHECK
6 # f, g, and main go in the table.
7 # Including g isn't strictly necessary since it's not an indirect call target,
8 # however the linker can't know that because relative relocations are used both
9 # for direct calls and for getting the absolute address of a function.
10 # (use /lldmap:map.txt to check their addresses).
12 # CHECK: GuardFidTable [
13 # CHECK-NEXT: 0x140001000
14 # CHECK-NEXT: 0x140001010
15 # CHECK-NEXT: 0x140001030
22 .section .text,"xr",one_only,f
32 .section .text,"xr",one_only,g
39 .scl 6; # StorageClass: Label
40 .type 0; # Type: Not a function.
42 .section .text,"xr",one_only,label
50 fp
: .quad f # DIR32 relocation to function
51 .quad label # DIR32 relocation to label
58 .section .text,"xr",one_only,main
61 main
: call
*fp
# DIR32 relocation to data
62 call g
# REL32 relocation to function
66 # Load configuration directory entry (winnt.h _IMAGE_LOAD_CONFIG_DIRECTORY64).
67 # The linker will define the __guard_* symbols.
69 .globl _load_config_used
73 .quad __guard_fids_table
74 .quad __guard_fids_count