From ddf63a4a7f536f3ca2186646c4550b59b065898b Mon Sep 17 00:00:00 2001 From: Reid Kleckner Date: Tue, 18 Jun 2019 19:41:25 +0000 Subject: [PATCH] [PDB] Ignore .debug$S subsections with high bit set Some versions of the Visual C++ 2015 runtime have line tables with the subsection kind of 0x800000F2. In cvinfo.h, 0x80000000 is documented to be DEBUG_S_IGNORE. This appears to implement the intended behavior. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@363724 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/DebugInfo/CodeView/CodeView.h | 3 +++ tools/llvm-readobj/COFFDumper.cpp | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/include/llvm/DebugInfo/CodeView/CodeView.h b/include/llvm/DebugInfo/CodeView/CodeView.h index ff25972e6e4..c3acb05ea8b 100644 --- a/include/llvm/DebugInfo/CodeView/CodeView.h +++ b/include/llvm/DebugInfo/CodeView/CodeView.h @@ -304,6 +304,9 @@ enum class ModifierOptions : uint16_t { }; CV_DEFINE_ENUM_CLASS_FLAGS_OPERATORS(ModifierOptions) +// If the subsection kind has this bit set, then the linker should ignore it. +enum : uint32_t { SubsectionIgnoreFlag = 0x80000000 }; + enum class DebugSubsectionKind : uint32_t { None = 0, Symbols = 0xf1, diff --git a/tools/llvm-readobj/COFFDumper.cpp b/tools/llvm-readobj/COFFDumper.cpp index fbdc87a3494..4c2e39dfa3c 100644 --- a/tools/llvm-readobj/COFFDumper.cpp +++ b/tools/llvm-readobj/COFFDumper.cpp @@ -961,6 +961,11 @@ void COFFDumper::printCodeViewSymbolSection(StringRef SectionName, error(consume(Data, SubSectionSize)); ListScope S(W, "Subsection"); + // Dump the subsection as normal even if the ignore bit is set. + if (SubType & SubsectionIgnoreFlag) { + W.printHex("IgnoredSubsectionKind", SubType); + SubType &= ~SubsectionIgnoreFlag; + } W.printEnum("SubSectionType", SubType, makeArrayRef(SubSectionTypes)); W.printHex("SubSectionSize", SubSectionSize); -- 2.40.0