Adding support for R_PER_THREAD_PAYLOAD_OFFSET_32
Change-Id: Iacd8d2f84b6f307b37dd09fe794357bf4fa44388
This commit is contained in:
parent
b9b01c09bc
commit
6c0da29670
|
@ -112,6 +112,9 @@ bool LinkerInput::decodeRelocationTable(const void *data, uint32_t numEntries, u
|
|||
case vISA::R_SYM_ADDR_32_HI:
|
||||
relocInfo.type = RelocationInfo::Type::AddressHigh;
|
||||
break;
|
||||
case vISA::R_PER_THREAD_PAYLOAD_OFFSET_32:
|
||||
relocInfo.type = RelocationInfo::Type::PerThreadPayloadOffset;
|
||||
break;
|
||||
}
|
||||
outRelocInfo.push_back(std::move(relocInfo));
|
||||
}
|
||||
|
@ -185,6 +188,9 @@ void Linker::patchInstructionsSegments(const std::vector<PatchableSegment> &inst
|
|||
auto &thisSegmentRelocs = *relocsIt;
|
||||
const PatchableSegment &instSeg = *segIt;
|
||||
for (const auto &relocation : thisSegmentRelocs) {
|
||||
if (shouldIgnoreRelocation(relocation)) {
|
||||
continue;
|
||||
}
|
||||
UNRECOVERABLE_IF(nullptr == instSeg.hostPointer);
|
||||
auto relocAddress = ptrOffset(instSeg.hostPointer, static_cast<uintptr_t>(relocation.offset));
|
||||
auto symbolIt = relocatedSymbols.find(relocation.symbolName);
|
||||
|
|
|
@ -78,7 +78,8 @@ struct LinkerInput {
|
|||
Unknown,
|
||||
Address,
|
||||
AddressHigh,
|
||||
AddressLow
|
||||
AddressLow,
|
||||
PerThreadPayloadOffset
|
||||
};
|
||||
|
||||
std::string symbolName;
|
||||
|
@ -207,5 +208,8 @@ struct Linker {
|
|||
|
||||
std::string constructLinkerErrorMessage(const Linker::UnresolvedExternals &unresolvedExternals, const std::vector<std::string> &instructionsSegmentsNames);
|
||||
std::string constructRelocationsDebugMessage(const Linker::RelocatedSymbolsMap &relocatedSymbols);
|
||||
constexpr bool shouldIgnoreRelocation(const LinkerInput::RelocationInfo &relocation) {
|
||||
return LinkerInput::RelocationInfo::Type::PerThreadPayloadOffset == relocation.type;
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
|
|
|
@ -377,8 +377,14 @@ TEST(LinkerTests, givenValidSymbolsAndRelocationsThenInstructionSegmentsArePrope
|
|||
relocCPartLow.r_offset = 36;
|
||||
relocCPartLow.r_type = vISA::GenRelocType::R_SYM_ADDR_32;
|
||||
|
||||
vISA::GenRelocEntry relocs[] = {relocA, relocB, relocC, relocCPartHigh, relocCPartLow};
|
||||
bool decodeRelocSuccess = linkerInput.decodeRelocationTable(&relocs, 5, 0);
|
||||
vISA::GenRelocEntry relocIgnore = {};
|
||||
relocIgnore.r_symbol[0] = 'X';
|
||||
relocIgnore.r_offset = 36;
|
||||
relocIgnore.r_type = vISA::GenRelocType::R_PER_THREAD_PAYLOAD_OFFSET_32;
|
||||
|
||||
vISA::GenRelocEntry relocs[] = {relocA, relocB, relocC, relocCPartHigh, relocCPartLow, relocIgnore};
|
||||
constexpr uint32_t numRelocations = sizeof(relocs) / sizeof(relocs[0]);
|
||||
bool decodeRelocSuccess = linkerInput.decodeRelocationTable(&relocs, numRelocations, 0);
|
||||
EXPECT_TRUE(decodeRelocSuccess);
|
||||
|
||||
NEO::Linker linker(linkerInput);
|
||||
|
|
Loading…
Reference in New Issue