root/include/linux/a.out.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


   1 #ifndef __A_OUT_GNU_H__
   2 #define __A_OUT_GNU_H__
   3 
   4 #define __GNU_EXEC_MACROS__
   5 
   6 #ifndef __STRUCT_EXEC_OVERRIDE__
   7 
   8 #include <asm/a.out.h>
   9 
  10 #endif /* __STRUCT_EXEC_OVERRIDE__ */
  11 
  12 /* these go in the N_MACHTYPE field */
  13 enum machine_type {
  14 #if defined (M_OLDSUN2)
  15   M__OLDSUN2 = M_OLDSUN2,
  16 #else
  17   M_OLDSUN2 = 0,
  18 #endif
  19 #if defined (M_68010)
  20   M__68010 = M_68010,
  21 #else
  22   M_68010 = 1,
  23 #endif
  24 #if defined (M_68020)
  25   M__68020 = M_68020,
  26 #else
  27   M_68020 = 2,
  28 #endif
  29 #if defined (M_SPARC)
  30   M__SPARC = M_SPARC,
  31 #else
  32   M_SPARC = 3,
  33 #endif
  34   /* skip a bunch so we don't run into any of sun's numbers */
  35   M_386 = 100,
  36 };
  37 
  38 #if !defined (N_MAGIC)
  39 #define N_MAGIC(exec) ((exec).a_info & 0xffff)
  40 #endif
  41 #define N_MACHTYPE(exec) ((enum machine_type)(((exec).a_info >> 16) & 0xff))
  42 #define N_FLAGS(exec) (((exec).a_info >> 24) & 0xff)
  43 #define N_SET_INFO(exec, magic, type, flags) \
  44         ((exec).a_info = ((magic) & 0xffff) \
  45          | (((int)(type) & 0xff) << 16) \
  46          | (((flags) & 0xff) << 24))
  47 #define N_SET_MAGIC(exec, magic) \
  48         ((exec).a_info = (((exec).a_info & 0xffff0000) | ((magic) & 0xffff)))
  49 
  50 #define N_SET_MACHTYPE(exec, machtype) \
  51         ((exec).a_info = \
  52          ((exec).a_info&0xff00ffff) | ((((int)(machtype))&0xff) << 16))
  53 
  54 #define N_SET_FLAGS(exec, flags) \
  55         ((exec).a_info = \
  56          ((exec).a_info&0x00ffffff) | (((flags) & 0xff) << 24))
  57 
  58 /* Code indicating object file or impure executable.  */
  59 #define OMAGIC 0407
  60 /* Code indicating pure executable.  */
  61 #define NMAGIC 0410
  62 /* Code indicating demand-paged executable.  */
  63 #define ZMAGIC 0413
  64 /* This indicates a demand-paged executable with the header in the text. 
  65    The first page is unmapped to help trap NULL pointer references */
  66 #define QMAGIC 0314
  67 
  68 /* Code indicating core file.  */
  69 #define CMAGIC 0421
  70 
  71 #if !defined (N_BADMAG)
  72 #define N_BADMAG(x)       (N_MAGIC(x) != OMAGIC         \
  73                         && N_MAGIC(x) != NMAGIC         \
  74                         && N_MAGIC(x) != ZMAGIC \
  75                         && N_MAGIC(x) != QMAGIC)
  76 #endif
  77 
  78 #define _N_HDROFF(x) (1024 - sizeof (struct exec))
  79 
  80 #if !defined (N_TXTOFF)
  81 #define N_TXTOFF(x) \
  82  (N_MAGIC(x) == ZMAGIC ? _N_HDROFF((x)) + sizeof (struct exec) : \
  83   (N_MAGIC(x) == QMAGIC ? 0 : sizeof (struct exec)))
  84 #endif
  85 
  86 #if !defined (N_DATOFF)
  87 #define N_DATOFF(x) (N_TXTOFF(x) + (x).a_text)
  88 #endif
  89 
  90 #if !defined (N_TRELOFF)
  91 #define N_TRELOFF(x) (N_DATOFF(x) + (x).a_data)
  92 #endif
  93 
  94 #if !defined (N_DRELOFF)
  95 #define N_DRELOFF(x) (N_TRELOFF(x) + (x).a_trsize)
  96 #endif
  97 
  98 #if !defined (N_SYMOFF)
  99 #define N_SYMOFF(x) (N_DRELOFF(x) + (x).a_drsize)
 100 #endif
 101 
 102 #if !defined (N_STROFF)
 103 #define N_STROFF(x) (N_SYMOFF(x) + (x).a_syms)
 104 #endif
 105 
 106 /* Address of text segment in memory after it is loaded.  */
 107 #if !defined (N_TXTADDR)
 108 #define N_TXTADDR(x) (N_MAGIC(x) == QMAGIC ? PAGE_SIZE : 0)
 109 #endif
 110 
 111 /* Address of data segment in memory after it is loaded.
 112    Note that it is up to you to define SEGMENT_SIZE
 113    on machines not listed here.  */
 114 #if defined(vax) || defined(hp300) || defined(pyr)
 115 #define SEGMENT_SIZE page_size
 116 #endif
 117 #ifdef  sony
 118 #define SEGMENT_SIZE    0x2000
 119 #endif  /* Sony.  */
 120 #ifdef is68k
 121 #define SEGMENT_SIZE 0x20000
 122 #endif
 123 #if defined(m68k) && defined(PORTAR)
 124 #define PAGE_SIZE 0x400
 125 #define SEGMENT_SIZE PAGE_SIZE
 126 #endif
 127 
 128 #ifdef linux
 129 #include <asm/page.h>
 130 #ifdef __i386__
 131 #define SEGMENT_SIZE    1024
 132 #else
 133 #define SEGMENT_SIZE    PAGE_SIZE
 134 #endif
 135 #endif
 136 
 137 #define _N_SEGMENT_ROUND(x) (((x) + SEGMENT_SIZE - 1) & ~(SEGMENT_SIZE - 1))
 138 
 139 #define _N_TXTENDADDR(x) (N_TXTADDR(x)+(x).a_text)
 140 
 141 #ifndef N_DATADDR
 142 #define N_DATADDR(x) \
 143     (N_MAGIC(x)==OMAGIC? (_N_TXTENDADDR(x)) \
 144      : (_N_SEGMENT_ROUND (_N_TXTENDADDR(x))))
 145 #endif
 146 
 147 /* Address of bss segment in memory after it is loaded.  */
 148 #if !defined (N_BSSADDR)
 149 #define N_BSSADDR(x) (N_DATADDR(x) + (x).a_data)
 150 #endif
 151 
 152 #if !defined (N_NLIST_DECLARED)
 153 struct nlist {
 154   union {
 155     char *n_name;
 156     struct nlist *n_next;
 157     long n_strx;
 158   } n_un;
 159   unsigned char n_type;
 160   char n_other;
 161   short n_desc;
 162   unsigned long n_value;
 163 };
 164 #endif /* no N_NLIST_DECLARED.  */
 165 
 166 #if !defined (N_UNDF)
 167 #define N_UNDF 0
 168 #endif
 169 #if !defined (N_ABS)
 170 #define N_ABS 2
 171 #endif
 172 #if !defined (N_TEXT)
 173 #define N_TEXT 4
 174 #endif
 175 #if !defined (N_DATA)
 176 #define N_DATA 6
 177 #endif
 178 #if !defined (N_BSS)
 179 #define N_BSS 8
 180 #endif
 181 #if !defined (N_FN)
 182 #define N_FN 15
 183 #endif
 184 
 185 #if !defined (N_EXT)
 186 #define N_EXT 1
 187 #endif
 188 #if !defined (N_TYPE)
 189 #define N_TYPE 036
 190 #endif
 191 #if !defined (N_STAB)
 192 #define N_STAB 0340
 193 #endif
 194 
 195 /* The following type indicates the definition of a symbol as being
 196    an indirect reference to another symbol.  The other symbol
 197    appears as an undefined reference, immediately following this symbol.
 198 
 199    Indirection is asymmetrical.  The other symbol's value will be used
 200    to satisfy requests for the indirect symbol, but not vice versa.
 201    If the other symbol does not have a definition, libraries will
 202    be searched to find a definition.  */
 203 #define N_INDR 0xa
 204 
 205 /* The following symbols refer to set elements.
 206    All the N_SET[ATDB] symbols with the same name form one set.
 207    Space is allocated for the set in the text section, and each set
 208    element's value is stored into one word of the space.
 209    The first word of the space is the length of the set (number of elements).
 210 
 211    The address of the set is made into an N_SETV symbol
 212    whose name is the same as the name of the set.
 213    This symbol acts like a N_DATA global symbol
 214    in that it can satisfy undefined external references.  */
 215 
 216 /* These appear as input to LD, in a .o file.  */
 217 #define N_SETA  0x14            /* Absolute set element symbol */
 218 #define N_SETT  0x16            /* Text set element symbol */
 219 #define N_SETD  0x18            /* Data set element symbol */
 220 #define N_SETB  0x1A            /* Bss set element symbol */
 221 
 222 /* This is output from LD.  */
 223 #define N_SETV  0x1C            /* Pointer to set vector in data area.  */
 224 
 225 #if !defined (N_RELOCATION_INFO_DECLARED)
 226 /* This structure describes a single relocation to be performed.
 227    The text-relocation section of the file is a vector of these structures,
 228    all of which apply to the text section.
 229    Likewise, the data-relocation section applies to the data section.  */
 230 
 231 struct relocation_info
 232 {
 233   /* Address (within segment) to be relocated.  */
 234   int r_address;
 235   /* The meaning of r_symbolnum depends on r_extern.  */
 236   unsigned int r_symbolnum:24;
 237   /* Nonzero means value is a pc-relative offset
 238      and it should be relocated for changes in its own address
 239      as well as for changes in the symbol or section specified.  */
 240   unsigned int r_pcrel:1;
 241   /* Length (as exponent of 2) of the field to be relocated.
 242      Thus, a value of 2 indicates 1<<2 bytes.  */
 243   unsigned int r_length:2;
 244   /* 1 => relocate with value of symbol.
 245           r_symbolnum is the index of the symbol
 246           in file's the symbol table.
 247      0 => relocate with the address of a segment.
 248           r_symbolnum is N_TEXT, N_DATA, N_BSS or N_ABS
 249           (the N_EXT bit may be set also, but signifies nothing).  */
 250   unsigned int r_extern:1;
 251   /* Four bits that aren't used, but when writing an object file
 252      it is desirable to clear them.  */
 253 #ifdef NS32K
 254   unsigned r_bsr:1;
 255   unsigned r_disp:1;
 256   unsigned r_pad:2;
 257 #else
 258   unsigned int r_pad:4;
 259 #endif
 260 };
 261 #endif /* no N_RELOCATION_INFO_DECLARED.  */
 262 
 263 
 264 #endif /* __A_OUT_GNU_H__ */

/* [previous][next][first][last][top][bottom][index][help] */