Skip to content

Commit

Permalink
Unrolled build for rust-lang#127787
Browse files Browse the repository at this point in the history
Rollup merge of rust-lang#127787 - Rejyr:migrate-atomic-lock-free-rmake, r=jieyouxu

Migrate `atomic-lock-free` to `rmake`

Also adds `llvm_components_contain` to `run-make-support`.

Part of rust-lang#121876.

r? ``@jieyouxu``

try-job: dist-x86_64-linux
  • Loading branch information
rust-timer committed Jul 18, 2024
2 parents 4bb2f27 + a8b6e3f commit 238f4d7
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 50 deletions.
2 changes: 1 addition & 1 deletion src/tools/run-make-support/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ pub use env::{env_var, env_var_os};
pub use run::{cmd, run, run_fail, run_with_args};

/// Helpers for checking target information.
pub use targets::{is_darwin, is_msvc, is_windows, target, uname};
pub use targets::{is_darwin, is_msvc, is_windows, llvm_components_contain, target, uname};

/// Helpers for building names of output artifacts that are potentially target-specific.
pub use artifact_names::{
Expand Down
7 changes: 7 additions & 0 deletions src/tools/run-make-support/src/targets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ pub fn is_darwin() -> bool {
target().contains("darwin")
}

/// Check if `component` is within `LLVM_COMPONENTS`
#[must_use]
pub fn llvm_components_contain(component: &str) -> bool {
// `LLVM_COMPONENTS` is a space-separated list of words
env_var("LLVM_COMPONENTS").split_whitespace().find(|s| s == &component).is_some()
}

/// Run `uname`. This assumes that `uname` is available on the platform!
#[track_caller]
#[must_use]
Expand Down
1 change: 0 additions & 1 deletion src/tools/tidy/src/allowed_run_make_makefiles.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
run-make/archive-duplicate-names/Makefile
run-make/atomic-lock-free/Makefile
run-make/branch-protection-check-IBT/Makefile
run-make/c-dynamic-dylib/Makefile
run-make/c-dynamic-rlib/Makefile
Expand Down
48 changes: 0 additions & 48 deletions tests/run-make/atomic-lock-free/Makefile

This file was deleted.

52 changes: 52 additions & 0 deletions tests/run-make/atomic-lock-free/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// This tests ensure that atomic types are never lowered into runtime library calls that are not
// guaranteed to be lock-free.

//@ only-linux

use run_make_support::{llvm_components_contain, llvm_readobj, rustc};

fn compile(target: &str) {
rustc().input("atomic_lock_free.rs").target(target).run();
}

fn check() {
llvm_readobj()
.symbols()
.input("libatomic_lock_free.rlib")
.run()
.assert_stdout_not_contains("__atomic_fetch_add");
}

fn compile_and_check(target: &str) {
compile(target);
check();
}

fn main() {
if llvm_components_contain("x86") {
compile_and_check("i686-unknown-linux-gnu");
compile_and_check("x86_64-unknown-linux-gnu");
}
if llvm_components_contain("arm") {
compile_and_check("arm-unknown-linux-gnueabi");
compile_and_check("arm-unknown-linux-gnueabihf");
compile_and_check("armv7-unknown-linux-gnueabihf");
compile_and_check("thumbv7neon-unknown-linux-gnueabihf");
}
if llvm_components_contain("aarch64") {
compile_and_check("aarch64-unknown-linux-gnu");
}
if llvm_components_contain("mips") {
compile_and_check("mips-unknown-linux-gnu");
compile_and_check("mipsel-unknown-linux-gnu");
}
if llvm_components_contain("powerpc") {
compile_and_check("powerpc-unknown-linux-gnu");
compile_and_check("powerpc-unknown-linux-gnuspe");
compile_and_check("powerpc64-unknown-linux-gnu");
compile_and_check("powerpc64le-unknown-linux-gnu");
}
if llvm_components_contain("systemz") {
compile_and_check("s390x-unknown-linux-gnu");
}
}

0 comments on commit 238f4d7

Please sign in to comment.