rustc: Handle linker diagnostic 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.
This commit is contained in:
parent
f89817997a
commit
f0bceba669
8 changed files with 77 additions and 8 deletions
16
src/test/compile-fail/auxiliary/lto-duplicate-symbols1.rs
Normal file
16
src/test/compile-fail/auxiliary/lto-duplicate-symbols1.rs
Normal file
|
|
@ -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() {}
|
||||
16
src/test/compile-fail/auxiliary/lto-duplicate-symbols2.rs
Normal file
16
src/test/compile-fail/auxiliary/lto-duplicate-symbols2.rs
Normal file
|
|
@ -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() {}
|
||||
20
src/test/compile-fail/lto-duplicate-symbols.rs
Normal file
20
src/test/compile-fail/lto-duplicate-symbols.rs
Normal file
|
|
@ -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() {}
|
||||
Loading…
Add table
Add a link
Reference in a new issue