Steve Ellcey <sell...@mips.com> writes:
> On Sun, 2012-09-16 at 09:22 +0100, Richard Sandiford wrote:
>
>> > +/* This is idential to sde.h except for the ABI setting which defaults
>> > +   to 32 instead of n32 on 32 bit architectures and the addition of
>> > +   MIPS_ISA_SYNCI_SPEC.  */
>> 
>> SDE defaults to o32 (-mabi=32) for 32-bit targets and n32 for 64-bit targets.
>> I think that's what you'd want here too, otherwise the mips64 multilibs
>> are really no different from the mips32 ones.
>
> I am a bit confused about this.  It looks like the current
> mips-*-linux-gnu targets default to o32 when compiled for 64-bit targets
> but the mips-sde-elf target defaults to n32 when compiled for 64-bit
> targets.  I am not sure which default makes more sense but it seems odd
> that the two targets have different defaults for the same architecture.
> Do you know how the current state of affairs came to be with respect to
> this difference in defaults?

It's a hosted vs. embedded thing.  Hosted targets like *-linux-gnu have
dynamic ABI requirements and so are keyed off an ABI rather than an
architecture.  The only effect of -march= and --with-arch= should be to
extend the choice of available instructions.

That was actually very useful in pre MIPS(isa)32 and MIPS(isa)64 days,
because MIPS IV had ISA extensions that could be used in 32-bit as well
as 64-bit code.  You could therefore use the MIPS IV extensions with an
existing 32-bit MIPS I or MIPS II sysroot.  The same sort of thing applied
to processor-specific extensions in 64-bit processors (of which there were
many :-)).  It's less useful with the stock MIPS32 and MIPS64 ISAs because
the 32-bit subset of MIPS64 is (by design) essentially MIPS32.

In a hosted environment, if you want a 64-bit toolchain, you need
to use a 64-bit target like mips64-linux-gnu or mipsisa64-linux-gnu.
(Or configure mips-*-linux-gnu with --enable-targets=all and be
prepared to use -mabi=n32.)

In contrast, embedded *-elf targets have only static ABI requirements,
and the runtime libraries are usually built as part of the toolchain.
It's therefore convenient for -march= to select the "best" ABI for
the architecture.

Richard

Reply via email to