Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: rust-lang/rust
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 42150ae948a6b78dfe8ff3a2abd60f56c6606049
Choose a base ref
..
head repository: rust-lang/rust
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 54eada24414152db2cbafeefab4446cabe0fd3d9
Choose a head ref
Showing with 26 additions and 9 deletions.
  1. +26 −9 tests/assembly/small_data_threshold.rs
35 changes: 26 additions & 9 deletions tests/assembly/small_data_threshold.rs
Original file line number Diff line number Diff line change
@@ -3,8 +3,10 @@
// assembly-output: emit-asm
// compile-flags: -Z small_data_threshold=4
// [RISCV] compile-flags:--target=riscv32im-unknown-none-elf
// [MIPS] compile-flags:--target=mips-unknown-linux-musl -C llvm-args=-relocation-model=static -C llvm-args=-membedded-data -C llvm-args=-mgpopt -C llvm-args=-target-abi=n64
// [HEXAGON] compile-flags:--target=hexagon-unknown-linux-musl -C target-feature=+small-data -C llvm-args=--hexagon-statics-in-small-data
// [MIPS] compile-flags:--target=mips-unknown-linux-uclibc -C relocation-model=static
// [MIPS] compile-flags:-C llvm-args=-mgpopt -C llvm-args=-mlocal-sdata -C target-feature=+noabicalls
// [HEXAGON] compile-flags:--target=hexagon-unknown-linux-musl -C target-feature=+small-data
// [HEXAGON] compile-flags:-C llvm-args=--hexagon-statics-in-small-data
// [M68K] compile-flags:--target=m68k-unknown-linux-gnu

#![feature(no_core, lang_items)]
@@ -21,35 +23,36 @@ fn drop_in_place<T>(_: *mut T) {}
#[used]
#[no_mangle]
// U is below the threshold, should be in sdata
pub static mut U: u16 = 123;
static mut U: u16 = 123;

#[used]
#[no_mangle]
// V is below the threshold, should be in sbss
pub static mut V: u16 = 0;
static mut V: u16 = 0;

#[used]
#[no_mangle]
// W is at the threshold, should be in sdata
pub static mut W: u32 = 123;
static mut W: u32 = 123;

#[used]
#[no_mangle]
// X is at the threshold, should be in sbss
pub static mut X: u32 = 0;
static mut X: u32 = 0;

#[used]
#[no_mangle]
// Y is over the threshold, should be in its own .data section
pub static mut Y: u64 = 123;
static mut Y: u64 = 123;

#[used]
#[no_mangle]
/// Z is over the threshold, should be in its own .bss section
pub static mut Z: u64 = 0;
static mut Z: u64 = 0;

// Currently, only RISCV successfully puts any objects in the small data
// Currently, only MIPS and RISCV successfully put any objects in the small data
// sections so the U/V/W/X tests are skipped on MIPS/Hexagon/M68K

// RISCV: .section .sdata,
// RISCV-NOT: .section
// RISCV: U:
@@ -62,6 +65,20 @@ pub static mut Z: u64 = 0;
// RISCV: .section .sbss
// RISV-NOT: .section
// RISCV: X:

// MIPS: .section .sdata,
// MIPS-NOT: .section
// MIPS: U:
// MIPS: .section .sbss
// RISV-NOT: .section
// MIPS: V:
// MIPS .section .sdata
// RISV-NOT: .section
// MIPS: W:
// MIPS: .section .sbss
// RISV-NOT: .section
// MIPS: X:

// CHECK: .section .data.Y,
// CHECK-NOT: .section
// CHECK: Y: