]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
elfos.h (MAKE_DECL_ONE_ONLY): Redefined to stop DECL_WEAK from being used for symbols...
authorJulian Brown <julian@codesourcery.com>
Wed, 13 Apr 2005 15:24:03 +0000 (15:24 +0000)
committerJulian Brown <jules@gcc.gnu.org>
Wed, 13 Apr 2005 15:24:03 +0000 (15:24 +0000)
* gcc/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.
* gcc/java/decl.c (finish_method): Give methods once-only linkage.

From-SVN: r98089

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

index 4da851e1853dba01a720f1b8dfd9a8e10a2f19a3..1a5f5f85d9044975a002b87fc88652e4a052493c 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,
index 9eed0d13fe3944a87eea4d90a189daa5d854d30e..6e41bb269368053dc7ad734558449988570e1509 100644 (file)
@@ -212,7 +212,15 @@ Boston, MA 02111-1307, USA.  */
   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
index 1044784186b31f953e509b8a09d127d8df24ca5a..a0d1037dd2f1b1e6e070ec36420c6368b89cc189 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.
index 197c391e27c071a753b1214eb845bffb759b82ce..168d30dba2a673d86147b4479fa59711a26d42ca 100644 (file)
@@ -2057,6 +2057,13 @@ finish_method (tree fndecl)
                    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)