Skip to content

Commit

Permalink
[MachO] Adding struct field to MachO.def
Browse files Browse the repository at this point in the history
This provides a mapping from load command names to the data structures.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269498 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
Chris Bieneman committed May 13, 2016
1 parent d8c064b commit 10b6767
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 54 deletions.
4 changes: 2 additions & 2 deletions include/llvm/ObjectYAML/MachOYAML.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ template <> struct MappingTraits<std::unique_ptr<MachOYAML::LoadCommand>> {
std::unique_ptr<MachOYAML::LoadCommand> &LoadCommand);
};

#define HANDLE_LOAD_COMMAND(LoadCommandName, LoadCommandValue) \
io.enumCase(value, #LoadCommandName, MachO::LoadCommandName);
#define HANDLE_LOAD_COMMAND(LCName, LCValue, LCStruct) \
io.enumCase(value, #LCName, MachO::LCName);

template <> struct ScalarEnumerationTraits<MachO::LoadCommandType> {
static void enumeration(IO &io, MachO::LoadCommandType &value) {
Expand Down
101 changes: 51 additions & 50 deletions include/llvm/Support/MachO.def
Original file line number Diff line number Diff line change
Expand Up @@ -12,55 +12,56 @@
//,,,----------------------------------------------------------------------,,,//

#ifndef HANDLE_LOAD_COMMAND
#define HANDLE_LOAD_COMMAND(LoadCommandName, LoadCommandValue)
#define HANDLE_LOAD_COMMAND(LCName, LCValue, LCStruct)
#endif

HANDLE_LOAD_COMMAND(LC_SEGMENT , 0x00000001u)
HANDLE_LOAD_COMMAND(LC_SYMTAB , 0x00000002u)
HANDLE_LOAD_COMMAND(LC_SYMSEG , 0x00000003u)
HANDLE_LOAD_COMMAND(LC_THREAD , 0x00000004u)
HANDLE_LOAD_COMMAND(LC_UNIXTHREAD , 0x00000005u)
HANDLE_LOAD_COMMAND(LC_LOADFVMLIB , 0x00000006u)
HANDLE_LOAD_COMMAND(LC_IDFVMLIB , 0x00000007u)
HANDLE_LOAD_COMMAND(LC_IDENT , 0x00000008u)
HANDLE_LOAD_COMMAND(LC_FVMFILE , 0x00000009u)
HANDLE_LOAD_COMMAND(LC_PREPAGE , 0x0000000Au)
HANDLE_LOAD_COMMAND(LC_DYSYMTAB , 0x0000000Bu)
HANDLE_LOAD_COMMAND(LC_LOAD_DYLIB , 0x0000000Cu)
HANDLE_LOAD_COMMAND(LC_ID_DYLIB , 0x0000000Du)
HANDLE_LOAD_COMMAND(LC_LOAD_DYLINKER , 0x0000000Eu)
HANDLE_LOAD_COMMAND(LC_ID_DYLINKER , 0x0000000Fu)
HANDLE_LOAD_COMMAND(LC_PREBOUND_DYLIB , 0x00000010u)
HANDLE_LOAD_COMMAND(LC_ROUTINES , 0x00000011u)
HANDLE_LOAD_COMMAND(LC_SUB_FRAMEWORK , 0x00000012u)
HANDLE_LOAD_COMMAND(LC_SUB_UMBRELLA , 0x00000013u)
HANDLE_LOAD_COMMAND(LC_SUB_CLIENT , 0x00000014u)
HANDLE_LOAD_COMMAND(LC_SUB_LIBRARY , 0x00000015u)
HANDLE_LOAD_COMMAND(LC_TWOLEVEL_HINTS , 0x00000016u)
HANDLE_LOAD_COMMAND(LC_PREBIND_CKSUM , 0x00000017u)
HANDLE_LOAD_COMMAND(LC_LOAD_WEAK_DYLIB , 0x80000018u)
HANDLE_LOAD_COMMAND(LC_SEGMENT_64 , 0x00000019u)
HANDLE_LOAD_COMMAND(LC_ROUTINES_64 , 0x0000001Au)
HANDLE_LOAD_COMMAND(LC_UUID , 0x0000001Bu)
HANDLE_LOAD_COMMAND(LC_RPATH , 0x8000001Cu)
HANDLE_LOAD_COMMAND(LC_CODE_SIGNATURE , 0x0000001Du)
HANDLE_LOAD_COMMAND(LC_SEGMENT_SPLIT_INFO , 0x0000001Eu)
HANDLE_LOAD_COMMAND(LC_REEXPORT_DYLIB , 0x8000001Fu)
HANDLE_LOAD_COMMAND(LC_LAZY_LOAD_DYLIB , 0x00000020u)
HANDLE_LOAD_COMMAND(LC_ENCRYPTION_INFO , 0x00000021u)
HANDLE_LOAD_COMMAND(LC_DYLD_INFO , 0x00000022u)
HANDLE_LOAD_COMMAND(LC_DYLD_INFO_ONLY , 0x80000022u)
HANDLE_LOAD_COMMAND(LC_LOAD_UPWARD_DYLIB , 0x80000023u)
HANDLE_LOAD_COMMAND(LC_VERSION_MIN_MACOSX , 0x00000024u)
HANDLE_LOAD_COMMAND(LC_VERSION_MIN_IPHONEOS , 0x00000025u)
HANDLE_LOAD_COMMAND(LC_FUNCTION_STARTS , 0x00000026u)
HANDLE_LOAD_COMMAND(LC_DYLD_ENVIRONMENT , 0x00000027u)
HANDLE_LOAD_COMMAND(LC_MAIN , 0x80000028u)
HANDLE_LOAD_COMMAND(LC_DATA_IN_CODE , 0x00000029u)
HANDLE_LOAD_COMMAND(LC_SOURCE_VERSION , 0x0000002Au)
HANDLE_LOAD_COMMAND(LC_DYLIB_CODE_SIGN_DRS , 0x0000002Bu)
HANDLE_LOAD_COMMAND(LC_ENCRYPTION_INFO_64 , 0x0000002Cu)
HANDLE_LOAD_COMMAND(LC_LINKER_OPTION , 0x0000002Du)
HANDLE_LOAD_COMMAND(LC_LINKER_OPTIMIZATION_HINT , 0x0000002Eu)
HANDLE_LOAD_COMMAND(LC_VERSION_MIN_TVOS , 0x0000002Fu)
HANDLE_LOAD_COMMAND(LC_VERSION_MIN_WATCHOS , 0x00000030u)
HANDLE_LOAD_COMMAND(LC_SEGMENT, 0x00000001u, segment_command)
HANDLE_LOAD_COMMAND(LC_SYMTAB, 0x00000002u, symtab_command)
HANDLE_LOAD_COMMAND(LC_SYMSEG, 0x00000003u, symseg_command)
HANDLE_LOAD_COMMAND(LC_THREAD, 0x00000004u, thread_command)
HANDLE_LOAD_COMMAND(LC_UNIXTHREAD, 0x00000005u, thread_command)
HANDLE_LOAD_COMMAND(LC_LOADFVMLIB, 0x00000006u, load_command)
HANDLE_LOAD_COMMAND(LC_IDFVMLIB, 0x00000007u, load_command)
HANDLE_LOAD_COMMAND(LC_IDENT, 0x00000008u, load_command)
HANDLE_LOAD_COMMAND(LC_FVMFILE, 0x00000009u, fvmfile_command)
HANDLE_LOAD_COMMAND(LC_PREPAGE, 0x0000000Au, load_command)
HANDLE_LOAD_COMMAND(LC_DYSYMTAB, 0x0000000Bu, dysymtab_command)
HANDLE_LOAD_COMMAND(LC_LOAD_DYLIB, 0x0000000Cu, dylib_command)
HANDLE_LOAD_COMMAND(LC_ID_DYLIB, 0x0000000Du, load_command)
HANDLE_LOAD_COMMAND(LC_LOAD_DYLINKER, 0x0000000Eu, load_command)
HANDLE_LOAD_COMMAND(LC_ID_DYLINKER, 0x0000000Fu, dylinker_command)
HANDLE_LOAD_COMMAND(LC_PREBOUND_DYLIB, 0x00000010u, prebound_dylib_command)
HANDLE_LOAD_COMMAND(LC_ROUTINES, 0x00000011u, routines_command)
HANDLE_LOAD_COMMAND(LC_SUB_FRAMEWORK, 0x00000012u, load_command)
HANDLE_LOAD_COMMAND(LC_SUB_UMBRELLA, 0x00000013u, sub_umbrella_command)
HANDLE_LOAD_COMMAND(LC_SUB_CLIENT, 0x00000014u, sub_client_command)
HANDLE_LOAD_COMMAND(LC_SUB_LIBRARY, 0x00000015u, sub_library_command)
HANDLE_LOAD_COMMAND(LC_TWOLEVEL_HINTS, 0x00000016u, twolevel_hints_command)
HANDLE_LOAD_COMMAND(LC_PREBIND_CKSUM, 0x00000017u, prebind_cksum_command)
HANDLE_LOAD_COMMAND(LC_LOAD_WEAK_DYLIB, 0x80000018u, dylib_command)
HANDLE_LOAD_COMMAND(LC_SEGMENT_64, 0x00000019u, segment_command_64)
HANDLE_LOAD_COMMAND(LC_ROUTINES_64, 0x0000001Au, routines_command_64)
HANDLE_LOAD_COMMAND(LC_UUID, 0x0000001Bu, uuid_command)
HANDLE_LOAD_COMMAND(LC_RPATH, 0x8000001Cu, rpath_command)
HANDLE_LOAD_COMMAND(LC_CODE_SIGNATURE, 0x0000001Du, load_command)
HANDLE_LOAD_COMMAND(LC_SEGMENT_SPLIT_INFO, 0x0000001Eu, load_command)
HANDLE_LOAD_COMMAND(LC_REEXPORT_DYLIB, 0x8000001Fu, dylib_command)
HANDLE_LOAD_COMMAND(LC_LAZY_LOAD_DYLIB, 0x00000020u, dylib_command)
HANDLE_LOAD_COMMAND(LC_ENCRYPTION_INFO, 0x00000021u, encryption_info_command)
HANDLE_LOAD_COMMAND(LC_DYLD_INFO, 0x00000022u, dyld_info_command)
HANDLE_LOAD_COMMAND(LC_DYLD_INFO_ONLY, 0x80000022u, dyld_info_command)
HANDLE_LOAD_COMMAND(LC_LOAD_UPWARD_DYLIB, 0x80000023u, dylib_command)
HANDLE_LOAD_COMMAND(LC_VERSION_MIN_MACOSX, 0x00000024u, version_min_command)
HANDLE_LOAD_COMMAND(LC_VERSION_MIN_IPHONEOS, 0x00000025u, version_min_command)
HANDLE_LOAD_COMMAND(LC_FUNCTION_STARTS, 0x00000026u, load_command)
HANDLE_LOAD_COMMAND(LC_DYLD_ENVIRONMENT, 0x00000027u, load_command)
HANDLE_LOAD_COMMAND(LC_MAIN, 0x80000028u, entry_point_command)
HANDLE_LOAD_COMMAND(LC_DATA_IN_CODE, 0x00000029u, linkedit_data_command)
HANDLE_LOAD_COMMAND(LC_SOURCE_VERSION, 0x0000002Au, source_version_command)
HANDLE_LOAD_COMMAND(LC_DYLIB_CODE_SIGN_DRS, 0x0000002Bu, load_command)
HANDLE_LOAD_COMMAND(LC_ENCRYPTION_INFO_64, 0x0000002Cu,
encryption_info_command_64)
HANDLE_LOAD_COMMAND(LC_LINKER_OPTION, 0x0000002Du, linker_option_command)
HANDLE_LOAD_COMMAND(LC_LINKER_OPTIMIZATION_HINT, 0x0000002Eu, load_command)
HANDLE_LOAD_COMMAND(LC_VERSION_MIN_TVOS, 0x0000002Fu, version_min_command)
HANDLE_LOAD_COMMAND(LC_VERSION_MIN_WATCHOS, 0x00000030u, version_min_command)
4 changes: 2 additions & 2 deletions include/llvm/Support/MachO.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ namespace llvm {
LC_REQ_DYLD = 0x80000000u
};

#define HANDLE_LOAD_COMMAND(LoadCommandName, LoadCommandValue) \
LoadCommandName = LoadCommandValue,
#define HANDLE_LOAD_COMMAND(LCName, LCValue, LCStruct) \
LCName = LCValue,

enum LoadCommandType : uint32_t {
#include "llvm/Support/MachO.def"
Expand Down

0 comments on commit 10b6767

Please sign in to comment.