summaryrefslogtreecommitdiff
path: root/lib/CodeGen
diff options
context:
space:
mode:
authorEric Christopher <echristo@gmail.com>2014-01-28 00:49:26 +0000
committerEric Christopher <echristo@gmail.com>2014-01-28 00:49:26 +0000
commit1c2827cd6a5456126b9a8041642148279456f71a (patch)
treec4567e7cd9950e26721335db4567d1f7444b19d3 /lib/CodeGen
parent2ddf01b64d1cc8b6e920405b4f847cf4077b1820 (diff)
downloadllvm-1c2827cd6a5456126b9a8041642148279456f71a.tar.gz
llvm-1c2827cd6a5456126b9a8041642148279456f71a.tar.bz2
llvm-1c2827cd6a5456126b9a8041642148279456f71a.tar.xz
Revert r199871 and replace it with a simple check in the debug info
code to see if we're emitting a function into a non-default text section. This is still a less-than-ideal solution, but more contained than r199871 to determine whether or not we're emitting code into an array of comdat sections. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200269 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r--lib/CodeGen/AsmPrinter/DwarfDebug.cpp9
-rw-r--r--lib/CodeGen/AsmPrinter/DwarfDebug.h4
-rw-r--r--lib/CodeGen/TargetLoweringObjectFileImpl.cpp8
3 files changed, 15 insertions, 6 deletions
diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index 72ce337b20..1d059d9f3c 100644
--- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/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/lib/CodeGen/AsmPrinter/DwarfDebug.h b/lib/CodeGen/AsmPrinter/DwarfDebug.h
index 516def804d..11695a5735 100644
--- a/lib/CodeGen/AsmPrinter/DwarfDebug.h
+++ b/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/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
index 7f534acb70..3621b58287 100644
--- a/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
+++ b/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.