mach-o file types

Jan 20, 2021 2:41 PM
Jan 12, 2021 1:07 PM
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.