OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [binutils-2.18.50/] [gas/] [output-file.c] - Diff between revs 156 and 816

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 156 Rev 816
/* output-file.c -  Deal with the output file
/* output-file.c -  Deal with the output file
   Copyright 1987, 1990, 1991, 1992, 1993, 1994, 1996, 1998, 1999, 2001,
   Copyright 1987, 1990, 1991, 1992, 1993, 1994, 1996, 1998, 1999, 2001,
   2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
   2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
 
 
   This file is part of GAS, the GNU Assembler.
   This file is part of GAS, the GNU Assembler.
 
 
   GAS is free software; you can redistribute it and/or modify
   GAS is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 3, or (at your option)
   the Free Software Foundation; either version 3, or (at your option)
   any later version.
   any later version.
 
 
   GAS is distributed in the hope that it will be useful,
   GAS is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.
   GNU General Public License for more details.
 
 
   You should have received a copy of the GNU General Public License
   You should have received a copy of the GNU General Public License
   along with GAS; see the file COPYING.  If not, write to
   along with GAS; see the file COPYING.  If not, write to
   the Free Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
   the Free Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
   02110-1301, USA.  */
   02110-1301, USA.  */
 
 
#include "as.h"
#include "as.h"
#include "output-file.h"
#include "output-file.h"
 
 
#ifndef TARGET_MACH
#ifndef TARGET_MACH
#define TARGET_MACH 0
#define TARGET_MACH 0
#endif
#endif
 
 
bfd *stdoutput;
bfd *stdoutput;
 
 
void
void
output_file_create (char *name)
output_file_create (char *name)
{
{
  if (name[0] == '-' && name[1] == '\0')
  if (name[0] == '-' && name[1] == '\0')
    as_fatal (_("can't open a bfd on stdout %s"), name);
    as_fatal (_("can't open a bfd on stdout %s"), name);
 
 
  else if (!(stdoutput = bfd_openw (name, TARGET_FORMAT)))
  else if (!(stdoutput = bfd_openw (name, TARGET_FORMAT)))
    {
    {
      bfd_error_type err = bfd_get_error ();
      bfd_error_type err = bfd_get_error ();
 
 
      if (err == bfd_error_invalid_target)
      if (err == bfd_error_invalid_target)
        as_fatal (_("selected target format '%s' unknown"), TARGET_FORMAT);
        as_fatal (_("selected target format '%s' unknown"), TARGET_FORMAT);
      else
      else
        as_fatal (_("can't create %s: %s"), name, bfd_errmsg (err));
        as_fatal (_("can't create %s: %s"), name, bfd_errmsg (err));
    }
    }
 
 
  bfd_set_format (stdoutput, bfd_object);
  bfd_set_format (stdoutput, bfd_object);
  bfd_set_arch_mach (stdoutput, TARGET_ARCH, TARGET_MACH);
  bfd_set_arch_mach (stdoutput, TARGET_ARCH, TARGET_MACH);
  if (flag_traditional_format)
  if (flag_traditional_format)
    stdoutput->flags |= BFD_TRADITIONAL_FORMAT;
    stdoutput->flags |= BFD_TRADITIONAL_FORMAT;
}
}
 
 
void
void
output_file_close (char *filename)
output_file_close (char *filename)
{
{
  bfd_boolean res;
  bfd_boolean res;
 
 
  if (stdoutput == NULL)
  if (stdoutput == NULL)
    return;
    return;
 
 
  /* Close the bfd.  */
  /* Close the bfd.  */
  res = bfd_close (stdoutput);
  res = bfd_close (stdoutput);
 
 
  /* Prevent an infinite loop - if the close failed we will call as_fatal
  /* Prevent an infinite loop - if the close failed we will call as_fatal
     which will call xexit() which may call this function again...  */
     which will call xexit() which may call this function again...  */
  stdoutput = NULL;
  stdoutput = NULL;
 
 
  if (! res)
  if (! res)
    as_fatal (_("can't close %s: %s"), filename,
    as_fatal (_("can't close %s: %s"), filename,
              bfd_errmsg (bfd_get_error ()));
              bfd_errmsg (bfd_get_error ()));
}
}
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.