Auto merge of #73384 - petrochenkov:gnulink, r=cuviper

linker: Never pass `-no-pie` to non-gnu linkers

Fixes https://github.com/rust-lang/rust/issues/73370
This commit is contained in:
bors 2020-06-18 04:29:23 +00:00
commit e55d3f9c52

View file

@ -280,7 +280,7 @@ impl<'a> Linker for GccLinker<'a> {
fn set_output_kind(&mut self, output_kind: LinkOutputKind, out_filename: &Path) {
match output_kind {
LinkOutputKind::DynamicNoPicExe => {
if !self.is_ld {
if !self.is_ld && self.sess.target.target.options.linker_is_gnu {
self.cmd.arg("-no-pie");
}
}
@ -291,7 +291,7 @@ impl<'a> Linker for GccLinker<'a> {
LinkOutputKind::StaticNoPicExe => {
// `-static` works for both gcc wrapper and ld.
self.cmd.arg("-static");
if !self.is_ld {
if !self.is_ld && self.sess.target.target.options.linker_is_gnu {
self.cmd.arg("-no-pie");
}
}