From 92e60a324f0e99377c9528f2e4c7b44e45d648e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Miku=C5=82a?= Date: Wed, 18 Feb 2026 11:24:10 +0100 Subject: [PATCH] Do no add -no-pie on Windows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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] ``` --- compiler/rustc_codegen_ssa/src/back/linker.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/compiler/rustc_codegen_ssa/src/back/linker.rs b/compiler/rustc_codegen_ssa/src/back/linker.rs index 10c4eedb58e8..3ace1a8c266c 100644 --- a/compiler/rustc_codegen_ssa/src/back/linker.rs +++ b/compiler/rustc_codegen_ssa/src/back/linker.rs @@ -527,7 +527,8 @@ impl<'a> Linker for GccLinker<'a> { ) { match output_kind { LinkOutputKind::DynamicNoPicExe => { - if !self.is_ld && self.is_gnu { + // noop on windows w/ gcc, warning w/ clang + if !self.is_ld && self.is_gnu && !self.sess.target.is_like_windows { self.cc_arg("-no-pie"); } }