diff --git a/macho/main.cc b/macho/main.cc index cea33bae..91d69ed9 100644 --- a/macho/main.cc +++ b/macho/main.cc @@ -85,10 +85,6 @@ static void export_symbols(Context &ctx) { } static i64 assign_offsets(Context &ctx) { - for (OutputSegment *seg : ctx.segments) - for (Chunk *chunk : seg->chunks) - chunk->compute_size(ctx); - i64 fileoff = 0; i64 vmaddr = PAGE_ZERO_SIZE; diff --git a/macho/output-chunks.cc b/macho/output-chunks.cc index 191d2fc3..50e63db7 100644 --- a/macho/output-chunks.cc +++ b/macho/output-chunks.cc @@ -277,6 +277,7 @@ void OutputSegment::set_offset(Context &ctx, i64 fileoff, u64 vmaddr) { offset = align_to(offset, 1 << sec->hdr.p2align); sec->hdr.addr = vmaddr + offset; sec->hdr.offset = fileoff + offset; + sec->compute_size(ctx); offset += sec->hdr.size; }