authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-06-04 10:29:13+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-06-04 10:32:30+02:00
logc6208369458208f097b8ce1ad1bb6c2bf40f211d
treeafb8282a735ffd79dcc1f9c7509fc8d0d2337380
parent0ccd2b0c5cdf4bee706b4a9341b97f786b19a978
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

zig cc: Pass -f(no-)PIE to clang.

Otherwise we rely on Clang's default which is known to not always match ours.

1 files changed, 3 insertions(+), 0 deletions(-)

src/Compilation.zig+3
...@@ -6169,6 +6169,9 @@ pub fn addCCArgs(...@@ -6169,6 +6169,9 @@ pub fn addCCArgs(
6169 }6169 }
61706170
6171 if (target_util.supports_fpic(target)) {6171 if (target_util.supports_fpic(target)) {
6172 // PIE needs to go before PIC because Clang interprets `-fno-PIE` to imply `-fno-PIC`, which
6173 // we don't necessarily want.
6174 try argv.append(if (comp.config.pie) "-fPIE" else "-fno-PIE");
6172 try argv.append(if (mod.pic) "-fPIC" else "-fno-PIC");6175 try argv.append(if (mod.pic) "-fPIC" else "-fno-PIC");
6173 }6176 }
61746177