From 1c8c213529e08e82c26548199f13bfebe42900af Mon Sep 17 00:00:00 2001 From: Colin LeMahieu Date: Sat, 6 Jun 2015 20:12:40 +0000 Subject: [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 --- llvm/lib/MC/MCELFStreamer.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'llvm/lib/MC/MCELFStreamer.cpp') 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(Symbol) -- cgit v1.2.3