Rollup merge of #49329 - canarysnort01:fix-no-pie, r=pnkfelix
don't pass -no-pie to gnu ld fixes #48884
This commit is contained in:
commit
4285e1cad4
1 changed files with 4 additions and 2 deletions
|
@ -713,6 +713,7 @@ fn link_natively(sess: &Session,
|
||||||
// linking executables as pie. Different versions of gcc seem to use
|
// linking executables as pie. Different versions of gcc seem to use
|
||||||
// different quotes in the error message so don't check for them.
|
// different quotes in the error message so don't check for them.
|
||||||
if sess.target.target.options.linker_is_gnu &&
|
if sess.target.target.options.linker_is_gnu &&
|
||||||
|
sess.linker_flavor() != LinkerFlavor::Ld &&
|
||||||
(out.contains("unrecognized command line option") ||
|
(out.contains("unrecognized command line option") ||
|
||||||
out.contains("unknown argument")) &&
|
out.contains("unknown argument")) &&
|
||||||
out.contains("-no-pie") &&
|
out.contains("-no-pie") &&
|
||||||
|
@ -1008,8 +1009,9 @@ fn link_args(cmd: &mut Linker,
|
||||||
} else {
|
} else {
|
||||||
// recent versions of gcc can be configured to generate position
|
// recent versions of gcc can be configured to generate position
|
||||||
// independent executables by default. We have to pass -no-pie to
|
// independent executables by default. We have to pass -no-pie to
|
||||||
// explicitly turn that off.
|
// explicitly turn that off. Not applicable to ld.
|
||||||
if sess.target.target.options.linker_is_gnu {
|
if sess.target.target.options.linker_is_gnu
|
||||||
|
&& sess.linker_flavor() != LinkerFlavor::Ld {
|
||||||
cmd.no_position_independent_executable();
|
cmd.no_position_independent_executable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue