source: vendor/emx/current/include/a_out.h

Last change on this file was 18, checked in by bird, 23 years ago

Initial revision

  • Property cvs2svn:cvs-rev set to 1.1
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 6.1 KB
Line 
1/* a_out.h -- changed for emx by Eberhard Mattes -- Sep 1998 */
2
3#ifndef __A_OUT_GNU_H__
4#define __A_OUT_GNU_H__
5#define __GNU_EXEC_MACROS__
6#ifndef __STRUCT_EXEC_OVERRIDE__
7struct exec
8{
9 unsigned long a_info; /* Use macros N_MAGIC, etc for access */
10 unsigned a_text; /* length of text, in bytes */
11 unsigned a_data; /* length of data, in bytes */
12 unsigned a_bss; /* length of uninitialized data area for file, in bytes */
13 unsigned a_syms; /* length of symbol table data in file, in bytes */
14 unsigned a_entry; /* start address */
15 unsigned a_trsize; /* length of relocation info for text, in bytes */
16 unsigned a_drsize; /* length of relocation info for data, in bytes */
17};
18#endif /* __STRUCT_EXEC_OVERRIDE__ */
19/* these go in the N_MACHTYPE field */
20enum machine_type {
21 M_OLDSUN2 = 0,
22 M_68010 = 1,
23 M_68020 = 2,
24 M_SPARC = 3,
25 /* skip a bunch so we don't run into any of sun's numbers */
26 M_386 = 100,
27};
28#define N_MAGIC(exec) ((exec).a_info & 0xffff)
29#define N_MACHTYPE(exec) ((enum machine_type)(((exec).a_info >> 16) & 0xff))
30#define N_FLAGS(exec) (((exec).a_info >> 24) & 0xff)
31#define N_SET_INFO(exec, magic, type, flags) \
32 ((exec).a_info = ((magic) & 0xffff) \
33 | (((int)(type) & 0xff) << 16) \
34 | (((flags) & 0xff) << 24))
35#define N_SET_MAGIC(exec, magic) \
36 ((exec).a_info = (((exec).a_info & 0xffff0000) | ((magic) & 0xffff)))
37#define N_SET_MACHTYPE(exec, machtype) \
38 ((exec).a_info = \
39 ((exec).a_info&0xff00ffff) | ((((int)(machtype))&0xff) << 16))
40#define N_SET_FLAGS(exec, flags) \
41 ((exec).a_info = \
42 ((exec).a_info&0x00ffffff) | (((flags) & 0xff) << 24))
43/* Code indicating object file or impure executable. */
44#define OMAGIC 0407
45/* Code indicating pure executable. */
46#define NMAGIC 0410
47/* Code indicating demand-paged executable. */
48#define ZMAGIC 0413
49#define N_BADMAG(x) \
50 (N_MAGIC(x) != OMAGIC && N_MAGIC(x) != NMAGIC \
51 && N_MAGIC(x) != ZMAGIC)
52#define _N_BADMAG(x) \
53 (N_MAGIC(x) != OMAGIC && N_MAGIC(x) != NMAGIC \
54 && N_MAGIC(x) != ZMAGIC)
55#define _N_HDROFF(x) (1024 - sizeof (struct exec))
56#define N_TXTOFF(x) \
57 (N_MAGIC(x) == ZMAGIC ? _N_HDROFF((x)) + sizeof (struct exec) : sizeof (struct exec))
58#define N_DATOFF(x) (N_TXTOFF(x) + (x).a_text)
59#define N_TRELOFF(x) (N_DATOFF(x) + (x).a_data)
60#define N_DRELOFF(x) (N_TRELOFF(x) + (x).a_trsize)
61#define N_SYMOFF(x) (N_DRELOFF(x) + (x).a_drsize)
62#define N_STROFF(x) (N_SYMOFF(x) + (x).a_syms)
63/* Address of text segment in memory after it is loaded. */
64#define N_TXTADDR(x) SEGMENT_SIZE /* emx */
65
66/* Address of data segment in memory after it is loaded.
67 Note that it is up to you to define SEGMENT_SIZE
68 on machines not listed here. */
69#ifdef vax
70#define SEGMENT_SIZE page_size
71#endif
72#ifdef is68k
73#define SEGMENT_SIZE 0x20000
74#endif
75
76#define SEGMENT_SIZE 0x10000 /* emx */
77
78#ifndef N_DATADDR
79#define N_DATADDR(x) \
80 (N_MAGIC(x)==OMAGIC? (N_TXTADDR(x)+(x).a_text) \
81 : (SEGMENT_SIZE + ((N_TXTADDR(x)+(x).a_text-1) & ~(SEGMENT_SIZE-1))))
82#endif
83/* Address of bss segment in memory after it is loaded. */
84#define N_BSSADDR(x) (N_DATADDR(x) + (x).a_data)
85
86
87struct nlist {
88 union {
89 char *n_name;
90 struct nlist *n_next;
91 long n_strx;
92 } n_un;
93 unsigned char n_type;
94 char n_other;
95 short n_desc;
96 unsigned long n_value;
97};
98#define N_UNDF 0
99#define N_ABS 2
100#define N_TEXT 4
101#define N_DATA 6
102#define N_BSS 8
103#define N_FN 15
104#define N_EXT 1
105#define N_TYPE 036
106#define N_STAB 0340
107/* The following type indicates the definition of a symbol as being
108 an indirect reference to another symbol. The other symbol
109 appears as an undefined reference, immediately following this symbol.
110 Indirection is asymmetrical. The other symbol's value will be used
111 to satisfy requests for the indirect symbol, but not vice versa.
112 If the other symbol does not have a definition, libraries will
113 be searched to find a definition. */
114#define N_INDR 0xa
115/* The following symbols refer to set elements.
116 All the N_SET[ATDB] symbols with the same name form one set.
117 Space is allocated for the set in the text section, and each set
118 element's value is stored into one word of the space.
119 The first word of the space is the length of the set (number of elements).
120 The address of the set is made into an N_SETV symbol
121 whose name is the same as the name of the set.
122 This symbol acts like a N_DATA global symbol
123 in that it can satisfy undefined external references. */
124
125/* These appear as input to LD, in a .o file. */
126#define N_SETA 0x14 /* Absolute set element symbol */
127#define N_SETT 0x16 /* Text set element symbol */
128#define N_SETD 0x18 /* Data set element symbol */
129#define N_SETB 0x1A /* Bss set element symbol */
130/* This is output from LD. */
131#define N_SETV 0x1C /* Pointer to set vector in data area. */
132/* Copied from aout64.h of BFD */
133#define N_WEAKU 0x0d /* Weak undefined symbol. */
134/* emx */
135#define N_IMP1 0x68 /* Import definition symbol */
136
137
138/* This structure describes a single relocation to be performed.
139 The text-relocation section of the file is a vector of these structures,
140 all of which apply to the text section.
141 Likewise, the data-relocation section applies to the data section. */
142struct relocation_info
143{
144 /* Address (within segment) to be relocated. */
145 int r_address;
146 /* The meaning of r_symbolnum depends on r_extern. */
147 unsigned int r_symbolnum:24;
148 /* Nonzero means value is a pc-relative offset
149 and it should be relocated for changes in its own address
150 as well as for changes in the symbol or section specified. */
151 unsigned int r_pcrel:1;
152 /* Length (as exponent of 2) of the field to be relocated.
153 Thus, a value of 2 indicates 1<<2 bytes. */
154 unsigned int r_length:2;
155 /* 1 => relocate with value of symbol.
156 r_symbolnum is the index of the symbol
157 in file's the symbol table.
158 0 => relocate with the address of a segment.
159 r_symbolnum is N_TEXT, N_DATA, N_BSS or N_ABS
160 (the N_EXT bit may be set also, but signifies nothing). */
161 unsigned int r_extern:1;
162 /* Four bits that aren't used, but when writing an object file
163 it is desirable to clear them. */
164 unsigned int r_pad:4;
165};
166#endif /* __A_OUT_GNU_H__ */
Note: See TracBrowser for help on using the repository browser.