6 /* Global datastructures :
7 * - 'text_area' points to the text segment, 'text' points to first free
8 * entry in the text segment.
9 * - 'data_area' points to the data segment, 'data' points to the first free
10 * entry in the data segmnet.
11 * - 'string_area' points to the string area, 'string' points to the first free
12 * entry in the string area.
13 * - 'reloc_info' points to the relocation table, 'relo' points to the first
14 * free entry in the relocation table.
15 * - 'symbol_table' points to the symbol table, 'nname' is the index of the
16 * first free entry in the symbol_table. If pointers were used it is a pain
17 * to do a realloc on the symbol table, because all pointers in the
18 * relocation table to the symbol table have to be updated.
19 * - The bss segment contains only one vaue, so its enough to count the
21 * - The 'size_*' variables count the number of entries in each segment.
22 * - 'cur_seg' contains the number of the segment to be filled.
30 *text, *data, *string;
31 struct outrelo *reloc_info, *relo;
32 struct outname *symbol_table;
35 int cur_seg = -1 , nname = 0;
36 long nbss = 0, size_text, size_data, size_reloc, size_symbol,
37 size_string, text_cnt, data_cnt;
46 put1(sect, addr, (w>>8));
47 put1(sect, addr+1, w);
50 put1(sect, addr+1, (w>>8));
61 put2(sect,addr,(int) (l>>16));
62 put2(sect,addr+2,(int) l);
64 put2(sect,addr,(int) l);
65 put2(sect,addr+2,(int) (l>>16));
74 return (get1(sect,addr) << 8) | (get1(sect,addr+1) & 255);
76 return (get1(sect,addr+1) << 8) | (get1(sect,addr) & 255);
86 return ((long)get2(sect,addr) << 16) | (get2(sect, addr+2) & 65535L);
88 return ((long)get2(sect,addr+2) << 16) | (get2(sect, addr) & 65535L);