Skip to content

Commit

Permalink
rewrite export-executable-symbols to rmake
Browse files Browse the repository at this point in the history
  • Loading branch information
Oneirical committed Jul 22, 2024
1 parent 639b56c commit 0d27c7b
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 15 deletions.
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
Expand Up @@ -13,7 +13,6 @@ run-make/dep-info-spaces/Makefile
run-make/dep-info/Makefile
run-make/dump-ice-to-disk/Makefile
run-make/emit-to-stdout/Makefile
run-make/export-executable-symbols/Makefile
run-make/extern-diff-internal-name/Makefile
run-make/extern-flag-disambiguates/Makefile
run-make/extern-fn-reachable/Makefile
Expand Down
6 changes: 3 additions & 3 deletions tests/run-make/c-unwind-abi-catch-lib-panic/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
//@ needs-unwind
// Reason: this test exercises unwinding a panic

use run_make_support::{cc, is_msvc, llvm_ar, run, rustc};
use run_make_support::{cc, is_msvc, llvm_ar, run, rustc, static_lib_name};

fn main() {
// Compile `add.c` into an object file.
Expand All @@ -25,9 +25,9 @@ fn main() {

// Now, create an archive using these two objects.
if is_msvc() {
llvm_ar().obj_to_ar().args(&["libadd.a", "add.obj", "panic.o"]).run();
llvm_ar().obj_to_ar().args(&[&static_lib_name("add"), "add.obj", "panic.o"]).run();
} else {
llvm_ar().obj_to_ar().args(&["libadd.a", "add.o", "panic.o"]).run();
llvm_ar().obj_to_ar().args(&[&static_lib_name("add"), "add.o", "panic.o"]).run();
};

// Compile `main.rs`, which will link into our library, and run it.
Expand Down
11 changes: 0 additions & 11 deletions tests/run-make/export-executable-symbols/Makefile

This file was deleted.

22 changes: 22 additions & 0 deletions tests/run-make/export-executable-symbols/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// The unstable flag `-Z export-executable-symbols` exports symbols from executables, as if
// they were dynamic libraries. This test is a simple smoke test to check that this feature
// works by using it in compilation, then checking that the output binary contains the exported
// symbol.
// See https://github.com/rust-lang/rust/pull/85673

//@ ignore-wasm32
//@ ignore-wasm64
//@ ignore-none
// Reason: no-std is not supported
//FIXME(Oneirical): try it on more than only-linux

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

fn main() {
rustc().arg("-Zexport-executable-symbols").input("main.rs").crate_type("bin").run();
llvm_readobj()
.symbols()
.input(bin_name("main"))
.run()
.assert_stdout_contains("exported_symbol");
}

0 comments on commit 0d27c7b

Please sign in to comment.