2004-04-28 Andrew Cagney <cagney@redhat.com>
[deliverable/binutils-gdb.git] / bfd / elf32-sparc.c
index 3016652678babd84bcc0e2abe8a394e734956f13..3809567627ae06f39e1c7c8fa9109d0776fec4f5 100644 (file)
@@ -2323,7 +2323,7 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
          if (h == NULL)
            break;
 
-         if (h->plt.offset == (bfd_vma) -1)
+         if (h->plt.offset == (bfd_vma) -1 || htab->splt == NULL)
            {
              /* We didn't make a PLT entry for this symbol.  This
                 happens when statically linking PIC code, or when
@@ -2331,9 +2331,6 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
              break;
            }
 
-         if (htab->splt == NULL)
-           abort ();
-
          relocation = (htab->splt->output_section->vma
                        + htab->splt->output_offset
                        + h->plt.offset);
@@ -2377,6 +2374,9 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
            break;
 
          if ((info->shared
+              && (h == NULL
+                  || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
+                  || h->root.type != bfd_link_hash_undefweak)
               && (! howto->pc_relative
                   || (h != NULL
                       && h->dynindx != -1
@@ -3432,6 +3432,17 @@ elf32_sparc_reloc_type_class (rela)
       return reloc_class_normal;
     }
 }
+
+/* Return address for Ith PLT stub in section PLT, for relocation REL
+   or (bfd_vma) -1 if it should not be included.  */
+
+static bfd_vma
+elf32_sparc_plt_sym_val (bfd_vma i ATTRIBUTE_UNUSED,
+                        const asection *plt ATTRIBUTE_UNUSED,
+                        const arelent *rel)
+{
+  return rel->address;
+}
 \f
 #define TARGET_BIG_SYM bfd_elf32_sparc_vec
 #define TARGET_BIG_NAME        "elf32-sparc"
@@ -3470,6 +3481,7 @@ elf32_sparc_reloc_type_class (rela)
 #define elf_backend_gc_sweep_hook       elf32_sparc_gc_sweep_hook
 #define elf_backend_grok_psinfo                elf32_sparc_grok_psinfo
 #define elf_backend_reloc_type_class   elf32_sparc_reloc_type_class
+#define elf_backend_plt_sym_val                elf32_sparc_plt_sym_val
 
 #define elf_backend_can_gc_sections 1
 #define elf_backend_can_refcount 1
This page took 0.025505 seconds and 4 git commands to generate.