mirror of
https://github.com/ziglang/zig.git
synced 2026-01-05 04:53:17 +00:00
zld: dealloc TextBlock if omitted
This commit is contained in:
parent
555b66c255
commit
dfa69e3c30
@ -512,10 +512,10 @@ pub fn parseTextBlocks(self: *Object, zld: *Zld) !void {
|
||||
const relocs = mem.bytesAsSlice(macho.relocation_info, raw_relocs);
|
||||
|
||||
// Is there any padding between symbols within the section?
|
||||
const is_padded = self.header.?.flags & macho.MH_SUBSECTIONS_VIA_SYMBOLS != 0;
|
||||
const is_splittable = self.header.?.flags & macho.MH_SUBSECTIONS_VIA_SYMBOLS != 0;
|
||||
|
||||
next: {
|
||||
if (is_padded) blocks: {
|
||||
if (is_splittable) blocks: {
|
||||
const filtered_nlists = NlistWithIndex.filterInSection(
|
||||
sorted_nlists.items,
|
||||
sect_id + 1,
|
||||
@ -540,6 +540,8 @@ pub fn parseTextBlocks(self: *Object, zld: *Zld) !void {
|
||||
if (reg.file) |file| {
|
||||
if (file != self) {
|
||||
log.warn("deduping definition of {s} in {s}", .{ sym.name, self.name.? });
|
||||
block.deinit(self.allocator);
|
||||
self.allocator.destroy(block);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
@ -147,7 +147,7 @@ pub const TextBlock = struct {
|
||||
}
|
||||
block.relocs.deinit();
|
||||
block.references.deinit();
|
||||
allocator.free(code);
|
||||
allocator.free(block.code);
|
||||
}
|
||||
|
||||
pub fn print_this(self: *const TextBlock, zld: *Zld) void {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user