This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: Optimize add_archive_element call


On Fri, Dec 10, 2010 at 03:13:40PM -0800, H.J. Lu wrote:
> On Fri, Dec 10, 2010 at 2:37 PM, Alan Modra <amodra@gmail.com> wrote:
> > On Fri, Dec 10, 2010 at 05:48:44AM -0800, H.J. Lu wrote:
> >> Hi,
> >>
> >> Before we call add_archive_element, we set subsbfd to NULL and
> >> check if it is changed after add_archive_element returns. ?This
> >> patch sets subsbfd to the unchanged value and avoids the check.
> >> OK to install?
> >
> > Why not get rid of subsbfd entirely?
> >
> > ? ? ? ? ?if (! (*info->callbacks->add_archive_element)
> > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?(info, element, symdef->name, &element))
> >
> 
> Like this?

Yes, but the same in ldlang.c too.  It's true that "member" is used
later, but I think that is a bug.  Better to report an error against
the actual file that caused the problem.

Like the following, which does the same for other backends too.
Also fixes freeing of external symbols when !keep_memory, which may
lead to a real bug for xcoff.  The formatting changes are so that
emacs c-indent-exp or other automatic indenting keeps the code looking
reasonable.

I will commit this after running the testsuite over my big list of
targets.

bfd/
	* aoutx.h (aout_link_check_ar_symbols): Formatting.
	* cofflink.c (coff_link_check_ar_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.
	* elflink.c (elf_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.

ld/
	* ldlang.c (load_symbols): Simplify code dealing with
	add_archive_element substitute BFD.

Index: bfd/aoutx.h
===================================================================
RCS file: /cvs/src/src/bfd/aoutx.h,v
retrieving revision 1.84
diff -u -p -r1.84 aoutx.h
--- bfd/aoutx.h	14 Oct 2010 01:31:26 -0000	1.84
+++ bfd/aoutx.h	11 Dec 2010 13:21:32 -0000
@@ -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 *ab
 				 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;
     }
 
Index: bfd/cofflink.c
===================================================================
RCS file: /cvs/src/src/bfd/cofflink.c,v
retrieving revision 1.74
diff -u -p -r1.74 cofflink.c
--- bfd/cofflink.c	14 Oct 2010 01:31:26 -0000	1.74
+++ bfd/cofflink.c	11 Dec 2010 13:21:38 -0000
@@ -244,8 +244,8 @@ coff_link_check_ar_symbols (bfd *abfd,
 	  if (h != (struct bfd_link_hash_entry *) NULL
 	      && 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;
@@ -269,29 +269,38 @@ coff_link_check_archive_element (bfd *ab
 				 struct bfd_link_info *info,
 				 bfd_boolean *pneeded)
 {
-  bfd *subsbfd = NULL;
+  bfd *oldbfd;
+  bfd_boolean needed;
 
-  if (! _bfd_coff_get_external_symbols (abfd))
+  if (!_bfd_coff_get_external_symbols (abfd))
     return FALSE;
 
-  if (! coff_link_check_ar_symbols (abfd, info, pneeded, &subsbfd))
+  oldbfd = abfd;
+  if (!coff_link_check_ar_symbols (abfd, info, pneeded, &abfd))
     return FALSE;
 
-  /* Potentially, the add_archive_element hook may have set a
-     substitute BFD for us.  */
-  if (*pneeded
-      && subsbfd
-      && ! _bfd_coff_get_external_symbols (subsbfd))
-    return FALSE;
-
-  if (*pneeded
-      && ! coff_link_add_symbols (subsbfd ? subsbfd : abfd, info))
-    return FALSE;
-
-  if ((! info->keep_memory || ! *pneeded)
-      && ! _bfd_coff_free_symbols (abfd))
-    return FALSE;
+  needed = *pneeded;
+  if (needed)
+    {
+      /* Potentially, the add_archive_element hook may have set a
+	 substitute BFD for us.  */
+      if (abfd != oldbfd)
+	{
+	  if (!info->keep_memory
+	      && !_bfd_coff_free_symbols (oldbfd))
+	    return FALSE;
+	  if (!_bfd_coff_get_external_symbols (abfd))
+	    return FALSE;
+	}
+      if (!coff_link_add_symbols (abfd, info))
+	return FALSE;
+    }
 
+  if (!info->keep_memory || !needed)
+    {
+      if (!_bfd_coff_free_symbols (abfd))
+	return FALSE;
+    }
   return TRUE;
 }
 
Index: bfd/ecoff.c
===================================================================
RCS file: /cvs/src/src/bfd/ecoff.c,v
retrieving revision 1.71
diff -u -p -r1.71 ecoff.c
--- bfd/ecoff.c	29 Oct 2010 12:10:24 -0000	1.71
+++ bfd/ecoff.c	11 Dec 2010 13:21:41 -0000
@@ -3600,7 +3600,7 @@ ecoff_link_check_archive_element (bfd *a
       EXTR esym;
       bfd_boolean def;
       const char *name;
-      bfd *subsbfd;
+      bfd *oldbfd;
       struct bfd_link_hash_entry *h;
 
       (*swap_ext_in) (abfd, (void *) ext_ptr, &esym);
@@ -3645,18 +3645,17 @@ ecoff_link_check_archive_element (bfd *a
 	continue;
 
       /* Include this element.  */
-      subsbfd = NULL;
-      if (! (*info->callbacks->add_archive_element)
-					(info, abfd, name, &subsbfd))
+      oldbfd = abfd;
+      if (!(*info->callbacks
+	    ->add_archive_element) (info, abfd, name, &abfd))
 	goto error_return;
       /* Potentially, the add_archive_element hook may have set a
 	 substitute BFD for us.  */
-      if (subsbfd
+      if (abfd != oldbfd
 	  && !reread_ext_syms_and_strs (&symhdr, &external_ext_size, &esize,
-				&external_ext, &ssext, subsbfd, backend))
+					&external_ext, &ssext, abfd, backend))
 	goto error_return;
-      if (! ecoff_link_add_externals (subsbfd ? subsbfd : abfd, info,
-				external_ext, ssext))
+      if (! ecoff_link_add_externals (abfd, info, external_ext, ssext))
 	goto error_return;
 
       *pneeded = TRUE;
@@ -3733,7 +3732,6 @@ ecoff_link_add_archive_symbols (bfd *abf
       unsigned int file_offset;
       const char *name;
       bfd *element;
-      bfd *subsbfd;
 
       h = *pundef;
 
@@ -3820,13 +3818,10 @@ ecoff_link_add_archive_symbols (bfd *abf
       /* Unlike the generic linker, we know that this element provides
 	 a definition for an undefined symbol and we know that we want
 	 to include it.  We don't need to check anything.  */
-      subsbfd = NULL;
-      if (! (*info->callbacks->add_archive_element)
-					(info, element, name, &subsbfd))
+      if (!(*info->callbacks
+	    ->add_archive_element) (info, element, name, &element))
 	return FALSE;
-      /* Potentially, the add_archive_element hook may have set a
-	 substitute BFD for us.  */
-      if (! ecoff_link_add_object_symbols (subsbfd ? subsbfd : element, info))
+      if (! ecoff_link_add_object_symbols (element, info))
 	return FALSE;
 
       pundef = &(*pundef)->u.undef.next;
Index: bfd/elflink.c
===================================================================
RCS file: /cvs/src/src/bfd/elflink.c,v
retrieving revision 1.389
diff -u -p -r1.389 elflink.c
--- bfd/elflink.c	4 Dec 2010 04:42:06 -0000	1.389
+++ bfd/elflink.c	11 Dec 2010 13:22:06 -0000
@@ -5011,7 +5011,6 @@ elf_link_add_archive_symbols (bfd *abfd,
 	{
 	  struct elf_link_hash_entry *h;
 	  bfd *element;
-	  bfd *subsbfd = NULL;
 	  struct bfd_link_hash_entry *undefs_tail;
 	  symindex mark;
 
@@ -5074,12 +5073,10 @@ elf_link_add_archive_symbols (bfd *abfd,
 
 	  undefs_tail = info->hash->undefs_tail;
 
-	  if (! (*info->callbacks->add_archive_element)
-				(info, element, symdef->name, &subsbfd))
+	  if (!(*info->callbacks
+		->add_archive_element) (info, element, symdef->name, &element))
 	    goto error_return;
-	  /* Potentially, the add_archive_element hook may have set a
-	     substitute BFD for us.  */
-	  if (! bfd_link_add_symbols (subsbfd ? subsbfd : element, info))
+	  if (!bfd_link_add_symbols (element, info))
 	    goto error_return;
 
 	  /* If there are any new undefined symbols, we need to make
Index: bfd/linker.c
===================================================================
RCS file: /cvs/src/src/bfd/linker.c,v
retrieving revision 1.77
diff -u -p -r1.77 linker.c
--- bfd/linker.c	14 Oct 2010 01:31:27 -0000	1.77
+++ bfd/linker.c	11 Dec 2010 13:22:13 -0000
@@ -1223,20 +1223,18 @@ generic_link_check_archive_element (bfd 
 	{
 	  bfd_size_type symcount;
 	  asymbol **symbols;
-	  bfd *subsbfd = NULL;
+	  bfd *oldbfd = abfd;
 
 	  /* This object file defines this symbol, so pull it in.  */
-	  if (! (*info->callbacks->add_archive_element)
-				(info, abfd, bfd_asymbol_name (p), &subsbfd))
+	  if (!(*info->callbacks
+		->add_archive_element) (info, abfd, bfd_asymbol_name (p),
+					&abfd))
 	    return FALSE;
 	  /* Potentially, the add_archive_element hook may have set a
 	     substitute BFD for us.  */
-	  if (subsbfd)
-	    {
-	      abfd = subsbfd;
-	      if (!bfd_generic_link_read_symbols (abfd))
-		return FALSE;
-	    }
+	  if (abfd != oldbfd
+	      && !bfd_generic_link_read_symbols (abfd))
+	    return FALSE;
 	  symcount = _bfd_generic_link_get_symcount (abfd);
 	  symbols = _bfd_generic_link_get_symbols (abfd);
 	  if (! generic_link_add_symbol_list (abfd, info, symcount,
@@ -1257,12 +1255,12 @@ generic_link_check_archive_element (bfd 
 	  symbfd = h->u.undef.abfd;
 	  if (symbfd == NULL)
 	    {
-	      bfd *subsbfd = NULL;
 	      /* This symbol was created as undefined from outside
 		 BFD.  We assume that we should link in the object
 		 file.  This is for the -u option in the linker.  */
-	      if (! (*info->callbacks->add_archive_element)
-				(info, abfd, bfd_asymbol_name (p), &subsbfd))
+	      if (!(*info->callbacks
+		    ->add_archive_element) (info, abfd, bfd_asymbol_name (p),
+					    &abfd))
 		return FALSE;
 	      /* Potentially, the add_archive_element hook may have set a
 		 substitute BFD for us.  But no symbols are going to get
Index: bfd/pdp11.c
===================================================================
RCS file: /cvs/src/src/bfd/pdp11.c,v
retrieving revision 1.46
diff -u -p -r1.46 pdp11.c
--- bfd/pdp11.c	2 Dec 2010 11:53:07 -0000	1.46
+++ bfd/pdp11.c	11 Dec 2010 13:22:15 -0000
@@ -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 *ab
 				 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;
     }
 
Index: bfd/vms-alpha.c
===================================================================
RCS file: /cvs/src/src/bfd/vms-alpha.c,v
retrieving revision 1.37
diff -u -p -r1.37 vms-alpha.c
--- bfd/vms-alpha.c	14 Oct 2010 01:31:27 -0000	1.37
+++ bfd/vms-alpha.c	11 Dec 2010 13:22:19 -0000
@@ -8220,7 +8220,6 @@ alpha_vms_link_add_archive_symbols (bfd 
       symindex symidx;
       bfd *element;
       bfd *orig_element;
-      bfd *subsbfd;
 
       h = *pundef;
       next_pundef = &(*pundef)->u.undef.next;
@@ -8278,14 +8277,10 @@ alpha_vms_link_add_archive_symbols (bfd 
       /* Unlike the generic linker, we know that this element provides
 	 a definition for an undefined symbol and we know that we want
 	 to include it.  We don't need to check anything.  */
-      subsbfd = NULL;
-      if (! (*info->callbacks->add_archive_element)
-				(info, element, h->root.string, &subsbfd))
+      if (!(*info->callbacks
+	    ->add_archive_element) (info, element, h->root.string, &element))
 	return FALSE;
-      /* Potentially, the add_archive_element hook may have set a
-	 substitute BFD for us.  */
-      if (! alpha_vms_link_add_object_symbols (subsbfd ? subsbfd : element,
-				info))
+      if (!alpha_vms_link_add_object_symbols (element, info))
 	return FALSE;
 
       orig_element->archive_pass = pass;
Index: bfd/xcofflink.c
===================================================================
RCS file: /cvs/src/src/bfd/xcofflink.c,v
retrieving revision 1.76
diff -u -p -r1.76 xcofflink.c
--- bfd/xcofflink.c	14 Oct 2010 01:31:27 -0000	1.76
+++ bfd/xcofflink.c	11 Dec 2010 13:22:21 -0000
@@ -2292,8 +2292,8 @@ xcoff_link_check_dynamic_ar_symbols (bfd
 	  && (((struct xcoff_link_hash_entry *) h)->flags
 	      & XCOFF_DEF_DYNAMIC) == 0)
 	{
-	  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;
@@ -2364,8 +2364,8 @@ xcoff_link_check_ar_symbols (bfd *abfd,
 		  || (((struct xcoff_link_hash_entry *) h)->flags
 		      & XCOFF_DEF_DYNAMIC) == 0))
 	    {
-	      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;
@@ -2390,22 +2390,30 @@ xcoff_link_check_archive_element (bfd *a
 				  bfd_boolean *pneeded)
 {
   bfd_boolean keep_syms_p;
-  bfd *subsbfd = NULL;
+  bfd *oldbfd;
 
   keep_syms_p = (obj_coff_external_syms (abfd) != NULL);
-  if (! _bfd_coff_get_external_symbols (abfd))
+  if (!_bfd_coff_get_external_symbols (abfd))
     return FALSE;
 
-  if (! xcoff_link_check_ar_symbols (abfd, info, pneeded, &subsbfd))
+  oldbfd = abfd;
+  if (!xcoff_link_check_ar_symbols (abfd, info, pneeded, &abfd))
     return FALSE;
 
   if (*pneeded)
     {
       /* Potentially, the add_archive_element hook may have set a
 	 substitute BFD for us.  */
-      if (subsbfd && !_bfd_coff_get_external_symbols (subsbfd))
-	return FALSE;
-      if (! xcoff_link_add_symbols (subsbfd ? subsbfd : abfd, info))
+      if (abfd != oldbfd)
+	{
+	  if (!keep_syms_p
+	      && !_bfd_coff_free_symbols (oldbfd))
+	    return FALSE;
+	  keep_syms_p = (obj_coff_external_syms (abfd) != NULL);
+	  if (!_bfd_coff_get_external_symbols (abfd))
+	    return FALSE;
+	}
+      if (!xcoff_link_add_symbols (abfd, info))
 	return FALSE;
       if (info->keep_memory)
 	keep_syms_p = TRUE;
@@ -2413,7 +2421,7 @@ xcoff_link_check_archive_element (bfd *a
 
   if (!keep_syms_p)
     {
-      if (! _bfd_coff_free_symbols (abfd))
+      if (!_bfd_coff_free_symbols (abfd))
 	return FALSE;
     }
 
Index: ld/ldlang.c
===================================================================
RCS file: /cvs/src/src/ld/ldlang.c,v
retrieving revision 1.350
diff -u -p -r1.350 ldlang.c
--- ld/ldlang.c	6 Dec 2010 00:07:05 -0000	1.350
+++ ld/ldlang.c	11 Dec 2010 13:23:03 -0000
@@ -2699,12 +2699,12 @@ load_symbols (lang_input_statement_type 
 
       if (entry->whole_archive)
 	{
-	  bfd *member = NULL;
 	  bfd_boolean loaded = TRUE;
 
 	  for (;;)
 	    {
-	      bfd *subsbfd;
+	      bfd *member;
+
 	      member = bfd_openr_next_archived_file (entry->the_bfd, member);
 
 	      if (member == NULL)
@@ -2717,15 +2717,12 @@ load_symbols (lang_input_statement_type 
 		  loaded = FALSE;
 		}
 
-	      subsbfd = NULL;
-	      if (! ((*link_info.callbacks->add_archive_element)
-		     (&link_info, member, "--whole-archive", &subsbfd)))
+	      if (!(*link_info.callbacks
+		    ->add_archive_element) (&link_info, member,
+					    "--whole-archive", &member))
 		abort ();
 
-	      /* Potentially, the add_archive_element hook may have set a
-		 substitute BFD for us.  */
-	      if (! bfd_link_add_symbols (subsbfd ? subsbfd : member,
-					&link_info))
+	      if (!bfd_link_add_symbols (member, &link_info))
 		{
 		  einfo (_("%F%B: could not read symbols: %E\n"), member);
 		  loaded = FALSE;

-- 
Alan Modra
Australia Development Lab, IBM


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]