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

Subversion Repositories open8_urisc

[/] [open8_urisc/] [trunk/] [gnu/] [binutils/] [ld/] [ldmisc.c] - Diff between revs 145 and 166

Only display areas with differences | Details | Blame | View Log

Rev 145 Rev 166
/* ldmisc.c
/* ldmisc.c
   Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
   Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
   2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010, 2011
   2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010, 2011, 2012
   Free Software Foundation, Inc.
   Free Software Foundation, Inc.
   Written by Steve Chamberlain of Cygnus Support.
   Written by Steve Chamberlain of Cygnus Support.
 
 
   This file is part of the GNU Binutils.
   This file is part of the GNU Binutils.
 
 
   This program is free software; you can redistribute it and/or modify
   This program 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 of the License, or
   the Free Software Foundation; either version 3 of the License, or
   (at your option) any later version.
   (at your option) any later version.
 
 
   This program is distributed in the hope that it will be useful,
   This program 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 this program; if not, write to the Free Software
   along with this program; if not, write to the Free Software
   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
   MA 02110-1301, USA.  */
   MA 02110-1301, USA.  */
 
 
#include "sysdep.h"
#include "sysdep.h"
#include "bfd.h"
#include "bfd.h"
#include "bfdlink.h"
#include "bfdlink.h"
#include "libiberty.h"
#include "libiberty.h"
#include "filenames.h"
#include "filenames.h"
#include "demangle.h"
#include "demangle.h"
#include <stdarg.h>
#include <stdarg.h>
#include "ld.h"
#include "ld.h"
#include "ldmisc.h"
#include "ldmisc.h"
#include "ldexp.h"
#include "ldexp.h"
#include "ldlang.h"
#include "ldlang.h"
#include <ldgram.h>
#include <ldgram.h>
#include "ldlex.h"
#include "ldlex.h"
#include "ldmain.h"
#include "ldmain.h"
#include "ldfile.h"
#include "ldfile.h"
#include "elf-bfd.h"
#include "elf-bfd.h"
 
 
/*
/*
 %% literal %
 %% literal %
 %A section name from a section
 %A section name from a section
 %B filename from a bfd
 %B filename from a bfd
 %C clever filename:linenumber with function
 %C clever filename:linenumber with function
 %D like %C, but no function name
 %D like %C, but no function name
 %E current bfd error or errno
 %E current bfd error or errno
 %F error is fatal
 %F error is fatal
 %G like %D, but only function name
 %G like %D, but only function name
 %H like %C but in addition emit section+offset
 %H like %C but in addition emit section+offset
 %I filename from a lang_input_statement_type
 %I filename from a lang_input_statement_type
 %P print program name
 %P print program name
 %R info about a relent
 %R info about a relent
 %S print script file and linenumber
 %S print script file and linenumber from etree_type.
 %T symbol name
 %T symbol name
 %V hex bfd_vma
 %V hex bfd_vma
 %W hex bfd_vma with 0x with no leading zeros taking up 8 spaces
 %W hex bfd_vma with 0x with no leading zeros taking up 8 spaces
 %X no object output, fail return
 %X no object output, fail return
 %d integer, like printf
 %d integer, like printf
 %ld long, like printf
 %ld long, like printf
 %lu unsigned long, like printf
 %lu unsigned long, like printf
 %p native (host) void* pointer, like printf
 %p native (host) void* pointer, like printf
 %s arbitrary string, like printf
 %s arbitrary string, like printf
 %u integer, like printf
 %u integer, like printf
 %v hex bfd_vma, no leading zeros
 %v hex bfd_vma, no leading zeros
*/
*/
 
 
void
void
vfinfo (FILE *fp, const char *fmt, va_list arg, bfd_boolean is_warning)
vfinfo (FILE *fp, const char *fmt, va_list arg, bfd_boolean is_warning)
{
{
  bfd_boolean fatal = FALSE;
  bfd_boolean fatal = FALSE;
 
 
  while (*fmt != '\0')
  while (*fmt != '\0')
    {
    {
      while (*fmt != '%' && *fmt != '\0')
      while (*fmt != '%' && *fmt != '\0')
        {
        {
          putc (*fmt, fp);
          putc (*fmt, fp);
          fmt++;
          fmt++;
        }
        }
 
 
      if (*fmt == '%')
      if (*fmt == '%')
        {
        {
          fmt++;
          fmt++;
          switch (*fmt++)
          switch (*fmt++)
            {
            {
            case '%':
            case '%':
              /* literal % */
              /* literal % */
              putc ('%', fp);
              putc ('%', fp);
              break;
              break;
 
 
            case 'X':
            case 'X':
              /* no object output, fail return */
              /* no object output, fail return */
              config.make_executable = FALSE;
              config.make_executable = FALSE;
              break;
              break;
 
 
            case 'V':
            case 'V':
              /* hex bfd_vma */
              /* hex bfd_vma */
              {
              {
                bfd_vma value = va_arg (arg, bfd_vma);
                bfd_vma value = va_arg (arg, bfd_vma);
                fprintf_vma (fp, value);
                fprintf_vma (fp, value);
              }
              }
              break;
              break;
 
 
            case 'v':
            case 'v':
              /* hex bfd_vma, no leading zeros */
              /* hex bfd_vma, no leading zeros */
              {
              {
                char buf[100];
                char buf[100];
                char *p = buf;
                char *p = buf;
                bfd_vma value = va_arg (arg, bfd_vma);
                bfd_vma value = va_arg (arg, bfd_vma);
                sprintf_vma (p, value);
                sprintf_vma (p, value);
                while (*p == '0')
                while (*p == '0')
                  p++;
                  p++;
                if (!*p)
                if (!*p)
                  p--;
                  p--;
                fputs (p, fp);
                fputs (p, fp);
              }
              }
              break;
              break;
 
 
            case 'W':
            case 'W':
              /* hex bfd_vma with 0x with no leading zeroes taking up
              /* hex bfd_vma with 0x with no leading zeroes taking up
                 8 spaces.  */
                 8 spaces.  */
              {
              {
                char buf[100];
                char buf[100];
                bfd_vma value;
                bfd_vma value;
                char *p;
                char *p;
                int len;
                int len;
 
 
                value = va_arg (arg, bfd_vma);
                value = va_arg (arg, bfd_vma);
                sprintf_vma (buf, value);
                sprintf_vma (buf, value);
                for (p = buf; *p == '0'; ++p)
                for (p = buf; *p == '0'; ++p)
                  ;
                  ;
                if (*p == '\0')
                if (*p == '\0')
                  --p;
                  --p;
                len = strlen (p);
                len = strlen (p);
                while (len < 8)
                while (len < 8)
                  {
                  {
                    putc (' ', fp);
                    putc (' ', fp);
                    ++len;
                    ++len;
                  }
                  }
                fprintf (fp, "0x%s", p);
                fprintf (fp, "0x%s", p);
              }
              }
              break;
              break;
 
 
            case 'T':
            case 'T':
              /* Symbol name.  */
              /* Symbol name.  */
              {
              {
                const char *name = va_arg (arg, const char *);
                const char *name = va_arg (arg, const char *);
 
 
                if (name == NULL || *name == 0)
                if (name == NULL || *name == 0)
                  {
                  {
                    fprintf (fp, _("no symbol"));
                    fprintf (fp, _("no symbol"));
                    break;
                    break;
                  }
                  }
                else if (demangling)
                else if (demangling)
                  {
                  {
                    char *demangled;
                    char *demangled;
 
 
                    demangled = bfd_demangle (link_info.output_bfd, name,
                    demangled = bfd_demangle (link_info.output_bfd, name,
                                              DMGL_ANSI | DMGL_PARAMS);
                                              DMGL_ANSI | DMGL_PARAMS);
                    if (demangled != NULL)
                    if (demangled != NULL)
                      {
                      {
                        fprintf (fp, "%s", demangled);
                        fprintf (fp, "%s", demangled);
                        free (demangled);
                        free (demangled);
                        break;
                        break;
                      }
                      }
                  }
                  }
                fprintf (fp, "%s", name);
                fprintf (fp, "%s", name);
              }
              }
              break;
              break;
 
 
            case 'A':
            case 'A':
              /* section name from a section */
              /* section name from a section */
              {
              {
                asection *sec = va_arg (arg, asection *);
                asection *sec = va_arg (arg, asection *);
                bfd *abfd = sec->owner;
                bfd *abfd = sec->owner;
                const char *group = NULL;
                const char *group = NULL;
                struct coff_comdat_info *ci;
                struct coff_comdat_info *ci;
 
 
                fprintf (fp, "%s", sec->name);
                fprintf (fp, "%s", sec->name);
                if (abfd != NULL
                if (abfd != NULL
                    && bfd_get_flavour (abfd) == bfd_target_elf_flavour
                    && bfd_get_flavour (abfd) == bfd_target_elf_flavour
                    && elf_next_in_group (sec) != NULL
                    && elf_next_in_group (sec) != NULL
                    && (sec->flags & SEC_GROUP) == 0)
                    && (sec->flags & SEC_GROUP) == 0)
                  group = elf_group_name (sec);
                  group = elf_group_name (sec);
                else if (abfd != NULL
                else if (abfd != NULL
                         && bfd_get_flavour (abfd) == bfd_target_coff_flavour
                         && bfd_get_flavour (abfd) == bfd_target_coff_flavour
                         && (ci = bfd_coff_get_comdat_section (sec->owner,
                         && (ci = bfd_coff_get_comdat_section (sec->owner,
                                                               sec)) != NULL)
                                                               sec)) != NULL)
                  group = ci->name;
                  group = ci->name;
                if (group != NULL)
                if (group != NULL)
                  fprintf (fp, "[%s]", group);
                  fprintf (fp, "[%s]", group);
              }
              }
              break;
              break;
 
 
            case 'B':
            case 'B':
              /* filename from a bfd */
              /* filename from a bfd */
              {
              {
                bfd *abfd = va_arg (arg, bfd *);
                bfd *abfd = va_arg (arg, bfd *);
 
 
                if (abfd == NULL)
                if (abfd == NULL)
                  fprintf (fp, "%s generated", program_name);
                  fprintf (fp, "%s generated", program_name);
                else if (abfd->my_archive)
                else if (abfd->my_archive)
                  fprintf (fp, "%s(%s)", abfd->my_archive->filename,
                  fprintf (fp, "%s(%s)", abfd->my_archive->filename,
                           abfd->filename);
                           abfd->filename);
                else
                else
                  fprintf (fp, "%s", abfd->filename);
                  fprintf (fp, "%s", abfd->filename);
              }
              }
              break;
              break;
 
 
            case 'F':
            case 'F':
              /* Error is fatal.  */
              /* Error is fatal.  */
              fatal = TRUE;
              fatal = TRUE;
              break;
              break;
 
 
            case 'P':
            case 'P':
              /* Print program name.  */
              /* Print program name.  */
              fprintf (fp, "%s", program_name);
              fprintf (fp, "%s", program_name);
              break;
              break;
 
 
            case 'E':
            case 'E':
              /* current bfd error or errno */
              /* current bfd error or errno */
              fprintf (fp, "%s", bfd_errmsg (bfd_get_error ()));
              fprintf (fp, "%s", bfd_errmsg (bfd_get_error ()));
              break;
              break;
 
 
            case 'I':
            case 'I':
              /* filename from a lang_input_statement_type */
              /* filename from a lang_input_statement_type */
              {
              {
                lang_input_statement_type *i;
                lang_input_statement_type *i;
 
 
                i = va_arg (arg, lang_input_statement_type *);
                i = va_arg (arg, lang_input_statement_type *);
                if (bfd_my_archive (i->the_bfd) != NULL)
                if (bfd_my_archive (i->the_bfd) != NULL)
                  fprintf (fp, "(%s)",
                  fprintf (fp, "(%s)",
                           bfd_get_filename (bfd_my_archive (i->the_bfd)));
                           bfd_get_filename (bfd_my_archive (i->the_bfd)));
                fprintf (fp, "%s", i->local_sym_name);
                fprintf (fp, "%s", i->local_sym_name);
                if (bfd_my_archive (i->the_bfd) == NULL
                if (bfd_my_archive (i->the_bfd) == NULL
                    && filename_cmp (i->local_sym_name, i->filename) != 0)
                    && filename_cmp (i->local_sym_name, i->filename) != 0)
                  fprintf (fp, " (%s)", i->filename);
                  fprintf (fp, " (%s)", i->filename);
              }
              }
              break;
              break;
 
 
            case 'S':
            case 'S':
              /* Print script file and linenumber.  */
              /* Print script file and linenumber.  */
              if (parsing_defsym)
              {
                fprintf (fp, "--defsym %s", lex_string);
                etree_type node;
              else if (ldfile_input_filename != NULL)
                etree_type *tp = va_arg (arg, etree_type *);
                fprintf (fp, "%s:%u", ldfile_input_filename, lineno);
 
              else
                if (tp == NULL)
                fprintf (fp, _("built in linker script:%u"), lineno);
                  {
 
                    tp = &node;
 
                    tp->type.filename = ldlex_filename ();
 
                    tp->type.lineno = lineno;
 
                  }
 
                if (tp->type.filename != NULL)
 
                  fprintf (fp, "%s:%u", tp->type.filename, tp->type.lineno);
 
              }
              break;
              break;
 
 
            case 'R':
            case 'R':
              /* Print all that's interesting about a relent.  */
              /* Print all that's interesting about a relent.  */
              {
              {
                arelent *relent = va_arg (arg, arelent *);
                arelent *relent = va_arg (arg, arelent *);
 
 
                lfinfo (fp, "%s+0x%v (type %s)",
                lfinfo (fp, "%s+0x%v (type %s)",
                        (*(relent->sym_ptr_ptr))->name,
                        (*(relent->sym_ptr_ptr))->name,
                        relent->addend,
                        relent->addend,
                        relent->howto->name);
                        relent->howto->name);
              }
              }
              break;
              break;
 
 
            case 'C':
            case 'C':
            case 'D':
            case 'D':
            case 'G':
            case 'G':
            case 'H':
            case 'H':
              /* Clever filename:linenumber with function name if possible.
              /* Clever filename:linenumber with function name if possible.
                 The arguments are a BFD, a section, and an offset.  */
                 The arguments are a BFD, a section, and an offset.  */
              {
              {
                static bfd *last_bfd;
                static bfd *last_bfd;
                static char *last_file = NULL;
                static char *last_file = NULL;
                static char *last_function = NULL;
                static char *last_function = NULL;
                bfd *abfd;
                bfd *abfd;
                asection *section;
                asection *section;
                bfd_vma offset;
                bfd_vma offset;
                asymbol **asymbols = NULL;
                asymbol **asymbols = NULL;
                const char *filename;
                const char *filename;
                const char *functionname;
                const char *functionname;
                unsigned int linenumber;
                unsigned int linenumber;
                bfd_boolean discard_last;
                bfd_boolean discard_last;
                bfd_boolean done;
                bfd_boolean done;
 
 
                abfd = va_arg (arg, bfd *);
                abfd = va_arg (arg, bfd *);
                section = va_arg (arg, asection *);
                section = va_arg (arg, asection *);
                offset = va_arg (arg, bfd_vma);
                offset = va_arg (arg, bfd_vma);
 
 
                if (abfd != NULL)
                if (abfd != NULL)
                  {
                  {
                    if (!bfd_generic_link_read_symbols (abfd))
                    if (!bfd_generic_link_read_symbols (abfd))
                      einfo (_("%B%F: could not read symbols: %E\n"), abfd);
                      einfo (_("%B%F: could not read symbols: %E\n"), abfd);
 
 
                    asymbols = bfd_get_outsymbols (abfd);
                    asymbols = bfd_get_outsymbols (abfd);
                  }
                  }
 
 
                /* The GNU Coding Standard requires that error messages
                /* The GNU Coding Standard requires that error messages
                   be of the form:
                   be of the form:
 
 
                     source-file-name:lineno: message
                     source-file-name:lineno: message
 
 
                   We do not always have a line number available so if
                   We do not always have a line number available so if
                   we cannot find them we print out the section name and
                   we cannot find them we print out the section name and
                   offset instead.  */
                   offset instead.  */
                discard_last = TRUE;
                discard_last = TRUE;
                if (abfd != NULL
                if (abfd != NULL
                    && bfd_find_nearest_line (abfd, section, asymbols, offset,
                    && bfd_find_nearest_line (abfd, section, asymbols, offset,
                                              &filename, &functionname,
                                              &filename, &functionname,
                                              &linenumber))
                                              &linenumber))
                  {
                  {
                    if (functionname != NULL
                    if (functionname != NULL
                        && (fmt[-1] == 'C' || fmt[-1] == 'H'))
                        && (fmt[-1] == 'C' || fmt[-1] == 'H'))
                      {
                      {
                        /* Detect the case where we are printing out a
                        /* Detect the case where we are printing out a
                           message for the same function as the last
                           message for the same function as the last
                           call to vinfo ("%C").  In this situation do
                           call to vinfo ("%C").  In this situation do
                           not print out the ABFD filename or the
                           not print out the ABFD filename or the
                           function name again.  Note - we do still
                           function name again.  Note - we do still
                           print out the source filename, as this will
                           print out the source filename, as this will
                           allow programs that parse the linker's output
                           allow programs that parse the linker's output
                           (eg emacs) to correctly locate multiple
                           (eg emacs) to correctly locate multiple
                           errors in the same source file.  */
                           errors in the same source file.  */
                        if (last_bfd == NULL
                        if (last_bfd == NULL
                            || last_file == NULL
                            || last_file == NULL
                            || last_function == NULL
                            || last_function == NULL
                            || last_bfd != abfd
                            || last_bfd != abfd
                            || (filename != NULL
                            || (filename != NULL
                                && filename_cmp (last_file, filename) != 0)
                                && filename_cmp (last_file, filename) != 0)
                            || strcmp (last_function, functionname) != 0)
                            || strcmp (last_function, functionname) != 0)
                          {
                          {
                            lfinfo (fp, _("%B: In function `%T':\n"),
                            lfinfo (fp, _("%B: In function `%T':\n"),
                                    abfd, functionname);
                                    abfd, functionname);
 
 
                            last_bfd = abfd;
                            last_bfd = abfd;
                            if (last_file != NULL)
                            if (last_file != NULL)
                              free (last_file);
                              free (last_file);
                            last_file = NULL;
                            last_file = NULL;
                            if (filename)
                            if (filename)
                              last_file = xstrdup (filename);
                              last_file = xstrdup (filename);
                            if (last_function != NULL)
                            if (last_function != NULL)
                              free (last_function);
                              free (last_function);
                            last_function = xstrdup (functionname);
                            last_function = xstrdup (functionname);
                          }
                          }
                        discard_last = FALSE;
                        discard_last = FALSE;
                      }
                      }
                    else
                    else
                      lfinfo (fp, "%B:", abfd);
                      lfinfo (fp, "%B:", abfd);
 
 
                    if (filename != NULL)
                    if (filename != NULL)
                      fprintf (fp, "%s:", filename);
                      fprintf (fp, "%s:", filename);
 
 
                    done = fmt[-1] != 'H';
                    done = fmt[-1] != 'H';
                    if (functionname != NULL && fmt[-1] == 'G')
                    if (functionname != NULL && fmt[-1] == 'G')
                      lfinfo (fp, "%T", functionname);
                      lfinfo (fp, "%T", functionname);
                    else if (filename != NULL && linenumber != 0)
                    else if (filename != NULL && linenumber != 0)
                      fprintf (fp, "%u%s", linenumber, ":" + done);
                      fprintf (fp, "%u%s", linenumber, ":" + done);
                    else
                    else
                      done = FALSE;
                      done = FALSE;
                  }
                  }
                else
                else
                  {
                  {
                    lfinfo (fp, "%B:", abfd);
                    lfinfo (fp, "%B:", abfd);
                    done = FALSE;
                    done = FALSE;
                  }
                  }
                if (!done)
                if (!done)
                  lfinfo (fp, "(%A+0x%v)", section, offset);
                  lfinfo (fp, "(%A+0x%v)", section, offset);
 
 
                if (discard_last)
                if (discard_last)
                  {
                  {
                    last_bfd = NULL;
                    last_bfd = NULL;
                    if (last_file != NULL)
                    if (last_file != NULL)
                      {
                      {
                        free (last_file);
                        free (last_file);
                        last_file = NULL;
                        last_file = NULL;
                      }
                      }
                    if (last_function != NULL)
                    if (last_function != NULL)
                      {
                      {
                        free (last_function);
                        free (last_function);
                        last_function = NULL;
                        last_function = NULL;
                      }
                      }
                  }
                  }
              }
              }
              break;
              break;
 
 
            case 'p':
            case 'p':
              /* native (host) void* pointer, like printf */
              /* native (host) void* pointer, like printf */
              fprintf (fp, "%p", va_arg (arg, void *));
              fprintf (fp, "%p", va_arg (arg, void *));
              break;
              break;
 
 
            case 's':
            case 's':
              /* arbitrary string, like printf */
              /* arbitrary string, like printf */
              fprintf (fp, "%s", va_arg (arg, char *));
              fprintf (fp, "%s", va_arg (arg, char *));
              break;
              break;
 
 
            case 'd':
            case 'd':
              /* integer, like printf */
              /* integer, like printf */
              fprintf (fp, "%d", va_arg (arg, int));
              fprintf (fp, "%d", va_arg (arg, int));
              break;
              break;
 
 
            case 'u':
            case 'u':
              /* unsigned integer, like printf */
              /* unsigned integer, like printf */
              fprintf (fp, "%u", va_arg (arg, unsigned int));
              fprintf (fp, "%u", va_arg (arg, unsigned int));
              break;
              break;
 
 
            case 'l':
            case 'l':
              if (*fmt == 'd')
              if (*fmt == 'd')
                {
                {
                  fprintf (fp, "%ld", va_arg (arg, long));
                  fprintf (fp, "%ld", va_arg (arg, long));
                  ++fmt;
                  ++fmt;
                  break;
                  break;
                }
                }
              else if (*fmt == 'u')
              else if (*fmt == 'u')
                {
                {
                  fprintf (fp, "%lu", va_arg (arg, unsigned long));
                  fprintf (fp, "%lu", va_arg (arg, unsigned long));
                  ++fmt;
                  ++fmt;
                  break;
                  break;
                }
                }
              /* Fall thru */
              /* Fall thru */
 
 
            default:
            default:
              fprintf (fp, "%%%c", fmt[-1]);
              fprintf (fp, "%%%c", fmt[-1]);
              break;
              break;
            }
            }
        }
        }
    }
    }
 
 
  if (is_warning && config.fatal_warnings)
  if (is_warning && config.fatal_warnings)
    config.make_executable = FALSE;
    config.make_executable = FALSE;
 
 
  if (fatal)
  if (fatal)
    xexit (1);
    xexit (1);
}
}
 
 
/* Format info message and print on stdout.  */
/* Format info message and print on stdout.  */
 
 
/* (You would think this should be called just "info", but then you
/* (You would think this should be called just "info", but then you
   would be hosed by LynxOS, which defines that name in its libc.)  */
   would be hosed by LynxOS, which defines that name in its libc.)  */
 
 
void
void
info_msg (const char *fmt, ...)
info_msg (const char *fmt, ...)
{
{
  va_list arg;
  va_list arg;
 
 
  va_start (arg, fmt);
  va_start (arg, fmt);
  vfinfo (stdout, fmt, arg, FALSE);
  vfinfo (stdout, fmt, arg, FALSE);
  va_end (arg);
  va_end (arg);
}
}
 
 
/* ('e' for error.) Format info message and print on stderr.  */
/* ('e' for error.) Format info message and print on stderr.  */
 
 
void
void
einfo (const char *fmt, ...)
einfo (const char *fmt, ...)
{
{
  va_list arg;
  va_list arg;
 
 
  fflush (stdout);
  fflush (stdout);
  va_start (arg, fmt);
  va_start (arg, fmt);
  vfinfo (stderr, fmt, arg, TRUE);
  vfinfo (stderr, fmt, arg, TRUE);
  va_end (arg);
  va_end (arg);
  fflush (stderr);
  fflush (stderr);
}
}
 
 
void
void
info_assert (const char *file, unsigned int line)
info_assert (const char *file, unsigned int line)
{
{
  einfo (_("%F%P: internal error %s %d\n"), file, line);
  einfo (_("%F%P: internal error %s %d\n"), file, line);
}
}
 
 
/* ('m' for map) Format info message and print on map.  */
/* ('m' for map) Format info message and print on map.  */
 
 
void
void
minfo (const char *fmt, ...)
minfo (const char *fmt, ...)
{
{
  if (config.map_file != NULL)
  if (config.map_file != NULL)
    {
    {
      va_list arg;
      va_list arg;
 
 
      va_start (arg, fmt);
      va_start (arg, fmt);
      vfinfo (config.map_file, fmt, arg, FALSE);
      vfinfo (config.map_file, fmt, arg, FALSE);
      va_end (arg);
      va_end (arg);
    }
    }
}
}
 
 
void
void
lfinfo (FILE *file, const char *fmt, ...)
lfinfo (FILE *file, const char *fmt, ...)
{
{
  va_list arg;
  va_list arg;
 
 
  va_start (arg, fmt);
  va_start (arg, fmt);
  vfinfo (file, fmt, arg, FALSE);
  vfinfo (file, fmt, arg, FALSE);
  va_end (arg);
  va_end (arg);
}
}


/* Functions to print the link map.  */
/* Functions to print the link map.  */
 
 
void
void
print_space (void)
print_space (void)
{
{
  fprintf (config.map_file, " ");
  fprintf (config.map_file, " ");
}
}
 
 
void
void
print_nl (void)
print_nl (void)
{
{
  fprintf (config.map_file, "\n");
  fprintf (config.map_file, "\n");
}
}
 
 
/* A more or less friendly abort message.  In ld.h abort is defined to
/* A more or less friendly abort message.  In ld.h abort is defined to
   call this function.  */
   call this function.  */
 
 
void
void
ld_abort (const char *file, int line, const char *fn)
ld_abort (const char *file, int line, const char *fn)
{
{
  if (fn != NULL)
  if (fn != NULL)
    einfo (_("%P: internal error: aborting at %s line %d in %s\n"),
    einfo (_("%P: internal error: aborting at %s line %d in %s\n"),
           file, line, fn);
           file, line, fn);
  else
  else
    einfo (_("%P: internal error: aborting at %s line %d\n"),
    einfo (_("%P: internal error: aborting at %s line %d\n"),
           file, line);
           file, line);
  einfo (_("%P%F: please report this bug\n"));
  einfo (_("%P%F: please report this bug\n"));
  xexit (1);
  xexit (1);
}
}
 
 

powered by: WebSVN 2.1.0

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