ldrMach-O.h revision 9a930fd7bd4d35c0ac75e4c83edb31b71bd3a635
/* $Id$ */
/** @file
* IPRT - Mach-O Structures and Constants.
*/
/*
* Copyright (C) 2011-2012 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*
* The contents of this file may alternatively be used under the terms
* of the Common Development and Distribution License Version 1.0
* (CDDL) only, as it comes in the "COPYING.CDDL" file of the
* VirtualBox OSE distribution, in which case the provisions of the
* CDDL are applicable instead of those of the GPL.
*
* You may elect to license modified versions of this file under the
* terms and conditions of either the GPL or the CDDL or both.
*/
#ifndef ___internal_ldrMach_O_h
#define ___internal_ldrMach_O_h
#ifndef CPU_ARCH_MASK
/* cputype */
#define CPU_TYPE_I386 CPU_TYPE_X86
/* cpusubtype */
#define CPU_SUBTYPE_LITTLE_ENDIAN INT32_C(0)
#define CPU_SUBTYPE_VAX_ALL INT32_C(0)
#define CPU_SUBTYPE_INTEL_FAMILY_MAX 0xf
#define CPU_SUBTYPE_INTEL_MODEL_ALL 0
#define CPU_SUBTYPE_MIPS_ALL INT32_C(0)
#define CPU_SUBTYPE_MC98000_ALL INT32_C(0)
#define CPU_SUBTYPE_HPPA_ALL INT32_C(0)
#define CPU_SUBTYPE_HPPA_7100 INT32_C(0)
#define CPU_SUBTYPE_MC88000_ALL INT32_C(0)
#define CPU_SUBTYPE_SPARC_ALL INT32_C(0)
#define CPU_SUBTYPE_I860_ALL INT32_C(0)
#define CPU_SUBTYPE_POWERPC_ALL INT32_C(0)
#endif /* !CPU_ARCH_MASK */
typedef struct fat_header
{
} fat_header_t;
#ifndef IMAGE_FAT_SIGNATURE
#endif
#ifndef IMAGE_FAT_SIGNATURE_OE
#endif
typedef struct fat_arch
{
} fat_arch_t;
typedef struct mach_header_32
{
/* magic */
#ifndef IMAGE_MACHO32_SIGNATURE
#endif
#ifndef IMAGE_MACHO32_SIGNATURE_OE
#endif
#define MH_MAGIC IMAGE_MACHO32_SIGNATURE
#define MH_CIGAM IMAGE_MACHO32_SIGNATURE_OE
typedef struct mach_header_64
{
/* magic */
#ifndef IMAGE_MACHO64_SIGNATURE
#endif
#ifndef IMAGE_MACHO64_SIGNATURE_OE
#endif
#define MH_MAGIC_64 IMAGE_MACHO64_SIGNATURE
/* mach_header_* filetype */
/* mach_header_* flags */
typedef struct load_command
{
/* load cmd */
typedef struct lc_str
{
} lc_str_t;
typedef struct segment_command_32
{
char segname[16];
typedef struct segment_command_64
{
char segname[16];
/* segment flags */
#ifndef VM_PROT_NONE
#endif
typedef struct section_32
{
char sectname[16];
char segname[16];
} section_32_t;
typedef struct section_64
{
char sectname[16];
char segname[16];
} section_64_t;
/* section flags */
#define S_REGULAR 0x0
#define S_ZEROFILL 0x1
#define S_CSTRING_LITERALS 0x2
#define S_4BYTE_LITERALS 0x3
#define S_8BYTE_LITERALS 0x4
#define S_LITERAL_POINTERS 0x5
#define S_NON_LAZY_SYMBOL_POINTERS 0x6
#define S_LAZY_SYMBOL_POINTERS 0x7
#define S_SYMBOL_STUBS 0x8
#define S_MOD_INIT_FUNC_POINTERS 0x9
#define S_MOD_TERM_FUNC_POINTERS 0xa
#define S_COALESCED 0xb
#define S_GB_ZEROFILL 0xc
#define S_INTERPOSING 0xd
#define S_16BYTE_LITERALS 0xe
#define S_DTRACE_DOF 0xf
#define S_LAZY_DYLIB_SYMBOL_POINTERS 0x10
/* standard section names */
#define SEG_PAGEZERO "__PAGEZERO"
#define SEG_TEXT "__TEXT"
#define SECT_TEXT "__text"
#define SECT_FVMLIB_INIT0 "__fvmlib_init0"
#define SECT_FVMLIB_INIT1 "__fvmlib_init1"
#define SEG_DATA "__DATA"
#define SECT_DATA "__data"
#define SECT_BSS "__bss"
#define SECT_COMMON "__common"
#define SEG_OBJC "__OBJC"
#define SECT_OBJC_SYMBOLS "__symbol_table"
#define SECT_OBJC_MODULES "__module_info"
#define SECT_OBJC_STRINGS "__selector_strs"
#define SECT_OBJC_REFS "__selector_refs"
#define SEG_ICON "__ICON"
#define SECT_ICON_HEADER "__header"
#define SECT_ICON_TIFF "__tiff"
#define SEG_LINKEDIT "__LINKEDIT"
#define SEG_UNIXSTACK "__UNIXSTACK"
#define SEG_IMPORT "__IMPORT"
typedef struct thread_command
{
typedef struct symtab_command
{
typedef struct uuid_command
{
typedef struct macho_nlist_32
{
union
{
} n_un;
typedef struct macho_nlist_64
{
union
{
} n_un;
#define REFERENCE_FLAG_UNDEFINED_NON_LAZY 0
#define REFERENCE_FLAG_UNDEFINED_LAZY 1
#define REFERENCE_FLAG_DEFINED 2
#define REFERENCE_FLAG_PRIVATE_DEFINED 3
#define REFERENCE_FLAG_PRIVATE_UNDEFINED_LAZY 5
#define GET_LIBRARY_ORDINAL(a_n_desc) \
#define SELF_LIBRARY_ORDINAL 0x00
#define MAX_LIBRARY_ORDINAL 0xfd
#define DYNAMIC_LOOKUP_ORDINAL 0xfe
#define EXECUTABLE_ORDINAL 0xff
typedef struct macho_relocation_info
{
#define R_ABS 0
typedef struct scattered_relocation_info
{
#ifdef RT_LITTLE_ENDIAN
#elif defined(RT_BIG_ENDIAN)
#else
# error "Neither K_ENDIAN isn't LITTLE or BIG!"
#endif
typedef enum reloc_type_generic
{
typedef enum reloc_type_x86_64
{
#endif