This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
RFC: Fix -Bsymbolic-functions for SPARC
- From: Nick Clifton <nickc at redhat dot com>
- To: davem at davemloft dot net
- Cc: binutils at sourceware dot org
- Date: Thu, 01 Oct 2015 17:47:11 +0100
- Subject: RFC: Fix -Bsymbolic-functions for SPARC
- Authentication-results: sourceware.org; auth=none
Hi David,
The linker test that checks the -Bsymbolic-functions option is failing
for SPARC targets. The test fails because the linker creates an
R_SPARC_32 reloc against "fun" rather than a RELATIVE reloc or an ADDR
reloc against .text.
Tracing the problem back through the linker lead me to the code in
_bfd_sparc_elf_relocate_section where it checks to see if a reloc
should be preserved or converted. This then lead to the following
patch. It works for the linker test, but I am not familiar enough
with the SPARC API to know if there might be a problem with the
change.
The patch itself is simple enough - it replaces the "! is_plt" part of
the check with a test for PC relative relocs. This matches the
behaviour of the x86_64 version of the same function, but is it
correct for the SPARC ?
Cheers
Nick
diff --git a/bfd/elfxx-sparc.c b/bfd/elfxx-sparc.c
index db0d4f18..f85703e 100644
--- a/bfd/elfxx-sparc.c
+++ b/bfd/elfxx-sparc.c
@@ -3470,7 +3470,7 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd,
become local. */
else if (h != NULL &&
h->dynindx != -1
- && (! is_plt
+ && (_bfd_sparc_elf_howto_table[r_type].pc_relative
|| !bfd_link_pic (info)
|| !SYMBOLIC_BIND (info, h)
|| !h->def_regular))