Skip to content

Commit 92e60a3

Browse files
committed
Do no add -no-pie on Windows
Windows binaries are always position independent and Clang warns when trying to enable or disable that: ``` ❯ clang hello.c -pie clang: warning: argument unused during compilation: '-pie' [-Wunused-command-line-argument] ❯ clang hello.c -no-pie clang: warning: argument unused during compilation: '-no-pie' [-Wunused-command-line-argument] ```
1 parent 8387095 commit 92e60a3

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

compiler/rustc_codegen_ssa/src/back/linker.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,8 @@ impl<'a> Linker for GccLinker<'a> {
527527
) {
528528
match output_kind {
529529
LinkOutputKind::DynamicNoPicExe => {
530-
if !self.is_ld && self.is_gnu {
530+
// noop on windows w/ gcc, warning w/ clang
531+
if !self.is_ld && self.is_gnu && !self.sess.target.is_like_windows {
531532
self.cc_arg("-no-pie");
532533
}
533534
}

0 commit comments

Comments
 (0)