This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Re: [Patch] PR/18549 [4.0 Regression] gcj no longer works on win32
- From: Danny Smith <danny_smith_0000 at yahoo dot co dot nz>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>, java-patches <java-patches at gcc dot gnu dot org>
- Cc: dannysmith at users dot sourceforge dot net
- Date: Sun, 12 Dec 2004 20:37:21 +1300 (NZDT)
- Subject: Re: [Patch] PR/18549 [4.0 Regression] gcj no longer works on win32
This is a refresh of patch submitted at:
http://gcc.gnu.org/ml/gcc-patches/2004-11/msg02192.html
correcting a macro definition in cygming.h in initial patch.
This PR is caused by the assumption that if a target SUPPORTS_WEAK
and can define a JCR_SECTION_NAME, it can use the .jcr section to
register classes (See the ??? comment in java/class.c:emit_register_classes)
This patch introduces a new target macro, TARGET_USE_JCR_SECTION that
defaults to 1 if the above conditions are met. else 0, but can be
overriden by those targets that do not have suitable crtbegin or crtend
objects or linker support.
For now, cygwin and mingw32 are such targets.
gcc/ChangeLog
2004-12-12 Danny Smith <dannysmith@users.sourceforge.net>
PR/18549
* defaults.h (TARGET_USE_JCR_SECTION): New macro.
* doc/tm.texi (TARGET_USE_JCR_SECTION): Document it.
* config/i386/cygming.h (TARGET_USE_JCR_SECTION): Overide
default.
gcc/java/ChangeLog
2004-12-12 Danny Smith <dannysmith@users.sourceforge.net>
PR/18549
* class.c (emit_register_classes): Use TARGET_USE_JCR_SECTION.
Update comment.
Index: gcc/gcc/defaults.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/defaults.h,v
retrieving revision 1.162
diff -c -3 -p -r1.162 defaults.h
*** gcc/gcc/defaults.h 24 Nov 2004 14:35:24 -0000 1.162
--- gcc/gcc/defaults.h 12 Dec 2004 07:09:55 -0000
*************** do { fputs (integer_asm_op (POINTER_SIZE
*** 339,344 ****
--- 339,356 ----
#endif
#endif
+ /* This decision to use a .jcr section can be overriden by defining
+ USE_JCR_SECTION to 0 in target file. This is necessary if target
+ can define JCR_SECTION_NAME but does not have crtstuff or
+ linker support for .jcr section */
+ #ifndef TARGET_USE_JCR_SECTION
+ #ifdef JCR_SECTION_NAME
+ #define TARGET_USE_JCR_SECTION 1
+ #else
+ #define TARGET_USE_JCR_SECTION 0
+ #endif
+ #endif
+
/* Number of hardware registers that go into the DWARF-2 unwind info.
If not defined, equals FIRST_PSEUDO_REGISTER */
Index: gcc/gcc/doc/tm.texi
===================================================================
RCS file: /cvs/gcc/gcc/gcc/doc/tm.texi,v
retrieving revision 1.404
diff -c -3 -p -r1.404 tm.texi
*** gcc/gcc/doc/tm.texi 9 Dec 2004 11:06:20 -0000 1.404
--- gcc/gcc/doc/tm.texi 12 Dec 2004 07:10:26 -0000
*************** option. The default is to have no targe
*** 9575,9577 ****
--- 9575,9583 ----
If defined, this macro is the number of entries in
@code{TARGET_FORMAT_TYPES}.
@end defmac
+
+ @defmac TARGET_USE_JCR_SECTION
+ This macro determines whether to use the JCR section to register Java
+ classes. By default, TARGET_USE_JCR_SECTION is defined to 1 if both
+ SUPPORTS_WEAK and TARGET_HAVE_NAMED_SECTIONS are true, else 0.
+ @end defmac
Index: gcc/gcc/config/i386/cygming.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/cygming.h,v
retrieving revision 1.23
diff -c -3 -p -r1.23 cygming.h
*** gcc/gcc/config/i386/cygming.h 6 Nov 2004 04:28:06 -0000 1.23
--- gcc/gcc/config/i386/cygming.h 12 Dec 2004 07:10:29 -0000
*************** extern int i386_pe_dllimport_name_p (con
*** 408,413 ****
--- 408,418 ----
while (0)
#endif /* HAVE_GAS_WEAK */
+ /* FIXME: SUPPORTS_WEAK && TARGET_HAVE_NAMED_SECTIONS is true,
+ but for .jcr section to work we also need crtbegin and crtend
+ objects. */
+ #define TARGET_USE_JCR_SECTION 0
+
/* Decide whether it is safe to use a local alias for a virtual function
when constructing thunks. */
#undef TARGET_USE_LOCAL_THUNK_ALIAS_P
Index: gcc/gcc/java/class.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/class.c,v
retrieving revision 1.218
diff -c -3 -p -r1.218 class.c
*** gcc/gcc/java/class.c 3 Dec 2004 18:01:59 -0000 1.218
--- gcc/gcc/java/class.c 12 Dec 2004 07:10:33 -0000
*************** emit_register_classes (tree *list_p)
*** 2419,2439 ****
if (registered_class == NULL)
return;
! /* ??? This isn't quite the correct test. We also have to know
! that the target is using gcc's crtbegin/crtend objects rather
! than the ones that come with the operating system. */
! if (SUPPORTS_WEAK && targetm.have_named_sections)
{
- #ifdef JCR_SECTION_NAME
tree t;
named_section_flags (JCR_SECTION_NAME, SECTION_WRITE);
assemble_align (POINTER_SIZE);
for (t = registered_class; t; t = TREE_CHAIN (t))
assemble_integer (XEXP (DECL_RTL (t), 0),
POINTER_SIZE / BITS_PER_UNIT, POINTER_SIZE, 1);
- #else
- abort ();
- #endif
}
else
{
--- 2419,2436 ----
if (registered_class == NULL)
return;
! /* TARGET_USE_JCR_SECTION defaults to 1 if SUPPORTS_WEAK and
! TARGET_ASM_NAMED_SECTION, else 0. Some targets meet those conditions
! but lack suitable crtbegin/end objects or linker support. These
! targets can overide the default in tm.h to use the fallback mechanism. */
! if (TARGET_USE_JCR_SECTION)
{
tree t;
named_section_flags (JCR_SECTION_NAME, SECTION_WRITE);
assemble_align (POINTER_SIZE);
for (t = registered_class; t; t = TREE_CHAIN (t))
assemble_integer (XEXP (DECL_RTL (t), 0),
POINTER_SIZE / BITS_PER_UNIT, POINTER_SIZE, 1);
}
else
{
Find local movie times and trailers on Yahoo! Movies.
http://au.movies.yahoo.com