[llvm] r261987 - llvm-dwp: Support empty .dwo files
David Blaikie via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 25 23:04:58 PST 2016
Author: dblaikie
Date: Fri Feb 26 01:04:58 2016
New Revision: 261987
URL: http://llvm.org/viewvc/llvm-project?rev=261987&view=rev
Log:
llvm-dwp: Support empty .dwo files
Though a bit odd, this is handy for a few reasons - for example, in a
build system that wants consistent input/output of build steps, but
where split-dwarf might be overriden/disabled by the user on a per-file
basis.
Added:
llvm/trunk/test/tools/llvm-dwp/Inputs/empty.dwo
llvm/trunk/test/tools/llvm-dwp/X86/empty.test
Modified:
llvm/trunk/tools/llvm-dwp/llvm-dwp.cpp
Added: llvm/trunk/test/tools/llvm-dwp/Inputs/empty.dwo
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-dwp/Inputs/empty.dwo?rev=261987&view=auto
==============================================================================
Binary files llvm/trunk/test/tools/llvm-dwp/Inputs/empty.dwo (added) and llvm/trunk/test/tools/llvm-dwp/Inputs/empty.dwo Fri Feb 26 01:04:58 2016 differ
Added: llvm/trunk/test/tools/llvm-dwp/X86/empty.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-dwp/X86/empty.test?rev=261987&view=auto
==============================================================================
--- llvm/trunk/test/tools/llvm-dwp/X86/empty.test (added)
+++ llvm/trunk/test/tools/llvm-dwp/X86/empty.test Fri Feb 26 01:04:58 2016
@@ -0,0 +1,8 @@
+RUN: llvm-dwp %p/../Inputs/empty.dwo -o %t
+RUN: llvm-dwarfdump %t | FileCheck %s
+
+CHECK-LABEL: .debug_cu_index
+CHECK-NOT: version
+CHECK-LABEL: .debug_tu_index
+CHECK-NOT: version
+CHECK: .debug_
Modified: llvm/trunk/tools/llvm-dwp/llvm-dwp.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-dwp/llvm-dwp.cpp?rev=261987&r1=261986&r2=261987&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-dwp/llvm-dwp.cpp (original)
+++ llvm/trunk/tools/llvm-dwp/llvm-dwp.cpp Fri Feb 26 01:04:58 2016
@@ -219,6 +219,9 @@ static void
writeIndex(MCStreamer &Out, MCSection *Section,
ArrayRef<unsigned> ContributionOffsets,
const MapVector<uint64_t, UnitIndexEntry> &IndexEntries) {
+ if (IndexEntries.empty())
+ return;
+
unsigned Columns = 0;
for (auto &C : ContributionOffsets)
if (C)
@@ -397,8 +400,9 @@ static std::error_code write(MCStreamer
}
}
- assert(!AbbrevSection.empty());
- assert(!InfoSection.empty());
+ if (InfoSection.empty())
+ continue;
+
if (!CurCUIndexSection.empty()) {
DWARFUnitIndex CUIndex(DW_SECT_INFO);
DataExtractor CUIndexData(CurCUIndexSection,
@@ -448,13 +452,11 @@ static std::error_code write(MCStreamer
return Err;
}
- if (!TypeIndexEntries.empty()) {
- // Lie about there being no info contributions so the TU index only includes
- // the type unit contribution
- ContributionOffsets[0] = 0;
- writeIndex(Out, MCOFI.getDwarfTUIndexSection(), ContributionOffsets,
- TypeIndexEntries);
- }
+ // Lie about there being no info contributions so the TU index only includes
+ // the type unit contribution
+ ContributionOffsets[0] = 0;
+ writeIndex(Out, MCOFI.getDwarfTUIndexSection(), ContributionOffsets,
+ TypeIndexEntries);
// Lie about the type contribution
ContributionOffsets[DW_SECT_TYPES - DW_SECT_INFO] = 0;
More information about the llvm-commits
mailing list