2024-05-22 14:25:43 -05:00
|
|
|
// It was once required to use a position-independent executable (PIE)
|
|
|
|
// in order to use the thread_local! macro, or some symbols would contain
|
|
|
|
// a NULL address. This was fixed, and this test checks a non-PIE, then a PIE
|
|
|
|
// build to see if this bug makes a resurgence.
|
|
|
|
// See https://github.com/rust-lang/rust/pull/24448
|
|
|
|
|
2024-05-22 14:55:02 -05:00
|
|
|
//@ ignore-cross-compile
|
2024-05-22 14:25:43 -05:00
|
|
|
//@ only-linux
|
|
|
|
|
2024-06-06 14:34:34 -05:00
|
|
|
use run_make_support::{cc, cwd, run, rustc};
|
2024-05-22 14:25:43 -05:00
|
|
|
|
|
|
|
fn main() {
|
|
|
|
rustc().input("foo.rs").run();
|
|
|
|
cc().input("foo.c")
|
|
|
|
.arg("-lfoo")
|
2024-06-06 14:34:34 -05:00
|
|
|
.library_search_path(cwd())
|
2024-05-22 14:55:02 -05:00
|
|
|
.arg("-Wl,--gc-sections")
|
2024-05-22 14:25:43 -05:00
|
|
|
.arg("-lpthread")
|
|
|
|
.arg("-ldl")
|
2024-05-22 14:55:02 -05:00
|
|
|
.out_exe("foo")
|
2024-05-22 14:25:43 -05:00
|
|
|
.run();
|
|
|
|
run("foo");
|
|
|
|
cc().input("foo.c")
|
|
|
|
.arg("-lfoo")
|
2024-06-06 14:34:34 -05:00
|
|
|
.library_search_path(cwd())
|
2024-05-22 14:55:02 -05:00
|
|
|
.arg("-Wl,--gc-sections")
|
2024-05-22 14:25:43 -05:00
|
|
|
.arg("-lpthread")
|
|
|
|
.arg("-ldl")
|
|
|
|
.arg("-pie")
|
|
|
|
.arg("-fPIC")
|
2024-05-22 14:55:02 -05:00
|
|
|
.out_exe("foo")
|
2024-05-22 14:25:43 -05:00
|
|
|
.run();
|
|
|
|
run("foo");
|
|
|
|
}
|