linker: Bail out of rpath logic early if the target doesn't support rpath
This commit is contained in:
parent
af31c338fc
commit
5f9a0d3844
3 changed files with 4 additions and 10 deletions
|
@ -2096,6 +2096,10 @@ fn add_rpath_args(
|
||||||
codegen_results: &CodegenResults,
|
codegen_results: &CodegenResults,
|
||||||
out_filename: &Path,
|
out_filename: &Path,
|
||||||
) {
|
) {
|
||||||
|
if !sess.target.has_rpath {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// FIXME (#2397): At some point we want to rpath our guesses as to
|
// FIXME (#2397): At some point we want to rpath our guesses as to
|
||||||
// where extern libraries might live, based on the
|
// where extern libraries might live, based on the
|
||||||
// add_lib_search_paths
|
// add_lib_search_paths
|
||||||
|
@ -2114,7 +2118,6 @@ fn add_rpath_args(
|
||||||
let rpath_config = RPathConfig {
|
let rpath_config = RPathConfig {
|
||||||
libs: &*libs,
|
libs: &*libs,
|
||||||
out_filename: out_filename.to_path_buf(),
|
out_filename: out_filename.to_path_buf(),
|
||||||
has_rpath: sess.target.has_rpath,
|
|
||||||
is_like_osx: sess.target.is_like_osx,
|
is_like_osx: sess.target.is_like_osx,
|
||||||
linker_is_gnu: sess.target.linker_flavor.is_gnu(),
|
linker_is_gnu: sess.target.linker_flavor.is_gnu(),
|
||||||
};
|
};
|
||||||
|
|
|
@ -9,16 +9,10 @@ pub struct RPathConfig<'a> {
|
||||||
pub libs: &'a [&'a Path],
|
pub libs: &'a [&'a Path],
|
||||||
pub out_filename: PathBuf,
|
pub out_filename: PathBuf,
|
||||||
pub is_like_osx: bool,
|
pub is_like_osx: bool,
|
||||||
pub has_rpath: bool,
|
|
||||||
pub linker_is_gnu: bool,
|
pub linker_is_gnu: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_rpath_flags(config: &RPathConfig<'_>) -> Vec<OsString> {
|
pub fn get_rpath_flags(config: &RPathConfig<'_>) -> Vec<OsString> {
|
||||||
// No rpath on windows
|
|
||||||
if !config.has_rpath {
|
|
||||||
return Vec::new();
|
|
||||||
}
|
|
||||||
|
|
||||||
debug!("preparing the RPATH!");
|
debug!("preparing the RPATH!");
|
||||||
|
|
||||||
let rpaths = get_rpaths(config);
|
let rpaths = get_rpaths(config);
|
||||||
|
|
|
@ -37,7 +37,6 @@ fn test_rpath_relative() {
|
||||||
if cfg!(target_os = "macos") {
|
if cfg!(target_os = "macos") {
|
||||||
let config = &mut RPathConfig {
|
let config = &mut RPathConfig {
|
||||||
libs: &[],
|
libs: &[],
|
||||||
has_rpath: true,
|
|
||||||
is_like_osx: true,
|
is_like_osx: true,
|
||||||
linker_is_gnu: false,
|
linker_is_gnu: false,
|
||||||
out_filename: PathBuf::from("bin/rustc"),
|
out_filename: PathBuf::from("bin/rustc"),
|
||||||
|
@ -48,7 +47,6 @@ fn test_rpath_relative() {
|
||||||
let config = &mut RPathConfig {
|
let config = &mut RPathConfig {
|
||||||
libs: &[],
|
libs: &[],
|
||||||
out_filename: PathBuf::from("bin/rustc"),
|
out_filename: PathBuf::from("bin/rustc"),
|
||||||
has_rpath: true,
|
|
||||||
is_like_osx: false,
|
is_like_osx: false,
|
||||||
linker_is_gnu: true,
|
linker_is_gnu: true,
|
||||||
};
|
};
|
||||||
|
@ -62,7 +60,6 @@ fn test_rpath_relative_issue_119571() {
|
||||||
let config = &mut RPathConfig {
|
let config = &mut RPathConfig {
|
||||||
libs: &[],
|
libs: &[],
|
||||||
out_filename: PathBuf::from("rustc"),
|
out_filename: PathBuf::from("rustc"),
|
||||||
has_rpath: true,
|
|
||||||
is_like_osx: false,
|
is_like_osx: false,
|
||||||
linker_is_gnu: true,
|
linker_is_gnu: true,
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue