[llvm-commits] CVS: llvm-gcc/gcc/llvm-expand.c

Chris Lattner lattner at cs.uiuc.edu
Thu Jul 28 13:19:04 PDT 2005



Changes in directory llvm-gcc/gcc:

llvm-expand.c updated: 1.110 -> 1.111
---
Log message:

Fix PR610: http://llvm.cs.uiuc.edu/PR610  and Regression/CFrontend/2005-07-28-IncorrectWeakGlobal.c


---
Diffs of the changes:  (+15 -13)

 llvm-expand.c |   28 +++++++++++++++-------------
 1 files changed, 15 insertions(+), 13 deletions(-)


Index: llvm-gcc/gcc/llvm-expand.c
diff -u llvm-gcc/gcc/llvm-expand.c:1.110 llvm-gcc/gcc/llvm-expand.c:1.111
--- llvm-gcc/gcc/llvm-expand.c:1.110	Thu Jul 28 13:50:28 2005
+++ llvm-gcc/gcc/llvm-expand.c	Thu Jul 28 15:18:53 2005
@@ -7653,19 +7653,6 @@
     if (PName && strcmp(PName, G2V(G)->Name))
       G->PrettyGlobalName = xstrdup(PName);
     
-    if (!TREE_PUBLIC(decl) || lang_hooks.llvm_is_in_anon(decl)) {
-      G->Linkage = L_Internal;
-    } else if (DECL_COMDAT(decl) || /*) {
-
-      FIXME: This is disabled, because with it we lose the definitions of _ZTIi
-      and friends (typeinfo for builtin types).  It looks like these are being
-      incorrectly marked as COMDAT even while compiling tinfo2.cc, where they
-      should be emitted as strong symbols.
-
-      G->Linkage = L_LinkOnce;
-      } else if (*/DECL_WEAK(decl) || DECL_COMMON(decl) || DECL_VIRTUAL_P(decl))
-      G->Linkage = L_Weak;
-
     if (TREE_READONLY(decl) && !TREE_SIDE_EFFECTS(decl)) {
       if (DECL_EXTERNAL(decl)) {
         /* Mark external globals constant even though they could be marked
@@ -7717,6 +7704,21 @@
     OldGlobal->ForwardedGlobal = G;
     assert(G2V(G)->Ty == Ty && "LLVM type not correctly set??");
   }
+  
+  if (!TREE_PUBLIC(decl) || lang_hooks.llvm_is_in_anon(decl)) {
+    G->Linkage = L_Internal;
+  } else if (DECL_COMDAT(decl) || /*) {
+    
+    FIXME: This is disabled, because with it we lose the definitions of _ZTIi
+    and friends (typeinfo for builtin types).  It looks like these are being
+    incorrectly marked as COMDAT even while compiling tinfo2.cc, where they
+    should be emitted as strong symbols.  This is tested by
+    SingleSource/Regression/C++/BuiltinTypeInfo.cpp
+      
+      G->Linkage = L_LinkOnce;
+  } else if (*/DECL_WEAK(decl) || DECL_COMMON(decl) || DECL_VIRTUAL_P(decl)) {
+    G->Linkage = L_Weak;
+  }    
 
   if (DECL_INITIAL(decl) && DECL_INITIAL(decl) != error_mark_node) {
     /* An initializer was specified for the global */






More information about the llvm-commits mailing list