if the expected argument to the opcode is unsigned,
return (val & 0xffff)
if the expected argument to the occode is signed,
sign extend the 16 bit value
short = val;
val = (int) short;
break;
case BFD_RELOC_LO16:
- if (ex.X_unsigned)
- ex.X_add_number &= 0xffff;
- else
- ex.X_add_number = (((ex.X_add_number & 0xffff)
- ^ 0x8000)
- - 0x8000);
+ if (operand->flags & PPC_OPERAND_SIGNED) {
+ /* sign extend */
+ signed short i;
+ i = ex.X_add_number;
+ ex.X_add_number = (int) i;
+ } else {
+ ex.X_add_number &= 0xffff;
+ }
break;
case BFD_RELOC_HI16: