This is ild.c in view mode; [Download] [Up]
@s[ if (relocation_info.r_type != R_DIR32S) {
fprintf(stderr, "%d: unsupported relocation type.",
relocation_info.r_type);
exit(1);
}
/*
Assuming R_DIR32S.
*/
p = (char *)(&value);
p[3] = where[0];
p[2] = where[1];
p[1] = where[2];
p[0] = where[3];
value += symbol_table[relocation_info.r_symndx].n_value;
where[0] = p[3];
where[1] = p[2];
where[2] = p[1];
where[3] = p[0];
}
@s|switch(relocation_info.r_type){ int *q;
#ifdef MP386
case R_DIR32:
*(int *)where= *((int *)where) +
symbol_table[relocation_info.r_symndx].n_value;
break;
case R_PCRLONG:
*(int *)where= *((int *)where) - (int)start_address
+ symbol_table[relocation_info.r_symndx].n_value;
break;
#else
case R_DIR32S:
p = (char *)(&value);
p[3] = where[0];
p[2] = where[1];
p[1] = where[2];
p[0] = where[3];
value += symbol_table[relocation_info.r_symndx].n_value;
where[0] = p[3];
where[1] = p[2];
where[2] = p[1];
where[3] = p[0];
break;
#endif
default:
fprintf(stderr, "%d: unsupported relocation type.",
relocation_info.r_type);
exit(1);
}
}
@s]
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.