4 +#ifndef __A_OUT_GNU_H__
5 +#define __A_OUT_GNU_H__
7 +#include <bits/a.out.h>
9 +#define __GNU_EXEC_MACROS__
13 + unsigned long a_info; /* Use macros N_MAGIC, etc for access. */
14 + unsigned int a_text; /* Length of text, in bytes. */
15 + unsigned int a_data; /* Length of data, in bytes. */
16 + unsigned int a_bss; /* Length of uninitialized data area for file, in bytes. */
17 + unsigned int a_syms; /* Length of symbol table data in file, in bytes. */
18 + unsigned int a_entry; /* Start address. */
19 + unsigned int a_trsize;/* Length of relocation info for text, in bytes. */
20 + unsigned int a_drsize;/* Length of relocation info for data, in bytes. */
34 +#define N_MAGIC(exec) ((exec).a_info & 0xffff)
35 +#define N_MACHTYPE(exec) ((enum machine_type)(((exec).a_info >> 16) & 0xff))
36 +#define N_FLAGS(exec) (((exec).a_info >> 24) & 0xff)
37 +#define N_SET_INFO(exec, magic, type, flags) \
38 + ((exec).a_info = ((magic) & 0xffff) \
39 + | (((int)(type) & 0xff) << 16) \
40 + | (((flags) & 0xff) << 24))
41 +#define N_SET_MAGIC(exec, magic) \
42 + ((exec).a_info = ((exec).a_info & 0xffff0000) | ((magic) & 0xffff))
43 +#define N_SET_MACHTYPE(exec, machtype) \
45 + ((exec).a_info&0xff00ffff) | ((((int)(machtype))&0xff) << 16))
46 +#define N_SET_FLAGS(exec, flags) \
48 + ((exec).a_info&0x00ffffff) | (((flags) & 0xff) << 24))
50 +/* Code indicating object file or impure executable. */
52 +/* Code indicating pure executable. */
54 +/* Code indicating demand-paged executable. */
56 +/* This indicates a demand-paged executable with the header in the text.
57 + The first page is unmapped to help trap NULL pointer references. */
59 +/* Code indicating core file. */
62 +#define N_TRSIZE(a) ((a).a_trsize)
63 +#define N_DRSIZE(a) ((a).a_drsize)
64 +#define N_SYMSIZE(a) ((a).a_syms)
65 +#define N_BADMAG(x) \
66 + (N_MAGIC(x) != OMAGIC && N_MAGIC(x) != NMAGIC \
67 + && N_MAGIC(x) != ZMAGIC && N_MAGIC(x) != QMAGIC)
68 +#define _N_HDROFF(x) (1024 - sizeof (struct exec))
69 +#define N_TXTOFF(x) \
70 + (N_MAGIC(x) == ZMAGIC ? _N_HDROFF((x)) + sizeof (struct exec) : \
71 + (N_MAGIC(x) == QMAGIC ? 0 : sizeof (struct exec)))
72 +#define N_DATOFF(x) (N_TXTOFF(x) + (x).a_text)
73 +#define N_TRELOFF(x) (N_DATOFF(x) + (x).a_data)
74 +#define N_DRELOFF(x) (N_TRELOFF(x) + N_TRSIZE(x))
75 +#define N_SYMOFF(x) (N_DRELOFF(x) + N_DRSIZE(x))
76 +#define N_STROFF(x) (N_SYMOFF(x) + N_SYMSIZE(x))
78 +/* Address of text segment in memory after it is loaded. */
79 +#define N_TXTADDR(x) (N_MAGIC(x) == QMAGIC ? 4096 : 0)
81 +/* Address of data segment in memory after it is loaded. */
82 +#define SEGMENT_SIZE 1024
84 +#define _N_SEGMENT_ROUND(x) (((x) + SEGMENT_SIZE - 1) & ~(SEGMENT_SIZE - 1))
85 +#define _N_TXTENDADDR(x) (N_TXTADDR(x)+(x).a_text)
87 +#define N_DATADDR(x) \
88 + (N_MAGIC(x)==OMAGIC? (_N_TXTENDADDR(x)) \
89 + : (_N_SEGMENT_ROUND (_N_TXTENDADDR(x))))
90 +#define N_BSSADDR(x) (N_DATADDR(x) + (x).a_data)
92 +#if !defined (N_NLIST_DECLARED)
98 + struct nlist *n_next;
101 + unsigned char n_type;
104 + unsigned long n_value;
106 +#endif /* no N_NLIST_DECLARED. */
118 +#define N_SETA 0x14 /* Absolute set element symbol. */
119 +#define N_SETT 0x16 /* Text set element symbol. */
120 +#define N_SETD 0x18 /* Data set element symbol. */
121 +#define N_SETB 0x1A /* Bss set element symbol. */
122 +#define N_SETV 0x1C /* Pointer to set vector in data area. */
124 +#if !defined (N_RELOCATION_INFO_DECLARED)
125 +/* This structure describes a single relocation to be performed.
126 + The text-relocation section of the file is a vector of these structures,
127 + all of which apply to the text section.
128 + Likewise, the data-relocation section applies to the data section. */
130 +struct relocation_info
133 + unsigned int r_symbolnum:24;
134 + unsigned int r_pcrel:1;
135 + unsigned int r_length:2;
136 + unsigned int r_extern:1;
137 + unsigned int r_pad:4;
139 +#endif /* no N_RELOCATION_INFO_DECLARED. */
141 +#endif /* __A_OUT_GNU_H__ */
143 +++ b/include/bits/a.out.h
145 +#ifndef __A_OUT_GNU_H__
146 +# error "Never use <bits/a.out.h> directly; include <a.out.h> instead."
149 +#include <bits/wordsize.h>
151 +#if __WORDSIZE == 64
153 +/* Signal to users of this header that this architecture really doesn't
154 + support a.out binary format. */
155 +#define __NO_A_OUT_SUPPORT 1