commit 05c059e563d88e277cbfb723449778c73ad94f8b (tree)
parent bc67a49c5c6c1a9b9eca8597b7dccc7b4b5ed49d
Author: Alex Rønne Petersen <alex@alexrp.com>
Date: Fri, 13 Mar 2026 04:25:58 +0100
link.Lld: pass --be8 to ld.lld for armeb/thumbeb v6+
BE32 is deprecated and only supported by older cores and some v6 cores. All
cores v6 or newer support BE8, so default to that for v6+.
closes https://codeberg.org/ziglang/zig/issues/31404
Diffstat:
1 file changed, 5 insertions(+), 0 deletions(-)
diff --git a/src/link/Lld.zig b/src/link/Lld.zig
@@ -871,6 +871,11 @@ fn elfLink(lld: *Lld, arena: Allocator) !void {
try std.fmt.allocPrint(arena, "-float-abi={s}", .{if (target.abi.float() == .hard) "hard" else "soft"}),
});
+ switch (target.cpu.arch) {
+ .armeb, .thumbeb => if (is_exe_or_dyn_lib and target.cpu.has(.arm, .has_v6)) try argv.append("--be8"),
+ else => {},
+ }
+
if (comp.config.lto != .none) {
switch (comp.root_mod.optimize_mode) {
.Debug => {},