aboutsummaryrefslogtreecommitdiff
path: root/bfd/mach-o.c
diff options
context:
space:
mode:
authorTristan Gingold <gingold@adacore.com>2012-01-04 10:37:36 +0000
committerTristan Gingold <gingold@adacore.com>2012-01-04 10:37:36 +0000
commit9f4a5bd19a3650f6a73d939262aee7f958754b6e (patch)
tree9c3048da824e6d0f2d118fdcf8ded158fe2fa4f2 /bfd/mach-o.c
parent0b2de107050237af9ccb6a2bd59070e9ac336b96 (diff)
downloadgdb-9f4a5bd19a3650f6a73d939262aee7f958754b6e.zip
gdb-9f4a5bd19a3650f6a73d939262aee7f958754b6e.tar.gz
gdb-9f4a5bd19a3650f6a73d939262aee7f958754b6e.tar.bz2
bfd/
2012-01-04 Tristan Gingold <gingold@adacore.com> * mach-o.h (bfd_mach_o_fvmlib_command): New structure. (bfd_mach_o_load_command): Add fvmlib field. * mach-o.c (bfd_mach_o_read_fvmlib): New function. (bfd_mach_o_read_command): Handle fvmlib. binutils/ 2012-01-04 Tristan Gingold <gingold@adacore.com> * od-macho.c (dump_load_command): Handle fvmlib. include/mach-o/ 2012-01-04 Tristan Gingold <gingold@adacore.com> * external.h (mach_o_fvmlib_command_external): New structure.
Diffstat (limited to 'bfd/mach-o.c')
-rw-r--r--bfd/mach-o.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/bfd/mach-o.c b/bfd/mach-o.c
index a72cba0..d2fd7e1 100644
--- a/bfd/mach-o.c
+++ b/bfd/mach-o.c
@@ -3045,6 +3045,32 @@ bfd_mach_o_read_prebound_dylib (bfd *abfd ATTRIBUTE_UNUSED,
}
static int
+bfd_mach_o_read_fvmlib (bfd *abfd, bfd_mach_o_load_command *command)
+{
+ bfd_mach_o_fvmlib_command *fvm = &command->command.fvmlib;
+ struct mach_o_fvmlib_command_external raw;
+ unsigned int nameoff;
+
+ if (bfd_seek (abfd, command->offset + BFD_MACH_O_LC_SIZE, SEEK_SET) != 0
+ || bfd_bread (&raw, sizeof (raw), abfd) != sizeof (raw))
+ return -1;
+
+ nameoff = bfd_h_get_32 (abfd, raw.name);
+ fvm->minor_version = bfd_h_get_32 (abfd, raw.minor_version);
+ fvm->header_addr = bfd_h_get_32 (abfd, raw.header_addr);
+
+ fvm->name_offset = command->offset + nameoff;
+ fvm->name_len = command->len - nameoff;
+ fvm->name_str = bfd_alloc (abfd, fvm->name_len);
+ if (fvm->name_str == NULL)
+ return -1;
+ if (bfd_seek (abfd, fvm->name_offset, SEEK_SET) != 0
+ || bfd_bread (fvm->name_str, fvm->name_len, abfd) != fvm->name_len)
+ return -1;
+ return 0;
+}
+
+static int
bfd_mach_o_read_thread (bfd *abfd, bfd_mach_o_load_command *command)
{
bfd_mach_o_data_struct *mdata = bfd_mach_o_get_data (abfd);
@@ -3618,6 +3644,9 @@ bfd_mach_o_read_command (bfd *abfd, bfd_mach_o_load_command *command)
break;
case BFD_MACH_O_LC_LOADFVMLIB:
case BFD_MACH_O_LC_IDFVMLIB:
+ if (bfd_mach_o_read_fvmlib (abfd, command) != 0)
+ return -1;
+ break;
case BFD_MACH_O_LC_IDENT:
case BFD_MACH_O_LC_FVMFILE:
case BFD_MACH_O_LC_PREPAGE: