aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorTristan Gingold <tristan.gingold@adacore.com>2014-04-11 17:10:03 +0200
committerTristan Gingold <tristan.gingold@adacore.com>2014-04-16 12:16:02 +0200
commite89d3dee76bc7f2d4b967ce9238f7f22e0a7c147 (patch)
treefdb78bc6642e48e00204372780b6222b758c9a9a /include
parent47f8a1070c0619bf7698e6584f7196f06e529da0 (diff)
downloadgdb-e89d3dee76bc7f2d4b967ce9238f7f22e0a7c147.zip
gdb-e89d3dee76bc7f2d4b967ce9238f7f22e0a7c147.tar.gz
gdb-e89d3dee76bc7f2d4b967ce9238f7f22e0a7c147.tar.bz2
Mach-O: Add objdump -P dyld_info to dump dyld data.
include/mach-o/ * loader.h: Add macros for rebase, bind and export constants. binutils/ * od-macho.c (OPT_DYLD_INFO): New macro. (options): Add entry for dyld_info. (mach_o_help): Likewise. (load_and_dump, dump_dyld_info_rebase, dump_dyld_info_bind) (dump_dyld_info_export_1, dump_dyld_info_export): New functions. (bfd_mach_o_dyld_rebase_type_name): New array. (export_info_data): New struct. (dump_dyld_info): Add verbose argument. Dump rebase, bind and exports data. (dump_load_command): Adjust dump_dyld_info call. (mach_o_dump): Handle dyld_info.
Diffstat (limited to 'include')
-rw-r--r--include/mach-o/ChangeLog4
-rw-r--r--include/mach-o/loader.h57
2 files changed, 61 insertions, 0 deletions
diff --git a/include/mach-o/ChangeLog b/include/mach-o/ChangeLog
index 0f2721a..7adbc49 100644
--- a/include/mach-o/ChangeLog
+++ b/include/mach-o/ChangeLog
@@ -1,5 +1,9 @@
2014-04-16 Tristan Gingold <gingold@adacore.com>
+ * loader.h: Add macros for rebase, bind and export constants.
+
+2014-04-16 Tristan Gingold <gingold@adacore.com>
+
* loader.h (BFD_MACH_O_CPU_ARCH_MASK, BFD_MACH_O_CPU_ARCH_ABI64)
(BFD_MACH_O_CPU_SUBTYPE_MASK, BFD_MACH_O_CPU_SUBTYPE_LIB64): Define.
diff --git a/include/mach-o/loader.h b/include/mach-o/loader.h
index 20cfe42..ff794a3 100644
--- a/include/mach-o/loader.h
+++ b/include/mach-o/loader.h
@@ -342,6 +342,63 @@ bfd_mach_o_section_attribute;
#define BFD_MACH_O_INDIRECT_SYM_LOCAL 0x80000000
#define BFD_MACH_O_INDIRECT_SYM_ABS 0x40000000
+/* Constants for dyld info rebase. */
+#define BFD_MACH_O_REBASE_OPCODE_MASK 0xf0
+#define BFD_MACH_O_REBASE_IMMEDIATE_MASK 0x0f
+
+/* The rebase opcodes. */
+#define BFD_MACH_O_REBASE_OPCODE_DONE 0x00
+#define BFD_MACH_O_REBASE_OPCODE_SET_TYPE_IMM 0x10
+#define BFD_MACH_O_REBASE_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB 0x20
+#define BFD_MACH_O_REBASE_OPCODE_ADD_ADDR_ULEB 0x30
+#define BFD_MACH_O_REBASE_OPCODE_ADD_ADDR_IMM_SCALED 0x40
+#define BFD_MACH_O_REBASE_OPCODE_DO_REBASE_IMM_TIMES 0x50
+#define BFD_MACH_O_REBASE_OPCODE_DO_REBASE_ULEB_TIMES 0x60
+#define BFD_MACH_O_REBASE_OPCODE_DO_REBASE_ADD_ADDR_ULEB 0x70
+#define BFD_MACH_O_REBASE_OPCODE_DO_REBASE_ULEB_TIMES_SKIPPING_ULEB 0x80
+
+/* The rebase type. */
+#define BFD_MACH_O_REBASE_TYPE_POINTER 1
+#define BFD_MACH_O_REBASE_TYPE_TEXT_ABSOLUTE32 2
+#define BFD_MACH_O_REBASE_TYPE_TEXT_PCREL32 3
+
+/* Constants for dyld info bind. */
+#define BFD_MACH_O_BIND_OPCODE_MASK 0xf0
+#define BFD_MACH_O_BIND_IMMEDIATE_MASK 0x0f
+
+/* The bind opcodes. */
+#define BFD_MACH_O_BIND_OPCODE_DONE 0x00
+#define BFD_MACH_O_BIND_OPCODE_SET_DYLIB_ORDINAL_IMM 0x10
+#define BFD_MACH_O_BIND_OPCODE_SET_DYLIB_ORDINAL_ULEB 0x20
+#define BFD_MACH_O_BIND_OPCODE_SET_DYLIB_SPECIAL_IMM 0x30
+#define BFD_MACH_O_BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM 0x40
+#define BFD_MACH_O_BIND_OPCODE_SET_TYPE_IMM 0x50
+#define BFD_MACH_O_BIND_OPCODE_SET_ADDEND_SLEB 0x60
+#define BFD_MACH_O_BIND_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB 0x70
+#define BFD_MACH_O_BIND_OPCODE_ADD_ADDR_ULEB 0x80
+#define BFD_MACH_O_BIND_OPCODE_DO_BIND 0x90
+#define BFD_MACH_O_BIND_OPCODE_DO_BIND_ADD_ADDR_ULEB 0xa0
+#define BFD_MACH_O_BIND_OPCODE_DO_BIND_ADD_ADDR_IMM_SCALED 0xb0
+#define BFD_MACH_O_BIND_OPCODE_DO_BIND_ULEB_TIMES_SKIPPING_ULEB 0xc0
+
+/* The bind types. */
+#define BFD_MACH_O_BIND_TYPE_POINTER 1
+#define BFD_MACH_O_BIND_TYPE_TEXT_ABSOLUTE32 2
+#define BFD_MACH_O_BIND_TYPE_TEXT_PCREL32 3
+
+/* The special dylib. */
+#define BFD_MACH_O_BIND_SPECIAL_DYLIB_SELF 0
+#define BFD_MACH_O_BIND_SPECIAL_DYLIB_MAIN_EXECUTABLE -1
+#define BFD_MACH_O_BIND_SPECIAL_DYLIB_FLAT_LOOKUP -2
+
+/* Constants for dyld info export. */
+#define BFD_MACH_O_EXPORT_SYMBOL_FLAGS_KIND_MASK 0x03
+#define BFD_MACH_O_EXPORT_SYMBOL_FLAGS_KIND_REGULAR 0x00
+#define BFD_MACH_O_EXPORT_SYMBOL_FLAGS_KIND_THREAD_LOCAL 0x01
+#define BFD_MACH_O_EXPORT_SYMBOL_FLAGS_WEAK_DEFINITION 0x04
+#define BFD_MACH_O_EXPORT_SYMBOL_FLAGS_REEXPORT 0x08
+#define BFD_MACH_O_EXPORT_SYMBOL_FLAGS_STUB_AND_RESOLVER 0x10
+
/* Constants for DATA_IN_CODE entries. */
typedef enum bfd_mach_o_data_in_code_entry_kind
{