public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: "Maciej W. Rozycki" <macro@ds2.pg.gda.pl>
To: binutils@sourceware.cygnus.com
Subject: Problems with symbol versioning on MIPS/ELF
Date: Tue, 12 Oct 1999 10:17:00 -0000	[thread overview]
Message-ID: <Pine.GSO.3.96.991012184750.15112C-100000@delta.DS2.net> (raw)

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        +

                 reply	other threads:[~1999-10-12 10:17 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.GSO.3.96.991012184750.15112C-100000@delta.DS2.net \
    --to=macro@ds2.pg.gda.pl \
    --cc=binutils@sourceware.cygnus.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).