mach-o: fix warnings on 32 bit hosts. Display personality functions.
authorTristan Gingold <tristan.gingold@adacore.com>
Thu, 3 Apr 2014 09:49:56 +0000 (11:49 +0200)
committerTristan Gingold <tristan.gingold@adacore.com>
Thu, 3 Apr 2014 09:49:56 +0000 (11:49 +0200)
binutils/
* od-macho.c (printf_uint64): New function.
(dump_load_command, dump_obj_compact_unwind): Use it.
(dump_exe_compact_unwind): Display personality functions.

include/mach-o/
* unwind.h (mach_o_compact_unwind_64): Fix typo in personality.

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

index 56ea96002609233649055b1a4849b607e6f49815..8fc5f7f05c9d23ba974b91e9a2597d06068ac18c 100644 (file)
@@ -1,3 +1,9 @@
+2014-04-03  Tristan Gingold  <gingold@adacore.com>
+
+       * od-macho.c (printf_uint64): New function.
+       (dump_load_command, dump_obj_compact_unwind): Use it.
+       (dump_exe_compact_unwind): Display personality functions.
+
 2014-04-02  Tristan Gingold  <gingold@adacore.com>
 
        * od-macho.c (OPT_TWOLEVEL_HINTS): New macro.
index d606a2beb0f40c44dcf907f1e4a17b283ff5a4d1..780b43848375288f0f8510667a9f825d20e75539 100644 (file)
@@ -249,6 +249,15 @@ bfd_mach_o_print_flags (const bfd_mach_o_xlat_name *table,
     printf ("-");
 }
 
+/* Print a bfd_uint64_t, using a platform independant style.  */
+
+static void
+printf_uint64 (bfd_uint64_t v)
+{
+  printf ("0x%08lx%08lx",
+         (unsigned long)((v >> 16) >> 16), (unsigned long)(v & 0xffffffffUL));
+}
+
 static const char *
 bfd_mach_o_get_name_or_null (const bfd_mach_o_xlat_name *table,
                              unsigned long val)
@@ -1279,10 +1288,10 @@ dump_load_command (bfd *abfd, bfd_mach_o_load_command *cmd,
         bfd_mach_o_main_command *entry = &cmd->command.main;
         printf ("\n"
                 "   entry offset: ");
-       printf_vma (entry->entryoff);
+       printf_uint64 (entry->entryoff);
         printf ("\n"
                 "   stack size:   ");
-       printf_vma (entry->stacksize);
+       printf_uint64 (entry->stacksize);
        printf ("\n");
         break;
       }
@@ -1492,12 +1501,12 @@ dump_obj_compact_unwind (bfd *abfd,
          e = (struct mach_o_compact_unwind_64 *) p;
 
          putchar (' ');
-         fprintf_vma (stdout, bfd_get_64 (abfd, e->start));
+         printf_uint64 (bfd_get_64 (abfd, e->start));
          printf (" %08lx", bfd_get_32 (abfd, e->length));
          putchar (' ');
-         fprintf_vma (stdout, bfd_get_64 (abfd, e->personnality));
+         printf_uint64 (bfd_get_64 (abfd, e->personality));
          putchar (' ');
-         fprintf_vma (stdout, bfd_get_64 (abfd, e->lsda));
+         printf_uint64 (bfd_get_64 (abfd, e->lsda));
          putchar ('\n');
 
          printf ("  encoding: ");
@@ -1552,6 +1561,17 @@ dump_exe_compact_unwind (bfd *abfd,
   printf ("   %u encodings, %u personalities, %u level-1 indexes:\n",
          encodings_count, personality_count, index_count);
 
+  /* Personality.  */
+  if (personality_count > 0)
+    {
+      const unsigned char *pers = content + personality_offset;
+
+      printf ("   personalities\n");
+      for (i = 0; i < personality_count; i++)
+       printf ("     %u: 0x%08x\n", i,
+               (unsigned) bfd_get_32 (abfd, pers + 4 * i));
+    }
+
   /* Level-1 index.  */
   printf ("   idx function   level2 off lsda off\n");
 
@@ -1634,7 +1654,7 @@ dump_exe_compact_unwind (bfd *abfd,
                    + 4 * (enc_idx - encodings_count);
                encoding = bfd_get_32 (abfd, enc_addr);
 
-               printf ("   %-4u 0x%08x [%3u] ", j,
+               printf ("   %4u 0x%08x [%3u] ", j,
                        func_offset + en_func, enc_idx);
                dump_unwind_encoding (mdata, encoding);
                putchar ('\n');
index b3dc669a0c2ec22b5f3b241c5a6a4a1e0715b55a..284e845a8093fc73c311a40db77cf02ec193c570 100644 (file)
@@ -1,3 +1,7 @@
+2014-04-03  Tristan Gingold  <gingold@adacore.com>
+
+       * unwind.h (mach_o_compact_unwind_64): Fix typo in personality.
+
 2014-04-02  Tristan Gingold  <gingold@adacore.com>
 
        * external.h (mach_o_prebound_dylib_command_external)
index f67c75b1f75fe133046bc8c0be3cf6168e4dc967..c11020e5232381ca21abd0ba3c19c0b07bbc1bdb 100644 (file)
@@ -119,7 +119,7 @@ struct mach_o_compact_unwind_64
   unsigned char start[8];
   unsigned char length[4];
   unsigned char encoding[4];
-  unsigned char personnality[8];
+  unsigned char personality[8];
   unsigned char lsda[8];
 };