mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-05-15 16:38:41 +00:00
Add an EmitAbsValue helper method and use it in cases where we want to be sure
that no relocations are used (on MochO). Fixes llc producing different output from llc + llvm-mc. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121000 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
03a83a3f41
commit
2303c9dd69
@ -249,6 +249,11 @@ namespace llvm {
|
|||||||
virtual void EmitIntValue(uint64_t Value, unsigned Size,
|
virtual void EmitIntValue(uint64_t Value, unsigned Size,
|
||||||
unsigned AddrSpace = 0);
|
unsigned AddrSpace = 0);
|
||||||
|
|
||||||
|
/// EmitAbsValue - Emit the Value, but try to avoid relocations. On MachO
|
||||||
|
/// this is done by producing
|
||||||
|
/// foo = value
|
||||||
|
/// .long foo
|
||||||
|
void EmitAbsValue(const MCExpr *Value, unsigned Size);
|
||||||
|
|
||||||
virtual void EmitULEB128Value(const MCExpr *Value,
|
virtual void EmitULEB128Value(const MCExpr *Value,
|
||||||
unsigned AddrSpace = 0) = 0;
|
unsigned AddrSpace = 0) = 0;
|
||||||
|
@ -156,7 +156,7 @@ void AsmPrinter::EmitReference(const MCSymbol *Sym, unsigned Encoding) const {
|
|||||||
|
|
||||||
const MCExpr *Exp =
|
const MCExpr *Exp =
|
||||||
TLOF.getExprForDwarfReference(Sym, Mang, MMI, Encoding, OutStreamer);
|
TLOF.getExprForDwarfReference(Sym, Mang, MMI, Encoding, OutStreamer);
|
||||||
OutStreamer.EmitValue(Exp, GetSizeOfEncodedValue(Encoding), /*addrspace*/0);
|
OutStreamer.EmitAbsValue(Exp, GetSizeOfEncodedValue(Encoding));
|
||||||
}
|
}
|
||||||
|
|
||||||
void AsmPrinter::EmitReference(const GlobalValue *GV, unsigned Encoding)const{
|
void AsmPrinter::EmitReference(const GlobalValue *GV, unsigned Encoding)const{
|
||||||
|
@ -213,15 +213,8 @@ void MCDwarfFileTable::Emit(MCStreamer *MCOS,
|
|||||||
|
|
||||||
// The first 4 bytes is the total length of the information for this
|
// The first 4 bytes is the total length of the information for this
|
||||||
// compilation unit (not including these 4 bytes for the length).
|
// compilation unit (not including these 4 bytes for the length).
|
||||||
// FIXME: We create the dummy TotalLength variable because LineEndSym points
|
MCOS->EmitAbsValue(MakeStartMinusEndExpr(MCOS, LineStartSym, LineEndSym,4),
|
||||||
// to the end of the section and the darwin assembler doesn't consider that
|
4);
|
||||||
// difference an assembly time constant. It might be better for this to be
|
|
||||||
// proected by a flag.
|
|
||||||
MCSymbol *TotalLength = MCOS->getContext().CreateTempSymbol();
|
|
||||||
MCOS->EmitAssignment(TotalLength,
|
|
||||||
MakeStartMinusEndExpr(MCOS, LineStartSym, LineEndSym,
|
|
||||||
4));
|
|
||||||
MCOS->EmitSymbolValue(TotalLength, 4, 0);
|
|
||||||
|
|
||||||
// Next 2 bytes is the Version, which is Dwarf 2.
|
// Next 2 bytes is the Version, which is Dwarf 2.
|
||||||
MCOS->EmitIntValue(2, 2);
|
MCOS->EmitIntValue(2, 2);
|
||||||
|
@ -72,6 +72,12 @@ void MCStreamer::EmitSLEB128IntValue(int64_t Value, unsigned AddrSpace) {
|
|||||||
EmitBytes(OSE.str(), AddrSpace);
|
EmitBytes(OSE.str(), AddrSpace);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MCStreamer::EmitAbsValue(const MCExpr *Value, unsigned Size) {
|
||||||
|
MCSymbol *ABS = getContext().CreateTempSymbol();
|
||||||
|
EmitAssignment(ABS, Value);
|
||||||
|
EmitSymbolValue(ABS, Size, 0);
|
||||||
|
}
|
||||||
|
|
||||||
void MCStreamer::EmitSymbolValue(const MCSymbol *Sym, unsigned Size,
|
void MCStreamer::EmitSymbolValue(const MCSymbol *Sym, unsigned Size,
|
||||||
unsigned AddrSpace) {
|
unsigned AddrSpace) {
|
||||||
EmitValue(MCSymbolRefExpr::Create(Sym, getContext()), Size, AddrSpace);
|
EmitValue(MCSymbolRefExpr::Create(Sym, getContext()), Size, AddrSpace);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user