-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Open
Labels
backend-llvmThe LLVM backend outputs an LLVM IR Module.The LLVM backend outputs an LLVM IR Module.bugObserved behavior contradicts documented or intended behaviorObserved behavior contradicts documented or intended behaviorupstreamAn issue with a third party project that Zig uses.An issue with a third party project that Zig uses.
Milestone
Description
I'm using the latest version (zig-0.8.0-dev.1825+d2d4df407
).
Here is my build.zig
:
const std = @import("std");
fn createCpuSet(features: []const std.Target.x86.Feature) std.Target.Cpu.Feature.Set {
var set = std.Target.Cpu.Feature.Set.empty;
for(features) |feature| {
set.addFeature(
@intCast(
std.Target.Cpu.Feature.Set.Index,
@enumToInt(feature)
)
);
}
return set;
}
pub fn build(b: *std.build.Builder) !void {
const kernel = b.addExecutable("a.out", "src/main.zig");
kernel.setOutputDir("build");
kernel.red_zone = false;
kernel.setBuildMode(b.standardReleaseOptions());
kernel.setTarget(.{
.cpu_arch = .x86_64,
.os_tag = .freestanding,
.abi = .none,
.cpu_model = .{
.explicit = &std.Target.x86.cpu.x86_64
},
.cpu_features_sub = createCpuSet(&.{ .mmx, .sse }),
.cpu_features_add = createCpuSet(&.{ .soft_float }),
});
b.default_step.dependOn(&kernel.step);
}
Here is my src/main.zig
:
export fn _start() noreturn {
while (true) {
asm volatile ("nop");
}
}
Here is the error I get when running zig build
:
The following command terminated unexpectedly:
tmp/.zig/zig build-exe /root/src/main.zig --cache-dir /root/zig-cache --global-cache-dir /root/.cache/zig --name a.out -mno-red-zone -target x86_64-freestanding-none -mcpu=x86_64-mmx+soft_float-sse --enable-cache
error: the following build command failed with exit code 11:
/root/zig-cache/o/43d7fb0f5cbd6f934528766dbd355070/build /tmp/.zig/zig /root /root/zig-cache /root/.cache/zig
Here is the GDB trace:
Thread 3.1 "zig" received signal SIGSEGV, Segmentation fault.
[Switching to LWP 14723]
0x00000000057e40a3 in llvm::DAGTypeLegalizer::SoftenFloatRes_Binary(llvm::SDNode*, llvm::RTLIB::Libcall) ()
Poking around a bit, I believe the issue revolves around the use of soft_float
in my build.zig
.
Metadata
Metadata
Assignees
Labels
backend-llvmThe LLVM backend outputs an LLVM IR Module.The LLVM backend outputs an LLVM IR Module.bugObserved behavior contradicts documented or intended behaviorObserved behavior contradicts documented or intended behaviorupstreamAn issue with a third party project that Zig uses.An issue with a third party project that Zig uses.