a.out.h
001: #ifndef __A_OUT_GNU_H__
002: #define __A_OUT_GNU_H__
003:
004: #include <bits/a.out.h>
005:
006: #define __GNU_EXEC_MACROS__
007:
008: struct exec
009: {
010: unsigned long a_info;
011: unsigned int a_text;
012: unsigned int a_data;
013: unsigned int a_bss;
014: unsigned int a_syms;
015: unsigned int a_entry;
016: unsigned int a_trsize;
017: unsigned int a_drsize;
018: };
019:
020: enum machine_type
021: {
022: M_OLDSUN2 = 0,
023: M_68010 = 1,
024: M_68020 = 2,
025: M_SPARC = 3,
026: M_386 = 100,
027: M_MIPS1 = 151,
028: M_MIPS2 = 152
029: };
030:
031: #define N_MAGIC(exec) ((exec).a_info & 0xffff)
032: #define N_MACHTYPE(exec) ((enum machine_type)(((exec).a_info >> 16) & 0xff))
033: #define N_FLAGS(exec) (((exec).a_info >> 24) & 0xff)
034: #define N_SET_INFO(exec, magic, type, flags) \
035: ((exec).a_info = ((magic) & 0xffff) \
036: | (((int)(type) & 0xff) << 16) \
037: | (((flags) & 0xff) << 24))
038: #define N_SET_MAGIC(exec, magic) \
039: ((exec).a_info = ((exec).a_info & 0xffff0000) | ((magic) & 0xffff))
040: #define N_SET_MACHTYPE(exec, machtype) \
041: ((exec).a_info = \
042: ((exec).a_info&0xff00ffff) | ((((int)(machtype))&0xff) << 16))
043: #define N_SET_FLAGS(exec, flags) \
044: ((exec).a_info = \
045: ((exec).a_info&0x00ffffff) | (((flags) & 0xff) << 24))
046:
047:
048: #define OMAGIC 0407
049:
050: #define NMAGIC 0410
051:
052: #define ZMAGIC 0413
053:
054:
055: #define QMAGIC 0314
056:
057: #define CMAGIC 0421
058:
059: #define N_TRSIZE(a) ((a).a_trsize)
060: #define N_DRSIZE(a) ((a).a_drsize)
061: #define N_SYMSIZE(a) ((a).a_syms)
062: #define N_BADMAG(x) \
063: (N_MAGIC(x) != OMAGIC && N_MAGIC(x) != NMAGIC \
064: && N_MAGIC(x) != ZMAGIC && N_MAGIC(x) != QMAGIC)
065: #define _N_HDROFF(x) (1024 - sizeof (struct exec))
066: #define N_TXTOFF(x) \
067: (N_MAGIC(x) == ZMAGIC ? _N_HDROFF((x)) + sizeof (struct exec) : \
068: (N_MAGIC(x) == QMAGIC ? 0 : sizeof (struct exec)))
069: #define N_DATOFF(x) (N_TXTOFF(x) + (x).a_text)
070: #define N_TRELOFF(x) (N_DATOFF(x) + (x).a_data)
071: #define N_DRELOFF(x) (N_TRELOFF(x) + N_TRSIZE(x))
072: #define N_SYMOFF(x) (N_DRELOFF(x) + N_DRSIZE(x))
073: #define N_STROFF(x) (N_SYMOFF(x) + N_SYMSIZE(x))
074:
075:
076: #define N_TXTADDR(x) (N_MAGIC(x) == QMAGIC ? 4096 : 0)
077:
078:
079: #define SEGMENT_SIZE 1024
080:
081: #define _N_SEGMENT_ROUND(x) (((x) + SEGMENT_SIZE - 1) & ~(SEGMENT_SIZE - 1))
082: #define _N_TXTENDADDR(x) (N_TXTADDR(x)+(x).a_text)
083:
084: #define N_DATADDR(x) \
085: (N_MAGIC(x)==OMAGIC? (_N_TXTENDADDR(x)) \
086: : (_N_SEGMENT_ROUND (_N_TXTENDADDR(x))))
087: #define N_BSSADDR(x) (N_DATADDR(x) + (x).a_data)
088:
089: #if !defined (N_NLIST_DECLARED)
090: struct nlist
091: {
092: union
093: {
094: char *n_name;
095: struct nlist *n_next;
096: long n_strx;
097: } n_un;
098: unsigned char n_type;
099: char n_other;
100: short n_desc;
101: unsigned long n_value;
102: };
103: #endif
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
116: #define N_SETT 0x16
117: #define N_SETD 0x18
118: #define N_SETB 0x1A
119: #define N_SETV 0x1C
120:
121: #if !defined (N_RELOCATION_INFO_DECLARED)
122:
123:
124:
125:
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
137:
138: #endif
139:
© Andrew Scott 2006 -
2024,
All Rights Reserved