summary refs log tree commit diff
path: root/tests/run-make/export-executable-symbols/rmake.rs
blob: 884c7362822f748bd4a158ea2f07d03284aae887 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// 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

//@ only-unix
// Reason: the export-executable-symbols flag only works on Unix
// due to hardcoded platform-specific implementation
// (See #85673)
//@ ignore-cross-compile
//@ ignore-wasm

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");
}