From c8b92f3a8ed740148c225608b6504fb8461249bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20R=C3=B8nne=20Petersen?= Date: Wed, 4 Jun 2025 10:35:04 +0200 Subject: [PATCH] zig cc: Pass -f(no-)(PIC,PIE) to Clang for *-(windows,uefi)-(gnu,cygnus). The previous supports_fpic() check was too broad. --- src/target.zig | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/target.zig b/src/target.zig index 81a1a4901f..f66fa1679a 100644 --- a/src/target.zig +++ b/src/target.zig @@ -60,7 +60,12 @@ pub fn picLevel(target: std.Target) u32 { /// This is not whether the target supports Position Independent Code, but whether the -fPIC /// C compiler argument is valid to Clang. pub fn supports_fpic(target: std.Target) bool { - return target.os.tag != .windows and target.os.tag != .uefi; + return switch (target.os.tag) { + .windows, + .uefi, + => target.abi == .gnu or target.abi == .cygnus, + else => true, + }; } pub fn alwaysSingleThreaded(target: std.Target) bool {