Skip to content

Commit d3eda76

Browse files
Rollup merge of rust-lang#120124 - nikic:fix-assembly-test, r=davidtwco
Split assembly tests for ELF and MachO On ELF, the text section is opened with ".text", on MachO with ".section __TEXT,__text". Previously, on ELF this test was actually matching a GNU note section, which is no longer emitted on Solaris starting with LLVM 18. Fixes rust-lang#120105. r? `@davidtwco`
2 parents 2f19fb1 + 8866449 commit d3eda76

File tree

2 files changed

+82
-64
lines changed

2 files changed

+82
-64
lines changed

tests/assembly/targets/targets-elf.rs

+1-64
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,5 @@
11
// assembly-output: emit-asm
22
// ignore-tidy-linelength
3-
// revisions: aarch64_apple_darwin
4-
// [aarch64_apple_darwin] compile-flags: --target aarch64-apple-darwin
5-
// [aarch64_apple_darwin] needs-llvm-components: aarch64
6-
// revisions: aarch64_apple_ios
7-
// [aarch64_apple_ios] compile-flags: --target aarch64-apple-ios
8-
// [aarch64_apple_ios] needs-llvm-components: aarch64
9-
// revisions: aarch64_apple_ios_macabi
10-
// [aarch64_apple_ios_macabi] compile-flags: --target aarch64-apple-ios-macabi
11-
// [aarch64_apple_ios_macabi] needs-llvm-components: aarch64
12-
// revisions: aarch64_apple_ios_sim
13-
// [aarch64_apple_ios_sim] compile-flags: --target aarch64-apple-ios-sim
14-
// [aarch64_apple_ios_sim] needs-llvm-components: aarch64
15-
// revisions: aarch64_apple_tvos
16-
// [aarch64_apple_tvos] compile-flags: --target aarch64-apple-tvos
17-
// [aarch64_apple_tvos] needs-llvm-components: aarch64
18-
// revisions: aarch64_apple_tvos_sim
19-
// [aarch64_apple_tvos_sim] compile-flags: --target aarch64-apple-tvos-sim
20-
// [aarch64_apple_tvos_sim] needs-llvm-components: aarch64
21-
// revisions: aarch64_apple_watchos
22-
// [aarch64_apple_watchos] compile-flags: --target aarch64-apple-watchos
23-
// [aarch64_apple_watchos] needs-llvm-components: aarch64
24-
// revisions: aarch64_apple_watchos_sim
25-
// [aarch64_apple_watchos_sim] compile-flags: --target aarch64-apple-watchos-sim
26-
// [aarch64_apple_watchos_sim] needs-llvm-components: aarch64
273
// revisions: aarch64_be_unknown_linux_gnu
284
// [aarch64_be_unknown_linux_gnu] compile-flags: --target aarch64_be-unknown-linux-gnu
295
// [aarch64_be_unknown_linux_gnu] needs-llvm-components: aarch64
@@ -93,15 +69,6 @@
9369
// revisions: aarch64_wrs_vxworks
9470
// [aarch64_wrs_vxworks] compile-flags: --target aarch64-wrs-vxworks
9571
// [aarch64_wrs_vxworks] needs-llvm-components: aarch64
96-
// revisions: arm64_32_apple_watchos
97-
// [arm64_32_apple_watchos] compile-flags: --target arm64_32-apple-watchos
98-
// [arm64_32_apple_watchos] needs-llvm-components: aarch64
99-
// revisions: arm64e_apple_darwin
100-
// [arm64e_apple_darwin] compile-flags: --target arm64e-apple-darwin
101-
// [arm64e_apple_darwin] needs-llvm-components: aarch64
102-
// revisions: arm64e_apple_ios
103-
// [arm64e_apple_ios] compile-flags: --target arm64e-apple-ios
104-
// [arm64e_apple_ios] needs-llvm-components: aarch64
10572
// revisions: arm_linux_androideabi
10673
// [arm_linux_androideabi] compile-flags: --target arm-linux-androideabi
10774
// [arm_linux_androideabi] needs-llvm-components: arm
@@ -201,18 +168,12 @@
201168
// revisions: armv7a_none_eabihf
202169
// [armv7a_none_eabihf] compile-flags: --target armv7a-none-eabihf
203170
// [armv7a_none_eabihf] needs-llvm-components: arm
204-
// revisions: armv7k_apple_watchos
205-
// [armv7k_apple_watchos] compile-flags: --target armv7k-apple-watchos
206-
// [armv7k_apple_watchos] needs-llvm-components: arm
207171
// revisions: armv7r_none_eabi
208172
// [armv7r_none_eabi] compile-flags: --target armv7r-none-eabi
209173
// [armv7r_none_eabi] needs-llvm-components: arm
210174
// revisions: armv7r_none_eabihf
211175
// [armv7r_none_eabihf] compile-flags: --target armv7r-none-eabihf
212176
// [armv7r_none_eabihf] needs-llvm-components: arm
213-
// revisions: armv7s_apple_ios
214-
// [armv7s_apple_ios] compile-flags: --target armv7s-apple-ios
215-
// [armv7s_apple_ios] needs-llvm-components: arm
216177
// FIXME: disabled since it fails on CI saying the csky component is missing
217178
/*
218179
revisions: csky_unknown_linux_gnuabiv2
@@ -228,9 +189,6 @@
228189
// revisions: hexagon_unknown_none_elf
229190
// [hexagon_unknown_none_elf] compile-flags: --target hexagon-unknown-none-elf
230191
// [hexagon_unknown_none_elf] needs-llvm-components: hexagon
231-
// revisions: i386_apple_ios
232-
// [i386_apple_ios] compile-flags: --target i386-apple-ios
233-
// [i386_apple_ios] needs-llvm-components: x86
234192
// revisions: i586_pc_nto_qnx700
235193
// [i586_pc_nto_qnx700] compile-flags: --target i586-pc-nto-qnx700
236194
// [i586_pc_nto_qnx700] needs-llvm-components: x86
@@ -243,9 +201,6 @@
243201
// revisions: i586_unknown_netbsd
244202
// [i586_unknown_netbsd] compile-flags: --target i586-unknown-netbsd
245203
// [i586_unknown_netbsd] needs-llvm-components: x86
246-
// revisions: i686_apple_darwin
247-
// [i686_apple_darwin] compile-flags: --target i686-apple-darwin
248-
// [i686_apple_darwin] needs-llvm-components: x86
249204
// revisions: i686_linux_android
250205
// [i686_linux_android] compile-flags: --target i686-linux-android
251206
// [i686_linux_android] needs-llvm-components: x86
@@ -537,21 +492,6 @@
537492
// revisions: wasm32_wasi_preview2
538493
// [wasm32_wasi_preview2] compile-flags: --target wasm32-wasi-preview2
539494
// [wasm32_wasi_preview2] needs-llvm-components: webassembly
540-
// revisions: x86_64_apple_darwin
541-
// [x86_64_apple_darwin] compile-flags: --target x86_64-apple-darwin
542-
// [x86_64_apple_darwin] needs-llvm-components: x86
543-
// revisions: x86_64_apple_ios
544-
// [x86_64_apple_ios] compile-flags: --target x86_64-apple-ios
545-
// [x86_64_apple_ios] needs-llvm-components: x86
546-
// revisions: x86_64_apple_ios_macabi
547-
// [x86_64_apple_ios_macabi] compile-flags: --target x86_64-apple-ios-macabi
548-
// [x86_64_apple_ios_macabi] needs-llvm-components: x86
549-
// revisions: x86_64_apple_tvos
550-
// [x86_64_apple_tvos] compile-flags: --target x86_64-apple-tvos
551-
// [x86_64_apple_tvos] needs-llvm-components: x86
552-
// revisions: x86_64_apple_watchos_sim
553-
// [x86_64_apple_watchos_sim] compile-flags: --target x86_64-apple-watchos-sim
554-
// [x86_64_apple_watchos_sim] needs-llvm-components: x86
555495
// revisions: x86_64_fortanix_unknown_sgx
556496
// [x86_64_fortanix_unknown_sgx] compile-flags: --target x86_64-fortanix-unknown-sgx
557497
// [x86_64_fortanix_unknown_sgx] needs-llvm-components: x86
@@ -618,9 +558,6 @@
618558
// revisions: x86_64_wrs_vxworks
619559
// [x86_64_wrs_vxworks] compile-flags: --target x86_64-wrs-vxworks
620560
// [x86_64_wrs_vxworks] needs-llvm-components: x86
621-
// revisions: x86_64h_apple_darwin
622-
// [x86_64h_apple_darwin] compile-flags: --target x86_64h-apple-darwin
623-
// [x86_64h_apple_darwin] needs-llvm-components: x86
624561

625562
// Sanity-check that each target can produce assembly code.
626563

@@ -636,4 +573,4 @@ pub fn test() -> u8 {
636573
42
637574
}
638575

639-
// CHECK: .section
576+
// CHECK: .text
+81
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
// assembly-output: emit-asm
2+
// ignore-tidy-linelength
3+
// revisions: aarch64_apple_darwin
4+
// [aarch64_apple_darwin] compile-flags: --target aarch64-apple-darwin
5+
// [aarch64_apple_darwin] needs-llvm-components: aarch64
6+
// revisions: aarch64_apple_ios
7+
// [aarch64_apple_ios] compile-flags: --target aarch64-apple-ios
8+
// [aarch64_apple_ios] needs-llvm-components: aarch64
9+
// revisions: aarch64_apple_ios_macabi
10+
// [aarch64_apple_ios_macabi] compile-flags: --target aarch64-apple-ios-macabi
11+
// [aarch64_apple_ios_macabi] needs-llvm-components: aarch64
12+
// revisions: aarch64_apple_ios_sim
13+
// [aarch64_apple_ios_sim] compile-flags: --target aarch64-apple-ios-sim
14+
// [aarch64_apple_ios_sim] needs-llvm-components: aarch64
15+
// revisions: aarch64_apple_tvos
16+
// [aarch64_apple_tvos] compile-flags: --target aarch64-apple-tvos
17+
// [aarch64_apple_tvos] needs-llvm-components: aarch64
18+
// revisions: aarch64_apple_tvos_sim
19+
// [aarch64_apple_tvos_sim] compile-flags: --target aarch64-apple-tvos-sim
20+
// [aarch64_apple_tvos_sim] needs-llvm-components: aarch64
21+
// revisions: aarch64_apple_watchos
22+
// [aarch64_apple_watchos] compile-flags: --target aarch64-apple-watchos
23+
// [aarch64_apple_watchos] needs-llvm-components: aarch64
24+
// revisions: aarch64_apple_watchos_sim
25+
// [aarch64_apple_watchos_sim] compile-flags: --target aarch64-apple-watchos-sim
26+
// [aarch64_apple_watchos_sim] needs-llvm-components: aarch64
27+
// revisions: arm64_32_apple_watchos
28+
// [arm64_32_apple_watchos] compile-flags: --target arm64_32-apple-watchos
29+
// [arm64_32_apple_watchos] needs-llvm-components: aarch64
30+
// revisions: arm64e_apple_darwin
31+
// [arm64e_apple_darwin] compile-flags: --target arm64e-apple-darwin
32+
// [arm64e_apple_darwin] needs-llvm-components: aarch64
33+
// revisions: arm64e_apple_ios
34+
// [arm64e_apple_ios] compile-flags: --target arm64e-apple-ios
35+
// [arm64e_apple_ios] needs-llvm-components: aarch64
36+
// revisions: armv7k_apple_watchos
37+
// [armv7k_apple_watchos] compile-flags: --target armv7k-apple-watchos
38+
// [armv7k_apple_watchos] needs-llvm-components: arm
39+
// revisions: armv7s_apple_ios
40+
// [armv7s_apple_ios] compile-flags: --target armv7s-apple-ios
41+
// [armv7s_apple_ios] needs-llvm-components: arm
42+
// revisions: i386_apple_ios
43+
// [i386_apple_ios] compile-flags: --target i386-apple-ios
44+
// [i386_apple_ios] needs-llvm-components: x86
45+
// revisions: i686_apple_darwin
46+
// [i686_apple_darwin] compile-flags: --target i686-apple-darwin
47+
// [i686_apple_darwin] needs-llvm-components: x86
48+
// revisions: x86_64_apple_darwin
49+
// [x86_64_apple_darwin] compile-flags: --target x86_64-apple-darwin
50+
// [x86_64_apple_darwin] needs-llvm-components: x86
51+
// revisions: x86_64_apple_ios
52+
// [x86_64_apple_ios] compile-flags: --target x86_64-apple-ios
53+
// [x86_64_apple_ios] needs-llvm-components: x86
54+
// revisions: x86_64_apple_ios_macabi
55+
// [x86_64_apple_ios_macabi] compile-flags: --target x86_64-apple-ios-macabi
56+
// [x86_64_apple_ios_macabi] needs-llvm-components: x86
57+
// revisions: x86_64_apple_tvos
58+
// [x86_64_apple_tvos] compile-flags: --target x86_64-apple-tvos
59+
// [x86_64_apple_tvos] needs-llvm-components: x86
60+
// revisions: x86_64_apple_watchos_sim
61+
// [x86_64_apple_watchos_sim] compile-flags: --target x86_64-apple-watchos-sim
62+
// [x86_64_apple_watchos_sim] needs-llvm-components: x86
63+
// revisions: x86_64h_apple_darwin
64+
// [x86_64h_apple_darwin] compile-flags: --target x86_64h-apple-darwin
65+
// [x86_64h_apple_darwin] needs-llvm-components: x86
66+
67+
// Sanity-check that each target can produce assembly code.
68+
69+
#![feature(no_core, lang_items)]
70+
#![no_std]
71+
#![no_core]
72+
#![crate_type = "lib"]
73+
74+
#[lang = "sized"]
75+
trait Sized {}
76+
77+
pub fn test() -> u8 {
78+
42
79+
}
80+
81+
// CHECK: .section __TEXT,__text

0 commit comments

Comments
 (0)