summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter
diff options
context:
space:
mode:
authorEric Christopher <echristo@gmail.com>2014-01-24 11:40:29 +0000
committerEric Christopher <echristo@gmail.com>2014-01-24 11:40:29 +0000
commitc528858cbd4fef01f2007cea8a4e8e25a6b86443 (patch)
tree4c44381c435c21a14c6af748ef659aa989cb8eb9 /llvm/lib/CodeGen/AsmPrinter
parent9f2134402c08e6d08c2e0f7a017afea2c7efe21b (diff)
downloadbcm5719-llvm-c528858cbd4fef01f2007cea8a4e8e25a6b86443.tar.gz
bcm5719-llvm-c528858cbd4fef01f2007cea8a4e8e25a6b86443.zip
Use DW_AT_high_pc and DW_AT_low_pc for the high and low pc for a
compile unit. Make these relocations on the platforms that need relocations and add a routine to ensure that we don't put the addresses in an offset table for split dwarf. llvm-svn: 199990
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp16
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h1
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp33
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h5
4 files changed, 41 insertions, 14 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index 7ba4fece43b..077af8c3756 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -187,6 +187,7 @@ DwarfDebug::DwarfDebug(AsmPrinter *A, Module *M)
DwarfAddrSectionSym = 0;
DwarfAbbrevDWOSectionSym = DwarfStrDWOSectionSym = 0;
FunctionBeginSym = FunctionEndSym = 0;
+ TextSectionBeginSym = TextSectionEndSym = 0;
CurFn = 0;
CurMI = 0;
@@ -1061,9 +1062,12 @@ void DwarfDebug::finalizeModuleInfo() {
addSectionLabel(Asm, U, U->getUnitDie(), dwarf::DW_AT_ranges,
Asm->GetTempSymbol("cu_ranges", U->getUniqueID()),
DwarfDebugRangeSectionSym);
- else
- U->addUInt(U->getUnitDie(), dwarf::DW_AT_low_pc, dwarf::DW_FORM_addr,
- 0);
+ else {
+ U->addLocalLabelAddress(U->getUnitDie(), dwarf::DW_AT_low_pc,
+ TextSectionBeginSym);
+ U->addLocalLabelAddress(U->getUnitDie(), dwarf::DW_AT_high_pc,
+ TextSectionEndSym);
+ }
}
}
@@ -1117,6 +1121,10 @@ void DwarfDebug::endSections() {
Sym = Asm->GetTempSymbol("debug_end", ID);
Asm->OutStreamer.SwitchSection(Section);
Asm->OutStreamer.EmitLabel(Sym);
+ // If this is the end of the text section keep track of where the end of
+ // the section is so that we can use it later.
+ if (Section == Asm->getObjFileLowering().getTextSection())
+ TextSectionEndSym = Sym;
}
// Insert a final terminator.
@@ -2012,6 +2020,8 @@ void DwarfDebug::emitSectionLabels() {
DwarfDebugLocSectionSym =
emitSectionSym(Asm, TLOF.getDwarfLocSection(), "section_debug_loc");
+
+ TextSectionBeginSym = emitSectionSym(Asm, TLOF.getTextSection(), "text_begin");
}
// Recursively emits a debug information entry.
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
index 516def804d1..1071e5892ac 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
@@ -432,6 +432,7 @@ class DwarfDebug : public AsmPrinterHandler {
MCSymbol *DwarfInfoDWOSectionSym, *DwarfAbbrevDWOSectionSym;
MCSymbol *DwarfStrDWOSectionSym;
MCSymbol *DwarfGnuPubNamesSectionSym, *DwarfGnuPubTypesSectionSym;
+ MCSymbol *TextSectionBeginSym, *TextSectionEndSym;
// As an optimization, there is no need to emit an entry in the directory
// table for the same directory as DW_AT_comp_dir.
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
index 4f55d89ce2c..e9b10ba2911 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
@@ -266,21 +266,32 @@ void DwarfUnit::addSectionOffset(DIE *Die, dwarf::Attribute Attribute,
///
void DwarfCompileUnit::addLabelAddress(DIE *Die, dwarf::Attribute Attribute,
MCSymbol *Label) {
+ if (!DD->useSplitDwarf())
+ return addLocalLabelAddress(Die, Attribute, Label);
+
if (Label)
DD->addArangeLabel(SymbolCU(this, Label));
- if (!DD->useSplitDwarf()) {
- if (Label) {
- DIEValue *Value = new (DIEValueAllocator) DIELabel(Label);
- Die->addValue(Attribute, dwarf::DW_FORM_addr, Value);
- } else {
- DIEValue *Value = new (DIEValueAllocator) DIEInteger(0);
- Die->addValue(Attribute, dwarf::DW_FORM_addr, Value);
- }
+ unsigned idx = DU->getAddrPoolIndex(Label);
+ DIEValue *Value = new (DIEValueAllocator) DIEInteger(idx);
+ Die->addValue(Attribute, dwarf::DW_FORM_GNU_addr_index, Value);
+}
+
+/// addLocalLabelAddress - Add a dwarf label attribute data and value using
+/// DW_FORM_addr only.
+///
+void DwarfCompileUnit::addLocalLabelAddress(DIE *Die,
+ dwarf::Attribute Attribute,
+ MCSymbol *Label) {
+ if (Label)
+ DD->addArangeLabel(SymbolCU(this, Label));
+
+ if (Label) {
+ DIEValue *Value = new (DIEValueAllocator) DIELabel(Label);
+ Die->addValue(Attribute, dwarf::DW_FORM_addr, Value);
} else {
- unsigned idx = DU->getAddrPoolIndex(Label);
- DIEValue *Value = new (DIEValueAllocator) DIEInteger(idx);
- Die->addValue(Attribute, dwarf::DW_FORM_GNU_addr_index, Value);
+ DIEValue *Value = new (DIEValueAllocator) DIEInteger(0);
+ Die->addValue(Attribute, dwarf::DW_FORM_addr, Value);
}
}
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h
index 3f42e2f6728..684c46b624e 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h
@@ -545,6 +545,11 @@ public:
/// addLabelAddress - Add a dwarf label attribute data and value using
/// either DW_FORM_addr or DW_FORM_GNU_addr_index.
void addLabelAddress(DIE *Die, dwarf::Attribute Attribute, MCSymbol *Label);
+
+ /// addLocalLabelAddress - Add a dwarf label attribute data and value using
+ /// DW_FORM_addr only.
+ void addLocalLabelAddress(DIE *Die, dwarf::Attribute Attribute,
+ MCSymbol *Label);
};
class DwarfTypeUnit : public DwarfUnit {
OpenPOWER on IntegriCloud