Skip to content

Commit

Permalink
Do not create an unnecessary gap in file for BSS
Browse files Browse the repository at this point in the history
Fixes #1216
  • Loading branch information
rui314 committed Mar 13, 2024
1 parent 16b0564 commit c395da1
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions elf/passes.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit c395da1

Please sign in to comment.