llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-objectyaml Author: Vitaly Buka (vitalybuka) <details> <summary>Changes</summary> With -DMACHINE=EM_NONE, machine specific sections, like SHT_ARM_EXIDX, will fall to parse and set `Type`. --- Full diff: https://github.com/llvm/llvm-project/pull/123274.diff 1 Files Affected: - (modified) llvm/lib/ObjectYAML/ELFYAML.cpp (+6-3) ``````````diff diff --git a/llvm/lib/ObjectYAML/ELFYAML.cpp b/llvm/lib/ObjectYAML/ELFYAML.cpp index 83e6cf76dd746f..961815392a1348 100644 --- a/llvm/lib/ObjectYAML/ELFYAML.cpp +++ b/llvm/lib/ObjectYAML/ELFYAML.cpp @@ -1588,7 +1588,7 @@ static bool isInteger(StringRef Val) { void MappingTraits<std::unique_ptr<ELFYAML::Chunk>>::mapping( IO &IO, std::unique_ptr<ELFYAML::Chunk> &Section) { - ELFYAML::ELF_SHT Type = ELF::ET_NONE; + ELFYAML::ELF_SHT Type; StringRef TypeStr; if (IO.outputting()) { if (auto *S = dyn_cast<ELFYAML::Section>(Section.get())) @@ -1599,9 +1599,12 @@ void MappingTraits<std::unique_ptr<ELFYAML::Chunk>>::mapping( // When the Type string does not have a "SHT_" prefix, we know it is not a // description of a regular ELF output section. TypeStr = getStringValue(IO, "Type"); - if (TypeStr.starts_with("SHT_") || isInteger(TypeStr)) + if (TypeStr.starts_with("SHT_") || isInteger(TypeStr)) { IO.mapRequired("Type", Type); - } + if (static_cast<Input&>(IO).error()) + Type = ELF::SHT_NULL; + } + } if (TypeStr == "Fill") { assert(!IO.outputting()); // We don't dump fills currently. `````````` </details> https://github.com/llvm/llvm-project/pull/123274 _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits