GAS: Catch attempts to create a file with an unknown target format.

Nick Clifton nickc@redhat.com
Tue Jul 6 16:41:00 GMT 2004


Hi Guys,

  I am applying the small patch below to slightly modify the
  output_file_create() function.  The problem was that if the
  TARGET_FORMAT macro selected an unsupported format the error
  message produced would just say "Invalid bfd target" without
  specifying what the target was.

  The patch fixes this so that in the case where bfd_openw() returns
  bfd_error_invalid_target the bogus target format is actually
  reported.

Cheers
  Nick

gas/ChangeLog
2004-07-06  Nick Clifton  <nickc@redhat.com>

	* output-file.c (output_file_create): Report the target format
	chosen when bfd_openw reports that it is invalid.

Index: gas/output-file.c
===================================================================
RCS file: /cvs/src/src/gas/output-file.c,v
retrieving revision 1.8
diff -c -3 -p -r1.8 output-file.c
*** gas/output-file.c	19 Dec 2003 15:23:41 -0000	1.8
--- gas/output-file.c	6 Jul 2004 16:08:41 -0000
*************** output_file_create (char *name)
*** 48,54 ****
  
    else if (!(stdoutput = bfd_openw (name, TARGET_FORMAT)))
      {
!       as_perror (_("FATAL: can't create %s"), name);
        exit (EXIT_FAILURE);
      }
  
--- 48,57 ----
  
    else if (!(stdoutput = bfd_openw (name, TARGET_FORMAT)))
      {
!       if (bfd_get_error () == bfd_error_invalid_target)
! 	as_perror (_("Selected target format '%s' unknown"), TARGET_FORMAT);
!       else
! 	as_perror (_("FATAL: can't create %s"), name);
        exit (EXIT_FAILURE);
      }
  



More information about the Binutils mailing list