aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2018-07-02 13:08:09 -0700
committerH.J. Lu <hjl.tools@gmail.com>2018-07-04 06:49:09 -0700
commitea2a7e63aaacdb8263b2d74308ed3e0e9a4313bd (patch)
treea20ae8fe339dace39850879917458d9aca60fb73 /bfd
parent6bb75436cd430556060e1526777eb0bb1e00c521 (diff)
downloadfsf-binutils-gdb-ea2a7e63aaacdb8263b2d74308ed3e0e9a4313bd.zip
fsf-binutils-gdb-ea2a7e63aaacdb8263b2d74308ed3e0e9a4313bd.tar.gz
fsf-binutils-gdb-ea2a7e63aaacdb8263b2d74308ed3e0e9a4313bd.tar.bz2
x86-64: Clear the R_X86_64_converted_reloc_bit bit
We need to clear the R_X86_64_converted_reloc_bit bit after setting it to avoid leaking it out by --emit-relocs. bfd/ PR ld/23324 * elf64-x86-64.c (elf_x86_64_relocate_section): Clear the R_X86_64_converted_reloc_bit bit. ld/ PR ld/23324 * testsuite/ld-x86-64/pr23324.s: New file. * testsuite/ld-x86-64/pr23324a.d: Likewise. * testsuite/ld-x86-64/pr23324b.d: Likewise. (cherry picked from commit b638b5d57fafc84a8dc0ff91d7579a3c24aad90c)
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog6
-rw-r--r--bfd/elf64-x86-64.c8
2 files changed, 12 insertions, 2 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 8a69c09..2c1c75c 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2018-07-04 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/23324
+ * elf64-x86-64.c (elf_x86_64_relocate_section): Clear the
+ R_X86_64_converted_reloc_bit bit.
+
2018-05-28 H.J. Lu <hongjiu.lu@intel.com>
* elf32-i386.c (elf_i386_lazy_plt): Add plt_tlsdesc_entry,
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
index 619f402..823901d 100644
--- a/bfd/elf64-x86-64.c
+++ b/bfd/elf64-x86-64.c
@@ -2432,8 +2432,13 @@ elf_x86_64_relocate_section (bfd *output_bfd,
continue;
}
+ r_symndx = htab->r_sym (rel->r_info);
converted_reloc = (r_type & R_X86_64_converted_reloc_bit) != 0;
- r_type &= ~R_X86_64_converted_reloc_bit;
+ if (converted_reloc)
+ {
+ r_type &= ~R_X86_64_converted_reloc_bit;
+ rel->r_info = htab->r_info (r_symndx, r_type);
+ }
if (r_type >= (int) R_X86_64_standard)
return _bfd_unrecognized_reloc (input_bfd, input_section, r_type);
@@ -2444,7 +2449,6 @@ elf_x86_64_relocate_section (bfd *output_bfd,
else
howto = (x86_64_elf_howto_table
+ ARRAY_SIZE (x86_64_elf_howto_table) - 1);
- r_symndx = htab->r_sym (rel->r_info);
h = NULL;
sym = NULL;
sec = NULL;