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

            Bug ID: 27763
           Summary: x86-64 RIP-relative address with labels wraps around
                    signed 32-bit integer
           Product: binutils
           Version: 2.36.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: gas
          Assignee: unassigned at sourceware dot org
          Reporter: andrey.vihrov at gmail dot com
  Target Milestone: ---

Consider the following source:

  movq test(%rip), %rax
  .set test, . + 0xF0000000

When assembled and then disassembled with "objdump -d", this gives

  0:    48 8b 05 00 00 00 f0    mov    -0x10000000(%rip),%rax

The relative address wraps around and results in a negative displacement.

This affects expressions with labels, such as (test + 1) and (test -
0x1E0000000), but not simply 0xF0000000, which is correctly rejected with

  Error: 0xf0000000 out range of signed 32bit displacement

Expressions not smaller than 2^32, such as (test + 0xF0000000), are also
correctly rejected:

  Error: value of 8053063680 too large for field of 4 bytes at 3

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

Reply via email to