aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorGeoffrey Keating <geoffk@apple.com>2004-10-26 06:09:05 +0000
committerGeoffrey Keating <geoffk@gcc.gnu.org>2004-10-26 06:09:05 +0000
commitf1a66265195781c7f0cc6c627706bdf33a313657 (patch)
tree55b7af27d9c57fd804dcf7cea7736d928a9d995d /gcc
parent595961fccbefdeb23a17856f78026f7b15efb67b (diff)
downloadgcc-f1a66265195781c7f0cc6c627706bdf33a313657.zip
gcc-f1a66265195781c7f0cc6c627706bdf33a313657.tar.gz
gcc-f1a66265195781c7f0cc6c627706bdf33a313657.tar.bz2
Index: gcc/gcc/ChangeLog
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog44
-rw-r--r--gcc/config/darwin-protos.h8
-rw-r--r--gcc/config/darwin.c96
-rw-r--r--gcc/config/darwin.h392
-rw-r--r--gcc/dbxout.c8
-rw-r--r--gcc/dwarf2out.c9
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/objc.dg/image-info.m2
-rw-r--r--gcc/varasm.c8
9 files changed, 332 insertions, 239 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index ae76071..d2b1cc4 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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.
diff --git a/gcc/config/darwin-protos.h b/gcc/config/darwin-protos.h
index 402311c..9a915a2 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 dd9c34d..0c39fd8 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 554ae9f..c12d5b6 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 afbc2be..5011869 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 a6b923c..63a4614 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 a0768c3..8e00d1b 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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>
diff --git a/gcc/testsuite/objc.dg/image-info.m b/gcc/testsuite/objc.dg/image-info.m
index 02511bc..87f1477 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 f704f68..4c96e9f 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. */