From: James Patrick Conlon Date: Wed, 1 Aug 2018 14:14:46 +0000 (+0100) Subject: Fix bug in PDP11 assembler when handling a JSr instruction with deferred auto increment. X-Git-Tag: users/ARM/embedded-binutils-master-2018q4~1200 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3cf2b6691cef024f7cdb48aaec5fab5189e1cffa;p=external%2Fbinutils.git Fix bug in PDP11 assembler when handling a JSr instruction with deferred auto increment. PR 14480 * config/tc-pdp11.c (parse_op_noreg): Check for and handle auto increment deferred. * testsuite/gas/pdp11/pr14480.d: New test driver file. * testsuite/gas/pdp11/pr14480.s: New test source file file. * testsuite/gas/pdp11/pdp11.exp: Run the new test. --- diff --git a/gas/ChangeLog b/gas/ChangeLog index 2976c79..4ba57b8 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,13 @@ +2018-08-01 James Patrick Conlon + Nick Clifton + + PR 14480 + * config/tc-pdp11.c (parse_op_noreg): Check for and handle auto + increment deferred. + * testsuite/gas/pdp11/pr14480.d: New test driver file. + * testsuite/gas/pdp11/pr14480.s: New test source file file. + * testsuite/gas/pdp11/pdp11.exp: Run the new test. + 2018-08-01 Nick Clifton * config/tc-ns32k.c (addr_mode): Replace "Drop through" comment diff --git a/gas/config/tc-pdp11.c b/gas/config/tc-pdp11.c index 2ad6882..e151b27 100644 --- a/gas/config/tc-pdp11.c +++ b/gas/config/tc-pdp11.c @@ -581,7 +581,21 @@ parse_op_noreg (char *str, struct pdp11_code *operand) if (*str == '@' || *str == '*') { - str = parse_op_no_deferred (str + 1, operand); + /* @(Rn) == @0(Rn): Mode 7, Indexed deferred. + Check for auto-increment deferred. */ + if (str[1] == '(' + && str[2] != 0 + && str[3] != 0 + && str[4] != 0 + && str[5] != '+') + { + /* Change implied to explicit index deferred. */ + *str = '0'; + str = parse_op_no_deferred (str, operand); + } + else + str = parse_op_no_deferred (str + 1, operand); + if (operand->error) return str; operand->code |= 010; diff --git a/gas/testsuite/gas/pdp11/pdp11.exp b/gas/testsuite/gas/pdp11/pdp11.exp index a6dbf88..b3609f9 100644 --- a/gas/testsuite/gas/pdp11/pdp11.exp +++ b/gas/testsuite/gas/pdp11/pdp11.exp @@ -19,8 +19,7 @@ # if [expr [istarget "pdp11-*-*"]] then { - run_dump_test "opcode" run_dump_test "absreloc" - + run_dump_test "pr14480" } diff --git a/gas/testsuite/gas/pdp11/pr14480.d b/gas/testsuite/gas/pdp11/pr14480.d new file mode 100644 index 0000000..ca85441 --- /dev/null +++ b/gas/testsuite/gas/pdp11/pr14480.d @@ -0,0 +1,14 @@ +#name: PR 14480 - correct assembly of 'jsr pc, @(r0)' +#objdump: -dw + +dump.o: +file format .* + +Disassembly of section .text: + +0+00 : +[ ]+0:[ ]+15c0 0014[ ]+mov[ ]+\$24, r0 +[ ]+4:[ ]+09c8[ ]+jsr[ ]+pc, \(r0\) +[ ]+6:[ ]+09f8 0000[ ]+jsr[ ]+pc, \*0\(r0\) +[ ]+a:[ ]+09f8 0000[ ]+jsr[ ]+pc, \*0\(r0\) +[ ]+e:[ ]+09f8 0002[ ]+jsr[ ]+pc, \*2\(r0\) +#pass diff --git a/gas/testsuite/gas/pdp11/pr14480.s b/gas/testsuite/gas/pdp11/pr14480.s new file mode 100644 index 0000000..505ca5d --- /dev/null +++ b/gas/testsuite/gas/pdp11/pr14480.s @@ -0,0 +1,17 @@ +start: mov $ind,r0 + jsr pc,(r0) + jsr pc,@(r0) + jsr pc,@0(r0) + jsr pc,@2(r0) + halt + + +ind: .WORD dest + .WORD dest2 + +dest: rts pc + +dest2: rts pc + + .END +