Fix debug zebin creation

- ELF type is EXEC
- Absolute GPU addresses in program headers as load addresses
- All relocations are applied (not only for debug info as before)
- Default section alignment for debug zebin is set to 4,
this fix the problem with .notes section parsing

Related-To: NEO-5571
Signed-off-by: Igor Venevtsev <igor.venevtsev@intel.com>
This commit is contained in:
Igor Venevtsev
2022-01-19 18:03:32 +00:00
committed by Compute-Runtime-Automation
parent f8c104feaa
commit af7a475cb0
7 changed files with 71 additions and 83 deletions

View File

@ -17,13 +17,13 @@ TEST_F(ProgramWithZebinFixture, givenNoZebinThenSegmentsAreEmpty) {
auto segments = program->getZebinSegments(pClDevice->getRootDeviceIndex());
EXPECT_EQ(std::numeric_limits<uintptr_t>::max(), segments.constData.address);
EXPECT_TRUE(segments.constData.data.empty());
EXPECT_EQ(0ULL, segments.constData.size);
EXPECT_EQ(std::numeric_limits<uintptr_t>::max(), segments.varData.address);
EXPECT_TRUE(segments.varData.data.empty());
EXPECT_EQ(0ULL, segments.varData.size);
EXPECT_EQ(std::numeric_limits<uintptr_t>::max(), segments.stringData.address);
EXPECT_TRUE(segments.stringData.data.empty());
EXPECT_EQ(0ULL, segments.stringData.size);
EXPECT_TRUE(segments.nameToSegMap.empty());
}
@ -33,17 +33,16 @@ TEST_F(ProgramWithZebinFixture, givenZebinSegmentsThenSegmentsArePopulated) {
auto segments = program->getZebinSegments(rootDeviceIndex);
auto checkGPUSeg = [](NEO::GraphicsAllocation *alloc, NEO::Debug::Segments::Segment segment) {
EXPECT_EQ(static_cast<uintptr_t>(alloc->getGpuAddressToPatch()), segment.address);
EXPECT_EQ(reinterpret_cast<uint8_t *>(alloc->getUnderlyingBuffer()), segment.data.begin());
EXPECT_EQ(static_cast<size_t>(alloc->getUnderlyingBufferSize()), segment.data.size());
EXPECT_EQ(static_cast<uintptr_t>(alloc->getGpuAddress()), segment.address);
EXPECT_EQ(static_cast<size_t>(alloc->getUnderlyingBufferSize()), segment.size);
};
checkGPUSeg(program->buildInfos[rootDeviceIndex].constantSurface, segments.constData);
checkGPUSeg(program->buildInfos[rootDeviceIndex].globalSurface, segments.varData);
checkGPUSeg(program->getKernelInfoArray(rootDeviceIndex)[0]->getGraphicsAllocation(), segments.nameToSegMap["kernel1"]);
EXPECT_EQ(reinterpret_cast<uintptr_t>(program->buildInfos[rootDeviceIndex].constStringSectionData.initData), segments.stringData.address);
EXPECT_EQ(reinterpret_cast<const uint8_t *>(program->buildInfos[rootDeviceIndex].constStringSectionData.initData), segments.stringData.data.begin());
EXPECT_EQ(program->buildInfos[rootDeviceIndex].constStringSectionData.size, segments.stringData.data.size());
EXPECT_EQ(reinterpret_cast<const char *>(program->buildInfos[rootDeviceIndex].constStringSectionData.initData), strings);
EXPECT_EQ(program->buildInfos[rootDeviceIndex].constStringSectionData.size, sizeof(strings));
}
TEST_F(ProgramWithZebinFixture, givenNonEmptyDebugDataThenDebugZebinIsNotCreated) {
@ -79,4 +78,4 @@ TEST_F(ProgramWithDebugDataCreationFixture, givenNonZebinaryFormatInCreateDebugD
programWithDebugDataCreation->createDebugData(rootDeviceIndex);
EXPECT_FALSE(programWithDebugDataCreation->wasCreateDebugZebinCalled);
EXPECT_TRUE(programWithDebugDataCreation->wasProcessDebugDataCalled);
}
}