Skip to content

Commit e55d3f9

Browse files
committed
Auto merge of rust-lang#73384 - petrochenkov:gnulink, r=cuviper
linker: Never pass `-no-pie` to non-gnu linkers Fixes rust-lang#73370
2 parents 7d16c1d + e8cf572 commit e55d3f9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/librustc_codegen_ssa/back/linker.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ impl<'a> Linker for GccLinker<'a> {
280280
fn set_output_kind(&mut self, output_kind: LinkOutputKind, out_filename: &Path) {
281281
match output_kind {
282282
LinkOutputKind::DynamicNoPicExe => {
283-
if !self.is_ld {
283+
if !self.is_ld && self.sess.target.target.options.linker_is_gnu {
284284
self.cmd.arg("-no-pie");
285285
}
286286
}
@@ -291,7 +291,7 @@ impl<'a> Linker for GccLinker<'a> {
291291
LinkOutputKind::StaticNoPicExe => {
292292
// `-static` works for both gcc wrapper and ld.
293293
self.cmd.arg("-static");
294-
if !self.is_ld {
294+
if !self.is_ld && self.sess.target.target.options.linker_is_gnu {
295295
self.cmd.arg("-no-pie");
296296
}
297297
}

0 commit comments

Comments
 (0)