|
From: | Bill Farmer |
Subject: | 2.15 pdp11-dec-aout gas and objdump |
Date: | Wed, 15 Sep 2004 20:17:06 +0100 |
Hi
I wish to report three problems with
version 2.15 of binutils when built with ./configure
--target=pdp11-dec-aout.
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.
test.s:
+----------------------------------------------------------------+
.title test ; s: clr r0 mov $5,r1 1$: inc @(R0)+ dec @x(R0) clr @x sob r1,1$ x: nop ; .end +----------------------------------------------------------------+
test.lst:
+----------------------------------------------------------------+ GAS LISTING test.mac
page 1
test
1
.title test
2 ; 3 0000 000A s: clr r0 4 0002 C1150500 mov $5,r1 5 0006 980A 1$: inc @(R0)+ 6 0008 F80A0000 dec @x(R0) <<< Should be F80A1200 7 000c 3F0A0200 clr @x <<< This is correct 8 0010 7A7E sob r1,1$ <<< Should be 467E 9 0012 A000 x: nop 10 ; 11 .end GAS LISTING test.mac page 2 test DEFINED
SYMBOLS
test.mac:3 .text:00000000 s test.mac:9 .text:00000012 x NO UNDEFINED
SYMBOLS
+----------------------------------------------------------------+
Same code assembled by RT11 MACRO, $5 is
misinterpreted as a
symbol, but the SOB and @x(Rn) address modes are correct.
+----------------------------------------------------------------+ TEST MACRO V05.03B WEDNESDAY
14-SEP-94 00:11 PAGE 1
1 .TITLE TEST 2 ; 3 000000 005000 S: CLR R0 4 000002 016701 000000G MOV $5,R1 5 000006 005230 1$: INC @(R0)+ 6 000010 005370 000022' DEC @X(R0) 7 000014 005077 000002 CLR @X 8 000020 077106 SOB R1,1$ 9 000022 000240 X: NOP 10 ; 11 000001 .END TEST MACRO V05.03B WEDNESDAY 14-SEP-94 00:11 PAGE 1-1 SYMBOL TABLE S
000000R
X
000022R $5 =
****** GX
. ABS. 000000
000 (RW,I,GBL,ABS,OVR) 000024 001 (RW,I,LCL,REL,CON) ERRORS DETECTED: 0 +----------------------------------------------------------------+
Output from pdp11-dec-aout-objdump -d
test.o:
+----------------------------------------------------------------+
test.o: file format
a.out-pdp11
Disassembly of section .text:
00000000 <s>:
0: 0a00 clr r0 2: 15c1 0005 mov $5, r1 6: 0a98 inc *(r0)+ 8: 0af8 0000 dec *0(r0) c: 0a3f 0002 clr *$12 <x> 10: 7e7a sob r1, 6 <s+0x6> <<< Wrong destination 00000012 <x>:
12: 00a0 nop +----------------------------------------------------------------+
I am happy to provide further information if
required
Regards
Bill
Farmer |
[Prev in Thread] | Current Thread | [Next in Thread] |