This commit is contained in:
Christian Speckner 2024-07-12 23:33:57 +02:00
parent 9c1231bd61
commit 885c404f20
1 changed files with 3 additions and 3 deletions

View File

@ -352,19 +352,19 @@ void ElfLinker::applyRelocationsToInitArrays(uInt8 initArrayType, vector<uInt32>
for (const auto& relocation: *relocations) { for (const auto& relocation: *relocations) {
if (relocation.type != ElfParser::R_ARM_ABS32 && relocation.type != ElfParser::R_ARM_TARGET1) if (relocation.type != ElfParser::R_ARM_ABS32 && relocation.type != ElfParser::R_ARM_TARGET1)
ElfLinkError::raise("unsupported relocation for init table"); ElfLinkError::raise("unsupported relocation for init array");
const auto& relocatedSymbol = myRelocatedSymbols[relocation.symbol]; const auto& relocatedSymbol = myRelocatedSymbols[relocation.symbol];
if (!relocatedSymbol) if (!relocatedSymbol)
ElfLinkError::raise( ElfLinkError::raise(
"unable to relocate init section: symbol " + relocation.symbolName + " could not be relocated" "unable to relocate init array: symbol " + relocation.symbolName + " could not be relocated"
); );
if (relocatedSymbol->undefined) if (relocatedSymbol->undefined)
Logger::error("unable to relocate symbol " + relocation.symbolName); Logger::error("unable to relocate symbol " + relocation.symbolName);
if (relocation.offset + 4 > section.size) if (relocation.offset + 4 > section.size)
ElfLinkError::raise("unable relocate init section: symbol " + relocation.symbolName + " out of range"); ElfLinkError::raise("unable relocate init array: symbol " + relocation.symbolName + " out of range");
const uInt32 index = (relocatedInitArrays.at(iSection) + relocation.offset) >> 2; const uInt32 index = (relocatedInitArrays.at(iSection) + relocation.offset) >> 2;
const uInt32 value = relocatedSymbol->value + relocation.addend.value_or(initArray[index]); const uInt32 value = relocatedSymbol->value + relocation.addend.value_or(initArray[index]);