forked from Imagelibrary/binutils-gdb
include/
* bfdlink.h (bfd_link_repair_undef_list): Declare. bfd/ * elf64-ppc.c (ppc64_elf_check_directives): Move undefs list fixup.. * linker.c (bfd_link_repair_undef_list): ..to new function, but don't remove anything but new and undefweak. * elflink.c (_bfd_elf_link_create_dynamic_sections): Override any existing _DYNAMIC. (_bfd_elf_create_dynamic_sections): Formatting. (bfd_elf_record_link_assignment): Call bfd_link_repair_undef_list. (_bfd_elf_merge_symbol): Don't handle as-needed syms here. (struct elf_smash_data): New. (elf_smash_syms): New function. (elf_link_add_object_symbols): Call elf_smash_syms. Don't add unneeded dynamic objects to loaded list. (elf_link_output_extsym): Don't handle as-needed here. Strip bfd_link_hash_new symbols. * elf32-cris.c (elf_cris_discard_excess_program_dynamics): Don't delref when dynindx is already -1. * elf64-alpha.c (elf64_alpha_output_extsym): Strip bfd_link_hash_new symbols. * elfxx-mips.c (mips_elf_output_extsym): Likewise. ld/ * ld.texinfo: Clarify --as-needed operation.
This commit is contained in:
41
bfd/linker.c
41
bfd/linker.c
@@ -1,6 +1,6 @@
|
||||
/* linker.c -- BFD linker routines
|
||||
Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
2003, 2004 Free Software Foundation, Inc.
|
||||
2003, 2004, 2005 Free Software Foundation, Inc.
|
||||
Written by Steve Chamberlain and Ian Lance Taylor, Cygnus Support
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
@@ -623,6 +623,45 @@ bfd_link_add_undef (struct bfd_link_hash_table *table,
|
||||
table->undefs = h;
|
||||
table->undefs_tail = h;
|
||||
}
|
||||
|
||||
/* The undefs list was designed so that in normal use we don't need to
|
||||
remove entries. However, if symbols on the list are changed from
|
||||
bfd_link_hash_undefined to either bfd_link_hash_undefweak or
|
||||
bfd_link_hash_new for some reason, then they must be removed from the
|
||||
list. Failure to do so might result in the linker attempting to add
|
||||
the symbol to the list again at a later stage. */
|
||||
|
||||
void
|
||||
bfd_link_repair_undef_list (struct bfd_link_hash_table *table)
|
||||
{
|
||||
struct bfd_link_hash_entry **pun;
|
||||
|
||||
pun = &table->undefs;
|
||||
while (*pun != NULL)
|
||||
{
|
||||
struct bfd_link_hash_entry *h = *pun;
|
||||
|
||||
if (h->type == bfd_link_hash_new
|
||||
|| h->type == bfd_link_hash_undefweak)
|
||||
{
|
||||
*pun = h->u.undef.next;
|
||||
h->u.undef.next = NULL;
|
||||
if (h == table->undefs_tail)
|
||||
{
|
||||
if (pun == &table->undefs)
|
||||
table->undefs_tail = NULL;
|
||||
else
|
||||
/* pun points at an u.undef.next field. Go back to
|
||||
the start of the link_hash_entry. */
|
||||
table->undefs_tail = (struct bfd_link_hash_entry *)
|
||||
((char *) pun - ((char *) &h->u.undef.next - (char *) h));
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
pun = &h->u.undef.next;
|
||||
}
|
||||
}
|
||||
|
||||
/* Routine to create an entry in a generic link hash table. */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user