Pristine Ack-5.5
[Ack-5.5.git] / util / ceg / ce_back / obj_back / reloc4.c
1 #include <out.h>
2 #include <system.h>
3 #include "mach.h"
4 #include "back.h"
5 #include "header.h"
6
7 /* There are two forms of relocation program counter relative or
8  * absolute.
9  */
10
11 #ifdef WORDS_REVERSED
12 #ifdef BYTES_REVERSED
13 #define RRR (RELO4|RELBR|RELWR)
14 #else
15 #define RRR (RELO4|RELWR)
16 #endif
17 #else
18 #ifdef BYTES_REVERSED
19 #define RRR (RELO4|RELBR)
20 #else
21 #define RRR (RELO4)
22 #endif
23 #endif
24
25 reloc4( sym, off, pcrel)
26 char *sym;
27 arith off;
28 int pcrel;
29 {
30         register struct outrelo *r;
31
32         if ( relo - reloc_info >= size_reloc)
33                 mem_relo();
34
35         r = relo;
36
37         r->or_type = ( pcrel) ? RELPC|RRR : RRR;
38         r->or_sect =  S_MIN + conv_seg( cur_seg);
39         r->or_nami = find_sym(sym, REFERENCE);
40         r->or_addr = cur_value();
41         gen4( (pcrel) ? off - ( r->or_addr + 4) : off);
42
43         /* print( "r %s r %ld s %d in %d adrr %ld off %ld\n",
44                  sym, pcrel, cur_seg, r->or_nami, r->or_addr, 
45                 (pcrel) ? off-cur_value() : off);
46          */
47          
48         relo++;
49 }