2009-08-23 H.J. Lu <hongjiu.lu@intel.com>
[deliverable/binutils-gdb.git] / bfd / binary.c
index 89a1a2c3e026cadc01294ed2c0c6e3210401461d..7e9bf102dd315f470c41e545c428a0234e4128f6 100644 (file)
@@ -1,13 +1,13 @@
 /* BFD back-end for binary objects.
    Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
-   2004, 2005 Free Software Foundation, Inc.
+   2004, 2005, 2006, 2007 Free Software Foundation, Inc.
    Written by Ian Lance Taylor, Cygnus Support, <ian@cygnus.com>
 
    This file is part of BFD, the Binary File Descriptor library.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
+   the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
 
    This program is distributed in the hope that it will be useful,
@@ -17,7 +17,8 @@
 
    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.  */
 
 /* This is a BFD backend which may be used to write binary objects.
    It may only be used for output, not input.  The intention is that
@@ -32,8 +33,8 @@
    the file.  objcopy cooperates by specially setting the start
    address to zero by default.  */
 
-#include "bfd.h"
 #include "sysdep.h"
+#include "bfd.h"
 #include "safe-ctype.h"
 #include "libbfd.h"
 
@@ -63,6 +64,7 @@ binary_object_p (bfd *abfd)
 {
   struct stat statbuf;
   asection *sec;
+  flagword flags;
 
   if (abfd->target_defaulted)
     {
@@ -80,10 +82,10 @@ binary_object_p (bfd *abfd)
     }
 
   /* One data section.  */
-  sec = bfd_make_section (abfd, ".data");
+  flags = SEC_ALLOC | SEC_LOAD | SEC_DATA | SEC_HAS_CONTENTS;
+  sec = bfd_make_section_with_flags (abfd, ".data", flags);
   if (sec == NULL)
     return NULL;
-  sec->flags = SEC_ALLOC | SEC_LOAD | SEC_DATA | SEC_HAS_CONTENTS;
   sec->vma = 0;
   sec->size = statbuf.st_size;
   sec->filepos = 0;
@@ -167,7 +169,7 @@ binary_canonicalize_symtab (bfd *abfd, asymbol **alocation)
 
   syms = bfd_alloc (abfd, amt);
   if (syms == NULL)
-    return 0;
+    return -1;
 
   /* Start symbol.  */
   syms[0].the_bfd = abfd;
@@ -216,12 +218,10 @@ binary_get_symbol_info (bfd *ignore_abfd ATTRIBUTE_UNUSED,
 #define binary_bfd_is_local_label_name      bfd_generic_is_local_label_name
 #define binary_get_lineno                  _bfd_nosymbols_get_lineno
 #define binary_find_nearest_line           _bfd_nosymbols_find_nearest_line
+#define binary_find_inliner_info           _bfd_nosymbols_find_inliner_info
 #define binary_bfd_make_debug_symbol       _bfd_nosymbols_bfd_make_debug_symbol
 #define binary_read_minisymbols            _bfd_generic_read_minisymbols
 #define binary_minisymbol_to_symbol        _bfd_generic_minisymbol_to_symbol
-#define binary_bfd_reloc_type_lookup       _bfd_norelocs_bfd_reloc_type_lookup
-#define binary_get_reloc_upper_bound        ((long (*) (bfd *, asection *)) bfd_0l)
-#define binary_canonicalize_reloc           ((long (*) (bfd *, asection *, arelent **, asymbol **)) bfd_0l)
 #define binary_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
 
 /* Set the architecture of a binary file.  */
@@ -304,7 +304,7 @@ binary_set_section_contents (bfd *abfd,
 
 static int
 binary_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED,
-                      bfd_boolean exec ATTRIBUTE_UNUSED)
+                      struct bfd_link_info *info ATTRIBUTE_UNUSED)
 {
   return 0;
 }
@@ -316,6 +316,7 @@ binary_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED,
 #define binary_bfd_is_group_section                bfd_generic_is_group_section
 #define binary_bfd_discard_group                   bfd_generic_discard_group
 #define binary_section_already_linked             _bfd_generic_section_already_linked
+#define binary_bfd_define_common_symbol            bfd_generic_define_common_symbol
 #define binary_bfd_link_hash_table_create         _bfd_generic_link_hash_table_create
 #define binary_bfd_link_hash_table_free           _bfd_generic_link_hash_table_free
 #define binary_bfd_link_just_syms                 _bfd_generic_link_just_syms
@@ -366,7 +367,7 @@ const bfd_target binary_vec =
   BFD_JUMP_TABLE_CORE (_bfd_nocore),
   BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive),
   BFD_JUMP_TABLE_SYMBOLS (binary),
-  BFD_JUMP_TABLE_RELOCS (binary),
+  BFD_JUMP_TABLE_RELOCS (_bfd_norelocs),
   BFD_JUMP_TABLE_WRITE (binary),
   BFD_JUMP_TABLE_LINK (binary),
   BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
This page took 0.025285 seconds and 4 git commands to generate.