The new mips gas breaks gcc 2.96
H. J. Lu
hjl@lucon.org
Fri Aug 2 09:01:00 GMT 2002
On Fri, Aug 02, 2002 at 10:55:34AM +0200, Johannes Stezenbach wrote:
> On Thu, Aug 01, 2002 at 07:39:04PM -0700, H. J. Lu wrote:
> > + case OPTION_MCPU:
> > + if (mips_tune_string == 0 && mips_tune_string == 0)
>
> This doesn't look right.
Here is the new one.
H.J.
-------------- next part --------------
2002-08-02 H.J. Lu <hjl@gnu.org>
* config/tc-mips.c (OPTION_MCPU): Put it back.
(md_parse_option): Handle OPTION_MCPU.
(mips_after_parse_args): Check -mcpu.
2002-07-26 H.J. Lu <hjl@gnu.org>
* config/tc-mips.c (mips_after_parse_args): Updated.
2002-04-04 H.J. Lu <hjl@gnu.org>
* elf32-mips.c: Move all changes to ...
* elfxx-mips.c: Here.
2001-10-26 H.J. Lu <hjl@gnu.org>
* elf32-mips.c: Include "opcode/mips.h".
(bfd_mips_elf_set_isa): New function. Set the EF_MIPS_ARCH
field in the ELF header.
(_bfd_mips_elf_final_write_processing): Set the EF_MIPS_ARCH
field only if it is unset.
2002-06-06 H.J. Lu <hjl@gnu.org>
* config/tc-mips.c (mips_after_parse_args): Check if -march is
compatible with -mipsN.
(md_begin): Call bfd_mips_elf_set_isa to set ISA in the ELF
header for ELF.
2001-10-26 H.J. Lu <hjl@gnu.org>
* mips.h (bfd_mips_elf_set_isa): New prototype.
--- binutils/bfd/elfxx-mips.c.mips Fri Aug 2 08:29:05 2002
+++ binutils/bfd/elfxx-mips.c Fri Aug 2 08:29:13 2002
@@ -33,6 +33,7 @@ Foundation, Inc., 59 Temple Place - Suit
#include "elf-bfd.h"
#include "elfxx-mips.h"
#include "elf/mips.h"
+#include "opcode/mips.h"
/* Get the ECOFF swapping routines. */
#include "coff/sym.h"
@@ -5882,6 +5883,55 @@ _bfd_mips_elf_finish_dynamic_sections (o
return true;
}
+/* Set MIPS ISA in the ELF header. */
+boolean
+bfd_mips_elf_set_isa (abfd, isa)
+ bfd *abfd;
+ int isa;
+{
+ unsigned long val;
+
+ switch (isa)
+ {
+ default:
+ return false;
+ break;
+
+ case ISA_MIPS1:
+ val = E_MIPS_ARCH_1;
+ break;
+
+ case ISA_MIPS2:
+ val = E_MIPS_ARCH_2;
+ break;
+
+ case ISA_MIPS3:
+ val = E_MIPS_ARCH_3;
+ break;
+
+ case ISA_MIPS4:
+ val = E_MIPS_ARCH_4;
+ break;
+
+ case ISA_MIPS5:
+ val = E_MIPS_ARCH_5;
+ break;
+
+ case ISA_MIPS32:
+ val = E_MIPS_ARCH_32;
+ break;
+
+ case ISA_MIPS64:
+ val = E_MIPS_ARCH_64;
+ break;
+ }
+
+ elf_elfheader (abfd)->e_flags &= ~EF_MIPS_ARCH;
+ elf_elfheader (abfd)->e_flags |= val;
+
+ return true;
+}
+
/* The final processing done just before writing out a MIPS ELF object
file. This gets the MIPS architecture right based on the machine
number. This is used by both the 32-bit and the 64-bit ABI. */
@@ -5891,75 +5941,92 @@ _bfd_mips_elf_final_write_processing (ab
bfd *abfd;
boolean linker ATTRIBUTE_UNUSED;
{
- unsigned long val;
+ unsigned long isa, cpu;
unsigned int i;
Elf_Internal_Shdr **hdrpp;
const char *name;
asection *sec;
+ isa = 0;
+ cpu = 0;
switch (bfd_get_mach (abfd))
{
default:
case bfd_mach_mips3000:
- val = E_MIPS_ARCH_1;
+ isa = E_MIPS_ARCH_1;
break;
case bfd_mach_mips3900:
- val = E_MIPS_ARCH_1 | E_MIPS_MACH_3900;
+ isa = E_MIPS_ARCH_1;
+ cpu = E_MIPS_MACH_3900;
break;
case bfd_mach_mips6000:
- val = E_MIPS_ARCH_2;
+ isa = E_MIPS_ARCH_2;
break;
case bfd_mach_mips4000:
case bfd_mach_mips4300:
case bfd_mach_mips4400:
case bfd_mach_mips4600:
- val = E_MIPS_ARCH_3;
+ isa = E_MIPS_ARCH_3;
break;
case bfd_mach_mips4010:
- val = E_MIPS_ARCH_3 | E_MIPS_MACH_4010;
+ isa = E_MIPS_ARCH_3;
+ cpu = E_MIPS_MACH_4010;
break;
case bfd_mach_mips4100:
- val = E_MIPS_ARCH_3 | E_MIPS_MACH_4100;
+ isa = E_MIPS_ARCH_3;
+ cpu = E_MIPS_MACH_4100;
break;
case bfd_mach_mips4111:
- val = E_MIPS_ARCH_3 | E_MIPS_MACH_4111;
+ isa = E_MIPS_ARCH_3;
+ cpu = E_MIPS_MACH_4111;
break;
case bfd_mach_mips4650:
- val = E_MIPS_ARCH_3 | E_MIPS_MACH_4650;
+ isa = E_MIPS_ARCH_3;
+ cpu = E_MIPS_MACH_4650;
break;
case bfd_mach_mips5000:
case bfd_mach_mips8000:
case bfd_mach_mips10000:
case bfd_mach_mips12000:
- val = E_MIPS_ARCH_4;
+ isa = E_MIPS_ARCH_4;
break;
case bfd_mach_mips5:
- val = E_MIPS_ARCH_5;
+ isa = E_MIPS_ARCH_5;
break;
case bfd_mach_mips_sb1:
- val = E_MIPS_ARCH_64 | E_MIPS_MACH_SB1;
+ isa = E_MIPS_ARCH_64;
+ cpu = E_MIPS_MACH_SB1;
break;
case bfd_mach_mipsisa32:
- val = E_MIPS_ARCH_32;
+ isa = E_MIPS_ARCH_32;
break;
case bfd_mach_mipsisa64:
- val = E_MIPS_ARCH_64;
+ isa = E_MIPS_ARCH_64;
}
- elf_elfheader (abfd)->e_flags &= ~(EF_MIPS_ARCH | EF_MIPS_MACH);
- elf_elfheader (abfd)->e_flags |= val;
+ if (isa != 0 && (elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH) == 0)
+ {
+ elf_elfheader (abfd)->e_flags &= ~EF_MIPS_ARCH;
+ elf_elfheader (abfd)->e_flags |= isa;
+ }
+
+ if (cpu != 0)
+ {
+ elf_elfheader (abfd)->e_flags &= ~EF_MIPS_MACH;
+ elf_elfheader (abfd)->e_flags |= cpu;
+ }
/* Set the sh_info field for .gptab sections and other appropriate
info for each special section. */
--- binutils/gas/config/tc-mips.c.mips Fri Aug 2 08:29:05 2002
+++ binutils/gas/config/tc-mips.c Fri Aug 2 08:37:21 2002
@@ -226,6 +226,11 @@ static int mips_tune = CPU_UNKNOWN;
static const char *mips_tune_string;
static const struct mips_cpu_info *mips_tune_info;
+/* The deprecated -mcpu option. */
+#define SEEN_OPTION_MCPU 0x1
+#define SEEN_OPTION_MARCH_MTUNE 0x2
+static int seen_mips_cpu_arch_tune = 0;
+
/* True when generating 32-bit code for a 64-bit processor. */
static int mips_32bitmode = 0;
@@ -1029,6 +1034,12 @@ md_begin ()
if (! bfd_set_arch_mach (stdoutput, bfd_arch_mips, mips_arch))
as_warn (_("Could not set architecture and machine"));
+#if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)
+ if (OUTPUT_FLAVOR == bfd_target_elf_flavour
+ && ! bfd_mips_elf_set_isa (stdoutput, mips_opts.isa))
+ as_warn (_("Could not set architecture"));
+#endif
+
op_hash = hash_new ();
for (i = 0; i < NUMOPCODES;)
@@ -9927,6 +9938,9 @@ struct option md_longopts[] =
#define OPTION_NO_MDEBUG (OPTION_ELF_BASE + 8)
{"no-mdebug", no_argument, NULL, OPTION_NO_MDEBUG},
#endif /* OBJ_ELF */
+/* Pray it is large enough so that it won't conflict with others. */
+#define OPTION_MCPU (OPTION_MD_BASE + 0x7000000)
+ {"mcpu", required_argument, NULL, OPTION_MCPU},
{NULL, no_argument, NULL, 0}
};
size_t md_longopts_size = sizeof (md_longopts);
@@ -10032,10 +10046,18 @@ md_parse_option (c, arg)
break;
case OPTION_MTUNE:
+ seen_mips_cpu_arch_tune |= SEEN_OPTION_MARCH_MTUNE;
mips_set_option_string (&mips_tune_string, arg);
break;
case OPTION_MARCH:
+ seen_mips_cpu_arch_tune |= SEEN_OPTION_MARCH_MTUNE;
+ mips_set_option_string (&mips_arch_string, arg);
+ break;
+
+ case OPTION_MCPU:
+ seen_mips_cpu_arch_tune |= SEEN_OPTION_MCPU;
+ mips_set_option_string (&mips_tune_string, arg);
mips_set_option_string (&mips_arch_string, arg);
break;
@@ -10296,6 +10318,14 @@ mips_set_tune (info)
void
mips_after_parse_args ()
{
+ if (seen_mips_cpu_arch_tune
+ == (SEEN_OPTION_MCPU | SEEN_OPTION_MARCH_MTUNE))
+ as_fatal (_("The -mcpu option is deprecated. Please use "
+ "-march and -mtune instead."));
+ else if (seen_mips_cpu_arch_tune == SEEN_OPTION_MCPU)
+ as_warn (_("The -mcpu option is deprecated. Please use "
+ "-march and -mtune instead."));
+
/* GP relative stuff not working for PE */
if (strncmp (TARGET_OS, "pe", 2) == 0
&& g_switch_value != 0)
--- binutils/include/elf/mips.h.mips Fri Aug 2 08:29:05 2002
+++ binutils/include/elf/mips.h Fri Aug 2 08:29:13 2002
@@ -817,6 +817,9 @@ extern void bfd_mips_elf_swap_options_in
extern void bfd_mips_elf_swap_options_out
PARAMS ((bfd *, const Elf_Internal_Options *, Elf_External_Options *));
+/* Set MIPS ISA in the ELF header. */
+extern boolean bfd_mips_elf_set_isa PARAMS ((bfd *, int));
+
/* Values which may appear in the kind field of an Elf_Options
structure. */
More information about the Binutils
mailing list