From b638b5d57fafc84a8dc0ff91d7579a3c24aad90c Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Mon, 2 Jul 2018 13:08:09 -0700 Subject: 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. --- bfd/elf64-x86-64.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'bfd/elf64-x86-64.c') diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c index 4349561..c3a6c31 100644 --- a/bfd/elf64-x86-64.c +++ b/bfd/elf64-x86-64.c @@ -2431,8 +2431,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); @@ -2443,7 +2448,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; -- cgit v1.1