Ignore:
Timestamp:
Aug 16, 2003, 11:33:53 PM (22 years ago)
Author:
bird
Message:

Joined the port of 2.11.2 with 2.14.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/binutils/include/aout/aout64.h

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r617 r618  
    11/* `a.out' object-file definitions, including extensions to 64-bit fields
    22
    3    Copyright 2001 Free Software Foundation, Inc.
     3   Copyright 2001, 2003 Free Software Foundation, Inc.
    44
    55   This program is free software; you can redistribute it and/or modify
     
    2020#define __A_OUT_64_H__
    2121
    22 /* This is the layout on disk of the 32-bit or 64-bit exec header. */
     22#ifndef BYTES_IN_WORD
     23#define BYTES_IN_WORD 4
     24#endif
     25
     26/* This is the layout on disk of the 32-bit or 64-bit exec header.  */
    2327
    2428#ifndef external_exec
    2529struct external_exec
    2630{
    27   bfd_byte e_info[4];           /* magic number and stuff               */
    28   bfd_byte e_text[BYTES_IN_WORD]; /* length of text section in bytes    */
    29   bfd_byte e_data[BYTES_IN_WORD]; /* length of data section in bytes    */
    30   bfd_byte e_bss[BYTES_IN_WORD]; /* length of bss area in bytes                 */
    31   bfd_byte e_syms[BYTES_IN_WORD]; /* length of symbol table in bytes    */
    32   bfd_byte e_entry[BYTES_IN_WORD]; /* start address                     */
    33   bfd_byte e_trsize[BYTES_IN_WORD]; /* length of text relocation info   */
    34   bfd_byte e_drsize[BYTES_IN_WORD]; /* length of data relocation info   */
     31  bfd_byte e_info[4];               /* Magic number and stuff.  */
     32  bfd_byte e_text[BYTES_IN_WORD];   /* Length of text section in bytes.  */
     33  bfd_byte e_data[BYTES_IN_WORD];   /* Length of data section in bytes.  */
     34  bfd_byte e_bss[BYTES_IN_WORD];    /* Length of bss area in bytes.  */
     35  bfd_byte e_syms[BYTES_IN_WORD];   /* Length of symbol table in bytes.  */
     36  bfd_byte e_entry[BYTES_IN_WORD];  /* Start address.  */
     37  bfd_byte e_trsize[BYTES_IN_WORD]; /* Length of text relocation info.  */
     38  bfd_byte e_drsize[BYTES_IN_WORD]; /* Length of data relocation info.  */
    3539};
    3640
    3741#define EXEC_BYTES_SIZE (4 + BYTES_IN_WORD * 7)
    3842
    39 /* Magic numbers for a.out files */
     43/* Magic numbers for a.out files. */
    4044
    4145#if ARCH_SIZE==64
    42 #define OMAGIC 0x1001           /* Code indicating object file  */
     46#define OMAGIC 0x1001           /* Code indicating object file.  */
    4347#define ZMAGIC 0x1002           /* Code indicating demand-paged executable.  */
    4448#define NMAGIC 0x1003           /* Code indicating pure executable.  */
     
    5054                        && N_MAGIC(x) != ZMAGIC)
    5155#else
    52 #define OMAGIC 0407             /* ...object file or impure executable.  */
     56#define OMAGIC 0407             /* Object file or impure executable.  */
    5357#define NMAGIC 0410             /* Code indicating pure executable.  */
    5458#define ZMAGIC 0413             /* Code indicating demand-paged executable.  */
     
    127131    * QMAGIC is always like a ZMAGIC for which N_HEADER_IN_TEXT is true,
    128132    and for which the starting address is TARGET_PAGE_SIZE (or should this be
    129     SEGMENT_SIZE?) (TEXT_START_ADDR only applies to ZMAGIC, not to QMAGIC).
    130     */
     133    SEGMENT_SIZE?) (TEXT_START_ADDR only applies to ZMAGIC, not to QMAGIC).  */
    131134
    132135/* This macro is only relevant for ZMAGIC files; QMAGIC always has the header
    133136   in the text.  */
    134137#ifndef N_HEADER_IN_TEXT
    135 #define N_HEADER_IN_TEXT(x) (((x).a_entry & (TARGET_PAGE_SIZE-1)) >= EXEC_BYTES_SIZE)
     138#define N_HEADER_IN_TEXT(x) \
     139  (((x).a_entry & (TARGET_PAGE_SIZE-1)) >= EXEC_BYTES_SIZE)
    136140#endif
    137141
     
    153157#ifndef N_TXTADDR
    154158#define N_TXTADDR(x) \
    155     (/* The address of a QMAGIC file is always one page in, */ \
    156      /* with the header in the text.  */ \
    157      N_IS_QMAGIC (x) ? TARGET_PAGE_SIZE + EXEC_BYTES_SIZE : \
    158      N_MAGIC(x) != ZMAGIC ? 0 : /* object file or NMAGIC */\
    159      N_SHARED_LIB(x) ? 0 :      \
    160      N_HEADER_IN_TEXT(x)  ?     \
    161             TEXT_START_ADDR + EXEC_BYTES_SIZE : /* no padding */\
    162             TEXT_START_ADDR                     /* a page of padding */\
    163     )
     159    (/* The address of a QMAGIC file is always one page in,             \
     160        with the header in the text.  */                                \
     161     N_IS_QMAGIC (x)                                                    \
     162     ? (bfd_vma) TARGET_PAGE_SIZE + EXEC_BYTES_SIZE                     \
     163     : (N_MAGIC (x) != ZMAGIC                                           \
     164        ? (bfd_vma) 0   /* Object file or NMAGIC.  */                   \
     165        : (N_SHARED_LIB (x)                                             \
     166           ? (bfd_vma) 0                                                \
     167           : (N_HEADER_IN_TEXT (x)                                      \
     168              ? (bfd_vma) TEXT_START_ADDR + EXEC_BYTES_SIZE             \
     169              : (bfd_vma) TEXT_START_ADDR))))
    164170#endif
    165171
     
    179185/* Offset in an a.out of the start of the text section. */
    180186#ifndef N_TXTOFF
    181 #define N_TXTOFF(x)     \
    182     (/* For {O,N,Q}MAGIC, no padding.  */ \
    183      N_MAGIC(x) != ZMAGIC ? EXEC_BYTES_SIZE : \
    184      N_SHARED_LIB(x) ? 0 : \
    185      N_HEADER_IN_TEXT(x) ?      \
    186             EXEC_BYTES_SIZE :                   /* no padding */\
    187             ZMAGIC_DISK_BLOCK_SIZE              /* a page of padding */\
    188     )
     187#define N_TXTOFF(x)                                                     \
     188    (/* For {O,N,Q}MAGIC, no padding.  */                               \
     189     N_MAGIC (x) != ZMAGIC                                              \
     190     ? EXEC_BYTES_SIZE                                                  \
     191     : (N_SHARED_LIB (x)                                                \
     192        ? 0                                                             \
     193        : (N_HEADER_IN_TEXT (x)                                         \
     194           ? EXEC_BYTES_SIZE            /* No padding.  */              \
     195           : ZMAGIC_DISK_BLOCK_SIZE     /* A page of padding.  */)))
    189196#endif
    190197/* Size of the text section.  It's always as stated, except that we
     
    195202#ifndef N_TXTSIZE
    196203#define N_TXTSIZE(x) \
    197     (/* For QMAGIC, we don't consider the header part of the text section.  */\
    198      N_IS_QMAGIC (x) ? (x).a_text - EXEC_BYTES_SIZE : \
    199      (N_MAGIC(x) != ZMAGIC || N_SHARED_LIB(x)) ? (x).a_text : \
    200      N_HEADER_IN_TEXT(x)  ?     \
    201             (x).a_text - EXEC_BYTES_SIZE:       /* no padding */\
    202             (x).a_text                          /* a page of padding */\
    203     )
     204  (/* For QMAGIC, we don't consider the header part of the text section.  */\
     205   N_IS_QMAGIC (x)                                                      \
     206   ? (x).a_text - EXEC_BYTES_SIZE                                       \
     207   : ((N_MAGIC (x) != ZMAGIC || N_SHARED_LIB (x))                       \
     208      ? (x).a_text                                                      \
     209      : (N_HEADER_IN_TEXT (x)                                           \
     210         ? (x).a_text - EXEC_BYTES_SIZE /* No padding.  */              \
     211         : (x).a_text                   /* A page of padding.  */ )))
    204212#endif
    205213/* The address of the data segment in virtual memory.
    206214   It is the text segment address, plus text segment size, rounded
    207    up to a N_SEGSIZE boundary for pure or pageable files. */
     215   up to a N_SEGSIZE boundary for pure or pageable files.  */
    208216#ifndef N_DATADDR
    209217#define N_DATADDR(x) \
    210     (N_MAGIC(x)==OMAGIC? (N_TXTADDR(x)+N_TXTSIZE(x)) \
    211      :  (N_SEGSIZE(x) + ((N_TXTADDR(x)+N_TXTSIZE(x)-1) & ~(N_SEGSIZE(x)-1))))
     218  (N_MAGIC (x) == OMAGIC                                                \
     219   ? (N_TXTADDR (x) + N_TXTSIZE (x))                                    \
     220   : (N_SEGSIZE (x) + ((N_TXTADDR (x) + N_TXTSIZE (x) - 1)              \
     221                       & ~ (bfd_vma) (N_SEGSIZE (x) - 1))))
    212222#endif
    213223/* The address of the BSS segment -- immediately after the data segment.  */
    214224
    215 #define N_BSSADDR(x)    (N_DATADDR(x) + (x).a_data)
     225#define N_BSSADDR(x)    (N_DATADDR (x) + (x).a_data)
    216226
    217227/* Offsets of the various portions of the file after the text segment.  */
     
    230240
    231241#ifndef N_DATOFF
    232 #define N_DATOFF(x) \
    233  (N_TXTOFF(x) + N_TXTSIZE(x))
    234 #endif
    235 
     242#define N_DATOFF(x)     (N_TXTOFF (x) + N_TXTSIZE (x))
     243#endif
    236244#ifndef N_TRELOFF
    237 #define N_TRELOFF(x)    ( N_DATOFF(x) + (x).a_data )
     245#define N_TRELOFF(x)    (N_DATOFF (x) + (x).a_data)
    238246#endif
    239247#ifndef N_DRELOFF
    240 #define N_DRELOFF(x)    ( N_TRELOFF(x) + (x).a_trsize )
     248#define N_DRELOFF(x)    (N_TRELOFF (x) + (x).a_trsize)
    241249#endif
    242250#ifndef N_SYMOFF
    243 #define N_SYMOFF(x)     ( N_DRELOFF(x) + (x).a_drsize )
     251#define N_SYMOFF(x)     (N_DRELOFF (x) + (x).a_drsize)
    244252#endif
    245253#ifndef N_STROFF
    246 #define N_STROFF(x)     ( N_SYMOFF(x) + (x).a_syms )
     254#define N_STROFF(x)     (N_SYMOFF (x) + (x).a_syms)
    247255#endif
    248256
     
    250258/* Symbols */
    251259#ifndef external_nlist
    252 struct external_nlist {
    253   bfd_byte e_strx[BYTES_IN_WORD];       /* index into string table of name */
    254   bfd_byte e_type[1];                   /* type of symbol */
    255   bfd_byte e_other[1];                  /* misc info (usually empty) */
    256   bfd_byte e_desc[2];                   /* description field */
    257   bfd_byte e_value[BYTES_IN_WORD];      /* value of symbol */
     260struct external_nlist
     261{
     262  bfd_byte e_strx[BYTES_IN_WORD];       /* Index into string table of name.  */
     263  bfd_byte e_type[1];                   /* Type of symbol.  */
     264  bfd_byte e_other[1];                  /* Misc info (usually empty).  */
     265  bfd_byte e_desc[2];                   /* Description field.  */
     266  bfd_byte e_value[BYTES_IN_WORD];      /* Value of symbol.  */
    258267};
    259268#define EXTERNAL_NLIST_SIZE (BYTES_IN_WORD+4+BYTES_IN_WORD)
    260269#endif
    261270
    262 struct internal_nlist {
    263   unsigned long n_strx;                 /* index into string table of name */
    264   unsigned char n_type;                 /* type of symbol */
    265   unsigned char n_other;                /* misc info (usually empty) */
    266   unsigned short n_desc;                /* description field */
    267   bfd_vma n_value;                      /* value of symbol */
     271struct internal_nlist
     272{
     273  unsigned long n_strx;                 /* Index into string table of name.  */
     274  unsigned char n_type;                 /* Type of symbol.  */
     275  unsigned char n_other;                /* Misc info (usually empty).  */
     276  unsigned short n_desc;                /* Description field.  */
     277  bfd_vma n_value;                      /* Value of symbol.  */
    268278};
    269279
    270280/* The n_type field is the symbol type, containing:  */
    271281
    272 #define N_UNDF  0       /* Undefined symbol */
    273 #define N_ABS   2       /* Absolute symbol -- defined at particular addr */
    274 #define N_TEXT  4       /* Text sym -- defined at offset in text seg */
    275 #define N_DATA  6       /* Data sym -- defined at offset in data seg */
    276 #define N_BSS   8       /* BSS  sym -- defined at offset in zero'd seg */
    277 #define N_COMM  0x12    /* Common symbol (visible after shared lib dynlink) */
    278 #define N_FN    0x1f    /* File name of .o file */
    279 #define N_FN_SEQ 0x0C   /* N_FN from Sequent compilers (sigh) */
     282#define N_UNDF  0       /* Undefined symbol. */
     283#define N_ABS   2       /* Absolute symbol -- defined at particular addr. */
     284#define N_TEXT  4       /* Text sym -- defined at offset in text seg. */
     285#define N_DATA  6       /* Data sym -- defined at offset in data seg. */
     286#define N_BSS   8       /* BSS  sym -- defined at offset in zero'd seg. */
     287#define N_COMM  0x12    /* Common symbol (visible after shared lib dynlink). */
     288#define N_FN    0x1f    /* File name of .o file. */
     289#define N_FN_SEQ 0x0C   /* N_FN from Sequent compilers (sigh). */
    280290/* Note: N_EXT can only be usefully OR-ed with N_UNDF, N_ABS, N_TEXT,
    281291   N_DATA, or N_BSS.  When the low-order bit of other types is set,
    282292   (e.g. N_WARNING versus N_FN), they are two different types.  */
    283 #define N_EXT   1       /* External symbol (as opposed to local-to-this-file) */
     293#define N_EXT   1       /* External symbol (as opposed to local-to-this-file). */
    284294#define N_TYPE  0x1e
    285 #define N_STAB  0xe0    /* If any of these bits are on, it's a debug symbol */
     295#define N_STAB  0xe0    /* If any of these bits are on, it's a debug symbol. */
    286296
    287297#define N_INDR 0x0a
     
    299309
    300310/* These appear as input to LD, in a .o file.  */
    301 #define N_SETA  0x14            /* Absolute set element symbol */
    302 #define N_SETT  0x16            /* Text set element symbol */
    303 #define N_SETD  0x18            /* Data set element symbol */
    304 #define N_SETB  0x1A            /* Bss set element symbol */
     311#define N_SETA  0x14            /* Absolute set element symbol. */
     312#define N_SETT  0x16            /* Text set element symbol. */
     313#define N_SETD  0x18            /* Data set element symbol. */
     314#define N_SETB  0x1A            /* Bss set element symbol. */
    305315
    306316/* This is output from LD.  */
     
    337347  the target with a displacement of 16 or 32 bits. On the sparc, move
    338348  instructions use an offset of 14 bits, so the offset is stored in
    339   the reloc field, and the data in the section is ignored.
    340 */
     349  the reloc field, and the data in the section is ignored.  */
    341350
    342351/* This structure describes a single relocation to be performed.
     
    345354   Likewise, the data-relocation section applies to the data section.  */
    346355
    347 struct reloc_std_external {
    348   bfd_byte      r_address[BYTES_IN_WORD];       /* offset of of data to relocate        */
    349   bfd_byte r_index[3];  /* symbol table index of symbol         */
    350   bfd_byte r_type[1];   /* relocation type                      */
     356struct reloc_std_external
     357{
     358  bfd_byte r_address[BYTES_IN_WORD];    /* Offset of of data to relocate.  */
     359  bfd_byte r_index[3];                  /* Symbol table index of symbol.  */
     360  bfd_byte r_type[1];                   /* Relocation type.  */
    351361};
    352362
     
    371381#define RELOC_STD_BITS_RELATIVE_LITTLE  ((unsigned int) 0x40)
    372382
    373 #define RELOC_STD_SIZE  (BYTES_IN_WORD + 3 + 1)         /* Bytes per relocation entry */
     383#define RELOC_STD_SIZE  (BYTES_IN_WORD + 3 + 1)         /* Bytes per relocation entry. */
    374384
    375385struct reloc_std_internal
     
    394404  /* The next three bits are for SunOS shared libraries, and seem to
    395405     be undocumented.  */
    396   unsigned int r_baserel:1;     /* Linkage table relative */
    397   unsigned int r_jmptable:1;    /* pc-relative to jump table */
    398   unsigned int r_relative:1;    /* "relative relocation" */
     406  unsigned int r_baserel:1;     /* Linkage table relative. */
     407  unsigned int r_jmptable:1;    /* pc-relative to jump table. */
     408  unsigned int r_relative:1;    /* "relative relocation". */
    399409  /* unused */
    400   unsigned int r_pad:1;         /* Padding -- set to zero */
    401 };
    402 
    403 
    404 /* EXTENDED RELOCS  */
    405 
    406 struct reloc_ext_external {
    407   bfd_byte r_address[BYTES_IN_WORD];    /* offset of of data to relocate        */
    408   bfd_byte r_index[3];  /* symbol table index of symbol         */
    409   bfd_byte r_type[1];   /* relocation type                      */
    410   bfd_byte r_addend[BYTES_IN_WORD];     /* datum addend                         */
     410  unsigned int r_pad:1;         /* Padding -- set to zero.  */
     411};
     412
     413
     414/* EXTENDED RELOCS.   */
     415
     416struct reloc_ext_external
     417{
     418  bfd_byte r_address[BYTES_IN_WORD];    /* Offset of of data to relocate.  */
     419  bfd_byte r_index[3];                  /* Symbol table index of symbol.  */
     420  bfd_byte r_type[1];                   /* Relocation type.  */
     421  bfd_byte r_addend[BYTES_IN_WORD];     /* Datum addend.  */
    411422};
    412423
     
    435446#endif
    436447
    437 /* Bytes per relocation entry */
     448/* Bytes per relocation entry. */
    438449#define RELOC_EXT_SIZE  (BYTES_IN_WORD + 3 + 1 + BYTES_IN_WORD)
    439450
    440451enum reloc_type
    441452{
    442   /* simple relocations */
     453  /* Simple relocations. */
    443454  RELOC_8,                      /* data[0:7] = addend + sv              */
    444455  RELOC_16,                     /* data[0:15] = addend + sv             */
    445456  RELOC_32,                     /* data[0:31] = addend + sv             */
    446   /* pc-rel displacement */
     457  /* PC-rel displacement. */
    447458  RELOC_DISP8,                  /* data[0:7] = addend - pc + sv         */
    448459  RELOC_DISP16,                 /* data[0:15] = addend - pc + sv        */
    449460  RELOC_DISP32,                 /* data[0:31] = addend - pc + sv        */
    450   /* Special */
     461  /* Special. */
    451462  RELOC_WDISP30,                /* data[0:29] = (addend + sv - pc)>>2   */
    452463  RELOC_WDISP22,                /* data[0:21] = (addend + sv - pc)>>2   */
     
    457468  RELOC_SFA_BASE,               
    458469  RELOC_SFA_OFF13,
    459   /* P.I.C. (base-relative) */
     470  /* P.I.C. (base-relative). */
    460471  RELOC_BASE10,                 /* Not sure - maybe we can do this the */
    461472  RELOC_BASE13,                 /* right way now */
    462473  RELOC_BASE22,
    463   /* for some sort of pc-rel P.I.C. (?) */
     474  /* For some sort of pc-rel P.I.C. (?) */
    464475  RELOC_PC10,
    465476  RELOC_PC22,
    466   /* P.I.C. jump table */
     477  /* P.I.C. jump table. */
    467478  RELOC_JMP_TBL,
    468   /* reputedly for shared libraries somehow */
     479  /* Reputedly for shared libraries somehow. */
    469480  RELOC_SEGOFF16,
    470481  RELOC_GLOB_DAT,
     
    478489  RELOC_HLO10,                  /* data[0:9] = (addend + sv) >> 32      */
    479490 
    480   /* 29K relocation types */
     491  /* 29K relocation types. */
    481492  RELOC_JUMPTARG,
    482493  RELOC_CONST,
    483494  RELOC_CONSTH,
    484495 
    485   /* All the new ones I can think of, for sparc v9 */
    486 
     496  /* All the new ones I can think of, for sparc v9.  */
    487497  RELOC_64,                     /* data[0:63] = addend + sv             */
    488498  RELOC_DISP64,                 /* data[0:63] = addend - pc + sv        */
     
    494504     Since this is a clean slate, can we throw away the ones we dont
    495505     understand ? Should we sort the values ? What about using a
    496      microcode format like the 68k ?
    497      */
     506     microcode format like the 68k ?  */
    498507  NO_RELOC
    499508  };
    500509
    501510
    502 struct reloc_internal {
    503   bfd_vma r_address;            /* offset of of data to relocate        */
    504   long  r_index;                /* symbol table index of symbol         */
    505   enum reloc_type r_type;       /* relocation type                      */
    506   bfd_vma r_addend;             /* datum addend                         */
     511struct reloc_internal
     512{
     513  bfd_vma r_address;            /* Offset of of data to relocate.  */
     514  long  r_index;                /* Symbol table index of symbol.  */
     515  enum reloc_type r_type;       /* Relocation type.  */
     516  bfd_vma r_addend;             /* Datum addend.  */
    507517};
    508518
     
    511521
    512522   Q.
    513    What about archive indexes ?
    514 
    515  */
     523   What about archive indexes ?  */
    516524
    517525#endif                          /* __A_OUT_64_H__ */
Note: See TracChangeset for help on using the changeset viewer.