diff options
author | Richard Henderson <rth@redhat.com> | 2001-08-06 17:13:35 -0700 |
---|---|---|
committer | Richard Henderson <rth@gcc.gnu.org> | 2001-08-06 17:13:35 -0700 |
commit | 47907859fdd0b39ecb2a78c068872470f823329f (patch) | |
tree | fe1d06a13ef40c7bd7f7953e66a94a01e57f7d54 /gcc | |
parent | 362b68a82dcf98169e852579a784dd4bddcccc25 (diff) | |
download | gcc-47907859fdd0b39ecb2a78c068872470f823329f.zip gcc-47907859fdd0b39ecb2a78c068872470f823329f.tar.gz gcc-47907859fdd0b39ecb2a78c068872470f823329f.tar.bz2 |
varasm.c (assemble_constructor): Take a symbol_ref and a priority instead of a bare string.
* varasm.c (assemble_constructor): Take a symbol_ref and a
priority instead of a bare string. Move priority handling
here from cp/decl2.c.
* output.h: Update decls.
* c-decl.c (c_expand_body): Update calls to assemble_constructor
and assemble_destructor.
* profile.c (output_func_start_profiler): Likewise.
* objc/objc-act.c (finish_objc): Likewise.
(build_module_descriptor): Return the symbol not the symbol name.
* ch/grant.c (chill_finish_compile): Pass a symbol_ref and priority
to assemble_constructor.
* cp/decl2.c (finish_objects): Pass a symbol_ref and priority to
assemble_{constructor,destructor}. Remove priority handling.
* java/class.c (emit_register_classes): Pass a symbol_ref and priority
to assemble_constructor.
From-SVN: r44678
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 13 | ||||
-rw-r--r-- | gcc/c-decl.c | 8 | ||||
-rw-r--r-- | gcc/ch/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/ch/grant.c | 3 | ||||
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/decl2.c | 32 | ||||
-rw-r--r-- | gcc/java/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/java/class.c | 2 | ||||
-rw-r--r-- | gcc/objc/objc-act.c | 20 | ||||
-rw-r--r-- | gcc/output.h | 14 | ||||
-rw-r--r-- | gcc/profile.c | 2 | ||||
-rw-r--r-- | gcc/varasm.c | 58 |
12 files changed, 106 insertions, 61 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2573197..1e18e1e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,16 @@ +2001-08-06 Richard Henderson <rth@redhat.com> + + * varasm.c (assemble_constructor): Take a symbol_ref and a + priority instead of a bare string. Move priority handling + here from cp/decl2.c. + * output.h: Update decls. + + * c-decl.c (c_expand_body): Update calls to assemble_constructor + and assemble_destructor. + * profile.c (output_func_start_profiler): Likewise. + * objc/objc-act.c (finish_objc): Likewise. + (build_module_descriptor): Return the symbol not the symbol name. + 2001-08-06 David Edelsohn <edelsohn@gnu.org> * config/rs6000/darwin.h (DOUBLE_INT_ASM_OP): Add whitespace. diff --git a/gcc/c-decl.c b/gcc/c-decl.c index b57e6d4..6c5056f 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -6781,9 +6781,10 @@ c_expand_body (fndecl, nested_p) static_ctors = tree_cons (NULL_TREE, fndecl, static_ctors); else #endif - assemble_constructor (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (fndecl))); - + assemble_constructor (XEXP (DECL_RTL (fndecl), 0), + DEFAULT_INIT_PRIORITY); } + if (DECL_STATIC_DESTRUCTOR (fndecl)) { #ifndef ASM_OUTPUT_DESTRUCTOR @@ -6791,7 +6792,8 @@ c_expand_body (fndecl, nested_p) static_dtors = tree_cons (NULL_TREE, fndecl, static_dtors); else #endif - assemble_destructor (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (fndecl))); + assemble_destructor (XEXP (DECL_RTL (fndecl), 0), + DEFAULT_INIT_PRIORITY); } if (nested_p) diff --git a/gcc/ch/ChangeLog b/gcc/ch/ChangeLog index d242105..b1c048b 100644 --- a/gcc/ch/ChangeLog +++ b/gcc/ch/ChangeLog @@ -1,3 +1,8 @@ +2001-08-06 Richard Henderson <rth@redhat.com> + + * grant.c (chill_finish_compile): Pass a symbol_ref and priority + to assemble_constructor. + 2001-07-19 Neil Booth <neil@daikokuya.demon.co.uk> * Makefile.in (lex.o): No dependence on dwarfout.h. diff --git a/gcc/ch/grant.c b/gcc/ch/grant.c index 29e7ddc..c10eb99 100644 --- a/gcc/ch/grant.c +++ b/gcc/ch/grant.c @@ -3048,7 +3048,8 @@ chill_finish_compile () if (pass == 2) { - assemble_constructor (IDENTIFIER_POINTER (chill_init_name)); + assemble_constructor (XEXP (DECL_RTL (chill_init_function), 0), + DEFAULT_INIT_PRIORITY); globalize_decl (chill_init_function); } diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 470fd82..1b3cceb 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2001-08-06 Richard Henderson <rth@redhat.com> + + * decl2.c (finish_objects): Pass a symbol_ref and priority to + assemble_{constructor,destructor}. Remove priority handling. + 2001-08-05 Gabriel Dos Reis <gdr@merlin.codesourcery.com> Don't allow template-id in using-declaration. diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index d35ab71..be02224 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -2839,8 +2839,8 @@ finish_objects (method_type, initp, body) int method_type, initp; tree body; { - const char *fnname; tree fn; + rtx fnsym; /* Finish up. */ finish_compound_stmt (/*has_no_scope=*/0, body); @@ -2853,31 +2853,11 @@ finish_objects (method_type, initp, body) if (flag_syntax_only) return; - fnname = XSTR (XEXP (DECL_RTL (fn), 0), 0); - if (initp == DEFAULT_INIT_PRIORITY) - { - if (method_type == 'I') - assemble_constructor (fnname); - else - assemble_destructor (fnname); - } -#if defined (ASM_OUTPUT_CONSTRUCTOR) - /* If we're using init priority we can't use assemble_*tor, but on ELF - targets we can stick the references into named sections for GNU ld - to collect. */ - else if (targetm.have_named_sections) - { - char buf[15]; - sprintf (buf, ".%ctors.%.5u", method_type == 'I' ? 'c' : 'd', - /* invert the numbering so the linker puts us in the proper - order; constructors are run from right to left, and the - linker sorts in increasing order. */ - MAX_INIT_PRIORITY - initp); - named_section (NULL_TREE, buf, 0); - assemble_integer (XEXP (DECL_RTL (fn), 0), - POINTER_SIZE / BITS_PER_UNIT, 1); - } -#endif + fnsym = XEXP (DECL_RTL (fn), 0); + if (method_type == 'I') + assemble_constructor (fnsym, initp); + else + assemble_destructor (fnsym, initp); } /* The names of the parameters to the function created to handle diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index 31c9785..5273aaf 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,8 @@ +2001-08-06 Richard Henderson <rth@redhat.com> + + * class.c (emit_register_classes): Pass a symbol_ref and priority + to assemble_constructor. + 2001-08-02 Alexandre Petit-Bianco <apbianco@redhat.com> * java-tree.h (all_class_filename): New macro. diff --git a/gcc/java/class.c b/gcc/java/class.c index 3b56f53..3cb8aa4 100644 --- a/gcc/java/class.c +++ b/gcc/java/class.c @@ -1903,7 +1903,7 @@ emit_register_classes () flag_inline_functions = saved_flag; } current_function_decl = NULL_TREE; - assemble_constructor (IDENTIFIER_POINTER (init_name)); + assemble_constructor (XEXP (DECL_RTL (init_decl), 0), DEFAULT_INIT_PRIORITY); } void diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c index 03c3ae4..67e4000 100644 --- a/gcc/objc/objc-act.c +++ b/gcc/objc/objc-act.c @@ -165,7 +165,7 @@ static void objc_post_options PARAMS ((void)); static void synth_module_prologue PARAMS ((void)); static tree build_constructor PARAMS ((tree, tree)); -static const char *build_module_descriptor PARAMS ((void)); +static rtx build_module_descriptor PARAMS ((void)); static tree init_module_descriptor PARAMS ((tree)); static tree build_objc_method_call PARAMS ((int, tree, tree, tree, tree, tree)); @@ -1836,13 +1836,12 @@ init_module_descriptor (type) /* Write out the data structures to describe Objective C classes defined. If appropriate, compile and output a setup function to initialize them. - Return a string which is the name of a function to call to initialize - the Objective C data structures for this file (and perhaps for other files - also). + Return a symbol_ref to the function to call to initialize the Objective C + data structures for this file (and perhaps for other files also). struct objc_module { ... } _OBJC_MODULE = { ... }; */ -static const char * +static rtx build_module_descriptor () { tree decl_specs, field_decl, field_decl_chain; @@ -1911,7 +1910,7 @@ build_module_descriptor () way of generating the requisite code. */ if (flag_next_runtime) - return 0; + return NULL_RTX; { tree parms, function_decl, decelerator, void_list_node_1; @@ -1967,8 +1966,7 @@ build_module_descriptor () function_decl = current_function_decl; finish_function (0); - /* Return the name of the constructor function. */ - return XSTR (XEXP (DECL_RTL (function_decl), 0), 0); + return XEXP (DECL_RTL (function_decl), 0); } } @@ -8361,9 +8359,9 @@ finish_objc () || meth_var_names_chain || meth_var_types_chain || sel_ref_chain) { /* Arrange for Objc data structures to be initialized at run time. */ - const char *init_name = build_module_descriptor (); - if (init_name) - assemble_constructor (init_name); + rtx init_sym = build_module_descriptor (); + if (init_sym) + assemble_constructor (init_sym, DEFAULT_INIT_PRIORITY); } /* Dump the class references. This forces the appropriate classes diff --git a/gcc/output.h b/gcc/output.h index f28c7af..574d6f6 100644 --- a/gcc/output.h +++ b/gcc/output.h @@ -257,16 +257,14 @@ extern void assemble_variable PARAMS ((tree, int, int, int)); extern void assemble_external PARAMS ((tree)); #endif /* TREE_CODE */ -/* Record an element in the table of global destructors. - How this is done depends on what sort of assembler and linker - are in use. - - NAME should be the name of a global function to be called - at exit time. This name is output using assemble_name. */ -extern void assemble_destructor PARAMS ((const char *)); +#ifdef RTX_CODE +/* Record an element in the table of global destructors. The argument + should be a SYMBOL_REF of the function to be called. */ +extern void assemble_destructor PARAMS ((rtx, int)); /* Likewise for global constructors. */ -extern void assemble_constructor PARAMS ((const char *)); +extern void assemble_constructor PARAMS ((rtx, int)); +#endif /* Likewise for entries we want to record for garbage collection. Garbage collection is still under development. */ diff --git a/gcc/profile.c b/gcc/profile.c index b3ecf4c..a872ab8 100644 --- a/gcc/profile.c +++ b/gcc/profile.c @@ -1147,5 +1147,5 @@ output_func_start_profiler () fflush (asm_out_file); current_function_decl = NULL_TREE; - assemble_constructor (IDENTIFIER_POINTER (DECL_NAME (fndecl))); + assemble_constructor (XEXP (DECL_RTL (fndecl), 0), DEFAULT_INIT_PRIORITY); } diff --git a/gcc/varasm.c b/gcc/varasm.c index d574a80..b7335d3 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -813,17 +813,34 @@ assemble_asm (string) fprintf (asm_out_file, "\t%s\n", TREE_STRING_POINTER (string)); } -/* Record an element in the table of global destructors. - How this is done depends on what sort of assembler and linker - are in use. - - NAME should be the name of a global function to be called - at exit time. This name is output using assemble_name. */ +/* Record an element in the table of global destructors. The argument + should be a SYMBOL_REF of the function to be called. */ void -assemble_destructor (name) - const char *name; +assemble_destructor (symbol, priority) + rtx symbol; + int priority; { + const char *name; + + if (GET_CODE (symbol) != SYMBOL_REF) + abort (); + name = XSTR (symbol, 0); + + if (priority != DEFAULT_INIT_PRIORITY + && targetm.have_named_sections) + { + char buf[15]; + sprintf (buf, ".dtors.%.5u", + /* Invert the numbering so the linker puts us in the proper + order; constructors are run from right to left, and the + linker sorts in increasing order. */ + MAX_INIT_PRIORITY - priority); + named_section_flags (buf, SECTION_WRITE, POINTER_SIZE / BITS_PER_UNIT); + assemble_integer (symbol, POINTER_SIZE / BITS_PER_UNIT, 1); + return; + } + #ifdef ASM_OUTPUT_DESTRUCTOR ASM_OUTPUT_DESTRUCTOR (asm_out_file, name); #else @@ -841,9 +858,30 @@ assemble_destructor (name) /* Likewise for global constructors. */ void -assemble_constructor (name) - const char *name; +assemble_constructor (symbol, priority) + rtx symbol; + int priority; { + const char *name; + + if (GET_CODE (symbol) != SYMBOL_REF) + abort (); + name = XSTR (symbol, 0); + + if (priority != DEFAULT_INIT_PRIORITY + && targetm.have_named_sections) + { + char buf[15]; + sprintf (buf, ".ctors.%.5u", + /* Invert the numbering so the linker puts us in the proper + order; constructors are run from right to left, and the + linker sorts in increasing order. */ + MAX_INIT_PRIORITY - priority); + named_section_flags (buf, SECTION_WRITE, POINTER_SIZE / BITS_PER_UNIT); + assemble_integer (symbol, POINTER_SIZE / BITS_PER_UNIT, 1); + return; + } + #ifdef ASM_OUTPUT_CONSTRUCTOR ASM_OUTPUT_CONSTRUCTOR (asm_out_file, name); #else |