aboutsummaryrefslogtreecommitdiff
path: root/src/link/Dwarf.zig
diff options
context:
space:
mode:
authorJakub Konka <kubkon@jakubkonka.com>2022-12-08 10:38:03 +0100
committerJakub Konka <kubkon@jakubkonka.com>2022-12-09 09:24:25 +0100
commit381abcfb7a24dcfda761390d6ef914047330f878 (patch)
tree43603d2c51e8802881e875170870aa5b35407bf5 /src/link/Dwarf.zig
parent4bb66b63ba108a1c7e5c920348d72ed1e169fd99 (diff)
downloadzig-381abcfb7a24dcfda761390d6ef914047330f878.tar.gz
zig-381abcfb7a24dcfda761390d6ef914047330f878.zip
dwarf: move another sect growing routine to d_sym
Diffstat (limited to 'src/link/Dwarf.zig')
-rw-r--r--src/link/Dwarf.zig30
1 files changed, 5 insertions, 25 deletions
diff --git a/src/link/Dwarf.zig b/src/link/Dwarf.zig
index c665031268..4faf72d8bc 100644
--- a/src/link/Dwarf.zig
+++ b/src/link/Dwarf.zig
@@ -1184,31 +1184,11 @@ pub fn commitDeclState(
},
.macho => {
- const macho_file = self.bin_file.cast(File.MachO).?;
- const d_sym = &macho_file.d_sym.?;
- const debug_line_sect = d_sym.getSectionPtr(d_sym.debug_line_section_index.?);
- if (needed_size != debug_line_sect.size) {
- if (needed_size > d_sym.allocatedSize(debug_line_sect.offset)) {
- const new_offset = d_sym.findFreeSpace(needed_size, 1);
- const existing_size = last_src_fn.off;
- std.log.scoped(.dsym).debug("moving __debug_line section: {} bytes from 0x{x} to 0x{x}", .{
- existing_size,
- debug_line_sect.offset,
- new_offset,
- });
- const amt = try d_sym.file.copyRangeAll(
- debug_line_sect.offset,
- d_sym.file,
- new_offset,
- existing_size,
- );
- if (amt != existing_size) return error.InputOutput;
- debug_line_sect.offset = @intCast(u32, new_offset);
- }
- debug_line_sect.size = needed_size;
- d_sym.debug_line_header_dirty = true;
- }
- const file_pos = debug_line_sect.offset + src_fn.off;
+ const d_sym = self.bin_file.cast(File.MachO).?.getDebugSymbols().?;
+ const sect_index = d_sym.debug_line_section_index.?;
+ try d_sym.growSection(sect_index, needed_size);
+ const sect = d_sym.getSection(sect_index);
+ const file_pos = sect.offset + src_fn.off;
try pwriteDbgLineNops(
d_sym.file,
file_pos,