summaryrefslogtreecommitdiff
path: root/bfd/aoutx.h
diff options
context:
space:
mode:
Diffstat (limited to 'bfd/aoutx.h')
-rw-r--r--bfd/aoutx.h24
1 files changed, 16 insertions, 8 deletions
diff --git a/bfd/aoutx.h b/bfd/aoutx.h
index 11598a000d..efa9d47431 100644
--- a/bfd/aoutx.h
+++ b/bfd/aoutx.h
@@ -3210,7 +3210,8 @@ aout_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
static bfd_boolean
aout_link_check_ar_symbols (bfd *abfd,
struct bfd_link_info *info,
- bfd_boolean *pneeded)
+ bfd_boolean *pneeded,
+ bfd **subsbfd)
{
struct external_nlist *p;
struct external_nlist *pend;
@@ -3304,7 +3305,8 @@ aout_link_check_ar_symbols (bfd *abfd,
continue;
}
- if (! (*info->callbacks->add_archive_element) (info, abfd, name))
+ if (! (*info->callbacks->add_archive_element)
+ (info, abfd, name, subsbfd))
return FALSE;
*pneeded = TRUE;
return TRUE;
@@ -3331,9 +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))
+ if (! (*info->callbacks->add_archive_element)
+ (info, abfd, name, subsbfd))
return FALSE;
*pneeded = TRUE;
return TRUE;
@@ -3381,7 +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))
+ if (! (*info->callbacks->add_archive_element)
+ (info, abfd, name, subsbfd))
return FALSE;
*pneeded = TRUE;
return TRUE;
@@ -3402,15 +3404,21 @@ aout_link_check_archive_element (bfd *abfd,
struct bfd_link_info *info,
bfd_boolean *pneeded)
{
+ bfd *subsbfd = NULL;
+
if (! aout_get_external_symbols (abfd))
return FALSE;
- if (! aout_link_check_ar_symbols (abfd, info, pneeded))
+ if (! aout_link_check_ar_symbols (abfd, info, pneeded, &subsbfd))
return FALSE;
if (*pneeded)
{
- if (! aout_link_add_symbols (abfd, info))
+ /* 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))
return FALSE;
}