Avoid 64-bit Solaris/SPARC -gstabs link failures (PR ld/12152)
Rainer Orth
ro@CeBiTec.Uni-Bielefeld.DE
Thu Mar 1 19:06:00 GMT 2012
As described in the PR, many 64-bit -gstabs* tests in the GCC testsuite
FAIL on Solaris/SPARC like this:
FAIL: gcc.dg/debug/20020220-1.c -gstabs1 (test for excess errors)
Excess errors:
/vol/gcc/src/hg/trunk/local/gcc/testsuite/gcc.dg/debug/20020220-1.c:19:(.stab+0x14): relocation truncated to fit: R_SPARC_UA32 against `.text'
and many more.
It seems this is a known issue and R_SPARC_32 relocs are already handled
in bfd/elfxx-sparc.c (_bfd_sparc_elf_relocate_section). The following
patch handles R_SPARC_UA32 in the same way and makes all those failures
go away.
Ok for mainline (and eventually the 2.22 branch)?
Rainer
2012-03-01 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
bfd:
PR ld/12152
* elfxx-sparc.c (_bfd_sparc_elf_relocate_section): Also ignore
overflows for R_SPARC_UA32 in .stab sections.
===================================================================
RCS file: RCS/elfxx-sparc.c,v
retrieving revision 1.1
diff -up -r1.1 elfxx-sparc.c
--- elfxx-sparc.c 2011/11/21 09:29:28 1.1
+++ elfxx-sparc.c 2012/02/28 17:43:57
@@ -4067,7 +4067,9 @@ do_relocation:
We don't, but this breaks stabs debugging info, whose
relocations are only 32-bits wide. Ignore overflows in
this case and also for discarded entries. */
- if ((r_type == R_SPARC_32 || r_type == R_SPARC_DISP32)
+ if ((r_type == R_SPARC_32
+ || r_type == R_SPARC_UA32
+ || r_type == R_SPARC_DISP32)
&& (((input_section->flags & SEC_DEBUGGING) != 0
&& strcmp (bfd_section_name (input_bfd,
input_section),
--
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University
More information about the Binutils
mailing list