-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
42 additions
and
24 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 was deleted.
Oops, something went wrong.
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,27 @@ | ||
// This tests ensure that global variables respect the target minimum alignment. | ||
// The three bools `STATIC_BOOL`, `STATIC_MUT_BOOL`, and `CONST_BOOL` all have | ||
// type-alignment of 1, but some targets require greater global alignment. | ||
// See https://github.com/rust-lang/rust/pull/44440 | ||
|
||
//@ only-linux | ||
// Reason: this test is target-independent, considering compilation is targeted | ||
// towards linux architectures only. | ||
|
||
use run_make_support::{assert_count_is, llvm_components_contain, rfs, rustc}; | ||
|
||
fn main() { | ||
// Most targets are happy with default alignment -- take i686 for example. | ||
if llvm_components_contain("x86") { | ||
rustc().target("i686-unknown-linux-gnu").emit("llvm-ir").input("min_global_align.rs").run(); | ||
assert_count_is(3, rfs::read_to_string("min_global_align.ll"), "align 1"); | ||
} | ||
// SystemZ requires even alignment for PC-relative addressing. | ||
if llvm_components_contain("systemz") { | ||
rustc() | ||
.target("s390x-unknown-linux-gnu") | ||
.emit("llvm-ir") | ||
.input("min_global_align.rs") | ||
.run(); | ||
assert_count_is(3, rfs::read_to_string("min_global_align.ll"), "align 2"); | ||
} | ||
} |