2009-12-15 Tristan Gingold <gingold@adacore.com>
[binutils-gdb.git] / bfd / elf64-hppa.c
index 1b5de6e4ef21204cc3ebbf93eda6131a52a4d1d1..06a3ae4d1291ed00c8af2672a000d5c85e290e5e 100644 (file)
@@ -184,7 +184,7 @@ static bfd_boolean elf64_hppa_mark_milli_and_exported_functions
 static bfd_boolean elf64_hppa_size_dynamic_sections
   (bfd *, struct bfd_link_info *);
 
-static bfd_boolean elf64_hppa_link_output_symbol_hook
+static int elf64_hppa_link_output_symbol_hook
   (struct bfd_link_info *, const char *, Elf_Internal_Sym *,
    asection *, struct elf_link_hash_entry *);
 
@@ -1914,7 +1914,7 @@ elf64_hppa_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
    the symbols have their expected value in the normal symbol
    table.  Ick.  */
 
-static bfd_boolean
+static int
 elf64_hppa_link_output_symbol_hook (struct bfd_link_info *info ATTRIBUTE_UNUSED,
                                    const char *name,
                                    Elf_Internal_Sym *sym,
@@ -1926,7 +1926,7 @@ elf64_hppa_link_output_symbol_hook (struct bfd_link_info *info ATTRIBUTE_UNUSED,
   /* We may be called with the file symbol or section symbols.
      They never need munging, so it is safe to ignore them.  */
   if (!name || !eh)
-    return TRUE;
+    return 1;
 
   /* Function symbols for which we created .opd entries *may* have been
      munged by finish_dynamic_symbol and have to be un-munged here.
@@ -1942,7 +1942,7 @@ elf64_hppa_link_output_symbol_hook (struct bfd_link_info *info ATTRIBUTE_UNUSED,
       sym->st_shndx = hh->st_shndx;
     }
 
-  return TRUE;
+  return 1;
 }
 
 /* Finish up dynamic symbol handling.  We set the contents of various
@@ -2740,15 +2740,16 @@ elf64_hppa_elf_get_symbol_type (Elf_Internal_Sym *elf_sym,
 }
 
 /* Support HP specific sections for core files.  */
+
 static bfd_boolean
-elf64_hppa_section_from_phdr (bfd *abfd, Elf_Internal_Phdr *hdr, int index,
+elf64_hppa_section_from_phdr (bfd *abfd, Elf_Internal_Phdr *hdr, int sec_index,
                              const char *typename)
 {
   if (hdr->p_type == PT_HP_CORE_KERNEL)
     {
       asection *sect;
 
-      if (!_bfd_elf_make_section_from_phdr (abfd, hdr, index, typename))
+      if (!_bfd_elf_make_section_from_phdr (abfd, hdr, sec_index, typename))
        return FALSE;
 
       sect = bfd_make_section_anyway (abfd, ".kernel");
@@ -2771,7 +2772,7 @@ elf64_hppa_section_from_phdr (bfd *abfd, Elf_Internal_Phdr *hdr, int index,
 
       elf_tdata (abfd)->core_signal = sig;
 
-      if (!_bfd_elf_make_section_from_phdr (abfd, hdr, index, typename))
+      if (!_bfd_elf_make_section_from_phdr (abfd, hdr, sec_index, typename))
        return FALSE;
 
       /* GDB uses the ".reg" section to read register contents.  */
@@ -2784,7 +2785,7 @@ elf64_hppa_section_from_phdr (bfd *abfd, Elf_Internal_Phdr *hdr, int index,
       || hdr->p_type == PT_HP_CORE_MMF)
     hdr->p_type = PT_LOAD;
 
-  return _bfd_elf_make_section_from_phdr (abfd, hdr, index, typename);
+  return _bfd_elf_make_section_from_phdr (abfd, hdr, sec_index, typename);
 }
 
 /* Hook called by the linker routine which adds symbols from an object
@@ -2800,9 +2801,9 @@ elf_hppa_add_symbol_hook (bfd *abfd,
                          asection **secp,
                          bfd_vma *valp)
 {
-  unsigned int index = sym->st_shndx;
+  unsigned int sec_index = sym->st_shndx;
 
-  switch (index)
+  switch (sec_index)
     {
     case SHN_PARISC_ANSI_COMMON:
       *secp = bfd_make_section_old_way (abfd, ".PARISC.ansi.common");
@@ -3033,7 +3034,7 @@ elf_hppa_final_link (bfd *abfd, struct bfd_link_info *info)
 
   /* If we're producing a final executable, sort the contents of the
      unwind section. */
-  if (retval)
+  if (retval && !info->relocatable)
     retval = elf_hppa_sort_unwind (abfd);
 
   return retval;