[MC] Common symbols weren't being checked for redeclaration which allowed an assembly...
[oota-llvm.git] / lib / MC / MCELFStreamer.cpp
index da664f578034b2783d23b11fdd5b9fc2223aa332..e0f4a2ae16a36652c3893f6e5c5dfca11f9f7557 100644 (file)
@@ -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)