[clang-tidy][use-internal-linkage]fix false positives for global overloaded operator...
[llvm-project.git] / lld / test / COFF / arm64ec-exports.s
blob870540d6104621c919ce9d402cdc9392d46675d9
1 ; REQUIRES: aarch64
2 ; RUN: split-file %s %t.dir && cd %t.dir
4 ; RUN: llvm-mc -filetype=obj -triple=arm64ec-windows test.s -o test.obj
5 ; RUN: llvm-mc -filetype=obj -triple=arm64ec-windows drectve.s -o drectve.obj
6 ; RUN: llvm-mc -filetype=obj -triple=arm64ec-windows %S/Inputs/loadconfig-arm64ec.s -o loadconfig-arm64ec.obj
8 ; Check various forms of export directive and make sure that function export name is demangled.
10 ; RUN: lld-link -out:out.dll test.obj loadconfig-arm64ec.obj -dll -noentry -machine:arm64ec \
11 ; RUN: -export:unmangled_func '-export:#mangled_func' '-export:#exportas_func,EXPORTAS,exportas_func' \
12 ; RUN: '-export:?cxx_func@@$$hYAHXZ' -export:data_sym,DATA '-export:#mangled_data_sym,DATA'
15 ; RUN: llvm-readobj --coff-exports out.dll | FileCheck --check-prefix=EXP %s
16 ; EXP: Export {
17 ; EXP-NEXT: Ordinal: 1
18 ; EXP-NEXT: Name: #mangled_data_sym
19 ; EXP-NEXT: RVA: 0x4000
20 ; EXP-NEXT: }
21 ; EXP-NEXT: Export {
22 ; EXP-NEXT: Ordinal: 2
23 ; EXP-NEXT: Name: ?cxx_func@@YAHXZ
24 ; EXP-NEXT: RVA: 0x2030
25 ; EXP-NEXT: }
26 ; EXP-NEXT: Export {
27 ; EXP-NEXT: Ordinal: 3
28 ; EXP-NEXT: Name: data_sym
29 ; EXP-NEXT: RVA: 0x4004
30 ; EXP-NEXT: }
31 ; EXP-NEXT: Export {
32 ; EXP-NEXT: Ordinal: 4
33 ; EXP-NEXT: Name: exportas_func
34 ; EXP-NEXT: RVA: 0x2020
35 ; EXP-NEXT: }
36 ; EXP-NEXT: Export {
37 ; EXP-NEXT: Ordinal: 5
38 ; EXP-NEXT: Name: mangled_func
39 ; EXP-NEXT: RVA: 0x2010
40 ; EXP-NEXT: }
41 ; EXP-NEXT: Export {
42 ; EXP-NEXT: Ordinal: 6
43 ; EXP-NEXT: Name: unmangled_func
44 ; EXP-NEXT: RVA: 0x2000
45 ; EXP-NEXT: }
47 ; RUN: llvm-nm --print-armap out.lib | FileCheck --check-prefix=IMPLIB %s
48 ; IMPLIB: Archive EC map
49 ; IMPLIB-NEXT: #exportas_func in out
50 ; IMPLIB-NEXT: #mangled_func in out
51 ; IMPLIB-NEXT: #unmangled_func in out
52 ; IMPLIB-NEXT: ?cxx_func@@$$hYAHXZ in out
53 ; IMPLIB-NEXT: ?cxx_func@@YAHXZ in out
54 ; IMPLIB-NEXT: __IMPORT_DESCRIPTOR_out{{.*}} in out
55 ; IMPLIB-NEXT: __NULL_IMPORT_DESCRIPTOR in out
56 ; IMPLIB-NEXT: __imp_?cxx_func@@YAHXZ in out
57 ; IMPLIB-NEXT: __imp_aux_?cxx_func@@YAHXZ in out
58 ; IMPLIB-NEXT: __imp_aux_exportas_func in out
59 ; IMPLIB-NEXT: __imp_aux_mangled_func in out
60 ; IMPLIB-NEXT: __imp_aux_unmangled_func in out
61 ; IMPLIB-NEXT: __imp_data_sym in out
62 ; IMPLIB-NEXT: __imp_exportas_func in out
63 ; IMPLIB-NEXT: __imp_mangled_data_sym in out
64 ; IMPLIB-NEXT: __imp_mangled_func in out
65 ; IMPLIB-NEXT: __imp_unmangled_func in out
66 ; IMPLIB-NEXT: exportas_func in out
67 ; IMPLIB-NEXT: mangled_func in out
68 ; IMPLIB-NEXT: unmangled_func in out
69 ; IMPLIB-NEXT: out{{.*}}_NULL_THUNK_DATA in out
72 ; Check that using .drectve section has the same effect.
74 ; RUN: lld-link -out:out2.dll test.obj loadconfig-arm64ec.obj -dll -noentry -machine:arm64ec drectve.obj
75 ; RUN: llvm-readobj --coff-exports out2.dll | FileCheck --check-prefix=EXP %s
76 ; RUN: llvm-nm --print-armap out2.lib | FileCheck --check-prefix=IMPLIB %s
78 #--- test.s
79 .text
80 .globl unmangled_func
81 .p2align 2, 0x0
82 unmangled_func:
83 mov w0, #1
84 ret
86 .globl "#mangled_func"
87 .p2align 2, 0x0
88 "#mangled_func":
89 mov w0, #2
90 ret
92 .globl "#exportas_func"
93 .p2align 2, 0x0
94 "#exportas_func":
95 mov w0, #3
96 ret
98 .globl "?cxx_func@@$$hYAHXZ"
99 .p2align 2, 0x0
100 "?cxx_func@@$$hYAHXZ":
101 mov w0, #4
104 .data
105 .globl "#mangled_data_sym"
106 .p2align 2, 0x0
107 "#mangled_data_sym":
108 .word 0x01010101
109 .globl data_sym
110 .p2align 2, 0x0
111 data_sym:
112 .word 0x01010101
114 #--- drectve.s
115 .section .drectve, "yn"
116 .ascii " -export:unmangled_func"
117 .ascii " -export:#mangled_func"
118 .ascii " -export:#exportas_func,EXPORTAS,exportas_func"
119 .ascii " -export:?cxx_func@@$$hYAHXZ"
120 .ascii " -export:data_sym,DATA"
121 .ascii " -export:#mangled_data_sym,DATA"