LLVM-OTOOL(1)               General Commands Manual              LLVM-OTOOL(1)

NAME
       llvm-otool - the otool-compatible command line parser for llvm-objdump

SYNOPSIS
       llvm-otool [ option ...  ] [ file ...  ]

DESCRIPTION
       The command line shim llvm-otool takes all the same options as the
       original otool(1) command and executes an equivalent objdump(1)
       command.  Its original intent was to ease changing usage over from
       otool(1) to the LLVM-based open source objdump(1) command with similar
       functionality. However, objdump(1) prefers different usage, with
       different behavior semantics and different output requirements.
       objdump(1) is no longer the preferred tool for inspecting modern Mach-O
       binaries. The llvm-otool command-line shim remains behind so that
       people who prefer to use the open source objdump(1) tool with otool-
       style semantics can continue to do so, mostly to support scripts or
       other tools that expect idiosyncrasies specific to that usage.

       By default, llvm-otool will invoke the original otool(1) functionality,
       meaning general usage such as the following will be executed via
       otool-classic as explained in the otool-classic(1) manual.
              % otool -hv file

       The unambiguous invocation of otool(1) can be found as otool-classic(1)
       and typically will be run by using the xcrun(1) utility:
              % xcrun otool-classic -hv file

       One can invoke objdump(1) in "otool compatibility" mode by calling
       llvm-otool(1) with the -objdump flag:
              % otool -objdump -hv file
       You can also invoke objdump(1) directly on the command line using LLVM-
       native options:
              % xcrun objdump --macho --private-header file

       -objdump
              This is a synonym for -object-tool-path objdump, described
              below.

       -object-tool-path tool
              After parsing the otool arguments, execute the command indicated
              by tool.  This value defaults to "otool-classic". If the
              specified tool contains the string "otool" in its name, the tool
              will be executed with the original unmodified arguments to
              llvm-otool(1), otherwise the arguments will be translated into
              llvm-style arguments as explained below.

       -show-objdump-command
              Print the command that llvm-otool(1) will execute. This is
              useful for seeing how comnand-line options were transformed.

GENERAL TRANSLATION NOTES
       Many of the older options in otool(1) are obsolete as they print parts
       of the object file that are no longer in use.  When translating options
       for objdump(1), obsolete options will produce a warning, and the option
       will be ignored. If no valid equivalent options are given then usage
       message from objdump(1) will be printed when executed.

       The archive member syntax of arguments of the form libx.a(foo.o), is
       not supported.  Which is the same as if the -m option is always used.

       When doing disassembly the default is to not print the opcode bytes of
       the instructions even for 32-bit ARM.  To get the opcode bytes printed
       for ARM the otool(1) option -j needs to be used.

       There are some whitespace and capitalization differences in the output
       of the otool(1) and objdump(1) commands in some cases; the objdump(1)
       command is not meant to produce the exact same output as otool(1) in
       all cases even where the functionality is very similar.

SPECIFIC TRANSLATIONS OF OPTIONS
       Below is the list of otool(1) options and the specific objdump(1)
       option to print the same information.  To use these options with
       objdump(1) the --macho option must be used.

       -f     The objdump(1) option to display the universal headers is
              --universal-headers.

       -a     The objdump(1) --archive-headers will print the archive header,
              if the file is an archive.  To get the offsets to the archive
              headers that would be printed with the otool(1) -aV options, the
              objdump(1) --archive-member-offsets can be added.

       -h     The objdump(1) option to display the Mach header is
              --private-header.

       -l     The objdump(1) option to display the load commands is
              --private-headers.  This implies the -h option, as
              --private-headers always displays the Mach header.

       -L     The objdump(1) option to display the names and version numbers
              of the shared libraries that the object file uses, as well as
              the shared library ID if the file is a shared library is
              --dylibs-used.

       -D     The objdump(1) option to display just the install name of a
              shared library is --dylib-id.

       -t     The objdump(1) option to display the contents of the
              (__TEXT,__text) section is to use the --section __TEXT,__text
              option.  If disassembly is wanted as with the -tv otool(1)
              options then the objdump(1) --disassemble is used.  By default
              objdump(1) also symbolically disassembles the operands as the
              otool(1) -tV options will do.  If this is not wanted then the
              objdump(1) --no-symbolic-operands option can be used.

       -x     The objdump(1) option to display the contents of every __text
              section defined in a Mach-O file is --section ,__text.  Note
              that an empty segment name means all segments. If disassembly is
              wanted as with the -xv otool(1) options then objdump(1)
              --disassemble-all is used.  By default objdump(1) also
              symbolically disassembles the operands as the otool(1) -xV
              options will do.  If this is not wanted then the objdump(1)
              --no-symbolic-operands option can be used.

       -p name
              The objdump(1) option to start the disassembly from symbol name
              is --dis-symname name.

       -s segname sectname
              The objdump(1) option to display the contents of the section
              (segname,sectname) is --section [segname,]sectname where the
              segname is optional and all segments will be searched for a
              matching sectname.

       -d     The objdump(1) option to display the contents of the
              (__DATA,__data) section is to use the --section __DATA,__data
              option.

       -o     The objdump(1) option to display the contents of the __OBJC
              segment used by the Objective-C run-time system is
              --objc-meta-data.

       -r     The objdump(1) option to display the relocation entries is
              --reloc.  Note that the default relocation entry format is
              different between objdump(1) and otool(1).  When --reloc is
              combined with the --macho option, objdump(1) will display the
              relocation entries in the classic otool(1) format.

       -S     There is no objdump(1) option to display  the contents of the
              `__.SYMDEF' file, if the file is an archive.  For that use
              llvm-nm(1) with the --print-armap option.

       -I     The objdump(1) option to display the indirect symbol table is
              --indirect-symbols.

       -G     The objdump(1) option to display the data in code table is
              --data-in-code.

       -v     For objdump(1) verbose output is the default and to get non-
              verbose output the option --non-verbose is used.

       -V     For objdump(1) displaying the disassembled operands symbolically
              is the default and to get non-symbolic operands with disassembly
              the option --no-symbolic-operands is used.

       -X     The objdump(1) option to not print leading addresses or headers
              with disassembly of sections is --no-leading-addr.

       -mcpu=arg
              The objdump(1) option when doing disassembly using the llvm
              disassembler to use the cpu arg.  is the --mcpu=arg option.

       -j     The objdump(1) prints the opcode bytes of the instructions when
              doing disassembly by default and is turned off with the option
              --no-show-raw-insn.

       -P     The objdump(1) option to print the info plist section,
              (__TEXT,__info_plist), as strings is --info-plist.

       -C     The objdump(1) option to display the linker optimization hints
              is --link-opt-hints.

       -arch arch_type
              The objdump(1) options to specifies the architectures to operate
              on are the --arch arch_type options.

       --version
              The objdump(1) option to display the llvm-otool(1) version
              information and the objdump(1) version information is --version.

OBSOLETE OPTIONS
       -T     There is no objdump(1) option to display the table of contents
              for a dynamically linked shared library, as this table is
              obsolete and no longer produced by the tools.

       -M     There is no objdump(1) option to display the module table of a
              dynamically linked shared library, as this table is obsolete and
              no longer produced by the tools.

       -R     There is no objdump(1) option to display the reference table of
              a dynamically linked shared library, as this table is obsolete
              and no longer produced by the tools.

       -H     There is no objdump(1) option to display the two-level namespace
              hints table, as this table is obsolete and no longer produced by
              the tools.

       -c     There is no objdump(1) option to display the argument strings
              (argv[] and envp[]) from a core file.

       -m     There is no objdump(1) option to not assume to the
              archive(member) syntax as that is the default.  And the
              archive(member) syntax is not supported as file arguments with
              objdump(1).

       -B     There is no objdump(1) option to force Thumb disassembly on ARM
              objects.

       -q     There is no objdump(1) option to use the llvm disassembler when
              doing disassembly as this is the default.

       -Q     There is no objdump(1) option to use the otool(1) disassembler
              when doing disassembly as only the llvm disassembler is used.

       -i     There is no objdump(1) option to display the shared library
              initialization table, as this table is obsolete and no longer
              produced by the tools.

       -function_offsets
              There is no objdump(1) option when doing disassembly to print
              the decimal offset from the last label printed.

SEE ALSO
       otool-classic(1), llvm-objdump(1)

Apple Inc.                       July 31, 2020                   LLVM-OTOOL(1)