[LV] Add test showing debug output for loops with uncountable BTCs.
[llvm-project.git] / lld / test / COFF / arm64x-loadconfig.s
blobd21f4bfe95b8435a8c3bb86416fa42265df3a484
1 // REQUIRES: aarch64
2 // RUN: split-file %s %t.dir && cd %t.dir
4 // RUN: llvm-mc -filetype=obj -triple=aarch64-windows test.s -o test.obj
5 // RUN: llvm-mc -filetype=obj -triple=arm64ec-windows chpe.s -o chpe.obj
6 // RUN: llvm-mc -filetype=obj -triple=aarch64-windows loadconfig.s -o loadconfig.obj
7 // RUN: llvm-mc -filetype=obj -triple=arm64ec-windows loadconfig-ec.s -o loadconfig-ec.obj
8 // RUN: llvm-mc -filetype=obj -triple=aarch64-windows loadconfig-short.s -o loadconfig-short.obj
9 // RUN: llvm-mc -filetype=obj -triple=arm64ec-windows loadconfig-short.s -o loadconfig-short-arm64ec.obj
11 // RUN: lld-link -machine:arm64x -out:out-warn.dll -dll -noentry test.obj \
12 // RUN: 2>&1 | FileCheck --check-prefixes=WARN-LOADCFG,WARN-EC-LOADCFG %s
13 // WARN-LOADCFG: lld-link: warning: native version of '_load_config_used' is missing for ARM64X target
14 // WARN-EC-LOADCFG: lld-link: warning: EC version of '_load_config_used' is missing
16 // RUN: lld-link -machine:arm64x -out:out-nonative.dll -dll -noentry loadconfig-ec.obj chpe.obj \
17 // RUN: 2>&1 | FileCheck --check-prefixes=WARN-LOADCFG --implicit-check-not EC %s
19 // RUN: lld-link -machine:arm64ec -out:out-ec.dll -dll -noentry chpe.obj \
20 // RUN: 2>&1 | FileCheck --check-prefixes=WARN-EC-LOADCFG --implicit-check-not native %s
22 // RUN: lld-link -machine:arm64x -out:out.dll -dll -noentry loadconfig.obj test.obj \
23 // RUN: 2>&1 | FileCheck --check-prefixes=WARN-EC-LOADCFG --implicit-check-not native %s
25 // RUN: llvm-readobj --coff-load-config out.dll | FileCheck --check-prefix=DYNRELOCS %s
26 // DYNRELOCS: DynamicValueRelocTableOffset: 0xC
27 // DYNRELOCS-NEXT: DynamicValueRelocTableSection: 4
28 // DYNRELOCS: DynamicRelocations [
29 // DYNRELOCS-NEXT: Version: 0x1
30 // DYNRELOCS-NEXT: Arm64X [
31 // DYNRELOCS-NEXT: Entry [
32 // DYNRELOCS-NEXT: RVA: 0x7C
33 // DYNRELOCS-NEXT: Type: VALUE
34 // DYNRELOCS-NEXT: Size: 0x2
35 // DYNRELOCS-NEXT: Value: 0x8664
36 // DYNRELOCS-NEXT: ]
37 // DYNRELOCS-NEXT: Entry [
38 // DYNRELOCS-NEXT: RVA: 0x150
39 // DYNRELOCS-NEXT: Type: VALUE
40 // DYNRELOCS-NEXT: Size: 0x4
41 // DYNRELOCS-NEXT: Value: 0x0
42 // DYNRELOCS-NEXT: ]
43 // DYNRELOCS-NEXT: Entry [
44 // DYNRELOCS-NEXT: RVA: 0x154
45 // DYNRELOCS-NEXT: Type: VALUE
46 // DYNRELOCS-NEXT: Size: 0x4
47 // DYNRELOCS-NEXT: Value: 0x0
48 // DYNRELOCS-NEXT: ]
49 // DYNRELOCS-NEXT: ]
50 // DYNRELOCS-NEXT: ]
52 // RUN: llvm-readobj --headers out.dll | FileCheck --check-prefix=HEADERS %s
53 // HEADERS: BaseRelocationTableRVA: 0x4000
54 // HEADERS-NEXT: BaseRelocationTableSize: 0xC
55 // HEADERS: LoadConfigTableRVA: 0x1000
56 // HEADERS-NEXT: LoadConfigTableSize: 0x140
57 // HEADERS: Name: .reloc (2E 72 65 6C 6F 63 00 00)
58 // HEADERS-NEXT: VirtualSize: 0x38
60 // RUN: lld-link -machine:arm64x -out:out-short.dll -dll -noentry loadconfig-short.obj 2>&1 | FileCheck --check-prefix=WARN-RELOC-SIZE %s
61 // RUN: lld-link -machine:arm64x -out:out-short.dll -dll -noentry loadconfig-short-arm64ec.obj 2>&1 | FileCheck --check-prefix=WARN-RELOC-SIZE %s
62 // WARN-RELOC-SIZE: lld-link: warning: '_load_config_used' structure too small to include dynamic relocations
64 // Check that the CHPE metadata pointer is correctly copied from the EC load config to the native load config.
66 // RUN: lld-link -machine:arm64x -out:out-hyb.dll -dll -noentry loadconfig.obj loadconfig-ec.obj chpe.obj test.obj
68 // RUN: llvm-readobj --coff-load-config out-hyb.dll | FileCheck --check-prefix=LOADCFG %s
69 // LOADCFG: Format: COFF-ARM64X
70 // LOADCFG-NEXT: Arch: aarch64
71 // LOADCFG-NEXT: AddressSize: 64bit
72 // LOADCFG-NEXT: LoadConfig [
73 // LOADCFG-NEXT: Size: 0x140
74 // LOADCFG: CHPEMetadata [
75 // LOADCFG-NEXT: Version: 0x2
76 // LOADCFG: RedirectionMetadata: 12288
77 // LOADCFG: AlternateEntryPoint: 0x0
78 // LOADCFG-NEXT: AuxiliaryIAT: 0x0
79 // LOADCFG-NEXT: GetX64InformationFunctionPointer: 0x0
80 // LOADCFG-NEXT: SetX64InformationFunctionPointer: 0x0
81 // LOADCFG-NEXT: ExtraRFETable: 0x0
82 // LOADCFG-NEXT: ExtraRFETableSize: 0x0
83 // LOADCFG-NEXT: __os_arm64x_dispatch_fptr: 0x0
84 // LOADCFG-NEXT: AuxiliaryIATCopy: 0x0
85 // LOADCFG-NEXT: AuxiliaryDelayloadIAT: 0x0
86 // LOADCFG-NEXT: AuxiliaryDelayloadIATCopy: 0x0
87 // LOADCFG-NEXT: HybridImageInfoBitfield: 0x0
88 // LOADCFG: ]
89 // LOADCFG-NEXT: DynamicRelocations [
90 // LOADCFG-NEXT: Version: 0x1
91 // LOADCFG-NEXT: Arm64X [
92 // LOADCFG-NEXT: Entry [
93 // LOADCFG-NEXT: RVA: 0x7C
94 // LOADCFG-NEXT: Type: VALUE
95 // LOADCFG-NEXT: Size: 0x2
96 // LOADCFG-NEXT: Value: 0x8664
97 // LOADCFG-NEXT: ]
98 // LOADCFG-NEXT: Entry [
99 // LOADCFG-NEXT: RVA: 0x150
100 // LOADCFG-NEXT: Type: VALUE
101 // LOADCFG-NEXT: Size: 0x4
102 // LOADCFG-NEXT: Value: 0x0
103 // LOADCFG-NEXT: ]
104 // LOADCFG-NEXT: Entry [
105 // LOADCFG-NEXT: RVA: 0x154
106 // LOADCFG-NEXT: Type: VALUE
107 // LOADCFG-NEXT: Size: 0x4
108 // LOADCFG-NEXT: Value: 0x0
109 // LOADCFG-NEXT: ]
110 // LOADCFG-NEXT: ]
111 // LOADCFG-NEXT: ]
112 // LOADCFG-NEXT: HybridObject {
113 // LOADCFG-NEXT: Format: COFF-x86-64
114 // LOADCFG-NEXT: Arch: x86_64
115 // LOADCFG-NEXT: AddressSize: 64bit
117 // RUN: llvm-readobj --coff-basereloc out-hyb.dll | FileCheck --check-prefix=BASERELOC %s
118 // BASERELOC: BaseReloc [
119 // BASERELOC-NEXT: Entry {
120 // BASERELOC-NEXT: Type: DIR64
121 // BASERELOC-NEXT: Address: 0x1208
122 // BASERELOC-NEXT: }
123 // BASERELOC-NEXT: Entry {
124 // BASERELOC: Type: DIR64
125 // BASERELOC-NEXT: Address: 0x2074
126 // BASERELOC-NEXT: }
128 #--- test.s
129 .data
130 sym:
131 // Emit a basereloc to make the loadconfig test more meaningful.
132 .xword sym
134 #--- loadconfig.s
135 .section .rdata,"dr"
136 .globl _load_config_used
137 .p2align 3, 0
138 _load_config_used:
139 .word 0x140
140 .fill 0x13c,1,0
142 #--- loadconfig-ec.s
143 .section .rdata,"dr"
144 .globl _load_config_used
145 .p2align 3, 0
146 _load_config_used:
147 .word 0x140
148 .fill 0xc4,1,0
149 .xword __chpe_metadata
150 .fill 0x70,1,0
152 #--- loadconfig-short.s
153 .section .rdata,"dr"
154 .globl _load_config_used
155 .p2align 3, 0
156 _load_config_used:
157 .word 0xe4
158 .fill 0xe0,1,0
160 #--- chpe.s
161 .data
162 .globl __chpe_metadata
163 .p2align 3, 0
164 __chpe_metadata:
165 .word 2
166 .rva __hybrid_code_map
167 .word __hybrid_code_map_count
168 .rva __x64_code_ranges_to_entry_points
169 .rva __arm64x_redirection_metadata
170 .word 0 // __os_arm64x_dispatch_call_no_redirect
171 .word 0 // __os_arm64x_dispatch_ret
172 .word 0 // __os_arm64x_check_call
173 .word 0 // __os_arm64x_check_icall
174 .word 0 // __os_arm64x_check_icall_cfg
175 .rva __arm64x_native_entrypoint
176 .rva __hybrid_auxiliary_iat
177 .word __x64_code_ranges_to_entry_points_count
178 .word __arm64x_redirection_metadata_count
179 .word 0 // __os_arm64x_get_x64_information
180 .word 0 // __os_arm64x_set_x64_information
181 .rva __arm64x_extra_rfe_table
182 .word __arm64x_extra_rfe_table_size
183 .word 0 // __os_arm64x_dispatch_fptr
184 .rva __hybrid_auxiliary_iat_copy
185 .rva __hybrid_auxiliary_delayload_iat
186 .rva __hybrid_auxiliary_delayload_iat_copy
187 .word __hybrid_image_info_bitfield
188 .word 0 // __os_arm64x_helper3
189 .word 0 // __os_arm64x_helper4
190 .word 0 // __os_arm64x_helper5
191 .word 0 // __os_arm64x_helper6
192 .word 0 // __os_arm64x_helper7
193 .word 0 // __os_arm64x_helper8