This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
[RFC PATCH] Don't use ELF weak for entities with vague linkage whenCOMDAT groups are available
- From: Julian Brown <julian at codesourcery dot com>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Cc: GCJ Patches <java-patches at gcc dot gnu dot org>, Julian Brown <julian at codesourcery dot com>
- Date: Fri, 08 Apr 2005 22:51:15 +0100
- Subject: [RFC PATCH] Don't use ELF weak for entities with vague linkage whenCOMDAT groups are available
Hi,
This is a patch to disable ELF weak for entities with vague linkage when
HAVE_GAS_COMDAT_GROUP is true. It was previously posted in two parts and
applied, then reverted soon after for causing breakage:
elfos.h patch:
http://gcc.gnu.org/ml/gcc-patches/2005-02/msg01624.html
Java patch:
http://gcc.gnu.org/ml/gcc-patches/2005-03/msg00712.html
These patches caused two problems. The first was causing bootstrap
failure on Darwin/ppc:
http://gcc.gnu.org/ml/gcc-regression/2005-03/msg00060.html
And the other was causing lots of "size of symbol changed" regressions:
http://gcc.gnu.org/ml/gcc-regression/2005-03/msg00056.html
I believe I have fixed the former problem with the attached patch, but I
have been unable to reproduce the latter test failures. I have tried on
various machines, including:
i686-pc-linux-gnu, Red Hat 8.0, bundled binutils (2.16.90) (no COMDAT
group support).
i686-pc-linux-gnu, Red Hat 8.0, binutils from cvs (2.16.90 20050330)
(with COMDAT support).
powerpc-apple-darwin7.4.0, cctools-576 (no COMDAT support)
i686-pc-linux-gnu, Debian testing, bundled binutils (2.15) (no COMDAT
support)
I haven't seen any sign of "size of symbol changed"-type errors after
running tests on any of these machines. They may have been indicative of
a system which has COMDAT support in the assembler, but not the linker,
for some reason.
If people would try this patch and run the testsuite on their machines,
I'd be grateful. I'd appreciate it if you post information about
failures which show up for you, with version numbers of binutils bits,
so I can attempt to track down whatever broke before.
Thanks,
Julian
Index: gcc/config/elfos.h
===================================================================
RCS file: /home/gcc/repos/gcc/gcc/gcc/config/elfos.h,v
retrieving revision 1.70
diff -c -p -r1.70 elfos.h
*** gcc/config/elfos.h 8 Mar 2005 23:24:46 -0000 1.70
--- gcc/config/elfos.h 31 Mar 2005 16:19:16 -0000
*************** Boston, MA 02111-1307, USA. */
*** 212,218 ****
fprintf ((FILE), "%s\n", ASM_SECTION_START_OP)
#endif
! #define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1)
/* Switch into a generic section. */
#define TARGET_ASM_NAMED_SECTION default_elf_asm_named_section
--- 212,226 ----
fprintf ((FILE), "%s\n", ASM_SECTION_START_OP)
#endif
! /* 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: gcc/java/decl.c
===================================================================
RCS file: /home/gcc/repos/gcc/gcc/gcc/java/decl.c,v
retrieving revision 1.214
diff -c -p -r1.214 decl.c
*** gcc/java/decl.c 23 Mar 2005 20:26:58 -0000 1.214
--- gcc/java/decl.c 4 Apr 2005 20:19:34 -0000
*************** finish_method (tree fndecl)
*** 2052,2057 ****
--- 2052,2064 ----
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)