diff options
Diffstat (limited to 'llvm/lib/CodeGen')
| -rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 9 | ||||
| -rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h | 4 | ||||
| -rw-r--r-- | llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp | 8 |
3 files changed, 15 insertions, 6 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index 72ce337b203..1d059d9f3c7 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -176,6 +176,7 @@ DwarfDebug::DwarfDebug(AsmPrinter *A, Module *M) : Asm(A), MMI(Asm->MMI), FirstCU(0), SourceIdMap(DIEValueAllocator), PrevLabel(NULL), GlobalRangeCount(0), InfoHolder(A, "info_string", DIEValueAllocator), HasCURanges(false), + UsedNonDefaultText(false), SkeletonHolder(A, "skel_string", DIEValueAllocator) { DwarfInfoSectionSym = DwarfAbbrevSectionSym = DwarfStrSectionSym = 0; @@ -1123,7 +1124,7 @@ void DwarfDebug::endSections() { // we have -ffunction-sections enabled, or we've emitted a function // into a unique section. At this point all sections should be finalized // except for dwarf sections. - HasCURanges = DwarfCURanges || Asm->TM.debugUseUniqueSections() || + HasCURanges = DwarfCURanges || UsedNonDefaultText || TargetMachine::getFunctionSections(); } @@ -1580,6 +1581,12 @@ void DwarfDebug::beginFunction(const MachineFunction *MF) { else Asm->OutStreamer.getContext().setDwarfCompileUnitID(TheCU->getUniqueID()); + // Check the current section against the standard text section. If different + // keep track so that we will know when we're emitting functions into multiple + // sections. + if (Asm->getObjFileLowering().getTextSection() != Asm->getCurrentSection()) + UsedNonDefaultText = true; + // Emit a label for the function so that we have a beginning address. FunctionBeginSym = Asm->GetTempSymbol("func_begin", Asm->getFunctionNumber()); // Assumes in correct section after the entry point. diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h index 516def804d1..11695a5735d 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h @@ -461,6 +461,10 @@ class DwarfDebug : public AsmPrinterHandler { // Whether or not to use AT_ranges for compilation units. bool HasCURanges; + // Whether we emitted a function into a section other than the default + // text. + bool UsedNonDefaultText; + // Version of dwarf we're emitting. unsigned DwarfVersion; diff --git a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp index 7f534acb70a..3621b582878 100644 --- a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp +++ b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp @@ -232,7 +232,7 @@ static const char *getSectionPrefixForGlobal(SectionKind Kind) { const MCSection *TargetLoweringObjectFileELF:: SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind, - Mangler *Mang, TargetMachine &TM) const { + Mangler *Mang, const TargetMachine &TM) const { // If we have -ffunction-section or -fdata-section then we should emit the // global value to a uniqued section specifically for it. bool EmitUniquedSection; @@ -258,8 +258,6 @@ SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind, Flags |= ELF::SHF_GROUP; } - // Set that we've used a unique section name in the target machine. - TM.setDebugUseUniqueSections(true); return getContext().getELFSection(Name.str(), getELFSectionType(Name.str(), Kind), Flags, Kind, 0, Group); @@ -531,7 +529,7 @@ getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind, const MCSection *TargetLoweringObjectFileMachO:: SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind, - Mangler *Mang, TargetMachine &TM) const { + Mangler *Mang, const TargetMachine &TM) const { // Handle thread local data. if (Kind.isThreadBSS()) return TLSBSSSection; @@ -756,7 +754,7 @@ static const char *getCOFFSectionNameForUniqueGlobal(SectionKind Kind) { const MCSection *TargetLoweringObjectFileCOFF:: SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind, - Mangler *Mang, TargetMachine &TM) const { + Mangler *Mang, const TargetMachine &TM) const { // If this global is linkonce/weak and the target handles this by emitting it // into a 'uniqued' section name, create and return the section now. |

