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...@@ -1019,7 +1019,14 @@ fn genArgDbgInfo(emit: *Emit, inst: Air.Inst.Index, mcv: MCValue, max_stack: u32
1019 switch (emit.debug_output) {1019 switch (emit.debug_output) {
1020 .dwarf => |dbg_out| {1020 .dwarf => |dbg_out| {
1021 try dbg_out.dbg_info.ensureUnusedCapacity(3);1021 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
1023 dbg_out.dbg_info.appendSliceAssumeCapacity(&[2]u8{ // DW.AT.location, DW.FORM.exprloc1030 dbg_out.dbg_info.appendSliceAssumeCapacity(&[2]u8{ // DW.AT.location, DW.FORM.exprloc
1024 1, // ULEB128 dwarf expression length1031 1, // ULEB128 dwarf expression length
1025 reg.dwarfLocOp(),1032 reg.dwarfLocOp(),
...@@ -1042,7 +1049,14 @@ fn genArgDbgInfo(emit: *Emit, inst: Air.Inst.Index, mcv: MCValue, max_stack: u32...@@ -1042,7 +1049,14 @@ fn genArgDbgInfo(emit: *Emit, inst: Air.Inst.Index, mcv: MCValue, max_stack: u32
1042 // for example when -fomit-frame-pointer is set.1049 // for example when -fomit-frame-pointer is set.
1043 const disp = @intCast(i32, max_stack) - off + 16;1050 const disp = @intCast(i32, max_stack) - off + 16;
1044 try dbg_out.dbg_info.ensureUnusedCapacity(8);1051 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
1046 const fixup = dbg_out.dbg_info.items.len;1060 const fixup = dbg_out.dbg_info.items.len;
1047 dbg_out.dbg_info.appendSliceAssumeCapacity(&[2]u8{ // DW.AT.location, DW.FORM.exprloc1061 dbg_out.dbg_info.appendSliceAssumeCapacity(&[2]u8{ // DW.AT.location, DW.FORM.exprloc
1048 1, // we will backpatch it after we encode the displacement in LEB1281062 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");...@@ -27,7 +27,6 @@ const Atom = @import("MachO/Atom.zig");
27const Cache = @import("../Cache.zig");27const Cache = @import("../Cache.zig");
28const CodeSignature = @import("MachO/CodeSignature.zig");28const CodeSignature = @import("MachO/CodeSignature.zig");
29const Compilation = @import("../Compilation.zig");29const Compilation = @import("../Compilation.zig");
30const DebugSymbols = @import("MachO/DebugSymbols.zig");
31const Dylib = @import("MachO/Dylib.zig");30const Dylib = @import("MachO/Dylib.zig");
32const File = link.File;31const File = link.File;
33const Object = @import("MachO/Object.zig");32const Object = @import("MachO/Object.zig");
...@@ -43,6 +42,7 @@ const TypedValue = @import("../TypedValue.zig");...@@ -43,6 +42,7 @@ const TypedValue = @import("../TypedValue.zig");
43const Value = @import("../value.zig").Value;42const Value = @import("../value.zig").Value;
4443
45pub const TextBlock = Atom;44pub const TextBlock = Atom;
45pub const DebugSymbols = @import("MachO/DebugSymbols.zig");
4646
47pub const base_tag: File.Tag = File.Tag.macho;47pub 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,...@@ -78,16 +78,15 @@ debug_aranges_section_dirty: bool = false,
78debug_info_header_dirty: bool = false,78debug_info_header_dirty: bool = false,
79debug_line_header_dirty: bool = false,79debug_line_header_dirty: bool = false,
8080
81const abbrev_compile_unit = 1;81pub const abbrev_compile_unit = 1;
82const abbrev_subprogram = 2;82pub const abbrev_subprogram = 2;
83const abbrev_subprogram_retvoid = 3;83pub const abbrev_subprogram_retvoid = 3;
84const abbrev_base_type = 4;84pub const abbrev_base_type = 4;
85const abbrev_ptr_type = 5;85pub const abbrev_ptr_type = 5;
86const abbrev_struct_type = 6;86pub const abbrev_struct_type = 6;
87const abbrev_anon_struct_type = 7;87pub const abbrev_struct_member = 7;
88const abbrev_struct_member = 8;88pub const abbrev_pad1 = 8;
89const abbrev_pad1 = 9;89pub const abbrev_parameter = 9;
90const abbrev_parameter = 10;
9190
92/// The reloc offset for the virtual address of a function in its Line Number Program.91/// The reloc offset for the virtual address of a function in its Line Number Program.
93/// Size is a virtual address integer.92/// Size is a virtual address integer.
...@@ -353,13 +352,6 @@ pub fn flushModule(self: *DebugSymbols, allocator: Allocator, options: link.Opti...@@ -353,13 +352,6 @@ pub fn flushModule(self: *DebugSymbols, allocator: Allocator, options: link.Opti
353 DW.FORM.string,352 DW.FORM.string,
354 0,353 0,
355 0, // table sentinel354 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
363 abbrev_struct_member,355 abbrev_struct_member,
364 DW.TAG.member,356 DW.TAG.member,
365 DW.CHILDREN.no, // header357 DW.CHILDREN.no, // header