This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[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>
- Date: Fri, 26 Nov 2004 10:34:04 +1300 (NZDT)
- Subject: [Patch] PR/18549 [4.0 Regression] gcj no longer works on win32
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. A patch has been submitted
to change that.
gcc/ChangeLog
2004-11-26 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): Ovveride
default.
gcc/java/ChangeLog
2004-11-26 Danny Smith <dannysmith@users.sourceforge.net>
PR/18549
* class.c (emit_register_classes): Use TARGET_USE_JCR_SECTION.
Index: gcc/gcc/defaults.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/defaults.h,v
retrieving revision 1.161
diff -c -3 -p -r1.161 defaults.h
*** gcc/gcc/defaults.h 18 Nov 2004 01:10:10 -0000 1.161
--- gcc/gcc/defaults.h 25 Nov 2004 21:24:44 -0000
*************** do { fputs (integer_asm_op (POINTER_SIZE
*** 319,324 ****
--- 319,336 ----
#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.393
diff -c -3 -p -r1.393 tm.texi
*** gcc/gcc/doc/tm.texi 18 Nov 2004 01:10:12 -0000 1.393
--- gcc/gcc/doc/tm.texi 25 Nov 2004 21:25:15 -0000
*************** option. The default is to have no targe
*** 9483,9485 ****
--- 9483,9491 ----
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 25 Nov 2004 21:25:17 -0000
*************** extern int i386_pe_dllimport_name_p (con
*** 408,413 ****
--- 410,420 ----
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 as well as linker supoort. */
+ #define 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.213
diff -c -3 -p -r1.213 class.c
*** gcc/gcc/java/class.c 2 Nov 2004 16:52:55 -0000 1.213
--- gcc/gcc/java/class.c 25 Nov 2004 21:25:21 -0000
*************** emit_register_classes (tree *list_p)
*** 2345,2365 ****
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
{
--- 2345,2362 ----
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 crtstuff ands/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