diff options
author | Alan Modra <amodra@gmail.com> | 2010-12-13 01:06:16 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2010-12-13 01:06:16 +0000 |
commit | 0e144ba71eacb7e00bff43fc66b707bd7f029c44 (patch) | |
tree | 4621646a912052f57c9a89b413e6d3c0f37c857d /bfd/aoutx.h | |
parent | 8d4f41361d6fff0e879d97f2583dbcbec8bf50c0 (diff) | |
download | gdb-0e144ba71eacb7e00bff43fc66b707bd7f029c44.zip gdb-0e144ba71eacb7e00bff43fc66b707bd7f029c44.tar.gz gdb-0e144ba71eacb7e00bff43fc66b707bd7f029c44.tar.bz2 |
* aoutx.h (aout_link_check_ar_symbols): Formatting.
* cofflink.c (coff_link_check_ar_symbols): Likewise.
* elflink.c (elf_link_add_archive_symbols): Likewise.
* pdp11.c (aout_link_check_ar_symbols): Likewise.
* xcofflink.c (xcoff_link_check_dynamic_ar_symbols,
xcoff_link_check_dynamic_ar_symbols): Likewise.
* aoutx.h (aout_link_check_archive_element): Simplify code dealing
with add_archive_element substitute BFD.
* cofflink.c (coff_link_check_archive_element): Likewise.
* ecoff.c (ecoff_link_check_archive_element): Likewise.
(ecoff_link_add_archive_symbols): Likewise.
* linker.c (generic_link_check_archive_element): Likewise.
* pdp11.c (aout_link_check_archive_element): Likewise.
* vms-alpha.c (alpha_vms_link_add_archive_symbols): Likewise.
* xcofflink.c (xcoff_link_check_archive_element): Likewise.
* aoutx.h (aout_link_check_archive_element): Free symbols from old
bfd if !keep_memory.
* cofflink.c (coff_link_check_archive_element): Likewise.
* pdp11.c (aout_link_check_archive_element): Likewise.
* xcofflink.c (xcoff_link_check_archive_element): Likewise.
Diffstat (limited to 'bfd/aoutx.h')
-rw-r--r-- | bfd/aoutx.h | 43 |
1 files changed, 26 insertions, 17 deletions
diff --git a/bfd/aoutx.h b/bfd/aoutx.h index efa9d47..7ca221e 100644 --- a/bfd/aoutx.h +++ b/bfd/aoutx.h @@ -3305,8 +3305,8 @@ aout_link_check_ar_symbols (bfd *abfd, continue; } - if (! (*info->callbacks->add_archive_element) - (info, abfd, name, subsbfd)) + if (!(*info->callbacks + ->add_archive_element) (info, abfd, name, subsbfd)) return FALSE; *pneeded = TRUE; return TRUE; @@ -3333,8 +3333,8 @@ aout_link_check_ar_symbols (bfd *abfd, outside BFD. We assume that we should link in the object file. This is done for the -u option in the linker. */ - if (! (*info->callbacks->add_archive_element) - (info, abfd, name, subsbfd)) + if (!(*info->callbacks + ->add_archive_element) (info, abfd, name, subsbfd)) return FALSE; *pneeded = TRUE; return TRUE; @@ -3343,8 +3343,8 @@ aout_link_check_ar_symbols (bfd *abfd, symbol. It is already on the undefs list. */ h->type = bfd_link_hash_common; h->u.c.p = (struct bfd_link_hash_common_entry *) - bfd_hash_allocate (&info->hash->table, - sizeof (struct bfd_link_hash_common_entry)); + bfd_hash_allocate (&info->hash->table, + sizeof (struct bfd_link_hash_common_entry)); if (h->u.c.p == NULL) return FALSE; @@ -3382,8 +3382,8 @@ aout_link_check_ar_symbols (bfd *abfd, it if the current link symbol is common. */ if (h->type == bfd_link_hash_undefined) { - if (! (*info->callbacks->add_archive_element) - (info, abfd, name, subsbfd)) + if (!(*info->callbacks + ->add_archive_element) (info, abfd, name, subsbfd)) return FALSE; *pneeded = TRUE; return TRUE; @@ -3404,27 +3404,36 @@ aout_link_check_archive_element (bfd *abfd, struct bfd_link_info *info, bfd_boolean *pneeded) { - bfd *subsbfd = NULL; + bfd *oldbfd; + bfd_boolean needed; - if (! aout_get_external_symbols (abfd)) + if (!aout_get_external_symbols (abfd)) return FALSE; - if (! aout_link_check_ar_symbols (abfd, info, pneeded, &subsbfd)) + oldbfd = abfd; + if (!aout_link_check_ar_symbols (abfd, info, pneeded, &abfd)) return FALSE; - if (*pneeded) + needed = *pneeded; + if (needed) { /* Potentially, the add_archive_element hook may have set a substitute BFD for us. */ - if (subsbfd && !aout_get_external_symbols (subsbfd)) - return FALSE; - if (! aout_link_add_symbols (subsbfd ? subsbfd : abfd, info)) + if (abfd != oldbfd) + { + if (!info->keep_memory + && !aout_link_free_symbols (oldbfd)) + return FALSE; + if (!aout_get_external_symbols (abfd)) + return FALSE; + } + if (!aout_link_add_symbols (abfd, info)) return FALSE; } - if (! info->keep_memory || ! *pneeded) + if (!info->keep_memory || !needed) { - if (! aout_link_free_symbols (abfd)) + if (!aout_link_free_symbols (abfd)) return FALSE; } |