Ignore:
Timestamp:
Aug 16, 2003, 6:59:22 PM (22 years ago)
Author:
bird
Message:

binutils v2.14 - offical sources.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/GNU/src/binutils/bfd/libpei.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    11/* Support for the generic parts of PE/PEI; common header information.
    2    Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001
     2   Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
    33   Free Software Foundation, Inc.
    44   Written by Cygnus Solutions.
    55
    6 This file is part of BFD, the Binary File Descriptor library.
    7 
    8 This program is free software; you can redistribute it and/or modify
    9 it under the terms of the GNU General Public License as published by
    10 the Free Software Foundation; either version 2 of the License, or
    11 (at your option) any later version.
    12 
    13 This program is distributed in the hope that it will be useful,
    14 but WITHOUT ANY WARRANTY; without even the implied warranty of
    15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    16 GNU General Public License for more details.
    17 
    18 You should have received a copy of the GNU General Public License
    19 along with this program; if not, write to the Free Software
    20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
    21 
    22 /*
    23 Most of this hacked by  Steve Chamberlain,
     6   This file is part of BFD, the Binary File Descriptor library.
     7
     8   This program is free software; you can redistribute it and/or modify
     9   it under the terms of the GNU General Public License as published by
     10   the Free Software Foundation; either version 2 of the License, or
     11   (at your option) any later version.
     12
     13   This program is distributed in the hope that it will be useful,
     14   but WITHOUT ANY WARRANTY; without even the implied warranty of
     15   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     16   GNU General Public License for more details.
     17   
     18   You should have received a copy of the GNU General Public License
     19   along with this program; if not, write to the Free Software
     20   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
     21
     22/* Most of this hacked by  Steve Chamberlain,
    2423                        sac@cygnus.com
    2524
    26 PE/PEI rearrangement (and code added): Donn Terry
    27                                        Softway Systems, Inc.
    28 */
     25   PE/PEI rearrangement (and code added): Donn Terry
     26                                       Softway Systems, Inc.  */
    2927
    3028/* Hey look, some documentation [and in a place you expect to find it]!
     
    5452   FIXME: Please add more docs here so the next poor fool that has to hack
    5553   on this code has a chance of getting something accomplished without
    56    wasting too much time.
    57 */
     54   wasting too much time.  */
    5855
    5956#ifndef GET_FCN_LNNOPTR
    6057#define GET_FCN_LNNOPTR(abfd, ext) \
    61      bfd_h_get_32(abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_lnnoptr)
     58  H_GET_32 (abfd, ext->x_sym.x_fcnary.x_fcn.x_lnnoptr)
    6259#endif
    6360
    6461#ifndef GET_FCN_ENDNDX
    65 #define GET_FCN_ENDNDX(abfd, ext)  \
    66         bfd_h_get_32(abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_endndx)
     62#define GET_FCN_ENDNDX(abfd, ext) \
     63  H_GET_32 (abfd, ext->x_sym.x_fcnary.x_fcn.x_endndx)
    6764#endif
    6865
    6966#ifndef PUT_FCN_LNNOPTR
    70 #define PUT_FCN_LNNOPTR(abfd, in, ext)  bfd_h_put_32(abfd,  in, (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_lnnoptr)
     67#define PUT_FCN_LNNOPTR(abfd, in, ext) \
     68  H_PUT_32(abfd, in, ext->x_sym.x_fcnary.x_fcn.x_lnnoptr)
    7169#endif
    7270#ifndef PUT_FCN_ENDNDX
    73 #define PUT_FCN_ENDNDX(abfd, in, ext) bfd_h_put_32(abfd, in, (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_endndx)
     71#define PUT_FCN_ENDNDX(abfd, in, ext) \
     72  H_PUT_32(abfd, in, ext->x_sym.x_fcnary.x_fcn.x_endndx)
    7473#endif
    7574#ifndef GET_LNSZ_LNNO
    76 #define GET_LNSZ_LNNO(abfd, ext) bfd_h_get_16(abfd, (bfd_byte *) ext->x_sym.x_misc.x_lnsz.x_lnno)
     75#define GET_LNSZ_LNNO(abfd, ext) \
     76  H_GET_16 (abfd, ext->x_sym.x_misc.x_lnsz.x_lnno)
    7777#endif
    7878#ifndef GET_LNSZ_SIZE
    79 #define GET_LNSZ_SIZE(abfd, ext) bfd_h_get_16(abfd, (bfd_byte *) ext->x_sym.x_misc.x_lnsz.x_size)
     79#define GET_LNSZ_SIZE(abfd, ext) \
     80  H_GET_16 (abfd, ext->x_sym.x_misc.x_lnsz.x_size)
    8081#endif
    8182#ifndef PUT_LNSZ_LNNO
    82 #define PUT_LNSZ_LNNO(abfd, in, ext) bfd_h_put_16(abfd, in, (bfd_byte *)ext->x_sym.x_misc.x_lnsz.x_lnno)
     83#define PUT_LNSZ_LNNO(abfd, in, ext) \
     84  H_PUT_16(abfd, in, ext->x_sym.x_misc.x_lnsz.x_lnno)
    8385#endif
    8486#ifndef PUT_LNSZ_SIZE
    85 #define PUT_LNSZ_SIZE(abfd, in, ext) bfd_h_put_16(abfd, in, (bfd_byte*) ext->x_sym.x_misc.x_lnsz.x_size)
     87#define PUT_LNSZ_SIZE(abfd, in, ext) \
     88  H_PUT_16(abfd, in, ext->x_sym.x_misc.x_lnsz.x_size)
    8689#endif
    8790#ifndef GET_SCN_SCNLEN
    88 #define GET_SCN_SCNLEN(abfd,  ext) bfd_h_get_32(abfd, (bfd_byte *) ext->x_scn.x_scnlen)
     91#define GET_SCN_SCNLEN(abfd, ext) \
     92  H_GET_32 (abfd, ext->x_scn.x_scnlen)
    8993#endif
    9094#ifndef GET_SCN_NRELOC
    91 #define GET_SCN_NRELOC(abfd,  ext) bfd_h_get_16(abfd, (bfd_byte *)ext->x_scn.x_nreloc)
     95#define GET_SCN_NRELOC(abfd, ext) \
     96  H_GET_16 (abfd, ext->x_scn.x_nreloc)
    9297#endif
    9398#ifndef GET_SCN_NLINNO
    94 #define GET_SCN_NLINNO(abfd, ext)  bfd_h_get_16(abfd, (bfd_byte *)ext->x_scn.x_nlinno)
     99#define GET_SCN_NLINNO(abfd, ext) \
     100  H_GET_16 (abfd, ext->x_scn.x_nlinno)
    95101#endif
    96102#ifndef PUT_SCN_SCNLEN
    97 #define PUT_SCN_SCNLEN(abfd,in, ext) bfd_h_put_32(abfd, in, (bfd_byte *) ext->x_scn.x_scnlen)
     103#define PUT_SCN_SCNLEN(abfd, in, ext) \
     104  H_PUT_32(abfd, in, ext->x_scn.x_scnlen)
    98105#endif
    99106#ifndef PUT_SCN_NRELOC
    100 #define PUT_SCN_NRELOC(abfd,in, ext) bfd_h_put_16(abfd, in, (bfd_byte *)ext->x_scn.x_nreloc)
     107#define PUT_SCN_NRELOC(abfd, in, ext) \
     108  H_PUT_16(abfd, in, ext->x_scn.x_nreloc)
    101109#endif
    102110#ifndef PUT_SCN_NLINNO
    103 #define PUT_SCN_NLINNO(abfd,in, ext)  bfd_h_put_16(abfd,in, (bfd_byte  *) ext->x_scn.x_nlinno)
     111#define PUT_SCN_NLINNO(abfd, in, ext) \
     112  H_PUT_16(abfd,in, ext->x_scn.x_nlinno)
    104113#endif
    105114#ifndef GET_LINENO_LNNO
    106 #define GET_LINENO_LNNO(abfd, ext) bfd_h_get_16(abfd, (bfd_byte *) (ext->l_lnno));
     115#define GET_LINENO_LNNO(abfd, ext) \
     116  H_GET_16 (abfd, ext->l_lnno);
    107117#endif
    108118#ifndef PUT_LINENO_LNNO
    109 #define PUT_LINENO_LNNO(abfd,val, ext) bfd_h_put_16(abfd,val,  (bfd_byte *) (ext->l_lnno));
     119#define PUT_LINENO_LNNO(abfd, val, ext) \
     120  H_PUT_16(abfd,val, ext->l_lnno);
    110121#endif
    111122
    112123/* The f_symptr field in the filehdr is sometimes 64 bits.  */
    113124#ifndef GET_FILEHDR_SYMPTR
    114 #define GET_FILEHDR_SYMPTR bfd_h_get_32
     125#define GET_FILEHDR_SYMPTR H_GET_32
    115126#endif
    116127#ifndef PUT_FILEHDR_SYMPTR
    117 #define PUT_FILEHDR_SYMPTR bfd_h_put_32
     128#define PUT_FILEHDR_SYMPTR H_PUT_32
    118129#endif
    119130
    120131/* Some fields in the aouthdr are sometimes 64 bits.  */
    121132#ifndef GET_AOUTHDR_TSIZE
    122 #define GET_AOUTHDR_TSIZE bfd_h_get_32
     133#define GET_AOUTHDR_TSIZE H_GET_32
    123134#endif
    124135#ifndef PUT_AOUTHDR_TSIZE
    125 #define PUT_AOUTHDR_TSIZE bfd_h_put_32
     136#define PUT_AOUTHDR_TSIZE H_PUT_32
    126137#endif
    127138#ifndef GET_AOUTHDR_DSIZE
    128 #define GET_AOUTHDR_DSIZE bfd_h_get_32
     139#define GET_AOUTHDR_DSIZE H_GET_32
    129140#endif
    130141#ifndef PUT_AOUTHDR_DSIZE
    131 #define PUT_AOUTHDR_DSIZE bfd_h_put_32
     142#define PUT_AOUTHDR_DSIZE H_PUT_32
    132143#endif
    133144#ifndef GET_AOUTHDR_BSIZE
    134 #define GET_AOUTHDR_BSIZE bfd_h_get_32
     145#define GET_AOUTHDR_BSIZE H_GET_32
    135146#endif
    136147#ifndef PUT_AOUTHDR_BSIZE
    137 #define PUT_AOUTHDR_BSIZE bfd_h_put_32
     148#define PUT_AOUTHDR_BSIZE H_PUT_32
    138149#endif
    139150#ifndef GET_AOUTHDR_ENTRY
    140 #define GET_AOUTHDR_ENTRY bfd_h_get_32
     151#define GET_AOUTHDR_ENTRY H_GET_32
    141152#endif
    142153#ifndef PUT_AOUTHDR_ENTRY
    143 #define PUT_AOUTHDR_ENTRY bfd_h_put_32
     154#define PUT_AOUTHDR_ENTRY H_PUT_32
    144155#endif
    145156#ifndef GET_AOUTHDR_TEXT_START
    146 #define GET_AOUTHDR_TEXT_START bfd_h_get_32
     157#define GET_AOUTHDR_TEXT_START H_GET_32
    147158#endif
    148159#ifndef PUT_AOUTHDR_TEXT_START
    149 #define PUT_AOUTHDR_TEXT_START bfd_h_put_32
     160#define PUT_AOUTHDR_TEXT_START H_PUT_32
    150161#endif
    151162#ifndef GET_AOUTHDR_DATA_START
    152 #define GET_AOUTHDR_DATA_START bfd_h_get_32
     163#define GET_AOUTHDR_DATA_START H_GET_32
    153164#endif
    154165#ifndef PUT_AOUTHDR_DATA_START
    155 #define PUT_AOUTHDR_DATA_START bfd_h_put_32
     166#define PUT_AOUTHDR_DATA_START H_PUT_32
    156167#endif
    157168
    158169/* Some fields in the scnhdr are sometimes 64 bits.  */
    159170#ifndef GET_SCNHDR_PADDR
    160 #define GET_SCNHDR_PADDR bfd_h_get_32
     171#define GET_SCNHDR_PADDR H_GET_32
    161172#endif
    162173#ifndef PUT_SCNHDR_PADDR
    163 #define PUT_SCNHDR_PADDR bfd_h_put_32
     174#define PUT_SCNHDR_PADDR H_PUT_32
    164175#endif
    165176#ifndef GET_SCNHDR_VADDR
    166 #define GET_SCNHDR_VADDR bfd_h_get_32
     177#define GET_SCNHDR_VADDR H_GET_32
    167178#endif
    168179#ifndef PUT_SCNHDR_VADDR
    169 #define PUT_SCNHDR_VADDR bfd_h_put_32
     180#define PUT_SCNHDR_VADDR H_PUT_32
    170181#endif
    171182#ifndef GET_SCNHDR_SIZE
    172 #define GET_SCNHDR_SIZE bfd_h_get_32
     183#define GET_SCNHDR_SIZE H_GET_32
    173184#endif
    174185#ifndef PUT_SCNHDR_SIZE
    175 #define PUT_SCNHDR_SIZE bfd_h_put_32
     186#define PUT_SCNHDR_SIZE H_PUT_32
    176187#endif
    177188#ifndef GET_SCNHDR_SCNPTR
    178 #define GET_SCNHDR_SCNPTR bfd_h_get_32
     189#define GET_SCNHDR_SCNPTR H_GET_32
    179190#endif
    180191#ifndef PUT_SCNHDR_SCNPTR
    181 #define PUT_SCNHDR_SCNPTR bfd_h_put_32
     192#define PUT_SCNHDR_SCNPTR H_PUT_32
    182193#endif
    183194#ifndef GET_SCNHDR_RELPTR
    184 #define GET_SCNHDR_RELPTR bfd_h_get_32
     195#define GET_SCNHDR_RELPTR H_GET_32
    185196#endif
    186197#ifndef PUT_SCNHDR_RELPTR
    187 #define PUT_SCNHDR_RELPTR bfd_h_put_32
     198#define PUT_SCNHDR_RELPTR H_PUT_32
    188199#endif
    189200#ifndef GET_SCNHDR_LNNOPTR
    190 #define GET_SCNHDR_LNNOPTR bfd_h_get_32
     201#define GET_SCNHDR_LNNOPTR H_GET_32
    191202#endif
    192203#ifndef PUT_SCNHDR_LNNOPTR
    193 #define PUT_SCNHDR_LNNOPTR bfd_h_put_32
     204#define PUT_SCNHDR_LNNOPTR H_PUT_32
    194205#endif
    195206
    196207#ifdef COFF_WITH_pep
    197208
    198 #define GET_OPTHDR_IMAGE_BASE bfd_h_get_64
    199 #define PUT_OPTHDR_IMAGE_BASE bfd_h_put_64
    200 #define GET_OPTHDR_SIZE_OF_STACK_RESERVE bfd_h_get_64
    201 #define PUT_OPTHDR_SIZE_OF_STACK_RESERVE bfd_h_put_64
    202 #define GET_OPTHDR_SIZE_OF_STACK_COMMIT bfd_h_get_64
    203 #define PUT_OPTHDR_SIZE_OF_STACK_COMMIT bfd_h_put_64
    204 #define GET_OPTHDR_SIZE_OF_HEAP_RESERVE bfd_h_get_64
    205 #define PUT_OPTHDR_SIZE_OF_HEAP_RESERVE bfd_h_put_64
    206 #define GET_OPTHDR_SIZE_OF_HEAP_COMMIT bfd_h_get_64
    207 #define PUT_OPTHDR_SIZE_OF_HEAP_COMMIT bfd_h_put_64
     209#define GET_OPTHDR_IMAGE_BASE H_GET_64
     210#define PUT_OPTHDR_IMAGE_BASE H_PUT_64
     211#define GET_OPTHDR_SIZE_OF_STACK_RESERVE H_GET_64
     212#define PUT_OPTHDR_SIZE_OF_STACK_RESERVE H_PUT_64
     213#define GET_OPTHDR_SIZE_OF_STACK_COMMIT H_GET_64
     214#define PUT_OPTHDR_SIZE_OF_STACK_COMMIT H_PUT_64
     215#define GET_OPTHDR_SIZE_OF_HEAP_RESERVE H_GET_64
     216#define PUT_OPTHDR_SIZE_OF_HEAP_RESERVE H_PUT_64
     217#define GET_OPTHDR_SIZE_OF_HEAP_COMMIT H_GET_64
     218#define PUT_OPTHDR_SIZE_OF_HEAP_COMMIT H_PUT_64
    208219#define GET_PDATA_ENTRY bfd_get_64
    209220
     
    228239#else /* !COFF_WITH_pep */
    229240
    230 #define GET_OPTHDR_IMAGE_BASE bfd_h_get_32
    231 #define PUT_OPTHDR_IMAGE_BASE bfd_h_put_32
    232 #define GET_OPTHDR_SIZE_OF_STACK_RESERVE bfd_h_get_32
    233 #define PUT_OPTHDR_SIZE_OF_STACK_RESERVE bfd_h_put_32
    234 #define GET_OPTHDR_SIZE_OF_STACK_COMMIT bfd_h_get_32
    235 #define PUT_OPTHDR_SIZE_OF_STACK_COMMIT bfd_h_put_32
    236 #define GET_OPTHDR_SIZE_OF_HEAP_RESERVE bfd_h_get_32
    237 #define PUT_OPTHDR_SIZE_OF_HEAP_RESERVE bfd_h_put_32
    238 #define GET_OPTHDR_SIZE_OF_HEAP_COMMIT bfd_h_get_32
    239 #define PUT_OPTHDR_SIZE_OF_HEAP_COMMIT bfd_h_put_32
     241#define GET_OPTHDR_IMAGE_BASE H_GET_32
     242#define PUT_OPTHDR_IMAGE_BASE H_PUT_32
     243#define GET_OPTHDR_SIZE_OF_STACK_RESERVE H_GET_32
     244#define PUT_OPTHDR_SIZE_OF_STACK_RESERVE H_PUT_32
     245#define GET_OPTHDR_SIZE_OF_STACK_COMMIT H_GET_32
     246#define PUT_OPTHDR_SIZE_OF_STACK_COMMIT H_PUT_32
     247#define GET_OPTHDR_SIZE_OF_HEAP_RESERVE H_GET_32
     248#define PUT_OPTHDR_SIZE_OF_HEAP_RESERVE H_PUT_32
     249#define GET_OPTHDR_SIZE_OF_HEAP_COMMIT H_GET_32
     250#define PUT_OPTHDR_SIZE_OF_HEAP_COMMIT H_PUT_32
    240251#define GET_PDATA_ENTRY bfd_get_32
    241252
     
    300311#define coff_swap_scnhdr_out _bfd_XXi_swap_scnhdr_out
    301312
    302 boolean _bfd_XX_print_private_bfd_data_common PARAMS ((bfd *, PTR));
    303 
    304 boolean _bfd_XX_bfd_copy_private_bfd_data_common PARAMS ((bfd *, bfd *));
     313bfd_boolean _bfd_XX_print_private_bfd_data_common PARAMS ((bfd *, PTR));
     314
     315bfd_boolean _bfd_XX_bfd_copy_private_bfd_data_common PARAMS ((bfd *, bfd *));
    305316
    306317void _bfd_XX_get_symbol_info PARAMS ((bfd *, asymbol *, symbol_info *));
    307318
    308 boolean _bfd_XXi_final_link_postscript
     319bfd_boolean _bfd_XXi_final_link_postscript
    309320  PARAMS ((bfd *, struct coff_final_link_info *));
    310321
     
    318329unsigned int _bfd_XX_only_swap_filehdr_out PARAMS ((bfd*, PTR, PTR));
    319330unsigned int _bfd_XXi_only_swap_filehdr_out PARAMS ((bfd*, PTR, PTR));
    320 boolean _bfd_XX_bfd_copy_private_section_data
     331bfd_boolean _bfd_XX_bfd_copy_private_section_data
    321332  PARAMS ((bfd *, asection *, bfd *, asection *));
     333
     334/* Macro: Returns true if the bfd is a PE executable as opposed to a PE object file.  */
     335#define bfd_pe_executable_p(abfd)  (strncmp ((abfd)->xvec->name, "pei-", 4) == 0)
Note: See TracChangeset for help on using the changeset viewer.