21 static const char bsssymbol[] = {
".bss" };
30 #define R_C60ALIGN 0x76
31 #define R_C60FPHEAD 0x77
32 #define R_C60NOCMP 0x100
64 while (shift <= fieldsz) {
66 objval += (
rvalue) *dp << shift;
72 objval &= (2 << fieldsz) - 1;
75 objval = (objval << shift) >> shift;
99 static const unsigned char ovf_limit[] = { 1, 2, 2 };
102 int fieldsz,
int offset,
unsigned sgn)
110 mask = (2
UL << fieldsz) - 1;
111 objval = (val &
mask);
128 *dp = (*dp & ~mask) + objval;
137 unsigned tmp = (val >> fieldsz) + (sgn & 0x1);
138 if (tmp > ovf_limit[sgn - 1])
148 #define SCALE_MASK 0x7
150 1, 0, 0, 0, 1, 1, 2, 2
169 unsigned int fieldsz = 0;
171 unsigned int reloc_info = 0;
172 unsigned int reloc_action = 0;
178 unsigned int scale = 0;
187 if (second_pass ==
false)
193 while (rop_map1[rx] != rp->TYPE) {
194 rx =
HASH_L(rop_map2[rx]);
209 dload_error(dlthis,
"Bad coff operator 0x%x", rp->TYPE);
214 rx =
HASH_I(rop_map2[rx]);
215 if ((rx < (
sizeof(rop_action) /
sizeof(
u16)))
216 && (rx < (
sizeof(rop_info) /
sizeof(
u16))) && (rx > 0)) {
217 reloc_action = rop_action[
rx];
218 reloc_info = rop_info[
rx];
220 dload_error(dlthis,
"Buffer Overflow - Array Index Out "
225 reloc_amt = rp->UVAL;
229 if (second_pass ==
false) {
237 else if (rp->SYMNDX == -1) {
252 "Expression stack overflow in %s at offset "
262 if (reloc_info &
ROP_RW) {
271 fieldsz = rp->FIELDSZ;
276 rp->
vaddr += (rp->WORDSZ - offset - fieldsz)
281 #if BITS_PER_AU > TARGET_AU_BITS
294 scale = RFV_SCALE(reloc_info);
298 if (reloc_info &
ROP_R) {
327 if (rp->SYMNDX == -1)
332 val += rp->R_DISP + reloc_amt;
335 val = dlthis->
image_secn->run_addr + reloc_amt;
363 else if (stackp !=
NULL)
364 val = (
urvalue) *stackp >> val;
368 val =
sizeof(
rvalue) * BITS_PER_AU - 1;
369 else if (stackp !=
NULL)
370 val = *stackp >>
val;
375 else if (stackp !=
NULL)
376 val = *stackp <<
val;
400 [svp->
secnn - 1].run_addr;
404 if (dlthis->bss_run_base == 0) {
406 symp = dlthis->
mysym->find_matching_symbol
407 (dlthis->
mysym, bsssymbol);
410 dlthis->bss_run_base = symp->
value;
413 "Global BSS base referenced in %s "
419 reloc_amt -= dlthis->bss_run_base;
424 offset += SCALE_BITS;
425 fieldsz -= SCALE_BITS;
429 if (((1 << scale) - 1) & val)
431 "Unaligned reference in %s offset "
438 if (reloc_info &
ROP_W) {
447 if ((second_pass ==
false) &&
462 "generate trampoline for "
466 " overflows %d bits in %s "
473 *tramps_generated =
true;