cpp-d1064d
[cross.git] / i686-linux-gnu-4.7 / usr / include / x86_64-linux-gnu / a.out.h
1 #ifndef __A_OUT_GNU_H__
2 #define __A_OUT_GNU_H__
3
4 #include <bits/a.out.h>
5
6 #define __GNU_EXEC_MACROS__
7
8 struct exec
9 {
10   unsigned long a_info; /* Use macros N_MAGIC, etc for access.  */
11   unsigned int a_text;  /* Length of text, in bytes.  */
12   unsigned int a_data;  /* Length of data, in bytes.  */
13   unsigned int a_bss;   /* Length of uninitialized data area for file, in bytes.  */
14   unsigned int a_syms;  /* Length of symbol table data in file, in bytes.  */
15   unsigned int a_entry; /* Start address.  */
16   unsigned int a_trsize;/* Length of relocation info for text, in bytes.  */
17   unsigned int a_drsize;/* Length of relocation info for data, in bytes.  */
18 };
19
20 enum machine_type
21 {
22   M_OLDSUN2 = 0,
23   M_68010 = 1,
24   M_68020 = 2,
25   M_SPARC = 3,
26   M_386 = 100,
27   M_MIPS1 = 151,
28   M_MIPS2 = 152
29 };
30
31 #define N_MAGIC(exec)   ((exec).a_info & 0xffff)
32 #define N_MACHTYPE(exec) ((enum machine_type)(((exec).a_info >> 16) & 0xff))
33 #define N_FLAGS(exec)   (((exec).a_info >> 24) & 0xff)
34 #define N_SET_INFO(exec, magic, type, flags) \
35   ((exec).a_info = ((magic) & 0xffff)                                   \
36    | (((int)(type) & 0xff) << 16)                                       \
37    | (((flags) & 0xff) << 24))
38 #define N_SET_MAGIC(exec, magic) \
39   ((exec).a_info = ((exec).a_info & 0xffff0000) | ((magic) & 0xffff))
40 #define N_SET_MACHTYPE(exec, machtype) \
41   ((exec).a_info =                                                      \
42    ((exec).a_info&0xff00ffff) | ((((int)(machtype))&0xff) << 16))
43 #define N_SET_FLAGS(exec, flags) \
44   ((exec).a_info =                                                      \
45    ((exec).a_info&0x00ffffff) | (((flags) & 0xff) << 24))
46
47 /* Code indicating object file or impure executable.  */
48 #define OMAGIC 0407
49 /* Code indicating pure executable.  */
50 #define NMAGIC 0410
51 /* Code indicating demand-paged executable.  */
52 #define ZMAGIC 0413
53 /* This indicates a demand-paged executable with the header in the text.
54    The first page is unmapped to help trap NULL pointer references.  */
55 #define QMAGIC 0314
56 /* Code indicating core file.  */
57 #define CMAGIC 0421
58
59 #define N_TRSIZE(a)     ((a).a_trsize)
60 #define N_DRSIZE(a)     ((a).a_drsize)
61 #define N_SYMSIZE(a)    ((a).a_syms)
62 #define N_BADMAG(x) \
63   (N_MAGIC(x) != OMAGIC && N_MAGIC(x) != NMAGIC                         \
64    && N_MAGIC(x) != ZMAGIC && N_MAGIC(x) != QMAGIC)
65 #define _N_HDROFF(x)    (1024 - sizeof (struct exec))
66 #define N_TXTOFF(x) \
67   (N_MAGIC(x) == ZMAGIC ? _N_HDROFF((x)) + sizeof (struct exec) :       \
68    (N_MAGIC(x) == QMAGIC ? 0 : sizeof (struct exec)))
69 #define N_DATOFF(x)     (N_TXTOFF(x) + (x).a_text)
70 #define N_TRELOFF(x)    (N_DATOFF(x) + (x).a_data)
71 #define N_DRELOFF(x)    (N_TRELOFF(x) + N_TRSIZE(x))
72 #define N_SYMOFF(x)     (N_DRELOFF(x) + N_DRSIZE(x))
73 #define N_STROFF(x)     (N_SYMOFF(x) + N_SYMSIZE(x))
74
75 /* Address of text segment in memory after it is loaded.  */
76 #define N_TXTADDR(x)    (N_MAGIC(x) == QMAGIC ? 4096 : 0)
77
78 /* Address of data segment in memory after it is loaded.  */
79 #define SEGMENT_SIZE    1024
80
81 #define _N_SEGMENT_ROUND(x) (((x) + SEGMENT_SIZE - 1) & ~(SEGMENT_SIZE - 1))
82 #define _N_TXTENDADDR(x) (N_TXTADDR(x)+(x).a_text)
83
84 #define N_DATADDR(x) \
85   (N_MAGIC(x)==OMAGIC? (_N_TXTENDADDR(x))                               \
86    : (_N_SEGMENT_ROUND (_N_TXTENDADDR(x))))
87 #define N_BSSADDR(x) (N_DATADDR(x) + (x).a_data)
88
89 #if !defined (N_NLIST_DECLARED)
90 struct nlist
91 {
92   union
93     {
94       char *n_name;
95       struct nlist *n_next;
96       long n_strx;
97     } n_un;
98   unsigned char n_type;
99   char n_other;
100   short n_desc;
101   unsigned long n_value;
102 };
103 #endif /* no N_NLIST_DECLARED.  */
104
105 #define N_UNDF  0
106 #define N_ABS   2
107 #define N_TEXT  4
108 #define N_DATA  6
109 #define N_BSS   8
110 #define N_FN    15
111 #define N_EXT   1
112 #define N_TYPE  036
113 #define N_STAB  0340
114 #define N_INDR  0xa
115 #define N_SETA  0x14    /* Absolute set element symbol.  */
116 #define N_SETT  0x16    /* Text set element symbol.  */
117 #define N_SETD  0x18    /* Data set element symbol.  */
118 #define N_SETB  0x1A    /* Bss set element symbol.  */
119 #define N_SETV  0x1C    /* Pointer to set vector in data area.  */
120
121 #if !defined (N_RELOCATION_INFO_DECLARED)
122 /* This structure describes a single relocation to be performed.
123    The text-relocation section of the file is a vector of these structures,
124    all of which apply to the text section.
125    Likewise, the data-relocation section applies to the data section.  */
126
127 struct relocation_info
128 {
129   int r_address;
130   unsigned int r_symbolnum:24;
131   unsigned int r_pcrel:1;
132   unsigned int r_length:2;
133   unsigned int r_extern:1;
134   unsigned int r_pad:4;
135 };
136 #endif /* no N_RELOCATION_INFO_DECLARED.  */
137
138 #endif /* __A_OUT_GNU_H__ */