* gdb.base/attach.exp (do_attach_tests): Don't forget to kill second
[deliverable/binutils-gdb.git] / bfd / elf64-mips.c
index 71c3425eaa8b561a844ab17f27e101610d18b2ef..743444240aa7e3b23a9c09d0ad4fbaa6f84f6918 100644 (file)
@@ -1,5 +1,5 @@
 /* MIPS-specific support for 64-bit ELF
-   Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
    Free Software Foundation, Inc.
    Ian Lance Taylor, Cygnus Support
    Linker support added by Mark Mitchell, CodeSourcery, LLC.
@@ -1588,6 +1588,7 @@ mips_elf64_gprel32_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
   bfd_vma gp;
   bfd_vma relocation;
   bfd_vma val;
+  bfd_size_type sz;
 
   /* If we're relocating, and this is an external symbol, we don't want
      to change anything.  */
@@ -1621,7 +1622,8 @@ mips_elf64_gprel32_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
   relocation += symbol->section->output_section->vma;
   relocation += symbol->section->output_offset;
 
-  if (reloc_entry->address > input_section->_cooked_size)
+  sz = input_section->rawsize ? input_section->rawsize : input_section->size;
+  if (reloc_entry->address > sz)
     return bfd_reloc_outofrange;
 
   /* Set val to the offset into the section or symbol.  */
@@ -1712,6 +1714,7 @@ mips16_gprel_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
   unsigned short insn = 0;
   bfd_signed_vma val;
   bfd_vma relocation;
+  bfd_size_type sz;
 
   /* If we're relocating, and this is an external symbol with no
      addend, we don't want to change anything.  */
@@ -1736,7 +1739,8 @@ mips16_gprel_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
   if (ret != bfd_reloc_ok)
     return ret;
 
-  if (reloc_entry->address > input_section->_cooked_size)
+  sz = input_section->rawsize ? input_section->rawsize : input_section->size;
+  if (reloc_entry->address > sz)
     return bfd_reloc_outofrange;
 
   if (bfd_is_com_section (symbol->section))
@@ -1984,7 +1988,7 @@ mips_elf64_canonicalize_dynamic_reloc (bfd *abfd, arelent **storage,
 
          if (! (*slurp_relocs) (abfd, s, syms, TRUE))
            return -1;
-         count = s->_raw_size / elf_section_data (s)->this_hdr.sh_entsize * 3;
+         count = s->size / elf_section_data (s)->this_hdr.sh_entsize * 3;
          p = s->relocation;
          for (i = 0; i < count; i++)
            *storage++ = p++;
@@ -2015,7 +2019,7 @@ mips_elf64_slurp_one_reloc_table (bfd *abfd, asection *asect,
   arelent *relent;
   bfd_vma i;
   int entsize;
-  reloc_howto_type *howto_table;
+  bfd_boolean rela_p;
 
   allocated = bfd_malloc (rel_hdr->sh_size);
   if (allocated == NULL)
@@ -2033,9 +2037,9 @@ mips_elf64_slurp_one_reloc_table (bfd *abfd, asection *asect,
              || entsize == sizeof (Elf64_Mips_External_Rela));
 
   if (entsize == sizeof (Elf64_Mips_External_Rel))
-    howto_table = mips_elf64_howto_table_rel;
+    rela_p = FALSE;
   else
-    howto_table = mips_elf64_howto_table_rela;
+    rela_p = TRUE;
 
   for (i = 0, relent = relents;
        i < reloc_count;
@@ -2148,7 +2152,7 @@ mips_elf64_slurp_one_reloc_table (bfd *abfd, asection *asect,
 
          relent->addend = rela.r_addend;
 
-         relent->howto = &howto_table[(int) type];
+         relent->howto = mips_elf64_rtype_to_howto (type, rela_p);
 
          ++relent;
        }
@@ -2210,7 +2214,7 @@ mips_elf64_slurp_reloc_table (bfd *abfd, asection *asect,
         case because relocations against this section may use the
         dynamic symbol table, and in that case bfd_section_from_shdr
         in elf.c does not update the RELOC_COUNT.  */
-      if (asect->_raw_size == 0)
+      if (asect->size == 0)
        return TRUE;
 
       rel_hdr = &d->this_hdr;
@@ -2539,7 +2543,7 @@ static bfd_boolean
 elf64_mips_grok_prstatus (bfd *abfd, Elf_Internal_Note *note)
 {
   int offset;
-  unsigned int raw_size;
+  unsigned int size;
 
   switch (note->descsz)
     {
@@ -2555,14 +2559,14 @@ elf64_mips_grok_prstatus (bfd *abfd, Elf_Internal_Note *note)
 
        /* pr_reg */
        offset = 112;
-       raw_size = 360;
+       size = 360;
 
        break;
     }
 
   /* Make a ".reg/999" section.  */
   return _bfd_elfcore_make_pseudosection (abfd, ".reg",
-                                         raw_size, note->descpos + offset);
+                                         size, note->descpos + offset);
 }
 
 static bfd_boolean
This page took 0.024996 seconds and 4 git commands to generate.