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: --enable-targets=all breaks ranlib


On Thu, Sep 13, 2007 at 12:18:36PM -0700, H.J. Lu wrote:
> -	  /* If this is the default target, accept it, even if other
> -	     targets might match.  People who want those other targets
> -	     have to set the GNUTARGET variable.  */
> -	  if (temp == bfd_default_vector[0])
> +	  /* If this is the default target or the default alternative
> +	     target, accept it, even if other targets might match.
> +	     People who want those other targets have to set the
> +	     GNUTARGET variable.  */
> +	  if (temp == bfd_default_vector[0]
> +	      || (bfd_default_vector[0] != NULL
> +		  && temp == bfd_default_vector[1]))

Why is the bfd_associated_vector code not handling this?  I guess
because this is a bfd_check_format call rather than
bfd_check_format_matches, and "matching" is NULL.  So, why not have
bfd_check_format pass a non-NULL "matching"?

If the following works, then all the "if (matching)" tests in
bfd_check_format_matches can disappear too.

Index: bfd/format.c
===================================================================
RCS file: /cvs/src/src/bfd/format.c,v
retrieving revision 1.25
diff -u -p -r1.25 format.c
--- bfd/format.c	3 Jul 2007 14:26:42 -0000	1.25
+++ bfd/format.c	14 Sep 2007 01:02:24 -0000
@@ -92,7 +92,13 @@ DESCRIPTION
 bfd_boolean
 bfd_check_format (bfd *abfd, bfd_format format)
 {
-  return bfd_check_format_matches (abfd, format, NULL);
+  char **match = NULL;
+  if (bfd_check_format_matches (abfd, format, &match))
+    return TRUE;
+
+  if (match != NULL)
+    free (match);
+  return 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]