summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/MCAsmStreamer.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-08-14 19:10:46 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-08-14 19:10:46 +0000
commitc2346a30376b135c068b93de655c7cf4598a6ad8 (patch)
tree8004c9627b52cabd9548ed80da54b5b8be30f277 /llvm/lib/MC/MCAsmStreamer.cpp
parentc1524d442da06f3ba47df8606ee56d438aa20981 (diff)
downloadbcm5719-llvm-c2346a30376b135c068b93de655c7cf4598a6ad8.tar.gz
bcm5719-llvm-c2346a30376b135c068b93de655c7cf4598a6ad8.zip
llvm-mc: When handling a .set, make sure to print subsequent references to the
symbol as the symbol name itself, not the expression it was defined to. These have different semantics due to the quirky .set behavior (which absolutizes an expression that would otherwise be treated as a relocation). llvm-svn: 79025
Diffstat (limited to 'llvm/lib/MC/MCAsmStreamer.cpp')
-rw-r--r--llvm/lib/MC/MCAsmStreamer.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/llvm/lib/MC/MCAsmStreamer.cpp b/llvm/lib/MC/MCAsmStreamer.cpp
index 43ce04ffdfd..41f88334e2b 100644
--- a/llvm/lib/MC/MCAsmStreamer.cpp
+++ b/llvm/lib/MC/MCAsmStreamer.cpp
@@ -136,11 +136,18 @@ void MCAsmStreamer::EmitAssignment(MCSymbol *Symbol, const MCValue &Value,
if (MakeAbsolute) {
OS << ".set " << Symbol << ", " << Value << '\n';
+
+ // HACK: If the value isn't already absolute, set the symbol value to
+ // itself, we want to use the .set absolute value, not the actual
+ // expression.
+ if (!Value.isAbsolute())
+ getContext().SetSymbolValue(Symbol, MCValue::get(Symbol));
+ else
+ getContext().SetSymbolValue(Symbol, Value);
} else {
OS << Symbol << " = " << Value << '\n';
+ getContext().SetSymbolValue(Symbol, Value);
}
-
- getContext().SetSymbolValue(Symbol, Value);
}
void MCAsmStreamer::EmitSymbolAttribute(MCSymbol *Symbol,
OpenPOWER on IntegriCloud