I accidentally exposed a bug in MCExpr::evaluateAsRelocatableImpl() with the test file added in:
http://reviews.llvm.org/rL269977
I don't know anything about MC. Is this a viable fix?
Note that I see at least one other negation later in this file that seems like it could trigger the same UB:
return EvaluateSymbolicAdd(Asm, Layout, Addrs, InSet, LHSValue, RHSValue.getSymB(), RHSValue.getSymA(), -RHSValue.getConstant(), Res);
I'd just go with:
Res = MCValue::get(Value.getSymB(), Value.getSymA(), -(uint64_t)Value.getConstant());