From 6a5848cd100234c5b7ae08af2bc314cefe2413fc Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Tue, 17 Jan 1995 15:55:55 +0000 Subject: [PATCH] * 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.*. --- bfd/ChangeLog | 11 +++ bfd/elf32-mips.c | 200 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 211 insertions(+) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index cf96324894..bbd43470d1 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,14 @@ +Tue Jan 17 10:52:32 1995 Ian Lance Taylor + + * 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 * archures.c, Makefile.in, targets.c, bfd-in2.h, coffcode.h, diff --git a/bfd/elf32-mips.c b/bfd/elf32-mips.c index 544d0cd3a1..af076e0e01 100644 --- a/bfd/elf32-mips.c +++ b/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; }