[Nasm-bugs] [Bug 3392797] New: Invalid addressing mode with "rel" simply disregards rel

noreply-nasm at dev.nasm.us noreply-nasm at dev.nasm.us
Sun Apr 17 15:12:47 PDT 2022


https://bugzilla.nasm.us/show_bug.cgi?id=3392797

            Bug ID: 3392797
           Summary: Invalid addressing mode with "rel" simply disregards
                    rel
           Product: NASM
           Version: 2.14.xx
          Hardware: All
                OS: All
            Status: OPEN
          Severity: normal
          Priority: Medium
         Component: Assembler
          Assignee: nobody at nasm.us
          Reporter: liambowen at gmail.com
                CC: chang.seok.bae at intel.com, gorcunov at gmail.com,
                    hpa at zytor.com, nasm-bugs at nasm.us
     Obtained from: From OS distribution

I am not an expert on x86-64 assembly. I tried to assemble this line:

lea rbx, [rel values + rdi * 8]

No error was given, nor warning with -Wall, but I ran into problems linking:

relocation R_X86_64_32S against `.data' can not be used when making a PIE
object

This confused me for a while. After doing some research, it turns out that this
is an invalid addressing mode for x86-64. Instead, I have to use two
instructions, which I now realize.

What troubles me is that this seems to silently ignore "rel" and just assemble
as though I had given it:

lea rbx, [values + rdi * 8]

In my opinion, giving an invalid address mode should definitely be an error. A
warning would a good alternative. Because I can't use "rel" here, then please
have nasm tell me that!

Thank you very much for such a great assembler!

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


More information about the Nasm-bugs mailing list