From d768f160a99558a07a2463899c8bfeec0f0a67a7 Mon Sep 17 00:00:00 2001 From: Saagar Jha Date: Mon, 22 Jun 2020 14:29:20 +0100 Subject: [PATCH] Recognize some new Mach-O load commands bfd * mach-o.c: Support the new load commands by reading a linkedit data command for them. binutils * od-macho.c: Dump linkedit data for new load commands. include * mach-o/loader.h: Add declarations of two new Mach-O load commands. --- bfd/ChangeLog | 5 +++++ bfd/mach-o.c | 2 ++ binutils/ChangeLog | 4 ++++ binutils/od-macho.c | 4 ++++ include/ChangeLog | 5 +++++ include/mach-o/loader.h | 2 ++ 6 files changed, 22 insertions(+) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 6ac3c0fb67..f149677913 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +2020-06-22 Saagar Jha + + * mach-o.c: Support the new load commands by reading a linkedit + data command for them. + 2020-06-22 Nelson Chu * elfxx-riscv.c (struct priv_spec_t priv_specs[]): Move them from diff --git a/bfd/mach-o.c b/bfd/mach-o.c index 43fa56cb58..f285305cd0 100644 --- a/bfd/mach-o.c +++ b/bfd/mach-o.c @@ -5017,6 +5017,8 @@ bfd_mach_o_read_command (bfd *abfd, bfd_mach_o_load_command *command, case BFD_MACH_O_LC_DATA_IN_CODE: case BFD_MACH_O_LC_DYLIB_CODE_SIGN_DRS: case BFD_MACH_O_LC_LINKER_OPTIMIZATION_HINT: + case BFD_MACH_O_LC_DYLD_EXPORTS_TRIE: + case BFD_MACH_O_LC_DYLD_CHAINED_FIXUPS: if (!bfd_mach_o_read_linkedit (abfd, command)) return FALSE; break; diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 0cac3f4f95..700c1ea939 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,7 @@ +2020-06-22 Saagar Jha + + * od-macho.c: Dump linkedit data for new load commands. + 2020-06-19 Alan Modra * testsuite/config/default.exp (ld_elf_shared_opt): Don't set. diff --git a/binutils/od-macho.c b/binutils/od-macho.c index f9d4b3729f..938426806c 100644 --- a/binutils/od-macho.c +++ b/binutils/od-macho.c @@ -214,6 +214,8 @@ static const bfd_mach_o_xlat_name bfd_mach_o_load_command_name[] = { "version_min_watchos", BFD_MACH_O_LC_VERSION_MIN_WATCHOS}, { "note", BFD_MACH_O_LC_NOTE}, { "build_version", BFD_MACH_O_LC_BUILD_VERSION}, + { "exports_trie", BFD_MACH_O_LC_DYLD_EXPORTS_TRIE}, + { "chained_fixups", BFD_MACH_O_LC_DYLD_CHAINED_FIXUPS}, { NULL, 0} }; @@ -1610,6 +1612,8 @@ dump_load_command (bfd *abfd, bfd_mach_o_load_command *cmd, case BFD_MACH_O_LC_FUNCTION_STARTS: case BFD_MACH_O_LC_DATA_IN_CODE: case BFD_MACH_O_LC_DYLIB_CODE_SIGN_DRS: + case BFD_MACH_O_LC_DYLD_EXPORTS_TRIE: + case BFD_MACH_O_LC_DYLD_CHAINED_FIXUPS: { bfd_mach_o_linkedit_command *linkedit = &cmd->command.linkedit; printf diff --git a/include/ChangeLog b/include/ChangeLog index 65e8af867f..12467f86ab 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,3 +1,8 @@ +2020-06-22 Saagar Jha + + * mach-o/loader.h: Add declarations of two new Mach-O load + commands. + 2020-06-22 Nelson Chu * opcode/riscv.h (riscv_get_priv_spec_class): Move the function diff --git a/include/mach-o/loader.h b/include/mach-o/loader.h index a34a89421f..47d4608ba9 100644 --- a/include/mach-o/loader.h +++ b/include/mach-o/loader.h @@ -189,6 +189,8 @@ typedef enum bfd_mach_o_load_command_type 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_LC_DYLD_EXPORTS_TRIE = 0x33, /* Exports trie. */ + BFD_MACH_O_LC_DYLD_CHAINED_FIXUPS = 0x34, /* Chained fixups. */ } bfd_mach_o_load_command_type;