DebugInfo: Pass MCSymbolRefExprs for labels instead of MCSymbols

This is a precursor to adding debug info support for TLS which requires
non-default relocations applied to TLS symbols.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185202 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
David Blaikie
2013-06-28 20:05:04 +00:00
parent 2c77a625b7
commit 95e72c90e4
5 changed files with 26 additions and 13 deletions

View File

@ -135,7 +135,7 @@ void CompileUnit::addString(DIE *Die, unsigned Attribute, StringRef String) {
MCSymbol *Symb = DU->getStringPoolEntry(String);
DIEValue *Value;
if (Asm->needsRelocationsForDwarfStringPool())
Value = new (DIEValueAllocator) DIELabel(Symb);
Value = new (DIEValueAllocator) DIELabel(Symb, Asm->OutContext);
else {
MCSymbol *StringPool = DU->getStringPoolSym();
Value = new (DIEValueAllocator) DIEDelta(Symb, StringPool);
@ -155,7 +155,7 @@ void CompileUnit::addLocalString(DIE *Die, unsigned Attribute,
MCSymbol *Symb = DU->getStringPoolEntry(String);
DIEValue *Value;
if (Asm->needsRelocationsForDwarfStringPool())
Value = new (DIEValueAllocator) DIELabel(Symb);
Value = new (DIEValueAllocator) DIELabel(Symb, Asm->OutContext);
else {
MCSymbol *StringPool = DU->getStringPoolSym();
Value = new (DIEValueAllocator) DIEDelta(Symb, StringPool);
@ -166,11 +166,16 @@ void CompileUnit::addLocalString(DIE *Die, unsigned Attribute,
/// addLabel - Add a Dwarf label attribute data and value.
///
void CompileUnit::addLabel(DIE *Die, unsigned Attribute, unsigned Form,
const MCSymbol *Label) {
const MCSymbolRefExpr *Label) {
DIEValue *Value = new (DIEValueAllocator) DIELabel(Label);
Die->addValue(Attribute, Form, Value);
}
void CompileUnit::addLabel(DIE *Die, unsigned Attribute, unsigned Form,
const MCSymbol *Label) {
addLabel(Die, Attribute, Form, MCSymbolRefExpr::Create(Label, Asm->OutContext));
}
/// addLabelAddress - Add a dwarf label attribute data and value using
/// DW_FORM_addr or DW_FORM_GNU_addr_index.
///
@ -178,7 +183,7 @@ void CompileUnit::addLabelAddress(DIE *Die, unsigned Attribute,
MCSymbol *Label) {
if (!DD->useSplitDwarf()) {
if (Label != NULL) {
DIEValue *Value = new (DIEValueAllocator) DIELabel(Label);
DIEValue *Value = new (DIEValueAllocator) DIELabel(Label, Asm->OutContext);
Die->addValue(Attribute, dwarf::DW_FORM_addr, Value);
} else {
DIEValue *Value = new (DIEValueAllocator) DIEInteger(0);
@ -194,7 +199,7 @@ void CompileUnit::addLabelAddress(DIE *Die, unsigned Attribute,
/// addOpAddress - Add a dwarf op address data and value using the
/// form given and an op of either DW_FORM_addr or DW_FORM_GNU_addr_index.
///
void CompileUnit::addOpAddress(DIE *Die, MCSymbol *Sym) {
void CompileUnit::addOpAddress(DIE *Die, const MCSymbol *Sym) {
if (!DD->useSplitDwarf()) {
addUInt(Die, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_addr);