From be86fae7b04f61d5b199dedb33d40fed393166e7 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Mon, 13 Dec 2010 01:06:13 +0000 Subject: * 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. --- bfd/pdp11.c | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) (limited to 'bfd/pdp11.c') diff --git a/bfd/pdp11.c b/bfd/pdp11.c index 08aab37dd9..3821037827 100644 --- a/bfd/pdp11.c +++ b/bfd/pdp11.c @@ -2601,8 +2601,8 @@ aout_link_check_ar_symbols (bfd *abfd, but not if it is defined in the .text section. That seems a bit crazy to me, and I haven't implemented it. However, it might be correct. */ - 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; @@ -2629,8 +2629,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; @@ -2682,27 +2682,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; } -- cgit v1.2.1