mach-o file types

Created
Jan 12, 2021 1:07 PM
Tags
Keywords
otool -h <path>

filetypeAn integer indicating the usage and alignment of the file. Valid values for this field include:

  • The MH_OBJECT file type is the format used for intermediate object files. It is a very compact format containing all its sections in one segment. The compiler and assembler usually create one MH_OBJECT file for each source code file. By convention, the file name extension for this format is .o.
  • The MH_EXECUTE file type is the format used by standard executable programs.
  • The MH_BUNDLE file type is the type typically used by code that you load at runtime (typically called bundles or plug-ins). By convention, the file name extension for this format is .bundle.
  • The MH_DYLIB file type is for dynamic shared libraries. It contains some additional tables to support multiple modules. By convention, the file name extension for this format is .dylib, except for the main shared library of a framework, which does not usually have a file name extension.
  • The MH_PRELOAD file type is an executable format used for special-purpose programs that are not loaded by the OS X kernel, such as programs burned into programmable ROM chips. Do not confuse this file type with the MH_PREBOUND flag, which is a flag that the static linker sets in the header structure to mark a prebound image.
  • The MH_CORE file type is used to store core files, which are traditionally created when a program crashes. Core files store the entire address space of a process at the time it crashed. You can later run gdb on the core file to figure out why the crash occurred.
  • The MH_DYLINKER file type is the type of a dynamic linker shared library. This is the type of the dyld file.
  • The MH_DSYM file type designates files that store symbol information for a corresponding binary file.

image