mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 14:55:26 +00:00
rewrite and rename issue-24445
to rmake
This commit is contained in:
parent
c24d1c7ff8
commit
d4e5426256
@ -45,6 +45,14 @@ impl Cc {
|
||||
self
|
||||
}
|
||||
|
||||
/// Adds directories to the list that the linker searches for libraries.
|
||||
/// Equivalent to `-L`.
|
||||
pub fn library_search_path<P: AsRef<Path>>(&mut self, path: P) -> &mut Self {
|
||||
self.cmd.arg("-L");
|
||||
self.cmd.arg(path.as_ref());
|
||||
self
|
||||
}
|
||||
|
||||
/// Specify `-o` or `-Fe`/`-Fo` depending on platform/compiler. This assumes that the executable
|
||||
/// is under `$TMPDIR`.
|
||||
pub fn out_exe(&mut self, name: &str) -> &mut Self {
|
||||
|
@ -97,7 +97,6 @@ run-make/issue-15460/Makefile
|
||||
run-make/issue-18943/Makefile
|
||||
run-make/issue-20626/Makefile
|
||||
run-make/issue-22131/Makefile
|
||||
run-make/issue-24445/Makefile
|
||||
run-make/issue-25581/Makefile
|
||||
run-make/issue-26006/Makefile
|
||||
run-make/issue-26092/Makefile
|
||||
|
@ -1,11 +0,0 @@
|
||||
# ignore-cross-compile
|
||||
include ../tools.mk
|
||||
|
||||
# only-linux
|
||||
|
||||
all:
|
||||
$(RUSTC) foo.rs
|
||||
$(CC) foo.c -lfoo -L $(TMPDIR) -Wl,--gc-sections -lpthread -ldl -o $(TMPDIR)/foo
|
||||
$(call RUN,foo)
|
||||
$(CC) foo.c -lfoo -L $(TMPDIR) -Wl,--gc-sections -lpthread -ldl -pie -fPIC -o $(TMPDIR)/foo
|
||||
$(call RUN,foo)
|
36
tests/run-make/non-pie-thread-local/rmake.rs
Normal file
36
tests/run-make/non-pie-thread-local/rmake.rs
Normal file
@ -0,0 +1,36 @@
|
||||
// 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")
|
||||
.arg("--gc-sections")
|
||||
.arg("-lpthread")
|
||||
.arg("-ldl")
|
||||
.out_exe(tmp_dir().join("foo"))
|
||||
.run();
|
||||
run("foo");
|
||||
cc().input("foo.c")
|
||||
.arg("-lfoo")
|
||||
.library_search_path(tmp_dir())
|
||||
.arg("-Wl")
|
||||
.arg("--gc-sections")
|
||||
.arg("-lpthread")
|
||||
.arg("-ldl")
|
||||
.arg("-pie")
|
||||
.arg("-fPIC")
|
||||
.out_exe(tmp_dir().join("foo"))
|
||||
.run();
|
||||
run("foo");
|
||||
}
|
Loading…
Reference in New Issue
Block a user