Using nm(1) to list symbols from object file built for arm64 on OS X

1.8k views Asked by At

Does anyone know how can list symbols from an object file that I built for arm64 architecture?

I tried to use nm but it gave me an error:

bfd_mach_o_scan: unknown architecture0x100000c/0x0 
File format not recognized

Is it possible to do the same thing using otool?

1

There are 1 answers

1
Variable Length Coder On BEST ANSWER

The system nm doesn't read arm64. You need to use the nm that came with your arm64 SDK (i.e. the iphoneos SDK in Xcode). This is the same path as where you ran clang.

$ xcrun -sdk iphoneos clang -arch arm64 main.c
$ xcrun -sdk iphoneos nm a.out 
0000000100000000 T __mh_execute_header
0000000100007f4c T _main
                 U _printf
                 U dyld_stub_binder