mirror of
https://github.com/ziglang/zig.git
synced 2026-01-14 11:25:14 +00:00
link.Dwarf: Fix function alignment calculation to match the rest of the linker.
In particular, for user-specified alignment values, we need to do max(user_align, minFunctionAlignment()) to respect the ABI minimum.
This commit is contained in:
parent
762ad4c6f4
commit
43344833c5
@ -2372,8 +2372,11 @@ pub fn initWipNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool.Nav.In
|
||||
try wip_nav.infoAddrSym(sym_index, 0);
|
||||
wip_nav.func_high_pc = @intCast(wip_nav.debug_info.items.len);
|
||||
try diw.writeInt(u32, 0, dwarf.endian);
|
||||
try uleb128(diw, nav.status.resolved.alignment.toByteUnits() orelse
|
||||
target_info.defaultFunctionAlignment(file.mod.resolved_target.result).toByteUnits().?);
|
||||
const target = file.mod.resolved_target.result;
|
||||
try uleb128(diw, switch (nav.status.resolved.alignment) {
|
||||
.none => target_info.defaultFunctionAlignment(target),
|
||||
else => |a| a.maxStrict(target_info.minFunctionAlignment(target)),
|
||||
}.toByteUnits().?);
|
||||
try diw.writeByte(@intFromBool(false));
|
||||
try diw.writeByte(@intFromBool(func_type.return_type == .noreturn_type));
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user