From db0ca79ff43c1ca413646ef08baa220a79ab44f2 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Sun, 12 Dec 2010 14:52:27 +0000 Subject: [PATCH] Optimize for add_archive_element. bfd/ 2010-12-12 H.J. Lu * elflink.c (elf_link_add_archive_symbols): Remove subsbfd. ld/ 2010-12-12 H.J. Lu * ldlang.c (load_symbols): Optimize for add_archive_element. --- bfd/ChangeLog | 4 ++++ bfd/elflink.c | 7 ++----- ld/ChangeLog | 4 ++++ ld/ldlang.c | 5 ++--- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 102e0823120..602c669250a 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,7 @@ +2010-12-12 H.J. Lu + + * elflink.c (elf_link_add_archive_symbols): Remove subsbfd. + 2010-12-12 H.J. Lu * elf.c (special_sections_g): Add ".gnu.lto_". diff --git a/bfd/elflink.c b/bfd/elflink.c index 32575d900f7..a8aac7ced01 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -5011,7 +5011,6 @@ elf_link_add_archive_symbols (bfd *abfd, struct bfd_link_info *info) { struct elf_link_hash_entry *h; bfd *element; - bfd *subsbfd = NULL; struct bfd_link_hash_entry *undefs_tail; symindex mark; @@ -5075,11 +5074,9 @@ elf_link_add_archive_symbols (bfd *abfd, struct bfd_link_info *info) undefs_tail = info->hash->undefs_tail; if (! (*info->callbacks->add_archive_element) - (info, element, symdef->name, &subsbfd)) + (info, element, symdef->name, &element)) goto error_return; - /* Potentially, the add_archive_element hook may have set a - substitute BFD for us. */ - if (! bfd_link_add_symbols (subsbfd ? subsbfd : element, info)) + if (! bfd_link_add_symbols (element, info)) goto error_return; /* If there are any new undefined symbols, we need to make diff --git a/ld/ChangeLog b/ld/ChangeLog index 58b6e82032d..ca9baf83084 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,7 @@ +2010-12-12 H.J. Lu + + * ldlang.c (load_symbols): Optimize for add_archive_element. + 2010-12-09 Mike Frysinger * .gitignore: New file. diff --git a/ld/ldlang.c b/ld/ldlang.c index e804a53b84a..03a11bd8269 100644 --- a/ld/ldlang.c +++ b/ld/ldlang.c @@ -2717,15 +2717,14 @@ load_symbols (lang_input_statement_type *entry, loaded = FALSE; } - subsbfd = NULL; + subsbfd = member; if (! ((*link_info.callbacks->add_archive_element) (&link_info, member, "--whole-archive", &subsbfd))) abort (); /* Potentially, the add_archive_element hook may have set a substitute BFD for us. */ - if (! bfd_link_add_symbols (subsbfd ? subsbfd : member, - &link_info)) + if (! bfd_link_add_symbols (member, &link_info)) { einfo (_("%F%B: could not read symbols: %E\n"), member); loaded = FALSE; -- 2.30.2