diff --git a/shared/source/compiler_interface/linker.cpp b/shared/source/compiler_interface/linker.cpp index 63d879afe5..542f80053e 100644 --- a/shared/source/compiler_interface/linker.cpp +++ b/shared/source/compiler_interface/linker.cpp @@ -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 &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(relocation.offset)); auto symbolIt = relocatedSymbols.find(relocation.symbolName); diff --git a/shared/source/compiler_interface/linker.h b/shared/source/compiler_interface/linker.h index 3294a74e86..e3b921eb9b 100644 --- a/shared/source/compiler_interface/linker.h +++ b/shared/source/compiler_interface/linker.h @@ -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 &instructionsSegmentsNames); std::string constructRelocationsDebugMessage(const Linker::RelocatedSymbolsMap &relocatedSymbols); +constexpr bool shouldIgnoreRelocation(const LinkerInput::RelocationInfo &relocation) { + return LinkerInput::RelocationInfo::Type::PerThreadPayloadOffset == relocation.type; +} } // namespace NEO diff --git a/shared/test/unit_test/compiler_interface/linker_tests.cpp b/shared/test/unit_test/compiler_interface/linker_tests.cpp index 6b72760f69..ef3e13ebc9 100644 --- a/shared/test/unit_test/compiler_interface/linker_tests.cpp +++ b/shared/test/unit_test/compiler_interface/linker_tests.cpp @@ -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);