mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-05 09:09:04 +08:00
Do not resolve external functions when none passed
This commit adds check in Linker::resolveExternalFunctions checking if external functions are present before trying to resolve dependencies and adds default values for ExternalFunctionInfo. Signed-off-by: Krystian Chmielewski <krystian.chmielewski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
0f54a57910
commit
439389ae19
@@ -2357,10 +2357,28 @@ TEST(LinkerTests, givenDependencyOnMissingExternalFunctionWhenLinkingThenFail) {
|
||||
NEO::Linker::PatchableSegments patchableInstructionSegments;
|
||||
NEO::Linker::UnresolvedExternals unresolvedExternals;
|
||||
NEO::Linker::KernelDescriptorsT kernelDescriptors;
|
||||
NEO::Linker::ExternalFunctionsT externalFunctions;
|
||||
NEO::Linker::ExternalFunctionsT externalFunctions = {{"fun1", 0U, 128U, 8U}};
|
||||
auto linkResult = linker.link(
|
||||
globalVar, globalConst, exportedFunc, {},
|
||||
patchableGlobalVarSeg, patchableConstVarSeg, patchableInstructionSegments,
|
||||
unresolvedExternals, nullptr, nullptr, nullptr, kernelDescriptors, externalFunctions);
|
||||
EXPECT_EQ(LinkingStatus::Error, linkResult);
|
||||
}
|
||||
|
||||
TEST(LinkerTests, givenDependencyOnMissingExternalFunctionAndNoExternalFunctionInfosWhenLinkingThenDoNotResolveDependenciesAndReturnSuccess) {
|
||||
WhiteBox<NEO::LinkerInput> linkerInput;
|
||||
linkerInput.extFunDependencies.push_back({"fun0", "fun1"});
|
||||
NEO::Linker linker(linkerInput);
|
||||
NEO::Linker::SegmentInfo globalVar, globalConst, exportedFunc;
|
||||
NEO::GraphicsAllocation *patchableGlobalVarSeg = nullptr;
|
||||
NEO::GraphicsAllocation *patchableConstVarSeg = nullptr;
|
||||
NEO::Linker::PatchableSegments patchableInstructionSegments;
|
||||
NEO::Linker::UnresolvedExternals unresolvedExternals;
|
||||
NEO::Linker::KernelDescriptorsT kernelDescriptors;
|
||||
NEO::Linker::ExternalFunctionsT externalFunctions;
|
||||
auto linkResult = linker.link(
|
||||
globalVar, globalConst, exportedFunc, {},
|
||||
patchableGlobalVarSeg, patchableConstVarSeg, patchableInstructionSegments,
|
||||
unresolvedExternals, nullptr, nullptr, nullptr, kernelDescriptors, externalFunctions);
|
||||
EXPECT_EQ(LinkingStatus::LinkedFully, linkResult);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user