[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
binutils 2.16.1 assembler dwarf2 relocations break solaris native ld
From: |
Andrew Morrow |
Subject: |
binutils 2.16.1 assembler dwarf2 relocations break solaris native ld |
Date: |
Thu, 11 Aug 2005 19:32:22 -0400 |
All of the following is on Solaris 9 SPARC, using binutils-2.16.1.
These are the entire contents of os_SunOS.s from NSPR 4.6.0:
/*
* sol_getsp()
*
* Return the current sp (for debugging)
*/
.global sol_getsp
sol_getsp:
retl
mov %sp, %o0
/*
* sol_curthread()
*
* Return a unique identifier for the currently active thread.
*/
.global sol_curthread
sol_curthread:
retl
mov %g7, %o0
.global __MD_FlushRegisterWindows
.global _MD_FlushRegisterWindows
__MD_FlushRegisterWindows:
_MD_FlushRegisterWindows:
ta 3
ret
restore
When driving the binutils-2.16.1 assembler through gcc-4.0.1 with
/usr/local/gcc-4.0.1/bin/gcc -g -fPIC file.s -c -o file.o
gcc plans to invoke gas as follows:
"/usr/local/binutils-2.16.1/bin/as" "--gdwarf2" "--traditional-format"
"-Qy" "-s" "-K" "PIC" "-xarch=v8" "-o" "file.o" "file.s"
In the generated object file relocations for the debug info are marked
as R_SPARC_32:
Relocation section '.rela.debug_line' at offset 0x4cc contains 1 entries:
Offset Info Type Sym.Value Sym. Name + Addend
00000027 00000103 R_SPARC_32 00000000 .text + 0
Relocation section '.rela.debug_info' at offset 0x4d8 contains 4 entries:
Offset Info Type Sym.Value Sym. Name + Addend
00000006 00000503 R_SPARC_32 00000000 .debug_abbrev + 0
0000000c 00000603 R_SPARC_32 00000000 .debug_line + 0
00000010 00000103 R_SPARC_32 00000000 .text + 0
00000014 00000103 R_SPARC_32 00000000 .text + 1c
Relocation section '.rela.debug_aranges' at offset 0x508 contains 2 entries:
Offset Info Type Sym.Value Sym. Name + Addend
00000006 00000403 R_SPARC_32 00000000 .debug_info + 0
00000010 00000103 R_SPARC_32 00000000 .text + 0
The binutils linker is fine building a shared library from this object file:
/usr/local/binutils-2.16.1/bin/ld -shared file.o -o file.so
but trying to link this into a shared library with the solaris native
ld does not go well at all:
/usr/ccs/bin/ld -G file.o -o file.so
ld: fatal: relocation error: R_SPARC_32: file file.o: symbol
<unknown>: offset 0xff1904ef is non-aligned
ld: fatal: relocation error: R_SPARC_32: file file.o: symbol
<unknown>: offset 0xff190509 is non-aligned
ld: fatal: relocation error: R_SPARC_32: file file.o: symbol
<unknown>: offset 0xff19050f is non-aligned
ld: fatal: relocation error: R_SPARC_32: file file.o: symbol
<unknown>: offset 0xff190513 is non-aligned
ld: fatal: relocation error: R_SPARC_32: file file.o: symbol
<unknown>: offset 0xff190517 is non-aligned
ld: fatal: relocation error: R_SPARC_32: file file.o: symbol
<unknown>: offset 0xff19057e is non-aligned
If I re-run the assembly step with any of -gstabs, -gstabs+ or no
debugging selected at all, the solaris linker is fine, so this seems
to be specific to --gdwarf2.
So who is right here? Is there really an alignment problem with the
debug sections in the object file, or is the solaris linker just
confused? If there is a problem, why doesn't binutils ld complain?
Any ideas?
Thanks,
Andrew
- binutils 2.16.1 assembler dwarf2 relocations break solaris native ld,
Andrew Morrow <=