Change "reloc_howto_type" typedef to be "const", since all uses of it are (or
[binutils-gdb.git] / bfd / elf32-mips.c
index 6148a5aa63472724c17069d1800e8e5a4178293b..544d0cd3a15308c298c5d8a13c7700dba0645167 100644 (file)
@@ -71,7 +71,8 @@ static void mips_info_to_howto_rel
   PARAMS ((bfd *, arelent *, Elf32_Internal_Rel *));
 static boolean mips_elf_sym_is_global PARAMS ((bfd *, asymbol *));
 static boolean mips_elf_object_p PARAMS ((bfd *));
-static void mips_elf_final_write_processing PARAMS ((bfd *));
+static void mips_elf_final_write_processing
+  PARAMS ((bfd *, boolean));
 static boolean mips_elf_section_from_shdr
   PARAMS ((bfd *, Elf32_Internal_Shdr *, char *));
 static boolean mips_elf_fake_sections
@@ -362,7 +363,7 @@ mips_elf_hi16_reloc (abfd,
     abort ();
 
   ret = bfd_reloc_ok;
-  if (symbol->section == &bfd_und_section
+  if (bfd_is_und_section (symbol->section)
       && output_bfd == (bfd *) NULL)
     ret = bfd_reloc_undefined;
 
@@ -548,7 +549,7 @@ mips_elf_gprel16_reloc (abfd,
       output_bfd = symbol->section->output_section->owner;
     }
 
-  if (symbol->section == &bfd_und_section
+  if (bfd_is_und_section (symbol->section)
       && relocateable == false)
     return bfd_reloc_undefined;
 
@@ -839,9 +840,11 @@ mips_elf_object_p (abfd)
    file.  This gets the MIPS architecture right based on the machine
    number.  */
 
+/*ARGSUSED*/
 static void
-mips_elf_final_write_processing (abfd)
+mips_elf_final_write_processing (abfd, linker)
      bfd *abfd;
+     boolean linker;
 {
   unsigned long val;
   unsigned int i;
@@ -878,8 +881,8 @@ mips_elf_final_write_processing (abfd)
          const char *name;
          asection *sec;
 
-         BFD_ASSERT ((*hdrpp)->rawdata != NULL);
-         name = ((asection *) (*hdrpp)->rawdata)->name;
+         BFD_ASSERT ((*hdrpp)->bfd_section != NULL);
+         name = bfd_get_section_name (abfd, (*hdrpp)->bfd_section);
          BFD_ASSERT (name != NULL
                      && strncmp (name, ".gptab.", sizeof ".gptab." - 1) == 0);
          sec = bfd_get_section_by_name (abfd, name + sizeof ".gptab" - 1);
@@ -944,7 +947,7 @@ mips_elf_section_from_shdr (abfd, hdr, name)
 
   if (! _bfd_elf_make_section_from_shdr (abfd, hdr, name))
     return false;
-  newsect = (asection *) hdr->rawdata;
+  newsect = hdr->bfd_section;
 
   if (hdr->sh_type == SHT_MIPS_DEBUG)
     {
@@ -1042,8 +1045,11 @@ mips_elf_section_from_bfd_section (abfd, hdr, sec, retval)
       *retval = SHN_MIPS_SCOMMON;
       return true;
     }
-  if ((asection *) hdr->rawdata == sec)
-    return true;
+  if (strcmp (bfd_get_section_name (abfd, sec), ".acommon") == 0)
+    {
+      *retval = SHN_MIPS_ACOMMON;
+      return true;
+    }
   return false;
 }
 
@@ -1073,9 +1079,9 @@ mips_elf_section_processing (abfd, hdr)
        return false;
     }
 
-  if (hdr->rawdata != NULL)
+  if (hdr->bfd_section != NULL)
     {
-      const char *name = ((asection *) hdr->rawdata)->name;
+      const char *name = bfd_get_section_name (abfd, hdr->bfd_section);
 
       if (strcmp (name, ".sdata") == 0)
        {
@@ -1173,7 +1179,7 @@ mips_elf_symbol_processing (abfd, asym)
       break;
 
     case SHN_MIPS_SUNDEFINED:
-      asym->section = &bfd_und_section;
+      asym->section = bfd_und_section_ptr;
       break;
     }
 }
@@ -1409,7 +1415,7 @@ mips_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
       break;
 
     case SHN_MIPS_SUNDEFINED:
-      *secp = &bfd_und_section;
+      *secp = bfd_und_section_ptr;
       break;
     }
 
@@ -2184,7 +2190,7 @@ mips_elf_relocate_section (output_bfd, info, input_bfd, input_section,
   for (; rel < relend; rel++)
     {
       int r_type;
-      const reloc_howto_type *howto;
+      reloc_howto_type *howto;
       long r_symndx;
       bfd_vma addend;
       struct elf_link_hash_entry *h;