mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-19 19:44:55 +00:00
fix a fixme in TargetLoweringObjectFile::getExprForDwarfReference
where we used ot create an MCSymbol for ".". Now emit an assembler temporary label and reference it instead of "." textually. rdar://7739457 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98292 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -51,6 +51,12 @@ public:
|
|||||||
// symbols.
|
// symbols.
|
||||||
Mangler(const MCAsmInfo &mai) : MAI(mai), NextAnonGlobalID(1) {}
|
Mangler(const MCAsmInfo &mai) : MAI(mai), NextAnonGlobalID(1) {}
|
||||||
|
|
||||||
|
/// getUniqueID() - Allocate and return a unique ID.
|
||||||
|
/// FIXME: Remove this.
|
||||||
|
unsigned getUniqueID() {
|
||||||
|
return NextAnonGlobalID++;
|
||||||
|
}
|
||||||
|
|
||||||
/// getNameWithPrefix - Fill OutName with the name of the appropriate prefix
|
/// getNameWithPrefix - Fill OutName with the name of the appropriate prefix
|
||||||
/// and the specified global variable's name. If the global variable doesn't
|
/// and the specified global variable's name. If the global variable doesn't
|
||||||
/// have a name, this fills in a unique name for the global.
|
/// have a name, this fills in a unique name for the global.
|
||||||
|
@@ -208,8 +208,8 @@ public:
|
|||||||
|
|
||||||
///
|
///
|
||||||
const MCExpr *
|
const MCExpr *
|
||||||
getExprForDwarfReference(const MCSymbol *Sym, MachineModuleInfo *MMI,
|
getExprForDwarfReference(const MCSymbol *Sym, Mangler *Mang,
|
||||||
unsigned Encoding,
|
MachineModuleInfo *MMI, unsigned Encoding,
|
||||||
MCStreamer &Streamer) const;
|
MCStreamer &Streamer) const;
|
||||||
|
|
||||||
virtual unsigned getPersonalityEncoding() const;
|
virtual unsigned getPersonalityEncoding() const;
|
||||||
|
@@ -189,7 +189,8 @@ void DwarfPrinter::EmitULEB128(unsigned Value, const char *Desc,
|
|||||||
void DwarfPrinter::EmitReference(const MCSymbol *Sym, unsigned Encoding) const {
|
void DwarfPrinter::EmitReference(const MCSymbol *Sym, unsigned Encoding) const {
|
||||||
const TargetLoweringObjectFile &TLOF = Asm->getObjFileLowering();
|
const TargetLoweringObjectFile &TLOF = Asm->getObjFileLowering();
|
||||||
|
|
||||||
const MCExpr *Exp = TLOF.getExprForDwarfReference(Sym, Asm->MMI, Encoding,
|
const MCExpr *Exp = TLOF.getExprForDwarfReference(Sym, Asm->Mang,
|
||||||
|
Asm->MMI, Encoding,
|
||||||
Asm->OutStreamer);
|
Asm->OutStreamer);
|
||||||
Asm->OutStreamer.EmitValue(Exp, SizeOfEncodedValue(Encoding), /*addrspace*/0);
|
Asm->OutStreamer.EmitValue(Exp, SizeOfEncodedValue(Encoding), /*addrspace*/0);
|
||||||
}
|
}
|
||||||
|
@@ -421,7 +421,7 @@ getExprForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang,
|
|||||||
}
|
}
|
||||||
|
|
||||||
return TargetLoweringObjectFile::
|
return TargetLoweringObjectFile::
|
||||||
getExprForDwarfReference(Sym, MMI,
|
getExprForDwarfReference(Sym, Mang, MMI,
|
||||||
Encoding & ~dwarf::DW_EH_PE_indirect, Streamer);
|
Encoding & ~dwarf::DW_EH_PE_indirect, Streamer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -784,8 +784,8 @@ getExprForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang,
|
|||||||
}
|
}
|
||||||
|
|
||||||
return TargetLoweringObjectFile::
|
return TargetLoweringObjectFile::
|
||||||
getExprForDwarfReference(Sym, MMI, Encoding & ~dwarf::DW_EH_PE_indirect,
|
getExprForDwarfReference(Sym, Mang, MMI,
|
||||||
Streamer);
|
Encoding & ~dwarf::DW_EH_PE_indirect, Streamer);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TargetLoweringObjectFile::
|
return TargetLoweringObjectFile::
|
||||||
|
@@ -19,6 +19,7 @@
|
|||||||
#include "llvm/GlobalVariable.h"
|
#include "llvm/GlobalVariable.h"
|
||||||
#include "llvm/MC/MCContext.h"
|
#include "llvm/MC/MCContext.h"
|
||||||
#include "llvm/MC/MCExpr.h"
|
#include "llvm/MC/MCExpr.h"
|
||||||
|
#include "llvm/MC/MCStreamer.h"
|
||||||
#include "llvm/MC/MCSymbol.h"
|
#include "llvm/MC/MCSymbol.h"
|
||||||
#include "llvm/Target/Mangler.h"
|
#include "llvm/Target/Mangler.h"
|
||||||
#include "llvm/Target/TargetData.h"
|
#include "llvm/Target/TargetData.h"
|
||||||
@@ -307,29 +308,34 @@ getExprForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang,
|
|||||||
else
|
else
|
||||||
Sym = getContext().GetOrCreateSymbol(Name.str());
|
Sym = getContext().GetOrCreateSymbol(Name.str());
|
||||||
|
|
||||||
return getExprForDwarfReference(Sym, MMI, Encoding, Streamer);
|
return getExprForDwarfReference(Sym, Mang, MMI, Encoding, Streamer);
|
||||||
}
|
}
|
||||||
|
|
||||||
const MCExpr *TargetLoweringObjectFile::
|
const MCExpr *TargetLoweringObjectFile::
|
||||||
getExprForDwarfReference(const MCSymbol *Sym, MachineModuleInfo *MMI,
|
getExprForDwarfReference(const MCSymbol *Sym, Mangler *Mang,
|
||||||
unsigned Encoding, MCStreamer &Streamer) const {
|
MachineModuleInfo *MMI, unsigned Encoding,
|
||||||
|
MCStreamer &Streamer) const {
|
||||||
const MCExpr *Res = MCSymbolRefExpr::Create(Sym, getContext());
|
const MCExpr *Res = MCSymbolRefExpr::Create(Sym, getContext());
|
||||||
|
|
||||||
switch (Encoding & 0xF0) {
|
switch (Encoding & 0xF0) {
|
||||||
default:
|
default:
|
||||||
llvm_report_error("We do not support this DWARF encoding yet!");
|
llvm_report_error("We do not support this DWARF encoding yet!");
|
||||||
break;
|
|
||||||
case dwarf::DW_EH_PE_absptr:
|
case dwarf::DW_EH_PE_absptr:
|
||||||
// Do nothing special
|
// Do nothing special
|
||||||
break;
|
return Res;
|
||||||
case dwarf::DW_EH_PE_pcrel:
|
case dwarf::DW_EH_PE_pcrel: {
|
||||||
// FIXME: PCSymbol
|
// Emit a label to the streamer for the current position. This gives us
|
||||||
const MCExpr *PC = MCSymbolRefExpr::Create(".", getContext());
|
// .-foo addressing.
|
||||||
Res = MCBinaryExpr::CreateSub(Res, PC, getContext());
|
SmallString<128> Name;
|
||||||
break;
|
Mang->getNameWithPrefix(Name, Twine("PCtemp") + Twine(Mang->getUniqueID()),
|
||||||
}
|
Mangler::Private);
|
||||||
|
|
||||||
return Res;
|
MCSymbol *PCSym = getContext().GetOrCreateTemporarySymbol(Name.str());
|
||||||
|
Streamer.EmitLabel(PCSym);
|
||||||
|
const MCExpr *PC = MCSymbolRefExpr::Create(PCSym, getContext());
|
||||||
|
return MCBinaryExpr::CreateSub(Res, PC, getContext());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned TargetLoweringObjectFile::getPersonalityEncoding() const {
|
unsigned TargetLoweringObjectFile::getPersonalityEncoding() const {
|
||||||
|
Reference in New Issue
Block a user