]> rtime.felk.cvut.cz Git - fpga/lx-cpu1/binutils-tumbl.git/commitdiff
bfd/
authorTristan Gingold <gingold@adacore.com>
Wed, 4 Jan 2012 10:37:34 +0000 (10:37 +0000)
committerTristan Gingold <gingold@adacore.com>
Wed, 4 Jan 2012 10:37:34 +0000 (10:37 +0000)
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.

bfd/ChangeLog
bfd/mach-o.c
bfd/mach-o.h
binutils/ChangeLog
binutils/od-macho.c
include/mach-o/ChangeLog
include/mach-o/external.h

index 2fd6ae0390919b7f70d8be1c6e35fe7e5193b265..4eac2d419dd37010d78cff0d783143fe1c93b199 100644 (file)
@@ -1,3 +1,11 @@
+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.
+
 2012-01-04  Tristan Gingold  <gingold@adacore.com>
 
        * mach-o.c (bfd_mach_o_convert_architecture): Reindent.
index a72cba0200e0483f61210c1ee5c28b015421bf71..d2fd7e1867e49dfd4a35facbed38219a7a71f2cd 100644 (file)
@@ -3044,6 +3044,32 @@ bfd_mach_o_read_prebound_dylib (bfd *abfd ATTRIBUTE_UNUSED,
   return 0;
 }
 
+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)
 {
@@ -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:
index b32b6a8962f4b56005d42098f7874d77eed1893a..123eddafef9cdef8f3dadb105e1978d9a2bdf3f2 100644 (file)
@@ -450,6 +450,16 @@ typedef struct bfd_mach_o_str_command
 }
 bfd_mach_o_str_command;
 
+typedef struct bfd_mach_o_fvmlib_command
+{
+  unsigned int name_offset;
+  unsigned int name_len;
+  char *name_str;
+  unsigned int minor_version;
+  unsigned int header_addr;
+}
+bfd_mach_o_fvmlib_command;
+
 typedef struct bfd_mach_o_dyld_info_command
 {
   /* File offset and size to rebase info.  */
@@ -512,6 +522,7 @@ typedef struct bfd_mach_o_load_command
     bfd_mach_o_dyld_info_command dyld_info;
     bfd_mach_o_version_min_command version_min;
     bfd_mach_o_encryption_info_command encryption_info;
+    bfd_mach_o_fvmlib_command fvmlib;
   }
   command;
 }
index a7a78c4d960276f3cd9008ff6ac0353ecd76772b..88397d2c705c54e1dfba60dd4a67fcb08eea9d35 100644 (file)
@@ -1,3 +1,7 @@
+2012-01-04  Tristan Gingold  <gingold@adacore.com>
+
+       * od-macho.c (dump_load_command): Handle fvmlib.
+
 2012-01-04  Tristan Gingold  <gingold@adacore.com>
 
        * od-macho.c: Update copyright year.
index fbdd53f3aa7488b198ebdcb926c8c9e1f0a2bc56..91e080e9bccce5dc5ca056b5f3a813796a93edc3 100644 (file)
@@ -896,8 +896,8 @@ dump_load_command (bfd *abfd, bfd_mach_o_load_command *cmd,
                 dylib->current_version);
         printf ("  comptibility version: 0x%08lx\n",
                 dylib->compatibility_version);
-        break;
       }
+      break;
     case BFD_MACH_O_LC_LOAD_DYLINKER:
     case BFD_MACH_O_LC_ID_DYLINKER:
       printf (" %s\n", cmd->command.dylinker.name_str);
@@ -920,6 +920,15 @@ dump_load_command (bfd *abfd, bfd_mach_o_load_command *cmd,
       putchar ('\n');
       dump_dysymtab (abfd, cmd, verbose);
       break;
+    case BFD_MACH_O_LC_LOADFVMLIB:
+    case BFD_MACH_O_LC_IDFVMLIB:
+      {
+        bfd_mach_o_fvmlib_command *fvmlib = &cmd->command.fvmlib;
+        printf (" %s\n", fvmlib->name_str);
+        printf ("         minor version: 0x%08x\n", fvmlib->minor_version);
+        printf ("        header address: 0x%08x\n", fvmlib->header_addr);
+      }
+      break;
     case BFD_MACH_O_LC_CODE_SIGNATURE:
     case BFD_MACH_O_LC_SEGMENT_SPLIT_INFO:
     case BFD_MACH_O_LC_FUNCTION_STARTS:
index 0280ca7784c51ba0d873fbf174e33d0f0d4304a7..2cd71c963e6682b48c386d30b82ad26860cb779e 100644 (file)
@@ -1,3 +1,7 @@
+2012-01-04  Tristan Gingold  <gingold@adacore.com>
+
+       * external.h (mach_o_fvmlib_command_external): New structure.
+
 2012-01-04  Tristan Gingold  <gingold@adacore.com>
 
        * loader.h: Update copyright year.
index 23d9a5c006062a52eb7e2b9421a45b8a998b4020..ad419ef549ad3a44f63b27fa88748fba26a3ef91 100644 (file)
@@ -262,6 +262,13 @@ struct mach_o_encryption_info_command_external
   unsigned char cryptid[4];    /* Encryption method.  */
 };
 
+struct mach_o_fvmlib_command_external
+{
+  unsigned char name[4];       /* Offset of the name.  */
+  unsigned char minor_version[4];
+  unsigned char header_addr[4];
+};
+
 struct mach_o_fat_header_external
 {
   unsigned char magic[4];