Rename CODE_OWNERS -> Maintainers (#114544)
[llvm-project.git] / lld / test / COFF / gfids-relocations64.s
blob7d3afb221258df1018b92c764798cbefcc9a1f7c
1 # REQUIRES: x86
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
16 # CHECK-NEXT: ]
18 .def f;
19 .scl 3;
20 .type 32;
21 .endef
22 .section .text,"xr",one_only,f
23 .p2align 4
24 f: movl $1, %eax
25 ret
28 .def g;
29 .scl 3;
30 .type 32;
31 .endef
32 .section .text,"xr",one_only,g
33 .p2align 4
34 g: movl $2, %eax
35 ret
38 .def label;
39 .scl 6; # StorageClass: Label
40 .type 0; # Type: Not a function.
41 .endef
42 .section .text,"xr",one_only,label
43 .p2align 4
44 label: ret
47 .data
48 .globl fp
49 .p2align 4
50 fp: .quad f # DIR32 relocation to function
51 .quad label # DIR32 relocation to label
54 .def main;
55 .scl 2;
56 .type 32;
57 .endef
58 .section .text,"xr",one_only,main
59 .globl main
60 .p2align 4
61 main: call *fp # DIR32 relocation to data
62 call g # REL32 relocation to function
63 ret
66 # Load configuration directory entry (winnt.h _IMAGE_LOAD_CONFIG_DIRECTORY64).
67 # The linker will define the __guard_* symbols.
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