bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug gas/14480] PDP11 gas generates invalid code for deferred indirect J


From: cptjustice at gmail dot com
Subject: [Bug gas/14480] PDP11 gas generates invalid code for deferred indirect JSR with 0 index
Date: Thu, 19 Jul 2018 17:11:16 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=14480

--- Comment #5 from James Patrick Conlon <cptjustice at gmail dot com> ---
Confirming that this bug still exists in as 2.31.51.20180719.

Attached is a slightly modified version of Jordi's dic.s called dic-mod.s.  The
output of pdp11-aout-as -a dic-mod.s is:
GAS LISTING /home/cptnapalm/Downloads/dic-mod.s page 1

   1 0000 C0151200 start:mov$ind,r0
   2 0004 C809     jsr      pc,(r0)
   3 0006 C809     jsr      pc,@(r0)
   4 0008 F8090000 jsr      pc,@0(r0)
   5 000c F8090200 jsr      pc,@2(r0)
   6 0010 0000     halt
   7              
   8              
   9 0012 1600     ind:.WORDdest
  10 0014 1800     .WORDdest2
  11              
  12 0016 8700     dest:rtspc
  13              
  14 0018 8700     dest2:rtspc
  15              
  16              .END

    GAS LISTING /home/cptnapalm/Downloads/dic-mod.s page 2


    DEFINED SYMBOLS
    /home/cptnapalm/Downloads/dic-mod.s:1      .text:0000000000000000 start
    /home/cptnapalm/Downloads/dic-mod.s:9      .text:0000000000000012 ind
    /home/cptnapalm/Downloads/dic-mod.s:12     .text:0000000000000016 dest
    /home/cptnapalm/Downloads/dic-mod.s:14     .text:0000000000000018 dest2

    NO UNDEFINED SYMBOLS


As can be seen, jsr pc,@(r0) assembles the same as jsr pc,(r0), which it
shouldn't do.  I created a patch, which is attached, that solves this problem. 
As adding a '0' would create a new string and since it already knows that it's
deferred, I just replace the '@' with a '0' before sending it along.

The new output:
GAS LISTING /home/cptnapalm/Downloads/dic-mod.s                         page 1


   1 0000 C0151400      start:  mov     $ind,r0
   2 0004 C809                  jsr     pc,(r0)
   3 0006 F8090000              jsr     pc,@(r0)
   4 000a F8090000              jsr     pc,@0(r0)
   5 000e F8090200              jsr     pc,@2(r0)
   6 0012 0000                  halt
   7                    
   8                    
   9 0014 1800          ind:    .WORD   dest
  10 0016 1A00                  .WORD   dest2
  11                    
  12 0018 8700          dest:   rts     pc
  13                    
  14 001a 8700          dest2:  rts     pc
  15                            
  16                            .END

GAS LISTING /home/cptnapalm/Downloads/dic-mod.s                         page 2


DEFINED SYMBOLS
/home/cptnapalm/Downloads/dic-mod.s:1      .text:0000000000000000 start
/home/cptnapalm/Downloads/dic-mod.s:9      .text:0000000000000014 ind
/home/cptnapalm/Downloads/dic-mod.s:12     .text:0000000000000018 dest
/home/cptnapalm/Downloads/dic-mod.s:14     .text:000000000000001a dest2

NO UNDEFINED SYMBOLS


It now does the right thing in this case.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]