Skip to content

Commit

Permalink
Merge pull request #1187 from aokblast/fix/fileoffset
Browse files Browse the repository at this point in the history
  • Loading branch information
rui314 authored Feb 3, 2024
2 parents 2535137 + 8c99dd0 commit c9651d9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion elf/passes.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit c9651d9

Please sign in to comment.