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

Subversion Repositories open8_urisc

[/] [open8_urisc/] [trunk/] [gnu/] [binutils/] [binutils/] [objdump.c] - Diff between revs 15 and 166

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 15 Rev 166
Line 1... Line 1...
/* objdump.c -- dump information about an object file.
/* objdump.c -- dump information about an object file.
   Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
   Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011,
   Free Software Foundation, Inc.
   2012 Free Software Foundation, Inc.
 
 
   This file is part of GNU Binutils.
   This file is part of 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
Line 69... Line 69...
 
 
#ifdef HAVE_MMAP
#ifdef HAVE_MMAP
#include <sys/mman.h>
#include <sys/mman.h>
#endif
#endif
 
 
#include <sys/stat.h>
 
 
 
/* Internal headers for the ELF .stab-dump code - sorry.  */
/* Internal headers for the ELF .stab-dump code - sorry.  */
#define BYTES_IN_WORD   32
#define BYTES_IN_WORD   32
#include "aout/aout64.h"
#include "aout/aout64.h"
 
 
/* Exit status.  */
/* Exit status.  */
Line 1123... Line 1121...
  int fd = open (fn, O_RDONLY | O_BINARY);
  int fd = open (fn, O_RDONLY | O_BINARY);
 
 
  if (fd < 0)
  if (fd < 0)
    return NULL;
    return NULL;
  if (fstat (fd, &st) < 0)
  if (fstat (fd, &st) < 0)
 
    {
 
      close (fd);
    return NULL;
    return NULL;
 
    }
  *size = st.st_size;
  *size = st.st_size;
#ifdef HAVE_MMAP
#ifdef HAVE_MMAP
  msize = (*size + ps - 1) & ~(ps - 1);
  msize = (*size + ps - 1) & ~(ps - 1);
  map = mmap (NULL, msize, PROT_READ, MAP_SHARED, fd, 0);
  map = mmap (NULL, msize, PROT_READ, MAP_SHARED, fd, 0);
  if (map != (char *)-1L)
  if (map != (char *)-1L)
Line 3255... Line 3256...
  dynsymcount = 0;
  dynsymcount = 0;
  synthcount = 0;
  synthcount = 0;
}
}
 
 
static void
static void
display_bfd (bfd *abfd)
display_object_bfd (bfd *abfd)
{
{
  char **matching;
  char **matching;
 
 
  if (bfd_check_format_matches (abfd, bfd_object, &matching))
  if (bfd_check_format_matches (abfd, bfd_object, &matching))
    {
    {
Line 3295... Line 3296...
      free (matching);
      free (matching);
    }
    }
}
}
 
 
static void
static void
display_file (char *filename, char *target)
display_any_bfd (bfd *file, int level)
{
 
  bfd *file;
 
  bfd *arfile = NULL;
 
 
 
  if (get_file_size (filename) < 1)
 
    {
 
      exit_status = 1;
 
      return;
 
    }
 
 
 
  file = bfd_openr (filename, target);
 
  if (file == NULL)
 
    {
    {
      nonfatal (filename);
 
      return;
 
    }
 
 
 
  /* Decompress sections unless dumping the section contents.  */
  /* Decompress sections unless dumping the section contents.  */
  if (!dump_section_contents)
  if (!dump_section_contents)
    file->flags |= BFD_DECOMPRESS;
    file->flags |= BFD_DECOMPRESS;
 
 
  /* If the file is an archive, process all of its elements.  */
  /* If the file is an archive, process all of its elements.  */
  if (bfd_check_format (file, bfd_archive))
  if (bfd_check_format (file, bfd_archive))
    {
    {
 
      bfd *arfile = NULL;
      bfd *last_arfile = NULL;
      bfd *last_arfile = NULL;
 
 
 
      if (level == 0)
      printf (_("In archive %s:\n"), bfd_get_filename (file));
      printf (_("In archive %s:\n"), bfd_get_filename (file));
 
      else
 
        printf (_("In nested archive %s:\n"), bfd_get_filename (file));
 
 
      for (;;)
      for (;;)
        {
        {
          bfd_set_error (bfd_error_no_error);
          bfd_set_error (bfd_error_no_error);
 
 
          arfile = bfd_openr_next_archived_file (file, arfile);
          arfile = bfd_openr_next_archived_file (file, arfile);
Line 3335... Line 3325...
              if (bfd_get_error () != bfd_error_no_more_archived_files)
              if (bfd_get_error () != bfd_error_no_more_archived_files)
                nonfatal (bfd_get_filename (file));
                nonfatal (bfd_get_filename (file));
              break;
              break;
            }
            }
 
 
          display_bfd (arfile);
          display_any_bfd (arfile, level + 1);
 
 
          if (last_arfile != NULL)
          if (last_arfile != NULL)
            bfd_close (last_arfile);
            bfd_close (last_arfile);
          last_arfile = arfile;
          last_arfile = arfile;
        }
        }
 
 
      if (last_arfile != NULL)
      if (last_arfile != NULL)
        bfd_close (last_arfile);
        bfd_close (last_arfile);
    }
    }
  else
  else
    display_bfd (file);
    display_object_bfd (file);
 
}
 
 
 
static void
 
display_file (char *filename, char *target)
 
{
 
  bfd *file;
 
 
 
  if (get_file_size (filename) < 1)
 
    {
 
      exit_status = 1;
 
      return;
 
    }
 
 
 
  file = bfd_openr (filename, target);
 
  if (file == NULL)
 
    {
 
      nonfatal (filename);
 
      return;
 
    }
 
 
 
  display_any_bfd (file, 0);
 
 
  bfd_close (file);
  bfd_close (file);
}
}


int
int

powered by: WebSVN 2.1.0

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