wasm linker: apply object relocations to data segments

This commit is contained in:
Andrew Kelley
2025-01-05 20:33:13 -08:00
parent 290d97bd09
commit e6a5fe7c55

View File

@@ -796,9 +796,11 @@ pub fn finish(f: *Flush, wasm: *Wasm) !void {
}
break :append;
},
.object => |i| c: {
if (true) @panic("TODO apply data segment relocations");
break :c i.ptr(wasm).payload;
.object => |i| {
const ptr = i.ptr(wasm);
try binary_bytes.appendSlice(gpa, ptr.payload.slice(wasm));
if (!is_obj) applyRelocs(binary_bytes.items[code_start..], ptr.offset, ptr.relocations(wasm), wasm);
break :append;
},
inline .uav_exe, .uav_obj, .nav_exe, .nav_obj => |i| i.value(wasm).code,
};