This adds ABI flags to MIPS/ELF object files.
For bfd: * elf32-mips.c (elf_mips_abi_name): New. (_bfd_mips_elf_merge_private_bfd_data): Compare EF_MIPS_ABI flags. For gas: * config/tc-mips.c (mips_abi_string): New. (md_parse_option,md_longopts): Add mabi. (mips_elf_final_processing): Set e_flags based on mabi flag. For gcc: * config/mips/mips.h (GAS_ASM_SPEC): Pass mabi to gas. (ABI_GAS_ASM_SPEC,abi_gas_asm_spec): New. (EXTRA_SPECS): Added ABI_GAS_ASM_SPEC,abi_gas_asm_spec. For include/elf: * mips.h (EF_MIPS_ABI,E_MIPS_ABI_O32,E_MIPS_ABI_O64, E_MIPS_ABI_EABI32,E_MIPS_ABI_EABI64):
This commit is contained in:
parent
759181e384
commit
02650bd0a9
|
@ -1,3 +1,8 @@
|
||||||
|
1998-12-15 Gavin Romig-Koch <gavin@cygnus.com>
|
||||||
|
|
||||||
|
* elf32-mips.c (elf_mips_abi_name): New.
|
||||||
|
(_bfd_mips_elf_merge_private_bfd_data): Compare EF_MIPS_ABI flags.
|
||||||
|
|
||||||
start-sanitize-vr4xxx
|
start-sanitize-vr4xxx
|
||||||
1998-12-13 Gavin Romig-Koch <gavin@cygnus.com>
|
1998-12-13 Gavin Romig-Koch <gavin@cygnus.com>
|
||||||
|
|
||||||
|
|
|
@ -60,6 +60,7 @@ static int mips_elf_additional_program_headers PARAMS ((bfd *));
|
||||||
static boolean mips_elf_modify_segment_map PARAMS ((bfd *));
|
static boolean mips_elf_modify_segment_map PARAMS ((bfd *));
|
||||||
static INLINE int elf_mips_isa PARAMS ((flagword));
|
static INLINE int elf_mips_isa PARAMS ((flagword));
|
||||||
static INLINE int elf_mips_mach PARAMS ((flagword));
|
static INLINE int elf_mips_mach PARAMS ((flagword));
|
||||||
|
static INLINE char* elf_mips_abi_name PARAMS ((flagword));
|
||||||
static boolean mips_elf32_section_from_shdr
|
static boolean mips_elf32_section_from_shdr
|
||||||
PARAMS ((bfd *, Elf32_Internal_Shdr *, char *));
|
PARAMS ((bfd *, Elf32_Internal_Shdr *, char *));
|
||||||
static boolean mips_elf32_section_processing
|
static boolean mips_elf32_section_processing
|
||||||
|
@ -1716,6 +1717,29 @@ elf_mips_mach (flags)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Return printable name for ABI from flagword. */
|
||||||
|
|
||||||
|
static INLINE char*
|
||||||
|
elf_mips_abi_name (flags)
|
||||||
|
flagword flags;
|
||||||
|
{
|
||||||
|
switch (flags & EF_MIPS_ABI)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
return "none";
|
||||||
|
case E_MIPS_ABI_O32:
|
||||||
|
return "O32";
|
||||||
|
case E_MIPS_ABI_O64:
|
||||||
|
return "O64";
|
||||||
|
case E_MIPS_ABI_EABI32:
|
||||||
|
return "EABI32";
|
||||||
|
case E_MIPS_ABI_EABI64:
|
||||||
|
return "EABI64";
|
||||||
|
default:
|
||||||
|
return "unknown abi";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* A mapping from BFD reloc types to MIPS ELF reloc types. */
|
/* A mapping from BFD reloc types to MIPS ELF reloc types. */
|
||||||
|
|
||||||
struct elf_reloc_map {
|
struct elf_reloc_map {
|
||||||
|
@ -2388,6 +2412,24 @@ _bfd_mips_elf_merge_private_bfd_data (ibfd, obfd)
|
||||||
old_flags &= ~ (EF_MIPS_ARCH | EF_MIPS_MACH);
|
old_flags &= ~ (EF_MIPS_ARCH | EF_MIPS_MACH);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Compare ABI's */
|
||||||
|
if ((new_flags & EF_MIPS_ABI) != (old_flags & EF_MIPS_ABI))
|
||||||
|
{
|
||||||
|
/* Only error if both are set (to different values). */
|
||||||
|
if ((new_flags & EF_MIPS_ABI)
|
||||||
|
&& (old_flags & EF_MIPS_ABI))
|
||||||
|
{
|
||||||
|
(*_bfd_error_handler)
|
||||||
|
(_("%s: ABI mismatch: linking %s module with previous %s modules"),
|
||||||
|
bfd_get_filename (ibfd),
|
||||||
|
elf_mips_abi_name (new_flags),
|
||||||
|
elf_mips_abi_name (old_flags));
|
||||||
|
ok = false;
|
||||||
|
}
|
||||||
|
new_flags &= ~EF_MIPS_ABI;
|
||||||
|
old_flags &= ~EF_MIPS_ABI;
|
||||||
|
}
|
||||||
|
|
||||||
/* Warn about any other mismatches */
|
/* Warn about any other mismatches */
|
||||||
if (new_flags != old_flags)
|
if (new_flags != old_flags)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
1998-12-15 Gavin Romig-Koch <gavin@cygnus.com>
|
||||||
|
|
||||||
|
* config/tc-mips.c (mips_abi_string): New.
|
||||||
|
(md_parse_option,md_longopts): Add mabi.
|
||||||
|
(mips_elf_final_processing): Set e_flags based on mabi flag.
|
||||||
|
|
||||||
start-sanitize-vr4xxx
|
start-sanitize-vr4xxx
|
||||||
1998-12-15 Gavin Romig-Koch <gavin@cygnus.com>
|
1998-12-15 Gavin Romig-Koch <gavin@cygnus.com>
|
||||||
|
|
||||||
|
|
|
@ -198,6 +198,9 @@ static int file_mips_isa;
|
||||||
/* The CPU type as a number: 2000, 3000, 4000, 4400, etc. */
|
/* The CPU type as a number: 2000, 3000, 4000, 4400, etc. */
|
||||||
static int mips_cpu = -1;
|
static int mips_cpu = -1;
|
||||||
|
|
||||||
|
/* The argument of the -mabi= flag. */
|
||||||
|
static char* mips_abi_string = 0;
|
||||||
|
|
||||||
/* Whether the 4650 instructions (mad/madu) are permitted. */
|
/* Whether the 4650 instructions (mad/madu) are permitted. */
|
||||||
static int mips_4650 = -1;
|
static int mips_4650 = -1;
|
||||||
|
|
||||||
|
@ -9449,8 +9452,8 @@ struct option md_longopts[] = {
|
||||||
{"fix-4011-branch-bug", no_argument, NULL, OPTION_FIX_4011_BRANCH_BUG},
|
{"fix-4011-branch-bug", no_argument, NULL, OPTION_FIX_4011_BRANCH_BUG},
|
||||||
#define OPTION_NO_FIX_4011_BRANCH_BUG (OPTION_MD_BASE + 35)
|
#define OPTION_NO_FIX_4011_BRANCH_BUG (OPTION_MD_BASE + 35)
|
||||||
{"no-fix-4011-branch-bug", no_argument, NULL, OPTION_NO_FIX_4011_BRANCH_BUG},
|
{"no-fix-4011-branch-bug", no_argument, NULL, OPTION_NO_FIX_4011_BRANCH_BUG},
|
||||||
/* end-sanitize-branchbug4011 */
|
|
||||||
|
|
||||||
|
/* end-sanitize-branchbug4011 */
|
||||||
/* start-sanitize-vr4xxx */
|
/* start-sanitize-vr4xxx */
|
||||||
#define OPTION_M4121 (OPTION_MD_BASE + 36)
|
#define OPTION_M4121 (OPTION_MD_BASE + 36)
|
||||||
{"m4121", no_argument, NULL, OPTION_M4121},
|
{"m4121", no_argument, NULL, OPTION_M4121},
|
||||||
|
@ -9458,6 +9461,9 @@ struct option md_longopts[] = {
|
||||||
{"no-m4121", no_argument, NULL, OPTION_NO_M4121},
|
{"no-m4121", no_argument, NULL, OPTION_NO_M4121},
|
||||||
|
|
||||||
/* end-sanitize-vr4xxx */
|
/* end-sanitize-vr4xxx */
|
||||||
|
#define OPTION_MABI (OPTION_MD_BASE + 38)
|
||||||
|
{"mabi", required_argument, NULL, OPTION_MABI},
|
||||||
|
|
||||||
#define OPTION_CALL_SHARED (OPTION_MD_BASE + 7)
|
#define OPTION_CALL_SHARED (OPTION_MD_BASE + 7)
|
||||||
#define OPTION_NON_SHARED (OPTION_MD_BASE + 8)
|
#define OPTION_NON_SHARED (OPTION_MD_BASE + 8)
|
||||||
#define OPTION_XGOT (OPTION_MD_BASE + 19)
|
#define OPTION_XGOT (OPTION_MD_BASE + 19)
|
||||||
|
@ -9868,6 +9874,16 @@ md_parse_option (c, arg)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* end-sanitize-branchbug4011 */
|
/* end-sanitize-branchbug4011 */
|
||||||
|
|
||||||
|
case OPTION_MABI:
|
||||||
|
if (strcmp (arg,"32") == 0
|
||||||
|
|| strcmp (arg,"n32") == 0
|
||||||
|
|| strcmp (arg,"64") == 0
|
||||||
|
|| strcmp (arg,"o64") == 0
|
||||||
|
|| strcmp (arg,"eabi") == 0)
|
||||||
|
mips_abi_string = arg;
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -12066,6 +12082,21 @@ mips_elf_final_processing ()
|
||||||
elf_elfheader (stdoutput)->e_flags |= EF_MIPS_NOREORDER;
|
elf_elfheader (stdoutput)->e_flags |= EF_MIPS_NOREORDER;
|
||||||
if (mips_pic != NO_PIC)
|
if (mips_pic != NO_PIC)
|
||||||
elf_elfheader (stdoutput)->e_flags |= EF_MIPS_PIC;
|
elf_elfheader (stdoutput)->e_flags |= EF_MIPS_PIC;
|
||||||
|
|
||||||
|
/* Set the MIPS ELF ABI flags. */
|
||||||
|
if (mips_abi_string == 0)
|
||||||
|
;
|
||||||
|
else if (strcmp (mips_abi_string,"32") == 0)
|
||||||
|
elf_elfheader (stdoutput)->e_flags |= E_MIPS_ABI_O32;
|
||||||
|
else if (strcmp (mips_abi_string,"o64") == 0)
|
||||||
|
elf_elfheader (stdoutput)->e_flags |= E_MIPS_ABI_O64;
|
||||||
|
else if (strcmp (mips_abi_string,"eabi") == 0)
|
||||||
|
{
|
||||||
|
if (mips_opts.isa > 2)
|
||||||
|
elf_elfheader (stdoutput)->e_flags |= E_MIPS_ABI_EABI32;
|
||||||
|
else
|
||||||
|
elf_elfheader (stdoutput)->e_flags |= E_MIPS_ABI_EABI64;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* OBJ_ELF || OBJ_MAYBE_ELF */
|
#endif /* OBJ_ELF || OBJ_MAYBE_ELF */
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
1998-12-15 Gavin Romig-Koch <gavin@cygnus.com>
|
||||||
|
|
||||||
|
* mips.h (EF_MIPS_ABI,E_MIPS_ABI_O32,E_MIPS_ABI_O64,
|
||||||
|
E_MIPS_ABI_EABI32,E_MIPS_ABI_EABI64):
|
||||||
|
|
||||||
start-sanitize-vr4xxx
|
start-sanitize-vr4xxx
|
||||||
1998-12-13 Gavin Romig-Koch <gavin@cygnus.com>
|
1998-12-13 Gavin Romig-Koch <gavin@cygnus.com>
|
||||||
|
|
||||||
|
|
|
@ -121,6 +121,22 @@ END_RELOC_NUMBERS
|
||||||
/* -mips4 code. */
|
/* -mips4 code. */
|
||||||
#define E_MIPS_ARCH_4 0x30000000
|
#define E_MIPS_ARCH_4 0x30000000
|
||||||
|
|
||||||
|
/* The ABI of the file. Also see EF_MIPS_ABI2 above. */
|
||||||
|
#define EF_MIPS_ABI 0x0000F000
|
||||||
|
|
||||||
|
/* The original o32 abi. */
|
||||||
|
#define E_MIPS_ABI_O32 0x00001000
|
||||||
|
|
||||||
|
/* O32 extended to work on 64 bit architectures */
|
||||||
|
#define E_MIPS_ABI_O64 0x00002000
|
||||||
|
|
||||||
|
/* EABI in 32 bit mode */
|
||||||
|
#define E_MIPS_ABI_EABI32 0x00003000
|
||||||
|
|
||||||
|
/* EABI in 64 bit mode */
|
||||||
|
#define E_MIPS_ABI_EABI64 0x00004000
|
||||||
|
|
||||||
|
|
||||||
/* Machine variant if we know it. This field was invented at Cygnus,
|
/* Machine variant if we know it. This field was invented at Cygnus,
|
||||||
but it is hoped that other vendors will adopt it. If some standard
|
but it is hoped that other vendors will adopt it. If some standard
|
||||||
is developed, this code should be changed to follow it. */
|
is developed, this code should be changed to follow it. */
|
||||||
|
|
Loading…
Reference in New Issue