summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2010-12-22 19:05:49 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2010-12-22 19:05:49 +0000
commit0e14b61c0bad7796b8f7f28208cda8e776118e14 (patch)
tree5f8057e94bca9ceccf3e7b6b7575815c915b6a32 /llvm
parentd80ea20411809cfccaaf9359e135fe7cb2571474 (diff)
downloadbcm5719-llvm-0e14b61c0bad7796b8f7f28208cda8e776118e14.tar.gz
bcm5719-llvm-0e14b61c0bad7796b8f7f28208cda8e776118e14.zip
Revert r122359 while I debug PR8845.
llvm-svn: 122427
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/MC/MCExpr.cpp24
1 files changed, 19 insertions, 5 deletions
diff --git a/llvm/lib/MC/MCExpr.cpp b/llvm/lib/MC/MCExpr.cpp
index 58f2e94dd62..8fdf8378333 100644
--- a/llvm/lib/MC/MCExpr.cpp
+++ b/llvm/lib/MC/MCExpr.cpp
@@ -269,13 +269,27 @@ bool MCExpr::EvaluateAsAbsolute(int64_t &Res, const MCAssembler *Asm,
// FIXME: The use if InSet = Addrs is a hack. Setting InSet causes us
// absolutize differences across sections and that is what the MachO writer
// uses Addrs for.
- bool IsRelocatable =
- EvaluateAsRelocatableImpl(Value, Asm, Layout, Addrs, /*InSet*/ Addrs);
+ if (!EvaluateAsRelocatableImpl(Value, Asm, Layout, Addrs, /*InSet*/ Addrs) ||
+ !Value.isAbsolute()) {
+ // EvaluateAsAbsolute is defined to return the "current value" of
+ // the expression if we are given a Layout object, even in cases
+ // when the value is not fixed.
+ if (Layout) {
+ Res = Value.getConstant();
+ if (Value.getSymA()) {
+ Res += Layout->getSymbolOffset(
+ &Layout->getAssembler().getSymbolData(Value.getSymA()->getSymbol()));
+ }
+ if (Value.getSymB()) {
+ Res -= Layout->getSymbolOffset(
+ &Layout->getAssembler().getSymbolData(Value.getSymB()->getSymbol()));
+ }
+ }
+ return false;
+ }
- // Record the current value.
Res = Value.getConstant();
-
- return IsRelocatable && Value.isAbsolute();
+ return true;
}
/// \brief Helper method for \see EvaluateSymbolAdd().
OpenPOWER on IntegriCloud