Turns out that clang generates R_SPARC_WPLT30 relocations against
local symbols, which our binutils doesn't handle.  Since the Solaris
native assembler produces such relocations (and expects them to be
handled as R_SPARC_WDISP30) and newer binutils handles them as well, I
think we should as well.  The diff below fixes the issue expressed in
a slightly different way as the fix that ended up in newer binutils
versions.

ok?


Index: gnu/usr.bin/binutils-2.17/bfd/elfxx-sparc.c
===================================================================
RCS file: /cvs/src/gnu/usr.bin/binutils-2.17/bfd/elfxx-sparc.c,v
retrieving revision 1.6
diff -u -p -r1.6 elfxx-sparc.c
--- gnu/usr.bin/binutils-2.17/bfd/elfxx-sparc.c 3 Sep 2016 10:03:26 -0000       
1.6
+++ gnu/usr.bin/binutils-2.17/bfd/elfxx-sparc.c 14 Apr 2017 13:12:03 -0000
@@ -1280,6 +1280,8 @@ _bfd_sparc_elf_check_relocs (bfd *abfd, 
                    goto r_sparc_plt32;
                  break;
                }
+             else if (r_type == R_SPARC_WPLT30)
+               break;
 
              /* It does not make sense to have a procedure linkage
                  table entry for a local symbol.  */
@@ -2676,6 +2678,11 @@ _bfd_sparc_elf_relocate_section (bfd *ou
                 for a local symbol if you assemble a call from one
                 section to another when using -K pic.  We treat it as
                 WDISP30.  */
+             if (h == NULL)
+               break;
+           }
+         else if (r_type == R_SPARC_WPLT30)
+           {
              if (h == NULL)
                break;
            }

Reply via email to