1988-09-28 16:47:47 +00:00
|
|
|
#include <system.h>
|
|
|
|
#include <out.h>
|
|
|
|
#include "data.h"
|
|
|
|
#include "back.h"
|
|
|
|
|
|
|
|
long get4();
|
|
|
|
extern long base_address();
|
1988-10-07 16:52:44 +00:00
|
|
|
/*
|
1988-09-28 16:47:47 +00:00
|
|
|
extern short get2();
|
|
|
|
extern char get1();
|
1988-10-07 16:52:44 +00:00
|
|
|
*/
|
1988-09-28 16:47:47 +00:00
|
|
|
|
|
|
|
do_local_relocation()
|
|
|
|
{
|
1988-10-07 16:52:44 +00:00
|
|
|
register struct outrelo *rp;
|
1988-09-28 16:47:47 +00:00
|
|
|
|
|
|
|
/* print( "n relocation records %d\n", relo - reloc_info); */
|
|
|
|
|
1988-10-07 16:52:44 +00:00
|
|
|
for ( rp = reloc_info; rp < relo; rp++) {
|
|
|
|
register struct outname *np = &symbol_table[rp->or_nami];
|
1988-09-28 16:47:47 +00:00
|
|
|
|
1988-10-07 16:52:44 +00:00
|
|
|
if ( np->on_valu != -1 && ! (np->on_type & S_COM)) {
|
|
|
|
register long oldval,newval;
|
|
|
|
register char *sect;
|
1988-09-28 16:47:47 +00:00
|
|
|
|
1988-10-07 16:52:44 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
oldval = get4( sect, rp->or_addr);
|
|
|
|
newval = oldval + np->on_valu +
|
|
|
|
base_address( (np->on_type & S_TYP) -S_MIN);
|
|
|
|
if ( rp->or_type & RELO4)
|
|
|
|
put4( sect, rp->or_addr, newval);
|
|
|
|
/*
|
|
|
|
else if ( rp->or_type & RELO2)
|
|
|
|
put2( sect, rp->or_addr, (int) newval);
|
|
|
|
else if ( rp->or_type & RELO1)
|
|
|
|
put1( sect, rp->or_addr, (char) newval);
|
|
|
|
*/
|
|
|
|
else
|
|
|
|
print( STDERR,
|
|
|
|
"do_relo() : bad relocation size\n");
|
|
|
|
}
|
1988-09-28 16:47:47 +00:00
|
|
|
}
|
|
|
|
}
|