void update_ext_reloc(ALL_TABLES* tfinal, ALL_TABLES* t, int ex_tabix,
int new_ref, int new_tabix, int modify_code , int t_code_offset,
int new_dseg_adr)
/* Called when new information shows up about an external dseg rence.
* Search the relocation table t->reloc[] for an extdsegref ref field
* having a tabix field == ex_tabix
* When found at t->reloc[i],
* update the ref field of t->reloc[i] to new_ref
* update the tabix field of t->reloc[i] to new_tabix
* If (modify_code),
* modify tfinal->code[adr+t_code_offset].u.y to new_dseg_adr
* If new_tabix == NO_MOD, then the adr field of the relocation
* item must be modified now (append_reloc will zero the tabix
* field when it sees such an item and leave the adr field
* unmolested)
*/
{
int i;
reloc_fields r;
for(i = 0; i <= t->last_reloc; i++)
{
r = t->reloc[i];
if(r.r.tabix == ex_tabix && r.r.ref == EXTDSEGREF)
{
r.r.ref = new_ref;
r.r.tabix = new_tabix;
if(modify_code)
tfinal->code[r.r.adr + t_code_offset].u.y = new_dseg_adr;
if(new_tabix == NO_MOD)
r.r.adr += t_code_offset;
t->reloc[i] = r;
}
}
} /* update_ext_reloc */