daily update
[deliverable/binutils-gdb.git] / bfd / elf32-sparc.c
index c50e4458deb5b8c4358227f578c129af90fbd24d..60a4dc76fa5023e52871d6a4ce51742f9d693f97 100644 (file)
@@ -53,7 +53,7 @@ static boolean elf32_sparc_object_p
 static void elf32_sparc_final_write_processing
   PARAMS ((bfd *, boolean));
 static enum elf_reloc_type_class elf32_sparc_reloc_type_class
-  PARAMS ((int));
+  PARAMS ((const Elf_Internal_Rela *));
 static asection * elf32_sparc_gc_mark_hook
   PARAMS ((bfd *, struct bfd_link_info *, Elf_Internal_Rela *,
           struct elf_link_hash_entry *, Elf_Internal_Sym *));
@@ -1176,9 +1176,7 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
        {
          sym = local_syms + r_symndx;
          sec = local_sections[r_symndx];
-         relocation = (sec->output_section->vma
-                       + sec->output_offset
-                       + sym->st_value);
+         relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
        }
       else
        {
@@ -1223,7 +1221,15 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
                          || ((r_type == R_SPARC_PC10
                               || r_type == R_SPARC_PC22)
                              && strcmp (h->root.root.string,
-                                        "_GLOBAL_OFFSET_TABLE_") != 0))))
+                                        "_GLOBAL_OFFSET_TABLE_") != 0))
+                     && ((input_section->flags & SEC_ALLOC) != 0
+                         /* DWARF will emit R_SPARC_32 relocations in its
+                            sections against symbols defined externally
+                            in shared libraries.  We can't do anything
+                            with them here.  */
+                         || ((input_section->flags & SEC_DEBUGGING) != 0
+                             && (h->elf_link_hash_flags
+                                 & ELF_LINK_HASH_DEF_DYNAMIC) != 0))))
                {
                  /* In these cases, we don't need the relocation
                      value.  We check specially because in some
@@ -1409,7 +1415,9 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
        case R_SPARC_LO10:
        case R_SPARC_UA16:
        case R_SPARC_UA32:
-         if (info->shared && (input_section->flags & SEC_ALLOC))
+         if (info->shared
+             && r_symndx != 0
+             && (input_section->flags & SEC_ALLOC))
            {
              Elf_Internal_Rela outrel;
              boolean skip;
@@ -2082,10 +2090,10 @@ elf32_sparc_final_write_processing (abfd, linker)
 }
 
 static enum elf_reloc_type_class
-elf32_sparc_reloc_type_class (type)
-     int type;
+elf32_sparc_reloc_type_class (rela)
+     const Elf_Internal_Rela *rela;
 {
-  switch (type)
+  switch ((int) ELF32_R_TYPE (rela->r_info))
     {
     case R_SPARC_RELATIVE:
       return reloc_class_relative;
This page took 0.025007 seconds and 4 git commands to generate.