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 char a_dynamic
:1; /* A __DYNAMIC is in this image. */
11 unsigned char a_toolversion
:7;
12 unsigned char a_machtype
;
13 unsigned short a_info
;
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 bss, in bytes. */
17 unsigned int a_syms
; /* Length of symbol table, in bytes. */
18 unsigned int a_entry
; /* Where program begins. */
19 unsigned int a_trsize
;
20 unsigned int a_drsize
;
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)
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))
70 (N_MAGIC(x) == ZMAGIC ? 0 : sizeof (struct exec))
71 #define N_DATOFF(x) (N_TXTOFF(x) + (x).a_text)
72 #define N_TRELOFF(x) (N_DATOFF(x) + (x).a_data)
73 #define N_DRELOFF(x) (N_TRELOFF(x) + N_TRSIZE(x))
75 (N_TXTOFF(x) + (x).a_text + (x).a_data + (x).a_trsize + (x).a_drsize)
76 #define N_STROFF(x) (N_SYMOFF(x) + N_SYMSIZE(x))
78 #define SPARC_PGSIZE 0x2000
80 /* Address of text segment in memory after it is loaded. */
81 #define N_TXTADDR(x) \
82 (unsigned long)(((N_MAGIC(x) == ZMAGIC) && ((x).a_entry < SPARC_PGSIZE)) \
85 /* Address of data segment in memory after it is loaded. */
86 #define SEGMENT_SIZE SPARC_PGSIZE
88 #define _N_SEGMENT_ROUND(x) (((x) + SEGMENT_SIZE - 1) & ~(SEGMENT_SIZE - 1))
89 #define _N_TXTENDADDR(x) (N_TXTADDR(x)+(x).a_text)
91 #define N_DATADDR(x) \
93 ? (N_TXTADDR(x) + (x).a_text) \
94 : (unsigned long)(_N_SEGMENT_ROUND (_N_TXTENDADDR(x))))
95 #define N_BSSADDR(x) (N_DATADDR(x) + (x).a_data)
97 #if !defined (N_NLIST_DECLARED)
103 struct nlist
*n_next
;
106 unsigned char n_type
;
109 unsigned long n_value
;
111 #endif /* no N_NLIST_DECLARED. */
123 #define N_SETA 0x14 /* Absolute set element symbol. */
124 #define N_SETT 0x16 /* Text set element symbol. */
125 #define N_SETD 0x18 /* Data set element symbol. */
126 #define N_SETB 0x1A /* Bss set element symbol. */
127 #define N_SETV 0x1C /* Pointer to set vector in data area. */
129 #if !defined (N_RELOCATION_INFO_DECLARED)
158 /* This structure describes a single relocation to be performed.
159 The text-relocation section of the file is a vector of these structures,
160 all of which apply to the text section.
161 Likewise, the data-relocation section applies to the data section. */
163 struct relocation_info
165 unsigned int r_address
;
166 unsigned int r_index
:24;
167 unsigned int r_extern
:1;
169 enum reloc_type r_type
:5;
172 #endif /* no N_RELOCATION_INFO_DECLARED. */
174 #endif /* __A_OUT_GNU_H__ */