-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
auto merge of #13857 : alexcrichton/rust/add-dylib-paths, r=brson
When a syntax extension is loaded by the compiler, the dylib that is opened may have other dylibs that it depends on. The dynamic linker must be able to find these libraries on the system or else the library will fail to load. Currently, unix gets by with the use of rpaths. This relies on the dylib not moving around too drastically relative to its dependencies. For windows, however, this is no rpath available, and in theory unix should work without rpaths as well. This modifies the compiler to add all -L search directories to the dynamic linker's set of load paths. This is currently managed through environment variables for each platform. Closes #13848
- Loading branch information
Showing
7 changed files
with
114 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright 2014 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 | ||
// force-host | ||
|
||
#![crate_type = "dylib"] | ||
|
||
pub fn the_answer() -> int { | ||
2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Copyright 2014 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. | ||
|
||
// force-host | ||
// no-prefer-dynamic | ||
|
||
#![crate_type = "dylib"] | ||
#![feature(macro_registrar, quote, globs)] | ||
|
||
extern crate other = "syntax-extension-with-dll-deps-1"; | ||
extern crate syntax; | ||
|
||
use syntax::ast::{Name, TokenTree, Item, MetaItem}; | ||
use syntax::codemap::Span; | ||
use syntax::ext::base::*; | ||
use syntax::parse::token; | ||
|
||
#[macro_registrar] | ||
pub fn macro_registrar(register: |Name, SyntaxExtension|) { | ||
register(token::intern("foo"), | ||
NormalTT(~BasicMacroExpander { | ||
expander: expand_foo, | ||
span: None, | ||
}, | ||
None)); | ||
} | ||
|
||
fn expand_foo(cx: &mut ExtCtxt, sp: Span, tts: &[TokenTree]) -> ~MacResult { | ||
let answer = other::the_answer(); | ||
MacExpr::new(quote_expr!(cx, $answer)) | ||
} |
22 changes: 22 additions & 0 deletions
22
src/test/run-pass-fulldeps/syntax-extension-with-dll-deps.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright 2014 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:syntax-extension-with-dll-deps-1.rs | ||
// aux-build:syntax-extension-with-dll-deps-2.rs | ||
// ignore-stage1 | ||
|
||
#![feature(phase)] | ||
|
||
#[phase(syntax)] | ||
extern crate extension = "syntax-extension-with-dll-deps-2"; | ||
|
||
fn main() { | ||
foo!(); | ||
} |