This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH, GNU ld] Fix broken -Bsymbolic-functions for hppa, m68k, nios2 and tic6x
- From: "Thomas Preud'homme" <thomas dot preudhomme at arm dot com>
- To: <binutils at sourceware dot org>
- Date: Fri, 24 Jul 2015 17:09:08 +0800
- Subject: [PATCH, GNU ld] Fix broken -Bsymbolic-functions for hppa, m68k, nios2 and tic6x
- Authentication-results: sourceware.org; auth=none
GNU ld generates absolute relocation for non function call references to functions
(eg. initialization of function pointer) despite the presence of -Bsymbolic-functions.
This issue has already been dealt with in Aarch64 some time ago but although a
check for similar issues in other targets was done, it was done incorrectly (probably
by looking for the whole condition on a single line instead of just grepping for
!.*->dynamic).
Target that appears to be affected:
arm
hppa
m68k
nios2
tic6x
This patch fixes the issue for non ARM targets. Target maintainers for these targets are encouraged to add testcases for this issue.
ChangeLog entry is as follow:
*** bfd/ChangeLog ***
2015-07-20 Thomas Preud'homme <thomas.preudhomme@arm.com>
* elf32-hppa.c (elf32_hppa_relocate_section): Likewise.
* elf32-m68k.c (elf_m68k_relocate_section): Likewise.
* elf32-nios2.c (nios2_elf32_relocate_section): Likewise.
* elf32-tic6x.c (elf32_tic6x_relocate_section): Likewise.
diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c
index af512a7..0c91c29 100644
--- a/bfd/elf32-hppa.c
+++ b/bfd/elf32-hppa.c
@@ -4005,7 +4005,7 @@ elf32_hppa_relocate_section (bfd *output_bfd,
&& (plabel
|| !IS_ABSOLUTE_RELOC (r_type)
|| !info->shared
- || !info->symbolic
+ || !SYMBOLIC_BIND (info, &hh->eh)
|| !hh->eh.def_regular))
{
outrel.r_info = ELF32_R_INFO (hh->eh.dynindx, r_type);
diff --git a/bfd/elf32-m68k.c b/bfd/elf32-m68k.c
index fad3ec6..2557fca 100644
--- a/bfd/elf32-m68k.c
+++ b/bfd/elf32-m68k.c
@@ -4027,7 +4027,7 @@ elf_m68k_relocate_section (bfd *output_bfd,
|| r_type == R_68K_PC16
|| r_type == R_68K_PC32
|| !info->shared
- || !info->symbolic
+ || !SYMBOLIC_BIND (info, h)
|| !h->def_regular))
{
outrel.r_info = ELF32_R_INFO (h->dynindx, r_type);
diff --git a/bfd/elf32-nios2.c b/bfd/elf32-nios2.c
index 4f992bf..357a211 100644
--- a/bfd/elf32-nios2.c
+++ b/bfd/elf32-nios2.c
@@ -3446,7 +3446,7 @@ nios2_elf32_relocate_section (bfd *output_bfd,
else if (h != NULL
&& h->dynindx != -1
&& (!info->shared
- || !info->symbolic
+ || !SYMBOLIC_BIND (info, h)
|| !h->def_regular))
{
outrel.r_info = ELF32_R_INFO (h->dynindx, r_type);
diff --git a/bfd/elf32-tic6x.c b/bfd/elf32-tic6x.c
index 8bfad84..9bfb949 100644
--- a/bfd/elf32-tic6x.c
+++ b/bfd/elf32-tic6x.c
@@ -2449,7 +2449,7 @@ elf32_tic6x_relocate_section (bfd *output_bfd,
else if (h != NULL
&& h->dynindx != -1
&& (!info->shared
- || !info->symbolic
+ || !SYMBOLIC_BIND (info, h)
|| !h->def_regular))
{
outrel.r_info = ELF32_R_INFO (h->dynindx, r_type);
No regression was observed when running testsuite for the following targets:
* hppa-linux-gnu
* m68k-linux
* nios2-linux
* tic6x-none-elf
Is this patch ok for master as well as for 2.24 and 2.25 stable branch?
Best regards,
Thomas