Allow undefined symbols in symbol table for OCL
Related-To: NEO-5081 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
parent
038d1d54fa
commit
3e8a6680e2
|
@ -300,7 +300,6 @@ bool ModuleTranslationUnit::processUnpackedBinary() {
|
|||
|
||||
NEO::DecodeError decodeError;
|
||||
NEO::DeviceBinaryFormat singleDeviceBinaryFormat;
|
||||
programInfo.levelZeroDynamicLinkProgram = true;
|
||||
std::tie(decodeError, singleDeviceBinaryFormat) = NEO::decodeSingleDeviceBinary(programInfo, binary, decodeErrors, decodeWarnings);
|
||||
if (decodeWarnings.empty() == false) {
|
||||
PRINT_DEBUG_STRING(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "%s\n", decodeWarnings.c_str());
|
||||
|
@ -320,7 +319,6 @@ bool ModuleTranslationUnit::processUnpackedBinary() {
|
|||
id++;
|
||||
}
|
||||
programInfo.prepareLinkerInputStorage();
|
||||
programInfo.linkerInput->undefinedSymbolsAllowed = programInfo.levelZeroDynamicLinkProgram;
|
||||
programInfo.linkerInput->decodeElfSymbolTableAndRelocations(programInfo.decodedElf, nameToKernelId);
|
||||
}
|
||||
|
||||
|
|
|
@ -82,14 +82,8 @@ bool LinkerInput::decodeExportedFunctionsSymbolTable(const void *data, uint32_t
|
|||
this->valid = false;
|
||||
return false;
|
||||
case vISA::S_UNDEF:
|
||||
if (this->undefinedSymbolsAllowed) {
|
||||
symbols.erase(symbolEntryIt->s_name);
|
||||
break;
|
||||
} else {
|
||||
DEBUG_BREAK_IF(true);
|
||||
this->valid = false;
|
||||
return false;
|
||||
}
|
||||
case vISA::S_GLOBAL_VAR:
|
||||
symbolInfo.segment = SegmentType::GlobalVariables;
|
||||
traits.exportsGlobalVariables = true;
|
||||
|
@ -195,8 +189,7 @@ void LinkerInput::decodeElfSymbolTableAndRelocations(Elf::Elf<Elf::EI_CLASS_64>
|
|||
|
||||
switch (type) {
|
||||
default:
|
||||
this->valid &= this->undefinedSymbolsAllowed;
|
||||
DEBUG_BREAK_IF(false == this->undefinedSymbolsAllowed);
|
||||
DEBUG_BREAK_IF(type != Elf::SYMBOL_TABLE_TYPE::STT_NOTYPE);
|
||||
continue;
|
||||
case Elf::SYMBOL_TABLE_TYPE::STT_OBJECT:
|
||||
symbolInfo.segment = symbolSegment;
|
||||
|
|
|
@ -147,8 +147,6 @@ struct LinkerInput {
|
|||
return valid;
|
||||
}
|
||||
|
||||
bool undefinedSymbolsAllowed = false;
|
||||
|
||||
const std::vector<ExternalFunctionUsageKernel> &getKernelDependencies() const {
|
||||
return kernelDependencies;
|
||||
}
|
||||
|
|
|
@ -47,7 +47,6 @@ struct ProgramInfo {
|
|||
std::vector<KernelInfo *> kernelInfos;
|
||||
Elf::Elf<Elf::EI_CLASS_64> decodedElf;
|
||||
uint32_t grfSize = 32U;
|
||||
bool levelZeroDynamicLinkProgram = false;
|
||||
};
|
||||
|
||||
size_t getMaxInlineSlmNeeded(const ProgramInfo &programInfo);
|
||||
|
|
|
@ -35,7 +35,6 @@ void populateSingleKernelInfo(ProgramInfo &dst, const PatchTokenBinary::ProgramF
|
|||
|
||||
if (decodedKernel.tokens.programSymbolTable) {
|
||||
dst.prepareLinkerInputStorage();
|
||||
dst.linkerInput->undefinedSymbolsAllowed = dst.levelZeroDynamicLinkProgram;
|
||||
dst.linkerInput->decodeExportedFunctionsSymbolTable(decodedKernel.tokens.programSymbolTable + 1, decodedKernel.tokens.programSymbolTable->NumEntries, kernelNum);
|
||||
}
|
||||
|
||||
|
|
|
@ -189,7 +189,7 @@ TEST(LinkerInputTests, givenFunctionsSymbolTableThenProperlyDecodesExportedFunct
|
|||
EXPECT_EQ(3, linkerInput.getExportedFunctionsSegmentId());
|
||||
}
|
||||
|
||||
TEST(LinkerInputTests, givenFunctionsSymbolTableThenUndefIsNotAllowed) {
|
||||
TEST(LinkerInputTests, givenFunctionsSymbolTableThenUndefIsAllowed) {
|
||||
NEO::LinkerInput linkerInput;
|
||||
vISA::GenSymEntry entry = {};
|
||||
entry.s_name[0] = 'A';
|
||||
|
@ -197,20 +197,6 @@ TEST(LinkerInputTests, givenFunctionsSymbolTableThenUndefIsNotAllowed) {
|
|||
entry.s_size = 16;
|
||||
entry.s_type = vISA::GenSymType::S_UNDEF;
|
||||
|
||||
auto decodeResult = linkerInput.decodeExportedFunctionsSymbolTable(&entry, 1, 3);
|
||||
EXPECT_FALSE(decodeResult);
|
||||
EXPECT_FALSE(linkerInput.isValid());
|
||||
}
|
||||
|
||||
TEST(LinkerInputTests, givenFunctionsSymbolTableWithAllowUndefinedSymbolsThenUndefIsAllowed) {
|
||||
NEO::LinkerInput linkerInput;
|
||||
vISA::GenSymEntry entry = {};
|
||||
entry.s_name[0] = 'A';
|
||||
entry.s_offset = 8;
|
||||
entry.s_size = 16;
|
||||
entry.s_type = vISA::GenSymType::S_UNDEF;
|
||||
linkerInput.undefinedSymbolsAllowed = true;
|
||||
|
||||
auto decodeResult = linkerInput.decodeExportedFunctionsSymbolTable(&entry, 1, 3);
|
||||
EXPECT_TRUE(decodeResult);
|
||||
EXPECT_TRUE(linkerInput.isValid());
|
||||
|
|
Loading…
Reference in New Issue