]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Index: gcc/gcc/ChangeLog
authorGeoffrey Keating <geoffk@apple.com>
Tue, 26 Oct 2004 06:09:05 +0000 (06:09 +0000)
committerGeoffrey Keating <geoffk@gcc.gnu.org>
Tue, 26 Oct 2004 06:09:05 +0000 (06:09 +0000)
2004-10-25  Geoffrey Keating  <geoffk@apple.com>

* config/darwin.h (LINK_SPEC): Default weak_reference_mismatches
to 'non-weak'.
(MAKE_DECL_ONE_ONLY): Set DECL_WEAK.
(ASM_MAKE_LABEL_LINKONCE): Delete.
(ASM_WEAKEN_DECL): New.
(ASM_DECLARE_OBJECT_NAME): Look at DECL_WEAK not DECL_ONE_ONLY.
(ASM_DECLARE_FUNCTION_NAME): Likewise.
(TEXT_SECTION_ASM_OP): Add a tab.
(DATA_SECTION_ASM_OP): Likewise.
(SECTION_FUNCTION): Add a tab.  Use fputs.  Don't call
data_section on every section change.
(EXTRA_SECTIONS): Add a bunch of new extra sections.
(EXTRA_SECTION_FUNCTIONS): Likewise.
(USE_SELECT_SECTION_FOR_FUNCTIONS): Define.
(JCR_SECTION_NAME): Define.
(TARGET_SECTION_TYPE_FLAGS): Don't define.
* config/darwin.c (darwin_encode_section_info): A symbol is defined
in this file if it is not weak.
(textcoal_section): Delete.
(datacoal_section): Delete.
(darwin_make_decl_one_only): Delete.
(machopic_select_section): Handle functions.
(darwin_asm_named_section): Add a tab.
(darwin_section_type_flags): Delete.
(darwin_unique_section): Delete contents.
(darwin_emit_unwind_label): Add a tab.  Make decls weak if
DECL_WEAK is set.
* config/darwin-protos.h (darwin_section_type_flags): Delete.
(darwin_make_decl_one_only): Delete.
(text_coal_section): New.
(text_unlikely_section): New.
(text_unlikely_coal_section): New.
(const_coal_section): New.
(data_coal_section): New.
(const_data_coal_section): New.
* varasm.c (function_section): Honour
USE_SELECT_SECTION_FOR_FUNCTIONS.
* dwarf2out.c (output_call_frame_info): Look at DECL_WEAK when
TARGET_USES_WEAK_UNWIND_INFO is in effect.
* dbxout.c (dbxout_source_file): Don't change sections while
a function is being output.

Index: gcc/testsuite/ChangeLog
2004-10-25  Geoffrey Keating  <geoffk@apple.com>

* objc.dg/image-info.m: Update for changes to section selection.

Index: libjava/ChangeLog
2004-10-25  Geoffrey Keating  <geoffk@apple.com>

* Makefile.am (DARWIN_CRT_SRC): New.
(libgcj_la_SOURCES): Use it.
* configure.ac: Define USING_DARWIN_CRT when on Darwin.
* darwin.cc: New file.
* include/jvm.h (_Jv_RegisterClasses): Constify.
(_Jv_RegisterClasses_Counted): New prototype.
* java/lang/Class.h: Include stddef.h.
(_Jv_RegisterClasses): Constify.
(_Jv_RegisterClasses_Counted): New prototype.
(Object): Make '_Jv_RegisterClasses_Counted' a friend.
* java/lang/natClassLoader.cc (_Jv_RegisterClasses): Constify.
(_Jv_RegisterClasses_Counted): New function.
* configure: Regenerate.
* Makefile.in: Regenerate.
* gcj/Makefile.in: Regenerate.
* include/Makefile.in: Regenerate.
* testsuite/Makefile.in: Regenerate.

Index: libstdc++-v3/ChangeLog
2004-10-25  Geoffrey Keating  <geoffk@apple.com>

* libsupc++/new_op.cc (new): Make weak.
* libsupc++/new_opnt.cc (new): Make weak.
* libsupc++/new_opv.cc (new): Make weak.
* libsupc++/new_opvnt.cc (new): Make weak.
* libsupc++/delete_op.cc (delete): Make weak.
* libsupc++/delete_opnt.cc (delete): Make weak.
* libsupc++/delete_opv.cc (delete): Make weak.
* libsupc++/delete_opvnt.cc (delete): Make weak.

From-SVN: r89572

31 files changed:
gcc/ChangeLog
gcc/config/darwin-protos.h
gcc/config/darwin.c
gcc/config/darwin.h
gcc/dbxout.c
gcc/dwarf2out.c
gcc/testsuite/ChangeLog
gcc/testsuite/objc.dg/image-info.m
gcc/varasm.c
libjava/ChangeLog
libjava/Makefile.am
libjava/Makefile.in
libjava/configure
libjava/configure.ac
libjava/darwin.cc [new file with mode: 0644]
libjava/gcj/Makefile.in
libjava/include/Makefile.in
libjava/include/jvm.h
libjava/java/lang/Class.h
libjava/java/lang/natClassLoader.cc
libjava/testsuite/Makefile.in
libstdc++-v3/ChangeLog
libstdc++-v3/configure.host
libstdc++-v3/libsupc++/del_op.cc
libstdc++-v3/libsupc++/del_opnt.cc
libstdc++-v3/libsupc++/del_opv.cc
libstdc++-v3/libsupc++/del_opvnt.cc
libstdc++-v3/libsupc++/new_op.cc
libstdc++-v3/libsupc++/new_opnt.cc
libstdc++-v3/libsupc++/new_opv.cc
libstdc++-v3/libsupc++/new_opvnt.cc

index ae76071825d2b20b62e24849b84d42c102928536..d2b1cc423bdcc76140d7f29600f6eb3af8450334 100644 (file)
@@ -1,3 +1,47 @@
+2004-10-25  Geoffrey Keating  <geoffk@apple.com>
+
+       * config/darwin.h (LINK_SPEC): Default weak_reference_mismatches
+       to 'non-weak'.
+       (MAKE_DECL_ONE_ONLY): Set DECL_WEAK.
+       (ASM_MAKE_LABEL_LINKONCE): Delete.
+       (ASM_WEAKEN_DECL): New.
+       (ASM_DECLARE_OBJECT_NAME): Look at DECL_WEAK not DECL_ONE_ONLY.
+       (ASM_DECLARE_FUNCTION_NAME): Likewise.
+       (TEXT_SECTION_ASM_OP): Add a tab.
+       (DATA_SECTION_ASM_OP): Likewise.
+       (SECTION_FUNCTION): Add a tab.  Use fputs.  Don't call
+       data_section on every section change.
+       (EXTRA_SECTIONS): Add a bunch of new extra sections.
+       (EXTRA_SECTION_FUNCTIONS): Likewise.
+       (USE_SELECT_SECTION_FOR_FUNCTIONS): Define.
+       (JCR_SECTION_NAME): Define.
+       (TARGET_SECTION_TYPE_FLAGS): Don't define.
+       * config/darwin.c (darwin_encode_section_info): A symbol is defined
+       in this file if it is not weak.
+       (textcoal_section): Delete.
+       (datacoal_section): Delete.
+       (darwin_make_decl_one_only): Delete.
+       (machopic_select_section): Handle functions.
+       (darwin_asm_named_section): Add a tab.
+       (darwin_section_type_flags): Delete.
+       (darwin_unique_section): Delete contents.
+       (darwin_emit_unwind_label): Add a tab.  Make decls weak if
+       DECL_WEAK is set.
+       * config/darwin-protos.h (darwin_section_type_flags): Delete.
+       (darwin_make_decl_one_only): Delete.
+       (text_coal_section): New.
+       (text_unlikely_section): New.
+       (text_unlikely_coal_section): New.
+       (const_coal_section): New.
+       (data_coal_section): New.
+       (const_data_coal_section): New.
+       * varasm.c (function_section): Honour
+       USE_SELECT_SECTION_FOR_FUNCTIONS.
+       * dwarf2out.c (output_call_frame_info): Look at DECL_WEAK when
+       TARGET_USES_WEAK_UNWIND_INFO is in effect.
+       * dbxout.c (dbxout_source_file): Don't change sections while
+       a function is being output.
+
 2004-10-25  David Ayers  <d.ayers@inode.at>
 
        * c-common.h: Remove RID_ID.
index 402311c6bb129ab076efdb17a29b39f98a898ff6..9a915a2b16f7a375af36c444e19d31fd67aa0ea6 100644 (file)
@@ -70,7 +70,6 @@ extern void machopic_select_rtx_section (enum machine_mode, rtx,
 
 extern void darwin_unique_section (tree decl, int reloc);
 extern void darwin_asm_named_section (const char *, unsigned int, tree);
-extern unsigned int darwin_section_type_flags (tree, const char *, int);
 extern void darwin_non_lazy_pcrel (FILE *, rtx);
 
 extern void darwin_emit_unwind_label (FILE *, tree, int, int);
@@ -81,12 +80,17 @@ extern void darwin_pragma_unused (struct cpp_reader *);
 
 extern void darwin_file_end (void);
 
-extern void darwin_make_decl_one_only (tree decl);
 extern void darwin_mark_decl_preserved (const char *);
 
 /* Expanded by EXTRA_SECTION_FUNCTIONS into varasm.o.  */
+extern void text_coal_section (void);
+extern void text_unlikely_section (void);
+extern void text_unlikely_coal_section (void);
 extern void const_section (void);
+extern void const_coal_section (void);
 extern void const_data_section (void);
+extern void const_data_coal_section (void);
+extern void data_coal_section (void);
 extern void cstring_section (void);
 extern void literal4_section (void);
 extern void literal8_section (void);
index dd9c34d984ae075249ab6d72d96a8dc40161870a..0c39fd80c650eef0ab8ad4df30261e597ab50e9f 100644 (file)
@@ -976,7 +976,7 @@ darwin_encode_section_info (tree decl, rtx rtl, int first ATTRIBUTE_UNUSED)
     SYMBOL_REF_FLAGS (sym_ref) |= MACHO_SYMBOL_FLAG_VARIABLE;
 
   if (!DECL_EXTERNAL (decl)
-      && (!TREE_PUBLIC (decl) || (!DECL_ONE_ONLY (decl) && !DECL_WEAK (decl)))
+      && (!TREE_PUBLIC (decl) || !DECL_WEAK (decl))
       && ((TREE_STATIC (decl)
           && (!DECL_COMMON (decl) || !TREE_PUBLIC (decl)))
          || (!DECL_COMMON (decl) && DECL_INITIAL (decl)
@@ -989,29 +989,6 @@ darwin_encode_section_info (tree decl, rtx rtl, int first ATTRIBUTE_UNUSED)
     SYMBOL_REF_FLAGS (sym_ref) |= MACHO_SYMBOL_STATIC;
 }
 
-static GTY(()) tree textcoal_section = 0;
-static GTY(()) tree datacoal_section = 0;
-
-void
-darwin_make_decl_one_only (tree decl)
-{
-  tree sec = 0;
-  if (textcoal_section == 0)
-    {
-      static const char *ts = "__TEXT,__textcoal_nt,coalesced";
-      static const char *ds = "__DATA,__datacoal_nt,coalesced";
-      textcoal_section = build_string (strlen (ts), ts);
-      datacoal_section = build_string (strlen (ds), ds);
-    }
-
-  sec = TREE_CODE (decl) == FUNCTION_DECL
-    ? textcoal_section
-    : datacoal_section;
-  TREE_PUBLIC (decl) = 1;
-  DECL_ONE_ONLY (decl) = 1;
-  DECL_SECTION_NAME (decl) = sec;
-}
-
 void
 darwin_mark_decl_preserved (const char *name)
 {
@@ -1025,13 +1002,23 @@ machopic_select_section (tree exp, int reloc,
                         unsigned HOST_WIDE_INT align ATTRIBUTE_UNUSED)
 {
   void (*base_function)(void);
-
-  if (decl_readonly_section_1 (exp, reloc, MACHOPIC_INDIRECT))
-    base_function = readonly_data_section;
+  bool weak_p = DECL_P (exp) && DECL_WEAK (exp);
+  static void (* const base_funs[][2])(void) = {
+    { text_section, text_coal_section },
+    { text_unlikely_section, text_unlikely_coal_section },
+    { readonly_data_section, const_coal_section },
+    { const_data_section, const_data_coal_section },
+    { data_section, data_coal_section }
+  };
+
+  if (TREE_CODE (exp) == FUNCTION_DECL)
+    base_function = base_funs[reloc][weak_p];
+  else if (decl_readonly_section_1 (exp, reloc, MACHOPIC_INDIRECT))
+    base_function = base_funs[2][weak_p];
   else if (TREE_READONLY (exp) || TREE_CONSTANT (exp))
-    base_function = const_data_section;
+    base_function = base_funs[3][weak_p];
   else
-    base_function = data_section;
+    base_function = base_funs[4][weak_p];
 
   if (TREE_CODE (exp) == STRING_CST
       && ((size_t) TREE_STRING_LENGTH (exp)
@@ -1125,6 +1112,28 @@ machopic_select_section (tree exp, int reloc,
       else
        base_function ();
     }
+  /* ::operator new and ::operator delete must be coalesced, even
+     if not weak.  There are 8 variants that we look for.  */
+  else if (TREE_CODE (exp) == FUNCTION_DECL
+          && ! DECL_ONE_ONLY (exp))
+    {
+      const char * name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (exp));
+      if (name[0] == '_' && name[1] == 'Z'
+         && ((name[2] == 'n' && (name[3] == 'a' || name[3] == 'w')
+              && name[4] == 'm')
+             || (name[2] == 'd' && (name[3] == 'a' || name[3] == 'l')
+                 && name[4] == 'P' && name[5] == 'v')))
+       {
+         bool delete_p = name[2] == 'd';
+         if (name[5 + delete_p] == 0
+             || strcmp (name + 5 + delete_p, "KSt9nothrow_t") == 0)
+           base_funs[reloc][1] ();
+         else
+           base_function ();
+       }
+      else
+       base_function ();
+    }
   else
     base_function ();
 }
@@ -1191,30 +1200,13 @@ darwin_asm_named_section (const char *name,
                          unsigned int flags ATTRIBUTE_UNUSED,
                          tree decl ATTRIBUTE_UNUSED)
 {
-  fprintf (asm_out_file, ".section %s\n", name);
+  fprintf (asm_out_file, "\t.section %s\n", name);
 }
 
-unsigned int
-darwin_section_type_flags (tree decl, const char *name, int reloc)
-{
-  unsigned int flags = default_section_type_flags (decl, name, reloc);
-  /* Weak or linkonce variables live in a writable section.  */
-  if (decl != 0 && TREE_CODE (decl) != FUNCTION_DECL
-      && (DECL_WEAK (decl) || DECL_ONE_ONLY (decl)))
-    flags |= SECTION_WRITE;
-  
-  return flags;
-}              
-
 void 
-darwin_unique_section (tree decl, int reloc ATTRIBUTE_UNUSED)
+darwin_unique_section (tree decl ATTRIBUTE_UNUSED, int reloc ATTRIBUTE_UNUSED)
 {
-  /* Darwin does not use unique sections.  However, the target's
-     unique_section hook is called for linkonce symbols.  We need
-     to set an appropriate section for such symbols. */
-  if (DECL_ONE_ONLY (decl) && !DECL_SECTION_NAME (decl))
-    darwin_make_decl_one_only (decl);
+  /* Darwin does not use unique sections.  */
 }
 
 #define HAVE_DEAD_STRIP 0
@@ -1265,14 +1257,14 @@ darwin_emit_unwind_label (FILE *file, tree decl, int for_eh, int empty)
     strcat(lab, "\"");
 
   if (TREE_PUBLIC (decl))
-    fprintf (file, "%s %s\n",
+    fprintf (file, "\t%s %s\n",
             (DECL_VISIBILITY (decl) != VISIBILITY_HIDDEN
              ? ".globl"
              : ".private_extern"),
             lab);
 
-  if (DECL_ONE_ONLY (decl) && TREE_PUBLIC (decl))
-    fprintf (file, ".weak_definition %s\n", lab);
+  if (DECL_WEAK (decl))
+    fprintf (file, "\t.weak_definition %s\n", lab);
 
   if (empty)
     {
index 554ae9f89ed96efffca3fd0865d14a9c27285de1..c12d5b67160925eb97890231e54cea60831df343 100644 (file)
@@ -295,6 +295,7 @@ extern const char *darwin_fix_and_continue_switch;
    %{undefined*} \
    %{Zunexported_symbols_list*:-unexported_symbols_list %*} \
    %{Zweak_reference_mismatches*:-weak_reference_mismatches %*} \
+   %{!Zweak_reference_mismatches*:-weak_reference_mismatches non-weak} \
    %{X} \
    %{y*} \
    %{w} \
@@ -364,16 +365,33 @@ extern const char *darwin_fix_and_continue_switch;
 
 #define DBX_OUTPUT_NULL_N_SO_AT_MAIN_SOURCE_FILE_END
 
-/* Making a symbols weak on Darwin requires more than just setting DECL_WEAK. */
-#define MAKE_DECL_ONE_ONLY(DECL) darwin_make_decl_one_only (DECL)
+/* GCC's definition of 'one_only' is the same as its definition of 'weak'.  */
+#define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1)
 
-/* Representation of linkonce symbols for the MACH-O assembler. Linkonce
-   symbols must be given a special section *and* must be preceded by a 
-   special assembler directive. */
-#define ASM_MAKE_LABEL_LINKONCE(FILE,  NAME)                            \
- do { const char* _x = (NAME); if (!!strncmp (_x, "_OBJC_", 6)) {      \
-  fputs (".weak_definition ", FILE); assemble_name (FILE, _x);         \
-  fputs ("\n", FILE); }} while (0)
+/* Mach-O supports 'weak imports', and 'weak definitions' in coalesced
+   sections.  machopic_select_section ensures that weak variables go in
+   coalesced sections.  Weak aliases (or any other kind of aliases) are
+   not supported.  Weak symbols that aren't visible outside the .s file
+   are not supported.  */
+#define ASM_WEAKEN_DECL(FILE, DECL, NAME, ALIAS)                       \
+  do {                                                                 \
+    if (ALIAS)                                                         \
+      {                                                                        \
+       warning ("alias definitions not supported in Mach-O; ignored"); \
+       break;                                                          \
+      }                                                                        \
+                                                                       \
+    if (! DECL_EXTERNAL (DECL) && TREE_PUBLIC (DECL))                  \
+      targetm.asm_out.globalize_label (FILE, NAME);                    \
+    if (DECL_EXTERNAL (DECL))                                          \
+      fputs ("\t.weak_reference ", FILE);                              \
+    else if (TREE_PUBLIC (DECL))                                       \
+      fputs ("\t.weak_definition ", FILE);                             \
+    else                                                               \
+      break;                                                           \
+    assemble_name (FILE, NAME);                                                \
+    fputc ('\n', FILE);                                                        \
+  } while (0)
 
 /* We support hidden visibility */
 #undef TARGET_SUPPORTS_HIDDEN
@@ -455,37 +473,37 @@ extern const char *darwin_fix_and_continue_switch;
     const char *xname = NAME;                                          \
     if (GET_CODE (XEXP (DECL_RTL (DECL), 0)) != SYMBOL_REF)            \
       xname = IDENTIFIER_POINTER (DECL_NAME (DECL));                   \
-    if (! DECL_ONE_ONLY (DECL) && ! DECL_WEAK (DECL))                   \
-      if ((TREE_STATIC (DECL)                                          \
-          && (!DECL_COMMON (DECL) || !TREE_PUBLIC (DECL)))             \
-          || DECL_INITIAL (DECL))                                      \
+    if (! DECL_WEAK (DECL)                                             \
+        && ((TREE_STATIC (DECL)                                                \
+            && (!DECL_COMMON (DECL) || !TREE_PUBLIC (DECL)))           \
+            || DECL_INITIAL (DECL)))                                   \
         machopic_define_symbol (DECL_RTL (DECL));                      \
     if ((TREE_STATIC (DECL)                                            \
         && (!DECL_COMMON (DECL) || !TREE_PUBLIC (DECL)))               \
         || DECL_INITIAL (DECL))                                                \
       (* targetm.encode_section_info) (DECL, DECL_RTL (DECL), false);  \
     ASM_OUTPUT_LABEL (FILE, xname);                                    \
-    /* Darwin doesn't support zero-size objects, so give them a        \
+    /* Darwin doesn't support zero-size objects, so give them a                \
        byte.  */                                                       \
     if (tree_low_cst (DECL_SIZE_UNIT (DECL), 1) == 0)                  \
       assemble_zeros (1);                                              \
   } while (0)
 
-#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL)                     \
+#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL)                    \
   do {                                                                 \
-    const char *xname = NAME;                                           \
-    if (GET_CODE (XEXP (DECL_RTL (DECL), 0)) != SYMBOL_REF)             \
-      xname = IDENTIFIER_POINTER (DECL_NAME (DECL));                    \
-    if (! DECL_ONE_ONLY (DECL) && ! DECL_WEAK (DECL))                  \
-      if ((TREE_STATIC (DECL)                                           \
-          && (!DECL_COMMON (DECL) || !TREE_PUBLIC (DECL)))             \
-          || DECL_INITIAL (DECL))                                       \
-        machopic_define_symbol (DECL_RTL (DECL));                       \
-    if ((TREE_STATIC (DECL)                                             \
-        && (!DECL_COMMON (DECL) || !TREE_PUBLIC (DECL)))               \
-        || DECL_INITIAL (DECL))                                         \
+    const char *xname = NAME;                                          \
+    if (GET_CODE (XEXP (DECL_RTL (DECL), 0)) != SYMBOL_REF)            \
+      xname = IDENTIFIER_POINTER (DECL_NAME (DECL));                   \
+    if (! DECL_WEAK (DECL)                                             \
+        && ((TREE_STATIC (DECL)                                                \
+            && (!DECL_COMMON (DECL) || !TREE_PUBLIC (DECL)))           \
+            || DECL_INITIAL (DECL)))                                   \
+        machopic_define_symbol (DECL_RTL (DECL));                      \
+    if ((TREE_STATIC (DECL)                                            \
+        && (!DECL_COMMON (DECL) || !TREE_PUBLIC (DECL)))               \
+        || DECL_INITIAL (DECL))                                                \
       (* targetm.encode_section_info) (DECL, DECL_RTL (DECL), false);  \
-    ASM_OUTPUT_LABEL (FILE, xname);                                     \
+    ASM_OUTPUT_LABEL (FILE, xname);                                    \
   } while (0)
 
 #define ASM_DECLARE_CONSTANT_NAME(FILE, NAME, EXP, SIZE)       \
@@ -529,12 +547,12 @@ extern const char *darwin_fix_and_continue_switch;
 
 /* Output before executable code.  */
 #undef TEXT_SECTION_ASM_OP
-#define TEXT_SECTION_ASM_OP ".text"
+#define TEXT_SECTION_ASM_OP "\t.text"
 
 /* Output before writable data.  */
 
 #undef DATA_SECTION_ASM_OP
-#define DATA_SECTION_ASM_OP ".data"
+#define DATA_SECTION_ASM_OP "\t.data"
 
 #undef ALIGN_ASM_OP
 #define ALIGN_ASM_OP           ".align"
@@ -580,9 +598,8 @@ FUNCTION (void)                                                             \
     {                                                                  \
       if (OBJC)                                                                \
        objc_section_init ();                                           \
-      data_section ();                                                 \
       if (asm_out_file)                                                        \
-       fprintf (asm_out_file, "%s\n", DIRECTIVE);                      \
+       fputs ("\t" DIRECTIVE "\n", asm_out_file);                      \
       in_section = SECTION;                                            \
     }                                                                  \
 }                                                                      \
@@ -590,150 +607,178 @@ FUNCTION (void)                                                         \
 /* Darwin uses many types of special sections.  */
 
 #undef EXTRA_SECTIONS
-#define EXTRA_SECTIONS                                 \
+#define EXTRA_SECTIONS                                                 \
+  in_text_coal, in_text_unlikely, in_text_unlikely_coal,               \
   in_const, in_const_data, in_cstring, in_literal4, in_literal8,       \
+  in_const_coal, in_const_data_coal, in_data_coal,                     \
   in_constructor, in_destructor, in_mod_init, in_mod_term,             \
-  in_objc_class, in_objc_meta_class, in_objc_category, \
-  in_objc_class_vars, in_objc_instance_vars,           \
-  in_objc_cls_meth, in_objc_inst_meth,                 \
-  in_objc_cat_cls_meth, in_objc_cat_inst_meth,         \
-  in_objc_selector_refs,                               \
-  in_objc_selector_fixup,                              \
-  in_objc_symbols, in_objc_module_info,                        \
-  in_objc_protocol, in_objc_string_object,             \
-  in_objc_constant_string_object,                      \
-  in_objc_image_info,                                  \
-  in_objc_class_names, in_objc_meth_var_names,         \
-  in_objc_meth_var_types, in_objc_cls_refs,            \
-  in_machopic_nl_symbol_ptr,                           \
-  in_machopic_lazy_symbol_ptr,                         \
-  in_machopic_symbol_stub,                             \
-  in_machopic_symbol_stub1,                            \
-  in_machopic_picsymbol_stub,                          \
-  in_machopic_picsymbol_stub1,                         \
-  in_darwin_exception, in_darwin_eh_frame,             \
+  in_objc_class, in_objc_meta_class, in_objc_category,                 \
+  in_objc_class_vars, in_objc_instance_vars,                           \
+  in_objc_cls_meth, in_objc_inst_meth,                                 \
+  in_objc_cat_cls_meth, in_objc_cat_inst_meth,                         \
+  in_objc_selector_refs,                                               \
+  in_objc_selector_fixup,                                              \
+  in_objc_symbols, in_objc_module_info,                                        \
+  in_objc_protocol, in_objc_string_object,                             \
+  in_objc_constant_string_object,                                      \
+  in_objc_image_info,                                                  \
+  in_objc_class_names, in_objc_meth_var_names,                         \
+  in_objc_meth_var_types, in_objc_cls_refs,                            \
+  in_machopic_nl_symbol_ptr,                                           \
+  in_machopic_lazy_symbol_ptr,                                         \
+  in_machopic_symbol_stub,                                             \
+  in_machopic_symbol_stub1,                                            \
+  in_machopic_picsymbol_stub,                                          \
+  in_machopic_picsymbol_stub1,                                         \
+  in_darwin_exception, in_darwin_eh_frame,                             \
   num_sections
 
 #undef EXTRA_SECTION_FUNCTIONS
-#define EXTRA_SECTION_FUNCTIONS                        \
-static void objc_section_init (void);          \
-SECTION_FUNCTION (const_section,               \
-                  in_const,                    \
-                  ".const", 0)                 \
-SECTION_FUNCTION (const_data_section,          \
-                  in_const_data,               \
-                  ".const_data", 0)            \
-SECTION_FUNCTION (cstring_section,             \
-                 in_cstring,                   \
-                 ".cstring", 0)                \
-SECTION_FUNCTION (literal4_section,            \
-                 in_literal4,                  \
-                 ".literal4", 0)               \
-SECTION_FUNCTION (literal8_section,            \
-                 in_literal8,                  \
-                 ".literal8", 0)               \
-SECTION_FUNCTION (constructor_section,         \
-                 in_constructor,               \
-                 ".constructor", 0)            \
-SECTION_FUNCTION (mod_init_section,            \
-                 in_mod_init,                  \
-                 ".mod_init_func", 0)  \
-SECTION_FUNCTION (mod_term_section, \
-                 in_mod_term,                  \
-                 ".mod_term_func", 0)  \
-SECTION_FUNCTION (destructor_section,          \
-                 in_destructor,                \
-                 ".destructor", 0)             \
-SECTION_FUNCTION (objc_class_section,          \
-                 in_objc_class,                \
-                 ".objc_class", 1)             \
-SECTION_FUNCTION (objc_meta_class_section,     \
-                 in_objc_meta_class,           \
-                 ".objc_meta_class", 1)        \
-SECTION_FUNCTION (objc_category_section,       \
-                 in_objc_category,             \
-               ".objc_category", 1)            \
-SECTION_FUNCTION (objc_class_vars_section,     \
-                 in_objc_class_vars,           \
-                 ".objc_class_vars", 1)        \
-SECTION_FUNCTION (objc_instance_vars_section,  \
-                 in_objc_instance_vars,        \
-                 ".objc_instance_vars", 1)     \
-SECTION_FUNCTION (objc_cls_meth_section,       \
-                 in_objc_cls_meth,             \
-                 ".objc_cls_meth", 1)  \
-SECTION_FUNCTION (objc_inst_meth_section,      \
-                 in_objc_inst_meth,            \
-                 ".objc_inst_meth", 1) \
-SECTION_FUNCTION (objc_cat_cls_meth_section,   \
-                 in_objc_cat_cls_meth,         \
-                 ".objc_cat_cls_meth", 1)      \
-SECTION_FUNCTION (objc_cat_inst_meth_section,  \
-                 in_objc_cat_inst_meth,        \
-                 ".objc_cat_inst_meth", 1)     \
-SECTION_FUNCTION (objc_selector_refs_section,  \
-                 in_objc_selector_refs,        \
-                 ".objc_message_refs", 1)      \
-SECTION_FUNCTION (objc_selector_fixup_section, \
-                 in_objc_selector_fixup,       \
-                 ".section __OBJC, __sel_fixup, regular, no_dead_strip", 1)    \
-SECTION_FUNCTION (objc_symbols_section,                \
-                 in_objc_symbols,              \
-                 ".objc_symbols", 1)   \
-SECTION_FUNCTION (objc_module_info_section,    \
-                 in_objc_module_info,          \
-                 ".objc_module_info", 1)       \
-SECTION_FUNCTION (objc_protocol_section,       \
-                 in_objc_protocol,             \
-                 ".objc_protocol", 1)  \
-SECTION_FUNCTION (objc_string_object_section,  \
-                 in_objc_string_object,        \
-                 ".objc_string_object", 1)     \
-SECTION_FUNCTION (objc_constant_string_object_section, \
-                 in_objc_constant_string_object,       \
-                 ".section __OBJC, __cstring_object, regular, no_dead_strip", 1)       \
-/* Fix-and-Continue image marker.  */          \
-SECTION_FUNCTION (objc_image_info_section,     \
-                  in_objc_image_info,          \
-                  ".section __OBJC, __image_info, regular, no_dead_strip", 1)  \
-SECTION_FUNCTION (objc_class_names_section,    \
-               in_objc_class_names,            \
-               ".objc_class_names", 1) \
-SECTION_FUNCTION (objc_meth_var_names_section, \
-               in_objc_meth_var_names,         \
-               ".objc_meth_var_names", 1)      \
-SECTION_FUNCTION (objc_meth_var_types_section, \
-               in_objc_meth_var_types,         \
-               ".objc_meth_var_types", 1)      \
-SECTION_FUNCTION (objc_cls_refs_section,       \
-               in_objc_cls_refs,               \
-               ".objc_cls_refs", 1)            \
-                                               \
-SECTION_FUNCTION (machopic_lazy_symbol_ptr_section,    \
-               in_machopic_lazy_symbol_ptr,            \
-               ".lazy_symbol_pointer", 0)      \
-SECTION_FUNCTION (machopic_nl_symbol_ptr_section,      \
-               in_machopic_nl_symbol_ptr,              \
-               ".non_lazy_symbol_pointer", 0)  \
-SECTION_FUNCTION (machopic_symbol_stub_section,                \
-               in_machopic_symbol_stub,                \
-               ".symbol_stub", 0)              \
-SECTION_FUNCTION (machopic_symbol_stub1_section,       \
-               in_machopic_symbol_stub1,               \
-               ".section __TEXT,__symbol_stub1,symbol_stubs,pure_instructions,16", 0)\
-SECTION_FUNCTION (machopic_picsymbol_stub_section,     \
-               in_machopic_picsymbol_stub,             \
-               ".picsymbol_stub", 0)           \
-SECTION_FUNCTION (machopic_picsymbol_stub1_section,    \
-               in_machopic_picsymbol_stub1,            \
-               ".section __TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32", 0)\
-SECTION_FUNCTION (darwin_exception_section,            \
-               in_darwin_exception,                    \
-               ".section __DATA,__gcc_except_tab", 0)  \
-SECTION_FUNCTION (darwin_eh_frame_section,             \
-               in_darwin_eh_frame,                     \
-               ".section " EH_FRAME_SECTION_NAME ",__eh_frame" EH_FRAME_SECTION_ATTR, 0)  \
-                                                       \
+#define EXTRA_SECTION_FUNCTIONS                                        \
+static void objc_section_init (void);                          \
+SECTION_FUNCTION (text_coal_section,                           \
+                 in_text_coal,                                 \
+                 ".section __TEXT,__textcoal_nt,coalesced,"    \
+                   "pure_instructions", 0)                     \
+SECTION_FUNCTION (text_unlikely_section,                       \
+                 in_text_unlikely,                             \
+                 ".section __TEXT,__text_unlikely,coalesced,"  \
+                   "pure_instructions", 0)                     \
+SECTION_FUNCTION (text_unlikely_coal_section,                  \
+                 in_text_unlikely_coal,                        \
+                 ".section __TEXT,__text_unlikely_coal,"       \
+                   "coalesced,pure_instructions", 0)           \
+SECTION_FUNCTION (const_section,                               \
+                  in_const,                                    \
+                  ".const", 0)                                 \
+SECTION_FUNCTION (const_coal_section,                          \
+                 in_const_coal,                                \
+                 ".section __TEXT,__const_coal,coalesced", 0)  \
+SECTION_FUNCTION (const_data_section,                          \
+                  in_const_data,                               \
+                  ".const_data", 0)                            \
+SECTION_FUNCTION (const_data_coal_section,                     \
+                  in_const_data_coal,                          \
+                  ".section __DATA,__const_coal,coalesced", 0) \
+SECTION_FUNCTION (data_coal_section,                           \
+                  in_data_coal,                                        \
+                  ".section __DATA,__datacoal_nt,coalesced", 0)        \
+SECTION_FUNCTION (cstring_section,                             \
+                 in_cstring,                                   \
+                 ".cstring", 0)                                \
+SECTION_FUNCTION (literal4_section,                            \
+                 in_literal4,                                  \
+                 ".literal4", 0)                               \
+SECTION_FUNCTION (literal8_section,                            \
+                 in_literal8,                                  \
+                 ".literal8", 0)                               \
+SECTION_FUNCTION (constructor_section,                         \
+                 in_constructor,                               \
+                 ".constructor", 0)                            \
+SECTION_FUNCTION (mod_init_section,                            \
+                 in_mod_init,                                  \
+                 ".mod_init_func", 0)                          \
+SECTION_FUNCTION (mod_term_section,                            \
+                 in_mod_term,                                  \
+                 ".mod_term_func", 0)                          \
+SECTION_FUNCTION (destructor_section,                          \
+                 in_destructor,                                \
+                 ".destructor", 0)                             \
+SECTION_FUNCTION (objc_class_section,                          \
+                 in_objc_class,                                \
+                 ".objc_class", 1)                             \
+SECTION_FUNCTION (objc_meta_class_section,                     \
+                 in_objc_meta_class,                           \
+                 ".objc_meta_class", 1)                        \
+SECTION_FUNCTION (objc_category_section,                       \
+                 in_objc_category,                             \
+               ".objc_category", 1)                            \
+SECTION_FUNCTION (objc_class_vars_section,                     \
+                 in_objc_class_vars,                           \
+                 ".objc_class_vars", 1)                        \
+SECTION_FUNCTION (objc_instance_vars_section,                  \
+                 in_objc_instance_vars,                        \
+                 ".objc_instance_vars", 1)                     \
+SECTION_FUNCTION (objc_cls_meth_section,                       \
+                 in_objc_cls_meth,                             \
+                 ".objc_cls_meth", 1)                          \
+SECTION_FUNCTION (objc_inst_meth_section,                      \
+                 in_objc_inst_meth,                            \
+                 ".objc_inst_meth", 1)                         \
+SECTION_FUNCTION (objc_cat_cls_meth_section,                   \
+                 in_objc_cat_cls_meth,                         \
+                 ".objc_cat_cls_meth", 1)                      \
+SECTION_FUNCTION (objc_cat_inst_meth_section,                  \
+                 in_objc_cat_inst_meth,                        \
+                 ".objc_cat_inst_meth", 1)                     \
+SECTION_FUNCTION (objc_selector_refs_section,                  \
+                 in_objc_selector_refs,                        \
+                 ".objc_message_refs", 1)                      \
+SECTION_FUNCTION (objc_selector_fixup_section,                              \
+                 in_objc_selector_fixup,                                    \
+                 ".section __OBJC, __sel_fixup, regular, no_dead_strip", 1) \
+SECTION_FUNCTION (objc_symbols_section,                                        \
+                 in_objc_symbols,                                      \
+                 ".objc_symbols", 1)                                   \
+SECTION_FUNCTION (objc_module_info_section,                            \
+                 in_objc_module_info,                                  \
+                 ".objc_module_info", 1)                               \
+SECTION_FUNCTION (objc_protocol_section,                               \
+                 in_objc_protocol,                                     \
+                 ".objc_protocol", 1)                                  \
+SECTION_FUNCTION (objc_string_object_section,                          \
+                 in_objc_string_object,                                \
+                 ".objc_string_object", 1)                             \
+SECTION_FUNCTION (objc_constant_string_object_section,                 \
+                 in_objc_constant_string_object,                       \
+                 ".section __OBJC, __cstring_object, regular, "        \
+                   "no_dead_strip", 1)                                 \
+/* Fix-and-Continue image marker.  */                                  \
+SECTION_FUNCTION (objc_image_info_section,                             \
+                  in_objc_image_info,                                  \
+                  ".section __OBJC, __image_info, regular, "           \
+                   "no_dead_strip", 1)                                 \
+SECTION_FUNCTION (objc_class_names_section,                            \
+               in_objc_class_names,                                    \
+               ".objc_class_names", 1)                                 \
+SECTION_FUNCTION (objc_meth_var_names_section,                         \
+               in_objc_meth_var_names,                                 \
+               ".objc_meth_var_names", 1)                              \
+SECTION_FUNCTION (objc_meth_var_types_section,                         \
+               in_objc_meth_var_types,                                 \
+               ".objc_meth_var_types", 1)                              \
+SECTION_FUNCTION (objc_cls_refs_section,                               \
+               in_objc_cls_refs,                                       \
+               ".objc_cls_refs", 1)                                    \
+\
+SECTION_FUNCTION (machopic_lazy_symbol_ptr_section,                    \
+               in_machopic_lazy_symbol_ptr,                            \
+               ".lazy_symbol_pointer", 0)                              \
+SECTION_FUNCTION (machopic_nl_symbol_ptr_section,                      \
+               in_machopic_nl_symbol_ptr,                              \
+               ".non_lazy_symbol_pointer", 0)                          \
+SECTION_FUNCTION (machopic_symbol_stub_section,                                \
+               in_machopic_symbol_stub,                                \
+               ".symbol_stub", 0)                                      \
+SECTION_FUNCTION (machopic_symbol_stub1_section,                       \
+               in_machopic_symbol_stub1,                               \
+               ".section __TEXT,__symbol_stub1,symbol_stubs,"          \
+                 "pure_instructions,16", 0)                            \
+SECTION_FUNCTION (machopic_picsymbol_stub_section,                     \
+               in_machopic_picsymbol_stub,                             \
+               ".picsymbol_stub", 0)                                   \
+SECTION_FUNCTION (machopic_picsymbol_stub1_section,                    \
+               in_machopic_picsymbol_stub1,                            \
+               ".section __TEXT,__picsymbolstub1,symbol_stubs,"        \
+                 "pure_instructions,32", 0)                            \
+SECTION_FUNCTION (darwin_exception_section,                            \
+               in_darwin_exception,                                    \
+               ".section __DATA,__gcc_except_tab", 0)                  \
+SECTION_FUNCTION (darwin_eh_frame_section,                             \
+               in_darwin_eh_frame,                                     \
+               ".section " EH_FRAME_SECTION_NAME ",__eh_frame"         \
+                 EH_FRAME_SECTION_ATTR, 0)                             \
+\
 static void                                    \
 objc_section_init (void)                       \
 {                                              \
@@ -771,6 +816,8 @@ objc_section_init (void)                    \
 
 #undef TARGET_ASM_SELECT_SECTION
 #define TARGET_ASM_SELECT_SECTION machopic_select_section
+#define USE_SELECT_SECTION_FOR_FUNCTIONS
+
 #undef TARGET_ASM_SELECT_RTX_SECTION
 #define TARGET_ASM_SELECT_RTX_SECTION machopic_select_rtx_section
 #undef  TARGET_ASM_UNIQUE_SECTION
@@ -918,6 +965,9 @@ enum machopic_addr_class {
 #define EH_FRAME_SECTION_NAME   "__TEXT"
 #define EH_FRAME_SECTION_ATTR ",coalesced,no_toc+strip_static_syms+live_support"
 
+/* Java runtime class list.  */
+#define JCR_SECTION_NAME "__DATA,jcr,regular,no_dead_strip"
+
 #undef ASM_PREFERRED_EH_DATA_FORMAT
 #define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL)  \
   (((CODE) == 2 && (GLOBAL) == 1) \
@@ -938,8 +988,6 @@ enum machopic_addr_class {
 
 #undef TARGET_ASM_NAMED_SECTION
 #define TARGET_ASM_NAMED_SECTION darwin_asm_named_section
-#undef TARGET_SECTION_TYPE_FLAGS
-#define TARGET_SECTION_TYPE_FLAGS darwin_section_type_flags
 
 #define DARWIN_REGISTER_TARGET_PRAGMAS()                       \
   do {                                                         \
index afbc2be640e3bb775a81428eaf8c7956b0d4d03a..50118698d399ebd653336aa70dcb536fb88db749 100644 (file)
@@ -759,14 +759,10 @@ dbxout_source_file (FILE *file, const char *filename)
       fprintf (asm_out_file, ",%d,0,0,", N_SOL);
       assemble_name (asm_out_file, ltext_label_name);
       fputc ('\n', asm_out_file);
-      if (current_function_decl != NULL_TREE
-         && DECL_SECTION_NAME (current_function_decl) != NULL_TREE)
+      if (current_function_decl != NULL_TREE)
        ; /* Don't change section amid function.  */
       else
-       {
-         if (!in_text_section () && !in_unlikely_text_section ())
-           text_section ();
-       }
+       text_section ();
       targetm.asm_out.internal_label (file, "Ltext", source_label_number);
       source_label_number++;
       lastfile = filename;
index a6b923c3f40af6493f306942eec58990b5182b79..63a46149632b15c86c28d23547adce70ab699043 100644 (file)
@@ -2050,7 +2050,7 @@ output_call_frame_info (int for_eh)
   /* If we make FDEs linkonce, we may have to emit an empty label for
      an FDE that wouldn't otherwise be emitted.  We want to avoid
      having an FDE kept around when the function it refers to is
-     discarded. (Example where this matters: a primary function
+     discarded.  Example where this matters: a primary function
      template in C++ requires EH information, but an explicit
      specialization doesn't.  */
   if (TARGET_USES_WEAK_UNWIND_INFO
@@ -2059,7 +2059,7 @@ output_call_frame_info (int for_eh)
     for (i = 0; i < fde_table_in_use; i++)
       if ((fde_table[i].nothrow || fde_table[i].all_throwers_are_sibcalls)
           && !fde_table[i].uses_eh_lsda
-         && ! DECL_ONE_ONLY (fde_table[i].decl))
+         && ! DECL_WEAK (fde_table[i].decl))
        targetm.asm_out.unwind_label (asm_out_file, fde_table[i].decl,
                                      for_eh, /* empty */ 1);
 
@@ -2074,8 +2074,7 @@ output_call_frame_info (int for_eh)
       for (i = 0; i < fde_table_in_use; i++)
        if (fde_table[i].uses_eh_lsda)
          any_eh_needed = any_lsda_needed = true;
-        else if (TARGET_USES_WEAK_UNWIND_INFO
-                && DECL_ONE_ONLY (fde_table[i].decl))
+        else if (TARGET_USES_WEAK_UNWIND_INFO && DECL_WEAK (fde_table[i].decl))
          any_eh_needed = true;
        else if (! fde_table[i].nothrow
                 && ! fde_table[i].all_throwers_are_sibcalls)
@@ -2222,7 +2221,7 @@ output_call_frame_info (int for_eh)
       /* Don't emit EH unwind info for leaf functions that don't need it.  */
       if (for_eh && !flag_asynchronous_unwind_tables && flag_exceptions
          && (fde->nothrow || fde->all_throwers_are_sibcalls)
-         && (! TARGET_USES_WEAK_UNWIND_INFO || ! DECL_ONE_ONLY (fde->decl))
+         && ! (TARGET_USES_WEAK_UNWIND_INFO && DECL_WEAK (fde_table[i].decl))
          && !fde->uses_eh_lsda)
        continue;
 
index a0768c31742bd9c8b5209034e71f3b1b3b4d7c87..8e00d1b887bef7a7305e5884b1cd223a873791de 100644 (file)
@@ -1,3 +1,7 @@
+2004-10-25  Geoffrey Keating  <geoffk@apple.com>
+
+       * objc.dg/image-info.m: Update for changes to section selection.
+
 2004-10-25  David Ayers  <d.ayers@inode.at>
            Ziemowit Laski  <zlaski@apple.com>
 
index 02511bc4b822736eb2e6407bea1552a2a0c61f8a..87f147792956346b775cd2baf89fa37cdbbcc93e 100644 (file)
@@ -35,4 +35,4 @@ extern void abort(void);
 }
 @end
 
-/* { dg-final { scan-assembler "\n.data\n.section __OBJC, __image_info.*\n\t.align.*\nL_OBJC_IMAGE_INFO.*:\n\t.long\t0\n\t.long\t1\n.data\n.objc_module_info\n" } } */
+/* { dg-final { scan-assembler "\t.section __OBJC, __image_info.*\n\t.align.*\nL_OBJC_IMAGE_INFO.*:\n\t.long\t0\n\t.long\t1\n\t.objc_module_info\n" } } */
index f704f684dea058912595ce76a7bbb91964568e5d..4c96e9f2737b6f6a0729670b824d7aa6df3df32f 100644 (file)
@@ -574,13 +574,19 @@ asm_output_aligned_bss (FILE *file, tree decl ATTRIBUTE_UNUSED,
 void
 function_section (tree decl)
 {
+#ifdef USE_SELECT_SECTION_FOR_FUNCTIONS
+  bool unlikely = scan_ahead_for_unlikely_executed_note (get_insns());
+  
+  targetm.asm_out.select_section (decl, unlikely, DECL_ALIGN (decl));
+#else
   if (scan_ahead_for_unlikely_executed_note (get_insns()))
     unlikely_text_section ();
   else if (decl != NULL_TREE
           && DECL_SECTION_NAME (decl) != NULL_TREE)
     named_section (decl, (char *) 0, 0);
   else
-    text_section (); 
+    text_section ();
+#endif
 }
 
 /* Switch to read-only data section associated with function DECL.  */
index 4dee1255019d153815a26b76376f3a2e6f3e2345..51ee45bb6375bd24e16d67c7ca38ab6f699e54aa 100644 (file)
@@ -1,3 +1,23 @@
+2004-10-25  Geoffrey Keating  <geoffk@apple.com>
+
+       * Makefile.am (DARWIN_CRT_SRC): New.
+       (libgcj_la_SOURCES): Use it.
+       * configure.ac: Define USING_DARWIN_CRT when on Darwin.
+       * darwin.cc: New file.
+       * include/jvm.h (_Jv_RegisterClasses): Constify.
+       (_Jv_RegisterClasses_Counted): New prototype.
+       * java/lang/Class.h: Include stddef.h.  
+       (_Jv_RegisterClasses): Constify.
+       (_Jv_RegisterClasses_Counted): New prototype.
+       (Object): Make '_Jv_RegisterClasses_Counted' a friend.
+       * java/lang/natClassLoader.cc (_Jv_RegisterClasses): Constify.
+       (_Jv_RegisterClasses_Counted): New function.
+       * configure: Regenerate.
+       * Makefile.in: Regenerate.
+       * gcj/Makefile.in: Regenerate.
+       * include/Makefile.in: Regenerate.
+       * testsuite/Makefile.in: Regenerate.
+
 2004-10-25  Tom Tromey  <tromey@redhat.com>
 
        * java/util/ResourceBundle.java (tryBundle): Use
index 13a31180ca0762871c0b534b4f23aca6fd3c2429..09c31adb1bf1fb85251254595ed6349d6badc985 100644 (file)
@@ -69,6 +69,13 @@ else
 SUBDIRS = $(DIRLTDL) gcj include
 endif
 
+## Darwin uses the jcr section, but doesn't use crtstuff.
+if USING_DARWIN_CRT
+DARWIN_CRT_SRC = darwin.cc
+else
+DARWIN_CRT_SRC = 
+endif
+
 # write_entries_to_file - writes each entry in a list
 # to the specified file. Each entry is written individually
 # to accomodate systems with severe command-line-length
@@ -206,6 +213,7 @@ libgcj_la_SOURCES = prims.cc jni.cc exception.cc \
        $(BOEHMGC_SRC) $(NOGC_SRC) \
        $(BACKTRACE_SRC) \
        $(POSIX_PLATFORM_SRC) $(WIN32_PLATFORM_SRC) $(ECOS_PLATFORM_SRC) \
+       $(DARWIN_CRT_SRC) \
        $(POSIX_THREAD_SRC) $(WIN32_THREAD_SRC) $(NO_THREAD_SRC)
 libgcj_la_DEPENDENCIES = libgcj-@gcc_version@.jar \
        java/lang/fdlibm.h java/lang/ieeefp.h java/lang/mprec.h \
index 0d00ec0186ca7a4800d61e497c91a5645d77308b..14eba1367f8eb9729b31642e145c4ef24df7e840 100644 (file)
@@ -2261,8 +2261,8 @@ am__libgcj_la_SOURCES_DIST = prims.cc jni.cc exception.cc resolve.cc \
        javax/transaction/UserTransaction.java \
        java/lang/ConcreteProcess.java \
        gnu/classpath/Configuration.java boehm.cc nogc.cc \
-       sysdep/dwarf2-backtrace.cc posix.cc win32.cc posix-threads.cc \
-       win32-threads.cc no-threads.cc
+       sysdep/dwarf2-backtrace.cc posix.cc win32.cc darwin.cc \
+       posix-threads.cc win32-threads.cc no-threads.cc
 am__objects_6 = gnu/gcj/natCore.lo \
        gnu/gcj/convert/JIS0208_to_Unicode.lo \
        gnu/gcj/convert/JIS0212_to_Unicode.lo \
@@ -4028,15 +4028,17 @@ am__objects_16 = java/lang/ConcreteProcess.lo \
 @USING_POSIX_PLATFORM_TRUE@am__objects_20 = posix.lo
 @USING_WIN32_PLATFORM_TRUE@am__objects_21 = win32.lo
 @USING_ECOS_PLATFORM_TRUE@am__objects_22 = posix.lo
-@USING_POSIX_THREADS_TRUE@am__objects_23 = posix-threads.lo
-@USING_WIN32_THREADS_TRUE@am__objects_24 = win32-threads.lo
-@USING_NO_THREADS_TRUE@am__objects_25 = no-threads.lo
+@USING_DARWIN_CRT_TRUE@am__objects_23 = darwin.lo
+@USING_POSIX_THREADS_TRUE@am__objects_24 = posix-threads.lo
+@USING_WIN32_THREADS_TRUE@am__objects_25 = win32-threads.lo
+@USING_NO_THREADS_TRUE@am__objects_26 = no-threads.lo
 am_libgcj_la_OBJECTS = prims.lo jni.lo exception.lo resolve.lo \
        defineclass.lo interpret.lo verify.lo $(am__objects_6) \
        $(am__objects_7) $(am__objects_15) $(am__objects_16) \
        $(am__objects_17) $(am__objects_18) $(am__objects_19) \
        $(am__objects_20) $(am__objects_21) $(am__objects_22) \
-       $(am__objects_23) $(am__objects_24) $(am__objects_25)
+       $(am__objects_23) $(am__objects_24) $(am__objects_25) \
+       $(am__objects_26)
 libgcj_la_OBJECTS = $(am_libgcj_la_OBJECTS)
 am_libgij_la_OBJECTS = gij.lo
 libgij_la_OBJECTS = $(am_libgij_la_OBJECTS)
@@ -4243,6 +4245,8 @@ THREADSPEC = @THREADSPEC@
 TOOLKIT = @TOOLKIT@
 USING_BOEHMGC_FALSE = @USING_BOEHMGC_FALSE@
 USING_BOEHMGC_TRUE = @USING_BOEHMGC_TRUE@
+USING_DARWIN_CRT_FALSE = @USING_DARWIN_CRT_FALSE@
+USING_DARWIN_CRT_TRUE = @USING_DARWIN_CRT_TRUE@
 USING_ECOS_PLATFORM_FALSE = @USING_ECOS_PLATFORM_FALSE@
 USING_ECOS_PLATFORM_TRUE = @USING_ECOS_PLATFORM_TRUE@
 USING_GCC_FALSE = @USING_GCC_FALSE@
@@ -4355,6 +4359,8 @@ ACLOCAL_AMFLAGS = -I . -I ../config
 @USING_NO_THREADS_TRUE@NO_THREAD_SRC = no-threads.cc
 @TESTSUBDIR_FALSE@SUBDIRS = $(DIRLTDL) gcj include
 @TESTSUBDIR_TRUE@SUBDIRS = $(DIRLTDL) testsuite gcj include
+@USING_DARWIN_CRT_FALSE@DARWIN_CRT_SRC = 
+@USING_DARWIN_CRT_TRUE@DARWIN_CRT_SRC = darwin.cc
 
 # write_entries_to_file - writes each entry in a list
 # to the specified file. Each entry is written individually
@@ -4426,6 +4432,7 @@ libgcj_la_SOURCES = prims.cc jni.cc exception.cc \
        $(BOEHMGC_SRC) $(NOGC_SRC) \
        $(BACKTRACE_SRC) \
        $(POSIX_PLATFORM_SRC) $(WIN32_PLATFORM_SRC) $(ECOS_PLATFORM_SRC) \
+       $(DARWIN_CRT_SRC) \
        $(POSIX_THREAD_SRC) $(WIN32_THREAD_SRC) $(NO_THREAD_SRC)
 
 libgcj_la_DEPENDENCIES = libgcj-@gcc_version@.jar \
@@ -18976,6 +18983,7 @@ distclean-compile:
        -rm -f *.tab.c
 
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/boehm.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/darwin.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/defineclass.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/exception.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gij.Plo@am__quote@
index d3ce0509d0fba934dd0ce4eb1a7ccaa577829655..2c95d849431ca80023304fba4f8dfaf2cf46c58e 100755 (executable)
@@ -310,7 +310,7 @@ ac_includes_default="\
 # include <unistd.h>
 #endif"
 
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS libgcj_basedir build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os target_noncanonical LN_S mkinstalldirs CC ac_ct_CC EXEEXT OBJEXT CXX ac_ct_CXX CFLAGS CXXFLAGS LDFLAGS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE AS ac_ct_AS AR ac_ct_AR RANLIB ac_ct_RANLIB MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT LIBGCJ_CFLAGS LIBGCJ_CXXFLAGS LIBGCJ_JAVAFLAGS INCLTDL LIBLTDL DIRLTDL LIBTOOL CXXCPP CPPFLAGS GCJ GCJFLAGS GCJDEPMODE am__fastdepGCJ_TRUE am__fastdepGCJ_FALSE subdirs COMPPATH TESTSUBDIR_TRUE TESTSUBDIR_FALSE ONESTEP_TRUE ONESTEP_FALSE LIBGCJDEBUG INTERPRETER LIBFFI LIBFFIINCS PLATFORM_INNER_NAT_HDRS CPP EGREP USING_WIN32_PLATFORM_TRUE USING_WIN32_PLATFORM_FALSE USING_POSIX_PLATFORM_TRUE USING_POSIX_PLATFORM_FALSE USING_ECOS_PLATFORM_TRUE USING_ECOS_PLATFORM_FALSE SYSTEMSPEC LIBGCJTESTSPEC ZLIBSPEC ZLIBTESTSPEC X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS TOOLKIT XLIB_AWT_TRUE XLIB_AWT_FALSE GTK_AWT_TRUE GTK_AWT_FALSE GTK_CAIRO_TRUE GTK_CAIRO_FALSE PKG_CONFIG CAIRO_CFLAGS CAIRO_LIBS PANGOFT2_CFLAGS PANGOFT2_LIBS GCLIBS GCINCS GCDEPS GCSPEC JC1GCSPEC GCTESTSPEC USING_BOEHMGC_TRUE USING_BOEHMGC_FALSE USING_NOGC_TRUE USING_NOGC_FALSE THREADLIBS THREADINCS THREADDEPS THREADSPEC THREADLDFLAGS THREADCXXFLAGS USING_POSIX_THREADS_TRUE USING_POSIX_THREADS_FALSE USING_WIN32_THREADS_TRUE USING_WIN32_THREADS_FALSE USING_NO_THREADS_TRUE USING_NO_THREADS_FALSE HASH_SYNC_SPEC USING_GCC_TRUE USING_GCC_FALSE tool_include_dir gcc_version LIBICONV LTLIBICONV GTK_CFLAGS GTK_LIBS GLIB_CFLAGS GLIB_LIBS LIBART_CFLAGS LIBART_LIBS SUPPLY_BACKTRACE_TRUE SUPPLY_BACKTRACE_FALSE GCJH ZIP ac_ct_GCJ ZLIBS SYS_ZLIBS ZINCS DIVIDESPEC CHECKREFSPEC EXCEPTIONSPEC IEEESPEC NATIVE_TRUE NATIVE_FALSE NEEDS_DATA_START_TRUE NEEDS_DATA_START_FALSE GCC_UNWIND_INCLUDE toolexecdir toolexecmainlibdir toolexeclibdir GCJVERSION ALLOCA PERL BACKTRACESPEC SYSDEP_SOURCES here LIBOBJS LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS libgcj_basedir build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os target_noncanonical LN_S mkinstalldirs CC ac_ct_CC EXEEXT OBJEXT CXX ac_ct_CXX CFLAGS CXXFLAGS LDFLAGS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE AS ac_ct_AS AR ac_ct_AR RANLIB ac_ct_RANLIB MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT LIBGCJ_CFLAGS LIBGCJ_CXXFLAGS LIBGCJ_JAVAFLAGS INCLTDL LIBLTDL DIRLTDL LIBTOOL CXXCPP CPPFLAGS GCJ GCJFLAGS GCJDEPMODE am__fastdepGCJ_TRUE am__fastdepGCJ_FALSE subdirs COMPPATH TESTSUBDIR_TRUE TESTSUBDIR_FALSE ONESTEP_TRUE ONESTEP_FALSE LIBGCJDEBUG INTERPRETER LIBFFI LIBFFIINCS PLATFORM_INNER_NAT_HDRS CPP EGREP USING_WIN32_PLATFORM_TRUE USING_WIN32_PLATFORM_FALSE USING_POSIX_PLATFORM_TRUE USING_POSIX_PLATFORM_FALSE USING_ECOS_PLATFORM_TRUE USING_ECOS_PLATFORM_FALSE USING_DARWIN_CRT_TRUE USING_DARWIN_CRT_FALSE SYSTEMSPEC LIBGCJTESTSPEC ZLIBSPEC ZLIBTESTSPEC X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS TOOLKIT XLIB_AWT_TRUE XLIB_AWT_FALSE GTK_AWT_TRUE GTK_AWT_FALSE GTK_CAIRO_TRUE GTK_CAIRO_FALSE PKG_CONFIG CAIRO_CFLAGS CAIRO_LIBS PANGOFT2_CFLAGS PANGOFT2_LIBS GCLIBS GCINCS GCDEPS GCSPEC JC1GCSPEC GCTESTSPEC USING_BOEHMGC_TRUE USING_BOEHMGC_FALSE USING_NOGC_TRUE USING_NOGC_FALSE THREADLIBS THREADINCS THREADDEPS THREADSPEC THREADLDFLAGS THREADCXXFLAGS USING_POSIX_THREADS_TRUE USING_POSIX_THREADS_FALSE USING_WIN32_THREADS_TRUE USING_WIN32_THREADS_FALSE USING_NO_THREADS_TRUE USING_NO_THREADS_FALSE HASH_SYNC_SPEC USING_GCC_TRUE USING_GCC_FALSE tool_include_dir gcc_version LIBICONV LTLIBICONV GTK_CFLAGS GTK_LIBS GLIB_CFLAGS GLIB_LIBS LIBART_CFLAGS LIBART_LIBS SUPPLY_BACKTRACE_TRUE SUPPLY_BACKTRACE_FALSE GCJH ZIP ac_ct_GCJ ZLIBS SYS_ZLIBS ZINCS DIVIDESPEC CHECKREFSPEC EXCEPTIONSPEC IEEESPEC NATIVE_TRUE NATIVE_FALSE NEEDS_DATA_START_TRUE NEEDS_DATA_START_FALSE GCC_UNWIND_INCLUDE toolexecdir toolexecmainlibdir toolexeclibdir GCJVERSION ALLOCA PERL BACKTRACESPEC SYSDEP_SOURCES here LIBOBJS LTLIBOBJS'
 ac_subst_files=''
 
 # Initialize some variables set by options.
@@ -6328,6 +6328,21 @@ else
 fi
 
 
+case "$host" in
+  *-darwin*) DARWIN_CRT=true ;;
+  *) DARWIN_CRT=false ;;
+esac
+
+
+if $DARWIN_CRT; then
+  USING_DARWIN_CRT_TRUE=
+  USING_DARWIN_CRT_FALSE='#'
+else
+  USING_DARWIN_CRT_TRUE='#'
+  USING_DARWIN_CRT_FALSE=
+fi
+
+
 # These may not be defined in a non-ANS conformant embedded system.
 # FIXME: Should these case a runtime exception in that case?
 cat >conftest.$ac_ext <<_ACEOF
@@ -16433,6 +16448,13 @@ echo "$as_me: error: conditional \"USING_ECOS_PLATFORM\" was never defined.
 Usually this means the macro was only invoked conditionally." >&2;}
    { (exit 1); exit 1; }; }
 fi
+if test -z "${USING_DARWIN_CRT_TRUE}" && test -z "${USING_DARWIN_CRT_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"USING_DARWIN_CRT\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"USING_DARWIN_CRT\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
 if test -z "${XLIB_AWT_TRUE}" && test -z "${XLIB_AWT_FALSE}"; then
   { { echo "$as_me:$LINENO: error: conditional \"XLIB_AWT\" was never defined.
 Usually this means the macro was only invoked conditionally." >&5
@@ -17190,6 +17212,8 @@ s,@USING_POSIX_PLATFORM_TRUE@,$USING_POSIX_PLATFORM_TRUE,;t t
 s,@USING_POSIX_PLATFORM_FALSE@,$USING_POSIX_PLATFORM_FALSE,;t t
 s,@USING_ECOS_PLATFORM_TRUE@,$USING_ECOS_PLATFORM_TRUE,;t t
 s,@USING_ECOS_PLATFORM_FALSE@,$USING_ECOS_PLATFORM_FALSE,;t t
+s,@USING_DARWIN_CRT_TRUE@,$USING_DARWIN_CRT_TRUE,;t t
+s,@USING_DARWIN_CRT_FALSE@,$USING_DARWIN_CRT_FALSE,;t t
 s,@SYSTEMSPEC@,$SYSTEMSPEC,;t t
 s,@LIBGCJTESTSPEC@,$LIBGCJTESTSPEC,;t t
 s,@ZLIBSPEC@,$ZLIBSPEC,;t t
index 80775ab6219ab576223e1b3ebda73e3ac388db3b..53ff781003c86c4e469a68ba42922439572b68a1 100644 (file)
@@ -427,6 +427,12 @@ AM_CONDITIONAL(USING_WIN32_PLATFORM, test "$PLATFORM" = Win32)
 AM_CONDITIONAL(USING_POSIX_PLATFORM, test "$PLATFORM" = Posix)
 AM_CONDITIONAL(USING_ECOS_PLATFORM, test "$PLATFORM" = Ecos)
 
+case "$host" in
+  *-darwin*) DARWIN_CRT=true ;;
+  *) DARWIN_CRT=false ;;
+esac
+AM_CONDITIONAL(USING_DARWIN_CRT, $DARWIN_CRT)
+
 # These may not be defined in a non-ANS conformant embedded system.
 # FIXME: Should these case a runtime exception in that case?
 AC_EGREP_HEADER(mktime, time.h, AC_DEFINE(HAVE_MKTIME, 1,
diff --git a/libjava/darwin.cc b/libjava/darwin.cc
new file mode 100644 (file)
index 0000000..d427ba7
--- /dev/null
@@ -0,0 +1,63 @@
+/* darwin.cc - class loader stuff for Darwin.  */
+
+/* Copyright (C) 2004  Free Software Foundation
+
+   This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License.  Please consult the file "LIBGCJ_LICENSE" for
+details.  */
+
+#include <config.h>
+
+#include <jvm.h>
+
+/* In theory, we should be able to do:
+   #include <mach-o/getsect.h>
+   #include <mach-o/dyld.h>
+
+   but all the types in these headers changed between Panther and Tiger,
+   so the only way to be avoid type mismatches is to declare the routines
+   ourself.  */
+
+#include <stdint.h>
+struct mach_header;
+extern "C" void _dyld_register_func_for_add_image
+  (void (*func)(const struct mach_header *mh, intptr_t vmaddr_slide));
+extern "C" void _dyld_register_func_for_remove_image
+  (void (*func)(const struct mach_header *mh, intptr_t vmaddr_slide));
+extern "C" char *getsectdatafromheader
+(const struct mach_header *mhp, const char *segname, const char *sectname,
+ uint32_t *size);
+
+/* When a new image is loaded, look to see if it has a jcr section
+   and if so register the classes listed in it.  */
+
+static void
+darwin_java_register_dyld_add_image_hook (const struct mach_header *mh,
+                                         intptr_t slide)
+{
+  char *fde;
+  uint32_t sz;
+
+  fde = getsectdatafromheader (mh, "__DATA", "jcr", &sz);
+  if (! fde)
+    return;
+  
+  /* As far as I can tell, you're only supposed to load shared
+     libraries while having a lock on java.lang.Class.  So there's
+     no need to synchronize on anything here.  (I'm not sure how exactly
+     you can ensure this given lazy library loading.  FIXME.)  */
+  _Jv_RegisterClasses_Counted ((const jclass *) (fde + slide),
+                              sz / sizeof (jclass *));
+}
+
+static struct darwin_constructor_s{
+  darwin_constructor_s() 
+  {
+    _dyld_register_func_for_add_image 
+      (darwin_java_register_dyld_add_image_hook);
+    /* At present, you mustn't unload any java plugin.  */
+  };
+} darwin_constructor;
index 3b326f99cc8000ccde49b056de2eab5c2c9f846a..70f491b6ad3150ae99408626a206bd217df8a572 100644 (file)
@@ -196,6 +196,8 @@ THREADSPEC = @THREADSPEC@
 TOOLKIT = @TOOLKIT@
 USING_BOEHMGC_FALSE = @USING_BOEHMGC_FALSE@
 USING_BOEHMGC_TRUE = @USING_BOEHMGC_TRUE@
+USING_DARWIN_CRT_FALSE = @USING_DARWIN_CRT_FALSE@
+USING_DARWIN_CRT_TRUE = @USING_DARWIN_CRT_TRUE@
 USING_ECOS_PLATFORM_FALSE = @USING_ECOS_PLATFORM_FALSE@
 USING_ECOS_PLATFORM_TRUE = @USING_ECOS_PLATFORM_TRUE@
 USING_GCC_FALSE = @USING_GCC_FALSE@
index d87036c6e64643d10be602ae34ec17c32e6bcd16..b1856c9fe15692cf64bb910f446b614c68e1d376 100644 (file)
@@ -195,6 +195,8 @@ THREADSPEC = @THREADSPEC@
 TOOLKIT = @TOOLKIT@
 USING_BOEHMGC_FALSE = @USING_BOEHMGC_FALSE@
 USING_BOEHMGC_TRUE = @USING_BOEHMGC_TRUE@
+USING_DARWIN_CRT_FALSE = @USING_DARWIN_CRT_FALSE@
+USING_DARWIN_CRT_TRUE = @USING_DARWIN_CRT_TRUE@
 USING_ECOS_PLATFORM_FALSE = @USING_ECOS_PLATFORM_FALSE@
 USING_ECOS_PLATFORM_TRUE = @USING_ECOS_PLATFORM_TRUE@
 USING_GCC_FALSE = @USING_GCC_FALSE@
index 554e3459a479bfb8fa5f4d618954f29cf5ac24f4..55799515c05ea4e16552a472af471412731eb5c6 100644 (file)
@@ -411,7 +411,9 @@ extern "C" void *_Jv_LookupInterfaceMethodIdx (jclass klass, jclass iface,
                                                int meth_idx);
 extern "C" void _Jv_CheckArrayStore (jobject array, jobject obj);
 extern "C" void _Jv_RegisterClass (jclass klass);
-extern "C" void _Jv_RegisterClasses (jclass *classes);
+extern "C" void _Jv_RegisterClasses (const jclass *classes);
+extern "C" void _Jv_RegisterClasses_Counted (const jclass *classes,
+                                            size_t count);
 extern "C" void _Jv_RegisterResource (void *vptr);
 extern void _Jv_UnregisterClass (_Jv_Utf8Const*, java::lang::ClassLoader*);
 extern void _Jv_ResolveField (_Jv_Field *, java::lang::ClassLoader*);
index f6c6eec510de88ff31b4337b0f67edf8472ed303..02a97dfcf14e975392974ae8e81622adad2083ed 100644 (file)
@@ -14,6 +14,7 @@ details.  */
 
 #pragma interface
 
+#include <stddef.h>
 #include <java/lang/Object.h>
 #include <java/lang/String.h>
 #include <java/net/URL.h>
@@ -24,7 +25,9 @@ details.  */
 
 // We declare these here to avoid including gcj/cni.h.
 extern "C" void _Jv_InitClass (jclass klass);
-extern "C" void _Jv_RegisterClasses (jclass *classes);
+extern "C" void _Jv_RegisterClasses (const jclass *classes);
+extern "C" void _Jv_RegisterClasses_Counted (const jclass *classes,
+                                            size_t count);
 
 // This must be predefined with "C" linkage.
 extern "C" void *_Jv_LookupInterfaceMethodIdx (jclass klass, jclass iface, 
@@ -310,7 +313,9 @@ private:
   friend class java::io::ObjectStreamClass;
 
   friend void _Jv_WaitForState (jclass, int);
-  friend void _Jv_RegisterClasses (jclass *classes);
+  friend void _Jv_RegisterClasses (const jclass *classes);
+  friend void _Jv_RegisterClasses_Counted (const jclass *classes, 
+                                          size_t count);
   friend void _Jv_RegisterClassHookDefault (jclass klass);
   friend void _Jv_RegisterInitiatingLoader (jclass,java::lang::ClassLoader*);
   friend void _Jv_UnregisterClass (jclass);
index e660eae39e670a3548b83f3fbb958971b1eb32b2..5a0898a93c4ea7c28120f35317ae24d7809106d6 100644 (file)
@@ -316,7 +316,7 @@ _Jv_RegisterInitiatingLoader (jclass klass, java::lang::ClassLoader *loader)
 // class chain.  At all other times, the caller should synchronize on
 // Class::class$.
 void
-_Jv_RegisterClasses (jclass *classes)
+_Jv_RegisterClasses (const jclass *classes)
 {
   for (; *classes; ++classes)
     {
@@ -331,6 +331,24 @@ _Jv_RegisterClasses (jclass *classes)
     }
 }
 
+// This is a version of _Jv_RegisterClasses that takes a count.
+void
+_Jv_RegisterClasses_Counted (const jclass * classes, size_t count)
+{
+  size_t i;
+  for (i = 0; i < count; i++)
+    {
+      jclass klass = classes[i];
+
+      (*_Jv_RegisterClassHook) (klass);
+
+      // registering a compiled class causes
+      // it to be immediately "prepared".  
+      if (klass->state == JV_STATE_NOTHING)
+       klass->state = JV_STATE_COMPILED;
+    }
+}
+
 void
 _Jv_RegisterClassHookDefault (jclass klass)
 {
index 94a8b93d99787619d3b272480fc67ba10883c1d3..51c0ea364ff16c3e8c5e5e27e5156ea165bdbdcf 100644 (file)
@@ -184,6 +184,8 @@ THREADSPEC = @THREADSPEC@
 TOOLKIT = @TOOLKIT@
 USING_BOEHMGC_FALSE = @USING_BOEHMGC_FALSE@
 USING_BOEHMGC_TRUE = @USING_BOEHMGC_TRUE@
+USING_DARWIN_CRT_FALSE = @USING_DARWIN_CRT_FALSE@
+USING_DARWIN_CRT_TRUE = @USING_DARWIN_CRT_TRUE@
 USING_ECOS_PLATFORM_FALSE = @USING_ECOS_PLATFORM_FALSE@
 USING_ECOS_PLATFORM_TRUE = @USING_ECOS_PLATFORM_TRUE@
 USING_GCC_FALSE = @USING_GCC_FALSE@
index a60d1b476438dc5cb539cc36ab022874c1c6a4a9..18b574b1b723cc68fe6ace22020d363b7087c7a0 100644 (file)
@@ -1,3 +1,14 @@
+2004-10-25  Geoffrey Keating  <geoffk@apple.com>
+
+       * libsupc++/new_op.cc (new): Make weak.
+       * libsupc++/new_opnt.cc (new): Make weak.
+       * libsupc++/new_opv.cc (new): Make weak.
+       * libsupc++/new_opvnt.cc (new): Make weak.
+       * libsupc++/delete_op.cc (delete): Make weak.
+       * libsupc++/delete_opnt.cc (delete): Make weak.
+       * libsupc++/delete_opv.cc (delete): Make weak.
+       * libsupc++/delete_opvnt.cc (delete): Make weak.
+
 2004-10-25  Benjamin Kosnik  <bkoz@redhat.com>
 
        * testsuite/Makefile.am (GLIBCXX_INCLUDES): Add.
index 48397fde0719a088379eb5bcb7e869e941e79318..e6249e656c8e95b3167c3490a3015635b36b6355 100644 (file)
@@ -172,6 +172,13 @@ case "${host_os}" in
   cygwin*)
     os_include_dir="os/newlib"
     ;;
+  darwin*)
+    # On Darwin, performance is improved if libstdc++ is single-module.
+    # Up to at least 10.3.5, -flat_namespace is required for proper
+    # treatment of coalesced symbols.
+    OPT_LDFLAGS="${OPT_LDFLAGS} -Wl,-single_module -Wl,-flat_namespace"
+    os_include_dir="os/generic"
+    ;;
   *djgpp*)      # leading * picks up "msdosdjgpp"
     os_include_dir="os/djgpp"
     ;;
index e99f5b658d5ab31d09d03674b4a2284af1781645..32ccdb6808b9c4c9895ce465779e3d5354fead33 100644 (file)
@@ -39,7 +39,7 @@ using std::free;
 extern "C" void free(void *);
 #endif
 
-void
+__attribute__((weak)) void
 operator delete (void *ptr) throw ()
 {
   if (ptr)
index 44a7a925a35f526e517be32166149a99e48ef081..6cfb0775e4fb9f0ab81369add106b9015fdaed6d 100644 (file)
@@ -32,7 +32,7 @@
 
 extern "C" void free (void *);
 
-void
+__attribute__((weak)) void
 operator delete (void *ptr, const std::nothrow_t&) throw ()
 {
   if (ptr)
index 95b1f79018b95e5f19fdaae3fe570d8daec3586a..03e1612c47fa666bd1693e2d61bf75fe35c61fbe 100644 (file)
@@ -30,7 +30,7 @@
 
 #include "new"
 
-void
+__attribute__((weak)) void
 operator delete[] (void *ptr) throw ()
 {
   ::operator delete (ptr);
index 01a64f8bc294fb75f9754b2a8eb110ddb132858c..5b55cda66e624b9acd2141cb8e4b952c723b95e5 100644 (file)
@@ -30,7 +30,7 @@
 
 #include "new"
 
-void
+__attribute__((weak)) void
 operator delete[] (void *ptr, const std::nothrow_t&) throw ()
 {
   ::operator delete (ptr);
index 983ae45420e864ba475a3fea683c76c5a947c4a3..656b9f42d558b4f724ad5edc237f03e79ec0e9dd 100644 (file)
@@ -43,7 +43,7 @@ extern "C" void *malloc (std::size_t);
 
 extern new_handler __new_handler;
 
-void *
+__attribute__((weak)) void *
 operator new (std::size_t sz) throw (std::bad_alloc)
 {
   void *p;
index 4d7a5087c14c1375630d9ec63dabe590bb7acfe5..ff550b706ab7bca9e2efe497890325b69ace491e 100644 (file)
@@ -36,7 +36,7 @@ using std::bad_alloc;
 extern "C" void *malloc (std::size_t);
 extern new_handler __new_handler;
 
-void *
+__attribute__((weak)) void *
 operator new (std::size_t sz, const std::nothrow_t&) throw()
 {
   void *p;
index 74ad49caf8e4fe98ba86de856dbcf1574621d5e0..de3bc4ebd7c71c2ddceec17bb796404010b65b0f 100644 (file)
@@ -30,7 +30,7 @@
 
 #include "new"
 
-void *
+__attribute__((weak)) void *
 operator new[] (std::size_t sz) throw (std::bad_alloc)
 {
   return ::operator new(sz);
index 0a3f716d4e46da5c09b96df3a809bd8dfc59762e..1dbf991d83848dfa7e213cf84da96e5f1554e3d5 100644 (file)
@@ -30,7 +30,7 @@
 
 #include "new"
 
-void *
+__attribute__((weak)) void *
 operator new[] (std::size_t sz, const std::nothrow_t& nothrow) throw()
 {
   return ::operator new(sz, nothrow);