mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-01-31 11:37:35 +00:00
188 lines
8.9 KiB
C
188 lines
8.9 KiB
C
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
|
|
│ vi: set et ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi │
|
|
╞══════════════════════════════════════════════════════════════════════════════╡
|
|
│ Copyright 2020 Justine Alexandra Roberts Tunney │
|
|
│ │
|
|
│ Permission to use, copy, modify, and/or distribute this software for │
|
|
│ any purpose with or without fee is hereby granted, provided that the │
|
|
│ above copyright notice and this permission notice appear in all copies. │
|
|
│ │
|
|
│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │
|
|
│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │
|
|
│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │
|
|
│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │
|
|
│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │
|
|
│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │
|
|
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
|
│ PERFORMANCE OF THIS SOFTWARE. │
|
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
|
#include "tool/decode/lib/machoidnames.h"
|
|
#include "libc/macho.h"
|
|
|
|
const struct IdName kMachoArchitectures[] = {
|
|
{MAC_CPU_MC680x0, "MAC_CPU_MC680x0"}, //
|
|
{MAC_CPU_NEXGEN32E, "MAC_CPU_NEXGEN32E"}, //
|
|
{MAC_CPU_I386, "MAC_CPU_I386"}, //
|
|
{MAC_CPU_X86, "MAC_CPU_X86"}, //
|
|
{MAC_CPU_MC98000, "MAC_CPU_MC98000"}, //
|
|
{MAC_CPU_HPPA, "MAC_CPU_HPPA"}, //
|
|
{MAC_CPU_ARM64, "MAC_CPU_ARM64"}, //
|
|
{MAC_CPU_ARM64_32, "MAC_CPU_ARM64_32"}, //
|
|
{MAC_CPU_ARM, "MAC_CPU_ARM"}, //
|
|
{MAC_CPU_MC88000, "MAC_CPU_MC88000"}, //
|
|
{MAC_CPU_SPARC, "MAC_CPU_SPARC"}, //
|
|
{MAC_CPU_I860, "MAC_CPU_I860"}, //
|
|
{MAC_CPU_POWERPC64, "MAC_CPU_POWERPC64"}, //
|
|
{MAC_CPU_POWERPC, "MAC_CPU_POWERPC"}, //
|
|
{MAC_ARCH_ABI64, "MAC_ARCH_ABI64"}, // flaggy
|
|
{MAC_ARCH_ABI64_32, "MAC_ARCH_ABI64_32"}, //
|
|
{MAC_CPU_NEXGEN32E_ALL, "MAC_CPU_NEXGEN32E_ALL"}, // subtypes
|
|
{0, 0},
|
|
};
|
|
|
|
const struct IdName kMachoFileTypeNames[] = {
|
|
{MAC_OBJECT, "MAC_OBJECT"},
|
|
{MAC_EXECUTE, "MAC_EXECUTE"},
|
|
{MAC_FVMLIB, "MAC_FVMLIB"},
|
|
{MAC_CORE, "MAC_CORE"},
|
|
{MAC_PRELOAD, "MAC_PRELOAD"},
|
|
{MAC_DYLIB, "MAC_DYLIB"},
|
|
{MAC_DYLINKER, "MAC_DYLINKER"},
|
|
{MAC_BUNDLE, "MAC_BUNDLE"},
|
|
{0, 0},
|
|
};
|
|
|
|
const struct IdName kMachoFlagNames[] = {
|
|
{MAC_NOUNDEFS, "MAC_NOUNDEFS"},
|
|
{MAC_INCRLINK, "MAC_INCRLINK"},
|
|
{MAC_DYLDLINK, "MAC_DYLDLINK"},
|
|
{MAC_BINDATLOAD, "MAC_BINDATLOAD"},
|
|
{MAC_PREBOUND, "MAC_PREBOUND"},
|
|
{MAC_SPLIT_SEGS, "MAC_SPLIT_SEGS"},
|
|
{MAC_LAZY_INIT, "MAC_LAZY_INIT"},
|
|
{MAC_TWOLEVEL, "MAC_TWOLEVEL"},
|
|
{MAC_FORCE_FLAT, "MAC_FORCE_FLAT"},
|
|
{MAC_NOMULTIDEFS, "MAC_NOMULTIDEFS"},
|
|
{MAC_NOFIXPREBINDING, "MAC_NOFIXPREBINDING"},
|
|
{MAC_PREBINDABLE, "MAC_PREBINDABLE"},
|
|
{MAC_ALLMODSBOUND, "MAC_ALLMODSBOUND"},
|
|
{MAC_SUBSECTIONS_VIA_SYMBOLS, "MAC_SUBSECTIONS_VIA_SYMBOLS"},
|
|
{MAC_CANONICAL, "MAC_CANONICAL"},
|
|
{MAC_ALLOW_STACK_EXECUTION, "MAC_ALLOW_STACK_EXECUTION"},
|
|
{MAC_ROOT_SAFE, "MAC_ROOT_SAFE"},
|
|
{MAC_SETUID_SAFE, "MAC_SETUID_SAFE"},
|
|
{MAC_PIE, "MAC_PIE"},
|
|
{MAC_HAS_TLV_DESCRIPTORS, "MAC_HAS_TLV_DESCRIPTORS"},
|
|
{MAC_NO_HEAP_EXECUTION, "MAC_NO_HEAP_EXECUTION"},
|
|
{0, 0},
|
|
};
|
|
|
|
const struct IdName kMachoSegmentFlagNames[] = {
|
|
{MAC_SG_HIGHVM, "MAC_SG_HIGHVM"},
|
|
{MAC_SG_FVMLIB, "MAC_SG_FVMLIB"},
|
|
{MAC_SG_NORELOC, "MAC_SG_NORELOC"},
|
|
{0, 0},
|
|
};
|
|
|
|
const struct IdName kMachoSectionTypeNames[] = {
|
|
{MAC_S_REGULAR, "MAC_S_REGULAR"},
|
|
{MAC_S_ZEROFILL, "MAC_S_ZEROFILL"},
|
|
{MAC_S_CSTRING_LITERALS, "MAC_S_CSTRING_LITERALS"},
|
|
{MAC_S_4BYTE_LITERALS, "MAC_S_4BYTE_LITERALS"},
|
|
{MAC_S_8BYTE_LITERALS, "MAC_S_8BYTE_LITERALS"},
|
|
{MAC_S_LITERAL_POINTERS, "MAC_S_LITERAL_POINTERS"},
|
|
{MAC_S_NON_LAZY_SYMBOL_POINTERS, "MAC_S_NON_LAZY_SYMBOL_POINTERS"},
|
|
{MAC_S_LAZY_SYMBOL_POINTERS, "MAC_S_LAZY_SYMBOL_POINTERS"},
|
|
{MAC_S_SYMBOL_STUBS, "MAC_S_SYMBOL_STUBS"},
|
|
{MAC_S_MOD_INIT_FUNC_POINTERS, "MAC_S_MOD_INIT_FUNC_POINTERS"},
|
|
{MAC_S_MOD_TERM_FUNC_POINTERS, "MAC_S_MOD_TERM_FUNC_POINTERS"},
|
|
{MAC_S_COALESCED, "MAC_S_COALESCED"},
|
|
{MAC_S_GB_ZEROFILL, "MAC_S_GB_ZEROFILL"},
|
|
{MAC_S_INTERPOSING, "MAC_S_INTERPOSING"},
|
|
{MAC_S_16BYTE_LITERALS, "MAC_S_16BYTE_LITERALS"},
|
|
{0, 0},
|
|
};
|
|
|
|
const struct IdName kMachoSectionAttributeNames[] = {
|
|
{MAC_S_ATTRIBUTES_USR, "MAC_S_ATTRIBUTES_USR"},
|
|
{MAC_S_ATTR_PURE_INSTRUCTIONS, "MAC_S_ATTR_PURE_INSTRUCTIONS"},
|
|
{MAC_S_ATTR_NO_TOC, "MAC_S_ATTR_NO_TOC"},
|
|
{MAC_S_ATTR_STRIP_STATIC_SYMS, "MAC_S_ATTR_STRIP_STATIC_SYMS"},
|
|
{MAC_S_ATTR_NO_DEAD_STRIP, "MAC_S_ATTR_NO_DEAD_STRIP"},
|
|
{MAC_S_ATTR_LIVE_SUPPORT, "MAC_S_ATTR_LIVE_SUPPORT"},
|
|
{MAC_S_ATTR_SELF_MODIFYING_CODE, "MAC_S_ATTR_SELF_MODIFYING_CODE"},
|
|
{MAC_S_ATTR_DEBUG, "MAC_S_ATTR_DEBUG"},
|
|
{MAC_S_ATTRIBUTES_SYS, "MAC_S_ATTRIBUTES_SYS"},
|
|
{MAC_S_ATTR_SOME_INSTRUCTIONS, "MAC_S_ATTR_SOME_INSTRUCTIONS"},
|
|
{MAC_S_ATTR_EXT_RELOC, "MAC_S_ATTR_EXT_RELOC"},
|
|
{MAC_S_ATTR_LOC_RELOC, "MAC_S_ATTR_LOC_RELOC"},
|
|
{0, 0},
|
|
};
|
|
|
|
const struct IdName kMachoLoadCommandNames[] = {
|
|
{MAC_LC_SEGMENT, "MAC_LC_SEGMENT"},
|
|
{MAC_LC_SYMTAB, "MAC_LC_SYMTAB"},
|
|
{MAC_LC_SYMSEG, "MAC_LC_SYMSEG"},
|
|
{MAC_LC_THREAD, "MAC_LC_THREAD"},
|
|
{MAC_LC_UNIXTHREAD, "MAC_LC_UNIXTHREAD"},
|
|
{MAC_LC_LOADFVMLIB, "MAC_LC_LOADFVMLIB"},
|
|
{MAC_LC_IDFVMLIB, "MAC_LC_IDFVMLIB"},
|
|
{MAC_LC_IDENT, "MAC_LC_IDENT"},
|
|
{MAC_LC_FVMFILE, "MAC_LC_FVMFILE"},
|
|
{MAC_LC_PREPAGE, "MAC_LC_PREPAGE"},
|
|
{MAC_LC_DYSYMTAB, "MAC_LC_DYSYMTAB"},
|
|
{MAC_LC_LOAD_DYLIB, "MAC_LC_LOAD_DYLIB"},
|
|
{MAC_LC_ID_DYLIB, "MAC_LC_ID_DYLIB"},
|
|
{MAC_LC_LOAD_DYLINKER, "MAC_LC_LOAD_DYLINKER"},
|
|
{MAC_LC_ID_DYLINKER, "MAC_LC_ID_DYLINKER"},
|
|
{MAC_LC_PREBOUND_DYLIB, "MAC_LC_PREBOUND_DYLIB"},
|
|
{MAC_LC_ROUTINES, "MAC_LC_ROUTINES"},
|
|
{MAC_LC_SUB_FRAMEWORK, "MAC_LC_SUB_FRAMEWORK"},
|
|
{MAC_LC_SUB_UMBRELLA, "MAC_LC_SUB_UMBRELLA"},
|
|
{MAC_LC_SUB_CLIENT, "MAC_LC_SUB_CLIENT"},
|
|
{MAC_LC_SUB_LIBRARY, "MAC_LC_SUB_LIBRARY"},
|
|
{MAC_LC_TWOLEVEL_HINTS, "MAC_LC_TWOLEVEL_HINTS"},
|
|
{MAC_LC_PREBIND_CKSUM, "MAC_LC_PREBIND_CKSUM"},
|
|
{MAC_LC_LOAD_WEAK_DYLIB, "MAC_LC_LOAD_WEAK_DYLIB"},
|
|
{MAC_LC_SEGMENT_64, "MAC_LC_SEGMENT_64"},
|
|
{MAC_LC_ROUTINES_64, "MAC_LC_ROUTINES_64"},
|
|
{MAC_LC_UUID, "MAC_LC_UUID"},
|
|
{MAC_LC_CODE_SIGNATURE, "MAC_LC_CODE_SIGNATURE"},
|
|
{MAC_LC_SEGMENT_SPLIT_INFO, "MAC_LC_SEGMENT_SPLIT_INFO"},
|
|
{MAC_LC_LAZY_LOAD_DYLIB, "MAC_LC_LAZY_LOAD_DYLIB"},
|
|
{MAC_LC_ENCRYPTION_INFO, "MAC_LC_ENCRYPTION_INFO"},
|
|
{MAC_LC_DYLD_INFO, "MAC_LC_DYLD_INFO"},
|
|
{MAC_LC_DYLD_INFO_ONLY, "MAC_LC_DYLD_INFO_ONLY"},
|
|
{MAC_LC_VERSION_MIN_MACOSX, "MAC_LC_VERSION_MIN_MACOSX"},
|
|
{MAC_LC_VERSION_MIN_IPHONEOS, "MAC_LC_VERSION_MIN_IPHONEOS"},
|
|
{MAC_LC_FUNCTION_STARTS, "MAC_LC_FUNCTION_STARTS"},
|
|
{MAC_LC_DYLD_ENVIRONMENT, "MAC_LC_DYLD_ENVIRONMENT"},
|
|
{MAC_LC_DATA_IN_CODE, "MAC_LC_DATA_IN_CODE"},
|
|
{MAC_LC_SOURCE_VERSION, "MAC_LC_SOURCE_VERSION"},
|
|
{MAC_LC_RPATH, "MAC_LC_RPATH"},
|
|
{MAC_LC_MAIN, "MAC_LC_MAIN"},
|
|
{MAC_LC_DYLIB_CODE_SIGN_DRS, "MAC_LC_DYLIB_CODE_SIGN_DRS"},
|
|
{MAC_LC_ENCRYPTION_INFO_64, "MAC_LC_ENCRYPTION_INFO_64"},
|
|
{MAC_LC_LINKER_OPTION, "MAC_LC_LINKER_OPTION"},
|
|
{MAC_LC_LINKER_OPTIMIZATION_HINT, "MAC_LC_LINKER_OPTIMIZATION_HINT"},
|
|
{MAC_LC_VERSION_MIN_TVOS, "MAC_LC_VERSION_MIN_TVOS"},
|
|
{MAC_LC_VERSION_MIN_WATCHOS, "MAC_LC_VERSION_MIN_WATCHOS"},
|
|
{MAC_LC_NOTE, "MAC_LC_NOTE"},
|
|
{MAC_LC_BUILD_VERSION, "MAC_LC_BUILD_VERSION"},
|
|
{MAC_LC_DYLD_EXPORTS_TRIE, "MAC_LC_DYLD_EXPORTS_TRIE"},
|
|
{MAC_LC_DYLD_CHAINED_FIXUPS, "MAC_LC_DYLD_CHAINED_FIXUPS"},
|
|
{MAC_LC_FILESET_ENTRY, "MAC_LC_FILESET_ENTRY"},
|
|
{MAC_LC_REEXPORT_DYLIB, "MAC_LC_REEXPORT_DYLIB"},
|
|
{0, 0},
|
|
};
|
|
|
|
const struct IdName kMachoVmProtNames[] = {
|
|
{VM_PROT_READ, "VM_PROT_READ"},
|
|
{VM_PROT_WRITE, "VM_PROT_WRITE"},
|
|
{VM_PROT_EXECUTE, "VM_PROT_EXECUTE"},
|
|
{VM_PROT_NO_CHANGE, "VM_PROT_NO_CHANGE"},
|
|
{VM_PROT_COPY, "VM_PROT_COPY"},
|
|
{VM_PROT_TRUSTED, "VM_PROT_TRUSTED"},
|
|
{VM_PROT_STRIP_READ, "VM_PROT_STRIP_READ"},
|
|
{0, 0},
|
|
};
|