commit a85452b2c2a258c212a02b759634193db2f08ff0 (tree)
parent a5b76d2474c5d1cbbb1c08def6b30ad1836da3bc
Author: Noam Preil <noam@pixelhero.dev>
Date: Sun, 2 Aug 2020 20:48:39 -0400
Codegen: 16-bit pointers
Diffstat:
1 file changed, 4 insertions(+), 0 deletions(-)
diff --git a/src-self-hosted/codegen.zig b/src-self-hosted/codegen.zig
@@ -151,6 +151,10 @@ pub fn generateSymbol(
const vaddr = bin_file.local_symbols.items[decl.link.local_sym_index].st_value;
const endian = bin_file.base.options.target.cpu.arch.endian();
switch (bin_file.base.options.target.cpu.arch.ptrBitWidth()) {
+ 16 => {
+ try code.resize(2);
+ mem.writeInt(u16, code.items[0..2], @intCast(u16, vaddr), endian);
+ },
32 => {
try code.resize(4);
mem.writeInt(u32, code.items[0..4], @intCast(u32, vaddr), endian);