Skip to content

Commit 330a164

Browse files
committed
Migrate issue-68794-textrel-on-minimal-lib to rmake
1 parent ca52afa commit 330a164

File tree

3 files changed

+43
-19
lines changed

3 files changed

+43
-19
lines changed

src/tools/tidy/src/allowed_run_make_makefiles.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ run-make/issue-37839/Makefile
8282
run-make/issue-40535/Makefile
8383
run-make/issue-47384/Makefile
8484
run-make/issue-47551/Makefile
85-
run-make/issue-68794-textrel-on-minimal-lib/Makefile
8685
run-make/issue-69368/Makefile
8786
run-make/issue-83045/Makefile
8887
run-make/issue-83112-incr-test-moved-file/Makefile

tests/run-make/issue-68794-textrel-on-minimal-lib/Makefile

Lines changed: 0 additions & 18 deletions
This file was deleted.
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// Regression test for issue #68794
2+
//
3+
// Verify that no text relocations are accidentally introduced by linking a
4+
// minimal rust staticlib.
5+
//
6+
// The test links a rust static library into a shared library, and checks that
7+
// the linker doesn't have to flag the resulting file as containing TEXTRELs.
8+
9+
//@ only-linux
10+
//@ ignore-cross-compile
11+
12+
use std::env;
13+
14+
use run_make_support::cc;
15+
use run_make_support::llvm_readobj;
16+
use run_make_support::rustc;
17+
use run_make_support::{dynamic_lib_name, static_lib_name};
18+
19+
fn main() {
20+
let mut extra_flags = vec![];
21+
if let Ok(extracflags) = env::var("EXTRACFLAGS") {
22+
extra_flags.push(extracflags);
23+
}
24+
if let Ok(extracxxflags) = env::var("EXTRACXXFLAGS") {
25+
extra_flags.push(extracxxflags);
26+
}
27+
28+
rustc().input("foo.rs").run();
29+
30+
cc().input("bar.c")
31+
.arg(static_lib_name("foo"))
32+
.arg("-fPIC")
33+
.arg("-shared")
34+
.args(&extra_flags)
35+
.output(dynamic_lib_name("bar"))
36+
.run();
37+
38+
llvm_readobj()
39+
.dynamic_table()
40+
.input(dynamic_lib_name("bar"))
41+
.run()
42+
.assert_stdout_not_contains("TEXTREL");
43+
}

0 commit comments

Comments
 (0)