Skip to content

Commit bd52e6a

Browse files
committed
auto merge of #11157 : alexcrichton/rust/issue-11154, r=pcwalton
Closes #11154
2 parents 8ec03b3 + 870024a commit bd52e6a

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

src/librustc/back/lto.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ use std::libc;
1919

2020
pub fn run(sess: session::Session, llmod: ModuleRef,
2121
tm: TargetMachineRef, reachable: &[~str]) {
22+
if sess.prefer_dynamic() {
23+
sess.err("cannot prefer dynamic linking when performing LTO");
24+
sess.note("only 'staticlib' and 'bin' outputs are supported with LTO");
25+
sess.abort_if_errors();
26+
}
27+
2228
// Make sure we actually can run LTO
2329
let outputs = sess.outputs.borrow();
2430
for output in outputs.get().iter() {

src/test/compile-fail/issue-11154.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Copyright 2013 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+
// compile-flags: -Z lto -Z prefer-dynamic
12+
13+
// error-pattern: cannot prefer dynamic linking
14+
15+
fn main() {}

0 commit comments

Comments
 (0)