From 06303448942c387aa4b9d564bcc918ad27e3940a Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Wed, 18 Dec 2024 14:53:28 -0800 Subject: [PATCH] fix calculation of nav alignment --- src/link/Wasm.zig | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/link/Wasm.zig b/src/link/Wasm.zig index 4eba7f7d58..3150375230 100644 --- a/src/link/Wasm.zig +++ b/src/link/Wasm.zig @@ -1361,13 +1361,20 @@ pub const DataSegment = extern struct { const ip = &zcu.intern_pool; const ip_index = i.key(wasm).*; const ty: ZcuType = .fromInterned(ip.typeOf(ip_index)); - return ty.abiAlignment(zcu); + const result = ty.abiAlignment(zcu); + assert(result != .none); + return result; }, inline .nav_exe, .nav_obj => |i| { const zcu = wasm.base.comp.zcu.?; const ip = &zcu.intern_pool; const nav = ip.getNav(i.key(wasm).*); - return nav.status.resolved.alignment; + const explicit = nav.status.resolved.alignment; + if (explicit != .none) return explicit; + const ty: ZcuType = .fromInterned(nav.typeOf(ip)); + const result = ty.abiAlignment(zcu); + assert(result != .none); + return result; }, }; }