forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrmake.rs
34 lines (31 loc) · 953 Bytes
/
rmake.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// 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
//@ ignore-cross-compile
//@ only-linux
use run_make_support::{cc, run, rustc, tmp_dir};
fn main() {
rustc().input("foo.rs").run();
cc().input("foo.c")
.arg("-lfoo")
.library_search_path(tmp_dir())
.arg("-Wl,--gc-sections")
.arg("-lpthread")
.arg("-ldl")
.out_exe("foo")
.run();
run("foo");
cc().input("foo.c")
.arg("-lfoo")
.library_search_path(tmp_dir())
.arg("-Wl,--gc-sections")
.arg("-lpthread")
.arg("-ldl")
.arg("-pie")
.arg("-fPIC")
.out_exe("foo")
.run();
run("foo");
}