This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH, GNU ld] Fix broken -Bsymbolic-functions for hppa, m68k, nios2 and tic6x
- From: Hans-Peter Nilsson <hans-peter dot nilsson at axis dot com>
- To: amodra at gmail dot com
- Cc: thomas dot preudhomme at arm dot com, binutils at sourceware dot org
- Date: Mon, 3 Aug 2015 20:37:16 +0200
- Subject: Re: [PATCH, GNU ld] Fix broken -Bsymbolic-functions for hppa, m68k, nios2 and tic6x
- Authentication-results: sourceware.org; auth=none
> From: Alan Modra <amodra@gmail.com>
> Date: Sat, 25 Jul 2015 13:13:48 +0200
> On Fri, Jul 24, 2015 at 05:09:08PM +0800, Thomas Preud'homme wrote:
> > This patch fixes the issue for non ARM targets. Target
> > maintainers for these targets are encouraged to add testcases
> > for this issue.
>
> I'll do better than that with a generic testcase. It fails on a few
> targets.
[...]
> crisv32-linux +FAIL: -Bsymbolic-functions
[...]
> Your patches are good, but I reckon every other place using
> info->symbolic in these files ought to be using SYMBOLIC_BIND too. So
> this is what I committed.
>
> bfd/
> * elf32-arm.c (elf32_arm_final_link_relocate): Use SYMBOLIC_BIND to
> check if a symbol should be bound symbolically.
> * elf32-hppa.c (elf32_hppa_check_relocs,
> elf32_hppa_adjust_dynamic_symbol, elf32_hppa_relocate_section,
> elf32_hppa_finish_dynamic_symbol): Likewise.
> * elf32-m68k.c (elf_m68k_check_relocs,
> elf_m68k_relocate_section): Likewise.
> * elf32-nios2.c (nios2_elf32_relocate_section,
> nios2_elf32_check_relocs, allocate_dynrelocs): Likewise.
> * elf32-tic6x.c (elf32_tic6x_finish_dynamic_symbol,
> elf32_tic6x_relocate_section): Likewise.
I can't help but feeling a little abandoned...
Committed after checking cris-linux, crisv32-linux.
commit cb1c8103f13d413e05ca6e61e21b56bba3baae74
Author: Hans-Peter Nilsson <hp@bitrange.com>
Date: Mon Aug 3 20:34:51 2015 +0200
Fix "FAIL: -Bsymbolic-functions" for cris-linux in ld
* elf32-cris.c (cris_elf_relocate_section)
(elf_cris_finish_dynamic_symbol, cris_elf_check_relocs)
(elf_cris_discard_excess_dso_dynamics): Use SYMBOLIC_BIND, not
just h->symbolic, to check if a symbol should be bound
symbolically.
diff --git a/bfd/elf32-cris.c b/bfd/elf32-cris.c
index d5670ac..439ce11 100644
--- a/bfd/elf32-cris.c
+++ b/bfd/elf32-cris.c
@@ -1093,7 +1093,7 @@ cris_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
h->elf_link_hash_flags test, though it's there in
other targets. */
if (info->shared
- && ((! info->symbolic && h->dynindx != -1)
+ && ((!SYMBOLIC_BIND (info, h) && h->dynindx != -1)
|| !h->def_regular)
&& (input_section->flags & SEC_ALLOC) != 0
&& (r_type == R_CRIS_8
@@ -1212,7 +1212,7 @@ cris_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
|| h->type == STT_FUNC
|| h->needs_plt))
|| (info->shared
- && (info->symbolic || h->dynindx == -1)
+ && (SYMBOLIC_BIND (info, h) || h->dynindx == -1)
&& h->def_regular))
{
/* This wasn't checked above for ! info->shared, but
@@ -1432,7 +1432,7 @@ cris_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
&& ((r_type != R_CRIS_8_PCREL
&& r_type != R_CRIS_16_PCREL
&& r_type != R_CRIS_32_PCREL)
- || (!info->symbolic
+ || (!SYMBOLIC_BIND (info, h)
|| (h != NULL && !h->def_regular))))
{
Elf_Internal_Rela outrel;
@@ -1484,7 +1484,7 @@ cris_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
/* h->dynindx may be -1 if the symbol was marked to
become local. */
else if (h != NULL
- && ((! info->symbolic && h->dynindx != -1)
+ && ((!SYMBOLIC_BIND (info, h) && h->dynindx != -1)
|| !h->def_regular))
{
BFD_ASSERT (h->dynindx != -1);
@@ -2245,7 +2245,7 @@ elf_cris_finish_dynamic_symbol (bfd *output_bfd,
where = sgot->contents + (h->got.offset &~ (bfd_vma) 1);
if (! elf_hash_table (info)->dynamic_sections_created
|| (info->shared
- && (info->symbolic || h->dynindx == -1)
+ && (SYMBOLIC_BIND (info, h) || h->dynindx == -1)
&& h->def_regular))
{
rela.r_info = ELF32_R_INFO (0, R_CRIS_RELATIVE);
@@ -3661,7 +3661,7 @@ cris_elf_check_relocs (bfd *abfd,
this shared library) then we can also eliminate the
reloc. See comment above for more eliminable cases which
we can't identify at this time. */
- if (info->symbolic
+ if (SYMBOLIC_BIND (info, h)
&& h->root.type != bfd_link_hash_defweak
&& h->def_regular)
break;
@@ -3953,7 +3953,7 @@ elf_cris_discard_excess_dso_dynamics (struct elf_cris_link_hash_entry *h,
any relocs. */
if (h->root.def_regular
&& (h->root.forced_local
- || info->symbolic))
+ || SYMBOLIC_BIND (info, &h->root)))
{
for (s = h->pcrel_relocs_copied; s != NULL; s = s->next)
{
brgds, H-P