1988-09-15 09:49:22 +00:00
|
|
|
#include <system.h>
|
|
|
|
#include <out.h>
|
|
|
|
#include "back.h"
|
|
|
|
|
1989-02-02 12:29:14 +00:00
|
|
|
/* Written to run on VAX, and generate code for VAX */
|
1988-11-08 13:47:18 +00:00
|
|
|
|
1989-02-02 12:29:14 +00:00
|
|
|
extern long B_base_address[];
|
1988-09-15 09:49:22 +00:00
|
|
|
|
|
|
|
do_local_relocation()
|
|
|
|
{
|
1988-10-20 14:21:37 +00:00
|
|
|
register struct outrelo *rp;
|
1988-09-15 09:49:22 +00:00
|
|
|
|
|
|
|
/* print( "n relocation records %d\n", relo - reloc_info); */
|
|
|
|
|
1989-02-02 12:29:14 +00:00
|
|
|
B_base_address[SEGTXT] = 0;
|
|
|
|
B_base_address[SEGCON] = text - text_area;
|
|
|
|
B_base_address[SEGBSS] = B_base_address[SEGCON] + data - data_area;
|
1988-10-20 14:21:37 +00:00
|
|
|
for ( rp = reloc_info; rp < relo; rp++) {
|
|
|
|
register struct outname *np = &symbol_table[rp->or_nami];
|
|
|
|
|
|
|
|
if ( np->on_valu != -1 && ! (np->on_type & S_COM)) {
|
|
|
|
register char *sect;
|
|
|
|
|
|
|
|
switch( rp->or_sect - S_MIN) {
|
|
|
|
case SEGTXT:
|
|
|
|
sect = text_area;
|
|
|
|
break;
|
|
|
|
case SEGCON:
|
|
|
|
sect = data_area;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
fprint( STDERR,
|
|
|
|
"do_local_relo(): bad section %d\n",
|
|
|
|
rp->or_sect - S_MIN);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if ( rp->or_type & RELO4)
|
1988-11-08 13:47:18 +00:00
|
|
|
*((long *)(sect+rp->or_addr)) +=
|
|
|
|
np->on_valu +
|
1989-02-02 12:29:14 +00:00
|
|
|
B_base_address[(np->on_type&S_TYP)-S_MIN];
|
1988-10-20 14:21:37 +00:00
|
|
|
else
|
1988-11-08 13:47:18 +00:00
|
|
|
fprint( STDERR,
|
1988-10-20 14:21:37 +00:00
|
|
|
"do_relo() : bad relocation size\n");
|
|
|
|
}
|
1988-09-15 09:49:22 +00:00
|
|
|
}
|
|
|
|
}
|