1
1
mirror of https://github.com/rui314/mold.git synced 2024-10-05 17:17:40 +03:00

Do not create an unnecessary gap in file for BSS

Fixes https://github.com/rui314/mold/issues/1216
This commit is contained in:
Rui Ueyama 2024-03-13 16:01:02 +09:00
parent 16b0564d49
commit c395da1c54

View File

@ -2505,7 +2505,6 @@ 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;
@ -2548,10 +2547,9 @@ 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) {
fileoff = align_to(fileoff, chunks[i]->shdr.sh_addralign);
chunks[i]->shdr.sh_offset = fileoff;
i++;
}
}
}
return fileoff;