* elf32-mips.c (enum reloc_type): Define new relocs used on Irix.
(elf_mips_howto_table): Add entries for new relocs. (mips_elf_section_from_shdr): Handle SHT_MIPS_MSYM, SHT_MIPS_DWARF, and SHT_MIPS_EVENTS. (mips_elf_fake_sections): Handle sections named .msym, .debug_* and .MIPS.events.*.
This commit is contained in:
parent
dbd9bcaa8b
commit
6a5848cd10
2 changed files with 211 additions and 0 deletions
|
@ -1,3 +1,14 @@
|
|||
Tue Jan 17 10:52:32 1995 Ian Lance Taylor <ian@sanguine.cygnus.com>
|
||||
|
||||
* elf32-mips.c (enum reloc_type): Define new relocs used on Irix.
|
||||
(elf_mips_howto_table): Add entries for new relocs.
|
||||
(mips_elf_section_from_shdr): Handle SHT_MIPS_MSYM,
|
||||
SHT_MIPS_DWARF, and SHT_MIPS_EVENTS.
|
||||
(mips_elf_fake_sections): Handle sections named .msym, .debug_*
|
||||
and .MIPS.events.*.
|
||||
|
||||
* srec.c (srec_init): Remove unused local variable i.
|
||||
|
||||
Sat Jan 14 19:09:48 1995 Steve Chamberlain <sac@jonny>
|
||||
|
||||
* archures.c, Makefile.in, targets.c, bfd-in2.h, coffcode.h,
|
||||
|
|
200
bfd/elf32-mips.c
200
bfd/elf32-mips.c
|
@ -112,6 +112,18 @@ enum reloc_type
|
|||
R_MIPS_GPREL16, R_MIPS_LITERAL,
|
||||
R_MIPS_GOT16, R_MIPS_PC16,
|
||||
R_MIPS_CALL16, R_MIPS_GPREL32,
|
||||
/* The remaining relocs are defined on Irix, although they are not
|
||||
in the MIPS ELF ABI. */
|
||||
R_MIPS_UNUSED1, R_MIPS_UNUSED2,
|
||||
R_MIPS_UNUSED3,
|
||||
R_MIPS_SHIFT5, R_MIPS_SHIFT6,
|
||||
R_MIPS_64, R_MIPS_GOT_DISP,
|
||||
R_MIPS_GOT_PAGE, R_MIPS_GOT_OFST,
|
||||
R_MIPS_GOT_HI16, R_MIPS_GOT_LO16,
|
||||
R_MIPS_SUB, R_MIPS_INSERT_A,
|
||||
R_MIPS_INSERT_B, R_MIPS_DELETE,
|
||||
R_MIPS_HIGHER, R_MIPS_HIGHEST,
|
||||
R_MIPS_CALL_HI16, R_MIPS_CALL_LO16,
|
||||
R_MIPS_max
|
||||
};
|
||||
|
||||
|
@ -316,6 +328,172 @@ static reloc_howto_type elf_mips_howto_table[] =
|
|||
true, /* partial_inplace */
|
||||
0xffffffff, /* src_mask */
|
||||
0xffffffff, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
/* The remaining relocs are defined on Irix 5, although they are
|
||||
not defined by the ABI. */
|
||||
{ 13 },
|
||||
{ 14 },
|
||||
{ 15 },
|
||||
|
||||
/* A 5 bit shift field. */
|
||||
HOWTO (R_MIPS_SHIFT5, /* type */
|
||||
0, /* rightshift */
|
||||
2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
5, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
6, /* bitpos */
|
||||
complain_overflow_bitfield, /* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_MIPS_SHIFT5", /* name */
|
||||
true, /* partial_inplace */
|
||||
0x000007c0, /* src_mask */
|
||||
0x000007c0, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
/* A 6 bit shift field. */
|
||||
/* FIXME: This is not handled correctly; a special function is
|
||||
needed to put the most significant bit in the right place. */
|
||||
HOWTO (R_MIPS_SHIFT6, /* type */
|
||||
0, /* rightshift */
|
||||
2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
6, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
6, /* bitpos */
|
||||
complain_overflow_bitfield, /* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_MIPS_SHIFT6", /* name */
|
||||
true, /* partial_inplace */
|
||||
0x000007c4, /* src_mask */
|
||||
0x000007c4, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
/* A 64 bit relocation. Presumably not used in 32 bit ELF. */
|
||||
{ R_MIPS_64 },
|
||||
|
||||
/* Displacement in the global offset table. */
|
||||
/* FIXME: Not handled correctly. */
|
||||
HOWTO (R_MIPS_GOT_DISP, /* type */
|
||||
0, /* rightshift */
|
||||
2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
16, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_bitfield, /* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_MIPS_GOT_DISP", /* name */
|
||||
true, /* partial_inplace */
|
||||
0x0000ffff, /* src_mask */
|
||||
0x0000ffff, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
/* Displacement to page pointer in the global offset table. */
|
||||
/* FIXME: Not handled correctly. */
|
||||
HOWTO (R_MIPS_GOT_PAGE, /* type */
|
||||
0, /* rightshift */
|
||||
2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
16, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_bitfield, /* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_MIPS_GOT_PAGE", /* name */
|
||||
true, /* partial_inplace */
|
||||
0x0000ffff, /* src_mask */
|
||||
0x0000ffff, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
/* Offset from page pointer in the global offset table. */
|
||||
/* FIXME: Not handled correctly. */
|
||||
HOWTO (R_MIPS_GOT_OFST, /* type */
|
||||
0, /* rightshift */
|
||||
2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
16, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_bitfield, /* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_MIPS_GOT_OFST", /* name */
|
||||
true, /* partial_inplace */
|
||||
0x0000ffff, /* src_mask */
|
||||
0x0000ffff, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
/* High 16 bits of displacement in global offset table. */
|
||||
/* FIXME: Not handled correctly. */
|
||||
HOWTO (R_MIPS_GOT_HI16, /* type */
|
||||
0, /* rightshift */
|
||||
2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
16, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_dont, /* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_MIPS_GOT_HI16", /* name */
|
||||
true, /* partial_inplace */
|
||||
0x0000ffff, /* src_mask */
|
||||
0x0000ffff, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
/* Low 16 bits of displacement in global offset table. */
|
||||
/* FIXME: Not handled correctly. */
|
||||
HOWTO (R_MIPS_GOT_LO16, /* type */
|
||||
0, /* rightshift */
|
||||
2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
16, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_dont, /* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_MIPS_GOT_LO16", /* name */
|
||||
true, /* partial_inplace */
|
||||
0x0000ffff, /* src_mask */
|
||||
0x0000ffff, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
/* 64 bit subtraction. Presumably not used in 32 bit ELF. */
|
||||
{ R_MIPS_SUB },
|
||||
|
||||
/* Used to cause the linker to insert and delete instructions? */
|
||||
{ R_MIPS_INSERT_A },
|
||||
{ R_MIPS_INSERT_B },
|
||||
{ R_MIPS_DELETE },
|
||||
|
||||
/* Get the higher values of a 64 bit addend. Presumably not used in
|
||||
32 bit ELF. */
|
||||
{ R_MIPS_HIGHER },
|
||||
{ R_MIPS_HIGHEST },
|
||||
|
||||
/* High 16 bits of displacement in global offset table. */
|
||||
/* FIXME: Not handled correctly. */
|
||||
HOWTO (R_MIPS_CALL_HI16, /* type */
|
||||
0, /* rightshift */
|
||||
2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
16, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_dont, /* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_MIPS_CALL_HI16", /* name */
|
||||
true, /* partial_inplace */
|
||||
0x0000ffff, /* src_mask */
|
||||
0x0000ffff, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
/* Low 16 bits of displacement in global offset table. */
|
||||
/* FIXME: Not handled correctly. */
|
||||
HOWTO (R_MIPS_CALL_LO16, /* type */
|
||||
0, /* rightshift */
|
||||
2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
16, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_dont, /* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_MIPS_CALL_LO16", /* name */
|
||||
true, /* partial_inplace */
|
||||
0x0000ffff, /* src_mask */
|
||||
0x0000ffff, /* dst_mask */
|
||||
false) /* pcrel_offset */
|
||||
};
|
||||
|
||||
|
@ -916,6 +1094,10 @@ mips_elf_section_from_shdr (abfd, hdr, name)
|
|||
if (strcmp (name, ".liblist") != 0)
|
||||
return false;
|
||||
break;
|
||||
case SHT_MIPS_MSYM:
|
||||
if (strcmp (name, ".msym") != 0)
|
||||
return false;
|
||||
break;
|
||||
case SHT_MIPS_CONFLICT:
|
||||
if (strcmp (name, ".conflict") != 0)
|
||||
return false;
|
||||
|
@ -941,6 +1123,14 @@ mips_elf_section_from_shdr (abfd, hdr, name)
|
|||
if (strcmp (name, ".options") != 0)
|
||||
return false;
|
||||
break;
|
||||
case SHT_MIPS_DWARF:
|
||||
if (strncmp (name, ".debug_", sizeof ".debug_" - 1) != 0)
|
||||
return false;
|
||||
break;
|
||||
case SHT_MIPS_EVENTS:
|
||||
if (strncmp (name, ".MIPS.events.", sizeof ".MIPS.events." - 1) != 0)
|
||||
return false;
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
@ -996,6 +1186,12 @@ mips_elf_fake_sections (abfd, hdr, sec)
|
|||
hdr->sh_info = sec->_raw_size / sizeof (Elf32_Lib);
|
||||
/* FIXME: Set the sh_link field. */
|
||||
}
|
||||
else if (strcmp (name, ".msym") == 0)
|
||||
{
|
||||
hdr->sh_type = SHT_MIPS_MSYM;
|
||||
hdr->sh_entsize = 8;
|
||||
/* FIXME: Set the sh_info field. */
|
||||
}
|
||||
else if (strcmp (name, ".conflict") == 0)
|
||||
hdr->sh_type = SHT_MIPS_CONFLICT;
|
||||
else if (strncmp (name, ".gptab.", sizeof ".gptab." - 1) == 0)
|
||||
|
@ -1026,6 +1222,10 @@ mips_elf_fake_sections (abfd, hdr, sec)
|
|||
hdr->sh_type = SHT_MIPS_OPTIONS;
|
||||
hdr->sh_entsize = 1;
|
||||
}
|
||||
else if (strncmp (name, ".debug_", sizeof ".debug_" - 1) == 0)
|
||||
hdr->sh_type = SHT_MIPS_DWARF;
|
||||
else if (strncmp (name, ".MIPS.events.", sizeof ".MIPS.events." - 1) == 0)
|
||||
hdr->sh_type = SHT_MIPS_EVENTS;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue