diff options
author | Paul Robinson <paul.robinson@sony.com> | 2017-04-20 19:16:51 +0000 |
---|---|---|
committer | Paul Robinson <paul.robinson@sony.com> | 2017-04-20 19:16:51 +0000 |
commit | 70b34533c22703b51a95598afceb58a0257d434b (patch) | |
tree | 9736c54d2e6d8f90923d10ba1c5a8b35661ed9d6 /llvm/tools | |
parent | 8431e996d323bbafda2cad67a3d6672d69e2bef8 (diff) | |
download | bcm5719-llvm-70b34533c22703b51a95598afceb58a0257d434b.tar.gz bcm5719-llvm-70b34533c22703b51a95598afceb58a0257d434b.zip |
[DWARF] Versioning for DWARF constants; verify FORMs
Associate the version-when-defined with definitions of standard DWARF
constants. Identify the "vendor" for DWARF extensions.
Use this information to verify FORMs in .debug_abbrev are defined as
of the DWARF version specified in the associated unit.
Removed two tests that had specified DWARF v1 (which essentially does
not exist).
Differential Revision: http://reviews.llvm.org/D30785
llvm-svn: 300875
Diffstat (limited to 'llvm/tools')
-rw-r--r-- | llvm/tools/dsymutil/DwarfLinker.cpp | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/llvm/tools/dsymutil/DwarfLinker.cpp b/llvm/tools/dsymutil/DwarfLinker.cpp index 25f1a0f2712..6ee052f101f 100644 --- a/llvm/tools/dsymutil/DwarfLinker.cpp +++ b/llvm/tools/dsymutil/DwarfLinker.cpp @@ -522,7 +522,8 @@ public: /// \brief Emit the abbreviation table \p Abbrevs to the /// debug_abbrev section. - void emitAbbrevs(const std::vector<std::unique_ptr<DIEAbbrev>> &Abbrevs); + void emitAbbrevs(const std::vector<std::unique_ptr<DIEAbbrev>> &Abbrevs, + unsigned DwarfVersion); /// \brief Emit the string table described by \p Pool. void emitStrings(const NonRelocatableStringpool &Pool); @@ -690,8 +691,10 @@ void DwarfStreamer::emitCompileUnitHeader(CompileUnit &Unit) { /// \brief Emit the \p Abbrevs array as the shared abbreviation table /// for the linked Dwarf file. void DwarfStreamer::emitAbbrevs( - const std::vector<std::unique_ptr<DIEAbbrev>> &Abbrevs) { + const std::vector<std::unique_ptr<DIEAbbrev>> &Abbrevs, + unsigned DwarfVersion) { MS->SwitchSection(MOFI->getDwarfAbbrevSection()); + MC->setDwarfVersion(DwarfVersion); Asm->emitDwarfAbbrevs(Abbrevs); } @@ -1129,6 +1132,12 @@ private: /// \brief Called at the end of a debug object link. void endDebugObject(); + /// Remembers the newest DWARF version we've seen in a unit. + void maybeUpdateMaxDwarfVersion(unsigned Version) { + if (MaxDwarfVersion < Version) + MaxDwarfVersion = Version; + } + /// Keeps track of relocations. class RelocationManager { struct ValidReloc { @@ -1430,6 +1439,7 @@ private: std::unique_ptr<DwarfStreamer> Streamer; uint64_t OutputDebugInfoSize; unsigned UnitID; ///< A unique ID that identifies each compile unit. + unsigned MaxDwarfVersion = 0; /// The units of the current debug map object. std::vector<std::unique_ptr<CompileUnit>> Units; @@ -3435,9 +3445,11 @@ bool DwarfLinker::link(const DebugMap &Map) { CUDie.dump(outs(), 0); } - if (!registerModuleReference(CUDie, *CU, ModuleMap)) + if (!registerModuleReference(CUDie, *CU, ModuleMap)) { Units.push_back(llvm::make_unique<CompileUnit>(*CU, UnitID++, !Options.NoODR, "")); + maybeUpdateMaxDwarfVersion(CU->getVersion()); + } } // Now build the DIE parent links that we will use during the next phase. @@ -3471,7 +3483,7 @@ bool DwarfLinker::link(const DebugMap &Map) { // Emit everything that's global. if (!Options.NoOutput) { - Streamer->emitAbbrevs(Abbreviations); + Streamer->emitAbbrevs(Abbreviations, MaxDwarfVersion); Streamer->emitStrings(StringPool); } |