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