aboutsummaryrefslogtreecommitdiff
path: root/include/mach-o
diff options
context:
space:
mode:
authorRoman Bolshakov <r.bolshakov@yadro.com>2018-11-07 15:20:22 +0000
committerNick Clifton <nickc@redhat.com>2018-11-07 15:20:22 +0000
commitfc7b364aba41819a5d74ae0ac69f050af282d057 (patch)
tree3822fd2dce022a7971badc51cf07800dc103786c /include/mach-o
parent35ee2dc2e4de8b1ae73f420d5db3375f92300b70 (diff)
downloadgdb-fc7b364aba41819a5d74ae0ac69f050af282d057.zip
gdb-fc7b364aba41819a5d74ae0ac69f050af282d057.tar.gz
gdb-fc7b364aba41819a5d74ae0ac69f050af282d057.tar.bz2
Add support for new load commands added by Apple to the MACH-O file format.
bfd * mach-o.h: Add new enums for BFD_MACH_O_PLATFORM_MACOS, BFD_MACH_O_PLATFORM_IOS, BFD_MACH_O_PLATFORM_TVOS, BFD_MACH_O_PLATFORM_WATCHOS, BFD_MACH_O_PLATFORM_BRIDGEOS, BFD_MACH_O_TOOL_CLANG, BFD_MACH_O_TOOL_SWIFT, BFD_MACH_O_TOOL_LD. (struct bfd_mach_o_note_command): New. (struct bfd_mach_o_build_version_tool): New. (struct bfd_mach_o_build_version_command): New. (bfd_mach_o_read_version_min): Don't split version into a few fields. Rename reserved to sdk. * mach-o.c (bfd_mach_o_read_version_min): Don't split version into a few fields. Rename reserved to sdk. (bfd_mach_o_read_command): Handle LC_VERSION_MIN_TVOS, LC_NOTE, LC_BUILD_VERSION. (bfd_mach_o_read_note): New. (bfd_mach_o_read_build_version): New. PR 23728 binutils* od-macho.c (printf_version): New. (dump_load_command): Use it to print version. Print sdk version. Print version info for watchOS and tvOS. Print LC_NOTE, LC_BUILD_VERSION. (dump_buld_version): New. (bfd_mach_o_platform_name): New (bfd_mach_o_tool_name): New * mach-o/external.h (mach_o_nversion_min_command_external): Rename reserved to sdk. (mach_o_note_command_external): New. (mach_o_build_version_command_external): New. * mach-o/loader.h (BFD_MACH_O_LC_VERSION_MIN_TVOS): Define. (BFD_MACH_O_LC_NOTE): Define.
Diffstat (limited to 'include/mach-o')
-rw-r--r--include/mach-o/external.h19
-rw-r--r--include/mach-o/loader.h54
2 files changed, 45 insertions, 28 deletions
diff --git a/include/mach-o/external.h b/include/mach-o/external.h
index 2609bad9..bf3c0c8 100644
--- a/include/mach-o/external.h
+++ b/include/mach-o/external.h
@@ -308,7 +308,7 @@ struct mach_o_twolevel_hints_command_external
struct mach_o_version_min_command_external
{
unsigned char version[4];
- unsigned char reserved[4];
+ unsigned char sdk[4];
};
struct mach_o_encryption_info_command_external
@@ -345,12 +345,27 @@ struct mach_o_source_version_command_external
and 24 bits for A. */
};
+struct mach_o_note_command_external
+{
+ unsigned char data_owner[16]; /* Owner name for this note. */
+ unsigned char offset[8]; /* File offset of the note. */
+ unsigned char size[8]; /* Length of the note. */
+};
+
+struct mach_o_build_version_command_external
+{
+ unsigned char platform[4]; /* Target platform. */
+ unsigned char minos[4]; /* X.Y.Z is encoded in nibbles xxxx.yy.zz. */
+ unsigned char sdk[4]; /* X.Y.Z is encoded in nibbles xxxx.yy.zz. */
+ unsigned char ntools[4]; /* Number of tool entries following this. */
+};
+
/* The LD_DATA_IN_CODE command use a linkedit_data_command that points to
a table of entries. */
struct mach_o_data_in_code_entry_external
{
- unsigned char offset[4]; /* Offset from the mach_header. */
+ unsigned char offset[4]; /* Offset from the mach_header. */
unsigned char length[2]; /* Number of bytes. */
unsigned char kind[2]; /* Kind. See BFD_MACH_O_DICE_ values. */
};
diff --git a/include/mach-o/loader.h b/include/mach-o/loader.h
index 9abc51c..7b0a806 100644
--- a/include/mach-o/loader.h
+++ b/include/mach-o/loader.h
@@ -161,32 +161,34 @@ typedef enum bfd_mach_o_load_command_type
/* Load a dynamically linked shared library that is allowed to be
missing (weak). */
BFD_MACH_O_LC_LOAD_WEAK_DYLIB = 0x18,
- BFD_MACH_O_LC_SEGMENT_64 = 0x19, /* 64-bit segment of this file to be
- mapped. */
- BFD_MACH_O_LC_ROUTINES_64 = 0x1a, /* Address of the dyld init routine
- in a dylib. */
- BFD_MACH_O_LC_UUID = 0x1b, /* 128-bit UUID of the executable. */
- BFD_MACH_O_LC_RPATH = 0x1c, /* Run path addiions. */
- BFD_MACH_O_LC_CODE_SIGNATURE = 0x1d, /* Local of code signature. */
- BFD_MACH_O_LC_SEGMENT_SPLIT_INFO = 0x1e, /* Local of info to split seg. */
- BFD_MACH_O_LC_REEXPORT_DYLIB = 0x1f, /* Load and re-export lib. */
- BFD_MACH_O_LC_LAZY_LOAD_DYLIB = 0x20, /* Delay load of lib until use. */
- BFD_MACH_O_LC_ENCRYPTION_INFO = 0x21, /* Encrypted segment info. */
- BFD_MACH_O_LC_DYLD_INFO = 0x22, /* Compressed dyld information. */
- BFD_MACH_O_LC_LOAD_UPWARD_DYLIB = 0x23, /* Load upward dylib. */
- BFD_MACH_O_LC_VERSION_MIN_MACOSX = 0x24, /* Minimal MacOSX version. */
- BFD_MACH_O_LC_VERSION_MIN_IPHONEOS = 0x25, /* Minimal IOS version. */
- BFD_MACH_O_LC_FUNCTION_STARTS = 0x26, /* Compressed table of func start. */
- BFD_MACH_O_LC_DYLD_ENVIRONMENT = 0x27, /* Env variable string for dyld. */
- BFD_MACH_O_LC_MAIN = 0x28, /* Entry point. */
- BFD_MACH_O_LC_DATA_IN_CODE = 0x29, /* Table of non-instructions. */
- BFD_MACH_O_LC_SOURCE_VERSION = 0x2a, /* Source version. */
- BFD_MACH_O_LC_DYLIB_CODE_SIGN_DRS = 0x2b, /* DRs from dylibs. */
- BFD_MACH_O_LC_ENCRYPTION_INFO_64 = 0x2c, /* Encrypted 64 bit seg info. */
- BFD_MACH_O_LC_LINKER_OPTIONS = 0x2d, /* Linker options. */
- BFD_MACH_O_LC_LINKER_OPTIMIZATION_HINT = 0x2e, /* Optimization hints. */
- BFD_MACH_O_LC_VERSION_MIN_WATCHOS = 0x30, /* Minimal WatchOS version. */
- BFD_MACH_O_LC_BUILD_VERSION = 0x32 /* Records linker, SDK, OS, and tools version used. */
+ BFD_MACH_O_LC_SEGMENT_64 = 0x19, /* 64-bit segment of this file to be
+ mapped. */
+ BFD_MACH_O_LC_ROUTINES_64 = 0x1a, /* Address of the dyld init routine
+ in a dylib. */
+ BFD_MACH_O_LC_UUID = 0x1b, /* 128-bit UUID of the executable. */
+ BFD_MACH_O_LC_RPATH = 0x1c, /* Run path addiions. */
+ BFD_MACH_O_LC_CODE_SIGNATURE = 0x1d, /* Local of code signature. */
+ BFD_MACH_O_LC_SEGMENT_SPLIT_INFO = 0x1e, /* Local of info to split seg. */
+ BFD_MACH_O_LC_REEXPORT_DYLIB = 0x1f, /* Load and re-export lib. */
+ BFD_MACH_O_LC_LAZY_LOAD_DYLIB = 0x20, /* Delay load of lib until use. */
+ BFD_MACH_O_LC_ENCRYPTION_INFO = 0x21, /* Encrypted segment info. */
+ BFD_MACH_O_LC_DYLD_INFO = 0x22, /* Compressed dyld information. */
+ BFD_MACH_O_LC_LOAD_UPWARD_DYLIB = 0x23, /* Load upward dylib. */
+ BFD_MACH_O_LC_VERSION_MIN_MACOSX = 0x24, /* Minimal MacOSX version. */
+ BFD_MACH_O_LC_VERSION_MIN_IPHONEOS = 0x25, /* Minimal IOS version. */
+ BFD_MACH_O_LC_FUNCTION_STARTS = 0x26, /* Compressed table of func start. */
+ BFD_MACH_O_LC_DYLD_ENVIRONMENT = 0x27, /* Env variable string for dyld. */
+ BFD_MACH_O_LC_MAIN = 0x28, /* Entry point. */
+ BFD_MACH_O_LC_DATA_IN_CODE = 0x29, /* Table of non-instructions. */
+ BFD_MACH_O_LC_SOURCE_VERSION = 0x2a, /* Source version. */
+ BFD_MACH_O_LC_DYLIB_CODE_SIGN_DRS = 0x2b, /* DRs from dylibs. */
+ BFD_MACH_O_LC_ENCRYPTION_INFO_64 = 0x2c, /* Encrypted 64 bit seg info. */
+ BFD_MACH_O_LC_LINKER_OPTIONS = 0x2d, /* Linker options. */
+ BFD_MACH_O_LC_LINKER_OPTIMIZATION_HINT = 0x2e,/* Optimization hints. */
+ BFD_MACH_O_LC_VERSION_MIN_TVOS = 0x2f, /* Minimal tvOS version. */
+ BFD_MACH_O_LC_VERSION_MIN_WATCHOS = 0x30, /* Minimal WatchOS version. */
+ BFD_MACH_O_LC_NOTE = 0x31, /* Region of arbitrary data. */
+ BFD_MACH_O_LC_BUILD_VERSION = 0x32, /* Generic build version. */
}
bfd_mach_o_load_command_type;