From: Sergey M. Samoylov Date: Sat, 8 Jan 2005 14:33:34 +0000 (+0000) Subject: backport: re PR bootstrap/13617 (IRIX 6.5 Ada bootstrap failure with GNU as 2.14.90) X-Git-Tag: releases/gcc-3.3.6~142 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=77d4d1abeabf470bde1913b32a3f7e8af39b2264;p=thirdparty%2Fgcc.git backport: re PR bootstrap/13617 (IRIX 6.5 Ada bootstrap failure with GNU as 2.14.90) Backport: 2004-02-12 Richard Sandiford PR bootstrap/13617 * config/mips/mips-protos.h (mips_output_aligned_decl_common): Declare. (mips_declare_object): Make variadic. * config/mips/mips.h (ASM_OUTPUT_ALIGNED_DECL_COMMON): Use mips_output_aligned_decl_common. * config/mips/mips.c (mips_output_aligned_decl_common): New function. (mips_declare_object): Make variadic. From-SVN: r93084 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e7f3703c4460..b05b45708911 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,15 @@ +2005-01-08 Sergey M. Samoylov + + Backport: + 2004-02-12 Richard Sandiford + PR bootstrap/13617 + * config/mips/mips-protos.h (mips_output_aligned_decl_common): Declare. + (mips_declare_object): Make variadic. + * config/mips/mips.h (ASM_OUTPUT_ALIGNED_DECL_COMMON): Use + mips_output_aligned_decl_common. + * config/mips/mips.c (mips_output_aligned_decl_common): New function. + (mips_declare_object): Make variadic. + 2005-01-08 Richard Sandiford PR target/17565 diff --git a/gcc/config/mips/mips-protos.h b/gcc/config/mips/mips-protos.h index f7ec8183ed0d..f5cc947014b5 100644 --- a/gcc/config/mips/mips-protos.h +++ b/gcc/config/mips/mips-protos.h @@ -1,6 +1,6 @@ /* Prototypes of target machine for GNU compiler. MIPS version. Copyright (C) 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2001, 2002 Free Software Foundation, Inc. + 1999, 2001, 2002, 2005 Free Software Foundation, Inc. Contributed by A. Lichnewsky (lich@inria.inria.fr). Changed by Michael Meissner (meissner@osf.org). 64 bit r4000 support by Ian Lance Taylor (ian@cygnus.com) and @@ -36,9 +36,13 @@ extern void iris6_asm_output_align PARAMS ((FILE *, unsigned)); extern const char * current_section_name PARAMS ((void)); extern unsigned int current_section_flags PARAMS ((void)); extern int mips_can_use_return_insn PARAMS ((void)); -extern void mips_declare_object PARAMS ((FILE *, const char *, - const char *, - const char *, int)); +extern void mips_output_aligned_decl_common + PARAMS ((FILE *, tree, const char *, + unsigned HOST_WIDE_INT, + unsigned int)); +extern void mips_declare_object + PARAMS ((FILE *, const char *, const char *, + const char *, ...)); extern void mips_expand_epilogue PARAMS ((void)); extern void mips_expand_prologue PARAMS ((void)); extern void mips_output_filename PARAMS ((FILE *, const char *)); diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c index 44024f2e8136..cfc304a6cc24 100644 --- a/gcc/config/mips/mips.c +++ b/gcc/config/mips/mips.c @@ -1,6 +1,6 @@ /* Subroutines for insn-output.c for MIPS Copyright (C) 1989, 1990, 1991, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + 1999, 2000, 2001, 2002, 2005 Free Software Foundation, Inc. Contributed by A. Lichnewsky, lich@inria.inria.fr. Changes by Michael Meissner, meissner@osf.org. 64 bit r4000 support by Ian Lance Taylor, ian@cygnus.com, and @@ -6562,26 +6562,84 @@ copy_file_data (to, from) fatal_io_error ("can't close temp file"); } -/* Emit either a label, .comm, or .lcomm directive, and mark that the symbol - is used, so that we don't emit an .extern for it in mips_asm_file_end. */ +/* Implement ASM_OUTPUT_ALIGNED_DECL_COMMON. This is usually the same as + the elfos.h version, but we also need to handle -muninit-const-in-rodata + and the limitations of the SGI o32 assembler. */ void -mips_declare_object (stream, name, init_string, final_string, size) +mips_output_aligned_decl_common (stream, decl, name, size, align) FILE *stream; + tree decl; const char *name; - const char *init_string; - const char *final_string; - int size; + unsigned HOST_WIDE_INT size; + unsigned int align; { - fputs (init_string, stream); /* "", "\t.comm\t", or "\t.lcomm\t" */ + const char *format; + + /* If the target wants uninitialized const declarations in + .rdata then don't put them in .comm. */ + if (TARGET_EMBEDDED_DATA && TARGET_UNINIT_CONST_IN_RODATA + && TREE_CODE (decl) == VAR_DECL && TREE_READONLY (decl) + && (DECL_INITIAL (decl) == 0 || DECL_INITIAL (decl) == error_mark_node)) + { + if (TREE_PUBLIC (decl) && DECL_NAME (decl)) + targetm.asm_out.globalize_label (stream, name); + + readonly_data_section (); + ASM_OUTPUT_ALIGN (stream, floor_log2 (align / BITS_PER_UNIT)); + + format = ACONCAT ((":\n\t.space\t", HOST_WIDE_INT_PRINT_UNSIGNED, + "\n", NULL)); + mips_declare_object (stream, name, "", format, size); + } +#ifdef TARGET_IRIX6 + /* The SGI o32 assembler doesn't accept an alignment, so round up + the size instead. */ + else if (mips_abi == ABI_32 && !TARGET_GAS) + { + size += (align / BITS_PER_UNIT) - 1; + size -= size % (align / BITS_PER_UNIT); + format = ACONCAT ((",", HOST_WIDE_INT_PRINT_UNSIGNED, "\n", NULL)); + mips_declare_object (stream, name, "\n\t.comm\t", format, size); + } +#endif + else + { + format = ACONCAT ((",", HOST_WIDE_INT_PRINT_UNSIGNED, ",%u\n", NULL)); + mips_declare_object (stream, name, "\n\t.comm\t", format, + size, align / BITS_PER_UNIT); + } +} + +/* Emit either a label, .comm, or .lcomm directive. When using assembler + macros, mark the symbol as written so that mips_file_end won't emit an + .extern for it. STREAM is the output file, NAME is the name of the + symbol, INIT_STRING is the string that should be written before the + symbol and FINAL_STRING is the string that shoulbe written after it. + FINAL_STRING is a printf() format that consumes the remaining arguments. */ + +void +mips_declare_object VPARAMS ((FILE *stream, const char *name, + const char *init_string, + const char *final_string, ...)) +{ + VA_OPEN (ap, final_string); + VA_FIXEDARG (ap, FILE *, stream); + VA_FIXEDARG (ap, const char *, name); + VA_FIXEDARG (ap, const char *, init_string); + VA_FIXEDARG (ap, const char *, final_string); + + fputs (init_string, stream); assemble_name (stream, name); - fprintf (stream, final_string, size); /* ":\n", ",%u\n", ",%u\n" */ + vfprintf (stream, final_string, ap); if (TARGET_GP_OPT) { tree name_tree = get_identifier (name); TREE_ASM_WRITTEN (name_tree) = 1; } + + VA_CLOSE (ap); } /* Return the bytes needed to compute the frame pointer from the current diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h index 0de8bbf703aa..ad05be588c36 100644 --- a/gcc/config/mips/mips.h +++ b/gcc/config/mips/mips.h @@ -1,6 +1,6 @@ /* Definitions of target machine for GNU compiler. MIPS version. Copyright (C) 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998 - 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + 1999, 2000, 2001, 2002, 2003, 2005 Free Software Foundation, Inc. Contributed by A. Lichnewsky (lich@inria.inria.fr). Changed by Michael Meissner (meissner@osf.org). 64 bit r4000 support by Ian Lance Taylor (ian@cygnus.com) and @@ -4326,28 +4326,7 @@ while (0) /* This says how to define a global common symbol. */ -#define ASM_OUTPUT_ALIGNED_DECL_COMMON(STREAM, DECL, NAME, SIZE, ALIGN) \ - do { \ - /* If the target wants uninitialized const declarations in \ - .rdata then don't put them in .comm */ \ - if (TARGET_EMBEDDED_DATA && TARGET_UNINIT_CONST_IN_RODATA \ - && TREE_CODE (DECL) == VAR_DECL && TREE_READONLY (DECL) \ - && (DECL_INITIAL (DECL) == 0 \ - || DECL_INITIAL (DECL) == error_mark_node)) \ - { \ - if (TREE_PUBLIC (DECL) && DECL_NAME (DECL)) \ - (*targetm.asm_out.globalize_label) (STREAM, NAME); \ - \ - readonly_data_section (); \ - ASM_OUTPUT_ALIGN (STREAM, floor_log2 (ALIGN / BITS_PER_UNIT)); \ - mips_declare_object (STREAM, NAME, "", ":\n\t.space\t%u\n", \ - (SIZE)); \ - } \ - else \ - mips_declare_object (STREAM, NAME, "\n\t.comm\t", ",%u\n", \ - (SIZE)); \ - } while (0) - +#define ASM_OUTPUT_ALIGNED_DECL_COMMON mips_output_aligned_decl_common /* This says how to define a local common symbol (ie, not visible to linker). */