bug-binutils
[Top][All Lists]
Advanced

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

[Bug gas/25848] New: cmpi to local label produces wrong code on 68000


From: vincent.riviere at freesbee dot fr
Subject: [Bug gas/25848] New: cmpi to local label produces wrong code on 68000
Date: Sat, 18 Apr 2020 11:33:08 +0000

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

            Bug ID: 25848
           Summary: cmpi to local label produces wrong code on 68000
           Product: binutils
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: gas
          Assignee: unassigned at sourceware dot org
          Reporter: vincent.riviere at freesbee dot fr
  Target Milestone: ---
            Target: m68k-elf

Tested with gas 2.34.50.20200418 freshly compiled fom Git.

Basically, cmpi to local label is optimized by gas to PC-relative label. But
this addressing mode is actually only supported on 68020+.

$ cat bug.s
lab:
        cmpi.w  #1,lab

$ m68k-elf-as -m68000 bug.s -o bug.o && m68k-elf-objdump -d bug.o

bug.o:     file format elf32-m68k


Disassembly of section .text:

00000000 <lab>:
   0:   0c7a 0001 fffc  cmpiw #1,%pc@(0 <lab>)

We have specifically asked for 68000 compilation. We can see that the reference
to the absolute "lab" label has been silently replaced by a PC-relative label.
But on plain 68000, that addressing mode is unsupported. See M68000PRM.pdf,
instruction CMPI "Compare Immediate".

gas should not blindly convert absolute to PC-relative addressing with cmpi
when compiling for 68000.

-- 
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]