llvm.org GIT mirror llvm / cd94a76
Make sure we emit a relocation to the debug_ranges section in the presence of CU ranges. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199276 91177308-0d34-0410-b5e6-96231b3b80d8 Eric Christopher 6 years ago
3 changed file(s) with 16 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
208208 else
209209 HasDwarfPubSections = DwarfPubSections == Enable;
210210
211 // For now only turn on CU ranges if we've explicitly asked for it
212 // or we have -ffunction-sections enabled.
213 HasCURanges = DwarfCURanges || TargetMachine::getFunctionSections();
214
211215 DwarfVersion = DwarfVersionNumber
212216 ? DwarfVersionNumber
213217 : getDwarfVersionFromModule(MMI->getModule());
10561060 // FIXME: We should use ranges if we have multiple compile units or
10571061 // allow reordering of code ala .subsections_via_symbols in mach-o.
10581062 DwarfCompileUnit *U = SkCU ? SkCU : static_cast(TheU);
1059 if ((DwarfCURanges || TargetMachine::getFunctionSections()) &&
1060 TheU->getRanges().size())
1063 if (useCURanges() && TheU->getRanges().size())
10611064 addSectionLabel(Asm, U, U->getUnitDie(), dwarf::DW_AT_ranges,
10621065 Asm->GetTempSymbol("cu_ranges", U->getUniqueID()),
10631066 DwarfDebugRangeSectionSym);
29092912 }
29102913
29112914 // Now emit a range for the CU itself.
2912 if (DwarfCURanges) {
2915 if (useCURanges()) {
29132916 Asm->OutStreamer.EmitLabel(
29142917 Asm->GetTempSymbol("cu_ranges", TheCU->getUniqueID()));
29152918 const SmallVectorImpl &Ranges = TheCU->getRanges();
457457 // Whether to emit the pubnames/pubtypes sections.
458458 bool HasDwarfPubSections;
459459
460 // Whether or not to use AT_ranges for compilation units.
461 bool HasCURanges;
462
460463 // Version of dwarf we're emitting.
461464 unsigned DwarfVersion;
462465
732735 /// split dwarf proposal support.
733736 bool useSplitDwarf() { return HasSplitDwarf; }
734737
738 /// \brief Returns whether or not to use AT_ranges for compilation units.
739 bool useCURanges() { return HasCURanges; }
740
735741 /// Returns the Dwarf Version.
736742 unsigned getDwarfVersion() const { return DwarfVersion; }
737743
0 ; RUN: llc -split-dwarf=Enable -O0 %s -ffunction-sections -mtriple=x86_64-unknown-linux-gnu -filetype=obj -o %t
11 ; RUN: llvm-dwarfdump -debug-dump=all %t | FileCheck --check-prefix=FUNCTION-SECTIONS %s
2 ; RUN: llvm-readobj --relocations %t | FileCheck --check-prefix=FUNCTION-SECTIONS-RELOCS %s
23
34 ; RUN: llc -split-dwarf=Enable -O0 %s -mtriple=x86_64-unknown-linux-gnu -filetype=obj -o %t
45 ; RUN: llvm-dwarfdump -debug-dump=all %t | FileCheck --check-prefix=NO-FUNCTION-SECTIONS %s
1011
1112 ; With function sections enabled make sure that we have a DW_AT_ranges attribute.
1213 ; FUNCTION-SECTIONS: DW_AT_ranges
14
15 ; Check that we have a relocation against the .debug_ranges section.
16 ; FUNCTION-SECTIONS-RELOCS: R_X86_64_32 .debug_ranges 0x0
1317
1418 ; Without function sections enabled make sure that we have no DW_AT_ranges attribute.
1519 ; NO-FUNCTION-SECTIONS-NOT: DW_AT_ranges