fix(debug zebin): handle misaligned access

Handle misaligned access when aplying debug relocations in zebin.
Debug relocations entries have offsets which are not of natural
alignment, and need to be specificialy handled.

Signed-off-by: Krystian Chmielewski <krystian.chmielewski@intel.com>
This commit is contained in:
Krystian Chmielewski
2022-11-29 11:56:04 +00:00
committed by Compute-Runtime-Automation
parent 6806a0fb36
commit d4fe9298bf
5 changed files with 45 additions and 12 deletions

View File

@@ -47,7 +47,7 @@ class DebugZebinCreator {
inline std::vector<uint8_t> getDebugZebin() { return debugZebin; }
protected:
void applyRelocation(uint64_t addr, uint64_t value, NEO::Elf::RELOC_TYPE_ZEBIN type);
void applyRelocation(uintptr_t addr, uint64_t value, NEO::Elf::RELOC_TYPE_ZEBIN type);
bool isRelocTypeSupported(NEO::Elf::RELOC_TYPE_ZEBIN type);
const Segments::Segment *getSegmentByName(ConstStringRef sectionName);
const Segments::Segment *getTextSegmentByName(ConstStringRef textSegmentName);
@@ -59,6 +59,9 @@ class DebugZebinCreator {
std::vector<uint8_t> debugZebin;
};
template <typename T>
void patchWithValue(uintptr_t addr, T value);
std::vector<uint8_t> createDebugZebin(ArrayRef<const uint8_t> zebin, const Segments &segmentData);
} // namespace Debug
} // namespace NEO