FreeBSD/contrib/binutils/ld/ldmain.c
/* This is called when BFD has decided to include an archive member in
   a link.  */
This is called when BFD has decided to include an archive member in
a link.
This is called when BFD has decided to include an archive member in a link .
static bfd_boolean
add_archive_element (struct bfd_link_info *info,
		     bfd *abfd,
		     const char *name)
{
  lang_input_statement_type *input;
  input = xmalloc (sizeof (lang_input_statement_type));
  input->filename = abfd->filename;
  input->local_sym_name = abfd->filename;
  input->the_bfd = abfd;
  input->asymbols = NULL;
  input->next = NULL;
  input->just_syms_flag = FALSE;
  input->loaded = FALSE;
  input->search_dirs_flag = FALSE;
  ldlang_add_file (input);
  if (config.map_file != NULL)
    {
      static bfd_boolean header_printed;
      struct bfd_link_hash_entry *h;
      bfd *from;
      int len;
      h = bfd_link_hash_lookup (info->hash, name, FALSE, FALSE, TRUE);
      if (h == NULL)
	from = NULL;
      else
	{
	  switch (h->type)
	    {
	    default:
	      from = NULL;
	      break;
	    case bfd_link_hash_defined:
	    case bfd_link_hash_defweak:
	      from = h->u.def.section->owner;
	      break;
	    case bfd_link_hash_undefined:
	    case bfd_link_hash_undefweak:
	      from = h->u.undef.abfd;
	      break;
	    case bfd_link_hash_common:
	      from = h->u.c.p->section->owner;
	      break;
	    }
	}
      if (! header_printed)
	{
	  char buf[100];
	  sprintf (buf, _("Archive member included because of file (symbol)\n\n"));
	  minfo ("%s", buf);
	  header_printed = TRUE;
	}
      if (bfd_my_archive (abfd) == NULL)
	{
	  minfo ("%s", bfd_get_filename (abfd));
	  len = strlen (bfd_get_filename (abfd));
	}
      else
	{
	  minfo ("%s(%s)", bfd_get_filename (bfd_my_archive (abfd)),
		 bfd_get_filename (abfd));
	  len = (strlen (bfd_get_filename (bfd_my_archive (abfd)))
		 + strlen (bfd_get_filename (abfd))
		 + 2);
	}
      if (len >= 29)
	{
	  print_nl ();
	  len = 0;
	}
      while (len < 30)
	{
	  print_space ();
	  ++len;
	}
      if (from != NULL)
	minfo ("%B ", from);
      if (h != NULL)
	minfo ("(%T)\n", h->root.string);
      else
	minfo ("(%s)\n", name);
    }
  if (trace_files || trace_file_tries)
    info_msg ("%I\n", input);
  return TRUE;
}
static bfd_boolean add_archive_element ( struct bfd_link_info * info , bfd * abfd , const char * name ) { lang_input_statement_type * input ; input = xmalloc ( sizeof ( lang_input_statement_type ) ) ; input -> filename = abfd -> filename ; input -> local_sym_name = abfd -> filename ; input -> the_bfd = abfd ; input -> asymbols = NULL ; input -> next = NULL ; input -> just_syms_flag = FALSE ; input -> loaded = FALSE ; input -> search_dirs_flag = FALSE ; ldlang_add_file ( input ) ; if ( config . map_file != NULL ) { static bfd_boolean header_printed ; struct bfd_link_hash_entry * h ; bfd * from ; int len ; h = bfd_link_hash_lookup ( info -> hash , name , FALSE , FALSE , TRUE ) ; if ( h == NULL ) from = NULL ; else { switch ( h -> type ) { default : from = NULL ; break ; case bfd_link_hash_defined : case bfd_link_hash_defweak : from = h -> u . def . section -> owner ; break ; case bfd_link_hash_undefined : case bfd_link_hash_undefweak : from = h -> u . undef . abfd ; break ; case bfd_link_hash_common : from = h -> u . c . p -> section -> owner ; break ; } } if ( ! header_printed ) { char buf [ 100 ] ; sprintf ( buf , _ ( " \n \n " ) ) ; minfo ( " " , buf ) ; header_printed = TRUE ; } if ( bfd_my_archive ( abfd ) == NULL ) { minfo ( " " , bfd_get_filename ( abfd ) ) ; len = strlen ( bfd_get_filename ( abfd ) ) ; } else { minfo ( " " , bfd_get_filename ( bfd_my_archive ( abfd ) ) , bfd_get_filename ( abfd ) ) ; len = ( strlen ( bfd_get_filename ( bfd_my_archive ( abfd ) ) ) + strlen ( bfd_get_filename ( abfd ) ) + 2 ) ; } if ( len >= 29 ) { print_nl ( ) ; len = 0 ; } while ( len < 30 ) { print_space ( ) ; ++ len ; } if ( from != NULL ) minfo ( " " , from ) ; if ( h != NULL ) minfo ( " \n " , h -> root . string ) ; else minfo ( " \n " , name ) ; } if ( trace_files || trace_file_tries ) info_msg ( " \n " , input ) ; return TRUE ; }
This is called when BFD has decided to include an archive member in
a link.
This is called when BFD has decided to include an archive member in a link .
/* FIXME: The following fields are not set: header.next,
     header.type, closed, passive_position, symbol_count,
     next_real_file, is_archive, target, real.  This bit of code is
     from the old decode_library_subfile function.  I don't know
     whether any of those fields matters.  */