-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This flag allows specifying the threshold size above which LLVM should consider placing small objects in a .sdata or .sbss section.
- Loading branch information
1 parent
b66fe58
commit 27b2be8
Showing
4 changed files
with
73 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// Test for -Z small_data_threshold=... | ||
// revisions: RISCV MIPS HEXAGON M68K | ||
// 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 | ||
// [HEXAGON] compile-flags:--target=hexagon-unknown-linux-musl | ||
// [M68K] compile-flags:--target=m68k-unknown-linux-gnu | ||
|
||
#![feature(no_core, lang_items)] | ||
#![no_std] | ||
#![no_core] | ||
#![crate_type = "lib"] | ||
|
||
#[lang = "sized"] | ||
trait Sized {} | ||
|
||
#[lang = "drop_in_place"] | ||
fn drop_in_place<T>(_: *mut T) {} | ||
|
||
#[used] | ||
#[no_mangle] | ||
/// X is below the threshold, should be in sdata | ||
static mut X: u16 = 123; | ||
|
||
#[used] | ||
#[no_mangle] | ||
/// Y is at the threshold, should be in sdata | ||
static mut Y: u32 = 123; | ||
|
||
#[used] | ||
#[no_mangle] | ||
/// Z is over the threshold, should be in its own section | ||
static mut Z: u64 = 123; | ||
|
||
// Currently, only RISCV successfully puts any objects in the small data | ||
// section. | ||
|
||
// RISCV: .section .sdata, | ||
// RISCV-NOT: .section | ||
// RISCV: X: | ||
// RISCV: Y: | ||
// CHECK: .section .data.Z, | ||
// CHECK-NOT: .section | ||
// CHECK: Z: |