aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2004-04-14 09:50:07 +0000
committerAlan Modra <amodra@gmail.com>2004-04-14 09:50:07 +0000
commit6de00a78235f512af73af5ea4b4f0e60e8b45ca0 (patch)
treefae6bd4468fa3551f2c37d053aee5aa64ef4a49e
parentd766e8ec5050cef93be39b7b7fbd3142a7a587cd (diff)
downloadfsf-binutils-gdb-6de00a78235f512af73af5ea4b4f0e60e8b45ca0.zip
fsf-binutils-gdb-6de00a78235f512af73af5ea4b4f0e60e8b45ca0.tar.gz
fsf-binutils-gdb-6de00a78235f512af73af5ea4b4f0e60e8b45ca0.tar.bz2
* elf32-sparc.c (elf32_sparc_relocate_section): Don't abort
when statically linking PIC code. * elf64-sparc.c (sparc64_elf_relocate_section): Likewise.
-rw-r--r--bfd/ChangeLog6
-rw-r--r--bfd/elf32-sparc.c5
-rw-r--r--bfd/elf64-sparc.c11
3 files changed, 10 insertions, 12 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index c453657..7aff007 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2004-04-14 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-sparc.c (elf32_sparc_relocate_section): Don't abort
+ when statically linking PIC code.
+ * elf64-sparc.c (sparc64_elf_relocate_section): Likewise.
+
2004-04-11 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
* config.bfd: Remove mips*-*-mach3* and mips*-dec-mach3* targets.
diff --git a/bfd/elf32-sparc.c b/bfd/elf32-sparc.c
index 3016652..0f94f5f 100644
--- a/bfd/elf32-sparc.c
+++ b/bfd/elf32-sparc.c
@@ -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);
diff --git a/bfd/elf64-sparc.c b/bfd/elf64-sparc.c
index dd3e496..0b65380 100644
--- a/bfd/elf64-sparc.c
+++ b/bfd/elf64-sparc.c
@@ -2027,7 +2027,8 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
else
got_base = elf_hash_table (info)->hgot->root.u.def.value;
- sgot = splt = sreloc = NULL;
+ sgot = sreloc = NULL;
+ splt = bfd_get_section_by_name (dynobj, ".plt");
rel = relocs;
relend = relocs + NUM_SHDR_ENTRIES (& elf_section_data (input_section)->rel_hdr);
@@ -2409,7 +2410,7 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
procedure linkage table. */
BFD_ASSERT (h != NULL);
- if (h->plt.offset == (bfd_vma) -1)
+ if (h->plt.offset == (bfd_vma) -1 || splt == NULL)
{
/* We didn't make a PLT entry for this symbol. This
happens when statically linking PIC code, or when
@@ -2417,12 +2418,6 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
goto do_default;
}
- if (splt == NULL)
- {
- splt = bfd_get_section_by_name (dynobj, ".plt");
- BFD_ASSERT (splt != NULL);
- }
-
relocation = (splt->output_section->vma
+ splt->output_offset
+ sparc64_elf_plt_entry_offset (h->plt.offset));