Bug 12152 - Many 64-bit Solaris/SPARC gcc -gstabs testcases fail to link
Summary: Many 64-bit Solaris/SPARC gcc -gstabs testcases fail to link
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: ld (show other bugs)
Version: 2.21
: P2 normal
Target Milestone: ---
Assignee: Rainer Orth
URL: http://sourceware.org/ml/binutils/201...
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-22 10:30 UTC by Rainer Orth
Modified: 2012-03-05 16:03 UTC (History)
0 users

See Also:
Host: sparc-sun-solaris2.10
Target: sparc-sun-solaris2.10
Build: sparc-sun-solaris2.10
Last reconfirmed:


Attachments
assembler output for testcase (1.32 KB, text/plain)
2010-10-22 10:30 UTC, Rainer Orth
Details
corresponding object file (1.34 KB, application/octet-stream)
2010-10-22 10:32 UTC, Rainer Orth
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Rainer Orth 2010-10-22 10:30:40 UTC
Created attachment 5077 [details]
assembler output for testcase

When comparing GCC mainline testsuite results on Solaris 10/SPARC with either Sun
ld or mainline GNU ld (2.20.51.20101021), many (all) 64-bit -gstabs* testcases
fail to link:

spawn /var/gcc/regression/trunk/10-gcc-gas-gld-cvs/build/gcc/xgcc -B/var/gcc/regression/trunk/10-gcc-gas-gld-cvs/build/gcc/ /vol/gcc/src/hg/trunk/local/gcc/testsuite/gcc.dg/debug/20020220-1.c -gstabs1 -lm -m64 -o ./20020220-1.exe

/var/tmp//ccOgZAdZ.o: In function `bar':

/vol/gcc/src/hg/trunk/local/gcc/testsuite/gcc.dg/debug/20020220-1.c:19: relocation truncated to fit: R_SPARC_UA32 against `.text'

/vol/gcc/src/hg/trunk/local/gcc/testsuite/gcc.dg/debug/20020220-1.c:23: relocation truncated to fit: R_SPARC_UA32 against symbol `foo' defined in .text section in /var/tmp//ccOgZAdZ.o

/vol/gcc/src/hg/trunk/local/gcc/testsuite/gcc.dg/debug/20020220-1.c:24: relocation truncated to fit: R_SPARC_UA32 against symbol `bar' defined in .text section in /var/tmp//ccOgZAdZ.o

/var/tmp//ccOgZAdZ.o: In function `main':

/vol/gcc/src/hg/trunk/local/gcc/testsuite/gcc.dg/debug/20020220-1.c:29: relocation truncated to fit: R_SPARC_UA32 against symbol `main' defined in .text section in /var/tmp//ccOgZAdZ.o

/vol/gcc/src/hg/trunk/local/gcc/testsuite/gcc.dg/debug/20020220-1.c:31: relocation truncated to fit: R_SPARC_UA32 against `.text'

collect2: ld returned 1 exit status


Linking the same object file with Sun ld instead just works.

$ gld-2.20.51 -V -m elf64_sparc_sol2 -Y P,/usr/lib/sparcv9 -rpath-link /usr/lib/sparcv9 -Qy -o ./20020220-1.exe /var/gcc/regression/trunk/10-gcc-gas-gld-cvs/build/gcc/sparcv9/crt1.o /var/gcc/regression/trunk/10-gcc-gas-gld-cvs/build/gcc/sparcv9/crti.o /usr/ccs/lib/sparcv9/values-Xa.o /var/gcc/regression/trunk/10-gcc-gas-gld-cvs/build/gcc/sparcv9/crtbegin.o -L/var/gcc/regression/trunk/10-gcc-gas-gld-cvs/build/gcc/sparcv9 -L/usr/ccs/lib/sparcv9 -L/lib/sparcv9 -L/usr/lib/sparcv9 -L/var/gcc/regression/trunk/10-gcc-gas-gld-cvs/build/gcc -L/usr/ccs/lib 20020220-1.o -lm -lgcc -lgcc_eh -lc -lgcc -lgcc_eh -lc /var/gcc/regression/trunk/10-gcc-gas-gld-cvs/build/gcc/sparcv9/crtend.o /var/gcc/regression/trunk/10-gcc-gas-gld-cvs/build/gcc/sparcv9/crtn.o
GNU ld (GNU Binutils) 2.20.51.20101021
  Supported emulations:
   elf32_sparc_sol2
   elf32_sparc
   elf64_sparc_sol2
   elf64_sparc
20020220-1.o: In function `bar':
/vol/gcc/src/hg/trunk/local/gcc/testsuite/gcc.dg/debug/20020220-1.c:19: relocation truncated to fit: R_SPARC_UA32 against `.text'
/vol/gcc/src/hg/trunk/local/gcc/testsuite/gcc.dg/debug/20020220-1.c:23: relocation truncated to fit: R_SPARC_UA32 against symbol `foo' defined in .text section in 20020220-1.o
/vol/gcc/src/hg/trunk/local/gcc/testsuite/gcc.dg/debug/20020220-1.c:24: relocation truncated to fit: R_SPARC_UA32 against symbol `bar' defined in .text section in 20020220-1.o
20020220-1.o: In function `main':
/vol/gcc/src/hg/trunk/local/gcc/testsuite/gcc.dg/debug/20020220-1.c:29: relocation truncated to fit: R_SPARC_UA32 against symbol `main' defined in .text section in 20020220-1.o
/vol/gcc/src/hg/trunk/local/gcc/testsuite/gcc.dg/debug/20020220-1.c:31: relocation truncated to fit: R_SPARC_UA32 against `.text'
$ ld -V -Y P,/usr/lib/sparcv9 -R /usr/lib/sparcv9 -Qy -o ./20020220-1.exe /var/gcc/regression/trunk/10-gcc-gas-gld-cvs/build/gcc/sparcv9/crt1.o /var/gcc/regression/trunk/10-gcc-gas-gld-cvs/build/gcc/sparcv9/crti.o /usr/ccs/lib/sparcv9/values-Xa.o /var/gcc/regression/trunk/10-gcc-gas-gld-cvs/build/gcc/sparcv9/crtbegin.o -L/var/gcc/regression/trunk/10-gcc-gas-gld-cvs/build/gcc/sparcv9 -L/usr/ccs/lib/sparcv9 -L/lib/sparcv9 -L/usr/lib/sparcv9 -L/var/gcc/regression/trunk/10-gcc-gas-gld-cvs/build/gcc -L/usr/ccs/lib 20020220-1.o -lm -lgcc -lgcc_eh -lc -lgcc -lgcc_eh -lc /var/gcc/regression/trunk/10-gcc-gas-gld-cvs/build/gcc/sparcv9/crtend.o /var/gcc/regression/trunk/10-gcc-gas-gld-cvs/build/gcc/sparcv9/crtn.o
ld: Software Generation Utilities - Solaris Link Editors: 5.10-1.497

I'm attaching the .s and .o files for investigation.
Comment 1 Rainer Orth 2010-10-22 10:32:03 UTC
Created attachment 5078 [details]
corresponding object file
Comment 2 Rainer Orth 2012-03-01 19:06:54 UTC
Patch submitted.
Comment 3 cvs-commit@gcc.gnu.org 2012-03-05 16:02:27 UTC
CVSROOT:	/cvs/src
Module name:	src
Changes by:	ro@sourceware.org	2012-03-05 16:02:20

Modified files:
	bfd            : ChangeLog elfxx-sparc.c 

Log message:
	PR ld/12152
	* elfxx-sparc.c (_bfd_sparc_elf_relocate_section): Also ignore
	overflows for R_SPARC_UA32 in .stab sections.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/ChangeLog.diff?cvsroot=src&r1=1.5620&r2=1.5621
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elfxx-sparc.c.diff?cvsroot=src&r1=1.62&r2=1.63
Comment 4 Rainer Orth 2012-03-05 16:03:59 UTC
Fixed for 2.23.