authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2022-03-05 17:19:06+01:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2022-03-05 17:55:01+01:00
log0a9088bd0684a517961b35bff458962174099677
tree28b328eb7362d1dd8e3e52c7d5f44fe3a153f5fb
parent2be003a3b37f32b2c187064b975fc10f335d5ac1

macho: remove anon_struct_type which is now redundant


3 files changed, 26 insertions(+), 20 deletions(-)

src/arch/x86_64/Emit.zig+16-2
......@@ -1019,7 +1019,14 @@ fn genArgDbgInfo(emit: *Emit, inst: Air.Inst.Index, mcv: MCValue, max_stack: u32
10191019 switch (emit.debug_output) {
10201020 .dwarf => |dbg_out| {
10211021 try dbg_out.dbg_info.ensureUnusedCapacity(3);
1022 dbg_out.dbg_info.appendAssumeCapacity(link.File.Elf.abbrev_parameter);
1022
1023 // TODO this will go away once we pull DWARF into a cross-platform module.
1024 if (emit.bin_file.cast(link.File.MachO)) |_| {
1025 dbg_out.dbg_info.appendAssumeCapacity(link.File.MachO.DebugSymbols.abbrev_parameter);
1026 } else if (emit.bin_file.cast(link.File.Elf)) |_| {
1027 dbg_out.dbg_info.appendAssumeCapacity(link.File.Elf.abbrev_parameter);
1028 } else return emit.fail("TODO DWARF in non-MachO and non-ELF backend", .{});
1029
10231030 dbg_out.dbg_info.appendSliceAssumeCapacity(&[2]u8{ // DW.AT.location, DW.FORM.exprloc
10241031 1, // ULEB128 dwarf expression length
10251032 reg.dwarfLocOp(),
......@@ -1042,7 +1049,14 @@ fn genArgDbgInfo(emit: *Emit, inst: Air.Inst.Index, mcv: MCValue, max_stack: u32
10421049 // for example when -fomit-frame-pointer is set.
10431050 const disp = @intCast(i32, max_stack) - off + 16;
10441051 try dbg_out.dbg_info.ensureUnusedCapacity(8);
1045 dbg_out.dbg_info.appendAssumeCapacity(link.File.Elf.abbrev_parameter);
1052
1053 // TODO this will go away once we pull DWARF into a cross-platform module.
1054 if (emit.bin_file.cast(link.File.MachO)) |_| {
1055 dbg_out.dbg_info.appendAssumeCapacity(link.File.MachO.DebugSymbols.abbrev_parameter);
1056 } else if (emit.bin_file.cast(link.File.Elf)) |_| {
1057 dbg_out.dbg_info.appendAssumeCapacity(link.File.Elf.abbrev_parameter);
1058 } else return emit.fail("TODO DWARF in non-MachO and non-ELF backend", .{});
1059
10461060 const fixup = dbg_out.dbg_info.items.len;
10471061 dbg_out.dbg_info.appendSliceAssumeCapacity(&[2]u8{ // DW.AT.location, DW.FORM.exprloc
10481062 1, // we will backpatch it after we encode the displacement in LEB128
src/link/MachO.zig+1-1
......@@ -27,7 +27,6 @@ const Atom = @import("MachO/Atom.zig");
2727const Cache = @import("../Cache.zig");
2828const CodeSignature = @import("MachO/CodeSignature.zig");
2929const Compilation = @import("../Compilation.zig");
30const DebugSymbols = @import("MachO/DebugSymbols.zig");
3130const Dylib = @import("MachO/Dylib.zig");
3231const File = link.File;
3332const Object = @import("MachO/Object.zig");
......@@ -43,6 +42,7 @@ const TypedValue = @import("../TypedValue.zig");
4342const Value = @import("../value.zig").Value;
4443
4544pub const TextBlock = Atom;
45pub const DebugSymbols = @import("MachO/DebugSymbols.zig");
4646
4747pub const base_tag: File.Tag = File.Tag.macho;
4848
src/link/MachO/DebugSymbols.zig+9-17
......@@ -78,16 +78,15 @@ debug_aranges_section_dirty: bool = false,
7878debug_info_header_dirty: bool = false,
7979debug_line_header_dirty: bool = false,
8080
81const abbrev_compile_unit = 1;
82const abbrev_subprogram = 2;
83const abbrev_subprogram_retvoid = 3;
84const abbrev_base_type = 4;
85const abbrev_ptr_type = 5;
86const abbrev_struct_type = 6;
87const abbrev_anon_struct_type = 7;
88const abbrev_struct_member = 8;
89const abbrev_pad1 = 9;
90const abbrev_parameter = 10;
81pub const abbrev_compile_unit = 1;
82pub const abbrev_subprogram = 2;
83pub const abbrev_subprogram_retvoid = 3;
84pub const abbrev_base_type = 4;
85pub const abbrev_ptr_type = 5;
86pub const abbrev_struct_type = 6;
87pub const abbrev_struct_member = 7;
88pub const abbrev_pad1 = 8;
89pub const abbrev_parameter = 9;
9190
9291/// The reloc offset for the virtual address of a function in its Line Number Program.
9392/// Size is a virtual address integer.
......@@ -353,13 +352,6 @@ pub fn flushModule(self: *DebugSymbols, allocator: Allocator, options: link.Opti
353352 DW.FORM.string,
354353 0,
355354 0, // table sentinel
356 abbrev_anon_struct_type,
357 DW.TAG.structure_type,
358 DW.CHILDREN.yes, // header
359 DW.AT.byte_size,
360 DW.FORM.sdata,
361 0,
362 0, // table sentinel
363355 abbrev_struct_member,
364356 DW.TAG.member,
365357 DW.CHILDREN.no, // header