mirror of
https://github.com/ziglang/zig.git
synced 2025-12-07 14:53:08 +00:00
elf: reset (merge) sections sizes before updating
This commit is contained in:
parent
db3db1150e
commit
82cf762b02
@ -19,6 +19,9 @@ pub fn offset(list: AtomList, elf_file: *Elf) u64 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn updateSize(list: *AtomList, elf_file: *Elf) void {
|
pub fn updateSize(list: *AtomList, elf_file: *Elf) void {
|
||||||
|
// TODO perhaps a 'stale' flag would be better here?
|
||||||
|
list.size = 0;
|
||||||
|
list.alignment = .@"1";
|
||||||
for (list.atoms.items) |ref| {
|
for (list.atoms.items) |ref| {
|
||||||
const atom_ptr = elf_file.atom(ref).?;
|
const atom_ptr = elf_file.atom(ref).?;
|
||||||
assert(atom_ptr.alive);
|
assert(atom_ptr.alive);
|
||||||
|
|||||||
@ -95,6 +95,10 @@ pub const MergeSection = struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn updateSize(msec: *MergeSection) void {
|
pub fn updateSize(msec: *MergeSection) void {
|
||||||
|
// TODO a 'stale' flag would be better here perhaps?
|
||||||
|
msec.size = 0;
|
||||||
|
msec.alignment = .@"1";
|
||||||
|
msec.entsize = 0;
|
||||||
for (msec.finalized_subsections.items) |msub_index| {
|
for (msec.finalized_subsections.items) |msub_index| {
|
||||||
const msub = msec.mergeSubsection(msub_index);
|
const msub = msec.mergeSubsection(msub_index);
|
||||||
assert(msub.alive);
|
assert(msub.alive);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user