bfd target lists

Alan Modra amodra@bigpond.net.au
Tue Oct 15 04:32:00 GMT 2002


On Tue, Oct 15, 2002 at 08:59:51PM +0930, Alan Modra wrote:
> If anyone has taken a close look at the list of targets printed by
> say, objdump --help, when compiled with --enable-targets=all, you
> may have noticed that the default target is mentioned twice.

And this is the bit that will make the previous patch work for
objdump and other binutils.

	* bucomm.c (list_supported_targets): Use bfd_target_list.

Committing mainline.

Index: binutils/bucomm.c
===================================================================
RCS file: /cvs/src/src/binutils/bucomm.c,v
retrieving revision 1.15
diff -u -p -r1.15 bucomm.c
--- binutils/bucomm.c	8 Jun 2002 07:38:30 -0000	1.15
+++ binutils/bucomm.c	15 Oct 2002 07:43:12 -0000
@@ -128,16 +128,18 @@ list_supported_targets (name, f)
      const char *name;
      FILE *f;
 {
-  extern const bfd_target *const *bfd_target_vector;
   int t;
+  const char **targ_names = bfd_target_list ();
 
   if (name == NULL)
     fprintf (f, _("Supported targets:"));
   else
     fprintf (f, _("%s: supported targets:"), name);
-  for (t = 0; bfd_target_vector[t] != NULL; t++)
-    fprintf (f, " %s", bfd_target_vector[t]->name);
+
+  for (t = 0; targ_names[t] != NULL; t++)
+    fprintf (f, " %s", targ_names[t]);
   fprintf (f, "\n");
+  free (targ_names);
 }
 
 /* List the supported architectures.  */

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre



More information about the Binutils mailing list