mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-11 00:10:58 +08:00
feature: Adding support for empty .text section
If .text section is empty then ignore it. Related-To: NEO-12229 Signed-off-by: Chodor, Jaroslaw <jaroslaw.chodor@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
81f4b885f1
commit
b612301b72
@@ -249,7 +249,9 @@ DecodeError extractZebinSections(NEO::Elf::Elf<numBits> &elf, ZebinSections<numB
|
||||
if (sectionName.startsWith(Elf::SectionNames::textPrefix.data())) {
|
||||
out.textKernelSections.push_back(&elfSectionHeader);
|
||||
} else if (sectionName == Elf::SectionNames::text) {
|
||||
out.textSections.push_back(&elfSectionHeader);
|
||||
if (false == elfSectionHeader.data.empty()) {
|
||||
out.textSections.push_back(&elfSectionHeader);
|
||||
}
|
||||
} else if (sectionName == Elf::SectionNames::dataConst) {
|
||||
out.constDataSections.push_back(&elfSectionHeader);
|
||||
} else if (sectionName == Elf::SectionNames::dataGlobalConst) {
|
||||
|
||||
@@ -222,6 +222,26 @@ TEST(ExtractZebinSections, GivenKnownSectionsThenCapturesThemProperly) {
|
||||
EXPECT_STREQ(NEO::Zebin::Elf::SectionNames::dataGlobalZeroInit.data(), strings + sections.globalZeroInitDataSections[0]->header->name);
|
||||
}
|
||||
|
||||
TEST(ExtractZebinSections, GivenEmptyTextSectionThenIgnoresIt) {
|
||||
NEO::Elf::ElfEncoder<> elfEncoder;
|
||||
elfEncoder.appendSection(NEO::Elf::SHT_PROGBITS, NEO::Zebin::Elf::SectionNames::text, ArrayRef<const uint8_t>{});
|
||||
|
||||
auto encodedElf = elfEncoder.encode();
|
||||
std::string elferrors;
|
||||
std::string elfwarnings;
|
||||
auto decodedElf = NEO::Elf::decodeElf(encodedElf, elferrors, elfwarnings);
|
||||
|
||||
ZebinSections sections;
|
||||
std::string errors;
|
||||
std::string warnings;
|
||||
auto decodeError = extractZebinSections(decodedElf, sections, errors, warnings);
|
||||
EXPECT_EQ(NEO::DecodeError::success, decodeError);
|
||||
EXPECT_TRUE(warnings.empty()) << warnings;
|
||||
EXPECT_TRUE(errors.empty()) << errors;
|
||||
|
||||
EXPECT_EQ(0U, sections.textSections.size());
|
||||
}
|
||||
|
||||
TEST(ExtractZebinSections, GivenMispelledConstDataSectionThenAllowItButEmitWarning) {
|
||||
NEO::Elf::ElfEncoder<> elfEncoder;
|
||||
elfEncoder.appendSection(NEO::Elf::SHT_PROGBITS, ".data.global_const", std::string{});
|
||||
|
||||
Reference in New Issue
Block a user