/* BFD back-end for PDP-11 a.out binaries.
- Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009
+ Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
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;
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))
+ if (!(*info->callbacks
+ ->add_archive_element) (info, abfd, name, subsbfd))
return FALSE;
*pneeded = TRUE;
return TRUE;
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;
struct bfd_link_info *info,
bfd_boolean *pneeded)
{
- if (! aout_get_external_symbols (abfd))
+ bfd *oldbfd;
+ bfd_boolean needed;
+
+ if (!aout_get_external_symbols (abfd))
return FALSE;
- if (! aout_link_check_ar_symbols (abfd, info, pneeded))
+ oldbfd = abfd;
+ if (!aout_link_check_ar_symbols (abfd, info, pneeded, &abfd))
return FALSE;
- if (*pneeded)
+ needed = *pneeded;
+ if (needed)
{
- if (! aout_link_add_symbols (abfd, info))
+ /* Potentially, the add_archive_element hook may have set a
+ substitute BFD for us. */
+ 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;
}
switch (type)
{
default:
- abort ();
+ /* Anything else should be a debugging symbol. */
+ BFD_ASSERT ((type & N_STAB) != 0);
+ continue;
case N_UNDF:
case N_ABS:
char *strings;
struct aout_link_hash_entry **sym_hashes;
int *symbol_map;
- bfd_size_type reloc_count;
bfd_byte *rel;
bfd_byte *rel_end;
sym_hashes = obj_aout_sym_hashes (input_bfd);
symbol_map = finfo->symbol_map;
- reloc_count = rel_size / RELOC_SIZE;
rel = relocs;
rel_end = rel + rel_size;
for (; rel < rel_end; rel += RELOC_SIZE)
static bfd_boolean
aout_link_input_bfd (struct aout_final_link_info *finfo, bfd *input_bfd)
{
- bfd_size_type sym_count;
-
BFD_ASSERT (bfd_get_format (input_bfd) == bfd_object);
/* If this is a dynamic object, it may need special handling. */
if (! aout_get_external_symbols (input_bfd))
return FALSE;
- sym_count = obj_aout_external_sym_count (input_bfd);
-
/* Write out the symbols and get a map of the new indices. The map
is placed into finfo->symbol_map. */
if (! aout_link_write_symbols (finfo, input_bfd))