Back to index

cell-binutils  2.17cvs20070401
Defines | Functions | Variables
coff-ia64.c File Reference
#include "bfd.h"
#include "sysdep.h"
#include "libbfd.h"
#include "coff/ia64.h"
#include "coff/internal.h"
#include "coff/pe.h"
#include "libcoff.h"
#include "coffcode.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.


#define COFF_PAGE_SIZE   0x1000
#define BADMAG(x)   IA64BADMAG(x)
#define IA64   1 /* Customize coffcode.h */
#define RTYPE2HOWTO(cache_ptr, dst)   (cache_ptr)->howto = howto_table + (dst)->r_type;


static const bfd_target
PARAMS ((bfd *))
static const bfd_targetia64coff_object_p (bfd *abfd)


static reloc_howto_type howto_table []
const bfd_target ia64coff_vec

Define Documentation

#define BADMAG (   x)    IA64BADMAG(x)

Definition at line 39 of file coff-ia64.c.

Definition at line 29 of file coff-ia64.c.

#define COFF_PAGE_SIZE   0x1000

Definition at line 32 of file coff-ia64.c.

#define IA64   1 /* Customize coffcode.h */

Definition at line 40 of file coff-ia64.c.

#define RTYPE2HOWTO (   cache_ptr,
)    (cache_ptr)->howto = howto_table + (dst)->r_type;

Definition at line 48 of file coff-ia64.c.

Function Documentation

static const bfd_target* ia64coff_object_p ( bfd abfd) [static]

Definition at line 71 of file coff-ia64.c.

    struct external_PEI_DOS_hdr dos_hdr;
    struct external_PEI_IMAGE_hdr image_hdr;
    file_ptr offset;

    if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0
       || (bfd_bread (&dos_hdr, (bfd_size_type) sizeof (dos_hdr), abfd)
           != sizeof (dos_hdr)))
       if (bfd_get_error () != bfd_error_system_call)
         bfd_set_error (bfd_error_wrong_format);
       return NULL;

    /* There are really two magic numbers involved; the magic number
       that says this is a NT executable (PEI) and the magic number
       that determines the architecture.  The former is DOSMAGIC,
       stored in the e_magic field.  The latter is stored in the
       f_magic field.  If the NT magic number isn't valid, the
       architecture magic number could be mimicked by some other
       field (specifically, the number of relocs in section 3).  Since
       this routine can only be called correctly for a PEI file, check
       the e_magic number here, and, if it doesn't match, clobber the
       f_magic number so that we don't get a false match.  */
    if (H_GET_16 (abfd, dos_hdr.e_magic) != DOSMAGIC)
       bfd_set_error (bfd_error_wrong_format);
       return NULL;

    offset = H_GET_32 (abfd, dos_hdr.e_lfanew);
    if (bfd_seek (abfd, offset, SEEK_SET) != 0
       || (bfd_bread (&image_hdr, (bfd_size_type) sizeof (image_hdr), abfd)
           != sizeof (image_hdr)))
       if (bfd_get_error () != bfd_error_system_call)
         bfd_set_error (bfd_error_wrong_format);
       return NULL;

    if (H_GET_32 (abfd, image_hdr.nt_signature)
       != 0x4550)
       bfd_set_error (bfd_error_wrong_format);
       return NULL;

    /* Here is the hack.  coff_object_p wants to read filhsz bytes to
       pick up the COFF header for PE, see "struct external_PEI_filehdr"
       in include/coff/pe.h.  We adjust so that that will work. */
    if (bfd_seek (abfd, offset - sizeof (dos_hdr), SEEK_SET) != 0)
       if (bfd_get_error () != bfd_error_system_call)
         bfd_set_error (bfd_error_wrong_format);
       return NULL;

  return coff_object_p (abfd);

Here is the call graph for this function:

static const bfd_target* ia64coff_object_p PARAMS ( (bfd *)  ) [static]

Variable Documentation

reloc_howto_type howto_table[] [static]
Initial value:

Definition at line 34 of file coff-ia64.c.

Definition at line 141 of file coff-ia64.c.