Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass --enable-new-dtags to GNU ld #30394

Merged
merged 1 commit into from Dec 19, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/librustc_back/rpath.rs
Expand Up @@ -19,6 +19,7 @@ pub struct RPathConfig<'a> {
pub out_filename: PathBuf,
pub is_like_osx: bool,
pub has_rpath: bool,
pub linker_is_gnu: bool,
pub get_install_prefix_lib_path: &'a mut FnMut() -> PathBuf,
}

Expand All @@ -36,6 +37,12 @@ pub fn get_rpath_flags(config: &mut RPathConfig) -> Vec<String> {
let libs = libs.into_iter().filter_map(|(_, l)| l).collect::<Vec<_>>();
let rpaths = get_rpaths(config, &libs[..]);
flags.extend_from_slice(&rpaths_to_flags(&rpaths[..]));

// Use DT_RUNPATH instead of DT_RPATH if available
if config.linker_is_gnu {
flags.push("-Wl,--enable-new-dtags".to_string());
}

flags
}

Expand Down Expand Up @@ -228,6 +235,7 @@ mod tests {
used_crates: Vec::new(),
has_rpath: true,
is_like_osx: true,
linker_is_gnu: false,
out_filename: PathBuf::from("bin/rustc"),
get_install_prefix_lib_path: &mut || panic!(),
};
Expand All @@ -241,6 +249,7 @@ mod tests {
get_install_prefix_lib_path: &mut || panic!(),
has_rpath: true,
is_like_osx: false,
linker_is_gnu: true,
};
let res = get_rpath_relative_to_output(config,
Path::new("lib/libstd.so"));
Expand Down
1 change: 1 addition & 0 deletions src/librustc_trans/back/link.rs
Expand Up @@ -1054,6 +1054,7 @@ fn link_args(cmd: &mut Linker,
out_filename: out_filename.to_path_buf(),
has_rpath: sess.target.target.options.has_rpath,
is_like_osx: sess.target.target.options.is_like_osx,
linker_is_gnu: sess.target.target.options.linker_is_gnu,
get_install_prefix_lib_path: &mut get_install_prefix_lib_path,
};
cmd.args(&rpath::get_rpath_flags(&mut rpath_config));
Expand Down