| ... | ... | @@ -267,7 +267,7 @@ fn parseInputFiles(self: *Zld, files: []const []const u8) !void { |
| 267 | 267 | continue; |
| 268 | 268 | } |
| 269 | 269 | |
| 270 | | log.warn("unexpected input file of unknown type '{s}'", .{file_name}); |
| 270 | log.debug("unexpected input file of unknown type '{s}'", .{file_name}); |
| 271 | 271 | } |
| 272 | 272 | |
| 273 | 273 | // Based on our classification, proceed with parsing. |
| ... | ... | @@ -325,7 +325,7 @@ fn mapAndUpdateSections( |
| 325 | 325 | .target_sect_id = target_sect_id, |
| 326 | 326 | .offset = @intCast(u32, offset), |
| 327 | 327 | }); |
| 328 | | log.warn("{s}: {s},{s} mapped to {s},{s} from 0x{x} to 0x{x}", .{ |
| 328 | log.debug("{s}: {s},{s} mapped to {s},{s} from 0x{x} to 0x{x}", .{ |
| 329 | 329 | object.name, |
| 330 | 330 | parseName(&source_sect.segname), |
| 331 | 331 | parseName(&source_sect.sectname), |
| ... | ... | @@ -555,7 +555,7 @@ fn updateMetadata(self: *Zld) !void { |
| 555 | 555 | }); |
| 556 | 556 | }, |
| 557 | 557 | else => { |
| 558 | | log.warn("unhandled section type 0x{x} for '{s}/{s}'", .{ flags, segname, sectname }); |
| 558 | log.debug("unhandled section type 0x{x} for '{s}/{s}'", .{ flags, segname, sectname }); |
| 559 | 559 | }, |
| 560 | 560 | } |
| 561 | 561 | } |
| ... | ... | @@ -580,7 +580,7 @@ fn updateMetadata(self: *Zld) !void { |
| 580 | 580 | const segname = parseName(&source_sect.segname); |
| 581 | 581 | const sectname = parseName(&source_sect.sectname); |
| 582 | 582 | |
| 583 | | log.warn("section '{s}/{s}' will be unmapped", .{ segname, sectname }); |
| 583 | log.debug("section '{s}/{s}' will be unmapped", .{ segname, sectname }); |
| 584 | 584 | |
| 585 | 585 | try self.unhandled_sections.putNoClobber(self.allocator, .{ |
| 586 | 586 | .object_id = object_id, |
| ... | ... | @@ -928,7 +928,7 @@ fn allocateSymbols(self: *Zld) !void { |
| 928 | 928 | const target_addr = target_sect.addr + target_mapping.offset; |
| 929 | 929 | const address = reg.address - source_sect.addr + target_addr; |
| 930 | 930 | |
| 931 | | log.warn("resolving symbol '{s}' at 0x{x}", .{ sym.name, address }); |
| 931 | log.debug("resolving symbol '{s}' at 0x{x}", .{ sym.name, address }); |
| 932 | 932 | |
| 933 | 933 | // TODO there might be a more generic way of doing this. |
| 934 | 934 | var section: u8 = 0; |
| ... | ... | @@ -1099,7 +1099,7 @@ fn writeLazySymbolPointer(self: *Zld, index: u32) !void { |
| 1099 | 1099 | var buf: [@sizeOf(u64)]u8 = undefined; |
| 1100 | 1100 | mem.writeIntLittle(u64, &buf, end); |
| 1101 | 1101 | const off = la_symbol_ptr.offset + index * @sizeOf(u64); |
| 1102 | | log.warn("writing lazy symbol pointer entry 0x{x} at 0x{x}", .{ end, off }); |
| 1102 | log.debug("writing lazy symbol pointer entry 0x{x} at 0x{x}", .{ end, off }); |
| 1103 | 1103 | try self.file.?.pwriteAll(&buf, off); |
| 1104 | 1104 | } |
| 1105 | 1105 | |
| ... | ... | @@ -1112,7 +1112,7 @@ fn writeStub(self: *Zld, index: u32) !void { |
| 1112 | 1112 | const stub_off = stubs.offset + index * stubs.reserved2; |
| 1113 | 1113 | const stub_addr = stubs.addr + index * stubs.reserved2; |
| 1114 | 1114 | const la_ptr_addr = la_symbol_ptr.addr + index * @sizeOf(u64); |
| 1115 | | log.warn("writing stub at 0x{x}", .{stub_off}); |
| 1115 | log.debug("writing stub at 0x{x}", .{stub_off}); |
| 1116 | 1116 | var code = try self.allocator.alloc(u8, stubs.reserved2); |
| 1117 | 1117 | defer self.allocator.free(code); |
| 1118 | 1118 | switch (self.arch.?) { |
| ... | ... | @@ -1216,7 +1216,7 @@ fn writeStubInStubHelper(self: *Zld, index: u32) !void { |
| 1216 | 1216 | } |
| 1217 | 1217 | |
| 1218 | 1218 | fn resolveSymbolsInObject(self: *Zld, object: *Object) !void { |
| 1219 | | log.warn("resolving symbols in '{s}'", .{object.name}); |
| 1219 | log.debug("resolving symbols in '{s}'", .{object.name}); |
| 1220 | 1220 | |
| 1221 | 1221 | for (object.symbols.items) |sym| { |
| 1222 | 1222 | if (sym.cast(Symbol.Regular)) |reg| { |
| ... | ... | @@ -1245,7 +1245,7 @@ fn resolveSymbolsInObject(self: *Zld, object: *Object) !void { |
| 1245 | 1245 | }, |
| 1246 | 1246 | .global => { |
| 1247 | 1247 | if (reg.linkage == .global) { |
| 1248 | | log.warn("symbol '{s}' defined multiple times", .{reg.base.name}); |
| 1248 | log.debug("symbol '{s}' defined multiple times", .{reg.base.name}); |
| 1249 | 1249 | return error.MultipleSymbolDefinitions; |
| 1250 | 1250 | } |
| 1251 | 1251 | sym.alias = g_sym; |
| ... | ... | @@ -1363,7 +1363,7 @@ fn resolveSymbols(self: *Zld) !void { |
| 1363 | 1363 | |
| 1364 | 1364 | fn resolveStubsAndGotEntries(self: *Zld) !void { |
| 1365 | 1365 | for (self.objects.items) |object| { |
| 1366 | | log.warn("resolving stubs and got entries from {s}", .{object.name}); |
| 1366 | log.debug("resolving stubs and got entries from {s}", .{object.name}); |
| 1367 | 1367 | |
| 1368 | 1368 | for (object.sections.items) |sect| { |
| 1369 | 1369 | const relocs = sect.relocs orelse continue; |
| ... | ... | @@ -1378,7 +1378,7 @@ fn resolveStubsAndGotEntries(self: *Zld) !void { |
| 1378 | 1378 | sym.got_index = index; |
| 1379 | 1379 | try self.got_entries.append(self.allocator, sym); |
| 1380 | 1380 | |
| 1381 | | log.warn(" | found GOT entry {s}: {*}", .{ sym.name, sym }); |
| 1381 | log.debug(" | found GOT entry {s}: {*}", .{ sym.name, sym }); |
| 1382 | 1382 | }, |
| 1383 | 1383 | else => { |
| 1384 | 1384 | if (rel.target != .symbol) continue; |
| ... | ... | @@ -1387,15 +1387,16 @@ fn resolveStubsAndGotEntries(self: *Zld) !void { |
| 1387 | 1387 | assert(sym.@"type" != .unresolved); |
| 1388 | 1388 | |
| 1389 | 1389 | if (sym.stubs_index != null) continue; |
| 1390 | | if (sym.cast(Symbol.Regular)) |reg| { |
| 1391 | | if (!reg.weak_ref) continue; |
| 1392 | | } |
| 1390 | if (sym.@"type" != .proxy) continue; |
| 1391 | // if (sym.cast(Symbol.Regular)) |reg| { |
| 1392 | // if (!reg.weak_ref) continue; |
| 1393 | // } |
| 1393 | 1394 | |
| 1394 | 1395 | const index = @intCast(u32, self.stubs.items.len); |
| 1395 | 1396 | sym.stubs_index = index; |
| 1396 | 1397 | try self.stubs.append(self.allocator, sym); |
| 1397 | 1398 | |
| 1398 | | log.warn(" | found stub {s}: {*}", .{ sym.name, sym }); |
| 1399 | log.debug(" | found stub {s}: {*}", .{ sym.name, sym }); |
| 1399 | 1400 | }, |
| 1400 | 1401 | } |
| 1401 | 1402 | } |
| ... | ... | @@ -1408,12 +1409,12 @@ fn resolveStubsAndGotEntries(self: *Zld) !void { |
| 1408 | 1409 | sym.got_index = index; |
| 1409 | 1410 | try self.got_entries.append(self.allocator, sym); |
| 1410 | 1411 | |
| 1411 | | log.warn(" | found GOT entry {s}: {*}", .{ sym.name, sym }); |
| 1412 | log.debug(" | found GOT entry {s}: {*}", .{ sym.name, sym }); |
| 1412 | 1413 | } |
| 1413 | 1414 | |
| 1414 | 1415 | fn resolveRelocsAndWriteSections(self: *Zld) !void { |
| 1415 | 1416 | for (self.objects.items) |object, object_id| { |
| 1416 | | log.warn("relocating object {s}", .{object.name}); |
| 1417 | log.debug("relocating object {s}", .{object.name}); |
| 1417 | 1418 | |
| 1418 | 1419 | for (object.sections.items) |sect, source_sect_id| { |
| 1419 | 1420 | if (sect.inner.flags == macho.S_MOD_INIT_FUNC_POINTERS or |
| ... | ... | @@ -1422,14 +1423,14 @@ fn resolveRelocsAndWriteSections(self: *Zld) !void { |
| 1422 | 1423 | const segname = parseName(&sect.inner.segname); |
| 1423 | 1424 | const sectname = parseName(&sect.inner.sectname); |
| 1424 | 1425 | |
| 1425 | | log.warn("relocating section '{s},{s}'", .{ segname, sectname }); |
| 1426 | log.debug("relocating section '{s},{s}'", .{ segname, sectname }); |
| 1426 | 1427 | |
| 1427 | 1428 | // Get mapping |
| 1428 | 1429 | const target_mapping = self.mappings.get(.{ |
| 1429 | 1430 | .object_id = @intCast(u16, object_id), |
| 1430 | 1431 | .source_sect_id = @intCast(u16, source_sect_id), |
| 1431 | 1432 | }) orelse { |
| 1432 | | log.warn("no mapping for {s},{s}; skipping", .{ segname, sectname }); |
| 1433 | log.debug("no mapping for {s},{s}; skipping", .{ segname, sectname }); |
| 1433 | 1434 | continue; |
| 1434 | 1435 | }; |
| 1435 | 1436 | const target_seg = self.load_commands.items[target_mapping.target_seg_id].Segment; |
| ... | ... | @@ -1518,7 +1519,7 @@ fn resolveRelocsAndWriteSections(self: *Zld) !void { |
| 1518 | 1519 | } |
| 1519 | 1520 | } |
| 1520 | 1521 | |
| 1521 | | log.warn("writing contents of '{s},{s}' section from '{s}' from 0x{x} to 0x{x}", .{ |
| 1522 | log.debug("writing contents of '{s},{s}' section from '{s}' from 0x{x} to 0x{x}", .{ |
| 1522 | 1523 | segname, |
| 1523 | 1524 | sectname, |
| 1524 | 1525 | object.name, |
| ... | ... | @@ -1530,7 +1531,7 @@ fn resolveRelocsAndWriteSections(self: *Zld) !void { |
| 1530 | 1531 | target_sect.flags == macho.S_THREAD_LOCAL_ZEROFILL or |
| 1531 | 1532 | target_sect.flags == macho.S_THREAD_LOCAL_VARIABLES) |
| 1532 | 1533 | { |
| 1533 | | log.warn("zeroing out '{s},{s}' from 0x{x} to 0x{x}", .{ |
| 1534 | log.debug("zeroing out '{s},{s}' from 0x{x} to 0x{x}", .{ |
| 1534 | 1535 | parseName(&target_sect.segname), |
| 1535 | 1536 | parseName(&target_sect.sectname), |
| 1536 | 1537 | target_sect_off, |
| ... | ... | @@ -1555,17 +1556,17 @@ fn relocTargetAddr(self: *Zld, object_id: u16, target: reloc.Relocation.Target) |
| 1555 | 1556 | .symbol => |sym| { |
| 1556 | 1557 | const final = sym.getTopmostAlias(); |
| 1557 | 1558 | if (final.cast(Symbol.Regular)) |reg| { |
| 1558 | | log.warn(" | regular '{s}'", .{sym.name}); |
| 1559 | log.debug(" | regular '{s}'", .{sym.name}); |
| 1559 | 1560 | break :blk reg.address; |
| 1560 | 1561 | } else if (final.cast(Symbol.Proxy)) |proxy| { |
| 1561 | 1562 | if (mem.eql(u8, sym.name, "__tlv_bootstrap")) { |
| 1562 | | log.warn(" | symbol '__tlv_bootstrap'", .{}); |
| 1563 | log.debug(" | symbol '__tlv_bootstrap'", .{}); |
| 1563 | 1564 | const segment = self.load_commands.items[self.data_segment_cmd_index.?].Segment; |
| 1564 | 1565 | const tlv = segment.sections.items[self.tlv_section_index.?]; |
| 1565 | 1566 | break :blk tlv.addr; |
| 1566 | 1567 | } |
| 1567 | 1568 | |
| 1568 | | log.warn(" | symbol stub '{s}'", .{sym.name}); |
| 1569 | log.debug(" | symbol stub '{s}'", .{sym.name}); |
| 1569 | 1570 | const segment = self.load_commands.items[self.text_segment_cmd_index.?].Segment; |
| 1570 | 1571 | const stubs = segment.sections.items[self.stubs_section_index.?]; |
| 1571 | 1572 | break :blk stubs.addr + proxy.base.stubs_index.? * stubs.reserved2; |
| ... | ... | @@ -2103,7 +2104,7 @@ fn writeGotEntries(self: *Zld) !void { |
| 2103 | 2104 | try writer.writeIntLittle(u64, address); |
| 2104 | 2105 | } |
| 2105 | 2106 | |
| 2106 | | log.warn("writing GOT pointers at 0x{x} to 0x{x}", .{ sect.offset, sect.offset + buffer.len }); |
| 2107 | log.debug("writing GOT pointers at 0x{x} to 0x{x}", .{ sect.offset, sect.offset + buffer.len }); |
| 2107 | 2108 | |
| 2108 | 2109 | try self.file.?.pwriteAll(buffer, sect.offset); |
| 2109 | 2110 | } |
| ... | ... | @@ -2189,7 +2190,7 @@ fn writeRebaseInfoTable(self: *Zld) !void { |
| 2189 | 2190 | dyld_info.rebase_size = @intCast(u32, mem.alignForwardGeneric(u64, buffer.len, @sizeOf(u64))); |
| 2190 | 2191 | seg.inner.filesize += dyld_info.rebase_size; |
| 2191 | 2192 | |
| 2192 | | log.warn("writing rebase info from 0x{x} to 0x{x}", .{ dyld_info.rebase_off, dyld_info.rebase_off + dyld_info.rebase_size }); |
| 2193 | log.debug("writing rebase info from 0x{x} to 0x{x}", .{ dyld_info.rebase_off, dyld_info.rebase_off + dyld_info.rebase_size }); |
| 2193 | 2194 | |
| 2194 | 2195 | try self.file.?.pwriteAll(buffer, dyld_info.rebase_off); |
| 2195 | 2196 | } |
| ... | ... | @@ -2248,7 +2249,7 @@ fn writeBindInfoTable(self: *Zld) !void { |
| 2248 | 2249 | dyld_info.bind_size = @intCast(u32, mem.alignForwardGeneric(u64, buffer.len, @alignOf(u64))); |
| 2249 | 2250 | seg.inner.filesize += dyld_info.bind_size; |
| 2250 | 2251 | |
| 2251 | | log.warn("writing binding info from 0x{x} to 0x{x}", .{ dyld_info.bind_off, dyld_info.bind_off + dyld_info.bind_size }); |
| 2252 | log.debug("writing binding info from 0x{x} to 0x{x}", .{ dyld_info.bind_off, dyld_info.bind_off + dyld_info.bind_size }); |
| 2252 | 2253 | |
| 2253 | 2254 | try self.file.?.pwriteAll(buffer, dyld_info.bind_off); |
| 2254 | 2255 | } |
| ... | ... | @@ -2290,7 +2291,7 @@ fn writeLazyBindInfoTable(self: *Zld) !void { |
| 2290 | 2291 | dyld_info.lazy_bind_size = @intCast(u32, mem.alignForwardGeneric(u64, buffer.len, @alignOf(u64))); |
| 2291 | 2292 | seg.inner.filesize += dyld_info.lazy_bind_size; |
| 2292 | 2293 | |
| 2293 | | log.warn("writing lazy binding info from 0x{x} to 0x{x}", .{ dyld_info.lazy_bind_off, dyld_info.lazy_bind_off + dyld_info.lazy_bind_size }); |
| 2294 | log.debug("writing lazy binding info from 0x{x} to 0x{x}", .{ dyld_info.lazy_bind_off, dyld_info.lazy_bind_off + dyld_info.lazy_bind_size }); |
| 2294 | 2295 | |
| 2295 | 2296 | try self.file.?.pwriteAll(buffer, dyld_info.lazy_bind_off); |
| 2296 | 2297 | try self.populateLazyBindOffsetsInStubHelper(buffer); |
| ... | ... | @@ -2394,7 +2395,7 @@ fn writeExportInfo(self: *Zld) !void { |
| 2394 | 2395 | dyld_info.export_size = @intCast(u32, mem.alignForwardGeneric(u64, buffer.len, @alignOf(u64))); |
| 2395 | 2396 | seg.inner.filesize += dyld_info.export_size; |
| 2396 | 2397 | |
| 2397 | | log.warn("writing export info from 0x{x} to 0x{x}", .{ dyld_info.export_off, dyld_info.export_off + dyld_info.export_size }); |
| 2398 | log.debug("writing export info from 0x{x} to 0x{x}", .{ dyld_info.export_off, dyld_info.export_off + dyld_info.export_size }); |
| 2398 | 2399 | |
| 2399 | 2400 | try self.file.?.pwriteAll(buffer, dyld_info.export_off); |
| 2400 | 2401 | } |
| ... | ... | @@ -2511,7 +2512,7 @@ fn writeDebugInfo(self: *Zld) !void { |
| 2511 | 2512 | |
| 2512 | 2513 | const stabs_off = symtab.symoff; |
| 2513 | 2514 | const stabs_size = symtab.nsyms * @sizeOf(macho.nlist_64); |
| 2514 | | log.warn("writing symbol stabs from 0x{x} to 0x{x}", .{ stabs_off, stabs_size + stabs_off }); |
| 2515 | log.debug("writing symbol stabs from 0x{x} to 0x{x}", .{ stabs_off, stabs_size + stabs_off }); |
| 2515 | 2516 | try self.file.?.pwriteAll(mem.sliceAsBytes(stabs.items), stabs_off); |
| 2516 | 2517 | |
| 2517 | 2518 | linkedit.inner.filesize += stabs_size; |
| ... | ... | @@ -2582,17 +2583,17 @@ fn writeSymbolTable(self: *Zld) !void { |
| 2582 | 2583 | |
| 2583 | 2584 | const locals_off = symtab.symoff + symtab.nsyms * @sizeOf(macho.nlist_64); |
| 2584 | 2585 | const locals_size = nlocals * @sizeOf(macho.nlist_64); |
| 2585 | | log.warn("writing local symbols from 0x{x} to 0x{x}", .{ locals_off, locals_size + locals_off }); |
| 2586 | log.debug("writing local symbols from 0x{x} to 0x{x}", .{ locals_off, locals_size + locals_off }); |
| 2586 | 2587 | try self.file.?.pwriteAll(mem.sliceAsBytes(locals.items), locals_off); |
| 2587 | 2588 | |
| 2588 | 2589 | const exports_off = locals_off + locals_size; |
| 2589 | 2590 | const exports_size = nexports * @sizeOf(macho.nlist_64); |
| 2590 | | log.warn("writing exported symbols from 0x{x} to 0x{x}", .{ exports_off, exports_size + exports_off }); |
| 2591 | log.debug("writing exported symbols from 0x{x} to 0x{x}", .{ exports_off, exports_size + exports_off }); |
| 2591 | 2592 | try self.file.?.pwriteAll(mem.sliceAsBytes(exports.items), exports_off); |
| 2592 | 2593 | |
| 2593 | 2594 | const undefs_off = exports_off + exports_size; |
| 2594 | 2595 | const undefs_size = nundefs * @sizeOf(macho.nlist_64); |
| 2595 | | log.warn("writing undefined symbols from 0x{x} to 0x{x}", .{ undefs_off, undefs_size + undefs_off }); |
| 2596 | log.debug("writing undefined symbols from 0x{x} to 0x{x}", .{ undefs_off, undefs_size + undefs_off }); |
| 2596 | 2597 | try self.file.?.pwriteAll(mem.sliceAsBytes(undefs.items), undefs_off); |
| 2597 | 2598 | |
| 2598 | 2599 | symtab.nsyms += @intCast(u32, nlocals + nexports + nundefs); |
| ... | ... | @@ -2622,7 +2623,7 @@ fn writeSymbolTable(self: *Zld) !void { |
| 2622 | 2623 | const needed_size = dysymtab.nindirectsyms * @sizeOf(u32); |
| 2623 | 2624 | seg.inner.filesize += needed_size; |
| 2624 | 2625 | |
| 2625 | | log.warn("writing indirect symbol table from 0x{x} to 0x{x}", .{ |
| 2626 | log.debug("writing indirect symbol table from 0x{x} to 0x{x}", .{ |
| 2626 | 2627 | dysymtab.indirectsymoff, |
| 2627 | 2628 | dysymtab.indirectsymoff + needed_size, |
| 2628 | 2629 | }); |
| ... | ... | @@ -2665,7 +2666,7 @@ fn writeStringTable(self: *Zld) !void { |
| 2665 | 2666 | symtab.strsize = @intCast(u32, mem.alignForwardGeneric(u64, self.strtab.items.len, @alignOf(u64))); |
| 2666 | 2667 | seg.inner.filesize += symtab.strsize; |
| 2667 | 2668 | |
| 2668 | | log.warn("writing string table from 0x{x} to 0x{x}", .{ symtab.stroff, symtab.stroff + symtab.strsize }); |
| 2669 | log.debug("writing string table from 0x{x} to 0x{x}", .{ symtab.stroff, symtab.stroff + symtab.strsize }); |
| 2669 | 2670 | |
| 2670 | 2671 | try self.file.?.pwriteAll(self.strtab.items, symtab.stroff); |
| 2671 | 2672 | |
| ... | ... | @@ -2711,7 +2712,7 @@ fn writeDataInCode(self: *Zld) !void { |
| 2711 | 2712 | dice_cmd.datasize = datasize; |
| 2712 | 2713 | seg.inner.filesize += datasize; |
| 2713 | 2714 | |
| 2714 | | log.warn("writing data-in-code from 0x{x} to 0x{x}", .{ fileoff, fileoff + datasize }); |
| 2715 | log.debug("writing data-in-code from 0x{x} to 0x{x}", .{ fileoff, fileoff + datasize }); |
| 2715 | 2716 | |
| 2716 | 2717 | try self.file.?.pwriteAll(buf.items, fileoff); |
| 2717 | 2718 | } |
| ... | ... | @@ -2732,7 +2733,7 @@ fn writeCodeSignaturePadding(self: *Zld) !void { |
| 2732 | 2733 | seg.inner.filesize += needed_size; |
| 2733 | 2734 | seg.inner.vmsize = mem.alignForwardGeneric(u64, seg.inner.filesize, self.page_size.?); |
| 2734 | 2735 | |
| 2735 | | log.warn("writing code signature padding from 0x{x} to 0x{x}", .{ fileoff, fileoff + needed_size }); |
| 2736 | log.debug("writing code signature padding from 0x{x} to 0x{x}", .{ fileoff, fileoff + needed_size }); |
| 2736 | 2737 | |
| 2737 | 2738 | // Pad out the space. We need to do this to calculate valid hashes for everything in the file |
| 2738 | 2739 | // except for code signature data. |
| ... | ... | @@ -2758,7 +2759,7 @@ fn writeCodeSignature(self: *Zld) !void { |
| 2758 | 2759 | var stream = std.io.fixedBufferStream(buffer); |
| 2759 | 2760 | try code_sig.write(stream.writer()); |
| 2760 | 2761 | |
| 2761 | | log.warn("writing code signature from 0x{x} to 0x{x}", .{ code_sig_cmd.dataoff, code_sig_cmd.dataoff + buffer.len }); |
| 2762 | log.debug("writing code signature from 0x{x} to 0x{x}", .{ code_sig_cmd.dataoff, code_sig_cmd.dataoff + buffer.len }); |
| 2762 | 2763 | try self.file.?.pwriteAll(buffer, code_sig_cmd.dataoff); |
| 2763 | 2764 | } |
| 2764 | 2765 | |
| ... | ... | @@ -2776,7 +2777,7 @@ fn writeLoadCommands(self: *Zld) !void { |
| 2776 | 2777 | } |
| 2777 | 2778 | |
| 2778 | 2779 | const off = @sizeOf(macho.mach_header_64); |
| 2779 | | log.warn("writing {} load commands from 0x{x} to 0x{x}", .{ self.load_commands.items.len, off, off + sizeofcmds }); |
| 2780 | log.debug("writing {} load commands from 0x{x} to 0x{x}", .{ self.load_commands.items.len, off, off + sizeofcmds }); |
| 2780 | 2781 | try self.file.?.pwriteAll(buffer, off); |
| 2781 | 2782 | } |
| 2782 | 2783 | |
| ... | ... | @@ -2814,7 +2815,7 @@ fn writeHeader(self: *Zld) !void { |
| 2814 | 2815 | for (self.load_commands.items) |cmd| { |
| 2815 | 2816 | header.sizeofcmds += cmd.cmdsize(); |
| 2816 | 2817 | } |
| 2817 | | log.warn("writing Mach-O header {}", .{header}); |
| 2818 | log.debug("writing Mach-O header {}", .{header}); |
| 2818 | 2819 | try self.file.?.pwriteAll(mem.asBytes(&header), 0); |
| 2819 | 2820 | } |
| 2820 | 2821 | |
| ... | ... | @@ -2827,13 +2828,13 @@ pub fn makeStaticString(bytes: []const u8) [16]u8 { |
| 2827 | 2828 | |
| 2828 | 2829 | fn makeString(self: *Zld, bytes: []const u8) !u32 { |
| 2829 | 2830 | if (self.strtab_dir.get(bytes)) |offset| { |
| 2830 | | log.warn("reusing '{s}' from string table at offset 0x{x}", .{ bytes, offset }); |
| 2831 | log.debug("reusing '{s}' from string table at offset 0x{x}", .{ bytes, offset }); |
| 2831 | 2832 | return offset; |
| 2832 | 2833 | } |
| 2833 | 2834 | |
| 2834 | 2835 | try self.strtab.ensureCapacity(self.allocator, self.strtab.items.len + bytes.len + 1); |
| 2835 | 2836 | const offset = @intCast(u32, self.strtab.items.len); |
| 2836 | | log.warn("writing new string '{s}' into string table at offset 0x{x}", .{ bytes, offset }); |
| 2837 | log.debug("writing new string '{s}' into string table at offset 0x{x}", .{ bytes, offset }); |
| 2837 | 2838 | self.strtab.appendSliceAssumeCapacity(bytes); |
| 2838 | 2839 | self.strtab.appendAssumeCapacity(0); |
| 2839 | 2840 | try self.strtab_dir.putNoClobber(self.allocator, try self.allocator.dupe(u8, bytes), offset); |
| ... | ... | @@ -2851,31 +2852,31 @@ pub fn parseName(name: *const [16]u8) []const u8 { |
| 2851 | 2852 | } |
| 2852 | 2853 | |
| 2853 | 2854 | fn printSymbols(self: *Zld) void { |
| 2854 | | log.warn("globals", .{}); |
| 2855 | log.debug("globals", .{}); |
| 2855 | 2856 | for (self.globals.items()) |entry| { |
| 2856 | 2857 | const sym = entry.value.cast(Symbol.Regular) orelse unreachable; |
| 2857 | | log.warn(" | {s} @ {*}", .{ sym.base.name, entry.value }); |
| 2858 | | log.warn(" => alias of {*}", .{sym.base.alias}); |
| 2859 | | log.warn(" => linkage {s}", .{sym.linkage}); |
| 2860 | | log.warn(" => defined in {s}", .{sym.file.name.?}); |
| 2858 | log.debug(" | {s} @ {*}", .{ sym.base.name, entry.value }); |
| 2859 | log.debug(" => alias of {*}", .{sym.base.alias}); |
| 2860 | log.debug(" => linkage {s}", .{sym.linkage}); |
| 2861 | log.debug(" => defined in {s}", .{sym.file.name.?}); |
| 2861 | 2862 | } |
| 2862 | 2863 | for (self.objects.items) |object| { |
| 2863 | | log.warn("locals in {s}", .{object.name.?}); |
| 2864 | log.debug("locals in {s}", .{object.name.?}); |
| 2864 | 2865 | for (object.symbols.items) |sym| { |
| 2865 | | log.warn(" | {s} @ {*}", .{ sym.name, sym }); |
| 2866 | | log.warn(" => alias of {*}", .{sym.alias}); |
| 2866 | log.debug(" | {s} @ {*}", .{ sym.name, sym }); |
| 2867 | log.debug(" => alias of {*}", .{sym.alias}); |
| 2867 | 2868 | if (sym.cast(Symbol.Regular)) |reg| { |
| 2868 | | log.warn(" => linkage {s}", .{reg.linkage}); |
| 2869 | log.debug(" => linkage {s}", .{reg.linkage}); |
| 2869 | 2870 | } else { |
| 2870 | | log.warn(" => unresolved", .{}); |
| 2871 | log.debug(" => unresolved", .{}); |
| 2871 | 2872 | } |
| 2872 | 2873 | } |
| 2873 | 2874 | } |
| 2874 | | log.warn("proxies", .{}); |
| 2875 | log.debug("proxies", .{}); |
| 2875 | 2876 | for (self.imports.items()) |entry| { |
| 2876 | 2877 | const sym = entry.value.cast(Symbol.Proxy) orelse unreachable; |
| 2877 | | log.warn(" | {s} @ {*}", .{ sym.base.name, entry.value }); |
| 2878 | | log.warn(" => alias of {*}", .{sym.base.alias}); |
| 2879 | | log.warn(" => defined in libSystem.B.dylib", .{}); |
| 2878 | log.debug(" | {s} @ {*}", .{ sym.base.name, entry.value }); |
| 2879 | log.debug(" => alias of {*}", .{sym.base.alias}); |
| 2880 | log.debug(" => defined in libSystem.B.dylib", .{}); |
| 2880 | 2881 | } |
| 2881 | 2882 | } |