Ignore:
Timestamp:
Jan 16, 2007, 3:22:55 AM (19 years ago)
Author:
bird
Message:

Work in progress.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kLdr/kLdrModMachO.h

    r2949 r2950  
    2525    uint32_t        magic;
    2626    uint32_t        nfat_arch;
    27 } fat_header;
     27} fat_header_t;
    2828
    2929/**
     
    3737    uint32_t        size;
    3838    uint32_t        align;          /**< Power of 2. */
    39 } fat_arch;
     39} fat_arch_t;
    4040
    4141
     
    6666    uint32_t        sizeofcmds;
    6767    uint32_t        flags;
    68 } mach_header_32;
     68} mach_header_32_t;
    6969
    7070
     
    9696    uint32_t        flags;
    9797    uint32_t        reserved;       /**< (for proper struct and command alignment I guess) */
    98 } mach_header_64;
    99 
    100 
    101 
    102 /** @name CPU types / bits.
     98} mach_header_64_t;
     99
     100
     101/** @name File types (mach_header_64::filetype, mach_header_32::filetype)
     102 * @{
     103 */
     104#define MH_OBJECT           UINT32_C(1) /**< Object (relocatable). */
     105#define MH_EXECUTE          UINT32_C(2) /**< Executable (demand paged). */
     106#define MH_FVMLIB           UINT32_C(3) /**< Fixed VM shared library. */
     107#define MH_CORE             UINT32_C(4) /**< Core file. */
     108#define MH_PRELOAD          UINT32_C(5) /**< Preloaded executable. */
     109#define MH_DYLIB            UINT32_C(6) /**< Dynamically bound shared library. */
     110#define MH_DYLINKER         UINT32_C(7) /**< Dynamic linker. */
     111#define MH_BUNDLE           UINT32_C(8) /**< Dymamically bound bundle. */
     112#define MH_DYLIB_STUB       UINT32_C(9) /**< Shared library stub for static linking. */
     113#define MH_DSYM             UINT32_C(10)/**< Debug symbols. */
     114
     115/** @} */
     116
     117
     118/** @name Mach-O Header flags (mach_header_64::flags, mach_header_32::flags)
     119 * @{
     120 */
     121#define MH_NOUNDEFS                 UINT32_C(0x00000001) /**< No undefined symbols. */
     122#define MH_INCRLINK                 UINT32_C(0x00000002) /**< Partial increment link output. */
     123#define MH_DYLDLINK                 UINT32_C(0x00000004) /**< Food for the dynamic linker, not for ld. */
     124#define MH_BINDATLOAD               UINT32_C(0x00000008) /**< Bind all undefined symbols at load time. */
     125#define MH_PREBOUND                 UINT32_C(0x00000010) /**< Contains prebound undefined symbols. */
     126#define MH_SPLIT_SEGS               UINT32_C(0x00000020) /**< Read-only and read-write segments are split. */
     127#define MH_LAZY_INIT                UINT32_C(0x00000040) /**< Obsolete flag for doing lazy init when data is written. */
     128#define MH_TWOLEVEL                 UINT32_C(0x00000080) /**< Uses two-level name space bindings. */
     129#define MH_FORCE_FLAT               UINT32_C(0x00000100) /**< Task: The executable forces all images to use flat name space bindings. */
     130#define MH_NOMULTIDEFS              UINT32_C(0x00000200) /**< No multiple symbol definitions, safe to use two-level namespace hints. */
     131#define MH_NOFIXPREBINDING          UINT32_C(0x00000400) /**< The dynamic linker should not notify the prebinding agent about this executable. */
     132#define MH_PREBINDABLE              UINT32_C(0x00000800) /**< Not prebound, but it can be. Invalid if MH_PREBOUND is set. */
     133#define MH_ALLMODSBOUND             UINT32_C(0x00001000) /**< Binds to all two-level namespace modules of preqs. Requires MH_PREBINDABLE and MH_TWOLEVEL to be set. */
     134#define MH_SUBSECTIONS_VIA_SYMBOLS  UINT32_C(0x00002000) /**< Safe to divide sections into sub-sections via symbols for dead code stripping. */
     135#define MH_CANONICAL                UINT32_C(0x00004000) /**< Canonicalized via unprebind. */
     136#define MH_WEAK_DEFINES             UINT32_C(0x00008000) /**< The (finally) linked image has weak symbols. */
     137#define MH_BINDS_TO_WEAK            UINT32_C(0x00010000) /**< The (finally) linked image uses weak symbols. */
     138#define MH_ALLOW_STACK_EXECUTION    UINT32_C(0x00020000) /**< Task: allow stack execution. (MH_EXECUTE only) */
     139/** @} */
     140
     141
     142/** @name CPU types / bits (mach_header_64::cputype, mach_header_32::cputype, fat_arch::cputype)
    103143 * @{
    104144 */
     
    120160/** @} */
    121161
    122 /** @name CPU subtypes
     162
     163/** @name CPU subtypes (mach_header_64::cpusubtype, mach_header_32::cpusubtype, fat_arch::cpusubtype)
    123164 * @{ */
    124165#define CPU_SUBTYPE_MULTIPLE        INT32_C(-1)
     
    231272/** @} */
    232273
    233 #endif
    234 
     274
     275/**
     276 * The load command common core structure.
     277 *
     278 * After the Mach-O header follows an array of variable sized
     279 * load command which all has this header in common.
     280 */
     281typedef struct load_command
     282{
     283    uint32_t        cmd;            /**< The load command id. */
     284    uint32_t        cmdsize;        /**< The size of the command (including this header?). */
     285} load_command_t;
     286
     287/** @name Load Command IDs (load_command::cmd)
     288 * @{
     289 */
     290/** Flag that when set requires the dynamic linker to fail if it doesn't
     291 * grok the command. The dynamic linker will otherwise ignore commands it
     292 * doesn't understand. Introduced with Mac OS X 10.1. */
     293#define LC_REQ_DYLD         UINT32_C(0x80000000)
     294
     295#define LC_SEGMENT_32       UINT32_C(0x01)  /**< Segment to be mapped (32-bit). See segment_command_32. */
     296#define LC_SYMTAB           UINT32_C(0x02)  /**< 'stab' symbol table. See symtab_command. */
     297#define LC_SYMSEG           UINT32_C(0x03)  /**< Obsoleted gdb symbol table. */
     298#define LC_THREAD           UINT32_C(0x04)  /**< Thread. See thread_command. */
     299#define LC_UNIXTHREAD       UINT32_C(0x05)  /**< Unix thread (includes stack and stuff). See thread_command. */
     300#define LC_LOADFVMLIB       UINT32_C(0x06)  /**< Load a specified fixed VM shared library  (obsolete?). See fvmlib_command. */
     301#define LC_IDFVMLIB         UINT32_C(0x07)  /**< Fixed VM shared library id (obsolete?). See fvmlib_command. */
     302#define LC_IDENT            UINT32_C(0x08)  /**< Identification info (obsolete). See ident_command. */
     303#define LC_FVMFILE          UINT32_C(0x09)  /**< Fixed VM file inclusion (internal). See fvmfile_command. */
     304#define LC_PREPAGE          UINT32_C(0x0a)  /**< Prepage command (internal). See ?? */
     305#define LC_DYSYMTAB         UINT32_C(0x0b)  /**< Symbol table for dynamic linking. See dysymtab_command. */
     306#define LC_LOAD_DYLIB       UINT32_C(0x0c)  /**< Load a dynamically linked shared library. See dylib_command. */
     307#define LC_ID_DYLIB         UINT32_C(0x0d)  /**< Dynamically linked share library ident. See dylib_command. */
     308#define LC_LOAD_DYLINKER    UINT32_C(0x0e)  /**< Load a dynamical link editor. See dylinker_command. */
     309#define LC_ID_DYLINKER      UINt32_C(0x0f)  /**< Dynamic link editor ident. See dylinker_command. */
     310#define LC_PREBOUND_DYLIB   UINT32_C(0x10)  /**< Prebound modules for dynamically linking of a shared lib. See prebound_dylib_command. */
     311#define LC_ROUTINES         UINT32_C(0x11)  /**< Image routines. See routines_command_32. */
     312#define LC_SUB_FRAMEWORK    UINT32_C(0x12)  /**< Sub framework. See sub_framework_command. */
     313#define LC_SUB_UMBRELLA     UINT32_C(0x13)  /**< Sub umbrella. See sub_umbrella_command. */
     314#define LC_SUB_CLIENT       UINT32_C(0x14)  /**< Sub client. See sub_client_command.
     315#define LC_SUB_LIBRARY      UINT32_C(0x15)  /**< Sub library. See sub_library_command. */
     316#define LC_TWOLEVEL_HINTS   UINT32_C(0x16)  /**< Two-level namespace lookup hints. See twolevel_hints_command. */
     317#define LC_PREBIND_CKSUM    UINT32_C(0x17)  /**< Prebind checksum. See prebind_cksum_command. */
     318#define LC_LOAD_WEAK_DYLIB (UINT32_C(0x18) | LC_REQ_DYLD) /**< Dylib that can be missing, all symbols weak. See dylib_command. */
     319#define LC_SEGMENT_64       UINT32_C(0x19)  /**< segment to be mapped (64-bit). See segment_command_32. */
     320#define LC_ROUTINES_64      UINT32_C(0x1a)  /**< Image routines (64-bit). See routines_command_32. */
     321#define LC_UUID             UINT32_C(0x1b)  /**< The UUID of the object module. See uuid_command.  */
     322/** @} */
     323
     324#endif
     325
Note: See TracChangeset for help on using the changeset viewer.