X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FMC%2FMCSymbol.cpp;h=24165254e56a67d115c700f3f797df7f03086459;hb=a8432640e8fd7b86fec7e9bfee98433d8070bfcf;hp=6582574ae941959761d39e9baa843f9b956ae39b;hpb=2eb21d024595201b56b0471da50e0801c08f5c8e;p=oota-llvm.git diff --git a/lib/MC/MCSymbol.cpp b/lib/MC/MCSymbol.cpp index 6582574ae94..24165254e56 100644 --- a/lib/MC/MCSymbol.cpp +++ b/lib/MC/MCSymbol.cpp @@ -55,7 +55,13 @@ void MCSymbol::setVariableValue(const MCExpr *Value) { assert(!IsUsed && "Cannot set a variable that has already been used."); assert(Value && "Invalid variable value!"); this->Value = Value; - this->Section = nullptr; + + // Variables should always be marked as in the same "section" as the value. + const MCSection *Section = Value->FindAssociatedSection(); + if (Section) + setSection(*Section); + else + setUndefined(); } void MCSymbol::print(raw_ostream &OS) const {