summaryrefslogtreecommitdiff
path: root/bfd/elf64-x86-64.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2021-02-04 06:02:13 -0800
committerH.J. Lu <hjl.tools@gmail.com>2021-02-04 06:06:44 -0800
commit1a2f1b54a520b28891910846c8671e1c4bcaf348 (patch)
treeb61a6448f833763aac399ceb12ff22d71ef6e2ec /bfd/elf64-x86-64.c
parent37707bd8221c2e3f7676de8bee0c42ce3ab38c77 (diff)
downloadbinutils-gdb-1a2f1b54a520b28891910846c8671e1c4bcaf348.tar.gz
x86-64: Provide more info when failed to convert GOTPCREL
Provide [hjl@gnu-cfl-2 ld]$ ./ld-new -z norelro -L/export/gnu/import/git/gitlab/x86-binutils/ld/testsuite/ld-x86-64 -melf32_x86_64 -Ttext=0x80000000 -o tmpdir/dump tmpdir/pr19609-7.o tmpdir/pr19609-7.o: in function `_start': (.text+0x2): failed to convert GOTPCREL relocation against 'foobar'; relink with --no-relax [hjl@gnu-cfl-2 ld]$ instead of [hjl@gnu-cfl-2 ld]$ ld -z norelro -L/export/gnu/import/git/gitlab/x86-binutils/ld/testsuite/ld-x86-64 -melf32_x86_64 -Ttext=0x80000000 -o tmpdir/dump tmpdir/pr19609-7.o ld: failed to convert GOTPCREL relocation; relink with --no-relax [hjl@gnu-cfl-2 ld]$ bfd/ PR ld/19609 * elf64-x86-64.c (elf_x86_64_relocate_section): Provide more info when failed to convert GOTPCREL relocation. ld/ PR ld/19609 * testsuite/ld-x86-64/pr19609-2a.d: Updated. * testsuite/ld-x86-64/pr19609-2b.d: Likewise. * testsuite/ld-x86-64/pr19609-4a.d: Likewise. * testsuite/ld-x86-64/pr19609-4c.d: Likewise. * testsuite/ld-x86-64/pr19609-5d.d: Likewise. * testsuite/ld-x86-64/pr19609-7a.d: Likewise. * testsuite/ld-x86-64/pr19609-7c.d: Likewise.
Diffstat (limited to 'bfd/elf64-x86-64.c')
-rw-r--r--bfd/elf64-x86-64.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
index 500f8bfa309..bba22008c06 100644
--- a/bfd/elf64-x86-64.c
+++ b/bfd/elf64-x86-64.c
@@ -2430,6 +2430,7 @@ elf_x86_64_relocate_section (bfd *output_bfd,
Elf_Internal_Rela *wrel;
Elf_Internal_Rela *relend;
unsigned int plt_entry_size;
+ bfd_boolean status;
/* Skip if check_relocs failed. */
if (input_section->check_relocs_failed)
@@ -2453,6 +2454,7 @@ elf_x86_64_relocate_section (bfd *output_bfd,
_bfd_x86_elf_set_tls_module_base (info);
+ status = TRUE;
rel = wrel = relocs;
relend = relocs + input_section->reloc_count;
for (; rel < relend; wrel++, rel++)
@@ -4118,8 +4120,13 @@ elf_x86_64_relocate_section (bfd *output_bfd,
if (converted_reloc)
{
info->callbacks->einfo
- (_("%F%P: failed to convert GOTPCREL relocation; relink with --no-relax\n"));
- return FALSE;
+ ("%X%H:", input_bfd, input_section, rel->r_offset);
+ info->callbacks->einfo
+ (_(" failed to convert GOTPCREL relocation against "
+ "'%s'; relink with --no-relax\n"),
+ name);
+ status = FALSE;
+ continue;
}
(*info->callbacks->reloc_overflow)
(info, (h ? &h->root : NULL), name, howto->name,
@@ -4160,7 +4167,7 @@ elf_x86_64_relocate_section (bfd *output_bfd,
input_section->reloc_count -= deleted;
}
- return TRUE;
+ return status;
}
/* Finish up dynamic symbol handling. We set the contents of various