bug-binutils
[Top][All Lists]
Advanced

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

[Bug ld/24881] New: x86_64-linux-gnu-ld.bfd does not convert instruction


From: kariya_mitsuru at hotmail dot com
Subject: [Bug ld/24881] New: x86_64-linux-gnu-ld.bfd does not convert instructions for GOTPCRELX if output format is binary
Date: Mon, 05 Aug 2019 16:13:28 +0000

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

            Bug ID: 24881
           Summary: x86_64-linux-gnu-ld.bfd does not convert instructions
                    for GOTPCRELX if output format is binary
           Product: binutils
           Version: 2.32
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: ld
          Assignee: unassigned at sourceware dot org
          Reporter: kariya_mitsuru at hotmail dot com
  Target Milestone: ---

Created attachment 11937
  --> https://sourceware.org/bugzilla/attachment.cgi?id=11937&action=edit
Test case

If an operand of mov (or call) is a locally defined symbol with GOTPCRELX, then
x86_64-linux-gnu-ld.bfd converts it into immediate operand.
However, if output format is binary, x86_64-linux-gnu-ld.bfd does not convert
it.

================= m.s =================
        .globl  main
        .type   main, @function
main:
        movq    f@GOTPCREL(%rip), %rax

        callq   *f@GOTPCREL(%rip)

        xorl    %edi, %edi
        movl    $60, %eax
        syscall

        .size   main, . - main
================= m.s =================

============= m.o(disasm) =============
   0:   48 8b 05 00 00 00 00    mov    0x0(%rip),%rax        # 7 <main+0x7>
                        3: R_X86_64_REX_GOTPCRELX       f-0x4
   7:   ff 15 00 00 00 00       callq  *0x0(%rip)        # d <main+0xd>
                        9: R_X86_64_GOTPCRELX   f-0x4
   d:   31 ff                   xor    %edi,%edi
   f:   b8 3c 00 00 00          mov    $0x3c,%eax
  14:   0f 05                   syscall
============= m.o(disasm) =============

============ m.elf(disasm) ============
  400000:       48 c7 c0 16 00 40 00    mov    $0x400016,%rax
  400007:       67 e8 09 00 00 00       addr32 callq 0x400016
  40000d:       31 ff                   xor    %edi,%edi
  40000f:       b8 3c 00 00 00          mov    $0x3c,%eax
  400014:       0f 05                   syscall
============ m.elf(disasm) ============

============ m.bin(disasm) ============
  400000:       48 8b 05 0f 00 00 00    mov    0xf(%rip),%rax        # 0x400016
  400007:       ff 15 09 00 00 00       callq  *0x9(%rip)        # 0x400016
  40000d:       31 ff                   xor    %edi,%edi
  40000f:       b8 3c 00 00 00          mov    $0x3c,%eax
  400014:       0f 05                   syscall
============ m.bin(disasm) ============

IMHO, the instructions should be converted even though output format is binary.

I think that PR22419(binary format generated by LD is incorrect) is same
problem for V850.

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