[llvm] r269380 - [MachO] Extract MachO load command enums into a def file
Chris Bieneman via llvm-commits
llvm-commits at lists.llvm.org
Thu May 12 16:18:31 PDT 2016
Author: cbieneman
Date: Thu May 12 18:18:31 2016
New Revision: 269380
URL: http://llvm.org/viewvc/llvm-project?rev=269380&view=rev
Log:
[MachO] Extract MachO load command enums into a def file
Having the MachO enums in a def file instead of inline will allow us to write utilities and encoding/decoding methods for load commands without having to write a lot of mechanically repeated code.
Added:
llvm/trunk/include/llvm/Support/MachO.def
Modified:
llvm/trunk/include/llvm/Support/MachO.h
Added: llvm/trunk/include/llvm/Support/MachO.def
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/MachO.def?rev=269380&view=auto
==============================================================================
--- llvm/trunk/include/llvm/Support/MachO.def (added)
+++ llvm/trunk/include/llvm/Support/MachO.def Thu May 12 18:18:31 2016
@@ -0,0 +1,66 @@
+//,,,-- llvm/Support/MachO.def - The MachO file definitions -----*- C++ -*-,,,//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//,,,----------------------------------------------------------------------,,,//
+//
+// Definitions for MachO files
+//
+//,,,----------------------------------------------------------------------,,,//
+
+#ifndef HANDLE_LOAD_COMMAND
+#define HANDLE_LOAD_COMMAND(LoadCommandName, LoadCommandValue)
+#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)
Modified: llvm/trunk/include/llvm/Support/MachO.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/MachO.h?rev=269380&r1=269379&r2=269380&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/MachO.h (original)
+++ llvm/trunk/include/llvm/Support/MachO.h Thu May 12 18:18:31 2016
@@ -84,59 +84,15 @@ namespace llvm {
LC_REQ_DYLD = 0x80000000u
};
+#define HANDLE_LOAD_COMMAND(LoadCommandName, LoadCommandValue) \
+ LoadCommandName = LoadCommandValue,
+
enum LoadCommandType : uint32_t {
- // Constants for the "cmd" field in llvm::MachO::load_command
- LC_SEGMENT = 0x00000001u,
- LC_SYMTAB = 0x00000002u,
- LC_SYMSEG = 0x00000003u,
- LC_THREAD = 0x00000004u,
- LC_UNIXTHREAD = 0x00000005u,
- LC_LOADFVMLIB = 0x00000006u,
- LC_IDFVMLIB = 0x00000007u,
- LC_IDENT = 0x00000008u,
- LC_FVMFILE = 0x00000009u,
- LC_PREPAGE = 0x0000000Au,
- LC_DYSYMTAB = 0x0000000Bu,
- LC_LOAD_DYLIB = 0x0000000Cu,
- LC_ID_DYLIB = 0x0000000Du,
- LC_LOAD_DYLINKER = 0x0000000Eu,
- LC_ID_DYLINKER = 0x0000000Fu,
- LC_PREBOUND_DYLIB = 0x00000010u,
- LC_ROUTINES = 0x00000011u,
- LC_SUB_FRAMEWORK = 0x00000012u,
- LC_SUB_UMBRELLA = 0x00000013u,
- LC_SUB_CLIENT = 0x00000014u,
- LC_SUB_LIBRARY = 0x00000015u,
- LC_TWOLEVEL_HINTS = 0x00000016u,
- LC_PREBIND_CKSUM = 0x00000017u,
- LC_LOAD_WEAK_DYLIB = 0x80000018u,
- LC_SEGMENT_64 = 0x00000019u,
- LC_ROUTINES_64 = 0x0000001Au,
- LC_UUID = 0x0000001Bu,
- LC_RPATH = 0x8000001Cu,
- LC_CODE_SIGNATURE = 0x0000001Du,
- LC_SEGMENT_SPLIT_INFO = 0x0000001Eu,
- LC_REEXPORT_DYLIB = 0x8000001Fu,
- LC_LAZY_LOAD_DYLIB = 0x00000020u,
- LC_ENCRYPTION_INFO = 0x00000021u,
- LC_DYLD_INFO = 0x00000022u,
- LC_DYLD_INFO_ONLY = 0x80000022u,
- LC_LOAD_UPWARD_DYLIB = 0x80000023u,
- LC_VERSION_MIN_MACOSX = 0x00000024u,
- LC_VERSION_MIN_IPHONEOS = 0x00000025u,
- LC_FUNCTION_STARTS = 0x00000026u,
- LC_DYLD_ENVIRONMENT = 0x00000027u,
- LC_MAIN = 0x80000028u,
- LC_DATA_IN_CODE = 0x00000029u,
- LC_SOURCE_VERSION = 0x0000002Au,
- LC_DYLIB_CODE_SIGN_DRS = 0x0000002Bu,
- LC_ENCRYPTION_INFO_64 = 0x0000002Cu,
- LC_LINKER_OPTION = 0x0000002Du,
- LC_LINKER_OPTIMIZATION_HINT = 0x0000002Eu,
- LC_VERSION_MIN_TVOS = 0x0000002Fu,
- LC_VERSION_MIN_WATCHOS = 0x00000030u,
+ #include "llvm/Support/MachO.def"
};
+#undef HANDLE_LOAD_COMMAND
+
enum : uint32_t {
// Constant bits for the "flags" field in llvm::MachO::segment_command
SG_HIGHVM = 0x1u,
More information about the llvm-commits
mailing list