1
1
mirror of https://github.com/rui314/mold.git synced 2024-09-17 16:09:43 +03:00

Feat: use accumulate address on sections with SHT_ALLOC

This commit is contained in:
aokblast 2024-02-03 22:03:55 +08:00
parent 25351379ab
commit 8c99dd0f2c
No known key found for this signature in database
GPG Key ID: F21D0E3FAD221571

View File

@ -2457,6 +2457,8 @@ static i64 set_file_offsets(Context<E> &ctx) {
}
if (first.shdr.sh_type == SHT_NOBITS) {
fileoff = align_to(fileoff, first.shdr.sh_addralign);
first.shdr.sh_offset = fileoff;
i++;
continue;
}
@ -2497,8 +2499,11 @@ static i64 set_file_offsets(Context<E> &ctx) {
while (i < chunks.size() &&
(chunks[i]->shdr.sh_flags & SHF_ALLOC) &&
chunks[i]->shdr.sh_type == SHT_NOBITS)
chunks[i]->shdr.sh_type == SHT_NOBITS) {
fileoff = align_to(fileoff, chunks[i]->shdr.sh_addralign);
chunks[i]->shdr.sh_offset = fileoff;
i++;
}
}
return fileoff;