mirror of
https://github.com/ziglang/zig.git
synced 2026-01-11 01:45:12 +00:00
elf: skip writing non-alloc and zerofill atoms
This commit is contained in:
parent
a9f1b994bd
commit
d4c1e85a13
@ -1690,7 +1690,11 @@ fn writeObjects(self: *Elf) !void {
|
||||
if (!atom_ptr.alive) continue;
|
||||
|
||||
const shdr = &self.shdrs.items[atom_ptr.output_section_index];
|
||||
if (shdr.sh_type == elf.SHT_NOBITS) continue;
|
||||
if (shdr.sh_flags & elf.SHF_ALLOC == 0) continue; // TODO we don't yet know how to handle non-alloc sections
|
||||
|
||||
const file_offset = shdr.sh_offset + atom_ptr.value - shdr.sh_addr;
|
||||
log.debug("writing atom({d}) at 0x{x}", .{ atom_ptr.atom_index, file_offset });
|
||||
const code = try atom_ptr.codeInObjectUncompressAlloc(self);
|
||||
defer gpa.free(code);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user