aboutsummaryrefslogtreecommitdiff
path: root/bfd/mach-o.c
diff options
context:
space:
mode:
authorTristan Gingold <gingold@adacore.com>2012-01-04 09:58:55 +0000
committerTristan Gingold <gingold@adacore.com>2012-01-04 09:58:55 +0000
commitfc55a902573b7f73d8f138b843f31f5adbe7331e (patch)
tree0d5c58dbdf940acc418d5d52e79127ee1b100546 /bfd/mach-o.c
parent2ca7691a9b964e6f393fbcc37e83dd8f91e63ae2 (diff)
downloadgdb-fc55a902573b7f73d8f138b843f31f5adbe7331e.zip
gdb-fc55a902573b7f73d8f138b843f31f5adbe7331e.tar.gz
gdb-fc55a902573b7f73d8f138b843f31f5adbe7331e.tar.bz2
bfd/
2012-01-04 Tristan Gingold <gingold@adacore.com> * mach-o.h: Reindent header. (bfd_mach_o_encryption_info_command): New structure. (bfd_mach_o_load_command): Add encryption_info field. * mach-o.c (bfd_mach_o_read_encryption_info): New function. (bfd_mach_o_read_command): Handle BFD_MACH_O_LC_ENCRYPTION_INFO. (bfd_mach_o_read_command): Adjust error message. binutils/ 2012-01-04 Tristan Gingold <gingold@adacore.com> * od-macho.c: Update copyright year. (dump_load_command): Handle BFD_MACH_O_LC_ENCRYPTION_INFO. include/mach-o/ 2012-01-04 Tristan Gingold <gingold@adacore.com> * external.h: Update copyright year. (mach_o_symtab_command_external): Add comments. (mach_o_encryption_info_command_external): New structure.
Diffstat (limited to 'bfd/mach-o.c')
-rw-r--r--bfd/mach-o.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/bfd/mach-o.c b/bfd/mach-o.c
index 30b77d8..57c37d8 100644
--- a/bfd/mach-o.c
+++ b/bfd/mach-o.c
@@ -3411,6 +3411,22 @@ bfd_mach_o_read_version_min (bfd *abfd, bfd_mach_o_load_command *command)
return TRUE;
}
+static bfd_boolean
+bfd_mach_o_read_encryption_info (bfd *abfd, bfd_mach_o_load_command *command)
+{
+ bfd_mach_o_encryption_info_command *cmd = &command->command.encryption_info;
+ struct mach_o_encryption_info_command_external raw;
+
+ if (bfd_seek (abfd, command->offset + BFD_MACH_O_LC_SIZE, SEEK_SET) != 0
+ || bfd_bread (&raw, sizeof (raw), abfd) != sizeof (raw))
+ return FALSE;
+
+ cmd->cryptoff = bfd_get_32 (abfd, raw.cryptoff);
+ cmd->cryptsize = bfd_get_32 (abfd, raw.cryptsize);
+ cmd->cryptid = bfd_get_32 (abfd, raw.cryptid);
+ return TRUE;
+}
+
static int
bfd_mach_o_read_segment (bfd *abfd,
bfd_mach_o_load_command *command,
@@ -3587,6 +3603,10 @@ bfd_mach_o_read_command (bfd *abfd, bfd_mach_o_load_command *command)
if (bfd_mach_o_read_linkedit (abfd, command) != 0)
return -1;
break;
+ case BFD_MACH_O_LC_ENCRYPTION_INFO:
+ if (!bfd_mach_o_read_encryption_info (abfd, command))
+ return -1;
+ break;
case BFD_MACH_O_LC_DYLD_INFO:
if (bfd_mach_o_read_dyld_info (abfd, command) != 0)
return -1;
@@ -3597,7 +3617,7 @@ bfd_mach_o_read_command (bfd *abfd, bfd_mach_o_load_command *command)
return -1;
break;
default:
- (*_bfd_error_handler)(_("%B: unable to read unknown load command 0x%lx"),
+ (*_bfd_error_handler)(_("%B: unknown load command 0x%lx"),
abfd, (unsigned long) command->type);
break;
}