[clang-tidy][use-internal-linkage]fix false positives for global overloaded operator...
[llvm-project.git] / lld / test / COFF / gfids-relocations32.s
bloba80bac76832378bf1bcfeff9c4688e99fbc400b2
1 # REQUIRES: x86
2 # RUN: llvm-mc -triple i686-pc-win32 %s -filetype=obj -o %t.obj
3 # RUN: lld-link -safeseh:no %t.obj -guard:cf -out:%t.exe -entry:main
4 # RUN: llvm-readobj --coff-load-config %t.exe | FileCheck %s --check-prefix=CHECK
6 # Only f and _main should go in the table.
7 # (use /lldmap:map.txt to check their addresses).
9 # CHECK: GuardFidTable [
10 # CHECK-NEXT: 0x401000
11 # CHECK-NEXT: 0x401030
12 # CHECK-NEXT: ]
14 # The input was loosely based on studying this program:
16 # void foo() { return; }
17 # void bar() { return; }
18 # int main() {
19 # foo();
20 # void (*arr[])() = { &bar };
21 # (*arr[0])();
22 # return 0;
23 # }
24 # cl /c a.cc && dumpbin /disasm a.obj > a.txt &&
25 # link a.obj /guard:cf /map:map.txt && dumpbin /loadconfig a.exe
29 .def f;
30 .scl 3;
31 .type 32;
32 .endef
33 .section .text,"xr",one_only,f
34 .p2align 4
35 f: movl $1, %eax
36 ret
39 .def g;
40 .scl 3;
41 .type 32;
42 .endef
43 .section .text,"xr",one_only,g
44 .p2align 4
45 g: movl $2, %eax
46 ret
49 .def label;
50 .scl 6; # StorageClass: Label
51 .type 0; # Type: Not a function.
52 .endef
53 .section .text,"xr",one_only,label
54 .p2align 4
55 label: ret
58 .data
59 .globl fp
60 .p2align 4
61 fp: .long f # DIR32 relocation to function
62 .long label # DIR32 relocation to label
65 .def _main;
66 .scl 2;
67 .type 32;
68 .endef
69 .section .text,"xr",one_only,_main
70 .globl _main
71 .p2align 4
72 _main: call *fp # DIR32 relocation to data
73 call g # REL32 relocation to function
74 ret
77 # Load configuration directory entry (winnt.h _IMAGE_LOAD_CONFIG_DIRECTORY32).
78 # The linker will define the ___guard_* symbols.
79 .section .rdata,"dr"
80 .globl __load_config_used
81 __load_config_used:
82 .long 104 # Size.
83 .fill 76, 1, 0
84 .long ___guard_fids_table
85 .long ___guard_fids_count
86 .long ___guard_flags
87 .fill 12, 1, 0