Skip to content

Commit e8cf572

Browse files
committed
linker: Never pass -no-pie to non-gnu linkers
1 parent f315c35 commit e8cf572

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)