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

don't pass -no-pie to gnu ld #49329

Merged
merged 1 commit into from
Mar 29, 2018
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
6 changes: 4 additions & 2 deletions src/librustc_trans/back/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -712,6 +712,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 @@ -1007,8 +1008,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