Linker: Fix incremental patching for local memory allocations

Change-Id: Ib85e4a2abc8a62477003853aa0c35f8107444f4e
Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
Bartosz Dunajski
2020-10-07 15:32:03 +02:00
committed by sys_ocldev
parent 2643346b48
commit fb0651521d
24 changed files with 115 additions and 73 deletions

View File

@@ -7,7 +7,9 @@
#include "shared/source/helpers/ptr_math.h"
#include "shared/source/memory_manager/graphics_allocation.h"
#include "shared/test/unit_test/helpers/default_hw_info.h"
#include "opencl/test/unit_test/mocks/mock_cl_device.h"
#include "opencl/test/unit_test/mocks/mock_graphics_allocation.h"
#include "RelocationInfo.h"
@@ -785,9 +787,12 @@ TEST(LinkerTests, givenValidSymbolsAndRelocationsThenDataSegmentsAreProperlyPatc
++initValue;
}
auto device = std::unique_ptr<NEO::MockDevice>(NEO::MockDevice::createWithNewExecutionEnvironment<NEO::MockDevice>(NEO::defaultHwInfo.get()));
auto linkResult = linker.link(globalVariablesSegmentInfo, globalConstantsSegmentInfo, {},
&globalVariablesPatchableSegment, &globalConstantsPatchableSegment, {},
unresolvedExternals, nullptr, nullptr, nullptr);
unresolvedExternals, device.get(), globalConstantsPatchableSegment.getUnderlyingBuffer(),
globalVariablesPatchableSegment.getUnderlyingBuffer());
EXPECT_EQ(NEO::LinkingStatus::LinkedFully, linkResult);
EXPECT_EQ(0U, unresolvedExternals.size());
EXPECT_EQ(7U, *reinterpret_cast<uint8_t *>(globalConstantsPatchableSegment.getUnderlyingBuffer()));
@@ -884,9 +889,12 @@ TEST(LinkerTests, givenValidSymbolsAndRelocationsWhenPatchin32bitBinaryThenDataS
++initValue;
}
auto device = std::unique_ptr<NEO::MockDevice>(NEO::MockDevice::createWithNewExecutionEnvironment<NEO::MockDevice>(NEO::defaultHwInfo.get()));
auto linkResult = linker.link(globalVariablesSegmentInfo, globalConstantsSegmentInfo, {},
&globalVariablesPatchableSegment, &globalConstantsPatchableSegment, {},
unresolvedExternals, nullptr, nullptr, nullptr);
unresolvedExternals, device.get(), globalConstantsPatchableSegment.getUnderlyingBuffer(),
globalVariablesPatchableSegment.getUnderlyingBuffer());
EXPECT_EQ(NEO::LinkingStatus::LinkedFully, linkResult);
EXPECT_EQ(0U, unresolvedExternals.size());
EXPECT_EQ(7U, *reinterpret_cast<uint8_t *>(globalConstantsPatchableSegment.getUnderlyingBuffer()));