--- /dev/null
+ .section __DWARF,__debug_info,regular,debug
+.long 8 # CU length
+.short 3 # Version
+.long 0 # Abbrev offset
+.byte 4 # AddrSize
+.byte 1 # Abbrev 1
+.long 7 # Unit lengthh...
+.short 3
+.long 0
+.byte 4
+ .section __DWARF,__debug_abbrev,regular,debug
+.byte 1 # Abbrev code
+.byte 0x11 # TAG_compile_unit
+.byte 0 # no children
+.byte 0 # no attributes
+.byte 0
--- /dev/null
+RUN: dsymutil --update -f %p/../Inputs/empty-CU.o -o - | llvm-dwarfdump -v - -debug-info | FileCheck %s
+
+CHECK: .debug_info contents:
+CHECK: 0x00000000: Compile Unit: length = 0x00000008 version = 0x0003 abbr_offset = 0x0000 addr_size = 0x04 (next unit at 0x0000000c)
+
+CHECK: 0x0000000b: DW_TAG_compile_unit [1]
+CHECK: 0x0000000c: Compile Unit: length = 0x00000007 version = 0x0003 abbr_offset = 0x0000 addr_size = 0x04 (next unit at 0x00000017)
Info.resize(OrigUnit.getNumDIEs());
auto CUDie = OrigUnit.getUnitDIE(false);
+ if (!CUDie) {
+ HasODR = false;
+ return;
+ }
if (auto Lang = dwarf::toUnsigned(CUDie.find(dwarf::DW_AT_language)))
HasODR = CanUseODR && (*Lang == dwarf::DW_LANG_C_plus_plus ||
*Lang == dwarf::DW_LANG_C_plus_plus_03 ||
// Recursively get all modules imported by this one.
auto CUDie = CU->getUnitDIE(false);
+ if (!CUDie)
+ continue;
if (!registerModuleReference(CUDie, *CU, ModuleMap, DMO, Ranges, StringPool,
UniquingStringPool, ODRContexts, UnitID,
Indent)) {
for (auto &CurrentUnit : CompileUnits) {
auto InputDIE = CurrentUnit->getOrigUnit().getUnitDIE();
CurrentUnit->setStartOffset(Linker.OutputDebugInfoSize);
+ if (!InputDIE) {
+ Linker.OutputDebugInfoSize = CurrentUnit->computeNextUnitOffset();
+ continue;
+ }
if (CurrentUnit->getInfo(0).Keep) {
// Clone the InputDIE into your Unit DIE in our compile unit since it
// already has a DIE inside of it.
}
// Now build the DIE parent links that we will use during the next phase.
- for (auto &CurrentUnit : LinkContext.CompileUnits)
+ for (auto &CurrentUnit : LinkContext.CompileUnits) {
+ auto CUDie = CurrentUnit->getOrigUnit().getUnitDIE();
+ if (!CUDie)
+ continue;
analyzeContextInfo(CurrentUnit->getOrigUnit().getUnitDIE(), 0,
*CurrentUnit, &ODRContexts.getRoot(),
UniquingStringPool, ODRContexts);
+ }
std::unique_lock<std::mutex> LockGuard(ProcessedFilesMutex);
ProcessedFiles.set(i);