commit f4fb47a6ec50ad18e6043a8cf55a65404b2718bb
parent fd4af9335888b63b00d8c3b9b46924fba1daa04e
Author: Sylvia Ivory <git@sivory.net>
Date: Tue, 13 Jan 2026 17:53:31 -0800
Ensure strict alignment
Diffstat:
1 file changed, 13 insertions(+), 12 deletions(-)
diff --git a/build.zig b/build.zig
@@ -1,19 +1,20 @@
const std = @import("std");
const config = @import("build.zig.zon");
-const fs = std.fs;
-
-// BCM2835 is **very specifically** the ARM1176JZF-S
-// https://www.raspberrypi.com/documentation/computers/processors.html
-const target: std.Target.Query = .{
- .cpu_arch = .arm,
- .cpu_model = .{ .explicit = &std.Target.arm.cpu.arm1176jzf_s },
- .cpu_features_add = std.Target.arm.cpu.arm1176jzf_s.features,
- .os_tag = .freestanding,
- .abi = .eabi,
-};
-
fn add_exe(exe_name: []const u8, path: std.Build.LazyPath, b: *std.Build) !*std.Build.Step.Compile {
+ var cpu_features = std.Target.arm.cpu.arm1176jzf_s.features;
+ cpu_features.addFeatureSet(std.Target.arm.featureSet(&[_]std.Target.arm.Feature{.strict_align}));
+
+ const target: std.Target.Query = .{
+ .cpu_arch = .arm,
+ .cpu_model = .{ .explicit = &std.Target.arm.cpu.arm1176jzf_s },
+ .cpu_features_add = cpu_features,
+ .os_tag = .freestanding,
+ .abi = .eabi,
+ };
+
+ // BCM2835 is **very specifically** the ARM1176JZF-S
+ // https://www.raspberrypi.com/documentation/computers/processors.html
const exe = b.addExecutable(.{
.name = exe_name,
.linkage = .static,