verify passed -no-pie arg before retrying failed link
This commit is contained in:
parent
8a72f589e5
commit
f0e9af1c55
2 changed files with 7 additions and 1 deletions
|
|
@ -109,6 +109,10 @@ impl Command {
|
|||
|
||||
// extensions
|
||||
|
||||
pub fn get_args(&self) -> &[OsString] {
|
||||
&self.args
|
||||
}
|
||||
|
||||
pub fn take_args(&mut self) -> Vec<OsString> {
|
||||
mem::replace(&mut self.args, Vec::new())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -668,7 +668,9 @@ fn link_natively(sess: &Session,
|
|||
// is safe because if the linker doesn't support -no-pie then it should not
|
||||
// default to linking executables as pie. Different versions of gcc seem to
|
||||
// use different quotes in the error message so don't check for them.
|
||||
if out.contains("unrecognized command line option") && out.contains("-no-pie") {
|
||||
if out.contains("unrecognized command line option") &&
|
||||
out.contains("-no-pie") &&
|
||||
cmd.get_args().iter().any(|e| e.to_string_lossy() == "-no-pie") {
|
||||
info!("linker output: {:?}", out);
|
||||
warn!("Linker does not support -no-pie command line option. Retrying without.");
|
||||
for arg in cmd.take_args() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue