[llvm-commits] [llvm] r98464 - in /llvm/trunk/lib/MC: MCExpr.cpp MCMachOStreamer.cpp
Daniel Dunbar
daniel at zuster.org
Sat Mar 13 19:10:40 PST 2010
Author: ddunbar
Date: Sat Mar 13 21:10:40 2010
New Revision: 98464
URL: http://llvm.org/viewvc/llvm-project?rev=98464&view=rev
Log:
MC: Fix a crash on invalid, attempting to evaluate undefined symbols.
Modified:
llvm/trunk/lib/MC/MCExpr.cpp
llvm/trunk/lib/MC/MCMachOStreamer.cpp
Modified: llvm/trunk/lib/MC/MCExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCExpr.cpp?rev=98464&r1=98463&r2=98464&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCExpr.cpp (original)
+++ llvm/trunk/lib/MC/MCExpr.cpp Sat Mar 13 21:10:40 2010
@@ -195,10 +195,11 @@
if (!Sym.getValue()->EvaluateAsRelocatable(Res, Layout))
return false;
- // Absolutize symbol differences when we have a layout object and the
- // target requests it.
+ // Absolutize symbol differences between defined symbols when we have a
+ // layout object and the target requests it.
if (Layout && Res.getSymB() &&
- Layout->getAssembler().getBackend().hasAbsolutizedSet()) {
+ Layout->getAssembler().getBackend().hasAbsolutizedSet() &&
+ Res.getSymA()->isDefined() && Res.getSymB()->isDefined()) {
MCSymbolData &A = Layout->getAssembler().getSymbolData(*Res.getSymA());
MCSymbolData &B = Layout->getAssembler().getSymbolData(*Res.getSymB());
Res = MCValue::get(+ A.getFragment()->getAddress() + A.getOffset()
Modified: llvm/trunk/lib/MC/MCMachOStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCMachOStreamer.cpp?rev=98464&r1=98463&r2=98464&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCMachOStreamer.cpp (original)
+++ llvm/trunk/lib/MC/MCMachOStreamer.cpp Sat Mar 13 21:10:40 2010
@@ -184,7 +184,7 @@
// FIXME: Lift context changes into super class.
// FIXME: Set associated section.
- Symbol->setValue(Value);
+ Symbol->setValue(AddValueSymbols(Value));
}
void MCMachOStreamer::EmitSymbolAttribute(MCSymbol *Symbol,
More information about the llvm-commits
mailing list