From ca16f1e8a703491bcaac0d13379d2556e8ca837d Mon Sep 17 00:00:00 2001 From: Veikka Tuominen Date: Fri, 26 May 2023 23:29:05 +0300 Subject: std.Target adjustments * move `ptrBitWidth` from Arch to Target since it needs to know about the abi * double isn't always 8 bits * AVR uses 1-byte alignment for everything in GCC --- src/link/Dwarf.zig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/link/Dwarf.zig') diff --git a/src/link/Dwarf.zig b/src/link/Dwarf.zig index 1a064049fc..1d358a29ab 100644 --- a/src/link/Dwarf.zig +++ b/src/link/Dwarf.zig @@ -260,7 +260,7 @@ pub const DeclState = struct { .Pointer => { if (ty.isSlice()) { // Slices are structs: struct { .ptr = *, .len = N } - const ptr_bits = target.cpu.arch.ptrBitWidth(); + const ptr_bits = target.ptrBitWidth(); const ptr_bytes = @intCast(u8, @divExact(ptr_bits, 8)); // DW.AT.structure_type try dbg_info_buffer.ensureUnusedCapacity(2); @@ -751,7 +751,7 @@ pub const DeclState = struct { .memory, .linker_load, => { - const ptr_width = @intCast(u8, @divExact(target.cpu.arch.ptrBitWidth(), 8)); + const ptr_width = @intCast(u8, @divExact(target.ptrBitWidth(), 8)); try dbg_info.ensureUnusedCapacity(2 + ptr_width); dbg_info.appendSliceAssumeCapacity(&[2]u8{ // DW.AT.location, DW.FORM.exprloc 1 + ptr_width + @boolToInt(is_ptr), @@ -928,7 +928,7 @@ const min_nop_size = 2; const ideal_factor = 3; pub fn init(allocator: Allocator, bin_file: *File, target: std.Target) Dwarf { - const ptr_width: PtrWidth = switch (target.cpu.arch.ptrBitWidth()) { + const ptr_width: PtrWidth = switch (target.ptrBitWidth()) { 0...32 => .p32, 33...64 => .p64, else => unreachable, -- cgit v1.2.3