OSDN Git Service

* gcc/config/elfos.h (MAKE_DECL_ONE_ONLY): Redefined to stop DECL_WEAK
authorjules <jules@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 13 Apr 2005 15:24:03 +0000 (15:24 +0000)
committerjules <jules@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 13 Apr 2005 15:24:03 +0000 (15:24 +0000)
from being used for symbols with vague linkage when
HAVE_GAS_COMDAT_GROUP is true.
* gcc/java/decl.c (finish_method): Give methods once-only linkage.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@98089 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config/elfos.h
gcc/java/ChangeLog
gcc/java/decl.c

index 4da851e..1a5f5f8 100644 (file)
@@ -1,3 +1,9 @@
+2005-04-13  Julian Brown  <julian@codesourcery.com>
+
+       * config/elfos.h (MAKE_DECL_ONE_ONLY): Redefined to stop DECL_WEAK from
+       being used for symbols with vague linkage when HAVE_GAS_COMDAT_GROUP
+       is true. 
+
 2005-04-13  Kazu Hirata  <kazu@cs.umass.edu>
 
        * basic-block.h, tree-ssa-uncprop.c, varasm.c,
 2005-04-13  Kazu Hirata  <kazu@cs.umass.edu>
 
        * basic-block.h, tree-ssa-uncprop.c, varasm.c,
index 9eed0d1..6e41bb2 100644 (file)
@@ -212,7 +212,15 @@ Boston, MA 02111-1307, USA.  */
   fprintf ((FILE), "%s\n", ASM_SECTION_START_OP)
 #endif
 
   fprintf ((FILE), "%s\n", ASM_SECTION_START_OP)
 #endif
 
-#define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1)
+/* Don't use weak for entities with vague linkage when HAVE_GAS_COMDAT_GROUP
+   is true.  */
+#define MAKE_DECL_ONE_ONLY(DECL)                       \
+  do                                                   \
+    {                                                  \
+      if (!HAVE_GAS_COMDAT_GROUP)                      \
+       DECL_WEAK(DECL) = 1;                            \
+    }                                                  \
+  while (0)
 
 /* Switch into a generic section.  */
 #define TARGET_ASM_NAMED_SECTION  default_elf_asm_named_section
 
 /* Switch into a generic section.  */
 #define TARGET_ASM_NAMED_SECTION  default_elf_asm_named_section
index 1044784..a0d1037 100644 (file)
@@ -1,3 +1,7 @@
+2005-04-13  Julian Brown  <julian@codesourcery.com>
+
+       * decl.c (finish_method): Give methods once-only linkage.
+
 2005-04-11  Richard Sandiford  <rsandifo@redhat.com>
 
        * lang.opt: Refer to the GCC internals documentation instead of c.opt.
 2005-04-11  Richard Sandiford  <rsandifo@redhat.com>
 
        * lang.opt: Refer to the GCC internals documentation instead of c.opt.
index 197c391..168d30d 100644 (file)
@@ -2057,6 +2057,13 @@ finish_method (tree fndecl)
                    build2 (TRY_FINALLY_EXPR, void_type_node, *tp, exit));
     }
 
                    build2 (TRY_FINALLY_EXPR, void_type_node, *tp, exit));
     }
 
+  /* Ensure non-abstract non-static non-private members are defined only once
+     when linking. This is an issue when using CNI to interface with C++ object
+     files.  */
+  if (! METHOD_STATIC (fndecl) && ! METHOD_PRIVATE (fndecl)
+      && ! METHOD_ABSTRACT (fndecl) && ! METHOD_FINAL (fndecl))
+    make_decl_one_only (fndecl);
+
   /* Prepend class initialization for static methods reachable from
      other classes.  */
   if (METHOD_STATIC (fndecl)
   /* Prepend class initialization for static methods reachable from
      other classes.  */
   if (METHOD_STATIC (fndecl)