zld: demote logging back to debug from warn
This commit is contained in:
@@ -486,7 +486,7 @@ const TextBlockParser = struct {
|
||||
pub fn parseTextBlocks(self: *Object, zld: *Zld) !void {
|
||||
const seg = self.load_commands.items[self.segment_cmd_index.?].Segment;
|
||||
|
||||
log.warn("analysing {s}", .{self.name.?});
|
||||
log.debug("analysing {s}", .{self.name.?});
|
||||
|
||||
const dysymtab = self.load_commands.items[self.dysymtab_cmd_index.?].Dysymtab;
|
||||
// We only care about defined symbols, so filter every other out.
|
||||
@@ -507,14 +507,14 @@ pub fn parseTextBlocks(self: *Object, zld: *Zld) !void {
|
||||
|
||||
for (seg.sections.items) |sect, id| {
|
||||
const sect_id = @intCast(u8, id);
|
||||
log.warn("putting section '{s},{s}' as a TextBlock", .{
|
||||
log.debug("putting section '{s},{s}' as a TextBlock", .{
|
||||
segmentName(sect),
|
||||
sectionName(sect),
|
||||
});
|
||||
|
||||
// Get matching segment/section in the final artifact.
|
||||
const match = (try zld.getMatchingSection(sect)) orelse {
|
||||
log.warn("unhandled section", .{});
|
||||
log.debug("unhandled section", .{});
|
||||
continue;
|
||||
};
|
||||
|
||||
@@ -533,7 +533,7 @@ pub fn parseTextBlocks(self: *Object, zld: *Zld) !void {
|
||||
const filtered_nlists = NlistWithIndex.filterInSection(sorted_nlists.items, sect);
|
||||
|
||||
// Is there any padding between symbols within the section?
|
||||
const is_splittable = self.header.?.flags & macho.MH_SUBSECTIONS_VIA_SYMBOLS != 0;
|
||||
// const is_splittable = self.header.?.flags & macho.MH_SUBSECTIONS_VIA_SYMBOLS != 0;
|
||||
// TODO is it perhaps worth skip parsing subsections in Debug mode and not worry about
|
||||
// duplicates at all? Need some benchmarks!
|
||||
// const is_splittable = false;
|
||||
|
||||
@@ -695,7 +695,7 @@ pub fn parseRelocsFromObject(
|
||||
.ARM64_RELOC_GOT_LOAD_PAGEOFF12,
|
||||
.ARM64_RELOC_TLVP_LOAD_PAGEOFF12,
|
||||
=> {
|
||||
self.parsePageOff(rel, &parsed_rel, addend, ctx);
|
||||
self.parsePageOff(rel, &parsed_rel, addend);
|
||||
if (rel_type == .ARM64_RELOC_PAGEOFF12)
|
||||
addend = 0;
|
||||
},
|
||||
@@ -866,6 +866,7 @@ fn parseUnsigned(
|
||||
}
|
||||
|
||||
fn parseBranch(self: TextBlock, rel: macho.relocation_info, out: *Relocation, ctx: RelocContext) void {
|
||||
_ = self;
|
||||
assert(rel.r_pcrel == 1);
|
||||
assert(rel.r_length == 2);
|
||||
|
||||
@@ -894,7 +895,7 @@ fn parsePage(self: TextBlock, rel: macho.relocation_info, out: *Relocation, adde
|
||||
};
|
||||
}
|
||||
|
||||
fn parsePageOff(self: TextBlock, rel: macho.relocation_info, out: *Relocation, addend: u32, ctx: RelocContext) void {
|
||||
fn parsePageOff(self: TextBlock, rel: macho.relocation_info, out: *Relocation, addend: u32) void {
|
||||
assert(rel.r_pcrel == 0);
|
||||
assert(rel.r_length == 2);
|
||||
|
||||
@@ -987,7 +988,7 @@ fn parseLoad(self: TextBlock, rel: macho.relocation_info, out: *Relocation) void
|
||||
|
||||
pub fn resolveRelocs(self: *TextBlock, zld: *Zld) !void {
|
||||
for (self.relocs.items) |rel| {
|
||||
log.warn("relocating {}", .{rel});
|
||||
log.debug("relocating {}", .{rel});
|
||||
|
||||
const source_addr = blk: {
|
||||
const sym = zld.locals.items[self.local_sym_index];
|
||||
@@ -1073,8 +1074,8 @@ pub fn resolveRelocs(self: *TextBlock, zld: *Zld) !void {
|
||||
}
|
||||
};
|
||||
|
||||
log.warn(" | source_addr = 0x{x}", .{source_addr});
|
||||
log.warn(" | target_addr = 0x{x}", .{target_addr});
|
||||
log.debug(" | source_addr = 0x{x}", .{source_addr});
|
||||
log.debug(" | target_addr = 0x{x}", .{target_addr});
|
||||
|
||||
try rel.resolve(.{
|
||||
.block = self,
|
||||
|
||||
@@ -253,58 +253,58 @@ pub fn link(self: *Zld, files: []const []const u8, output: Output, args: LinkArg
|
||||
self.allocateLinkeditSegment();
|
||||
try self.allocateTextBlocks();
|
||||
|
||||
log.warn("locals", .{});
|
||||
for (self.locals.items) |sym, id| {
|
||||
log.warn(" {d}: {s}, {}", .{ id, self.getString(sym.n_strx), sym });
|
||||
}
|
||||
// log.warn("locals", .{});
|
||||
// for (self.locals.items) |sym, id| {
|
||||
// log.warn(" {d}: {s}, {}", .{ id, self.getString(sym.n_strx), sym });
|
||||
// }
|
||||
|
||||
log.warn("globals", .{});
|
||||
for (self.globals.items) |sym, id| {
|
||||
log.warn(" {d}: {s}, {}", .{ id, self.getString(sym.n_strx), sym });
|
||||
}
|
||||
// log.warn("globals", .{});
|
||||
// for (self.globals.items) |sym, id| {
|
||||
// log.warn(" {d}: {s}, {}", .{ id, self.getString(sym.n_strx), sym });
|
||||
// }
|
||||
|
||||
log.warn("tentatives", .{});
|
||||
for (self.tentatives.items) |sym, id| {
|
||||
log.warn(" {d}: {s}, {}", .{ id, self.getString(sym.n_strx), sym });
|
||||
}
|
||||
// log.warn("tentatives", .{});
|
||||
// for (self.tentatives.items) |sym, id| {
|
||||
// log.warn(" {d}: {s}, {}", .{ id, self.getString(sym.n_strx), sym });
|
||||
// }
|
||||
|
||||
log.warn("undefines", .{});
|
||||
for (self.undefs.items) |sym, id| {
|
||||
log.warn(" {d}: {s}, {}", .{ id, self.getString(sym.n_strx), sym });
|
||||
}
|
||||
// log.warn("undefines", .{});
|
||||
// for (self.undefs.items) |sym, id| {
|
||||
// log.warn(" {d}: {s}, {}", .{ id, self.getString(sym.n_strx), sym });
|
||||
// }
|
||||
|
||||
log.warn("imports", .{});
|
||||
for (self.imports.items) |sym, id| {
|
||||
log.warn(" {d}: {s}, {}", .{ id, self.getString(sym.n_strx), sym });
|
||||
}
|
||||
// log.warn("imports", .{});
|
||||
// for (self.imports.items) |sym, id| {
|
||||
// log.warn(" {d}: {s}, {}", .{ id, self.getString(sym.n_strx), sym });
|
||||
// }
|
||||
|
||||
log.warn("symbol resolver", .{});
|
||||
for (self.symbol_resolver.keys()) |key| {
|
||||
log.warn(" {s} => {}", .{ key, self.symbol_resolver.get(key).? });
|
||||
}
|
||||
// log.warn("symbol resolver", .{});
|
||||
// for (self.symbol_resolver.keys()) |key| {
|
||||
// log.warn(" {s} => {}", .{ key, self.symbol_resolver.get(key).? });
|
||||
// }
|
||||
|
||||
log.warn("mappings", .{});
|
||||
for (self.objects.items) |object, id| {
|
||||
const object_id = @intCast(u16, id);
|
||||
log.warn(" in object {s}", .{object.name.?});
|
||||
for (object.symtab.items) |sym, sym_id| {
|
||||
if (object.symbol_mapping.get(@intCast(u32, sym_id))) |local_id| {
|
||||
log.warn(" | {d} => {d}", .{ sym_id, local_id });
|
||||
} else {
|
||||
log.warn(" | {d} no local mapping for {s}", .{ sym_id, object.getString(sym.n_strx) });
|
||||
}
|
||||
}
|
||||
}
|
||||
// log.warn("mappings", .{});
|
||||
// for (self.objects.items) |object, id| {
|
||||
// const object_id = @intCast(u16, id);
|
||||
// log.warn(" in object {s}", .{object.name.?});
|
||||
// for (object.symtab.items) |sym, sym_id| {
|
||||
// if (object.symbol_mapping.get(@intCast(u32, sym_id))) |local_id| {
|
||||
// log.warn(" | {d} => {d}", .{ sym_id, local_id });
|
||||
// } else {
|
||||
// log.warn(" | {d} no local mapping for {s}", .{ sym_id, object.getString(sym.n_strx) });
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
var it = self.blocks.iterator();
|
||||
while (it.next()) |entry| {
|
||||
const seg = self.load_commands.items[entry.key_ptr.seg].Segment;
|
||||
const sect = seg.sections.items[entry.key_ptr.sect];
|
||||
// var it = self.blocks.iterator();
|
||||
// while (it.next()) |entry| {
|
||||
// const seg = self.load_commands.items[entry.key_ptr.seg].Segment;
|
||||
// const sect = seg.sections.items[entry.key_ptr.sect];
|
||||
|
||||
log.warn("\n\n{s},{s} contents:", .{ segmentName(sect), sectionName(sect) });
|
||||
log.warn(" {}", .{sect});
|
||||
entry.value_ptr.*.print(self);
|
||||
}
|
||||
// log.warn("\n\n{s},{s} contents:", .{ segmentName(sect), sectionName(sect) });
|
||||
// log.warn(" {}", .{sect});
|
||||
// entry.value_ptr.*.print(self);
|
||||
// }
|
||||
|
||||
try self.flush();
|
||||
}
|
||||
@@ -1411,7 +1411,7 @@ fn writeStubInStubHelper(self: *Zld, index: u32) !void {
|
||||
fn resolveSymbolsInObject(self: *Zld, object_id: u16) !void {
|
||||
const object = self.objects.items[object_id];
|
||||
|
||||
log.warn("resolving symbols in '{s}'", .{object.name});
|
||||
log.debug("resolving symbols in '{s}'", .{object.name});
|
||||
|
||||
for (object.symtab.items) |sym, id| {
|
||||
const sym_id = @intCast(u32, id);
|
||||
|
||||
Reference in New Issue
Block a user