defaults.h (TARGET_USE_JCR_SECTION): New macro.
authorDanny Smith <dannysmith@users.sourceforge.net>
Mon, 13 Dec 2004 06:57:13 +0000 (06:57 +0000)
committerDanny Smith <dannysmith@gcc.gnu.org>
Mon, 13 Dec 2004 06:57:13 +0000 (06:57 +0000)
gcc
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): Override
default.

gcc/java
PR/18549
* class.c (emit_register_classes): Use TARGET_USE_JCR_SECTION.
Update comment.

From-SVN: r92078

gcc/ChangeLog
gcc/config/i386/cygming.h
gcc/defaults.h
gcc/doc/tm.texi
gcc/java/ChangeLog
gcc/java/class.c

index 5f22db1..2c5427b 100644 (file)
@@ -1,3 +1,11 @@
+2004-12-13  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): Override
+       default.
+
 2004-12-13 Uros Bizjak <uros@kss-loka.si>
 
        PR target/14941
index 3949f4c..a354994 100644 (file)
@@ -408,6 +408,11 @@ extern int i386_pe_dllimport_name_p (const char *);
   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 daa584a..a60d2a2 100644 (file)
@@ -339,6 +339,18 @@ do { fputs (integer_asm_op (POINTER_SIZE / BITS_PER_UNIT, TRUE), FILE); \
 #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 f021d15..f5436d7 100644 (file)
@@ -9575,3 +9575,9 @@ option.  The default is to have no target-specific format checks.
 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 2c8c591..dfb5ccb 100644 (file)
@@ -1,3 +1,9 @@
+2004-12-13  Danny Smith  <dannysmith@users.sourceforge.net>
+
+       PR/18549
+       * class.c (emit_register_classes): Use TARGET_USE_JCR_SECTION.
+       Update comment.
+
 2004-12-07  Andrew Haley  <aph@redhat.com>
 
        PR java/18811:
index c314950..9413820 100644 (file)
@@ -2419,10 +2419,11 @@ emit_register_classes (tree *list_p)
   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)
+  /* 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)
     {
 #ifdef JCR_SECTION_NAME
       tree t;
@@ -2432,6 +2433,8 @@ emit_register_classes (tree *list_p)
        assemble_integer (XEXP (DECL_RTL (t), 0),
                          POINTER_SIZE / BITS_PER_UNIT, POINTER_SIZE, 1);
 #else
+      /* A target has defined TARGET_USE_JCR_SECTION, but doesn't have a
+        JCR_SECTION_NAME.  */
       abort ();
 #endif
     }