This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Re: [PATCH] Use vague linkage for Java methods
- From: Julian Brown <julian at codesourcery dot com>
- To: Julian Brown <julian at codesourcery dot com>
- Cc: GCJ Patches <java-patches at gcc dot gnu dot org>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 08 Mar 2005 15:32:12 +0000
- Subject: Re: [PATCH] Use vague linkage for Java methods
- References: <422D0F4C.8040609@codesourcery.com> <422D32AE.40002@gmail.com> <422D9F03.4090900@codesourcery.com>
Julian Brown wrote:
Ranjit Mathew wrote:
Lastly, please do verify Java patches against the Jacks
testsuite as well:
http://gcc.gnu.org/install/test.html#TOC2
OK, I'll do that.
I've now tested the patch with Jacks too, with no regressions (again on
i686-pc-linux-gnu). A cleaned-up patch & ChangeLog are included.
OK to apply on mainline?
ChangeLog:
* decl.c (finish_method): Give methods once-only linkage.
Index: gcc/java/decl.c
===================================================================
RCS file: /home/gcc/repos/gcc/gcc/gcc/java/decl.c,v
retrieving revision 1.209
diff -c -p -r1.209 decl.c
*** gcc/java/decl.c 14 Feb 2005 14:58:22 -0000 1.209
--- gcc/java/decl.c 8 Mar 2005 15:05:49 -0000
*************** finish_method (tree fndecl)
*** 2036,2041 ****
--- 2036,2048 ----
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))
+ make_decl_one_only (fndecl);
+
/* Prepend class initialization for static methods reachable from
other classes. */
if (METHOD_STATIC (fndecl) && ! METHOD_PRIVATE (fndecl)