Skip to content

Commit c8b92f3

Browse files
committed
zig cc: Pass -f(no-)(PIC,PIE) to Clang for *-(windows,uefi)-(gnu,cygnus).
The previous supports_fpic() check was too broad.
1 parent c620836 commit c8b92f3

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/target.zig

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,12 @@ pub fn picLevel(target: std.Target) u32 {
6060
/// This is not whether the target supports Position Independent Code, but whether the -fPIC
6161
/// C compiler argument is valid to Clang.
6262
pub fn supports_fpic(target: std.Target) bool {
63-
return target.os.tag != .windows and target.os.tag != .uefi;
63+
return switch (target.os.tag) {
64+
.windows,
65+
.uefi,
66+
=> target.abi == .gnu or target.abi == .cygnus,
67+
else => true,
68+
};
6469
}
6570

6671
pub fn alwaysSingleThreaded(target: std.Target) bool {

0 commit comments

Comments
 (0)