Add CommonLinkage to lto (treated same as weak AFAICT)
authorDale Johannesen <dalej@apple.com>
Fri, 16 May 2008 22:44:18 +0000 (22:44 +0000)
committerDale Johannesen <dalej@apple.com>
Fri, 16 May 2008 22:44:18 +0000 (22:44 +0000)
and llvm-nm (prints as C).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51209 91177308-0d34-0410-b5e6-96231b3b80d8

tools/llvm-nm/llvm-nm.cpp
tools/lto/lto.cpp

index 63fa75d884f1a48e44ae521c015ad69b85b3285d..008c2e0431fca956121cc8abd9584a420a592f3f 100644 (file)
@@ -70,6 +70,7 @@ namespace {
 static char TypeCharForSymbol(GlobalValue &GV) {
   if (GV.isDeclaration())                                  return 'U';
   if (GV.hasLinkOnceLinkage())                             return 'C';
+  if (GV.hasCommonLinkage())                               return 'C';
   if (GV.hasWeakLinkage())                                 return 'W';
   if (isa<Function>(GV) && GV.hasInternalLinkage())        return 't';
   if (isa<Function>(GV))                                   return 'T';
index d2cb3b8b43c4724a7f1bba823e0280565e09fc49..0a962fce1ddadcecb39ea7c8c16ca10e63f089d8 100644 (file)
@@ -65,7 +65,7 @@ void LLVMSymbol::mayBeNotUsed() {
   gv->setLinkage(GlobalValue::InternalLinkage); 
 }
 
-// Map LLVM LinkageType to LTO LinakgeType
+// Map LLVM LinkageType to LTO LinkageType
 static LTOLinkageTypes
 getLTOLinkageType(GlobalValue *v)
 {
@@ -76,6 +76,8 @@ getLTOLinkageType(GlobalValue *v)
     lt = LTOLinkOnceLinkage;
   else if (v->hasWeakLinkage())
     lt = LTOWeakLinkage;
+  else if (v->hasCommonLinkage())
+    lt = LTOCommonLinkage;
   else
     // Otherwise it is internal linkage for link time optimizer
     lt = LTOInternalLinkage;