1. pdp11-dec-aout-gas produces an incorrect offset for the PDP11 SOB
instruction. The offset is calculated by gas as a 6 bit negative number. The
offset should be a 6 bit positive number and is subtracted from the PC by the
processor at run time. The command to gas was pdp11-dec-aout-gas -a -o test.lst
test.s. I have a potential fix for this, I have included it below as a context
diff:
+----------------------------------------------------------------+
*** ./gas/config/tc-pdp11.c.old Sat Jun 8 08:37:15 2002
--- ./gas/config/tc-pdp11.c Mon Sep 13 21:49:32 2004
***************
*** 199,204 ****
--- 199,205 ----
case BFD_RELOC_PDP11_DISP_6_PCREL:
mask = 0x003f;
shift = 1;
+ val = -val;
break;
default:
BAD_CASE (fixP->fx_r_type);
+----------------------------------------------------------------+
2. pdp11-dec-aout-objdump -d disassembles the offset for the PDP SOB
instruction incorrectly. The effect is to make the incorrect code generated by
the above problem appear correct. I have a potential fix for this, I have
included it below as a context diff:
+----------------------------------------------------------------+
*** ./opcodes/pdp11-dis.c.old Mon Dec 2 13:13:37 2002
--- ./opcodes/pdp11-dis.c Mon Sep 13 21:37:54 2004
***************
*** 342,348 ****
case PDP11_OPCODE_REG_DISPL:
{
int displ = (opcode & 0x3f) << 10;
! bfd_vma address = memaddr + (sign_extend (displ) >> 9);
FPRINTF (F, OP.name);
FPRINTF (F, AFTER_INSTRUCTION);
print_reg (src, info);
--- 342,348 ----
case PDP11_OPCODE_REG_DISPL:
{
int displ = (opcode & 0x3f) << 10;
! bfd_vma address = memaddr - (displ >> 9);
FPRINTF (F, OP.name);
FPRINTF (F, AFTER_INSTRUCTION);
print_reg (src, info);
3. pdp11-dec-aout-gas loses the offset for mode 7 index deferred address mode
instructions, @x(Rn), where x is the offset. I have no fix for this. I think
the problem is in the parse_op_no_deferred() and parse_op_noreg() functions in
./gas/config/tc-pdp11.c. I have a short section of code which illustrates this
problem, and the above problems.