Create debug zebin

Creates copy of zebinary with program headers containing
addresses of segments and applies debug relocations.


Related-To: NEO-6071
Signed-off-by: Krystian Chmielewski <krystian.chmielewski@intel.com>
This commit is contained in:
Krystian Chmielewski
2021-07-20 14:40:35 +00:00
committed by Compute-Runtime-Automation
parent c7d86af500
commit 1417e894c7
10 changed files with 390 additions and 5 deletions

View File

@@ -275,6 +275,7 @@ bool Linker::processRelocations(const SegmentInfo &globalVariables, const Segmen
uint32_t addressSizeInBytes(LinkerInput::RelocationInfo::Type relocationtype) {
return (relocationtype == LinkerInput::RelocationInfo::Type::Address) ? sizeof(uintptr_t) : sizeof(uint32_t);
}
void Linker::patchAddress(void *relocAddress, const Linker::RelocatedSymbol &symbol, const Linker::RelocationInfo &relocation) {
uint64_t gpuAddressAs64bit = static_cast<uint64_t>(symbol.gpuAddress);
switch (relocation.type) {
@@ -429,7 +430,7 @@ void Linker::applyDebugDataRelocations(const NEO::Elf::Elf<NEO::Elf::EI_CLASS_64
for (auto &reloc : decodedElf.getDebugInfoRelocations()) {
auto targetSectionName = decodedElf.getSectionName(reloc.targetSectionIndex);
auto sectionName = decodedElf.getSectionName(reloc.symbolSectionIndex);
auto symbolAddress = decodedElf.getSymbolAddress(reloc.symbolTableIndex);
auto symbolAddress = decodedElf.getSymbolValue(reloc.symbolTableIndex);
if (sectionName == Elf::SpecialSectionNames::text) {
symbolAddress += text.gpuAddress;