OSDN Git Service

Index: libiberty/ChangeLog
[pf3gnuchains/gcc-fork.git] / gcc / cp / mangle.c
index 40c059a..31676e7 100644 (file)
@@ -688,7 +688,8 @@ write_mangled_name (const tree decl, bool top_level)
        }
     }
   else if (TREE_CODE (decl) == VAR_DECL
-          /* The names of global variables aren't mangled.  */
+          /* The names of non-static global variables aren't mangled.  */
+          && DECL_EXTERNAL_LINKAGE_P (decl)
           && (CP_DECL_CONTEXT (decl) == global_namespace
               /* And neither are `extern "C"' variables.  */
               || DECL_EXTERN_C_P (decl)))
@@ -1086,7 +1087,10 @@ write_template_prefix (const tree node)
 
     <unqualified-name>  ::= <operator-name>
                        ::= <special-name>
-                       ::= <source-name>  */
+                       ::= <source-name>
+                       ::= <local-source-name> 
+
+    <local-source-name>        ::= L <source-name> <discriminator> */
 
 static void
 write_unqualified_name (const tree decl)
@@ -1126,6 +1130,16 @@ write_unqualified_name (const tree decl)
 
       write_string (oni[DECL_OVERLOADED_OPERATOR_P (decl)].mangled_name);
     }
+  else if (VAR_OR_FUNCTION_DECL_P (decl) && ! TREE_PUBLIC (decl)
+          && DECL_NAMESPACE_SCOPE_P (decl)
+          && decl_linkage (decl) == lk_internal)
+    {
+      MANGLE_TRACE_TREE ("local-source-name", decl);
+      write_char ('L');
+      write_source_name (DECL_NAME (decl));
+      /* The default discriminator is 1, and that's all we ever use,
+        so there's no code to output one here.  */
+    }
   else
     write_source_name (DECL_NAME (decl));
 }