Make getBaseSymbol non recursive.

llvm-svn: 207759
This commit is contained in:
Rafael Espindola 2014-05-01 13:09:42 +00:00
parent 576a0415cb
commit d5bbf36fcc
1 changed files with 5 additions and 3 deletions

View File

@ -585,16 +585,18 @@ static const MCSymbol *getBaseSymbol(const MCAsmLayout &Layout,
MCValue Value;
if (!Expr->EvaluateAsValue(Value, &Layout))
llvm_unreachable("Invalid Expression");
const MCSymbolRefExpr *RefB = Value.getSymB();
if (RefB) {
if (RefB)
Layout.getAssembler().getContext().FatalError(
SMLoc(), Twine("symbol '") + RefB->getSymbol().getName() +
"' could not be evaluated in a subtraction expression");
}
const MCSymbolRefExpr *A = Value.getSymA();
if (!A)
return nullptr;
return getBaseSymbol(Layout, A->getSymbol());
return &A->getSymbol();
}
void ELFObjectWriter::WriteSymbol(SymbolTableWriter &Writer, ELFSymbolData &MSD,