#include <mach-o/arch.h>
mach-o/arch.h
The NXArchInfo structs contain the architectures symbolic name
(such as "ppc"), its CPU type and CPU subtype as defined in
mach/machine.h, the byte order for the architecture, and a
describing string (such as "PowerPC").
There will both be entries for specific CPUs (such as ppc604e) as
well as generic "family" entries (such as ppc).
structNXArchInfo
| const char * | name | |
| cpu_type_t | cputype | |
| cpu_subtype_t | cpusubtype | |
| enum NXByteOrder | byteorder | |
| const char * | description |
typedefNXArchInfo
typedef struct NXArchInfo NXArchInfo
functionNXGetAllArchInfos
__CCTOOLS_DEPRECATED extern const NXArchInfo *NXGetAllArchInfos(void)
deprecated
NXGetAllArchInfos() returns a pointer to an array of all known
NXArchInfo structures. The last NXArchInfo is marked by a NULL name.
functionNXGetLocalArchInfo
__CCTOOLS_DEPRECATED_MSG("use macho_arch_name_for_mach_header()") extern const NXArchInfo *NXGetLocalArchInfo(void)
deprecated
NXGetLocalArchInfo() returns the NXArchInfo for the local host, or NULL
if none is known.
functionNXGetArchInfoFromName
__CCTOOLS_DEPRECATED_MSG("use macho_cpu_type_for_arch_name()") extern const NXArchInfo *NXGetArchInfoFromName(const char *name)
deprecated
NXGetArchInfoFromName() and NXGetArchInfoFromCpuType() return the
NXArchInfo from the architecture's name or cputype/cpusubtype
combination. A cpusubtype of CPU_SUBTYPE_MULTIPLE can be used
to request the most general NXArchInfo known for the given cputype.
NULL is returned if no matching NXArchInfo can be found.
functionNXGetArchInfoFromCpuType
__CCTOOLS_DEPRECATED_MSG("use macho_arch_name_for_cpu_type()") extern const NXArchInfo *NXGetArchInfoFromCpuType( cpu_type_t cputype, cpu_subtype_t cpusubtype )
deprecated
functionNXFreeArchInfo
__CCTOOLS_DEPRECATED_MSG("NXArchInfo is deprecated") extern void NXFreeArchInfo(const NXArchInfo *x)
deprecated
The above interfaces that return pointers to NXArchInfo structs in normal
cases returns a pointer from the array returned in NXGetAllArchInfos().
In some cases when the cputype is CPU_TYPE_I386 or CPU_TYPE_POWERPC it will
retun malloc(3)'ed NXArchInfo struct which contains a string in the
description field also a malloc(3)'ed pointer. To allow programs not to
leak memory they can call NXFreeArchInfo() on pointers returned from the
above interfaces. Since this is a new API on older systems can use the
code below. Going forward the above interfaces will only return pointers
from the array returned in NXGetAllArchInfos().
functionNXFindBestFatArch
__CCTOOLS_DEPRECATED_MSG("use macho_best_slice()") extern struct fat_arch *NXFindBestFatArch( cpu_type_t cputype, cpu_subtype_t cpusubtype, struct fat_arch *fat_archs, uint32_t nfat_archs )
deprecated
NXFindBestFatArch() is passed a cputype and cpusubtype and a set of
fat_arch structs and selects the best one that matches (if any) and returns
a pointer to that fat_arch struct (or NULL). The fat_arch structs must be
in the host byte order and correct such that the fat_archs really points to
enough memory for nfat_arch structs. It is possible that this routine could
fail if new cputypes or cpusubtypes are added and an old version of this
routine is used. But if there is an exact match between the cputype and
cpusubtype and one of the fat_arch structs this routine will always succeed.
functionNXFindBestFatArch_64
__CCTOOLS_DEPRECATED_MSG("use macho_best_slice()") extern struct fat_arch_64 *NXFindBestFatArch_64( cpu_type_t cputype, cpu_subtype_t cpusubtype, struct fat_arch_64 *fat_archs64, uint32_t nfat_archs )
deprecated
NXFindBestFatArch_64() is passed a cputype and cpusubtype and a set of
fat_arch_64 structs and selects the best one that matches (if any) and
returns a pointer to that fat_arch_64 struct (or NULL). The fat_arch_64
structs must be in the host byte order and correct such that the fat_archs64
really points to enough memory for nfat_arch structs. It is possible that
this routine could fail if new cputypes or cpusubtypes are added and an old
version of this routine is used. But if there is an exact match between the
cputype and cpusubtype and one of the fat_arch_64 structs this routine will
always succeed.
functionNXCombineCpuSubtypes
__CCTOOLS_DEPRECATED_MSG("cpu subtypes are no longer combinable") extern cpu_subtype_t NXCombineCpuSubtypes( cpu_type_t cputype, cpu_subtype_t cpusubtype1, cpu_subtype_t cpusubtype2 )
deprecated
NXCombineCpuSubtypes() returns the resulting cpusubtype when combining two
different cpusubtypes for the specified cputype. If the two cpusubtypes
can't be combined (the specific subtypes are mutually exclusive) -1 is
returned indicating it is an error to combine them. This can also fail and
return -1 if new cputypes or cpusubtypes are added and an old version of
this routine is used. But if the cpusubtypes are the same they can always
be combined and this routine will return the cpusubtype pass in.