aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf64-x86-64.c
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@linux-m68k.org>2002-07-01 08:47:13 +0000
committerAndreas Schwab <schwab@linux-m68k.org>2002-07-01 08:47:13 +0000
commit607c0e09443a78107c1019ef0573c74c9b1ba605 (patch)
treee2ed0bec8bca8ec2d617ff85a024e53ae4dbedb9 /bfd/elf64-x86-64.c
parent29e2951eb7038d94aca3d5994363fc6cf689ea59 (diff)
downloadfsf-binutils-gdb-607c0e09443a78107c1019ef0573c74c9b1ba605.zip
fsf-binutils-gdb-607c0e09443a78107c1019ef0573c74c9b1ba605.tar.gz
fsf-binutils-gdb-607c0e09443a78107c1019ef0573c74c9b1ba605.tar.bz2
* elf64-x86-64.c (elf64_x86_64_relocate_section): Only convert
R_X86_64_64 to R_X86_64_RELATIVE.
Diffstat (limited to 'bfd/elf64-x86-64.c')
-rw-r--r--bfd/elf64-x86-64.c41
1 files changed, 38 insertions, 3 deletions
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
index 9c1bfdb..8b4276f 100644
--- a/bfd/elf64-x86-64.c
+++ b/bfd/elf64-x86-64.c
@@ -1876,9 +1876,44 @@ elf64_x86_64_relocate_section (output_bfd, info, input_bfd, input_section,
else
{
/* This symbol is local, or marked to become local. */
- relocate = true;
- outrel.r_info = ELF64_R_INFO (0, R_X86_64_RELATIVE);
- outrel.r_addend = relocation + rel->r_addend;
+ if (r_type == R_X86_64_64)
+ {
+ relocate = true;
+ outrel.r_info = ELF64_R_INFO (0, R_X86_64_RELATIVE);
+ outrel.r_addend = relocation + rel->r_addend;
+ }
+ else
+ {
+ long sindx;
+
+ if (h == NULL)
+ sec = local_sections[r_symndx];
+ else
+ {
+ BFD_ASSERT (h->root.type == bfd_link_hash_defined
+ || (h->root.type
+ == bfd_link_hash_defweak));
+ sec = h->root.u.def.section;
+ }
+ if (sec != NULL && bfd_is_abs_section (sec))
+ sindx = 0;
+ else if (sec == NULL || sec->owner == NULL)
+ {
+ bfd_set_error (bfd_error_bad_value);
+ return false;
+ }
+ else
+ {
+ asection *osec;
+
+ osec = sec->output_section;
+ sindx = elf_section_data (osec)->dynindx;
+ BFD_ASSERT (sindx > 0);
+ }
+
+ outrel.r_info = ELF64_R_INFO (sindx, r_type);
+ outrel.r_addend = relocation + rel->r_addend;
+ }
}
sreloc = elf_section_data (input_section)->sreloc;