1 #ifndef __A_OUT_GNU_H__
2 #define __A_OUT_GNU_H__
4 #include <bits/a.out.h>
6 #define __GNU_EXEC_MACROS__
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. */
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) \
42 ((exec).a_info&0xff00ffff) | ((((int)(machtype))&0xff) << 16))
43 #define N_SET_FLAGS(exec, flags) \
45 ((exec).a_info&0x00ffffff) | (((flags) & 0xff) << 24))
47 /* Code indicating object file or impure executable. */
49 /* Code indicating pure executable. */
51 /* Code indicating demand-paged executable. */
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. */
56 /* Code indicating core file. */
59 #define N_TRSIZE(a) ((a).a_trsize)
60 #define N_DRSIZE(a) ((a).a_drsize)
61 #define N_SYMSIZE(a) ((a).a_syms)
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))
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))
75 /* Address of text segment in memory after it is loaded. */
76 #define N_TXTADDR(x) (N_MAGIC(x) == QMAGIC ? 4096 : 0)
78 /* Address of data segment in memory after it is loaded. */
79 #define SEGMENT_SIZE 1024
81 #define _N_SEGMENT_ROUND(x) (((x) + SEGMENT_SIZE - 1) & ~(SEGMENT_SIZE - 1))
82 #define _N_TXTENDADDR(x) (N_TXTADDR(x)+(x).a_text)
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)
89 #if !defined (N_NLIST_DECLARED)
101 unsigned long n_value
;
103 #endif /* no N_NLIST_DECLARED. */
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. */
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. */
127 struct relocation_info
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;
136 #endif /* no N_RELOCATION_INFO_DECLARED. */
138 #endif /* __A_OUT_GNU_H__ */