This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
elf refcount initializer breaks mips-irix6 linking
- From: Alexandre Oliva <aoliva at redhat dot com>
- To: binutils at sources dot redhat dot com
- Date: 19 Nov 2002 16:53:08 -0200
- Subject: elf refcount initializer breaks mips-irix6 linking
- Organization: GCC Team, Red Hat
_bfd_elf_link_hash_table_init would initialize the hashtable's
init_refcount with 0xffffffff, instead of (signed_bfd_vma)-1. That's
because can_refcount was (unsigned)0, from which 1 was subtracted
resulting (unsigned)-1, then zero-extended to (signed_bfd_vma). This
caused problems to the mips linker, that used MINUS_ONE (defined as
(((bfd_vma)0) - 1) to check for got offsets (got.refcount and
got.offset are members of a union, initialized to init_refcount).
This patch fixes the problem that causes the initializer of
got.refcount of every hashtable member to be miscomputed. I'm getting
closer to getting irix to bootstrap, but I'm not quite there yet, so
this hasn't got as much testing as a full bootstrap of the toolchain
:-( Also, this has some potential for breaking other targets that,
unlike mips, fail to use a properly-extended MINUS_ONE constant. I
haven't looked for those.
Ok to install?
Index: bfd/ChangeLog
from Alexandre Oliva <aoliva@redhat.com>
* elf.c (_bfd_elf_link_hash_table_init): Make sure
can_refcount is properly extended to the type of
init_refcount.
Index: bfd/elf.c
===================================================================
RCS file: /cvs/src/src/bfd/elf.c,v
retrieving revision 1.168
diff -u -p -r1.168 elf.c
--- bfd/elf.c 12 Nov 2002 07:35:26 -0000 1.168
+++ bfd/elf.c 19 Nov 2002 18:49:18 -0000
@@ -1503,7 +1503,10 @@ _bfd_elf_link_hash_table_init (table, ab
table->dynamic_sections_created = false;
table->dynobj = NULL;
- table->init_refcount = get_elf_backend_data (abfd)->can_refcount - 1;
+ /* Make sure can_refcount is extended to the width and signedness of
+ init_refcount before we subtract one from it. */
+ table->init_refcount = get_elf_backend_data (abfd)->can_refcount;
+ --table->init_refcount;
/* The first dynamic symbol is a dummy. */
table->dynsymcount = 1;
table->dynstr = NULL;
--
Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer aoliva@{redhat.com, gcc.gnu.org}
CS PhD student at IC-Unicamp oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist Professional serial bug killer