Skip to content

Commit c620836

Browse files
committed
zig cc: Pass -f(no-)PIE to clang.
Otherwise we rely on Clang's default which is known to not always match ours.
1 parent 0ccd2b0 commit c620836

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/Compilation.zig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6169,6 +6169,9 @@ pub fn addCCArgs(
61696169
}
61706170

61716171
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");
61726175
try argv.append(if (mod.pic) "-fPIC" else "-fno-PIC");
61736176
}
61746177

0 commit comments

Comments
 (0)