From 5811cb27a8bb6ff2dcfa12ca57cb140c97079fa1 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Mon, 23 Aug 2004 06:53:46 +0000 Subject: [PATCH] config.gcc (mips-*-*): Remove definitions of MASK_GAS and OBJECT_FORMAT_ELF. * config.gcc (mips-*-*): Remove definitions of MASK_GAS and OBJECT_FORMAT_ELF. Set MASK_SPLIT_ADDR by default if using GNU ld. * config/mips/mips.h (MASK_GAS): Delete. Shuffle later masks down. (TARGET_GAS, TARGET_MIPS_AS): Delete. (TARGET_GPWORD): Define to true for n32 on IRIX. (TARGET_SWITCHES): Remove -mmips-as. Turn -mgas into a no-op. (MIPS_AS_ASM_SPEC, SUBTARGET_MIPS_AS_ASM_SPEC): Delete. (GAS_ASM_SPEC): Delete, folding into ASM_SPEC. (ASM_ABI_DEFAULT_SPEC, TARGET_ASM_SPEC): Delete. (MDEBUG_ASM_SPEC): Delete, folding into... (SUBTARGET_ASM_DEBUGGING_SPEC): ...here. (ASM_SPEC): Inline old GAS_ASM_SPEC. Use GNU names for ABI switches. (EXTRA_SPECS): Remove mips_as_asm_spec, gas_asm_spec, target_asm_spec, subtarget_mips_as_asm_spec, mdebug_asm_spec. Use MULTILIB_ABI_DEFAULT to define asm_abi_default_spec. (ASM_STABS_OP, ASM_STABN_OP, ASM_STABD_OP): Delete. (TARGET_ASM_SELECT_SECTION): Delete. * config/mips/mips.c (MIPS_MAX_FIRST_STACK_STEP): Define to 0x7ff0 for non-mips16 code, removing previous workaround for SGI assemblers. (TARGET_ASM_INTEGER, mips_assemble_integer): Delete. (TARGET_ASM_ALIGNED_DI_OP): Define this instead. (override_options): Remove !TARGET_GAS and !have_named_sections code. (print_operand): Fold TARGET_GAS conditionals into asm strings. (mips_output_filename): Remove !TARGET_GAS code. Replace use of ASM_STABS_OP and ASM_STABN_OP. (mips_file_start): Remove TARGET_MIPS_AS/TARGET_GAS checks. (mips_output_aligned_decl_common): Remove mention of SGI o32 assembler. (mips_output_function_prologue): Remove !TARGET_GAS code. (mips_select_rtx_section): Remove !have_named_sections code. (mips_select_section): Delete. * config/mips/mips.md (trap): Remove !TARGET_GAS check. * config/mips/linux.h (TARGET_DEFAULT): Remove use of MASK_GAS. * config/mips/sdb.h (PUT_SDB_DEF, PUT_SDB_PLAIN_DEF): Delete. (PUT_SDB_BLOCK_START, PUT_SDB_BLOCK_END): Fold TARGET_GAS conditional. * config/mips/vxworks.h (ASM_SPEC): As for mips.h. * config/mips/windiss.h (ASM_SPEC): Likewise. testsuite/ * gcc.dg/special/mips-abi.exp: Expect gcc to pass the GNU ABI flags to the assembler. Simplify test accordingly. (asm_abi_flags): Use GNU names. (check_mips_abi, default_abi): Use string matches against "-mabi=*" to check for ABI flags. From-SVN: r86405 --- gcc/ChangeLog | 39 +++++ gcc/config.gcc | 46 ++---- gcc/config/mips/linux.h | 2 +- gcc/config/mips/mips.c | 113 ++------------ gcc/config/mips/mips.h | 173 +++++----------------- gcc/config/mips/mips.md | 3 +- gcc/config/mips/sdb.h | 20 +-- gcc/config/mips/vxworks.h | 5 +- gcc/config/mips/windiss.h | 5 +- gcc/testsuite/ChangeLog | 8 + gcc/testsuite/gcc.dg/special/mips-abi.exp | 39 ++--- 11 files changed, 135 insertions(+), 318 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 25da5351e72..cd83846fcf1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,42 @@ +2004-08-23 Richard Sandiford + + * config.gcc (mips-*-*): Remove definitions of MASK_GAS and + OBJECT_FORMAT_ELF. Set MASK_SPLIT_ADDR by default if using GNU ld. + * config/mips/mips.h (MASK_GAS): Delete. Shuffle later masks down. + (TARGET_GAS, TARGET_MIPS_AS): Delete. + (TARGET_GPWORD): Define to true for n32 on IRIX. + (TARGET_SWITCHES): Remove -mmips-as. Turn -mgas into a no-op. + (MIPS_AS_ASM_SPEC, SUBTARGET_MIPS_AS_ASM_SPEC): Delete. + (GAS_ASM_SPEC): Delete, folding into ASM_SPEC. + (ASM_ABI_DEFAULT_SPEC, TARGET_ASM_SPEC): Delete. + (MDEBUG_ASM_SPEC): Delete, folding into... + (SUBTARGET_ASM_DEBUGGING_SPEC): ...here. + (ASM_SPEC): Inline old GAS_ASM_SPEC. Use GNU names for ABI switches. + (EXTRA_SPECS): Remove mips_as_asm_spec, gas_asm_spec, target_asm_spec, + subtarget_mips_as_asm_spec, mdebug_asm_spec. Use MULTILIB_ABI_DEFAULT + to define asm_abi_default_spec. + (ASM_STABS_OP, ASM_STABN_OP, ASM_STABD_OP): Delete. + (TARGET_ASM_SELECT_SECTION): Delete. + * config/mips/mips.c (MIPS_MAX_FIRST_STACK_STEP): Define to 0x7ff0 + for non-mips16 code, removing previous workaround for SGI assemblers. + (TARGET_ASM_INTEGER, mips_assemble_integer): Delete. + (TARGET_ASM_ALIGNED_DI_OP): Define this instead. + (override_options): Remove !TARGET_GAS and !have_named_sections code. + (print_operand): Fold TARGET_GAS conditionals into asm strings. + (mips_output_filename): Remove !TARGET_GAS code. Replace use of + ASM_STABS_OP and ASM_STABN_OP. + (mips_file_start): Remove TARGET_MIPS_AS/TARGET_GAS checks. + (mips_output_aligned_decl_common): Remove mention of SGI o32 assembler. + (mips_output_function_prologue): Remove !TARGET_GAS code. + (mips_select_rtx_section): Remove !have_named_sections code. + (mips_select_section): Delete. + * config/mips/mips.md (trap): Remove !TARGET_GAS check. + * config/mips/linux.h (TARGET_DEFAULT): Remove use of MASK_GAS. + * config/mips/sdb.h (PUT_SDB_DEF, PUT_SDB_PLAIN_DEF): Delete. + (PUT_SDB_BLOCK_START, PUT_SDB_BLOCK_END): Fold TARGET_GAS conditional. + * config/mips/vxworks.h (ASM_SPEC): As for mips.h. + * config/mips/windiss.h (ASM_SPEC): Likewise. + 2004-08-23 Richard Sandiford * read-rtl.c (map_value, mapping, macro_group): New structures. diff --git a/gcc/config.gcc b/gcc/config.gcc index 0eacb5d8bf8..ecb619b9134 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -1278,7 +1278,7 @@ mcore-*-pe*) mips-sgi-irix[56]*) tm_file="elfos.h ${tm_file} mips/iris.h" tmake_file="mips/t-iris mips/t-slibgcc-irix" - target_cpu_default="MASK_GAS|MASK_ABICALLS" + target_cpu_default="MASK_ABICALLS" case ${target} in *-*-irix5*) tm_file="${tm_file} mips/iris5.h" @@ -1304,7 +1304,7 @@ mips-sgi-irix[56]*) use_fixproto=yes ;; mips*-*-netbsd*) # NetBSD/mips, either endian. - target_cpu_default="MASK_GAS|MASK_ABICALLS" + target_cpu_default="MASK_ABICALLS" tm_file="elfos.h ${tm_file} mips/elf.h netbsd.h netbsd-elf.h mips/netbsd.h" ;; mips64*-*-linux*) @@ -1333,7 +1333,7 @@ mips*-*-linux*) # Linux MIPS, either endian. ;; mips*-*-openbsd*) tm_defines="OBSD_HAS_DECLARE_FUNCTION_NAME OBSD_HAS_DECLARE_OBJECT OBSD_HAS_CORRECT_SPECS" - target_cpu_default="MASK_GAS|MASK_ABICALLS" + target_cpu_default="MASK_ABICALLS" tm_file="mips/mips.h openbsd.h mips/openbsd.h mips/sdb.h" case ${target} in mips*el-*-openbsd*) @@ -1356,21 +1356,21 @@ mipsisa32r2-*-elf* | mipsisa32r2el-*-elf*) mipsisa64-*-elf* | mipsisa64el-*-elf*) tm_file="elfos.h ${tm_file} mips/elf.h" tmake_file=mips/t-isa3264 - target_cpu_default="MASK_64BIT|MASK_FLOAT64|MASK_GAS" + target_cpu_default="MASK_64BIT|MASK_FLOAT64" tm_defines="MIPS_ISA_DEFAULT=64 MIPS_ABI_DEFAULT=ABI_EABI" use_fixproto=yes ;; mipsisa64sr71k-*-elf*) tm_file="elfos.h ${tm_file} mips/elf.h" tmake_file=mips/t-sr71k - target_cpu_default="MASK_64BIT|MASK_FLOAT64|MASK_GAS" + target_cpu_default="MASK_64BIT|MASK_FLOAT64" tm_defines="MIPS_ISA_DEFAULT=64 MIPS_CPU_STRING_DEFAULT=\\\"sr71000\\\" MIPS_ABI_DEFAULT=ABI_EABI" use_fixproto=yes ;; mipsisa64sb1-*-elf* | mipsisa64sb1el-*-elf*) tm_file="elfos.h ${tm_file} mips/elf.h" tmake_file=mips/t-elf - target_cpu_default="MASK_64BIT|MASK_FLOAT64|MASK_GAS" + target_cpu_default="MASK_64BIT|MASK_FLOAT64" tm_defines="MIPS_ISA_DEFAULT=64 MIPS_CPU_STRING_DEFAULT=\\\"sb1\\\" MIPS_ABI_DEFAULT=ABI_O64" use_fixproto=yes ;; @@ -1382,7 +1382,7 @@ mips-*-elf* | mipsel-*-elf*) mips64-*-elf* | mips64el-*-elf*) tm_file="elfos.h ${tm_file} mips/elf.h" tmake_file=mips/t-elf - target_cpu_default="MASK_64BIT|MASK_FLOAT64|MASK_GAS" + target_cpu_default="MASK_64BIT|MASK_FLOAT64" tm_defines="MIPS_ISA_DEFAULT=3 MIPS_ABI_DEFAULT=ABI_O64" use_fixproto=yes ;; @@ -1394,7 +1394,7 @@ mips64vr-*-elf* | mips64vrel-*-elf*) mips64orion-*-elf* | mips64orionel-*-elf*) tm_file="elfos.h ${tm_file} mips/elforion.h mips/elf.h" tmake_file=mips/t-elf - target_cpu_default="MASK_64BIT|MASK_FLOAT64|MASK_GAS" + target_cpu_default="MASK_64BIT|MASK_FLOAT64" tm_defines="MIPS_ISA_DEFAULT=3 MIPS_ABI_DEFAULT=ABI_O64" use_fixproto=yes ;; @@ -1407,13 +1407,11 @@ mips-wrs-vxworks) # have to redo the tm_file list from scratch. tm_file="elfos.h mips/mips.h svr4.h mips/elf.h vxworks.h mips/vxworks.h" tmake_file="${tmake_file} mips/t-vxworks" - target_cpu_default="MASK_GAS" ;; mips-wrs-windiss) # Instruction-level simulator for VxWorks. xm_defines=POSIX tm_file="elfos.h mips/mips.h svr4.h mips/elf.h windiss.h mips/windiss.h" tmake_file="${tmake_file} mips/t-elf" - target_cpu_default="MASK_GAS" thread_file= ;; mipstx39-*-elf* | mipstx39el-*-elf*) @@ -2598,35 +2596,15 @@ fi ;; mips*-*-*) - case ${target} in - mips*-*-ecoff* | mips*-*-elf*) - if test x$gas = xyes - then - if test x$gnu_ld = xyes - then - target_cpu_default2="MASK_GAS|MASK_SPLIT_ADDR" - else - target_cpu_default2="MASK_GAS" - fi - fi - ;; - mips*-*-*) - if test x$gas = xyes - then - target_cpu_default2="MASK_GAS" - fi - ;; - esac + if test x$gnu_ld = xyes + then + target_cpu_default2="MASK_SPLIT_ADDR" + fi case ${target} in mips*el-*-*) tm_defines="TARGET_ENDIAN_DEFAULT=0 $tm_defines" ;; esac - case $tm_file in - *mips/elf.h*) - tm_defines="OBJECT_FORMAT_ELF $tm_defines" - ;; - esac if test "x$enable_gofast" = xyes then tm_defines="US_SOFTWARE_GOFAST $tm_defines" diff --git a/gcc/config/mips/linux.h b/gcc/config/mips/linux.h index eee298f8a73..a4765d494ee 100644 --- a/gcc/config/mips/linux.h +++ b/gcc/config/mips/linux.h @@ -51,7 +51,7 @@ Boston, MA 02111-1307, USA. */ /* If we don't set MASK_ABICALLS, we can't default to PIC. */ #undef TARGET_DEFAULT -#define TARGET_DEFAULT (MASK_ABICALLS|MASK_GAS) +#define TARGET_DEFAULT MASK_ABICALLS #define TARGET_OS_CPP_BUILTINS() \ do { \ diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c index edb673b6935..5067324a05e 100644 --- a/gcc/config/mips/mips.c +++ b/gcc/config/mips/mips.c @@ -79,10 +79,8 @@ Boston, MA 02111-1307, USA. */ allocate and deallocate the top part of the frame. The value in the !mips16 case must be a SMALL_OPERAND and must - preserve the maximum stack alignment. It could really be 0x7ff0, - but SGI's assemblers implement daddiu $sp,$sp,-0x7ff0 as a - multi-instruction addu sequence. Use 0x7fe0 to work around this. */ -#define MIPS_MAX_FIRST_STACK_STEP (TARGET_MIPS16 ? 0x100 : 0x7fe0) + preserve the maximum stack alignment. */ +#define MIPS_MAX_FIRST_STACK_STEP (TARGET_MIPS16 ? 0x100 : 0x7ff0) /* True if INSN is a mips.md pattern or asm statement. */ #define USEFUL_INSN_P(INSN) \ @@ -180,7 +178,6 @@ static void mips_set_architecture (const struct mips_cpu_info *); static void mips_set_tune (const struct mips_cpu_info *); static struct machine_function *mips_init_machine_status (void); static void print_operand_reloc (FILE *, rtx, const char **); -static bool mips_assemble_integer (rtx, unsigned int, int); #if TARGET_IRIX static void irix_output_external_libcall (rtx); #endif @@ -208,8 +205,6 @@ static void mips_output_mi_thunk (FILE *, tree, HOST_WIDE_INT, static int symbolic_expression_p (rtx); static void mips_select_rtx_section (enum machine_mode, rtx, unsigned HOST_WIDE_INT); -static void mips_select_section (tree, int, unsigned HOST_WIDE_INT) - ATTRIBUTE_UNUSED; static bool mips_in_small_data_p (tree); static int mips_fpr_return_fields (tree, tree *); static bool mips_return_in_msb (tree); @@ -613,8 +608,8 @@ const struct mips_cpu_info mips_cpu_info_table[] = { #define TARGET_ASM_ALIGNED_HI_OP "\t.half\t" #undef TARGET_ASM_ALIGNED_SI_OP #define TARGET_ASM_ALIGNED_SI_OP "\t.word\t" -#undef TARGET_ASM_INTEGER -#define TARGET_ASM_INTEGER mips_assemble_integer +#undef TARGET_ASM_ALIGNED_DI_OP +#define TARGET_ASM_ALIGNED_DI_OP "\t.dword\t" #undef TARGET_ASM_FUNCTION_PROLOGUE #define TARGET_ASM_FUNCTION_PROLOGUE mips_output_function_prologue @@ -4063,20 +4058,6 @@ override_options (void) warning ("-G is incompatible with PIC code which is the default"); } - /* The MIPS and SGI o32 assemblers expect small-data variables to - be declared before they are used. Although we once had code to - do this, it was very invasive and fragile. It no longer seems - worth the effort. */ - if (!TARGET_EXPLICIT_RELOCS && !TARGET_GAS) - mips_section_threshold = 0; - - /* We switch to small data sections using ".section", which the native - o32 irix assemblers don't understand. Disable -G accordingly. - We must do this regardless of command-line options since otherwise - the compiler would abort. */ - if (!targetm.have_named_sections) - mips_section_threshold = 0; - /* mips_split_addresses is a half-way house between explicit relocations and the traditional assembler macros. It can split absolute 32-bit symbolic constants into a high/lo_sum @@ -4087,20 +4068,13 @@ override_options (void) Although this code should work for -O0, it has traditionally been treated as an optimization. */ - if (TARGET_GAS && !TARGET_MIPS16 && TARGET_SPLIT_ADDRESSES + if (!TARGET_MIPS16 && TARGET_SPLIT_ADDRESSES && optimize && !flag_pic && !ABI_HAS_64BIT_SYMBOLS) mips_split_addresses = 1; else mips_split_addresses = 0; - /* Explicit relocations for "old" ABIs are a GNU extension. Unless - the user has said otherwise, assume that they are not available - with assemblers other than gas. */ - if (!TARGET_NEWABI && !TARGET_GAS - && (target_flags_explicit & MASK_EXPLICIT_RELOCS) == 0) - target_flags &= ~MASK_EXPLICIT_RELOCS; - /* -mvr4130-align is a "speed over size" optimization: it usually produces faster code, but at the expense of more nops. Enable it at -O3 and above. */ @@ -4646,14 +4620,14 @@ print_operand (FILE *file, rtx op, int letter) case '{': if (set_volatile++ == 0) - fprintf (file, "%s.set\tvolatile\n\t", TARGET_MIPS_AS ? "" : "#"); + fputs ("#.set\tvolatile\n\t", file); break; case '}': if (set_volatile == 0) error ("internal error: %%} found without a %%{ in assembler pattern"); else if (--set_volatile == 0) - fprintf (file, "\n\t%s.set\tnovolatile", (TARGET_MIPS_AS) ? "" : "#"); + fputs ("\n\t#.set\tnovolatile", file); break; @@ -4869,26 +4843,6 @@ print_operand_address (FILE *file, rtx x) abort (); } -/* Target hook for assembling integer objects. It appears that the Irix - 6 assembler can't handle 64-bit decimal integers, so avoid printing - such an integer here. */ - -static bool -mips_assemble_integer (rtx x, unsigned int size, int aligned_p) -{ - if ((TARGET_64BIT || TARGET_GAS) && size == 8 && aligned_p) - { - fputs ("\t.dword\t", asm_out_file); - if (HOST_BITS_PER_WIDE_INT < 64 || GET_CODE (x) != CONST_INT) - output_addr_const (asm_out_file, x); - else - print_operand (asm_out_file, x, 'X'); - fputc ('\n', asm_out_file); - return true; - } - return default_assemble_integer (x, size, aligned_p); -} - /* When using assembler macros, keep track of all of small-data externs so that mips_file_end can emit the appropriate declarations for them. @@ -4958,15 +4912,12 @@ mips_output_filename (FILE *stream, const char *name) num_source_filenames += 1; current_function_file = name; ASM_OUTPUT_FILENAME (stream, num_source_filenames, name); - /* This tells mips-tfile that stabs will follow. */ - if (!TARGET_GAS && write_symbols == DBX_DEBUG) - fprintf (stream, "\t#@stabs\n"); } else if (write_symbols == DBX_DEBUG) { ASM_GENERATE_INTERNAL_LABEL (ltext_label_name, "Ltext", 0); - fprintf (stream, "%s", ASM_STABS_OP); + fputs ("\t.stabs\t", stream); output_quoted_string (stream, name); fprintf (stream, ",%d,0,0,%s\n", N_SOL, <ext_label_name[1]); } @@ -4991,8 +4942,8 @@ mips_output_lineno (FILE *stream, int line) if (write_symbols == DBX_DEBUG) { ++sym_lineno; - fprintf (stream, "%sLM%d:\n%s%d,0,%d,%sLM%d\n", - LOCAL_LABEL_PREFIX, sym_lineno, ASM_STABN_OP, N_SLINE, line, + fprintf (stream, "%sLM%d:\n\t.stabn\t%d,0,%d,%sLM%d\n", + LOCAL_LABEL_PREFIX, sym_lineno, N_SLINE, line, LOCAL_LABEL_PREFIX, sym_lineno); } else @@ -5087,15 +5038,7 @@ mips_file_start (void) { default_file_start (); - /* Versions of the MIPS assembler before 2.20 generate errors if a branch - inside of a .set noreorder section jumps to a label outside of the .set - noreorder section. Revision 2.20 just set nobopt silently rather than - fixing the bug. */ - - if (TARGET_MIPS_AS && optimize && flag_delayed_branch) - fprintf (asm_out_file, "\t.set\tnobopt\n"); - - if (TARGET_GAS && !TARGET_IRIX) + if (!TARGET_IRIX) { /* Generate a special section to describe the ABI switches used to produce the resultant binary. This used to be done by the assembler @@ -5212,9 +5155,8 @@ 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. */ +/* 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. */ void mips_output_aligned_decl_common (FILE *stream, tree decl, const char *name, @@ -5237,7 +5179,6 @@ mips_output_aligned_decl_common (FILE *stream, tree decl, const char *name, size); } else - /* The SGI o32 assembler doesn't accept an alignment. */ mips_declare_common_object (stream, name, "\n\t.comm\t", size, align, true); } @@ -5862,12 +5803,6 @@ mips_output_function_prologue (FILE *file, HOST_WIDE_INT size ATTRIBUTE_UNUSED) const char *fnname; HOST_WIDE_INT tsize = cfun->machine->frame.total_size; - /* ??? When is this really needed? At least the GNU assembler does not - need the source filename more than once in the file, beyond what is - emitted by the debug information. */ - if (!TARGET_GAS) - ASM_OUTPUT_SOURCE_FILENAME (file, DECL_SOURCE_FILE (current_function_decl)); - #ifdef SDB_DEBUGGING_INFO if (debug_info_level != DINFO_LEVEL_TERSE && write_symbols == SDB_DEBUG) ASM_OUTPUT_SOURCE_LINE (file, DECL_SOURCE_LINE (current_function_decl), 0); @@ -6480,32 +6415,12 @@ mips_select_rtx_section (enum machine_mode mode, rtx x, && mips_section_threshold > 0) named_section (0, ".sdata", 0); else if (flag_pic && symbolic_expression_p (x)) - { - if (targetm.have_named_sections) - named_section (0, ".data.rel.ro", 3); - else - data_section (); - } + named_section (0, ".data.rel.ro", 3); else mergeable_constant_section (mode, align, 0); } } -/* Choose the section to use for DECL. RELOC is true if its value contains - any relocatable expression. */ - -static void -mips_select_section (tree decl, int reloc, - unsigned HOST_WIDE_INT align ATTRIBUTE_UNUSED) -{ - if (targetm.have_named_sections) - default_elf_select_section (decl, reloc, align); - else - /* The native irix o32 assembler doesn't support named sections. */ - default_select_section (decl, reloc, align); -} - - /* Implement TARGET_IN_SMALL_DATA_P. Return true if it would be safe to access DECL using %gp_rel(...)($gp). */ diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h index 0ff8642f279..7d83f4f73c3 100644 --- a/gcc/config/mips/mips.h +++ b/gcc/config/mips/mips.h @@ -133,34 +133,33 @@ extern const struct mips_cpu_info *mips_tune_info; #define MASK_SPLIT_ADDR 0x00000004 /* Address splitting is enabled. */ #define MASK_NO_FUSED_MADD 0x00000008 /* Don't generate floating point multiply-add operations. */ -#define MASK_GAS 0x00000010 /* Gas used instead of MIPS as */ -#define MASK_EXPLICIT_RELOCS 0x00000020 /* Use relocation operators. */ -#define MASK_MEMCPY 0x00000040 /* call memcpy instead of inline code*/ -#define MASK_SOFT_FLOAT 0x00000080 /* software floating point */ -#define MASK_FLOAT64 0x00000100 /* fp registers are 64 bits */ -#define MASK_ABICALLS 0x00000200 /* emit .abicalls/.cprestore/.cpload */ -#define MASK_XGOT 0x00000400 /* emit big-got PIC */ -#define MASK_LONG_CALLS 0x00000800 /* Always call through a register */ -#define MASK_64BIT 0x00001000 /* Use 64 bit GP registers and insns */ -#define MASK_EMBEDDED_DATA 0x00002000 /* Reduce RAM usage, not fast code */ -#define MASK_BIG_ENDIAN 0x00004000 /* Generate big endian code */ -#define MASK_SINGLE_FLOAT 0x00008000 /* Only single precision FPU. */ -#define MASK_MAD 0x00010000 /* Generate mad/madu as on 4650. */ -#define MASK_4300_MUL_FIX 0x00020000 /* Work-around early Vr4300 CPU bug */ -#define MASK_MIPS16 0x00040000 /* Generate mips16 code */ +#define MASK_EXPLICIT_RELOCS 0x00000010 /* Use relocation operators. */ +#define MASK_MEMCPY 0x00000020 /* call memcpy instead of inline code*/ +#define MASK_SOFT_FLOAT 0x00000040 /* software floating point */ +#define MASK_FLOAT64 0x00000080 /* fp registers are 64 bits */ +#define MASK_ABICALLS 0x00000100 /* emit .abicalls/.cprestore/.cpload */ +#define MASK_XGOT 0x00000200 /* emit big-got PIC */ +#define MASK_LONG_CALLS 0x00000400 /* Always call through a register */ +#define MASK_64BIT 0x00000800 /* Use 64 bit GP registers and insns */ +#define MASK_EMBEDDED_DATA 0x00001000 /* Reduce RAM usage, not fast code */ +#define MASK_BIG_ENDIAN 0x00002000 /* Generate big endian code */ +#define MASK_SINGLE_FLOAT 0x00004000 /* Only single precision FPU. */ +#define MASK_MAD 0x00008000 /* Generate mad/madu as on 4650. */ +#define MASK_4300_MUL_FIX 0x00010000 /* Work-around early Vr4300 CPU bug */ +#define MASK_MIPS16 0x00020000 /* Generate mips16 code */ #define MASK_NO_CHECK_ZERO_DIV \ - 0x00080000 /* divide by zero checking */ -#define MASK_BRANCHLIKELY 0x00100000 /* Generate Branch Likely + 0x00040000 /* divide by zero checking */ +#define MASK_BRANCHLIKELY 0x00080000 /* Generate Branch Likely instructions. */ #define MASK_UNINIT_CONST_IN_RODATA \ - 0x00200000 /* Store uninitialized + 0x00100000 /* Store uninitialized consts in rodata */ -#define MASK_FIX_R4000 0x00400000 /* Work around R4000 errata. */ -#define MASK_FIX_R4400 0x00800000 /* Work around R4400 errata. */ -#define MASK_FIX_SB1 0x01000000 /* Work around SB-1 errata. */ -#define MASK_FIX_VR4120 0x02000000 /* Work around VR4120 errata. */ -#define MASK_VR4130_ALIGN 0x04000000 /* Perform VR4130 alignment opts. */ -#define MASK_FP_EXCEPTIONS 0x08000000 /* FP exceptions are enabled. */ +#define MASK_FIX_R4000 0x00200000 /* Work around R4000 errata. */ +#define MASK_FIX_R4400 0x00400000 /* Work around R4400 errata. */ +#define MASK_FIX_SB1 0x00800000 /* Work around SB-1 errata. */ +#define MASK_FIX_VR4120 0x01000000 /* Work around VR4120 errata. */ +#define MASK_VR4130_ALIGN 0x02000000 /* Perform VR4130 alignment opts. */ +#define MASK_FP_EXCEPTIONS 0x04000000 /* FP exceptions are enabled. */ /* Debug switches, not documented */ #define MASK_DEBUG 0 /* unused */ @@ -178,10 +177,6 @@ extern const struct mips_cpu_info *mips_tune_info; /* Mips vs. GNU linker */ #define TARGET_SPLIT_ADDRESSES ((target_flags & MASK_SPLIT_ADDR) != 0) - /* Mips vs. GNU assembler */ -#define TARGET_GAS ((target_flags & MASK_GAS) != 0) -#define TARGET_MIPS_AS (!TARGET_GAS) - /* Debug Modes */ #define TARGET_DEBUG_MODE ((target_flags & MASK_DEBUG) != 0) #define TARGET_DEBUG_D_MODE ((target_flags & MASK_DEBUG_D) != 0) @@ -271,22 +266,11 @@ extern const struct mips_cpu_info *mips_tune_info; (!TARGET_MIPS16 && (!TARGET_ABICALLS || TARGET_EXPLICIT_RELOCS)) /* True if .gpword or .gpdword should be used for switch tables. - There are some problems with using these directives with the - native IRIX tools: - - - It has been reported that some versions of the native n32 - assembler mishandle .gpword, complaining that symbols are - global when they are in fact local. - - - The native assemblers don't understand .gpdword. - - - Although GAS does understand .gpdword, the native linker - mishandles the relocations GAS generates (R_MIPS_GPREL32 - followed by R_MIPS_64). - We therefore disable GP-relative switch tables for n32 and n64 - on IRIX targets. */ -#define TARGET_GPWORD (TARGET_ABICALLS && !(TARGET_NEWABI && TARGET_IRIX)) + Although GAS does understand .gpdword, the SGI linker mishandles + the relocations GAS generates (R_MIPS_GPREL32 followed by R_MIPS_64). + We therefore disable GP-relative switch tables for n64 on IRIX targets. */ +#define TARGET_GPWORD (TARGET_ABICALLS && !(mips_abi == ABI_64 && TARGET_IRIX)) /* Generate mips16 code */ #define TARGET_MIPS16 ((target_flags & MASK_MIPS16) != 0) @@ -533,10 +517,8 @@ extern const struct mips_cpu_info *mips_tune_info; N_("Optimize lui/addiu address loads")}, \ {"no-split-addresses", -MASK_SPLIT_ADDR, \ N_("Don't optimize lui/addiu address loads")}, \ - {"mips-as", -MASK_GAS, \ - N_("Use MIPS as")}, \ - {"gas", MASK_GAS, \ - N_("Use GNU as")}, \ + {"gas", 0, \ + N_("Use GNU as (now ignored)")}, \ {"gpOPT", 0, \ N_("Use GP relative sdata/sbss sections (now ignored)")}, \ {"gpopt", 0, \ @@ -1004,28 +986,6 @@ extern const struct mips_cpu_info *mips_tune_info; #endif -/* Assembler specs. */ - -/* MIPS_AS_ASM_SPEC is passed when using the MIPS assembler rather - than gas. */ - -#define MIPS_AS_ASM_SPEC "\ -%{!.s:-nocpp} %{.s: %{cpp} %{nocpp}} \ -%{pipe: %e-pipe is not supported} \ -%{K} %(subtarget_mips_as_asm_spec)" - -/* SUBTARGET_MIPS_AS_ASM_SPEC is passed when using the MIPS assembler - rather than gas. It may be overridden by subtargets. */ - -#ifndef SUBTARGET_MIPS_AS_ASM_SPEC -#define SUBTARGET_MIPS_AS_ASM_SPEC "%{v}" -#endif - -/* GAS_ASM_SPEC is passed when using gas, rather than the MIPS - assembler. */ - -#define GAS_ASM_SPEC "%{mtune=*} %{v}" - #define SUBTARGET_TARGET_SWITCHES #ifndef MIPS_ABI_DEFAULT @@ -1036,48 +996,24 @@ extern const struct mips_cpu_info *mips_tune_info; #if MIPS_ABI_DEFAULT == ABI_32 #define MULTILIB_ABI_DEFAULT "mabi=32" -#define ASM_ABI_DEFAULT_SPEC "-32" #endif #if MIPS_ABI_DEFAULT == ABI_O64 #define MULTILIB_ABI_DEFAULT "mabi=o64" -#define ASM_ABI_DEFAULT_SPEC "-mabi=o64" #endif #if MIPS_ABI_DEFAULT == ABI_N32 #define MULTILIB_ABI_DEFAULT "mabi=n32" -#define ASM_ABI_DEFAULT_SPEC "-n32" #endif #if MIPS_ABI_DEFAULT == ABI_64 #define MULTILIB_ABI_DEFAULT "mabi=64" -#define ASM_ABI_DEFAULT_SPEC "-64" #endif #if MIPS_ABI_DEFAULT == ABI_EABI #define MULTILIB_ABI_DEFAULT "mabi=eabi" -#define ASM_ABI_DEFAULT_SPEC "-mabi=eabi" #endif -/* TARGET_ASM_SPEC is used to select either MIPS_AS_ASM_SPEC or - GAS_ASM_SPEC as the default, depending upon the value of - TARGET_DEFAULT. */ - -#if ((TARGET_CPU_DEFAULT | TARGET_DEFAULT) & MASK_GAS) != 0 -/* GAS */ - -#define TARGET_ASM_SPEC "\ -%{mmips-as: %(mips_as_asm_spec)} \ -%{!mmips-as: %(gas_asm_spec)}" - -#else /* not GAS */ - -#define TARGET_ASM_SPEC "\ -%{!mgas: %(mips_as_asm_spec)} \ -%{mgas: %(gas_asm_spec)}" - -#endif /* not GAS */ - /* SUBTARGET_ASM_OPTIMIZING_SPEC handles passing optimization options to the assembler. It may be overridden by subtargets. */ #ifndef SUBTARGET_ASM_OPTIMIZING_SPEC @@ -1087,7 +1023,11 @@ extern const struct mips_cpu_info *mips_tune_info; #endif /* SUBTARGET_ASM_DEBUGGING_SPEC handles passing debugging options to - the assembler. It may be overridden by subtargets. */ + the assembler. It may be overridden by subtargets. + + Beginning with gas 2.13, -mdebug must be passed to correctly handle + COFF debugging info. */ + #ifndef SUBTARGET_ASM_DEBUGGING_SPEC #define SUBTARGET_ASM_DEBUGGING_SPEC "\ %{g} %{g0} %{g1} %{g2} %{g3} \ @@ -1095,19 +1035,9 @@ extern const struct mips_cpu_info *mips_tune_info; %{gstabs:-g} %{gstabs0:-g0} %{gstabs1:-g1} %{gstabs2:-g2} %{gstabs3:-g3} \ %{gstabs+:-g} %{gstabs+0:-g0} %{gstabs+1:-g1} %{gstabs+2:-g2} %{gstabs+3:-g3} \ %{gcoff:-g} %{gcoff0:-g0} %{gcoff1:-g1} %{gcoff2:-g2} %{gcoff3:-g3} \ -%(mdebug_asm_spec)" +%{gcoff*:-mdebug} %{!gcoff*:-no-mdebug}" #endif -/* Beginning with gas 2.13, -mdebug must be passed to correctly handle COFF - debugging info. */ -#if ((TARGET_CPU_DEFAULT | TARGET_DEFAULT) & MASK_GAS) != 0 -/* GAS */ -#define MDEBUG_ASM_SPEC "%{gcoff*:-mdebug} \ - %{!gcoff*:-no-mdebug}" -#else /* not GAS */ -#define MDEBUG_ASM_SPEC "" -#endif /* not GAS */ - /* SUBTARGET_ASM_SPEC is always passed to the assembler. It may be overridden by subtargets. */ @@ -1115,12 +1045,6 @@ extern const struct mips_cpu_info *mips_tune_info; #define SUBTARGET_ASM_SPEC "" #endif -/* ASM_SPEC is the set of arguments to pass to the assembler. Note: we - pass -mgp32, -mgp64, -march, -mabi=eabi and -mabi=o64 regardless of - whether we're using GAS. These options can only be used properly - with GAS, and it is better to get an error from a non-GAS assembler - than to silently generate bad code. */ - #undef ASM_SPEC #define ASM_SPEC "\ %{G*} %(endian_spec) %{mips1} %{mips2} %{mips3} %{mips4} \ @@ -1129,10 +1053,9 @@ extern const struct mips_cpu_info *mips_tune_info; %{mfix-vr4120} \ %(subtarget_asm_optimizing_spec) \ %(subtarget_asm_debugging_spec) \ -%{mabi=32:-32}%{mabi=n32:-n32}%{mabi=64:-64}%{mabi=n64:-64} \ -%{mabi=eabi} %{mabi=o64} %{!mabi*: %(asm_abi_default_spec)} \ +%{mabi=*} %{!mabi*: %(asm_abi_default_spec)} \ %{mgp32} %{mgp64} %{march=*} %{mxgot:-xgot} \ -%(target_asm_spec) \ +%{mtune=*} %{v} \ %(subtarget_asm_spec)" /* Extra switches sometimes passed to the linker. */ @@ -1188,15 +1111,10 @@ extern const struct mips_cpu_info *mips_tune_info; #define EXTRA_SPECS \ { "subtarget_cc1_spec", SUBTARGET_CC1_SPEC }, \ { "subtarget_cpp_spec", SUBTARGET_CPP_SPEC }, \ - { "mips_as_asm_spec", MIPS_AS_ASM_SPEC }, \ - { "gas_asm_spec", GAS_ASM_SPEC }, \ - { "target_asm_spec", TARGET_ASM_SPEC }, \ - { "subtarget_mips_as_asm_spec", SUBTARGET_MIPS_AS_ASM_SPEC }, \ { "subtarget_asm_optimizing_spec", SUBTARGET_ASM_OPTIMIZING_SPEC }, \ { "subtarget_asm_debugging_spec", SUBTARGET_ASM_DEBUGGING_SPEC }, \ - { "mdebug_asm_spec", MDEBUG_ASM_SPEC }, \ { "subtarget_asm_spec", SUBTARGET_ASM_SPEC }, \ - { "asm_abi_default_spec", ASM_ABI_DEFAULT_SPEC }, \ + { "asm_abi_default_spec", "-" MULTILIB_ABI_DEFAULT }, \ { "endian_spec", ENDIAN_SPEC }, \ SUBTARGET_EXTRA_SPECS @@ -1217,15 +1135,6 @@ extern const struct mips_cpu_info *mips_tune_info; /* By default, turn on GDB extensions. */ #define DEFAULT_GDB_EXTENSIONS 1 -/* If we are passing smuggling stabs through the MIPS ECOFF object - format, put a comment in front of the .stab operation so - that the MIPS assembler does not choke. The mips-tfile program - will correctly put the stab into the object file. */ - -#define ASM_STABS_OP ((TARGET_GAS) ? "\t.stabs\t" : " #.stabs\t") -#define ASM_STABN_OP ((TARGET_GAS) ? "\t.stabn\t" : " #.stabn\t") -#define ASM_STABD_OP ((TARGET_GAS) ? "\t.stabd\t" : " #.stabd\t") - /* Local compiler-generated symbols must have a prefix that the assembler understands. By default, this is $, although some targets (e.g., NetBSD-ELF) need to override this. */ @@ -2997,12 +2906,6 @@ do { \ #undef READONLY_DATA_SECTION_ASM_OP #define READONLY_DATA_SECTION_ASM_OP "\t.rdata" /* read-only data */ - -/* Given a decl node or constant node, choose the section to output it in - and select that section. */ - -#undef TARGET_ASM_SELECT_SECTION -#define TARGET_ASM_SELECT_SECTION mips_select_section #define ASM_OUTPUT_REG_PUSH(STREAM,REGNO) \ do \ diff --git a/gcc/config/mips/mips.md b/gcc/config/mips/mips.md index a1226f8d2fc..26ab551b013 100644 --- a/gcc/config/mips/mips.md +++ b/gcc/config/mips/mips.md @@ -376,8 +376,7 @@ { if (ISA_HAS_COND_TRAP) return "teq\t$0,$0"; - /* The IRIX 6 O32 assembler requires the first break operand. */ - else if (TARGET_MIPS16 || !TARGET_GAS) + else if (TARGET_MIPS16) return "break 0"; else return "break"; diff --git a/gcc/config/mips/sdb.h b/gcc/config/mips/sdb.h index c0859c0cecd..4192b71a8d4 100644 --- a/gcc/config/mips/sdb.h +++ b/gcc/config/mips/sdb.h @@ -34,20 +34,6 @@ extern int sdb_label_count; /* Starting line of current function. */ extern int sdb_begin_function_line; -#define PUT_SDB_DEF(a) \ -do { \ - fprintf (asm_out_file, "\t%s.def\t", \ - (TARGET_GAS) ? "" : "#"); \ - ASM_OUTPUT_LABELREF (asm_out_file, a); \ - fputc (';', asm_out_file); \ -} while (0) - -#define PUT_SDB_PLAIN_DEF(a) \ -do { \ - fprintf (asm_out_file, "\t%s.def\t.%s;", \ - (TARGET_GAS) ? "" : "#", (a)); \ -} while (0) - /* For block start and end, we create labels, so that later we can figure out where the correct offset is. The normal .ent/.end serve well enough for functions, @@ -56,10 +42,9 @@ do { \ #define PUT_SDB_BLOCK_START(LINE) \ do { \ fprintf (asm_out_file, \ - "%sLb%d:\n\t%s.begin\t%sLb%d\t%d\n", \ + "%sLb%d:\n\t.begin\t%sLb%d\t%d\n", \ LOCAL_LABEL_PREFIX, \ sdb_label_count, \ - (TARGET_GAS) ? "" : "#", \ LOCAL_LABEL_PREFIX, \ sdb_label_count, \ (LINE)); \ @@ -69,10 +54,9 @@ do { \ #define PUT_SDB_BLOCK_END(LINE) \ do { \ fprintf (asm_out_file, \ - "%sLe%d:\n\t%s.bend\t%sLe%d\t%d\n", \ + "%sLe%d:\n\t.bend\t%sLe%d\t%d\n", \ LOCAL_LABEL_PREFIX, \ sdb_label_count, \ - (TARGET_GAS) ? "" : "#", \ LOCAL_LABEL_PREFIX, \ sdb_label_count, \ (LINE)); \ diff --git a/gcc/config/mips/vxworks.h b/gcc/config/mips/vxworks.h index ed4459829a4..33ca077896e 100644 --- a/gcc/config/mips/vxworks.h +++ b/gcc/config/mips/vxworks.h @@ -45,10 +45,9 @@ Boston, MA 02111-1307, USA. */ %{mips16:%{!mno-mips16:-mips16}} %{mno-mips16:-no-mips16} \ %(subtarget_asm_optimizing_spec) \ %(subtarget_asm_debugging_spec) \ -%{mabi=32:-32}%{mabi=n32:-n32}%{mabi=64:-64}%{mabi=n64:-64} \ -%{mabi=eabi} %{mabi=o64} %{!mabi*: %(asm_abi_default_spec)} \ +%{mabi=*} %{!mabi*: %(asm_abi_default_spec)} \ %{mgp32} %{mgp64} %{march=*} %{mxgot:-xgot} \ -%(target_asm_spec) \ +%{mtune=*} %{v} \ %(subtarget_asm_spec)" #undef LINK_SPEC diff --git a/gcc/config/mips/windiss.h b/gcc/config/mips/windiss.h index 156057f2de7..1ee112c6bcc 100644 --- a/gcc/config/mips/windiss.h +++ b/gcc/config/mips/windiss.h @@ -45,10 +45,9 @@ Boston, MA 02111-1307, USA. */ %{mips16:%{!mno-mips16:-mips16}} %{mno-mips16:-no-mips16} \ %(subtarget_asm_optimizing_spec) \ %(subtarget_asm_debugging_spec) \ -%{mabi=32:-32}%{mabi=n32:-n32}%{mabi=64:-64}%{mabi=n64:-64} \ -%{mabi=eabi} %{mabi=o64} %{!mabi*: %(asm_abi_default_spec)} \ +%{mabi=*} %{!mabi*: %(asm_abi_default_spec)} \ %{mgp32} %{mgp64} %{march=*} %{mxgot:-xgot} \ -%(target_asm_spec) \ +%{mtune=*} %{v} \ %(subtarget_asm_spec)" #undef LINK_SPEC diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 23d0604c2de..d3627a076af 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2004-08-23 Richard Sandiford + + * gcc.dg/special/mips-abi.exp: Expect gcc to pass the GNU ABI flags + to the assembler. Simplify test accordingly. + (asm_abi_flags): Use GNU names. + (check_mips_abi, default_abi): Use string matches against "-mabi=*" + to check for ABI flags. + 2004-08-22 Andrew Pinski * g++.dg/opt/pr14029.C: New test. diff --git a/gcc/testsuite/gcc.dg/special/mips-abi.exp b/gcc/testsuite/gcc.dg/special/mips-abi.exp index a13d2794f36..3c900d7a82e 100644 --- a/gcc/testsuite/gcc.dg/special/mips-abi.exp +++ b/gcc/testsuite/gcc.dg/special/mips-abi.exp @@ -1,4 +1,4 @@ -# Copyright (C) 2002 Free Software Foundation, Inc. +# Copyright (C) 2002, 2004 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -25,9 +25,8 @@ if {![istarget mips*-*-*] || [gcc_target_object_format] != "elf"} { return } -# A list of all assembler ABI flags. We should use SGI-compatible -# flags where possible. -set asm_abi_flags {-32 -n32 -64 -mabi=o64 -mabi=eabi} +# A list of all assembler ABI flags. +set asm_abi_flags {-mabi=32 -mabi=n32 -mabi=64 -mabi=o64 -mabi=eabi} # Try to assemble mips-abi.s (an empty file), passing -v in order to # get the assembler command line. Check whether an appropriate ABI @@ -38,7 +37,7 @@ set asm_abi_flags {-32 -n32 -64 -mabi=o64 -mabi=eabi} # ABI flag is expected. # FLAGS is a list of options for gcc. proc check_mips_abi {name abis flags} { - global srcdir subdir asm_abi_flags + global srcdir subdir lappend flags "-v" set lines [gcc_target_compile "$srcdir/$subdir/mips-abi.s" \ @@ -54,7 +53,7 @@ proc check_mips_abi {name abis flags} { # ABI options. if {[lsearch -exact $abis $arg] >= 0} { incr good - } elseif {[lsearch -exact $asm_abi_flags $arg] >= 0} { + } elseif {[string match "-mabi=*" $arg]} { incr bad } } @@ -83,29 +82,23 @@ if {[board_info $target exists multilib_flags]} { # See whether the default command line specifies an ABI. set default_abi "" foreach flag $default_flags { - if {[string first "-mabi" $flag] == 0} { + if {[string match "-mabi=*" $flag]} { set default_abi $flag } } # If the command line does specify an ABI, just check for the # appropriate assembler flag. -switch -- $default_abi { - -mabi=eabi { check_mips_abi "EABI" "-mabi=eabi" "" } - -mabi=32 { check_mips_abi "o32" "-32" "" } - -mabi=n32 { check_mips_abi "n32" "-n32" "" } - -mabi=o64 { check_mips_abi "o64" "-mabi=o64" "" } - -mabi=64 { check_mips_abi "n64" "-64" "" } - "" { - # An ABI should be passed to the assembler by default. - # It doesn't seem worthwhile to duplicate the - # configuration to ABI logic here, so just accept any ABI. - check_mips_abi "default" $asm_abi_flags "" +if {$default_abi != ""} { + check_mips_abi "command line" $default_abi "" +} else { + # An ABI should be passed to the assembler by default. + # It doesn't seem worthwhile to duplicate the + # configuration to ABI logic here, so just accept any ABI. + check_mips_abi "default" $asm_abi_flags "" - # See whether passing a -mabi flag does the right thing. - # Only try ABIs that the SGI assembler also understands. - check_mips_abi "o32" "-32" "-mabi=32" - check_mips_abi "n32" "-n32" "-mabi=n32" - check_mips_abi "64" "-64" "-mabi=64" + # See whether passing a -mabi flag does the right thing. + foreach abi $asm_abi_flags { + check_mips_abi $abi $abi $abi } } -- 2.30.2