Skip to content

Commit

Permalink
Rollup merge of rust-lang#49329 - canarysnort01:fix-no-pie, r=pnkfelix
Browse files Browse the repository at this point in the history
don't pass -no-pie to gnu ld

fixes rust-lang#48884
  • Loading branch information
kennytm authored Mar 28, 2018
2 parents 43f56ce + 7cae6fe commit 4285e1c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/librustc_trans/back/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -713,6 +713,7 @@ fn link_natively(sess: &Session,
// linking executables as pie. Different versions of gcc seem to use
// different quotes in the error message so don't check for them.
if sess.target.target.options.linker_is_gnu &&
sess.linker_flavor() != LinkerFlavor::Ld &&
(out.contains("unrecognized command line option") ||
out.contains("unknown argument")) &&
out.contains("-no-pie") &&
Expand Down Expand Up @@ -1008,8 +1009,9 @@ fn link_args(cmd: &mut Linker,
} else {
// recent versions of gcc can be configured to generate position
// independent executables by default. We have to pass -no-pie to
// explicitly turn that off.
if sess.target.target.options.linker_is_gnu {
// explicitly turn that off. Not applicable to ld.
if sess.target.target.options.linker_is_gnu
&& sess.linker_flavor() != LinkerFlavor::Ld {
cmd.no_position_independent_executable();
}
}
Expand Down

0 comments on commit 4285e1c

Please sign in to comment.