This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: RFC: Mips option parsing patch
On Mon, Nov 26, 2001 at 03:58:41PM -0800, Eric Christopher wrote:
> On Mon, 2001-11-26 at 11:58, Daniel Jacobowitz wrote:
> > I have the feeling this may not be popular... Eric, Thiemo, comments
> > welcome.
> >
>
> It wasn't :)
>
> Daniel and I have come up with another solution and he'll be submitting
> it when he can get to it :)
Consider it done.
Binaries built with -march=r8000 -mips2 are now marked:
Flags: 0x30000100, mips4 UNKNOWN
The mips4 marking is wrong, but that's a BFD bug - it sets mips_arch
unconditionally ignoring what GAS may have set. The UNKNOWN is a
readelf bug, and actually E_MIPS_32BITMODE - perfect.
OK?
--
Daniel Jacobowitz Carnegie Mellon University
MontaVista Software Debian GNU/Linux Developer
2001-11-27 Daniel Jacobowitz <drow@mvista.com>
* tc-mips.c (file_mips_gp32): Initialize to -1.
(file_mips_fp32): Likewise.
(md_begin): If an incompatible mips_opts.isa is specified,
use it to default fp32 and gp32 appropriately. If nothing is
specified default both to 0.
Index: tc-mips.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-mips.c,v
retrieving revision 1.97
diff -u -p -r1.97 tc-mips.c
--- tc-mips.c 2001/11/21 11:24:13 1.97
+++ tc-mips.c 2001/11/27 16:26:12
@@ -174,10 +174,10 @@ struct mips_set_options
};
/* True if -mgp32 was passed. */
-static int file_mips_gp32 = 0;
+static int file_mips_gp32 = -1;
/* True if -mfp32 was passed. */
-static int file_mips_fp32 = 0;
+static int file_mips_fp32 = -1;
/* This is the struct we use to hold the current set of options. Note
that we must set the isa field to ISA_UNKNOWN and the mips16 field to
@@ -1077,6 +1077,37 @@ md_begin ()
assert (ci != NULL);
if (mips_opts.isa != ci->isa)
{
+#if 1
+ /* This code should go away, to be replaced with the block below it.
+ Until GCC 3.1 has been released for some reasonable amount of time,
+ however, we need to support this. */
+ /* Translate -mipsN to the appropriate settings of file_mips_gp32
+ and file_mips_fp32. Tag binaries as using the mipsN ISA. */
+ if (file_mips_gp32 < 0)
+ {
+ if (ISA_HAS_64BIT_REGS (mips_opts.isa))
+ file_mips_gp32 = 0;
+ else
+ file_mips_gp32 = 1;
+ }
+ if (file_mips_fp32 < 0)
+ {
+ if (ISA_HAS_64BIT_REGS (mips_opts.isa))
+ file_mips_fp32 = 0;
+ else
+ file_mips_fp32 = 1;
+ }
+ if (ISA_HAS_64BIT_REGS (mips_opts.isa))
+ {
+ if (mips_opts.abi == O32_ABI)
+ mips_opts.abi = NO_ABI;
+ }
+ else
+ {
+ if (mips_opts.abi != O32_ABI)
+ mips_opts.abi = NO_ABI;
+ }
+#else
/* This really should be an error instead of a warning, but old
compilers only have -mcpu which sets both arch and tune. For
now, we discard arch and preserve tune. */
@@ -1087,6 +1118,7 @@ md_begin ()
ci = mips_cpu_info_from_isa (mips_opts.isa);
assert (ci != NULL);
mips_arch = ci->cpu;
+#endif
}
}
else if (mips_arch != CPU_UNKNOWN && mips_opts.isa == ISA_UNKNOWN)
@@ -1149,6 +1181,11 @@ md_begin ()
if (! bfd_set_arch_mach (stdoutput, bfd_arch_mips, mips_arch))
as_warn (_("Could not set architecture and machine"));
+
+ if (file_mips_gp32 < 0)
+ file_mips_gp32 = 0;
+ if (file_mips_fp32 < 0)
+ file_mips_fp32 = 0;
file_mips_isa = mips_opts.isa;
file_mips_abi = mips_opts.abi;