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

            Bug ID: 33145
           Summary: CR16 binary output format breaks relocations
           Product: binutils
           Version: 2.46 (HEAD)
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: binutils
          Assignee: unassigned at sourceware dot org
          Reporter: Jomosoto at proton dot me
  Target Milestone: ---

When outputting in binary output format, relocations break


Test case "test.S":

----
.global _start
_start:
                nop
_label:
                loadb _label, r0
                storb r0, 0xFF0000
                loadb 0xFF0000, r0
                cmpb $0, r0
                beq _label
----


Commands used:

----
as test.S -c -o test.o
ld test.o -o elf.out
ld test.o --oformat=binary -o bin.out
----


"objdump -D elf.out" output:
----
Disassembly of section .text:

00000002 <__FINI_END>:
   2:   00 2c           nop

00000004 <_label>:
   4:   12 00 00 70     loadb   0x4 <_label>:l,r0
   8:   04 00 
   a:   13 00 0f 7f     storb   r0,0xff0000 <__ISTACK_START+0xbe7f00>:l
   e:   00 00 
  10:   0f 88 00 00     loadb   0xf0000 <__CTOR_END+0xeffe8>:m,r0
  14:   00 50           cmpb    $0x0:s,r0
  16:   07 1f           beq     *-0x4 <_label>:s
----

"objdump -b binary -D bin.out --architecture cr16" output:
----
Disassembly of section .data:

00000000 <.data>:
   0:   00 2c           nop
   2:   04 00           di
   4:   00 70 00 00     sbitb   $0x0,[r12]0x0:m
   8:   13 00 0f 7f     storb   r0,0xff0000:l
   c:   00 00 
   e:   0f 88 00 00     loadb   0xf0000:m,r0
  12:   00 50           cmpb    $0x0:s,r0
  14:   01 10           beq     *+0x16:s
----


Expected "objdump -b binary -D bin.out --architecture cr16" output:
----
Disassembly of section .data:

00000000 <.data>:
   0:   00 2c           nop
   2:   12 00 00 70     loadb   0x2:l,r0
   6:   02 00 
   8:   13 00 0f 7f     storb   r0,0xff0000:l
   c:   00 00 
   e:   0f 88 00 00     loadb   0xf0000:m,r0
  12:   00 50           cmpb    $0x0:s,r0
  14:   07 1F           beq     *-0x2:s
----
(This is an example based on the instruction variants I saw beeing picked, the
real expected ouput may differ a bit :) )

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

Reply via email to