Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit844c7e8

Browse files
Rollup merge of#125047 - Oneirical:test5, r=jieyouxu
Migrate `run-make/issue-14500` to new `rmake.rs` formatPart of#121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html).Note: I find suspicious that `libbar.a` is hardcoded and is not using the `STATICLIB` call to adapt to Windows platforms. Is this intentional? If not, this will need to be changed.
2 parents0458d8a +45b50d3 commit844c7e8

File tree

7 files changed

+39
-16
lines changed

7 files changed

+39
-16
lines changed

‎src/tools/run-make-support/src/rustc.rs‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,19 @@ impl Rustc {
150150
self
151151
}
152152

153+
/// Enables link time optimizations in rustc. Equivalent to `-Clto``.
154+
pubfnlto(&mutself) ->&mutSelf{
155+
self.cmd.arg("-Clto");
156+
self
157+
}
158+
159+
/// Add a directory to the library search path.
160+
pubfnlibrary_search_path<P:AsRef<Path>>(&mutself,path:P) ->&mutSelf{
161+
self.cmd.arg("-L");
162+
self.cmd.arg(path.as_ref());
163+
self
164+
}
165+
153166
/// Specify the edition year.
154167
pubfnedition(&mutself,edition:&str) ->&mutSelf{
155168
self.cmd.arg("--edition");

‎src/tools/tidy/src/allowed_run_make_makefiles.txt‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ run-make/issue-107094/Makefile
9595
run-make/issue-10971-temps-dir/Makefile
9696
run-make/issue-109934-lto-debuginfo/Makefile
9797
run-make/issue-11908/Makefile
98-
run-make/issue-14500/Makefile
9998
run-make/issue-14698/Makefile
10099
run-make/issue-15460/Makefile
101100
run-make/issue-18943/Makefile

‎tests/run-make/issue-14500/Makefile‎

Lines changed: 0 additions & 15 deletions
This file was deleted.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Test to make sure that reachable extern fns are always available in final
2+
// productcs, including when link time optimizations (LTO) are used.
3+
4+
// In this test, the `foo` crate has a reahable symbol,
5+
// and is a dependency of the `bar` crate. When the `bar` crate
6+
// is compiled with LTO, it shouldn't strip the symbol from `foo`, and that's the
7+
// only way that `foo.c` will successfully compile.
8+
// See https://github.com/rust-lang/rust/issues/14500
9+
10+
//@ ignore-cross-compile
11+
12+
use run_make_support::{cc, extra_c_flags, run, rustc, static_lib, tmp_dir};
13+
14+
fnmain(){
15+
let libbar_path =static_lib("bar");
16+
rustc().input("foo.rs").crate_type("rlib").run();
17+
rustc()
18+
.input("bar.rs")
19+
.crate_type("staticlib")
20+
.lto()
21+
.library_search_path(".")
22+
.output(&libbar_path)
23+
.run();
24+
cc().input("foo.c").input(libbar_path).args(&extra_c_flags()).out_exe("foo").run();
25+
run("foo");
26+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp