aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorEric Christopher <echristo@gmail.com>2013-08-19 21:07:38 +0000
committerEric Christopher <echristo@gmail.com>2013-08-19 21:07:38 +0000
commitf04e4efcaa02012b7943b44c61b321a0fb5e1a72 (patch)
tree84c5f9f8b0d58d028253f6d04ee872297695f183 /lib
parentf1070a0b860d0d05a578b27f8a226732c7a1dfb9 (diff)
downloadexternal_llvm-f04e4efcaa02012b7943b44c61b321a0fb5e1a72.zip
external_llvm-f04e4efcaa02012b7943b44c61b321a0fb5e1a72.tar.gz
external_llvm-f04e4efcaa02012b7943b44c61b321a0fb5e1a72.tar.bz2
Turn on pubnames by default on linux.
Until gdb supports the new accelerator tables we should add the pubnames section so that gdb_index can be generated from gold at link time. On darwin we already emit the accelerator tables and so don't need to worry about pubnames. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188708 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/CodeGen/AsmPrinter/DwarfDebug.cpp31
-rw-r--r--lib/CodeGen/AsmPrinter/DwarfDebug.h1
2 files changed, 22 insertions, 10 deletions
diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index 8fd208a..1de4fca 100644
--- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -58,11 +58,6 @@ static cl::opt<bool> UnknownLocations(
cl::init(false));
static cl::opt<bool>
-GenerateDwarfPubNamesSection("generate-dwarf-pubnames", cl::Hidden,
- cl::init(false),
- cl::desc("Generate DWARF pubnames section"));
-
-static cl::opt<bool>
GenerateODRHash("generate-odr-hash", cl::Hidden,
cl::desc("Add an ODR hash to external type DIEs."),
cl::init(false));
@@ -104,6 +99,14 @@ SplitDwarf("split-dwarf", cl::Hidden,
clEnumVal(Disable, "Disabled"), clEnumValEnd),
cl::init(Default));
+static cl::opt<DefaultOnOff>
+DwarfPubNames("generate-dwarf-pubnames", cl::Hidden,
+ cl::desc("Generate DWARF pubnames section"),
+ cl::values(clEnumVal(Default, "Default for platform"),
+ clEnumVal(Enable, "Enabled"),
+ clEnumVal(Disable, "Disabled"), clEnumValEnd),
+ cl::init(Default));
+
namespace {
const char *const DWARFGroupName = "DWARF Emission";
const char *const DbgTimerName = "DWARF Debug Writer";
@@ -225,6 +228,14 @@ DwarfDebug::DwarfDebug(AsmPrinter *A, Module *M)
else
HasSplitDwarf = SplitDwarf == Enable ? true : false;
+ if (DwarfPubNames == Default) {
+ if (IsDarwin)
+ HasDwarfPubNames = false;
+ else
+ HasDwarfPubNames = true;
+ } else
+ HasDwarfPubNames = DwarfPubNames == Enable ? true : false;
+
DwarfVersion = getDwarfVersionFromModule(MMI->getModule());
{
@@ -797,7 +808,7 @@ void DwarfDebug::constructSubprogramDIE(CompileUnit *TheCU,
TheCU->addToContextOwner(SubprogramDie, SP.getContext());
// Expose as global, if requested.
- if (GenerateDwarfPubNamesSection)
+ if (HasDwarfPubNames)
TheCU->addGlobalName(SP.getName(), SubprogramDie);
}
@@ -1146,7 +1157,7 @@ void DwarfDebug::endModule() {
}
// Emit info into a debug pubnames section, if requested.
- if (GenerateDwarfPubNamesSection)
+ if (HasDwarfPubNames)
emitDebugPubnames();
// Emit info into a debug pubtypes section.
@@ -1932,7 +1943,7 @@ void DwarfDebug::emitSectionLabels() {
DwarfLineSectionSym =
emitSectionSym(Asm, TLOF.getDwarfLineSection(), "section_line");
emitSectionSym(Asm, TLOF.getDwarfLocSection());
- if (GenerateDwarfPubNamesSection)
+ if (HasDwarfPubNames)
emitSectionSym(Asm, TLOF.getDwarfPubNamesSection());
emitSectionSym(Asm, TLOF.getDwarfPubTypesSection());
DwarfStrSectionSym =
@@ -2307,8 +2318,8 @@ void DwarfDebug::emitDebugPubnames() {
continue;
// Start the dwarf pubnames section.
- Asm->OutStreamer.SwitchSection(
- Asm->getObjFileLowering().getDwarfPubNamesSection());
+ Asm->OutStreamer
+ .SwitchSection(Asm->getObjFileLowering().getDwarfPubNamesSection());
Asm->OutStreamer.AddComment("Length of Public Names Info");
Asm->EmitLabelDifference(Asm->GetTempSymbol("pubnames_end", ID),
diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.h b/lib/CodeGen/AsmPrinter/DwarfDebug.h
index f5344b1..da959f4 100644
--- a/lib/CodeGen/AsmPrinter/DwarfDebug.h
+++ b/lib/CodeGen/AsmPrinter/DwarfDebug.h
@@ -434,6 +434,7 @@ class DwarfDebug {
// DWARF5 Experimental Options
bool HasDwarfAccelTables;
bool HasSplitDwarf;
+ bool HasDwarfPubNames;
unsigned DwarfVersion;