authorgravatar for jacoblevgw@gmail.comJacob G-W <jacoblevgw@gmail.com> 2021-06-13 16:35:25-04:00
committergravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2021-06-13 23:42:57+03:00
logdf4f11f42f44b4ee2a06e43095bc160277ceed42
tree43b63421bce3441b0bb1a405c575d389c81489b0
parentff79b87fa062d602722a6ec17f74550cda42a624

link/Elf: don't use \n in log.debug calls

It already inserts a \n so it produces 2 \n which is harder to read.

1 files changed, 23 insertions(+), 23 deletions(-)

src/link/Elf.zig+23-23
......@@ -451,7 +451,7 @@ pub fn populateMissingMetadata(self: *Elf) !void {
451451 const file_size = self.base.options.program_code_size_hint;
452452 const p_align = 0x1000;
453453 const off = self.findFreeSpace(file_size, p_align);
454 log.debug("found PT_LOAD free space 0x{x} to 0x{x}\n", .{ off, off + file_size });
454 log.debug("found PT_LOAD free space 0x{x} to 0x{x}", .{ off, off + file_size });
455455 const entry_addr: u64 = self.entry_addr orelse if (self.base.options.target.cpu.arch == .spu_2) @as(u64, 0) else default_entry_addr;
456456 try self.program_headers.append(self.base.allocator, .{
457457 .p_type = elf.PT_LOAD,
......@@ -473,7 +473,7 @@ pub fn populateMissingMetadata(self: *Elf) !void {
473473 // page align.
474474 const p_align = if (self.base.options.target.os.tag == .linux) 0x1000 else @as(u16, ptr_size);
475475 const off = self.findFreeSpace(file_size, p_align);
476 log.debug("found PT_LOAD free space 0x{x} to 0x{x}\n", .{ off, off + file_size });
476 log.debug("found PT_LOAD free space 0x{x} to 0x{x}", .{ off, off + file_size });
477477 // TODO instead of hard coding the vaddr, make a function to find a vaddr to put things at.
478478 // we'll need to re-use that function anyway, in case the GOT grows and overlaps something
479479 // else in virtual memory.
......@@ -495,7 +495,7 @@ pub fn populateMissingMetadata(self: *Elf) !void {
495495 assert(self.shstrtab.items.len == 0);
496496 try self.shstrtab.append(self.base.allocator, 0); // need a 0 at position 0
497497 const off = self.findFreeSpace(self.shstrtab.items.len, 1);
498 log.debug("found shstrtab free space 0x{x} to 0x{x}\n", .{ off, off + self.shstrtab.items.len });
498 log.debug("found shstrtab free space 0x{x} to 0x{x}", .{ off, off + self.shstrtab.items.len });
499499 try self.sections.append(self.base.allocator, .{
500500 .sh_name = try self.makeString(".shstrtab"),
501501 .sh_type = elf.SHT_STRTAB,
......@@ -553,7 +553,7 @@ pub fn populateMissingMetadata(self: *Elf) !void {
553553 const each_size: u64 = if (small_ptr) @sizeOf(elf.Elf32_Sym) else @sizeOf(elf.Elf64_Sym);
554554 const file_size = self.base.options.symbol_count_hint * each_size;
555555 const off = self.findFreeSpace(file_size, min_align);
556 log.debug("found symtab free space 0x{x} to 0x{x}\n", .{ off, off + file_size });
556 log.debug("found symtab free space 0x{x} to 0x{x}", .{ off, off + file_size });
557557
558558 try self.sections.append(self.base.allocator, .{
559559 .sh_name = try self.makeString(".symtab"),
......@@ -595,7 +595,7 @@ pub fn populateMissingMetadata(self: *Elf) !void {
595595 const file_size_hint = 200;
596596 const p_align = 1;
597597 const off = self.findFreeSpace(file_size_hint, p_align);
598 log.debug("found .debug_info free space 0x{x} to 0x{x}\n", .{
598 log.debug("found .debug_info free space 0x{x} to 0x{x}", .{
599599 off,
600600 off + file_size_hint,
601601 });
......@@ -620,7 +620,7 @@ pub fn populateMissingMetadata(self: *Elf) !void {
620620 const file_size_hint = 128;
621621 const p_align = 1;
622622 const off = self.findFreeSpace(file_size_hint, p_align);
623 log.debug("found .debug_abbrev free space 0x{x} to 0x{x}\n", .{
623 log.debug("found .debug_abbrev free space 0x{x} to 0x{x}", .{
624624 off,
625625 off + file_size_hint,
626626 });
......@@ -645,7 +645,7 @@ pub fn populateMissingMetadata(self: *Elf) !void {
645645 const file_size_hint = 160;
646646 const p_align = 16;
647647 const off = self.findFreeSpace(file_size_hint, p_align);
648 log.debug("found .debug_aranges free space 0x{x} to 0x{x}\n", .{
648 log.debug("found .debug_aranges free space 0x{x} to 0x{x}", .{
649649 off,
650650 off + file_size_hint,
651651 });
......@@ -670,7 +670,7 @@ pub fn populateMissingMetadata(self: *Elf) !void {
670670 const file_size_hint = 250;
671671 const p_align = 1;
672672 const off = self.findFreeSpace(file_size_hint, p_align);
673 log.debug("found .debug_line free space 0x{x} to 0x{x}\n", .{
673 log.debug("found .debug_line free space 0x{x} to 0x{x}", .{
674674 off,
675675 off + file_size_hint,
676676 });
......@@ -826,7 +826,7 @@ pub fn flushModule(self: *Elf, comp: *Compilation) !void {
826826 debug_abbrev_sect.sh_offset = self.findFreeSpace(needed_size, 1);
827827 }
828828 debug_abbrev_sect.sh_size = needed_size;
829 log.debug(".debug_abbrev start=0x{x} end=0x{x}\n", .{
829 log.debug(".debug_abbrev start=0x{x} end=0x{x}", .{
830830 debug_abbrev_sect.sh_offset,
831831 debug_abbrev_sect.sh_offset + needed_size,
832832 });
......@@ -973,7 +973,7 @@ pub fn flushModule(self: *Elf, comp: *Compilation) !void {
973973 debug_aranges_sect.sh_offset = self.findFreeSpace(needed_size, 16);
974974 }
975975 debug_aranges_sect.sh_size = needed_size;
976 log.debug(".debug_aranges start=0x{x} end=0x{x}\n", .{
976 log.debug(".debug_aranges start=0x{x} end=0x{x}", .{
977977 debug_aranges_sect.sh_offset,
978978 debug_aranges_sect.sh_offset + needed_size,
979979 });
......@@ -1140,7 +1140,7 @@ pub fn flushModule(self: *Elf, comp: *Compilation) !void {
11401140 shstrtab_sect.sh_offset = self.findFreeSpace(needed_size, 1);
11411141 }
11421142 shstrtab_sect.sh_size = needed_size;
1143 log.debug("writing shstrtab start=0x{x} end=0x{x}\n", .{ shstrtab_sect.sh_offset, shstrtab_sect.sh_offset + needed_size });
1143 log.debug("writing shstrtab start=0x{x} end=0x{x}", .{ shstrtab_sect.sh_offset, shstrtab_sect.sh_offset + needed_size });
11441144
11451145 try self.base.file.?.pwriteAll(self.shstrtab.items, shstrtab_sect.sh_offset);
11461146 if (!self.shdr_table_dirty) {
......@@ -1161,7 +1161,7 @@ pub fn flushModule(self: *Elf, comp: *Compilation) !void {
11611161 debug_strtab_sect.sh_offset = self.findFreeSpace(needed_size, 1);
11621162 }
11631163 debug_strtab_sect.sh_size = needed_size;
1164 log.debug("debug_strtab start=0x{x} end=0x{x}\n", .{ debug_strtab_sect.sh_offset, debug_strtab_sect.sh_offset + needed_size });
1164 log.debug("debug_strtab start=0x{x} end=0x{x}", .{ debug_strtab_sect.sh_offset, debug_strtab_sect.sh_offset + needed_size });
11651165
11661166 try self.base.file.?.pwriteAll(self.debug_strtab.items, debug_strtab_sect.sh_offset);
11671167 if (!self.shdr_table_dirty) {
......@@ -1195,7 +1195,7 @@ pub fn flushModule(self: *Elf, comp: *Compilation) !void {
11951195
11961196 for (buf) |*shdr, i| {
11971197 shdr.* = sectHeaderTo32(self.sections.items[i]);
1198 log.debug("writing section {}\n", .{shdr.*});
1198 log.debug("writing section {}", .{shdr.*});
11991199 if (foreign_endian) {
12001200 std.elf.bswapAllFields(elf.Elf32_Shdr, shdr);
12011201 }
......@@ -1208,7 +1208,7 @@ pub fn flushModule(self: *Elf, comp: *Compilation) !void {
12081208
12091209 for (buf) |*shdr, i| {
12101210 shdr.* = self.sections.items[i];
1211 log.debug("writing section {}\n", .{shdr.*});
1211 log.debug("writing section {}", .{shdr.*});
12121212 if (foreign_endian) {
12131213 std.elf.bswapAllFields(elf.Elf64_Shdr, shdr);
12141214 }
......@@ -1219,10 +1219,10 @@ pub fn flushModule(self: *Elf, comp: *Compilation) !void {
12191219 self.shdr_table_dirty = false;
12201220 }
12211221 if (self.entry_addr == null and self.base.options.effectiveOutputMode() == .Exe) {
1222 log.debug("flushing. no_entry_point_found = true\n", .{});
1222 log.debug("flushing. no_entry_point_found = true", .{});
12231223 self.error_flags.no_entry_point_found = true;
12241224 } else {
1225 log.debug("flushing. no_entry_point_found = false\n", .{});
1225 log.debug("flushing. no_entry_point_found = false", .{});
12261226 self.error_flags.no_entry_point_found = false;
12271227 try self.writeElfHeader();
12281228 }
......@@ -2073,10 +2073,10 @@ pub fn allocateDeclIndexes(self: *Elf, decl: *Module.Decl) !void {
20732073 try self.offset_table.ensureCapacity(self.base.allocator, self.offset_table.items.len + 1);
20742074
20752075 if (self.local_symbol_free_list.popOrNull()) |i| {
2076 log.debug("reusing symbol index {d} for {s}\n", .{ i, decl.name });
2076 log.debug("reusing symbol index {d} for {s}", .{ i, decl.name });
20772077 decl.link.elf.local_sym_index = i;
20782078 } else {
2079 log.debug("allocating symbol index {d} for {s}\n", .{ self.local_symbols.items.len, decl.name });
2079 log.debug("allocating symbol index {d} for {s}", .{ self.local_symbols.items.len, decl.name });
20802080 decl.link.elf.local_sym_index = @intCast(u32, self.local_symbols.items.len);
20812081 _ = self.local_symbols.addOneAssumeCapacity();
20822082 }
......@@ -2278,11 +2278,11 @@ pub fn updateDecl(self: *Elf, module: *Module, decl: *Module.Decl) !void {
22782278 !mem.isAlignedGeneric(u64, local_sym.st_value, required_alignment);
22792279 if (need_realloc) {
22802280 const vaddr = try self.growTextBlock(&decl.link.elf, code.len, required_alignment);
2281 log.debug("growing {s} from 0x{x} to 0x{x}\n", .{ decl.name, local_sym.st_value, vaddr });
2281 log.debug("growing {s} from 0x{x} to 0x{x}", .{ decl.name, local_sym.st_value, vaddr });
22822282 if (vaddr != local_sym.st_value) {
22832283 local_sym.st_value = vaddr;
22842284
2285 log.debug(" (writing new offset table entry)\n", .{});
2285 log.debug(" (writing new offset table entry)", .{});
22862286 self.offset_table.items[decl.link.elf.offset_table_index] = vaddr;
22872287 try self.writeOffsetTableEntry(decl.link.elf.offset_table_index);
22882288 }
......@@ -2300,7 +2300,7 @@ pub fn updateDecl(self: *Elf, module: *Module, decl: *Module.Decl) !void {
23002300 const decl_name = mem.spanZ(decl.name);
23012301 const name_str_index = try self.makeString(decl_name);
23022302 const vaddr = try self.allocateTextBlock(&decl.link.elf, code.len, required_alignment);
2303 log.debug("allocated text block for {s} at 0x{x}\n", .{ decl_name, vaddr });
2303 log.debug("allocated text block for {s} at 0x{x}", .{ decl_name, vaddr });
23042304 errdefer self.freeTextBlock(&decl.link.elf);
23052305
23062306 local_sym.* = .{
......@@ -2418,7 +2418,7 @@ pub fn updateDecl(self: *Elf, module: *Module, decl: *Module.Decl) !void {
24182418 if (needed_size > self.allocatedSize(debug_line_sect.sh_offset)) {
24192419 const new_offset = self.findFreeSpace(needed_size, 1);
24202420 const existing_size = last_src_fn.off;
2421 log.debug("moving .debug_line section: {d} bytes from 0x{x} to 0x{x}\n", .{
2421 log.debug("moving .debug_line section: {d} bytes from 0x{x} to 0x{x}", .{
24222422 existing_size,
24232423 debug_line_sect.sh_offset,
24242424 new_offset,
......@@ -2589,7 +2589,7 @@ fn writeDeclDebugInfo(self: *Elf, text_block: *TextBlock, dbg_info_buf: []const
25892589 if (needed_size > self.allocatedSize(debug_info_sect.sh_offset)) {
25902590 const new_offset = self.findFreeSpace(needed_size, 1);
25912591 const existing_size = last_decl.dbg_info_off;
2592 log.debug("moving .debug_info section: {} bytes from 0x{x} to 0x{x}\n", .{
2592 log.debug("moving .debug_info section: {} bytes from 0x{x} to 0x{x}", .{
25932593 existing_size,
25942594 debug_info_sect.sh_offset,
25952595 new_offset,