Skip to content

Commit

Permalink
Rollup merge of rust-lang#120124 - nikic:fix-assembly-test, r=davidtwco
Browse files Browse the repository at this point in the history
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``
  • Loading branch information
fmease authored Jan 24, 2024
2 parents 74201b4 c7a77b2 commit dceb83c
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 64 deletions.
65 changes: 1 addition & 64 deletions tests/assembly/targets/targets-elf.rs
Original file line number Diff line number Diff line change
@@ -1,29 1,5 @@
// assembly-output: emit-asm
// ignore-tidy-linelength
// revisions: aarch64_apple_darwin
// [aarch64_apple_darwin] compile-flags: --target aarch64-apple-darwin
// [aarch64_apple_darwin] needs-llvm-components: aarch64
// revisions: aarch64_apple_ios
// [aarch64_apple_ios] compile-flags: --target aarch64-apple-ios
// [aarch64_apple_ios] needs-llvm-components: aarch64
// revisions: aarch64_apple_ios_macabi
// [aarch64_apple_ios_macabi] compile-flags: --target aarch64-apple-ios-macabi
// [aarch64_apple_ios_macabi] needs-llvm-components: aarch64
// revisions: aarch64_apple_ios_sim
// [aarch64_apple_ios_sim] compile-flags: --target aarch64-apple-ios-sim
// [aarch64_apple_ios_sim] needs-llvm-components: aarch64
// revisions: aarch64_apple_tvos
// [aarch64_apple_tvos] compile-flags: --target aarch64-apple-tvos
// [aarch64_apple_tvos] needs-llvm-components: aarch64
// revisions: aarch64_apple_tvos_sim
// [aarch64_apple_tvos_sim] compile-flags: --target aarch64-apple-tvos-sim
// [aarch64_apple_tvos_sim] needs-llvm-components: aarch64
// revisions: aarch64_apple_watchos
// [aarch64_apple_watchos] compile-flags: --target aarch64-apple-watchos
// [aarch64_apple_watchos] needs-llvm-components: aarch64
// revisions: aarch64_apple_watchos_sim
// [aarch64_apple_watchos_sim] compile-flags: --target aarch64-apple-watchos-sim
// [aarch64_apple_watchos_sim] needs-llvm-components: aarch64
// revisions: aarch64_be_unknown_linux_gnu
// [aarch64_be_unknown_linux_gnu] compile-flags: --target aarch64_be-unknown-linux-gnu
// [aarch64_be_unknown_linux_gnu] needs-llvm-components: aarch64
Expand Down Expand Up @@ -93,15 69,6 @@
// revisions: aarch64_wrs_vxworks
// [aarch64_wrs_vxworks] compile-flags: --target aarch64-wrs-vxworks
// [aarch64_wrs_vxworks] needs-llvm-components: aarch64
// revisions: arm64_32_apple_watchos
// [arm64_32_apple_watchos] compile-flags: --target arm64_32-apple-watchos
// [arm64_32_apple_watchos] needs-llvm-components: aarch64
// revisions: arm64e_apple_darwin
// [arm64e_apple_darwin] compile-flags: --target arm64e-apple-darwin
// [arm64e_apple_darwin] needs-llvm-components: aarch64
// revisions: arm64e_apple_ios
// [arm64e_apple_ios] compile-flags: --target arm64e-apple-ios
// [arm64e_apple_ios] needs-llvm-components: aarch64
// revisions: arm_linux_androideabi
// [arm_linux_androideabi] compile-flags: --target arm-linux-androideabi
// [arm_linux_androideabi] needs-llvm-components: arm
Expand Down Expand Up @@ -201,18 168,12 @@
// revisions: armv7a_none_eabihf
// [armv7a_none_eabihf] compile-flags: --target armv7a-none-eabihf
// [armv7a_none_eabihf] needs-llvm-components: arm
// revisions: armv7k_apple_watchos
// [armv7k_apple_watchos] compile-flags: --target armv7k-apple-watchos
// [armv7k_apple_watchos] needs-llvm-components: arm
// revisions: armv7r_none_eabi
// [armv7r_none_eabi] compile-flags: --target armv7r-none-eabi
// [armv7r_none_eabi] needs-llvm-components: arm
// revisions: armv7r_none_eabihf
// [armv7r_none_eabihf] compile-flags: --target armv7r-none-eabihf
// [armv7r_none_eabihf] needs-llvm-components: arm
// revisions: armv7s_apple_ios
// [armv7s_apple_ios] compile-flags: --target armv7s-apple-ios
// [armv7s_apple_ios] needs-llvm-components: arm
// FIXME: disabled since it fails on CI saying the csky component is missing
/*
revisions: csky_unknown_linux_gnuabiv2
Expand All @@ -228,9 189,6 @@
// revisions: hexagon_unknown_none_elf
// [hexagon_unknown_none_elf] compile-flags: --target hexagon-unknown-none-elf
// [hexagon_unknown_none_elf] needs-llvm-components: hexagon
// revisions: i386_apple_ios
// [i386_apple_ios] compile-flags: --target i386-apple-ios
// [i386_apple_ios] needs-llvm-components: x86
// revisions: i586_pc_nto_qnx700
// [i586_pc_nto_qnx700] compile-flags: --target i586-pc-nto-qnx700
// [i586_pc_nto_qnx700] needs-llvm-components: x86
Expand All @@ -243,9 201,6 @@
// revisions: i586_unknown_netbsd
// [i586_unknown_netbsd] compile-flags: --target i586-unknown-netbsd
// [i586_unknown_netbsd] needs-llvm-components: x86
// revisions: i686_apple_darwin
// [i686_apple_darwin] compile-flags: --target i686-apple-darwin
// [i686_apple_darwin] needs-llvm-components: x86
// revisions: i686_linux_android
// [i686_linux_android] compile-flags: --target i686-linux-android
// [i686_linux_android] needs-llvm-components: x86
Expand Down Expand Up @@ -534,21 489,6 @@
// revisions: wasm64_unknown_unknown
// [wasm64_unknown_unknown] compile-flags: --target wasm64-unknown-unknown
// [wasm64_unknown_unknown] needs-llvm-components: webassembly
// revisions: x86_64_apple_darwin
// [x86_64_apple_darwin] compile-flags: --target x86_64-apple-darwin
// [x86_64_apple_darwin] needs-llvm-components: x86
// revisions: x86_64_apple_ios
// [x86_64_apple_ios] compile-flags: --target x86_64-apple-ios
// [x86_64_apple_ios] needs-llvm-components: x86
// revisions: x86_64_apple_ios_macabi
// [x86_64_apple_ios_macabi] compile-flags: --target x86_64-apple-ios-macabi
// [x86_64_apple_ios_macabi] needs-llvm-components: x86
// revisions: x86_64_apple_tvos
// [x86_64_apple_tvos] compile-flags: --target x86_64-apple-tvos
// [x86_64_apple_tvos] needs-llvm-components: x86
// revisions: x86_64_apple_watchos_sim
// [x86_64_apple_watchos_sim] compile-flags: --target x86_64-apple-watchos-sim
// [x86_64_apple_watchos_sim] needs-llvm-components: x86
// revisions: x86_64_fortanix_unknown_sgx
// [x86_64_fortanix_unknown_sgx] compile-flags: --target x86_64-fortanix-unknown-sgx
// [x86_64_fortanix_unknown_sgx] needs-llvm-components: x86
Expand Down Expand Up @@ -615,9 555,6 @@
// revisions: x86_64_wrs_vxworks
// [x86_64_wrs_vxworks] compile-flags: --target x86_64-wrs-vxworks
// [x86_64_wrs_vxworks] needs-llvm-components: x86
// revisions: x86_64h_apple_darwin
// [x86_64h_apple_darwin] compile-flags: --target x86_64h-apple-darwin
// [x86_64h_apple_darwin] needs-llvm-components: x86

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

Expand All @@ -633,4 570,4 @@ pub fn test() -> u8 {
42
}

// CHECK: .section
// CHECK: .text
81 changes: 81 additions & 0 deletions tests/assembly/targets/targets-macho.rs
Original file line number Diff line number Diff line change
@@ -0,0 1,81 @@
// assembly-output: emit-asm
// ignore-tidy-linelength
// revisions: aarch64_apple_darwin
// [aarch64_apple_darwin] compile-flags: --target aarch64-apple-darwin
// [aarch64_apple_darwin] needs-llvm-components: aarch64
// revisions: aarch64_apple_ios
// [aarch64_apple_ios] compile-flags: --target aarch64-apple-ios
// [aarch64_apple_ios] needs-llvm-components: aarch64
// revisions: aarch64_apple_ios_macabi
// [aarch64_apple_ios_macabi] compile-flags: --target aarch64-apple-ios-macabi
// [aarch64_apple_ios_macabi] needs-llvm-components: aarch64
// revisions: aarch64_apple_ios_sim
// [aarch64_apple_ios_sim] compile-flags: --target aarch64-apple-ios-sim
// [aarch64_apple_ios_sim] needs-llvm-components: aarch64
// revisions: aarch64_apple_tvos
// [aarch64_apple_tvos] compile-flags: --target aarch64-apple-tvos
// [aarch64_apple_tvos] needs-llvm-components: aarch64
// revisions: aarch64_apple_tvos_sim
// [aarch64_apple_tvos_sim] compile-flags: --target aarch64-apple-tvos-sim
// [aarch64_apple_tvos_sim] needs-llvm-components: aarch64
// revisions: aarch64_apple_watchos
// [aarch64_apple_watchos] compile-flags: --target aarch64-apple-watchos
// [aarch64_apple_watchos] needs-llvm-components: aarch64
// revisions: aarch64_apple_watchos_sim
// [aarch64_apple_watchos_sim] compile-flags: --target aarch64-apple-watchos-sim
// [aarch64_apple_watchos_sim] needs-llvm-components: aarch64
// revisions: arm64_32_apple_watchos
// [arm64_32_apple_watchos] compile-flags: --target arm64_32-apple-watchos
// [arm64_32_apple_watchos] needs-llvm-components: aarch64
// revisions: arm64e_apple_darwin
// [arm64e_apple_darwin] compile-flags: --target arm64e-apple-darwin
// [arm64e_apple_darwin] needs-llvm-components: aarch64
// revisions: arm64e_apple_ios
// [arm64e_apple_ios] compile-flags: --target arm64e-apple-ios
// [arm64e_apple_ios] needs-llvm-components: aarch64
// revisions: armv7k_apple_watchos
// [armv7k_apple_watchos] compile-flags: --target armv7k-apple-watchos
// [armv7k_apple_watchos] needs-llvm-components: arm
// revisions: armv7s_apple_ios
// [armv7s_apple_ios] compile-flags: --target armv7s-apple-ios
// [armv7s_apple_ios] needs-llvm-components: arm
// revisions: i386_apple_ios
// [i386_apple_ios] compile-flags: --target i386-apple-ios
// [i386_apple_ios] needs-llvm-components: x86
// revisions: i686_apple_darwin
// [i686_apple_darwin] compile-flags: --target i686-apple-darwin
// [i686_apple_darwin] needs-llvm-components: x86
// revisions: x86_64_apple_darwin
// [x86_64_apple_darwin] compile-flags: --target x86_64-apple-darwin
// [x86_64_apple_darwin] needs-llvm-components: x86
// revisions: x86_64_apple_ios
// [x86_64_apple_ios] compile-flags: --target x86_64-apple-ios
// [x86_64_apple_ios] needs-llvm-components: x86
// revisions: x86_64_apple_ios_macabi
// [x86_64_apple_ios_macabi] compile-flags: --target x86_64-apple-ios-macabi
// [x86_64_apple_ios_macabi] needs-llvm-components: x86
// revisions: x86_64_apple_tvos
// [x86_64_apple_tvos] compile-flags: --target x86_64-apple-tvos
// [x86_64_apple_tvos] needs-llvm-components: x86
// revisions: x86_64_apple_watchos_sim
// [x86_64_apple_watchos_sim] compile-flags: --target x86_64-apple-watchos-sim
// [x86_64_apple_watchos_sim] needs-llvm-components: x86
// revisions: x86_64h_apple_darwin
// [x86_64h_apple_darwin] compile-flags: --target x86_64h-apple-darwin
// [x86_64h_apple_darwin] needs-llvm-components: x86

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

#![feature(no_core, lang_items)]
#![no_std]
#![no_core]
#![crate_type = "lib"]

#[lang = "sized"]
trait Sized {}

pub fn test() -> u8 {
42
}

// CHECK: .section __TEXT,__text

0 comments on commit dceb83c

Please sign in to comment.