[Nasm-bugs] [Bug 3392470] New: Make mach-o local labels start with a L in the object file

no-reply at bugzilla-nasm.gorcunov.org no-reply at bugzilla-nasm.gorcunov.org
Thu Mar 1 16:22:21 PST 2018


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

            Bug ID: 3392470
           Summary: Make mach-o local labels start with a L in the object
                    file
           Product: NASM
           Version: 2.13.xx
          Hardware: Macintosh
                OS: Mac OS
            Status: OPEN
          Severity: enhancement
          Priority: Medium
         Component: Assembler
          Assignee: nobody at nasm.us
          Reporter: afish at apple.com
                CC: gorcunov at gmail.com, hpa at zytor.com, nasm-bugs at nasm.us
     Obtained from: Binary from nasm.us

The concept is to be able to use local labels with "%pragma macho
subsections_via_symbols" and use those local labels to abstract out the strange
macOS behavior from NASM files that are shared between lots of
compiler/platforms. See 3392469 for more context. 

The macOS linker uses a simplistic naming scheme to chunk up the section into
meta sections. Basically the end of the meta section is before the next label
that does not start with a L. 

For example with this code:
global _IoReadFifo8
_IoReadFifo8:
    push    edi

    ; Check if we need to unroll String I/O
    jmp     .skip
.skip:
    call    _SevNoRepIo
    jmp     _SevNoRepIo
    test    eax, eax
    pop     edi
    ret

%pragma macho subsections_via_symbols

clang -arch i386 IoFifoSev.o  main.c -dead_strip

The result is:
(lldb) dis -b -n IoReadFifo8
a.out`IoReadFifo8:
a.out[0x1f90] <+0>:  57     pushl  %edi
a.out[0x1f91] <+1>:  eb 00  jmp    0x1f93                    ; <+3>
a.out[0x1f93] <+3>:  90     nop    
...

Thus if we could get this enhancement all we have to do is teach developers to
use local labels in the name space of the function to be compatible with
projects using mach-o.

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