From: Richard Sandiford Date: Thu, 12 Feb 2004 19:08:34 +0000 (+0000) Subject: re PR bootstrap/13617 (IRIX 6.5 Ada bootstrap failure with GNU as 2.14.90) X-Git-Tag: releases/gcc-4.0.0~10157 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=35f5add9236429ef410635f4180d6ea3f29010c8;p=thirdparty%2Fgcc.git re PR bootstrap/13617 (IRIX 6.5 Ada bootstrap failure with GNU as 2.14.90) 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: r77721 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3d38c29aeb5c..3c3b8605748a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +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. + 2004-02-12 Richard Kenner * emit-rtl.c (set_mem_attributes_minus_bitpos): Don't kill diff --git a/gcc/config/mips/mips-protos.h b/gcc/config/mips/mips-protos.h index 8a55e1ac1255..a2b1d458fc36 100644 --- a/gcc/config/mips/mips-protos.h +++ b/gcc/config/mips/mips-protos.h @@ -104,8 +104,11 @@ extern void mips_output_lineno (FILE *, int); extern void mips_output_ascii (FILE *, const char *, size_t, const char *); extern void mips_output_aligned_bss (FILE *, tree, const char *, unsigned HOST_WIDE_INT, int); +extern void mips_output_aligned_decl_common (FILE *, tree, const char *, + unsigned HOST_WIDE_INT, + unsigned int); extern void mips_declare_object (FILE *, const char *, const char *, - const char *, int); + const char *, ...); extern void mips_declare_object_name (FILE *, const char *, tree); extern void mips_finish_declare_object (FILE *, tree, int, int); diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c index 4d3a5bfda559..40b80148fc02 100644 --- a/gcc/config/mips/mips.c +++ b/gcc/config/mips/mips.c @@ -6022,17 +6022,63 @@ mips_file_end (void) } } +/* 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_output_aligned_decl_common (FILE *stream, tree decl, const char *name, + unsigned HOST_WIDE_INT size, + unsigned int align) +{ + /* 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" HOST_WIDE_INT_PRINT_UNSIGNED "\n", + size); + } + else if (TARGET_SGI_O32_AS) + { + /* The SGI o32 assembler doesn't accept an alignment, so round up + the size instead. */ + size += (align / BITS_PER_UNIT) - 1; + size -= size % (align / BITS_PER_UNIT); + mips_declare_object (stream, name, "\n\t.comm\t", + "," HOST_WIDE_INT_PRINT_UNSIGNED "\n", size); + } + else + mips_declare_object (stream, name, "\n\t.comm\t", + "," HOST_WIDE_INT_PRINT_UNSIGNED ",%u\n", + 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. */ + .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 (FILE *stream, const char *name, const char *init_string, - const char *final_string, int size) + const char *final_string, ...) { - fputs (init_string, stream); /* "", "\t.comm\t", or "\t.lcomm\t" */ + va_list ap; + + fputs (init_string, stream); assemble_name (stream, name); - fprintf (stream, final_string, size); /* ":\n", ",%u\n", ",%u\n" */ + va_start (ap, final_string); + vfprintf (stream, final_string, ap); + va_end (ap); if (!TARGET_EXPLICIT_RELOCS) { diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h index 616557c5e9b7..708b2e2eec0f 100644 --- a/gcc/config/mips/mips.h +++ b/gcc/config/mips/mips.h @@ -3177,28 +3177,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). */