以下是摘自binutils中gas的mips后端文件tc-mips.c, 定义了mips的目标格式
/* 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;
}
}
可以看出,gas中支持的格式包括大小端的,传统、非传统的,旧的、新的,32位、64位的。
主要区别可以参考以下的转贴,
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.
Traditional mips is the flavour used before SGI went ahead and screwed
it up. :-)
关于o32,n32,n64, 《see mips run》上有一些详细的介绍。在linux上安装mips-linux,
默认的目标格式是elf32-tradbigmips。安装mips-elf时的默认目标格式是elf32-bigmips。
mips-linux和mips-elf的主要区别之一,个人认为,在于mips-linux默认生成为SVR4_PIC
格式的位置独立代码文件。mips-elf是No_PIC的。在配置gcc为--target=mips-elf时,是不
会生成共享的libgcc的。
|