mirror of
https://github.com/rui314/mold.git
synced 2024-11-10 19:26:38 +03:00
[Mach-O] wip
This commit is contained in:
parent
c7243f6c5c
commit
e8aa31cd8b
@ -73,8 +73,6 @@ void create_synthetic_sections(Context &ctx) {
|
||||
}
|
||||
|
||||
void compute_seg_sizes(Context &ctx) {
|
||||
for (OutputSegment *seg : ctx.segments)
|
||||
seg->update_hdr(ctx);
|
||||
}
|
||||
|
||||
i64 assign_offsets(Context &ctx) {
|
||||
@ -82,12 +80,15 @@ i64 assign_offsets(Context &ctx) {
|
||||
i64 vmaddr = PAGE_ZERO_SIZE;
|
||||
|
||||
for (OutputSegment *seg : ctx.segments) {
|
||||
fileoff = align_to(fileoff, PAGE_SIZE);
|
||||
seg->cmd.fileoff = fileoff;
|
||||
fileoff += seg->cmd.filesize;
|
||||
assert(seg->cmd.filesize % PAGE_SIZE == 0);
|
||||
assert(seg->cmd.vmsize % PAGE_SIZE == 0);
|
||||
|
||||
vmaddr = align_to(vmaddr, PAGE_SIZE);
|
||||
seg->cmd.fileoff = fileoff;
|
||||
seg->cmd.vmaddr = vmaddr;
|
||||
|
||||
seg->update_hdr(ctx);
|
||||
|
||||
fileoff += seg->cmd.filesize;
|
||||
vmaddr += seg->cmd.vmsize;
|
||||
}
|
||||
|
||||
|
@ -255,6 +255,7 @@ void OutputSegment::update_hdr(Context &ctx) {
|
||||
fileoff += sec->hdr.size;
|
||||
}
|
||||
|
||||
fileoff = align_to(fileoff, PAGE_SIZE);
|
||||
cmd.vmsize = fileoff;
|
||||
cmd.filesize = fileoff;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user