diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2014-01-22 21:39:03 -0800 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2014-01-24 09:24:45 -0800 |
| commit | e715cdba31ae2bfee603cfe0c56260390ec36f1c (patch) | |
| tree | a7e8199f1f169a4803af7d567a44602341596c6c /src | |
| parent | fce792249e72a181f2ad52413b25b1db643c371f (diff) | |
Allow opting-out of rpath usage
By default, the compiler and libraries are all still built with rpaths, but this can be opted out of with --disable-rpath to ./configure or --no-rpath to rustc. cc #5219
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc/back/link.rs | 10 | ||||
| -rw-r--r-- | src/librustc/driver/driver.rs | 3 | ||||
| -rw-r--r-- | src/librustc/driver/session.rs | 2 |
3 files changed, 12 insertions, 3 deletions
diff --git a/src/librustc/back/link.rs b/src/librustc/back/link.rs index 63c4d9f4a29..a57f1296969 100644 --- a/src/librustc/back/link.rs +++ b/src/librustc/back/link.rs @@ -1089,8 +1089,10 @@ fn link_args(sess: Session, args.push(~"-dynamiclib"); args.push(~"-Wl,-dylib"); // FIXME (#9639): This needs to handle non-utf8 paths - args.push(~"-Wl,-install_name,@rpath/" + - out_filename.filename_str().unwrap()); + if !sess.opts.no_rpath { + args.push(~"-Wl,-install_name,@rpath/" + + out_filename.filename_str().unwrap()); + } } else { args.push(~"-shared") } @@ -1108,7 +1110,9 @@ fn link_args(sess: Session, // FIXME (#2397): At some point we want to rpath our guesses as to // where extern libraries might live, based on the // addl_lib_search_paths - args.push_all(rpath::get_rpath_flags(sess, out_filename)); + if !sess.opts.no_rpath { + args.push_all(rpath::get_rpath_flags(sess, out_filename)); + } // Finally add all the linker arguments provided on the command line along // with any #[link_args] attributes found inside the crate diff --git a/src/librustc/driver/driver.rs b/src/librustc/driver/driver.rs index 9cc12caa478..8c3d7e4215d 100644 --- a/src/librustc/driver/driver.rs +++ b/src/librustc/driver/driver.rs @@ -734,6 +734,7 @@ pub fn build_session_options(binary: ~str, let parse_only = matches.opt_present("parse-only"); let no_trans = matches.opt_present("no-trans"); let no_analysis = matches.opt_present("no-analysis"); + let no_rpath = matches.opt_present("no-rpath"); let lint_levels = [lint::allow, lint::warn, lint::deny, lint::forbid]; @@ -888,6 +889,7 @@ pub fn build_session_options(binary: ~str, parse_only: parse_only, no_trans: no_trans, no_analysis: no_analysis, + no_rpath: no_rpath, debugging_opts: debugging_opts, android_cross_path: android_cross_path, write_dependency_info: write_dependency_info, @@ -995,6 +997,7 @@ pub fn optgroups() -> ~[getopts::groups::OptGroup] { \"list\" will list all of the available passes", "NAMES"), optopt("", "llvm-args", "A list of arguments to pass to llvm, comma \ separated", "ARGS"), + optflag("", "no-rpath", "Disables setting the rpath in libs/exes"), optopt( "", "out-dir", "Write output to compiler-chosen filename in <dir>", "DIR"), diff --git a/src/librustc/driver/session.rs b/src/librustc/driver/session.rs index 75094bc8084..5b3b94cf7fc 100644 --- a/src/librustc/driver/session.rs +++ b/src/librustc/driver/session.rs @@ -170,6 +170,7 @@ pub struct Options { parse_only: bool, no_trans: bool, no_analysis: bool, + no_rpath: bool, debugging_opts: u64, android_cross_path: Option<~str>, /// Whether to write dependency files. It's (enabled, optional filename). @@ -388,6 +389,7 @@ pub fn basic_options() -> @Options { parse_only: false, no_trans: false, no_analysis: false, + no_rpath: false, debugging_opts: 0, android_cross_path: None, write_dependency_info: (false, None), |
