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

Otherwise we rely on Clang's default which is known to not always match ours.
This commit is contained in:
Alex Rønne Petersen 2025-06-04 10:29:13 +02:00
parent 0ccd2b0c5c
commit c620836945
No known key found for this signature in database

View File

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