Package ghidra.app.util.bin.format.macho

# Class MachHeaderFlags

java.lang.Object
ghidra.app.util.bin.format.macho.MachHeaderFlags

public final class MachHeaderFlags extends Object
Constants for the flags field of the mach_header

See Also:
  - EXTERNAL_HEADERS/mach-o/loader.h

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final int`
  `MH_ALLMODSBOUND`
  indicates that this binary binds to all two-level namespace modules of its dependent libraries.
  `static final int`
  `MH_ALLOW_STACK_EXECUTION`
  When this bit is set, all stacks in the task will be given stack execution privilege.
  `static final int`
  `MH_APP_EXTENSION_SAFE`
  The code was linked for use in an application extension.
  `static final int`
  `MH_BINDATLOAD`
  the object file's undefined references are bound by the dynamic linker when loaded
  `static final int`
  `MH_BINDS_TO_WEAK`
  the final linked image uses weak symbols.
  `static final int`
  `MH_CANONICAL`
  the binary has been canonicalized via the unprebind operation.
  `static final int`
  `MH_DEAD_STRIPPABLE_DYLIB`
  Only for use on dylibs.
  `static final int`
  `MH_DYLDLINK`
  the object file is input for the dynamic linker and can't be staticly link edited again
  `static final int`
  `MH_DYLIB_IN_CACHE`
  Only for use on dylibs.
  `static final int`
  `MH_FORCE_FLAT`
  the executable is forcing all images to use flat name space bindings
  `static final int`
  `MH_HAS_TLV_DESCRIPTORS`
  Contains a section of type S_THREAD_LOCAL_VARIABLES.
  `static final int`
  `MH_INCRLINK`
  the object file is the output of an incremental link against a base file and can't be link edited again.
  `static final int`
  `MH_LAZY_INIT`
  the shared library init routine is to be run lazily via catching memory faults to its writeable segments (obsolete)
  `static final int`
  `MH_NLIST_OUTOFSYNC_WITH_DYLDINFO`
  The external symbols listed in the nlist symbol table do not include all the symbols listed in the dyld info.
  `static final int`
  `MH_NO_HEAP_EXECUTION`
  When this bit is set, the OS will run the main executable with a non-executable heap even on platforms ( e.g., i386 ) that don't require it.
  `static final int`
  `MH_NO_REEXPORTED_DYLIBS`
  When this bit is set on a dylib, the static linker does not need to examine dependent dylibs to see if any are re-exported
  `static final int`
  `MH_NOFIXPREBINDING`
  do not have dyld notify the prebinding agent about this executable
  `static final int`
  `MH_NOMULTIDEFS`
  this umbrella guarantees no multiple definitions of symbols in its sub-images so the two-level namespace hints can always be used
  `static final int`
  `MH_NOUNDEFS`
  the object file has no undefined references
  `static final int`
  `MH_PIE`
  When this bit is set, the OS will load the main executable at a random address.
  `static final int`
  `MH_PREBINDABLE`
  the binary is not prebound but can have its prebinding redone.
  `static final int`
  `MH_PREBOUND`
  the file has its dynamic undefined references prebound
  `static final int`
  `MH_ROOT_SAFE`
  When this bit is set, the binary declares it is safe for use in processes with uid zero
  `static final int`
  `MH_SETUID_SAFE`
  When this bit is set, the binary declares it is safe for use in processes when issetugid() is true
  `static final int`
  `MH_SIM_SUPPORT`
  Allow LC_MIN_VERSION_MACOS and LC_BUILD_VERSION load commands with the platforms macOS, iOSMac, iOSSimulator, tvOSSimulator and watchOSSimulator.
  `static final int`
  `MH_SPLIT_SEGS`
  the file has its read-only and read-write segments split
  `static final int`
  `MH_SUBSECTIONS_VIA_SYMBOLS`
  safe to divide up the sections into sub-sections via symbols for dead code stripping
  `static final int`
  `MH_TWOLEVEL`
  the image is using two-level name space bindings
  `static final int`
  `MH_WEAK_DEFINES`
  the final linked image contains external weak symbols.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `MachHeaderFlags()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static final List<String>`
  `getFlags(int flags)`
  Returns string representation of the flag values.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### MH_NOUNDEFS

    public static final int MH_NOUNDEFS
    the object file has no undefined references
    See Also:
      - Constant Field Values

  - ### MH_INCRLINK

    public static final int MH_INCRLINK
    the object file is the output of an incremental link against a base file and can't be link edited again.
    See Also:
      - Constant Field Values

  - ### MH_DYLDLINK

    public static final int MH_DYLDLINK
    the object file is input for the dynamic linker and can't be staticly link edited again
    See Also:
      - Constant Field Values

  - ### MH_BINDATLOAD

    public static final int MH_BINDATLOAD
    the object file's undefined references are bound by the dynamic linker when loaded
    See Also:
      - Constant Field Values

  - ### MH_PREBOUND

    public static final int MH_PREBOUND
    the file has its dynamic undefined references prebound
    See Also:
      - Constant Field Values

  - ### MH_SPLIT_SEGS

    public static final int MH_SPLIT_SEGS
    the file has its read-only and read-write segments split
    See Also:
      - Constant Field Values

  - ### MH_LAZY_INIT

    public static final int MH_LAZY_INIT
    the shared library init routine is to be run lazily via catching memory faults to its writeable segments (obsolete)
    See Also:
      - Constant Field Values

  - ### MH_TWOLEVEL

    public static final int MH_TWOLEVEL
    the image is using two-level name space bindings
    See Also:
      - Constant Field Values

  - ### MH_FORCE_FLAT

    public static final int MH_FORCE_FLAT
    the executable is forcing all images to use flat name space bindings
    See Also:
      - Constant Field Values

  - ### MH_NOMULTIDEFS

    public static final int MH_NOMULTIDEFS
    this umbrella guarantees no multiple definitions of symbols in its sub-images so the two-level namespace hints can always be used
    See Also:
      - Constant Field Values

  - ### MH_NOFIXPREBINDING

    public static final int MH_NOFIXPREBINDING
    do not have dyld notify the prebinding agent about this executable
    See Also:
      - Constant Field Values

  - ### MH_PREBINDABLE

    public static final int MH_PREBINDABLE
    the binary is not prebound but can have its prebinding redone. only used when MH_PREBOUND is not set
    See Also:
      - Constant Field Values

  - ### MH_ALLMODSBOUND

    public static final int MH_ALLMODSBOUND
    indicates that this binary binds to all two-level namespace modules of its dependent libraries. only used when MH_PREBINDABLE and MH_TWOLEVEL are both set.
    See Also:
      - Constant Field Values

  - ### MH_SUBSECTIONS_VIA_SYMBOLS

    public static final int MH_SUBSECTIONS_VIA_SYMBOLS
    safe to divide up the sections into sub-sections via symbols for dead code stripping
    See Also:
      - Constant Field Values

  - ### MH_CANONICAL

    public static final int MH_CANONICAL
    the binary has been canonicalized via the unprebind operation.
    See Also:
      - Constant Field Values

  - ### MH_WEAK_DEFINES

    public static final int MH_WEAK_DEFINES
    the final linked image contains external weak symbols.
    See Also:
      - Constant Field Values

  - ### MH_BINDS_TO_WEAK

    public static final int MH_BINDS_TO_WEAK
    the final linked image uses weak symbols.
    See Also:
      - Constant Field Values

  - ### MH_ALLOW_STACK_EXECUTION

    public static final int MH_ALLOW_STACK_EXECUTION
    When this bit is set, all stacks in the task will be given stack execution privilege. only used in MH_EXECUTE filetypes.
    See Also:
      - Constant Field Values

  - ### MH_ROOT_SAFE

    public static final int MH_ROOT_SAFE
    When this bit is set, the binary declares it is safe for use in processes with uid zero
    See Also:
      - Constant Field Values

  - ### MH_SETUID_SAFE

    public static final int MH_SETUID_SAFE
    When this bit is set, the binary declares it is safe for use in processes when issetugid() is true
    See Also:
      - Constant Field Values

  - ### MH_NO_REEXPORTED_DYLIBS

    public static final int MH_NO_REEXPORTED_DYLIBS
    When this bit is set on a dylib, the static linker does not need to examine dependent dylibs to see if any are re-exported
    See Also:
      - Constant Field Values

  - ### MH_PIE

    public static final int MH_PIE
    When this bit is set, the OS will load the main executable at a random address. Only used in MH_EXECUTE filetypes.
    See Also:
      - Constant Field Values

  - ### MH_DEAD_STRIPPABLE_DYLIB

    public static final int MH_DEAD_STRIPPABLE_DYLIB
    Only for use on dylibs. When linking against a dylib that has this bit set, the static linker will automatically not create a LC_LOAD_DYLIB load command to the dylib if no symbols are being referenced from the dylib.
    See Also:
      - Constant Field Values

  - ### MH_HAS_TLV_DESCRIPTORS

    public static final int MH_HAS_TLV_DESCRIPTORS
    Contains a section of type S_THREAD_LOCAL_VARIABLES.
    See Also:
      - Constant Field Values

  - ### MH_NO_HEAP_EXECUTION

    public static final int MH_NO_HEAP_EXECUTION
    When this bit is set, the OS will run the main executable with a non-executable heap even on platforms ( e.g., i386 ) that don't require it. Only used in MH_EXECUTE file types.
    See Also:
      - Constant Field Values

  - ### MH_APP_EXTENSION_SAFE

    public static final int MH_APP_EXTENSION_SAFE
    The code was linked for use in an application extension.
    See Also:
      - Constant Field Values

  - ### MH_NLIST_OUTOFSYNC_WITH_DYLDINFO

    public static final int MH_NLIST_OUTOFSYNC_WITH_DYLDINFO
    The external symbols listed in the nlist symbol table do not include all the symbols listed in the dyld info.
    See Also:
      - Constant Field Values

  - ### MH_SIM_SUPPORT

    public static final int MH_SIM_SUPPORT
    Allow LC_MIN_VERSION_MACOS and LC_BUILD_VERSION load commands with the platforms macOS, iOSMac, iOSSimulator, tvOSSimulator and watchOSSimulator.
    See Also:
      - Constant Field Values

  - ### MH_DYLIB_IN_CACHE

    public static final int MH_DYLIB_IN_CACHE
    Only for use on dylibs. When this bit is set, the dylib is part of the dyld shared cache, rather than loose in the filesystem.
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### MachHeaderFlags

    public MachHeaderFlags()

- ## Method Details

  - ### getFlags

    public static final List<String> getFlags(int flags)
    Returns string representation of the flag values.
    Parameters:
      `flags` - the flags value to get the string representation of.
    Returns:
      a string representation of the flag values.