summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/MCELFStreamer.cpp
diff options
context:
space:
mode:
authorColin LeMahieu <colinl@codeaurora.org>2015-06-06 20:12:40 +0000
committerColin LeMahieu <colinl@codeaurora.org>2015-06-06 20:12:40 +0000
commit1c8c213529e08e82c26548199f13bfebe42900af (patch)
treee594a82d162b9f418fd663e79e1408facbfef098 /llvm/lib/MC/MCELFStreamer.cpp
parent253fd159779114fa2bcb9deb814b4db29fa12d0a (diff)
downloadbcm5719-llvm-1c8c213529e08e82c26548199f13bfebe42900af.tar.gz
bcm5719-llvm-1c8c213529e08e82c26548199f13bfebe42900af.zip
[MC] Common symbols weren't being checked for redeclaration which allowed an assembly file to generate an assertion in setCommon(): !isCommon(). This change allows redeclaration as long as the size and alignment match exactly, otherwise report a fatal error.
llvm-svn: 239227
Diffstat (limited to 'llvm/lib/MC/MCELFStreamer.cpp')
-rw-r--r--llvm/lib/MC/MCELFStreamer.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/MC/MCELFStreamer.cpp b/llvm/lib/MC/MCELFStreamer.cpp
index da664f57803..e0f4a2ae16a 100644
--- a/llvm/lib/MC/MCELFStreamer.cpp
+++ b/llvm/lib/MC/MCELFStreamer.cpp
@@ -320,7 +320,9 @@ void MCELFStreamer::EmitCommonSymbol(MCSymbol *S, uint64_t Size,
struct LocalCommon L = {Symbol, Size, ByteAlignment};
LocalCommons.push_back(L);
} else {
- Symbol->setCommon(Size, ByteAlignment);
+ if(Symbol->declareCommon(Size, ByteAlignment))
+ report_fatal_error("Symbol: " + Symbol->getName() +
+ " redeclared as different type");
}
cast<MCSymbolELF>(Symbol)
OpenPOWER on IntegriCloud