Otool
Usage
Usage: otool [-arch arch_type] [-fahlLDtdorSTMRIHGvVcXmqQjCP] [-mcpu=arg] [--version] <object file> ...
Flags
-
-f
: print the fat headers -
-a
: print the archive header -
-h
: print the mach header -
-l
: print the load commands -
-L
: print shared libraries used -
-D
: print shared library id name -
-t
: print the text section (disassemble with -v) -
-p
<routine name>: start dissassemble from routine name -
-s
<segname><sectname>: print contents of section
-
-d
: print the data section -
-o
: print the Objective-C segment -
-r
: print the relocation entries -
-S
: print the table of contents of a library -
-T
: print the table of contents of a dynamic shared library -
-M
: print the module table of a dynamic shared library -
-R
: print the reference table of a dynamic shared library -
-I
: print the indirect symbol table -
-H
: print the two-level hints table -
-G
: print the data in code table -
-v
: print verbosely (symbolically) when possible -
-V
: print disassembled operands symbolically -
-c
: print argument strings of a core file -
-X
: print no leading addresses or headers -
-m
: don't use archive(member) syntax -
-B
: force Thumb disassembly (ARM objects only) -
-q
: use llvm's disassembler (the default) -
-Q
: use otool(1)'s disassembler -
-mcpu=arg
: use `arg' as the cpu for disassembly -
-j
: print opcode bytes -
-P
: print the info plist section as strings -
-C
: print linker optimization hints -
--version
: print the version
Useful examples
-
otool -L libsomething.dylib
- 특정 라이브러리가 사용하는 공용 라이브러리 목록을 전부 출력한다. ldd와 유사하다.
-
otool -l ams
-
LC_RPATH
등의 헤더 정보를 출력한다.
How to check the lIbrary architecture
라이브러리의 아키텍쳐를 확인하는 방법은 아래와 같다.
참고로, readelf, lipo, objdump로도 각각 확인할 수 있다.
$ readelf -h <archive>.a | grep 'Class\|File\|Machine'
$ lipo -info libExample.a
$ objdump -a file.a | grep 'file format'