This is the mail archive of the
binutils@sourceware.cygnus.com
mailing list for the binutils project.
Patch to recent ELF linker enhancement
- To: binutils at sourceware dot cygnus dot com
- Subject: Patch to recent ELF linker enhancement
- From: Nick Clifton <nickc at cygnus dot com>
- Date: Mon, 13 Dec 1999 17:09:46 -0800
Hi Guys,
Below is a patch to my recent change to the ELF linker to cope with
commons defined in archives. This patch prevents the linker from
trying to link in the same archive element twice if it happens to
contain the definition of a common symbol.
OK to apply ?
Cheers
Nick
1999-12-13 Nick Clifton <nickc@cygnus.com>
* elflink.h (elf_link_add_archive_symbols): Do not bother
checking for defined commons if the element has already been
linked in.
Index: elflink.h
===================================================================
RCS file: /cvs/cvsfiles/devo/bfd/elflink.h,v
retrieving revision 1.140
diff -p -r1.140 elflink.h
*** elflink.h 1999/12/10 12:18:52 1.140
- --- elflink.h 1999/12/14 00:54:06
*************** elf_link_add_archive_symbols (abfd, info
*** 291,296 ****
- --- 291,298 ----
if (h == NULL)
continue;
+ element = _bfd_get_elt_at_filepos (abfd, symdef->file_offset);
+
if (h->root.type == bfd_link_hash_common)
{
/* We currently have a common symbol. The archive map contains
*************** elf_link_add_archive_symbols (abfd, info
*** 305,311 ****
map alone. Instead we must read in the element's symbol
table and check that to see what kind of symbol definition
this is. */
! if (! elf_link_is_defined_archive_symbol (abfd, symdef))
continue;
}
else if (h->root.type != bfd_link_hash_undefined)
- --- 307,314 ----
map alone. Instead we must read in the element's symbol
table and check that to see what kind of symbol definition
this is. */
! if ((element && element->archive_pass != 0)
! || ! elf_link_is_defined_archive_symbol (abfd, symdef))
continue;
}
else if (h->root.type != bfd_link_hash_undefined)
*************** elf_link_add_archive_symbols (abfd, info
*** 316,323 ****
}
/* We need to include this archive member. */
- -
- - element = _bfd_get_elt_at_filepos (abfd, symdef->file_offset);
if (element == (bfd *) NULL)
goto error_return;
- --- 319,324 ----