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

            Bug ID: 29557
           Summary: R_RISCV_ALIGN relocation emits wrong padding bytes
           Product: binutils
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: gas
          Assignee: unassigned at sourceware dot org
          Reporter: numbksco at gmail dot com
  Target Milestone: ---

Current result:

# cat <<EOF | riscv64-linux-gnu-gcc -fPIC -c -o a.o -xassembler -
.align 2
.section .text.hello
.globl hello
hello:
    li a0, 42
    ret
EOF

# riscv64-linux-gnu-objdump -z -d --reloc a.o 

a.o:     file format elf64-littleriscv


Disassembly of section .text:

0000000000000000 <.text>:
   0:   0001                    nop
                        0: R_RISCV_ALIGN        *ABS*+0x2
   2:   0000                    unimp

Disassembly of section .text.hello:

0000000000000000 <hello>:
   0:   02a00513                li      a0,42
   4:   8082                    ret


According to the spec:
https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/master/riscv-elf.adoc#relocation-for-alignment

The R_RISCV_ALIGN relocation padding bytes should be `c.nop + c.nop + c.nop` or
`c.nop + nop`, but currently we're getting `c.nop + 0x0000`.

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

Reply via email to