This is the mail archive of the
binutils@sourceware.cygnus.com
mailing list for the binutils project.
Problems with symbol versioning on MIPS/ELF
- To: binutils at sourceware dot cygnus dot com
- Subject: Problems with symbol versioning on MIPS/ELF
- From: "Maciej W. Rozycki" <macro at ds2 dot pg dot gda dot pl>
- Date: Tue, 12 Oct 1999 19:16:39 +0200 (MET DST)
- Organization: Technical University of Gdansk
Hi,
I am getting following errors from ld:
mipsel-linux-as -o symver.o symver.s
mipsel-linux-ld -shared --version-script=symver.map -o symver.so symver.o
mipsel-linux-ld: bfd assertion fail elf32-mips.c:5281
mipsel-linux-ld: bfd assertion fail elf32-mips.c:5155
mipsel-linux-ld: bfd assertion fail elf32-mips.c:5158
symver.o: In function `sym1':
symver.o(.text+0x4): relocation truncated to fit: R_MIPS_GOT16 _DYNAMIC
mipsel-linux-ld: bfd assertion fail elf32-mips.c:8169
mipsel-linux-ld: bfd assertion fail elf32-mips.c:8169
mipsel-linux-ld: bfd assertion fail elf32-mips.c:8169
mipsel-linux-ld: bfd assertion fail elf32-mips.c:8169
mipsel-linux-ld: bfd assertion fail elf32-mips.c:8169
mipsel-linux-ld: bfd assertion fail elf32-mips.c:8169
mipsel-linux-ld: bfd assertion fail elf32-mips.c:8169
mipsel-linux-ld: bfd assertion fail elf32-mips.c:8169
mipsel-linux-ld: bfd assertion fail elf32-mips.c:8169
mipsel-linux-ld: bfd assertion fail elf32-mips.c:8169
mipsel-linux-ld: bfd assertion fail elf32-mips.c:8169
mipsel-linux-ld: bfd assertion fail elf32-mips.c:8169
mipsel-linux-ld: bfd assertion fail elf32-mips.c:8169
make: *** [symver.so] Error 1
symvers.s:
.abicalls
.text
.set noreorder
.globl sym1
.type sym1,@function
.cprestore 16
sym1:
la $5,_DYNAMIC
jal sym2
nop
symver.map:
VER_1.0 {
global:
sym1;
local:
*;
};
Also if the jal opcode is absent from the above code, ld segfaults:
Program received signal SIGSEGV, Segmentation fault.
0x807fb96 in mips_elf_global_got_index (abfd=0x810e9a8, h=0x8109a70)
at elf32-mips.c:5155
5155 BFD_ASSERT (h->dynindx >= g->global_gotsym->dynindx);
(gdb) print g->global_gotsym
$14 = (struct elf_link_hash_entry *) 0x0
It looks like not all BFD structures get updated properly for symbols
that get forced to be local by a version script. I tried to track the
problem down and created a following patch that fullfills the first
assertion.
diff -u --recursive --new-file --exclude-from=.exclude binutils.macro/bfd/elflink.h binutils/bfd/elflink.h
--- binutils.macro/bfd/elflink.h Fri Oct 8 16:41:22 1999
+++ binutils/bfd/elflink.h Mon Oct 11 22:45:11 1999
@@ -3597,6 +3597,7 @@
h->elf_link_hash_flags &=~
ELF_LINK_HASH_NEEDS_PLT;
h->dynindx = -1;
+ --elf_hash_table (info)->dynsymcount;
h->plt.offset = (bfd_vma) -1;
/* FIXME: The name of the symbol has
already been recorded in the dynamic
@@ -3711,6 +3712,7 @@
h->elf_link_hash_flags |= ELF_LINK_FORCED_LOCAL;
h->elf_link_hash_flags &=~ ELF_LINK_HASH_NEEDS_PLT;
h->dynindx = -1;
+ --elf_hash_table (info)->dynsymcount;
h->plt.offset = (bfd_vma) -1;
/* FIXME: The name of the symbol has already
been recorded in the dynamic string table
@@ -3735,6 +3737,7 @@
h->elf_link_hash_flags |= ELF_LINK_FORCED_LOCAL;
h->elf_link_hash_flags &=~ ELF_LINK_HASH_NEEDS_PLT;
h->dynindx = -1;
+ --elf_hash_table (info)->dynsymcount;
h->plt.offset = (bfd_vma) -1;
/* FIXME: The name of the symbol has already been
recorded in the dynamic string table section. */
Unfortunately I don't know how to make mips_elf_local_relocation_p()
return a valid result for relocations that refer to symbols forced to be
local. Any help would be appreciated.
Maciej
--
+ Maciej W. Rozycki, Technical University of Gdansk, Poland +
+--------------------------------------------------------------+
+ e-mail: macro@ds2.pg.gda.pl, PGP key available +