|
|
1.1 root 1: /* (-lgl
2: * COHERENT Version 3.0
3: * Copyright (c) 1982, 1990 by Mark Williams Company.
4: * All rights reserved. May not be copied without permission.
5: -lgl) */
6: /*
7: * This is the format of the 'l.out' file with 32-bit addressing
8: * (for assembler, linkage editor, and compiler).
9: * It also has the namelist structure for the nlist routine.
10: */
11: #ifndef L_OUT_H
12: #define L_OUT_H
13: #include <sys/types.h>
14:
15: #define NCPLN 16 /* Chars in loader name */
16: #define NLSEG 9 /* No. of segments */
17: #define NXSEG 6 /* No. of segments used by exec */
18: #define L_MAGIC 0407 /* Magic number */
19:
20: /*
21: * This is the header.
22: * It sits at the front of the file,
23: * holding control information and
24: * the sizes of the other segments
25: * of the file.
26: * The l_u union can be used for different things, but
27: * keep the size of members to longs.
28: */
29:
30: struct ldheader {
31: short l_magic; /* Magic number */
32: short l_flag; /* Flags */
33: short l_machine; /* Type of target machine */
34: short l_tbase; /* Text starts here */
35: long l_ssize[NLSEG]; /* Segment sizes */
36: union {
37: long lu_entry; /* Entry point */
38: long lu_nhwrel; /* Num HIWORD/LONG rels, for M_LRG8086 */
39: } l_u;
40: };
41:
42: #define l_entry l_u.lu_entry
43: #define l_nhwrel l_u.lu_nhwrel
44:
45: /* Flags */
46: #define LF_SHR 01 /* Bound shared */
47: #define LF_SEP 02 /* Bound separated */
48: #define LF_NRB 04 /* No reloc. bits */
49: #define LF_KER 010 /* Loadable driver */
50: #define LF_32 020 /* 32-bit format l.out */
51: #define LF_SLREF 040 /* References shared library */
52: #define LF_SLIB 0100 /* Is the shared library */
53: #define LF_DEBUG 0200 /* Include debug segment flag to linker */
54: #define LF_FAKE 0400 /* header is displaced to end of exe or prg */
55:
56: /* Formats */
57: #define AFMT "%08lx" /* Address */
58:
59: /* Machines */
60: #ifndef MTYPE_H
61: #include <mtype.h>
62: #endif
63:
64: /* Segments */
65: #define L_SHRI 0 /* Shared Instruction space */
66: #define L_PRVI 1 /* Private Instruction space */
67: #define L_BSSI 2 /* Uninitialised Instruction */
68: #define L_SHRD 3 /* Shared Data space */
69: #define L_PRVD 4 /* Private Data space */
70: #define L_BSSD 5 /* Uninitalised Data */
71: #define L_DEBUG 6 /* Debug tables */
72: #define L_SYM 7 /* Symbols */
73: #define L_REL 8 /* Relocation */
74:
75: #define L_ABS 9 /* Absolute (symbol table) */
76: #define L_REF 10 /* Reference (symbol table) */
77:
78: /*
79: * Symbol.
80: * These live in the 'L_SYM' section
81: * of the file; the size of this section
82: * determines the number of symbols.
83: */
84: struct ldsym {
85: char ls_id[NCPLN]; /* Symbol name */
86: short ls_type; /* Global + Seg. */
87: long ls_addr; /* Value of symbol */
88: };
89:
90: /*
91: * The nlist structure for the nlist routine.
92: */
93: struct nlist {
94: char n_name[NCPLN]; /* Symbol name */
95: short n_type; /* Type flag */
96: long n_value; /* Value */
97: };
98:
99: #define L_GLOBAL 020
100:
101: /*
102: * Relocation.
103: * Relocation is a byte stream.
104: * The first is an opcode.
105: * The next 4 bytes are the address
106: * of relocation.
107: * If L_SYM-based relocation, the next two
108: * bytes are symbol number.
109: */
110: #define LR_SEG 017 /* Seg., L_SYM => Sym. based */
111: #define LR_PCR 020 /* PC Rel. flag */
112:
113: #define LR_OP 0340 /* Opcode */
114: #define LR_BYTE (0<<5) /* Rel. a byte */
115: #define LR_WORD (1<<5) /* Rel. a word */
116: #define LR_LONG (2<<5) /* Rel. a long */
117: #define LR_HIWORD (3<<5) /* Rel. via hiword of long */
118: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.