[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
ld mishandles R_SPARC_UA32 relocations
From: |
Michael Rauch |
Subject: |
ld mishandles R_SPARC_UA32 relocations |
Date: |
Tue, 11 Sep 2001 13:25:22 +0200 |
User-agent: |
Mutt/1.2.5i |
Hi,
a bug revealed with the use of R_SPARC_UA32 relocations currently prevents
generating C++ shared libraries.
The details:
System: NetBSD/sparc 1.5
gcc: 2.95.3
binutils: 2.11.2, emulation elf32_sparc
Take the two attached files, compile it and see it failing:
$ g++ -fPIC -shared -o libclass.so class.cpp --save-temps
$ g++ -L. -R. -lclass -o prog prog.cpp --save-temps
$ ./prog
./libclass.so: Undefined symbol "" (reloc type = 23, symnum = 9)
This same example works fine using binutils 2.10.1.
objdump --reloc class.o shows
class.o: file format elf32-sparc
RELOCATION RECORDS FOR [.eh_frame]:
OFFSET TYPE VALUE
0000001c R_SPARC_UA32 .text
while this is
0000001c R_SPARC_32 .text
for binutils 2.10.1 .
Looking at the source code I tried to find a difference between R_SPARC_32
and R_SPARC_UA32 handling, found it in bfd/elf32-sparc.c, made the
behaviour the same and that fixed the problem:
--- /aux/binutils-2.11.2/bfd/elf32-sparc.c Mon Jun 11 12:04:13 2001
+++ bfd/elf32-sparc.c Mon Sep 10 18:15:11 2001
@@ -1478,7 +1478,7 @@
}
else
{
- if (r_type == R_SPARC_32)
+ if (r_type == R_SPARC_32 || r_type == R_SPARC_UA32)
{
outrel.r_info = ELF32_R_INFO (0, R_SPARC_RELATIVE);
outrel.r_addend = relocation + rel->r_addend;
Michael
- ld mishandles R_SPARC_UA32 relocations,
Michael Rauch <=