[clang-tidy][use-internal-linkage]fix false positives for global overloaded operator...
[llvm-project.git] / lld / test / COFF / arm64ec-cust-export-thunk.s
blobe56f34c8752173e2518c4ad1cae7573137df743a
1 # REQUIRES: aarch64, x86
2 # RUN: split-file %s %t.dir && cd %t.dir
4 # Test that metadata is generated when a custom export thunk is supplied.
6 # RUN: llvm-mc -filetype=obj -triple=arm64ec-windows func.s -o func.obj
7 # RUN: llvm-mc -filetype=obj -triple=arm64ec-windows hp-func.s -o hp-func.obj
8 # RUN: llvm-mc -filetype=obj -triple=x86_64-windows thunk.s -o thunk.obj
9 # RUN: llvm-mc -filetype=obj -triple=arm64ec-windows %S/Inputs/loadconfig-arm64ec.s -o loadconfig-arm64ec.obj
11 # RUN: lld-link -out:out.dll -machine:arm64ec func.obj thunk.obj loadconfig-arm64ec.obj -dll -noentry "-export:#func,EXPORTAS,func"
13 # RUN: llvm-objdump -d out.dll | FileCheck --check-prefixes=DISASM,DISASM-EXP %s
14 # DISASM: Disassembly of section .text:
15 # DISASM-EMPTY:
16 # DISASM-NEXT: 0000000180001000 <.text>:
17 # DISASM-NEXT: 180001000: 52800040 mov w0, #0x2 // =2
18 # DISASM-NEXT: 180001004: d65f03c0 ret
19 # DISASM-NEXT: ...
20 # DISASM-EXP-EMPTY:
21 # DISASM-EXP-NEXT: 0000000180002000 <func>:
22 # DISASM-NEXT: 180002000: b8 03 00 00 00 movl $0x3, %eax
23 # DISASM-NEXT: 180002005: c3 retq
25 # RUN: llvm-objdump -p out.dll | FileCheck --check-prefix=EXPORT %s
26 # EXPORT: Ordinal RVA Name
27 # EXPORT-NEXT: 1 0x2000 func
29 # RUN: llvm-readobj --coff-load-config out.dll | FileCheck --check-prefix=CHPE %s
30 # CHPE: CodeMap [
31 # CHPE-NEXT: 0x1000 - 0x1008 ARM64EC
32 # CHPE-NEXT: 0x2000 - 0x2006 X64
33 # CHPE-NEXT: ]
34 # CHPE-NEXT: CodeRangesToEntryPoints [
35 # CHPE-NEXT: 0x2000 - 0x2006 -> 0x2000
36 # CHPE-NEXT: ]
37 # CHPE-NEXT: RedirectionMetadata [
38 # CHPE-NEXT: 0x2000 -> 0x1000
39 # CHPE-NEXT: ]
41 # RUN: lld-link -out:out2.dll -machine:arm64ec hp-func.obj thunk.obj loadconfig-arm64ec.obj -dll -noentry
42 # RUN: llvm-objdump -d out2.dll | FileCheck --check-prefix=DISASM %s
43 # RUN: llvm-readobj --coff-load-config out2.dll | FileCheck --check-prefix=CHPE %s
45 #--- func.s
46 .globl "#func"
47 .p2align 2, 0x0
48 "#func":
49 mov w0, #2
50 ret
52 #--- hp-func.s
53 .section .text,"xr",discard,"#func$hp_target"
54 .globl "#func$hp_target"
55 .p2align 2, 0x0
56 "#func$hp_target":
57 mov w0, #2
58 ret
60 .def "EXP+#func"
61 .scl 2
62 .type 32
63 .endef
64 .weak func
65 .set func, "EXP+#func"
66 .weak "#func"
67 .set "#func", "#func$hp_target"
69 .data
70 .rva func
72 #--- thunk.s
73 .def "EXP+#func"
74 .scl 2
75 .type 32
76 .endef
77 .section .wowthk$aa,"xr",discard,"EXP+#func"
78 .globl "EXP+#func"
79 .p2align 2, 0x0
80 "EXP+#func":
81 movl $3, %eax
82 retq