[llvm-commits] [llvm] r78169 - in /llvm/trunk: docs/LangRef.html lib/VMCore/Verifier.cpp
Chris Lattner
sabre at nondot.org
Tue Aug 4 22:41:45 PDT 2009
Author: lattner
Date: Wed Aug 5 00:41:44 2009
New Revision: 78169
URL: http://llvm.org/viewvc/llvm-project?rev=78169&view=rev
Log:
common globals may also not be marked constant.
Modified:
llvm/trunk/docs/LangRef.html
llvm/trunk/lib/VMCore/Verifier.cpp
Modified: llvm/trunk/docs/LangRef.html
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LangRef.html?rev=78169&r1=78168&r2=78169&view=diff
==============================================================================
--- llvm/trunk/docs/LangRef.html (original)
+++ llvm/trunk/docs/LangRef.html Wed Aug 5 00:41:44 2009
@@ -564,9 +564,10 @@
global scope.
Symbols with "<tt>common</tt>" linkage are merged in the same way as
<tt>weak symbols</tt>, and they may not be deleted if unreferenced.
- Further, <tt>common</tt> symbols may not have an explicit section, and
- must have a zero initializer. Functions and aliases may not have common
- linkage.</dd>
+ <tt>common</tt> symbols may not have an explicit section,
+ must have a zero initializer, and may not be marked '<a
+ href="#globalvars"><tt>constant</tt></a>'. Functions and aliases may not
+ have common linkage.</dd>
<dt><tt><b><a name="linkage_appending">appending</a></b></tt>: </dt>
Modified: llvm/trunk/lib/VMCore/Verifier.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Verifier.cpp?rev=78169&r1=78168&r2=78169&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Verifier.cpp (original)
+++ llvm/trunk/lib/VMCore/Verifier.cpp Wed Aug 5 00:41:44 2009
@@ -378,11 +378,14 @@
"Global variable initializer type does not match global "
"variable type!", &GV);
- // If the global has common linkage, it must have a zero initializer.
- if (GV.hasCommonLinkage())
+ // If the global has common linkage, it must have a zero initializer and
+ // cannot be constant.
+ if (GV.hasCommonLinkage()) {
Assert1(GV.getInitializer()->isNullValue(),
"'common' global must have a zero initializer!", &GV);
-
+ Assert1(!GV.isConstant(), "'common' global may not be marked constant!",
+ &GV);
+ }
// Verify that any metadata used in a global initializer points only to
// other globals.
More information about the llvm-commits
mailing list