opcodes/ChangeLog
[deliverable/binutils-gdb.git] / bfd / pef.c
index b7156f06234a2662c3e1958a6a2a5c3c8dda12e2..ca4c4548a91719954c7d2fe5e4fc83858647df19 100644 (file)
--- a/bfd/pef.c
+++ b/bfd/pef.c
@@ -1,6 +1,6 @@
 /* PEF support for BFD.
-   Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
-   Free Software Foundation, Inc.
+   Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
+   2009, 2011  Free Software Foundation, Inc.
 
    This file is part of BFD, the Binary File Descriptor library.
 
    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
    MA 02110-1301, USA.  */
 
+/* PEF (Preferred Executable Format) is the binary file format for late
+   classic Mac OS versions (before Darwin).  It is supported by both m68k
+   and PowerPc.  It is also called CFM (Code Fragment Manager).  */
+
 #include "sysdep.h"
 #include "safe-ctype.h"
 #include "pef.h"
@@ -48,6 +52,7 @@
 #define bfd_pef_bfd_get_relocated_section_contents  bfd_generic_get_relocated_section_contents
 #define bfd_pef_bfd_relax_section                   bfd_generic_relax_section
 #define bfd_pef_bfd_gc_sections                     bfd_generic_gc_sections
+#define bfd_pef_bfd_lookup_section_flags            bfd_generic_lookup_section_flags
 #define bfd_pef_bfd_merge_sections                  bfd_generic_merge_sections
 #define bfd_pef_bfd_is_group_section               bfd_generic_is_group_section
 #define bfd_pef_bfd_discard_group                   bfd_generic_discard_group
@@ -502,10 +507,9 @@ bfd_pef_scan_start_address (bfd *abfd)
 }
 
 int
-bfd_pef_scan (abfd, header, mdata)
-     bfd *abfd;
-     bfd_pef_header *header;
-     bfd_pef_data_struct *mdata;
+bfd_pef_scan (bfd *abfd,
+             bfd_pef_header *header,
+             bfd_pef_data_struct *mdata)
 {
   unsigned int i;
   enum bfd_architecture cputype;
@@ -516,8 +520,8 @@ bfd_pef_scan (abfd, header, mdata)
   bfd_pef_convert_architecture (header->architecture, &cputype, &cpusubtype);
   if (cputype == bfd_arch_unknown)
     {
-      fprintf (stderr, "bfd_pef_scan: unknown architecture 0x%lx\n",
-              header->architecture);
+      (*_bfd_error_handler) (_("bfd_pef_scan: unknown architecture 0x%lx"),
+                              header->architecture);
       return -1;
     }
   bfd_set_arch_mach (abfd, cputype, cpusubtype);
@@ -730,14 +734,11 @@ bfd_pef_parse_function_stubs (bfd *abfd,
                              asymbol **csym)
 {
   const char *const sprefix = "__stub_";
-
   size_t codepos = 0;
   unsigned long count = 0;
-
   bfd_pef_loader_header header;
   bfd_pef_imported_library *libraries = NULL;
   bfd_pef_imported_symbol *imports = NULL;
-
   unsigned long i;
   int ret;
 
@@ -783,8 +784,7 @@ bfd_pef_parse_function_stubs (bfd *abfd,
       asymbol sym;
       const char *symname;
       char *name;
-      unsigned long index;
-      int ret;
+      unsigned long sym_index;
 
       if (csym && (csym[count] == NULL))
        break;
@@ -802,14 +802,14 @@ bfd_pef_parse_function_stubs (bfd *abfd,
       if ((codepos + 4) > codelen)
        break;
 
-      ret = bfd_pef_parse_function_stub (abfd, codebuf + codepos, 24, &index);
+      ret = bfd_pef_parse_function_stub (abfd, codebuf + codepos, 24, &sym_index);
       if (ret < 0)
        {
          codepos += 24;
          continue;
        }
 
-      if (index >= header.total_imported_symbol_count)
+      if (sym_index >= header.total_imported_symbol_count)
        {
          codepos += 24;
          continue;
@@ -819,12 +819,12 @@ bfd_pef_parse_function_stubs (bfd *abfd,
        size_t max, namelen;
        const char *s;
 
-       if (loaderlen < (header.loader_strings_offset + imports[index].name))
+       if (loaderlen < (header.loader_strings_offset + imports[sym_index].name))
          goto error;
 
-       max = loaderlen - (header.loader_strings_offset + imports[index].name);
+       max = loaderlen - (header.loader_strings_offset + imports[sym_index].name);
        symname = (char *) loaderbuf;
-       symname += header.loader_strings_offset + imports[index].name;
+       symname += header.loader_strings_offset + imports[sym_index].name;
        namelen = 0;
        for (s = symname; s < (symname + max); s++)
          {
@@ -1019,6 +1019,7 @@ const bfd_target pef_vec =
   0,                           /* Symbol_leading_char.  */
   ' ',                         /* AR_pad_char.  */
   16,                          /* AR_max_namelen.  */
+  0,                           /* match priority.  */
   bfd_getb64, bfd_getb_signed_64, bfd_putb64,
   bfd_getb32, bfd_getb_signed_32, bfd_putb32,
   bfd_getb16, bfd_getb_signed_16, bfd_putb16,  /* Data.  */
@@ -1171,6 +1172,7 @@ const bfd_target pef_xlib_vec =
   0,                           /* Symbol_leading_char.  */
   ' ',                         /* AR_pad_char.  */
   16,                          /* AR_max_namelen.  */
+  0,                           /* match priority.  */
   bfd_getb64, bfd_getb_signed_64, bfd_putb64,
   bfd_getb32, bfd_getb_signed_32, bfd_putb32,
   bfd_getb16, bfd_getb_signed_16, bfd_putb16,  /* Data.  */
This page took 0.042598 seconds and 4 git commands to generate.