Discussion:
really confused by mips target formats
Eric Fisher
2006-02-28 03:03:33 UTC
Permalink
Hi,
I really need your help. I'm confused by mips target formats. Here is
the function from tc-mips.c.

/* The default target format to use. */

const char *
mips_target_format ()
{
switch (OUTPUT_FLAVOR)
{
case bfd_target_aout_flavour:
return target_big_endian ? "a.out-mips-big" : "a.out-mips-little";
case bfd_target_ecoff_flavour:
return target_big_endian ? "ecoff-bigmips" : ECOFF_LITTLE_FORMAT;
case bfd_target_coff_flavour:
return "pe-mips";
case bfd_target_elf_flavour:
#ifdef TE_TMIPS
/* This is traditional mips. */
return (target_big_endian
? (HAVE_64BIT_OBJECTS
? "elf64-tradbigmips"
: (HAVE_NEWABI
? "elf32-ntradbigmips" : "elf32-tradbigmips"))
: (HAVE_64BIT_OBJECTS
? "elf64-tradlittlemips"
: (HAVE_NEWABI
? "elf32-ntradlittlemips" : "elf32-tradlittlemips")));
#else
return (target_big_endian
? (HAVE_64BIT_OBJECTS
? "elf64-bigmips"
: (HAVE_NEWABI
? "elf32-nbigmips" : "elf32-bigmips"))
: (HAVE_64BIT_OBJECTS
? "elf64-littlemips"
: (HAVE_NEWABI
? "elf32-nlittlemips" : "elf32-littlemips")));
#endif
default:
abort ();
return NULL;
}
}

Let's just talk about elf flavour. What are the traditional mips,
non-traditional mips and newabi? Why do both traditional mips and
non-traditional mips contain newabi?

Why does the object file assembled by mips-linux-as have elf32-tradbigmips
format? While one by mips-elf-as has elf32-bigmips?

Thanks.
Eric.
Maciej W. Rozycki
2006-02-28 12:50:50 UTC
Permalink
Post by Eric Fisher
Let's just talk about elf flavour. What are the traditional mips,
non-traditional mips and newabi? Why do both traditional mips and
non-traditional mips contain newabi?
The existence of the traditional and non-traditional targets results from
a few subtle differences in how files are generated depending on whether
they are to be as defined by the generic ELF specification or the SGI
variation in areas that are not really processor specific. Most notably
the definition of what constitutes a local symbol which may affect the
order of symbols in symbol tables.

The old ABI (o32) vs new ABIs (n32, n64) difference is independent from
the above and results from different register sizes, calling conventions,
etc.
Post by Eric Fisher
Why does the object file assembled by mips-linux-as have elf32-tradbigmips
format? While one by mips-elf-as has elf32-bigmips?
It depends on the default emulation as configured when it was built.
Unfortunately it does not seem to be possible to select another BFD target
for gas. Possible workarounds include running `ld -r' or `objcopy' on the
object file, but as most likely completely untested these might not work
due to bugs either.

Maciej
Thiemo Seufer
2006-02-28 13:34:32 UTC
Permalink
On Tue, Feb 28, 2006 at 11:03:33AM +0800, Eric Fisher wrote:
[snip]
Post by Eric Fisher
Let's just talk about elf flavour. What are the traditional mips,
non-traditional mips and newabi? Why do both traditional mips and
non-traditional mips contain newabi?
Traditional mips is the flavour used before SGI went ahead and screwed
it up. :-)
Post by Eric Fisher
Why does the object file assembled by mips-linux-as have elf32-tradbigmips
format? While one by mips-elf-as has elf32-bigmips?
At one point, the SGI-ish flavour was used for both. For a linux
userland with its dynamic libraries the traditional format seemed to
be more sensible (and more in line with other ELF implementations).
For mips-elf embedded systems, the backward compatibility argument
had more weight, they continued to use SGI-ish objects.


Thiemo
Eric Fisher
2006-03-01 01:20:35 UTC
Permalink
I know o32, n32 and n64. But the thing puzzled me is that both
traditional and non-traditional have old and new abi. Then we got four
targets: trad+old, trad+new, nontrad+old, nontrad+new. ah-oh :<
Post by Thiemo Seufer
[snip]
Post by Eric Fisher
Let's just talk about elf flavour. What are the traditional mips,
non-traditional mips and newabi? Why do both traditional mips and
non-traditional mips contain newabi?
Traditional mips is the flavour used before SGI went ahead and screwed
it up. :-)
Post by Eric Fisher
Why does the object file assembled by mips-linux-as have elf32-tradbigmips
format? While one by mips-elf-as has elf32-bigmips?
At one point, the SGI-ish flavour was used for both. For a linux
userland with its dynamic libraries the traditional format seemed to
be more sensible (and more in line with other ELF implementations).
For mips-elf embedded systems, the backward compatibility argument
had more weight, they continued to use SGI-ish objects.
Thiemo
Maciej W. Rozycki
2006-03-01 12:50:16 UTC
Permalink
Post by Eric Fisher
I know o32, n32 and n64. But the thing puzzled me is that both
traditional and non-traditional have old and new abi. Then we got four
targets: trad+old, trad+new, nontrad+old, nontrad+new. ah-oh :<
Six, actually. And add another half a dozen for the other endianness.
;-)

Maciej

Loading...