Try harder to evaluate expressions when printing assembly.

When printing assembly we don't have a Layout object, but we can still
try to fold some constants.

Testcase by Ulrich Weigand.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203677 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola
2014-03-12 16:55:59 +00:00
parent a3802ac246
commit 3b8cc2299b
9 changed files with 23 additions and 20 deletions

View File

@@ -82,7 +82,7 @@ uint64_t MachObjectWriter::getSymbolAddress(const MCSymbolData* SD,
MCValue Target;
if (!S.getVariableValue()->EvaluateAsRelocatable(Target, Layout))
if (!S.getVariableValue()->EvaluateAsRelocatable(Target, &Layout))
report_fatal_error("unable to evaluate offset for variable '" +
S.getName() + "'");
@@ -631,7 +631,7 @@ void MachObjectWriter::markAbsoluteVariableSymbols(MCAssembler &Asm,
// and neither symbol is external, mark the variable as absolute.
const MCExpr *Expr = SD.getSymbol().getVariableValue();
MCValue Value;
if (Expr->EvaluateAsRelocatable(Value, Layout)) {
if (Expr->EvaluateAsRelocatable(Value, &Layout)) {
if (Value.getSymA() && Value.getSymB())
const_cast<MCSymbol*>(&SD.getSymbol())->setAbsolute();
}