diff options
author | Igor Kudrin <ikudrin@accesssoftek.com> | 2020-04-25 17:23:56 +0700 |
---|---|---|
committer | Igor Kudrin <ikudrin@accesssoftek.com> | 2020-04-25 18:59:41 +0700 |
commit | 575d9ba107f4f9c6ec345ed972eaac99ad9354f7 (patch) | |
tree | f4614548dc598052391cd93d62ab4c2472ad5c0c /llvm/tools/llvm-dwp/llvm-dwp.cpp | |
parent | 73868a2850942413da11cad8fd2fb655648556f5 (diff) | |
download | llvm-575d9ba107f4f9c6ec345ed972eaac99ad9354f7.zip llvm-575d9ba107f4f9c6ec345ed972eaac99ad9354f7.tar.gz llvm-575d9ba107f4f9c6ec345ed972eaac99ad9354f7.tar.bz2 |
[llvm-dwp] Refuse DWARFv5 input DWP files.
The library can parse DWARFv5 unit index sections of DWP files, but
llvm-dwp is not ready to process them. Refuse such input files for now.
Differential Revision: https://reviews.llvm.org/D77143
Diffstat (limited to 'llvm/tools/llvm-dwp/llvm-dwp.cpp')
-rw-r--r-- | llvm/tools/llvm-dwp/llvm-dwp.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/tools/llvm-dwp/llvm-dwp.cpp b/llvm/tools/llvm-dwp/llvm-dwp.cpp index bcc5f38..24063c8 100644 --- a/llvm/tools/llvm-dwp/llvm-dwp.cpp +++ b/llvm/tools/llvm-dwp/llvm-dwp.cpp @@ -618,6 +618,10 @@ static Error write(MCStreamer &Out, ArrayRef<std::string> Inputs) { DataExtractor CUIndexData(CurCUIndexSection, Obj.isLittleEndian(), 0); if (!CUIndex.parse(CUIndexData)) return make_error<DWPError>("failed to parse cu_index"); + if (CUIndex.getVersion() != 2) + return make_error<DWPError>( + "unsupported cu_index version: " + utostr(CUIndex.getVersion()) + + " (only version 2 is supported)"); for (const DWARFUnitIndex::Entry &E : CUIndex.getRows()) { auto *I = E.getContributions(); @@ -655,6 +659,11 @@ static Error write(MCStreamer &Out, ArrayRef<std::string> Inputs) { DataExtractor TUIndexData(CurTUIndexSection, Obj.isLittleEndian(), 0); if (!TUIndex.parse(TUIndexData)) return make_error<DWPError>("failed to parse tu_index"); + if (TUIndex.getVersion() != 2) + return make_error<DWPError>( + "unsupported tu_index version: " + utostr(TUIndex.getVersion()) + + " (only version 2 is supported)"); + addAllTypesFromDWP( Out, TypeIndexEntries, TUIndex, TypesSection, CurTypesSection.front(), CurEntry, |