bug-binutils
[Top][All Lists]
Advanced

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

[Bug binutils/23728] nm fails on OS X 10.14 (Mojave)


From: fxcoudert at gcc dot gnu.org
Subject: [Bug binutils/23728] nm fails on OS X 10.14 (Mojave)
Date: Wed, 24 Oct 2018 10:47:20 +0000

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

Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2018-10-24
                 CC|                            |fxcoudert at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #3 from Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> ---
I can confirm that binutils does not handle Mach-O object files generated for
10.14. See below:

rmeur /tmp $ cat a.c
void foo (void) { ; }
rmeur /tmp $ clang -c a.c                           
rmeur /tmp $ mv a.o 10.14.o
rmeur /tmp $ gnm 10.14.o
gnm: 10.14.o: unknown load command 0x32
gnm: 10.14.o: unknown load command 0x32
gnm: 10.14.o: unknown load command 0x32
gnm: 10.14.o: file format not recognized
rmeur /tmp $ nm 10.14.o 
0000000000000000 T _foo

where nm is Apple's own nm, and gnm is GNU Binutils 2.31.1. Using the
-mmacosx-version-min=10.13 compiler switch produces an object file for macOS
10.13 compatibility, which binutils can handle:

rmeur /tmp $ clang -c a.c -mmacosx-version-min=10.13               
rmeur /tmp $ mv a.o 10.13.o
rmeur /tmp $ gnm 10.13.o 
0000000000000000 T _foo
rmeur /tmp $ nm 10.13.o 
0000000000000000 T _foo

The two object files are generated by the system assembler from the exact same
assembly file, so the difference is really created by the assembler. In fact,
calling the system "objdump" on them gives the exact same disassembly:

rmeur /tmp $ objdump -D 10.14.o

10.14.o:        file format Mach-O 64-bit x86-64

Disassembly of section __TEXT,__text:
_foo:
       0:       55      pushq   %rbp
       1:       48 89 e5        movq    %rsp, %rbp
       4:       5d      popq    %rbp
       5:       c3      retq
Disassembly of section __LD,__compact_unwind:
__compact_unwind:
       8:       00 00   addb    %al, (%rax)
       a:       00 00   addb    %al, (%rax)
       c:       00 00   addb    %al, (%rax)
       e:       00 00   addb    %al, (%rax)
      10:       06  <unknown>
      11:       00 00   addb    %al, (%rax)
      13:       00 00   addb    %al, (%rax)
      15:       00 00   addb    %al, (%rax)
      17:       01 00   addl    %eax, (%rax)
      19:       00 00   addb    %al, (%rax)
      1b:       00 00   addb    %al, (%rax)
      1d:       00 00   addb    %al, (%rax)
      1f:       00 00   addb    %al, (%rax)
      21:       00 00   addb    %al, (%rax)
      23:       00 00   addb    %al, (%rax)
      25:       00 00   addb    %al, (%rax)
      27:       00  <unknown>
Disassembly of section __TEXT,__eh_frame:
__eh_frame:
      28:       14 00   adcb    $0, %al
      2a:       00 00   addb    %al, (%rax)
      2c:       00 00   addb    %al, (%rax)
      2e:       00 00   addb    %al, (%rax)
      30:       01 7a 52        addl    %edi, 82(%rdx)
      33:       00 01   addb    %al, (%rcx)
      35:       78 10   js      16 <__eh_frame+0x1f>
      37:       01 10   addl    %edx, (%rax)
      39:       0c 07   orb     $7, %al
      3b:       08 90 01 00 00 24       orb     %dl, 603979777(%rax)
      41:       00 00   addb    %al, (%rax)
      43:       00 1c 00        addb    %bl, (%rax,%rax)
      46:       00 00   addb    %al, (%rax)
      48:       b8 ff ff ff ff  movl    $4294967295, %eax
      4d:       ff ff  <unknown>
      4f:       ff 06   incl    (%rsi)
      51:       00 00   addb    %al, (%rax)
      53:       00 00   addb    %al, (%rax)
      55:       00 00   addb    %al, (%rax)
      57:       00 00   addb    %al, (%rax)
      59:       41 0e  <unknown>
      5b:       10 86 02 43 0d 06       adcb    %al, 101532418(%rsi)
      61:       00 00   addb    %al, (%rax)
      63:       00 00   addb    %al, (%rax)
      65:       00 00   addb    %al, (%rax)
      67:       00  <unknown>

(the output is exactly the same for 10.14)

I have placed the object files at
https://www.dropbox.com/s/pn7gyyqfd1f0xdp/binutils-10.14.zip?dl=0

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