Skip to content

Commit

Permalink
Merge pull request #240 from dfuchsgruber/master
Browse files Browse the repository at this point in the history
Fixes #239
  • Loading branch information
Kingcom authored Sep 21, 2023
2 parents 4f414f3 + 7cbf7bf commit a8d71f0
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions Core/ELF/ElfRelocator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -301,14 +301,21 @@ bool ElfRelocator::relocateFile(ElfRelocatorFile& file, int64_t& relocationAddre
size_t index = entry.index;
int size = section->getSize();

while (relocationAddress % section->getAlignment())
relocationAddress++;
if (section->getType() == SHT_NOBITS)
{
// these sections should not be relocated...
relocationOffsets[index] = section->getAddress();

} else {
while (relocationAddress % section->getAlignment())
relocationAddress++;

if (entry.label != nullptr)
entry.label->setValue(relocationAddress);
if (entry.label != nullptr)
entry.label->setValue(relocationAddress);

relocationOffsets[index] = relocationAddress;
relocationAddress += size;
relocationOffsets[index] = relocationAddress;
relocationAddress += size;
}
}

size_t dataStart = outputData.size();
Expand Down

0 comments on commit a8d71f0

Please sign in to comment.