From f1a66265195781c7f0cc6c627706bdf33a313657 Mon Sep 17 00:00:00 2001 From: Geoffrey Keating Date: Tue, 26 Oct 2004 06:09:05 +0000 Subject: [PATCH] Index: gcc/gcc/ChangeLog 2004-10-25 Geoffrey Keating * 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 * objc.dg/image-info.m: Update for changes to section selection. Index: libjava/ChangeLog 2004-10-25 Geoffrey Keating * 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 * 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 --- gcc/ChangeLog | 44 ++++ gcc/config/darwin-protos.h | 8 +- gcc/config/darwin.c | 96 ++++--- gcc/config/darwin.h | 392 ++++++++++++++++------------ gcc/dbxout.c | 8 +- gcc/dwarf2out.c | 9 +- gcc/testsuite/ChangeLog | 4 + gcc/testsuite/objc.dg/image-info.m | 2 +- gcc/varasm.c | 8 +- libjava/ChangeLog | 20 ++ libjava/Makefile.am | 8 + libjava/Makefile.in | 20 +- libjava/configure | 26 +- libjava/configure.ac | 6 + libjava/darwin.cc | 63 +++++ libjava/gcj/Makefile.in | 2 + libjava/include/Makefile.in | 2 + libjava/include/jvm.h | 4 +- libjava/java/lang/Class.h | 9 +- libjava/java/lang/natClassLoader.cc | 20 +- libjava/testsuite/Makefile.in | 2 + libstdc++-v3/ChangeLog | 11 + libstdc++-v3/configure.host | 7 + libstdc++-v3/libsupc++/del_op.cc | 2 +- libstdc++-v3/libsupc++/del_opnt.cc | 2 +- libstdc++-v3/libsupc++/del_opv.cc | 2 +- libstdc++-v3/libsupc++/del_opvnt.cc | 2 +- libstdc++-v3/libsupc++/new_op.cc | 2 +- libstdc++-v3/libsupc++/new_opnt.cc | 2 +- libstdc++-v3/libsupc++/new_opv.cc | 2 +- libstdc++-v3/libsupc++/new_opvnt.cc | 2 +- 31 files changed, 529 insertions(+), 258 deletions(-) create mode 100644 libjava/darwin.cc diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ae76071825d2..d2b1cc423bdc 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,47 @@ +2004-10-25 Geoffrey Keating + + * 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 * c-common.h: Remove RID_ID. diff --git a/gcc/config/darwin-protos.h b/gcc/config/darwin-protos.h index 402311c6bb12..9a915a2b16f7 100644 --- a/gcc/config/darwin-protos.h +++ b/gcc/config/darwin-protos.h @@ -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); diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c index dd9c34d984ae..0c39fd80c650 100644 --- a/gcc/config/darwin.c +++ b/gcc/config/darwin.c @@ -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) { diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h index 554ae9f89ed9..c12d5b671609 100644 --- a/gcc/config/darwin.h +++ b/gcc/config/darwin.h @@ -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 { \ diff --git a/gcc/dbxout.c b/gcc/dbxout.c index afbc2be640e3..50118698d399 100644 --- a/gcc/dbxout.c +++ b/gcc/dbxout.c @@ -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; diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index a6b923c3f40a..63a46149632b 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -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; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a0768c31742b..8e00d1b887be 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2004-10-25 Geoffrey Keating + + * objc.dg/image-info.m: Update for changes to section selection. + 2004-10-25 David Ayers Ziemowit Laski diff --git a/gcc/testsuite/objc.dg/image-info.m b/gcc/testsuite/objc.dg/image-info.m index 02511bc4b822..87f147792956 100644 --- a/gcc/testsuite/objc.dg/image-info.m +++ b/gcc/testsuite/objc.dg/image-info.m @@ -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" } } */ diff --git a/gcc/varasm.c b/gcc/varasm.c index f704f684dea0..4c96e9f2737b 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -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. */ diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 4dee1255019d..51ee45bb6375 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,23 @@ +2004-10-25 Geoffrey Keating + + * 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 * java/util/ResourceBundle.java (tryBundle): Use diff --git a/libjava/Makefile.am b/libjava/Makefile.am index 13a31180ca07..09c31adb1bf1 100644 --- a/libjava/Makefile.am +++ b/libjava/Makefile.am @@ -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 \ diff --git a/libjava/Makefile.in b/libjava/Makefile.in index 0d00ec0186ca..14eba1367f8e 100644 --- a/libjava/Makefile.in +++ b/libjava/Makefile.in @@ -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@ diff --git a/libjava/configure b/libjava/configure index d3ce0509d0fb..2c95d849431c 100755 --- a/libjava/configure +++ b/libjava/configure @@ -310,7 +310,7 @@ ac_includes_default="\ # include #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 diff --git a/libjava/configure.ac b/libjava/configure.ac index 80775ab6219a..53ff781003c8 100644 --- a/libjava/configure.ac +++ b/libjava/configure.ac @@ -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 index 000000000000..d427ba7cd194 --- /dev/null +++ b/libjava/darwin.cc @@ -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 + +#include + +/* In theory, we should be able to do: + #include + #include + + 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 +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; diff --git a/libjava/gcj/Makefile.in b/libjava/gcj/Makefile.in index 3b326f99cc80..70f491b6ad31 100644 --- a/libjava/gcj/Makefile.in +++ b/libjava/gcj/Makefile.in @@ -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@ diff --git a/libjava/include/Makefile.in b/libjava/include/Makefile.in index d87036c6e646..b1856c9fe156 100644 --- a/libjava/include/Makefile.in +++ b/libjava/include/Makefile.in @@ -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@ diff --git a/libjava/include/jvm.h b/libjava/include/jvm.h index 554e3459a479..55799515c05e 100644 --- a/libjava/include/jvm.h +++ b/libjava/include/jvm.h @@ -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*); diff --git a/libjava/java/lang/Class.h b/libjava/java/lang/Class.h index f6c6eec510de..02a97dfcf14e 100644 --- a/libjava/java/lang/Class.h +++ b/libjava/java/lang/Class.h @@ -14,6 +14,7 @@ details. */ #pragma interface +#include #include #include #include @@ -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); diff --git a/libjava/java/lang/natClassLoader.cc b/libjava/java/lang/natClassLoader.cc index e660eae39e67..5a0898a93c4e 100644 --- a/libjava/java/lang/natClassLoader.cc +++ b/libjava/java/lang/natClassLoader.cc @@ -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) { diff --git a/libjava/testsuite/Makefile.in b/libjava/testsuite/Makefile.in index 94a8b93d9978..51c0ea364ff1 100644 --- a/libjava/testsuite/Makefile.in +++ b/libjava/testsuite/Makefile.in @@ -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@ diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index a60d1b476438..18b574b1b723 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,14 @@ +2004-10-25 Geoffrey Keating + + * 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 * testsuite/Makefile.am (GLIBCXX_INCLUDES): Add. diff --git a/libstdc++-v3/configure.host b/libstdc++-v3/configure.host index 48397fde0719..e6249e656c8e 100644 --- a/libstdc++-v3/configure.host +++ b/libstdc++-v3/configure.host @@ -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" ;; diff --git a/libstdc++-v3/libsupc++/del_op.cc b/libstdc++-v3/libsupc++/del_op.cc index e99f5b658d5a..32ccdb6808b9 100644 --- a/libstdc++-v3/libsupc++/del_op.cc +++ b/libstdc++-v3/libsupc++/del_op.cc @@ -39,7 +39,7 @@ using std::free; extern "C" void free(void *); #endif -void +__attribute__((weak)) void operator delete (void *ptr) throw () { if (ptr) diff --git a/libstdc++-v3/libsupc++/del_opnt.cc b/libstdc++-v3/libsupc++/del_opnt.cc index 44a7a925a35f..6cfb0775e4fb 100644 --- a/libstdc++-v3/libsupc++/del_opnt.cc +++ b/libstdc++-v3/libsupc++/del_opnt.cc @@ -32,7 +32,7 @@ extern "C" void free (void *); -void +__attribute__((weak)) void operator delete (void *ptr, const std::nothrow_t&) throw () { if (ptr) diff --git a/libstdc++-v3/libsupc++/del_opv.cc b/libstdc++-v3/libsupc++/del_opv.cc index 95b1f79018b9..03e1612c47fa 100644 --- a/libstdc++-v3/libsupc++/del_opv.cc +++ b/libstdc++-v3/libsupc++/del_opv.cc @@ -30,7 +30,7 @@ #include "new" -void +__attribute__((weak)) void operator delete[] (void *ptr) throw () { ::operator delete (ptr); diff --git a/libstdc++-v3/libsupc++/del_opvnt.cc b/libstdc++-v3/libsupc++/del_opvnt.cc index 01a64f8bc294..5b55cda66e62 100644 --- a/libstdc++-v3/libsupc++/del_opvnt.cc +++ b/libstdc++-v3/libsupc++/del_opvnt.cc @@ -30,7 +30,7 @@ #include "new" -void +__attribute__((weak)) void operator delete[] (void *ptr, const std::nothrow_t&) throw () { ::operator delete (ptr); diff --git a/libstdc++-v3/libsupc++/new_op.cc b/libstdc++-v3/libsupc++/new_op.cc index 983ae45420e8..656b9f42d558 100644 --- a/libstdc++-v3/libsupc++/new_op.cc +++ b/libstdc++-v3/libsupc++/new_op.cc @@ -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; diff --git a/libstdc++-v3/libsupc++/new_opnt.cc b/libstdc++-v3/libsupc++/new_opnt.cc index 4d7a5087c14c..ff550b706ab7 100644 --- a/libstdc++-v3/libsupc++/new_opnt.cc +++ b/libstdc++-v3/libsupc++/new_opnt.cc @@ -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; diff --git a/libstdc++-v3/libsupc++/new_opv.cc b/libstdc++-v3/libsupc++/new_opv.cc index 74ad49caf8e4..de3bc4ebd7c7 100644 --- a/libstdc++-v3/libsupc++/new_opv.cc +++ b/libstdc++-v3/libsupc++/new_opv.cc @@ -30,7 +30,7 @@ #include "new" -void * +__attribute__((weak)) void * operator new[] (std::size_t sz) throw (std::bad_alloc) { return ::operator new(sz); diff --git a/libstdc++-v3/libsupc++/new_opvnt.cc b/libstdc++-v3/libsupc++/new_opvnt.cc index 0a3f716d4e46..1dbf991d8384 100644 --- a/libstdc++-v3/libsupc++/new_opvnt.cc +++ b/libstdc++-v3/libsupc++/new_opvnt.cc @@ -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); -- 2.39.5