change constant handling with @l.
authorrahnds <rahnds@openbsd.org>
Sun, 26 Jan 1997 08:17:27 +0000 (08:17 +0000)
committerrahnds <rahnds@openbsd.org>
Sun, 26 Jan 1997 08:17:27 +0000 (08:17 +0000)
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;

gnu/usr.bin/binutils/gas/config/tc-ppc.c

index 1a0d297..485da74 100644 (file)
@@ -1772,12 +1772,14 @@ md_assemble (str)
                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: