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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-6.8/] [bfd/] [elfcore.h] - Diff between revs 157 and 225

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

Rev 157 Rev 225
Line 1... Line 1...
/* ELF core file support for BFD.
/* ELF core file support for BFD.
   Copyright 1995, 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2005, 2007
   Copyright 1995, 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2005, 2007,
   Free Software Foundation, Inc.
   2008 Free Software Foundation, Inc.
 
 
   This file is part of BFD, the Binary File Descriptor library.
   This file is part of BFD, the Binary File Descriptor library.
 
 
   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 157... Line 157...
          const struct elf_backend_data *back;
          const struct elf_backend_data *back;
 
 
          if ((*target_ptr)->flavour != bfd_target_elf_flavour)
          if ((*target_ptr)->flavour != bfd_target_elf_flavour)
            continue;
            continue;
          back = xvec_get_elf_backend_data (*target_ptr);
          back = xvec_get_elf_backend_data (*target_ptr);
 
          if (back->s->arch_size != ARCH_SIZE)
 
            continue;
          if (back->elf_machine_code == i_ehdrp->e_machine
          if (back->elf_machine_code == i_ehdrp->e_machine
              || (back->elf_machine_alt1 != 0
              || (back->elf_machine_alt1 != 0
                  && i_ehdrp->e_machine == back->elf_machine_alt1)
                  && i_ehdrp->e_machine == back->elf_machine_alt1)
              || (back->elf_machine_alt2 != 0
              || (back->elf_machine_alt2 != 0
                  && i_ehdrp->e_machine == back->elf_machine_alt2))
                  && i_ehdrp->e_machine == back->elf_machine_alt2))
Line 186... Line 188...
  if (bfd_seek (abfd, (file_ptr) i_ehdrp->e_phoff, SEEK_SET) != 0)
  if (bfd_seek (abfd, (file_ptr) i_ehdrp->e_phoff, SEEK_SET) != 0)
    goto wrong;
    goto wrong;
 
 
  /* Allocate space for the program headers.  */
  /* Allocate space for the program headers.  */
  amt = sizeof (*i_phdrp) * i_ehdrp->e_phnum;
  amt = sizeof (*i_phdrp) * i_ehdrp->e_phnum;
  i_phdrp = bfd_alloc (abfd, amt);
  i_phdrp = (Elf_Internal_Phdr *) bfd_alloc (abfd, amt);
  if (!i_phdrp)
  if (!i_phdrp)
    goto fail;
    goto fail;
 
 
  elf_tdata (abfd)->phdr = i_phdrp;
  elf_tdata (abfd)->phdr = i_phdrp;
 
 
Line 225... Line 227...
  /* Process each program header.  */
  /* Process each program header.  */
  for (phindex = 0; phindex < i_ehdrp->e_phnum; ++phindex)
  for (phindex = 0; phindex < i_ehdrp->e_phnum; ++phindex)
    if (! bfd_section_from_phdr (abfd, i_phdrp + phindex, (int) phindex))
    if (! bfd_section_from_phdr (abfd, i_phdrp + phindex, (int) phindex))
      goto fail;
      goto fail;
 
 
 
  /* Check for core truncation.  */
 
  {
 
    bfd_size_type high = 0;
 
    struct stat statbuf;
 
    for (phindex = 0; phindex < i_ehdrp->e_phnum; ++phindex)
 
      {
 
        Elf_Internal_Phdr *p = i_phdrp + phindex;
 
        if (p->p_filesz)
 
          {
 
            bfd_size_type current = p->p_offset + p->p_filesz;
 
            if (high < current)
 
              high = current;
 
          }
 
      }
 
    if (bfd_stat (abfd, &statbuf) == 0)
 
      {
 
        if ((bfd_size_type) statbuf.st_size < high)
 
          {
 
            (*_bfd_error_handler)
 
              (_("Warning: %B is truncated: expected core file "
 
                 "size >= %lu, found: %lu."),
 
               abfd, (unsigned long) high, (unsigned long) statbuf.st_size);
 
          }
 
      }
 
  }
 
 
  /* Save the entry point from the ELF header.  */
  /* Save the entry point from the ELF header.  */
  bfd_get_start_address (abfd) = i_ehdrp->e_entry;
  bfd_get_start_address (abfd) = i_ehdrp->e_entry;
 
 
  bfd_preserve_finish (abfd, &preserve);
  bfd_preserve_finish (abfd, &preserve);
  return abfd->xvec;
  return abfd->xvec;

powered by: WebSVN 2.1.0

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