daily update
[deliverable/binutils-gdb.git] / bfd / mach-o.c
index 70310e62eedec6f817757e103e25a4826fc41d76..7baf87ba75d7c0f9a71dd8109a14088dfb1fdfa7 100644 (file)
@@ -1,5 +1,5 @@
 /* Mach-O support for BFD.
-   Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005
+   Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
    Free Software Foundation, Inc.
 
    This file is part of BFD, the Binary File Descriptor library.
@@ -16,7 +16,7 @@
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02110-1301, USA.  */
+   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
 
 #include "mach-o.h"
 #include "bfd.h"
@@ -48,6 +48,7 @@
 #define bfd_mach_o_bfd_is_local_label_name            _bfd_nosymbols_bfd_is_local_label_name
 #define bfd_mach_o_get_lineno                         _bfd_nosymbols_get_lineno
 #define bfd_mach_o_find_nearest_line                  _bfd_nosymbols_find_nearest_line
+#define bfd_mach_o_find_inliner_info                  _bfd_nosymbols_find_inliner_info
 #define bfd_mach_o_bfd_make_debug_symbol              _bfd_nosymbols_bfd_make_debug_symbol
 #define bfd_mach_o_read_minisymbols                   _bfd_generic_read_minisymbols
 #define bfd_mach_o_minisymbol_to_symbol               _bfd_generic_minisymbol_to_symbol
@@ -74,6 +75,7 @@
 #define bfd_mach_o_bfd_discard_group                  bfd_generic_discard_group
 #define bfd_mach_o_section_already_linked             _bfd_generic_section_already_linked
 #define bfd_mach_o_bfd_copy_private_header_data       _bfd_generic_bfd_copy_private_header_data
+#define bfd_mach_o_core_file_matches_executable_p     generic_core_file_matches_executable_p
 
 
 /* The flags field of a section structure is separated into two parts a section
@@ -566,7 +568,7 @@ bfd_mach_o_write_contents (bfd *abfd)
 
 static int
 bfd_mach_o_sizeof_headers (bfd *a ATTRIBUTE_UNUSED,
-                          bfd_boolean b ATTRIBUTE_UNUSED)
+                          struct bfd_link_info *info ATTRIBUTE_UNUSED)
 {
   return 0;
 }
@@ -632,6 +634,7 @@ bfd_mach_o_make_bfd_section (bfd *abfd, bfd_mach_o_section *section)
   char *sname;
   const char *prefix = "LC_SEGMENT";
   unsigned int snamelen;
+  flagword flags;
 
   snamelen = strlen (prefix) + 1
     + strlen (section->segname) + 1
@@ -642,7 +645,10 @@ bfd_mach_o_make_bfd_section (bfd *abfd, bfd_mach_o_section *section)
     return NULL;
   sprintf (sname, "%s.%s.%s", prefix, section->segname, section->sectname);
 
-  bfdsec = bfd_make_section_anyway (abfd, sname);
+  flags = SEC_ALLOC;
+  if (!(section->flags & BFD_MACH_O_S_ZEROFILL))
+    flags = SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC | SEC_CODE;
+  bfdsec = bfd_make_section_anyway_with_flags (abfd, sname, flags);
   if (bfdsec == NULL)
     return NULL;
 
@@ -652,11 +658,6 @@ bfd_mach_o_make_bfd_section (bfd *abfd, bfd_mach_o_section *section)
   bfdsec->filepos = section->offset;
   bfdsec->alignment_power = section->align;
 
-  if (section->flags & BFD_MACH_O_S_ZEROFILL)
-    bfdsec->flags = SEC_ALLOC;
-  else
-    bfdsec->flags = SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC | SEC_CODE;
-
   return bfdsec;
 }
 
@@ -964,7 +965,7 @@ bfd_mach_o_scan_read_dylinker (bfd *abfd,
     return -1;
   strcpy (sname, prefix);
 
-  bfdsec = bfd_make_section_anyway (abfd, sname);
+  bfdsec = bfd_make_section_anyway_with_flags (abfd, sname, SEC_HAS_CONTENTS);
   if (bfdsec == NULL)
     return -1;
 
@@ -973,7 +974,6 @@ bfd_mach_o_scan_read_dylinker (bfd *abfd,
   bfdsec->size = command->len - 8;
   bfdsec->filepos = command->offset + 8;
   bfdsec->alignment_power = 0;
-  bfdsec->flags = SEC_HAS_CONTENTS;
 
   cmd->section = bfdsec;
 
@@ -1020,7 +1020,7 @@ bfd_mach_o_scan_read_dylib (bfd *abfd, bfd_mach_o_load_command *command)
     return -1;
   strcpy (sname, prefix);
 
-  bfdsec = bfd_make_section_anyway (abfd, sname);
+  bfdsec = bfd_make_section_anyway_with_flags (abfd, sname, SEC_HAS_CONTENTS);
   if (bfdsec == NULL)
     return -1;
 
@@ -1029,7 +1029,6 @@ bfd_mach_o_scan_read_dylib (bfd *abfd, bfd_mach_o_load_command *command)
   bfdsec->size = command->len - 8;
   bfdsec->filepos = command->offset + 8;
   bfdsec->alignment_power = 0;
-  bfdsec->flags = SEC_HAS_CONTENTS;
 
   cmd->section = bfdsec;
 
@@ -1140,14 +1139,13 @@ bfd_mach_o_scan_read_thread (bfd *abfd, bfd_mach_o_load_command *command)
          j++;
        }
 
-      bfdsec = bfd_make_section (abfd, sname);
+      bfdsec = bfd_make_section_with_flags (abfd, sname, SEC_HAS_CONTENTS);
 
       bfdsec->vma = 0;
       bfdsec->lma = 0;
       bfdsec->size = cmd->flavours[i].size;
       bfdsec->filepos = cmd->flavours[i].offset;
       bfdsec->alignment_power = 0x0;
-      bfdsec->flags = SEC_HAS_CONTENTS;
 
       cmd->section = bfdsec;
     }
@@ -1216,7 +1214,7 @@ bfd_mach_o_scan_read_symtab (bfd *abfd, bfd_mach_o_load_command *command)
     return -1;
   strcpy (sname, prefix);
 
-  bfdsec = bfd_make_section_anyway (abfd, sname);
+  bfdsec = bfd_make_section_anyway_with_flags (abfd, sname, SEC_HAS_CONTENTS);
   if (bfdsec == NULL)
     return -1;
 
@@ -1225,7 +1223,6 @@ bfd_mach_o_scan_read_symtab (bfd *abfd, bfd_mach_o_load_command *command)
   bfdsec->size = seg->nsyms * 12;
   bfdsec->filepos = seg->symoff;
   bfdsec->alignment_power = 0;
-  bfdsec->flags = SEC_HAS_CONTENTS;
 
   seg->stabs_segment = bfdsec;
 
@@ -1235,7 +1232,7 @@ bfd_mach_o_scan_read_symtab (bfd *abfd, bfd_mach_o_load_command *command)
     return -1;
   strcpy (sname, prefix);
 
-  bfdsec = bfd_make_section_anyway (abfd, sname);
+  bfdsec = bfd_make_section_anyway_with_flags (abfd, sname, SEC_HAS_CONTENTS);
   if (bfdsec == NULL)
     return -1;
 
@@ -1244,7 +1241,6 @@ bfd_mach_o_scan_read_symtab (bfd *abfd, bfd_mach_o_load_command *command)
   bfdsec->size = seg->strsize;
   bfdsec->filepos = seg->stroff;
   bfdsec->alignment_power = 0;
-  bfdsec->flags = SEC_HAS_CONTENTS;
 
   seg->stabstr_segment = bfdsec;
 
@@ -1261,6 +1257,7 @@ bfd_mach_o_scan_read_segment (bfd *abfd, bfd_mach_o_load_command *command)
   char *sname;
   const char *prefix = "LC_SEGMENT";
   unsigned int snamelen;
+  flagword flags;
 
   BFD_ASSERT (command->type == BFD_MACH_O_LC_SEGMENT);
 
@@ -1284,7 +1281,8 @@ bfd_mach_o_scan_read_segment (bfd *abfd, bfd_mach_o_load_command *command)
     return -1;
   sprintf (sname, "%s.%s", prefix, seg->segname);
 
-  bfdsec = bfd_make_section_anyway (abfd, sname);
+  flags = SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC | SEC_CODE;
+  bfdsec = bfd_make_section_anyway_with_flags (abfd, sname, flags);
   if (bfdsec == NULL)
     return -1;
 
@@ -1293,7 +1291,6 @@ bfd_mach_o_scan_read_segment (bfd *abfd, bfd_mach_o_load_command *command)
   bfdsec->size = seg->filesize;
   bfdsec->filepos = seg->fileoff;
   bfdsec->alignment_power = 0x0;
-  bfdsec->flags = SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC | SEC_CODE;
 
   seg->segment = bfdsec;
 
@@ -1992,13 +1989,6 @@ bfd_mach_o_core_file_failing_signal (bfd *abfd ATTRIBUTE_UNUSED)
   return 0;
 }
 
-bfd_boolean
-bfd_mach_o_core_file_matches_executable_p (bfd *core_bfd ATTRIBUTE_UNUSED,
-                                          bfd *exec_bfd ATTRIBUTE_UNUSED)
-{
-  return TRUE;
-}
-
 #define TARGET_NAME            mach_o_be_vec
 #define TARGET_STRING          "mach-o-be"
 #define TARGET_BIG_ENDIAN      1
This page took 0.027154 seconds and 4 git commands to generate.