[clang-tidy][use-internal-linkage]fix false positives for global overloaded operator...
[llvm-project.git] / lld / test / COFF / arm64ec-altnames.s
blobb2abb24efe4c3278d58744d602cce23d55b1d891
1 REQUIRES: aarch64
2 RUN: split-file %s %t.dir && cd %t.dir
4 RUN: llvm-mc -filetype=obj -triple=arm64ec-windows ext.s -o ext.obj
5 RUN: llvm-mc -filetype=obj -triple=arm64ec-windows impl.s -o impl.obj
6 RUN: llvm-mc -filetype=obj -triple=arm64ec-windows impl-cpp.s -o impl-cpp.obj
7 RUN: llvm-mc -filetype=obj -triple=arm64ec-windows %S/Inputs/loadconfig-arm64ec.s -o loadconfig.obj
9 # Ensure -alternatename can change a mangled function symbol aliasing a defined symbol (typically a guest exit thunk).
11 RUN: lld-link -machine:arm64ec -dll -noentry -out:out1.dll ext.obj loadconfig.obj "-alternatename:#func=altsym"
13 RUN: llvm-objdump -d out1.dll | FileCheck --check-prefix=DISASM %s
14 DISASM: 0000000180001000 <.text>:
15 DISASM-NEXT: 180001000: 52800020 mov w0, #0x1 // =1
16 DISASM-NEXT: 180001004: d65f03c0 ret
17 DISASM-NOT: .thnk
19 RUN: llvm-readobj --hex-dump=.test out1.dll | FileCheck --check-prefix=TESTSEC %s
20 TESTSEC: 0x180005000 00100000 00100000
22 # Ensure -alternatename can change a demangled function symbol aliasing an anti-dependency symbol.
24 RUN: lld-link -machine:arm64ec -dll -noentry -out:out2.dll ext.obj loadconfig.obj -alternatename:func=altsym
26 RUN: llvm-objdump -d out2.dll | FileCheck --check-prefix=DISASM2 %s
27 DISASM2: Disassembly of section .text:
28 DISASM2-EMPTY:
29 DISASM2-NEXT: 0000000180001000 <.text>:
30 DISASM2-NEXT: 180001000: 52800020 mov w0, #0x1 // =1
31 DISASM2-NEXT: 180001004: d65f03c0 ret
32 DISASM2-EMPTY:
33 DISASM2-NEXT: Disassembly of section .thnk:
34 DISASM2-EMPTY:
35 DISASM2-NEXT: 0000000180006000 <.thnk>:
36 DISASM2-NEXT: 180006000: 52800040 mov w0, #0x2 // =2
37 DISASM2-NEXT: 180006004: d65f03c0 ret
39 RUN: llvm-readobj --hex-dump=.test out2.dll | FileCheck --check-prefix=TESTSEC2 %s
40 TESTSEC2: 0x180005000 00100000 00600000
42 # Ensure -alternatename cannot modify a demangled function symbol aliasing a defined symbol.
44 RUN: lld-link -machine:arm64ec -dll -noentry -out:out3.dll impl.obj loadconfig.obj -alternatename:func=altsym
45 RUN: llvm-objdump -d out3.dll | FileCheck --check-prefix=DISASM %s
46 RUN: llvm-readobj --hex-dump=.test out3.dll | FileCheck --check-prefix=TESTSEC %s
48 RUN: lld-link -machine:arm64ec -dll -noentry -out:out4.dll impl-cpp.obj loadconfig.obj -alternatename:func=altsym
49 RUN: llvm-objdump -d out4.dll | FileCheck --check-prefix=DISASM %s
50 RUN: llvm-readobj --hex-dump=.test out4.dll | FileCheck --check-prefix=TESTSEC %s
52 #--- ext.s
53 .weak_anti_dep func
54 .set func, "#func"
55 .weak_anti_dep "#func"
56 .set "#func", thunksym
58 .section .test, "r"
59 .rva func
60 .rva "#func"
62 .section .thnk,"xr",discard,thunksym
63 thunksym:
64 mov w0, #2
65 ret
67 .section .text,"xr",discard,altsym
68 .globl altsym
69 altsym:
70 mov w0, #1
71 ret
73 #--- impl.s
74 .weak_anti_dep func
75 .set func, "#func"
77 .section .test, "r"
78 .rva func
79 .rva "#func"
81 .section .text,"xr",discard,"#func"
82 "#func":
83 mov w0, #1
84 ret
86 .section .text,"xr",discard,altsym
87 .globl altsym
88 altsym:
89 mov w0, #2
90 ret
92 #--- impl-cpp.s
93 .weak_anti_dep func
94 .set func, "?func@@$$hYAXXZ"
96 .section .test, "r"
97 .rva func
98 .rva "?func@@$$hYAXXZ"
100 .section .text,"xr",discard,"?func@@$$hYAXXZ"
101 "?func@@$$hYAXXZ":
102 mov w0, #1
105 .section .text,"xr",discard,altsym
106 .globl altsym
107 altsym:
108 mov w0, #2