-
- switch (Attr) {
- case dwarf::DW_AT_abstract_origin:
- case dwarf::DW_AT_type:
- case dwarf::DW_AT_friend:
- case dwarf::DW_AT_specification:
- case dwarf::DW_AT_import:
- case dwarf::DW_AT_containing_type: {
- DIEEntry *E = cast<DIEEntry>(Values[i]);
- DIE *Origin = E->getEntry();
- unsigned Addr = Origin->getOffset();
- if (Form == dwarf::DW_FORM_ref_addr) {
- assert(!useSplitDwarf() && "TODO: dwo files can't have relocations.");
- // For DW_FORM_ref_addr, output the offset from beginning of debug info
- // section. Origin->getOffset() returns the offset from start of the
- // compile unit.
- CompileUnit *CU = CUDieMap.lookup(Origin->getCompileUnit());
- assert(CU && "CUDie should belong to a CU.");
- Addr += CU->getDebugInfoOffset();
- if (Asm->MAI->doesDwarfUseRelocationsAcrossSections())
- Asm->EmitLabelPlusOffset(DwarfInfoSectionSym, Addr,
- DIEEntry::getRefAddrSize(Asm));
- else
- Asm->EmitLabelOffsetDifference(DwarfInfoSectionSym, Addr,
- DwarfInfoSectionSym,
- DIEEntry::getRefAddrSize(Asm));
- } else {
- // Make sure Origin belong to the same CU.
- assert(Die->getCompileUnit() == Origin->getCompileUnit() &&
- "The referenced DIE should belong to the same CU in ref4");
- Asm->EmitInt32(Addr);
- }
- break;
- }
- case dwarf::DW_AT_ranges: {
- // DW_AT_range Value encodes offset in debug_range section.
- DIEInteger *V = cast<DIEInteger>(Values[i]);
-
- if (Asm->MAI->doesDwarfUseRelocationsAcrossSections()) {
- Asm->EmitLabelPlusOffset(DwarfDebugRangeSectionSym,
- V->getValue(),
- 4);
- } else {
- Asm->EmitLabelOffsetDifference(DwarfDebugRangeSectionSym,
- V->getValue(),
- DwarfDebugRangeSectionSym,
- 4);
- }
- break;
- }
- case dwarf::DW_AT_location: {
- if (DIELabel *L = dyn_cast<DIELabel>(Values[i])) {
- if (Asm->MAI->doesDwarfUseRelocationsAcrossSections())
- Asm->EmitLabelReference(L->getValue(), 4);
- else
- Asm->EmitLabelDifference(L->getValue(), DwarfDebugLocSectionSym, 4);
- } else {
- Values[i]->EmitValue(Asm, Form);
- }
- break;
- }
- case dwarf::DW_AT_accessibility: {
- if (Asm->isVerbose()) {
- DIEInteger *V = cast<DIEInteger>(Values[i]);
- Asm->OutStreamer.AddComment(dwarf::AccessibilityString(V->getValue()));
- }
- Values[i]->EmitValue(Asm, Form);
- break;
- }
- default:
- // Emit an attribute using the defined form.
- Values[i]->EmitValue(Asm, Form);
- break;