mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-25 05:22:04 +00:00
Fix the assembler to print a better relocatable expression error
diagnostic that includes location information.
Currently if one has this assembly:
.quad (0x1234 + (4 * SOME_VALUE))
where SOME_VALUE is undefined ones gets the less than
useful error message with no location information:
% clang -c x.s
clang -cc1as: fatal error: error in backend: expected relocatable expression
With this fix one now gets a more useful error message
with location information:
% clang -c x.s
x.s:5:8: error: expected relocatable expression
.quad (0x1234 + (4 * SOME_VALUE))
^
To do this I plumbed the SMLoc through the MCObjectStreamer
EmitValue() and EmitValueImpl() interfaces so it could be used
when creating the MCFixup.
rdar://12391022
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206906 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -72,7 +72,8 @@ public:
|
||||
uint64_t Size = 0, unsigned ByteAlignment = 0) override;
|
||||
void EmitTBSSSymbol(const MCSection *Section, MCSymbol *Symbol,
|
||||
uint64_t Size, unsigned ByteAlignment = 0) override;
|
||||
void EmitValueImpl(const MCExpr *Value, unsigned Size) override;
|
||||
void EmitValueImpl(const MCExpr *Value, unsigned Size,
|
||||
const SMLoc &Loc = SMLoc()) override;
|
||||
|
||||
void EmitFileDirective(StringRef Filename) override;
|
||||
|
||||
|
||||
@@ -81,7 +81,8 @@ public:
|
||||
void EmitLabel(MCSymbol *Symbol) override;
|
||||
void EmitDebugLabel(MCSymbol *Symbol) override;
|
||||
void EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) override;
|
||||
void EmitValueImpl(const MCExpr *Value, unsigned Size) override;
|
||||
void EmitValueImpl(const MCExpr *Value, unsigned Size,
|
||||
const SMLoc &Loc = SMLoc()) override;
|
||||
void EmitULEB128Value(const MCExpr *Value) override;
|
||||
void EmitSLEB128Value(const MCExpr *Value) override;
|
||||
void EmitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol) override;
|
||||
|
||||
@@ -529,9 +529,12 @@ public:
|
||||
/// @param Value - The value to emit.
|
||||
/// @param Size - The size of the integer (in bytes) to emit. This must
|
||||
/// match a native machine width.
|
||||
virtual void EmitValueImpl(const MCExpr *Value, unsigned Size) = 0;
|
||||
/// @param Loc - The location of the expression for error reporting.
|
||||
virtual void EmitValueImpl(const MCExpr *Value, unsigned Size,
|
||||
const SMLoc &Loc = SMLoc()) = 0;
|
||||
|
||||
void EmitValue(const MCExpr *Value, unsigned Size);
|
||||
void EmitValue(const MCExpr *Value, unsigned Size,
|
||||
const SMLoc &Loc = SMLoc());
|
||||
|
||||
/// EmitIntValue - Special case of EmitValue that avoids the client having
|
||||
/// to pass in a MCExpr for constant integers.
|
||||
|
||||
Reference in New Issue
Block a user