2 * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
3 * See the copyright notice in the ACK home directory, in the file "Copyright".
7 #ifndef __OUT_H_INCLUDED
8 #define __OUT_H_INCLUDED
10 * output format for ACK assemblers
13 #define ushort unsigned short
17 ushort oh_magic
; /* magic number */
18 ushort oh_stamp
; /* version stamp */
19 ushort oh_flags
; /* several format flags */
20 ushort oh_nsect
; /* number of outsect structures */
21 ushort oh_nrelo
; /* number of outrelo structures */
22 ushort oh_nname
; /* number of outname structures */
23 long oh_nemit
; /* sum of all os_flen */
24 long oh_nchar
; /* size of string area */
27 #define O_MAGIC 0x0201 /* magic number of output file */
28 #define O_STAMP 0 /* version stamp */
29 #define MAXSECT 64 /* Maximum number of sections */
31 #define HF_LINK 0x0004 /* unresolved references left */
32 #define HF_8086 0x0008 /* os_base specially encoded */
35 long os_base
; /* startaddress in machine */
36 long os_size
; /* section size in machine */
37 long os_foff
; /* startaddress in file */
38 long os_flen
; /* section size in file */
39 long os_lign
; /* section alignment */
43 char or_type
; /* type of reference */
44 char or_sect
; /* referencing section */
45 ushort or_nami
; /* referenced symbol index */
46 long or_addr
; /* referencing address */
51 char *on_ptr
; /* symbol name (in core) */
52 long on_off
; /* symbol name (in file) */
54 #define on_mptr on_u.on_ptr
55 #define on_foff on_u.on_off
56 ushort on_type
; /* symbol type */
57 ushort on_desc
; /* debug info */
58 long on_valu
; /* symbol value */
62 * relocation type bits
64 #define RELSZ 0x07 /* relocation length */
65 #define RELO1 1 /* 1 byte */
66 #define RELO2 2 /* 2 bytes */
67 #define RELO4 4 /* 4 bytes */
68 #define RELPC 0x08 /* pc relative */
69 #define RELBR 0x10 /* High order byte lowest address. */
70 #define RELWR 0x20 /* High order word lowest address. */
73 * section type bits and fields
75 #define S_TYP 0x007F /* undefined, absolute or relative */
76 #define S_EXT 0x0080 /* external flag */
77 #define S_ETC 0x7F00 /* for symbolic debug, bypassing 'as' */
82 #define S_UND 0x0000 /* undefined item */
83 #define S_ABS 0x0001 /* absolute item */
84 #define S_MIN 0x0002 /* first user section */
85 #define S_MAX (S_TYP-1) /* last user section */
86 #define S_CRS S_TYP /* on_valu is symbol index which contains value */
91 #define S_SCT 0x0100 /* section names */
92 #define S_LIN 0x0200 /* hll source line item */
93 #define S_FIL 0x0300 /* hll source file item */
94 #define S_MOD 0x0400 /* ass source file item */
95 #define S_COM 0x1000 /* Common name. */
96 #define S_STB 0xe000 /* entries with any of these bits set are
97 reserved for debuggers
101 * structure format strings
103 #define SF_HEAD "22222244"
104 #define SF_SECT "44444"
105 #define SF_RELO "1124"
106 #define SF_NAME "4224"
109 * structure sizes (bytes in file; add digits in SF_*)
119 #define BADMAGIC(x) ((x).oh_magic!=O_MAGIC)
120 #define OFF_SECT(x) SZ_HEAD
121 #define OFF_EMIT(x) (OFF_SECT(x) + ((long)(x).oh_nsect * SZ_SECT))
122 #define OFF_RELO(x) (OFF_EMIT(x) + (x).oh_nemit)
123 #define OFF_NAME(x) (OFF_RELO(x) + ((long)(x).oh_nrelo * SZ_RELO))
124 #define OFF_CHAR(x) (OFF_NAME(x) + ((long)(x).oh_nname * SZ_NAME))
126 #endif /* __OUT_H_INCLUDED */