summaryrefslogtreecommitdiff
path: root/lib/MC/MCSymbol.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2011-04-29 18:20:17 +0000
committerDaniel Dunbar <daniel@zuster.org>2011-04-29 18:20:17 +0000
commit90604ab725da8a2a57cf3ca1541b14b95d619040 (patch)
tree043e57a0fb1341dc8afb3f3b5ebf029021a70def /lib/MC/MCSymbol.cpp
parent173aa9ce3207379f9d9b18bdb9aefb0de1da8c85 (diff)
downloadllvm-90604ab725da8a2a57cf3ca1541b14b95d619040.tar.gz
llvm-90604ab725da8a2a57cf3ca1541b14b95d619040.tar.bz2
llvm-90604ab725da8a2a57cf3ca1541b14b95d619040.tar.xz
MC: Change variable symbols to be recognized as defined, by assigning their sections based on FindAssociatedSection().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130523 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC/MCSymbol.cpp')
-rw-r--r--lib/MC/MCSymbol.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/MC/MCSymbol.cpp b/lib/MC/MCSymbol.cpp
index 1c71f267a4..c2fad1674a 100644
--- a/lib/MC/MCSymbol.cpp
+++ b/lib/MC/MCSymbol.cpp
@@ -58,9 +58,13 @@ void MCSymbol::setVariableValue(const MCExpr *Value) {
"Invalid redefinition!");
this->Value = Value;
- // Mark the variable as absolute as appropriate.
- if (isa<MCConstantExpr>(Value))
- setAbsolute();
+ // 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 {