Skip to content

Commit d4e5426

Browse files
committed
rewrite and rename issue-24445 to rmake
1 parent c24d1c7 commit d4e5426

File tree

6 files changed

+44
-12
lines changed

6 files changed

+44
-12
lines changed

src/tools/run-make-support/src/cc.rs

+8
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,14 @@ impl Cc {
4545
self
4646
}
4747

48+
/// Adds directories to the list that the linker searches for libraries.
49+
/// Equivalent to `-L`.
50+
pub fn library_search_path<P: AsRef<Path>>(&mut self, path: P) -> &mut Self {
51+
self.cmd.arg("-L");
52+
self.cmd.arg(path.as_ref());
53+
self
54+
}
55+
4856
/// Specify `-o` or `-Fe`/`-Fo` depending on platform/compiler. This assumes that the executable
4957
/// is under `$TMPDIR`.
5058
pub fn out_exe(&mut self, name: &str) -> &mut Self {

src/tools/tidy/src/allowed_run_make_makefiles.txt

-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ run-make/issue-15460/Makefile
9797
run-make/issue-18943/Makefile
9898
run-make/issue-20626/Makefile
9999
run-make/issue-22131/Makefile
100-
run-make/issue-24445/Makefile
101100
run-make/issue-25581/Makefile
102101
run-make/issue-26006/Makefile
103102
run-make/issue-26092/Makefile

tests/run-make/issue-24445/Makefile

-11
This file was deleted.
File renamed without changes.
File renamed without changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// It was once required to use a position-independent executable (PIE)
2+
// in order to use the thread_local! macro, or some symbols would contain
3+
// a NULL address. This was fixed, and this test checks a non-PIE, then a PIE
4+
// build to see if this bug makes a resurgence.
5+
// See https://github.com/rust-lang/rust/pull/24448
6+
7+
//@ ignore-cross compile
8+
//@ only-linux
9+
10+
use run_make_support::{cc, run, rustc, tmp_dir};
11+
12+
fn main() {
13+
rustc().input("foo.rs").run();
14+
cc().input("foo.c")
15+
.arg("-lfoo")
16+
.library_search_path(tmp_dir())
17+
.arg("-Wl")
18+
.arg("--gc-sections")
19+
.arg("-lpthread")
20+
.arg("-ldl")
21+
.out_exe(tmp_dir().join("foo"))
22+
.run();
23+
run("foo");
24+
cc().input("foo.c")
25+
.arg("-lfoo")
26+
.library_search_path(tmp_dir())
27+
.arg("-Wl")
28+
.arg("--gc-sections")
29+
.arg("-lpthread")
30+
.arg("-ldl")
31+
.arg("-pie")
32+
.arg("-fPIC")
33+
.out_exe(tmp_dir().join("foo"))
34+
.run();
35+
run("foo");
36+
}

0 commit comments

Comments
 (0)