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

rustc: use -Xlinker when specifying an rpath with ',' in it #38798

Merged
merged 1 commit into from
Jan 8, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion src/librustc_trans/back/rpath.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,13 @@ pub fn get_rpath_flags(config: &mut RPathConfig) -> Vec<String> {
fn rpaths_to_flags(rpaths: &[String]) -> Vec<String> {
let mut ret = Vec::new();
for rpath in rpaths {
ret.push(format!("-Wl,-rpath,{}", &(*rpath)));
if rpath.contains(',') {
ret.push("-Wl,-rpath".into());
ret.push("-Xlinker".into());
ret.push(rpath.clone());
} else {
ret.push(format!("-Wl,-rpath,{}", &(*rpath)));
}
}
return ret;
}
Expand Down Expand Up @@ -258,4 +264,19 @@ mod tests {
assert_eq!(res, "$ORIGIN/../lib");
}
}

#[test]
fn test_xlinker() {
let args = rpaths_to_flags(&[
"a/normal/path".to_string(),
"a,comma,path".to_string()
]);

assert_eq!(args, vec![
"-Wl,-rpath,a/normal/path".to_string(),
"-Wl,-rpath".to_string(),
"-Xlinker".to_string(),
"a,comma,path".to_string()
]);
}
}