Codegen: 16-bit pointers

This commit is contained in:
Noam Preil 2020-08-02 20:48:39 -04:00 committed by Andrew Kelley
parent a5b76d2474
commit a85452b2c2

View File

@ -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);