commit bb7a43490f29cbe98974ba66ebd274bceb694acf (tree)
parent 4c50c4b6e5ba1b57e37194fb307d176bef16f810
Author: Alex Rønne Petersen <alex@alexrp.com>
Date: Sun, 18 Jan 2026 11:55:14 +0100
compiler: let LLVM set the x32 feature from the target triple on x86 targets
Diffstat:
2 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/src/Compilation.zig b/src/Compilation.zig
@@ -6808,6 +6808,7 @@ pub fn addCCArgs(
// We communicate these to Clang through the dedicated options.
if (std.mem.startsWith(u8, llvm_name, "soft-float") or
std.mem.startsWith(u8, llvm_name, "hard-float") or
+ (target.cpu.arch.isX86() and std.mem.startsWith(u8, llvm_name, "x32")) or
(target.cpu.arch == .s390x and std.mem.eql(u8, llvm_name, "backchain")))
continue;
diff --git a/src/Package/Module.zig b/src/Package/Module.zig
@@ -347,6 +347,8 @@ pub fn create(arena: Allocator, options: CreateOptions) !*Package.Module {
// See https://github.com/ziglang/zig/issues/23539
if (target_util.isDynamicAMDGCNFeature(target, feature)) continue;
+ if (target.cpu.arch.isX86() and @as(std.Target.x86.Feature, @enumFromInt(feature.index)) == .x32) continue;
+
var is_enabled = target.cpu.features.isEnabled(feature.index);
if (target.cpu.arch == .s390x and @as(std.Target.s390x.Feature, @enumFromInt(feature.index)) == .backchain) {
is_enabled = !omit_frame_pointer;