Introduce likely/unlikely macros, use them in saa.c
[nasm/autotest.git] / rdoff / ldsegs.h
blobfcecdf67321481bf8b21dc9d87d28ac893a9f420
1 /*
2 * ldsegs.h Data for 'ldrdf' to determine what to do with different
3 * types of segment. This may be useful in other contexts also.
4 */
6 #ifndef RDOFF_LDSEGS_H
7 #define RDOFF_LDSEGS_H 1
9 #include <inttypes.h>
11 struct segconfig {
12 uint16_t typelow, typehi; /* range of seg nos for which this is valid */
13 char *typedesc; /* a description of the segment type */
14 uint16_t dowhat; /* one of the SEG_xxxx values below */
15 uint16_t mergetype; /* if SEG_MERGE what type segment do we merge
16 with?
17 0 -> same type of segment. This type is also
18 used with SEG_NEWSEG. */
21 #define SEG_IGNORE 0
22 #define SEG_NEWSEG 1
23 #define SEG_MERGE 2
25 #define SEGCONFIGMAX 11
27 struct segconfig sconft[SEGCONFIGMAX] = {
28 {0x0000, 0x0000, "NULL segment", 0, 0},
29 {0x0001, 0x0001, "text", 2, 0},
30 {0x0002, 0x0002, "data", 2, 0},
31 {0x0003, 0x0003, "comment(ignored)", 0, 0},
32 {0x0004, 0x0005, "comment(kept)", 2, 0},
33 {0x0006, 0x0007, "debug information", 2, 0},
34 {0x0008, 0x001F, "reserved(general extensions)", 1, 0},
35 {0x0020, 0x0FFF, "reserved(MOSCOW)", 1, 0},
36 {0x1000, 0x7FFF, "reserved(system dependant)", 1, 0},
37 {0x8000, 0xFFFE, "reserved(other)", 1, 0},
38 {0xFFFF, 0xFFFF, "invalid segment", 0, 0}
41 #define getsegconfig(target,number) \
42 { \
43 int _i; \
44 int _t = number; \
45 for (_i = 0; _i < SEGCONFIGMAX; _i++) \
46 if (_t >= sconft[_i].typelow && _t <= sconft[_i].typehi) \
47 { \
48 target = sconft[_i]; \
49 if (target.mergetype == 0) target.mergetype = _t; \
50 break; \
51 } \
52 if (_i == SEGCONFIGMAX) \
53 { \
54 fprintf(stderr, "PANIC: can't find segment %04X in segconfig\n",\
55 _t); \
56 exit(1); \
57 } \
60 #endif