about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-08-01 11:38:20 +0000
committerbors <bors@rust-lang.org>2018-08-01 11:38:20 +0000
commit11f812aa7d1df09724f94c2b095f6dbfd367da17 (patch)
tree680776e9ca053a1b6c79a84093473edf4f439ec7 /src/test
parent8c069ceba81a0fffc1ce95aaf7e8339e11bf2796 (diff)
parentf0bceba669159f7bac581d03412cf69ce4558685 (diff)
Auto merge of #52474 - alexcrichton:better-lto-error, r=eddyb
rustc: Handle linker diagnostics from LLVM

Previously linker diagnostic were being hidden when two modules were linked
together but failed to link. This commit fixes the situation by ensuring that we
have a diagnostic handler installed and also adds support for handling linker
diagnostics.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/compile-fail/auxiliary/lto-duplicate-symbols1.rs16
-rw-r--r--src/test/compile-fail/auxiliary/lto-duplicate-symbols2.rs16
-rw-r--r--src/test/compile-fail/lto-duplicate-symbols.rs20
3 files changed, 52 insertions, 0 deletions
diff --git a/src/test/compile-fail/auxiliary/lto-duplicate-symbols1.rs b/src/test/compile-fail/auxiliary/lto-duplicate-symbols1.rs
new file mode 100644
index 00000000000..ea09327bd19
--- /dev/null
+++ b/src/test/compile-fail/auxiliary/lto-duplicate-symbols1.rs
@@ -0,0 +1,16 @@
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// no-prefer-dynamic
+
+#![crate_type = "rlib"]
+
+#[no_mangle]
+pub extern fn foo() {}
diff --git a/src/test/compile-fail/auxiliary/lto-duplicate-symbols2.rs b/src/test/compile-fail/auxiliary/lto-duplicate-symbols2.rs
new file mode 100644
index 00000000000..ea09327bd19
--- /dev/null
+++ b/src/test/compile-fail/auxiliary/lto-duplicate-symbols2.rs
@@ -0,0 +1,16 @@
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// no-prefer-dynamic
+
+#![crate_type = "rlib"]
+
+#[no_mangle]
+pub extern fn foo() {}
diff --git a/src/test/compile-fail/lto-duplicate-symbols.rs b/src/test/compile-fail/lto-duplicate-symbols.rs
new file mode 100644
index 00000000000..9c1dbfc2af9
--- /dev/null
+++ b/src/test/compile-fail/lto-duplicate-symbols.rs
@@ -0,0 +1,20 @@
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// aux-build:lto-duplicate-symbols1.rs
+// aux-build:lto-duplicate-symbols2.rs
+// error-pattern:Linking globals named 'foo': symbol multiply defined!
+// compile-flags: -C lto
+// no-prefer-dynamic
+
+extern crate lto_duplicate_symbols1;
+extern crate lto_duplicate_symbols2;
+
+fn main() {}