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