[Nasm-bugs] [Bug 3392408] New: Self-relative expressions on macho64

no-reply at bugzilla-nasm.gorcunov.org no-reply at bugzilla-nasm.gorcunov.org
Tue May 23 10:01:56 PDT 2017


            Bug ID: 3392408
           Summary: Self-relative expressions on macho64
           Product: NASM
           Version: 2.13.xx
          Hardware: All
                OS: Mac OS
            Status: OPEN
          Severity: severe
          Priority: Medium
         Component: Assembler
          Assignee: nobody at nasm.us
          Reporter: henrik at gramner.com
                CC: gorcunov at gmail.com, hpa at zytor.com, nasm-bugs at nasm.us
     Obtained from: Built from git using configure

Self-relative expressions in the form of [foo-$$] appears to be working
incorrectly on 64-bit Mach-O systems.

I compared the output of the following snippet to yasm as a quick test. 'foo'
which is declared in the same file produces different output, 'bar' which is
extern seems to be handled the same as yasm.

    section .rodata
    foo: dd 0x12345678
    extern bar

    section .text
    lea eax, [rax+foo-$$]
    lea ebx, [rax+bar-$$]
    mov ecx, foo-$$
    mov edx, bar-$$

We use similar expressions in x264 and it works fine on elf64 and win64 systems
but not on macho64.

I don't have an OSX machine so I'm unable to test things myself, but checking
out commit f1ac712 from https://git.videolan.org/git/x264.git and running
"./configure && make checkasm && ./checkasm" results in errors and/or crashes
on macho64 systems. When we disabled all functions using those expressions on
macho64 as a temporary workaround in a more recent commit the problem

We don't use such expressions on 32-bit platforms so I don't know if macho32 is

The same code worked correctly on macho64 when using yasm before we switched to

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

More information about the Nasm-bugs mailing list