aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Jaeger <aj@suse.de>2001-03-07 13:49:11 +0000
committerAndreas Jaeger <aj@suse.de>2001-03-07 13:49:11 +0000
commitbcdd92f3e09bfbb42f46281bab7619f8c40d10a3 (patch)
treeb895f11c90533c9fa5f6b5b09dea4331fb948587
parent7a1bd56a086cb8e81095bc373f0aadc0fe91fa8e (diff)
downloadfsf-binutils-gdb-bcdd92f3e09bfbb42f46281bab7619f8c40d10a3.zip
fsf-binutils-gdb-bcdd92f3e09bfbb42f46281bab7619f8c40d10a3.tar.gz
fsf-binutils-gdb-bcdd92f3e09bfbb42f46281bab7619f8c40d10a3.tar.bz2
2001-03-07 Andreas Jaeger <aj@suse.de>
* elf64-x86-64.c (elf64_x86_64_relocate_section): Fix handling of some relocation values.
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/elf64-x86-64.c36
2 files changed, 40 insertions, 1 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 32794be..2667ff9 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
+2001-03-07 Andreas Jaeger <aj@suse.de>
+
+ * elf64-x86-64.c (elf64_x86_64_relocate_section): Fix handling of
+ some relocation values.
+
2001-03-06 Nick Clifton <nickc@redhat.com>
* elf32-arm.h (elf32_arm_final_link_relocate): Clear bit zero
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
index aedd2b8..d797165 100644
--- a/bfd/elf64-x86-64.c
+++ b/bfd/elf64-x86-64.c
@@ -1194,7 +1194,41 @@ elf64_x86_64_relocate_section (output_bfd, info, input_bfd, input_section,
|| h->root.type == bfd_link_hash_defweak)
{
sec = h->root.u.def.section;
- if (sec->output_section == NULL)
+ if (r_type == R_X86_64_GOTPCREL
+ || (r_type = R_X86_64_PLT32
+ && splt != NULL
+ && h->plt.offset != (bfd_vma) -1)
+ || (r_type = R_X86_64_GOT32
+ && elf_hash_table (info)->dynamic_sections_created
+ && (!info->shared
+ || (! info->symbolic && h->dynindx != -1)
+ || (h->elf_link_hash_flags
+ & ELF_LINK_HASH_DEF_REGULAR) == 0))
+ || (info->shared
+ && ((! info->symbolic && h->dynindx != -1)
+ || (h->elf_link_hash_flags
+ & ELF_LINK_HASH_DEF_REGULAR) == 0)
+ && ( r_type == R_X86_64_8 ||
+ r_type == R_X86_64_16 ||
+ r_type == R_X86_64_32 ||
+ r_type == R_X86_64_64 ||
+ r_type == R_X86_64_PC16 ||
+ r_type == R_X86_64_PC32)
+ && ((input_section->flags & SEC_ALLOC) != 0
+ /* DWARF will emit R_X86_64_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
+ obscure cases sec->output_section will be NULL. */
+ relocation = 0;
+ }
+ else if (sec->output_section == NULL)
{
(*_bfd_error_handler)
(_("%s: warning: unresolvable relocation against symbol `%s' from %s section"),