* elf-bfd.h (elf_backend_data <elf_backend_section_from_bfd_section>):
[binutils-gdb.git] / bfd / elf32-mips.c
index 63e6e023db0bff41496fffe62ff9e61c74f44d3f..110b6098e8fc1667c59f7503ad9b19acce8b1a6e 100644 (file)
@@ -3585,9 +3585,8 @@ _bfd_mips_elf_fake_sections (abfd, hdr, sec)
    the .scommon section.  */
 
 boolean
-_bfd_mips_elf_section_from_bfd_section (abfd, hdr, sec, retval)
+_bfd_mips_elf_section_from_bfd_section (abfd, sec, retval)
      bfd *abfd ATTRIBUTE_UNUSED;
-     Elf_Internal_Shdr *hdr ATTRIBUTE_UNUSED;
      asection *sec;
      int *retval;
 {
@@ -5177,7 +5176,7 @@ _bfd_mips_elf_final_link (abfd, info)
              if (p->type == bfd_indirect_link_order)
                p->u.indirect.section->flags &= ~SEC_HAS_CONTENTS;
            (*secpp)->link_order_head = NULL;
-           *secpp = (*secpp)->next;
+           bfd_section_list_remove (abfd, secpp);
            --abfd->section_count;
 
            break;
@@ -5547,7 +5546,7 @@ _bfd_mips_elf_final_link (abfd, info)
                   *secpp != o;
                   secpp = &(*secpp)->next)
                ;
-             *secpp = (*secpp)->next;
+             bfd_section_list_remove (abfd, secpp);
              --abfd->section_count;
 
              continue;
@@ -6735,7 +6734,8 @@ mips_elf_calculate_relocation (abfd,
   /* Calls from 16-bit code to 32-bit code and vice versa require the
      special jalx instruction.  */
   *require_jalxp = (!info->relocateable
-                   && ((r_type == R_MIPS16_26) != target_is_16_bit_code_p));
+                   && (((r_type == R_MIPS16_26) != target_is_16_bit_code_p
+                        || ((r_type == R_MIPS_26) == target_is_16_bit_code_p))));
 
   local_p = mips_elf_local_relocation_p (input_bfd, relocation,
                                         local_sections, true);
@@ -6790,6 +6790,7 @@ mips_elf_calculate_relocation (abfd,
 
     case R_MIPS_HI16:
     case R_MIPS_LO16:
+    case R_MIPS16_GPREL:
     case R_MIPS_GPREL16:
     case R_MIPS_GPREL32:
     case R_MIPS_LITERAL:
@@ -9758,7 +9759,7 @@ _bfd_elf32_mips_discard_info (abfd, cookie, info)
   cookie->rel = cookie->rels;
   cookie->relend =
     cookie->rels + o->reloc_count * bed->s->int_rels_per_ext_rel;
-      
+
   for (i = 0, skip = 0; i < o->_raw_size; i ++)
     {
       if (_bfd_elf32_reloc_symbol_deleted_p (i * PDR_SIZE, cookie))