File tree Expand file tree Collapse file tree 4 files changed +23
-12
lines changed
lto-avoid-object-duplication Expand file tree Collapse file tree 4 files changed +23
-12
lines changed Original file line number Diff line number Diff line change @@ -146,7 +146,6 @@ run-make/native-link-modifier-verbatim-rustc/Makefile
146146run-make/native-link-modifier-whole-archive/Makefile
147147run-make/no-alloc-shim/Makefile
148148run-make/no-builtins-attribute/Makefile
149- run-make/no-builtins-lto/Makefile
150149run-make/no-duplicate-libs/Makefile
151150run-make/obey-crate-type-flag/Makefile
152151run-make/optimization-remarks-dir-pgo/Makefile
Original file line number Diff line number Diff line change 1+ // ignore-tidy-tab
12// Staticlibs don't include Rust object files from upstream crates if the same
23// code was already pulled into the lib via LTO. However, the bug described in
34// https://github.com/rust-lang/rust/issues/64153 lead to this exclusion not
78// This test makes sure that functions defined in the upstream crates do not
89// appear twice in the final staticlib when listing all the symbols from it.
910
10- //@ ignore-windows
11+ //FIXME(Oneirical): temporarily remove ignorewindows
1112// Reason: `llvm-objdump`'s output looks different on windows than on other platforms.
1213// Only checking on Unix platforms should suffice.
1314
@@ -28,7 +29,7 @@ fn main() {
2829 . codegen_units ( 1 )
2930 . run ( ) ;
3031 let syms = llvm_objdump ( ) . arg ( "-t" ) . input ( static_lib_name ( "downstream" ) ) . run ( ) . stdout_utf8 ( ) ;
31- let re = regex:: Regex :: new ( r#"(?m) \s*g\s*F\s.*issue64153_test_function"# ) . unwrap ( ) ;
32+ let re = regex:: Regex :: new ( r#"\s*g\s*F\s.*issue64153_test_function"# ) . unwrap ( ) ;
3233 // Count the global instances of `issue64153_test_function`. There'll be 2
3334 // if the `upstream` object file got erroneously included twice.
3435 // The line we are testing for with the regex looks something like:
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ // The rlib produced by a no_builtins crate should be explicitely linked
2+ // during compilation, and as a result be present in the linker arguments.
3+ // See the comments inside this file for more details.
4+ // See https://github.com/rust-lang/rust/pull/35637
5+
6+ use run_make_support:: { rust_lib_name, rustc} ;
7+
8+ fn main ( ) {
9+ // Compile a `#![no_builtins]` rlib crate
10+ rustc ( ) . input ( "no_builtins.rs" ) . run ( ) ;
11+ // Build an executable that depends on that crate using LTO. The no_builtins crate doesn't
12+ // participate in LTO, so its rlib must be explicitly
13+ // linked into the final binary. Verify this by grepping the linker arguments.
14+ rustc ( )
15+ . input ( "main.rs" )
16+ . arg ( "-Clto" )
17+ . print ( "link-args" )
18+ . run ( )
19+ . assert_stdout_contains ( rust_lib_name ( "no_builtins" ) ) ;
20+ }
You can’t perform that action at this time.
0 commit comments