File tree 3 files changed +54
-0
lines changed
src/test/run-make-fulldeps/cross-lang-lto-upstream-rlibs
3 files changed +54
-0
lines changed Original file line number Diff line number Diff line change
1
+
2
+ -include ../tools.mk
3
+
4
+ # This test makes sure that we don't loose upstream object files when compiling
5
+ # staticlibs with -Zcross-lang-lto
6
+
7
+ all : staticlib.rs upstream.rs
8
+ $(RUSTC ) upstream.rs -Z cross-lang-lto -Ccodegen-units=1
9
+
10
+ # Check No LTO
11
+ $(RUSTC) staticlib.rs -Z cross-lang-lto -Ccodegen-units=1 -L. -o $(TMPDIR)/staticlib.a
12
+ (cd $(TMPDIR); llvm-ar x ./staticlib.a)
13
+ # Make sure the upstream object file was included
14
+ ls upstream.*.rcgu.o
15
+
16
+ # Cleanup
17
+ rm $(TMPDIR)/*
18
+
19
+ # Check ThinLTO
20
+ $(RUSTC) upstream.rs -Z cross-lang-lto -Ccodegen-units=1 -Clto=thin
21
+ $(RUSTC) staticlib.rs -Z cross-lang-lto -Ccodegen-units=1 -Clto=thin -L. -o $(TMPDIR)/staticlib.a
22
+ (cd $(TMPDIR); llvm-ar x ./staticlib.a)
23
+ ls upstream.*.rcgu.o
Original file line number Diff line number Diff line change
1
+ // Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2
+ // file at the top-level directory of this distribution and at
3
+ // http://rust-lang.org/COPYRIGHT.
4
+ //
5
+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6
+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7
+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8
+ // option. This file may not be copied, modified, or distributed
9
+ // except according to those terms.
10
+
11
+ #![ crate_type="staticlib" ]
12
+
13
+ extern crate upstream;
14
+
15
+ #[ no_mangle]
16
+ pub extern fn bar ( ) {
17
+ upstream:: foo ( ) ;
18
+ }
Original file line number Diff line number Diff line change
1
+ // Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2
+ // file at the top-level directory of this distribution and at
3
+ // http://rust-lang.org/COPYRIGHT.
4
+ //
5
+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6
+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7
+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8
+ // option. This file may not be copied, modified, or distributed
9
+ // except according to those terms.
10
+
11
+ #![ crate_type = "rlib" ]
12
+
13
+ pub fn foo ( ) { }
You can’t perform that action at this time.
0 commit comments