OSDN Git Service

2009-12-03 Tristan Gingold <gingold@adacore.com>
[pf3gnuchains/pf3gnuchains3x.git] / bfd / xsym.c
index e38f9ba..dd1ffd7 100644 (file)
@@ -1,12 +1,12 @@
 /* xSYM symbol-file support for BFD.
-   Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005
-   Free Software Foundation, Inc.
+   Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
+   2009 Free Software Foundation, Inc.
 
    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,
 
    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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
+   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
+#include "alloca-conf.h"
+#include "sysdep.h"
 #include "xsym.h"
 #include "bfd.h"
-#include "sysdep.h"
 #include "libbfd.h"
 
 #define bfd_sym_close_and_cleanup                   _bfd_generic_close_and_cleanup
 #define bfd_sym_bfd_is_target_special_symbol       ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
 #define bfd_sym_get_lineno                          _bfd_nosymbols_get_lineno
 #define bfd_sym_find_nearest_line                   _bfd_nosymbols_find_nearest_line
+#define bfd_sym_find_inliner_info                   _bfd_nosymbols_find_inliner_info
 #define bfd_sym_bfd_make_debug_symbol               _bfd_nosymbols_bfd_make_debug_symbol
 #define bfd_sym_read_minisymbols                    _bfd_generic_read_minisymbols
 #define bfd_sym_minisymbol_to_symbol                _bfd_generic_minisymbol_to_symbol
-#define bfd_sym_get_reloc_upper_bound               _bfd_norelocs_get_reloc_upper_bound
-#define bfd_sym_canonicalize_reloc                  _bfd_norelocs_canonicalize_reloc
-#define bfd_sym_bfd_reloc_type_lookup               _bfd_norelocs_bfd_reloc_type_lookup
 #define bfd_sym_set_arch_mach                       _bfd_generic_set_arch_mach
 #define bfd_sym_get_section_contents                _bfd_generic_get_section_contents
 #define bfd_sym_set_section_contents                _bfd_generic_set_section_contents
 #define bfd_sym_bfd_is_group_section                bfd_generic_is_group_section
 #define bfd_sym_bfd_discard_group                   bfd_generic_discard_group
 #define bfd_sym_section_already_linked              _bfd_generic_section_already_linked
+#define bfd_sym_bfd_define_common_symbol            bfd_generic_define_common_symbol
 #define bfd_sym_bfd_link_hash_table_create          _bfd_generic_link_hash_table_create
 #define bfd_sym_bfd_link_hash_table_free            _bfd_generic_link_hash_table_free
 #define bfd_sym_bfd_link_add_symbols                _bfd_generic_link_add_symbols
 #define bfd_sym_bfd_link_just_syms                  _bfd_generic_link_just_syms
+#define bfd_sym_bfd_copy_link_hash_symbol_type \
+  _bfd_generic_copy_link_hash_symbol_type
 #define bfd_sym_bfd_final_link                      _bfd_generic_final_link
 #define bfd_sym_bfd_link_split_section              _bfd_generic_link_split_section
 #define bfd_sym_get_section_contents_in_window      _bfd_generic_get_section_contents_in_window
@@ -1641,7 +1644,7 @@ bfd_sym_print_type_information (bfd *abfd,
                       bfd_sym_symbol_name (abfd, tinfo.nte_index)[0],
                       &bfd_sym_symbol_name (abfd, tinfo.nte_index)[1]);
          }
-       fprintf (f, " (TTE %lu)", value);
+       fprintf (f, " (TTE %lu)", (unsigned long) value);
        break;
       }
 
@@ -1702,13 +1705,13 @@ bfd_sym_print_type_information (bfd *abfd,
          fprintf (f, "union (0x%x) of ", type);
 
        bfd_sym_fetch_long (buf, len, offset, &offset, &nrec);
-       fprintf (f, "%lu elements: ", nrec);
+       fprintf (f, "%lu elements: ", (unsigned long) nrec);
 
        for (i = 0; i < nrec; i++)
          {
            bfd_sym_fetch_long (buf, len, offset, &offset, &eloff);
            fprintf (f, "\n                ");
-           fprintf (f, "offset %lu: ", eloff);
+           fprintf (f, "offset %lu: ", (unsigned long) eloff);
            bfd_sym_print_type_information (abfd, f, buf, len, offset, &offset);
          }
        break;
@@ -1736,7 +1739,7 @@ bfd_sym_print_type_information (bfd *abfd,
                 bfd_sym_symbol_name (abfd, value)[0],
                 &bfd_sym_symbol_name (abfd, value)[1]);
 
-      fprintf (f, " (NTE %lu) with type ", value);
+      fprintf (f, " (NTE %lu) with type ", (unsigned long) value);
       bfd_sym_print_type_information (abfd, f, buf, len, offset, &offset);
       break;
     }
@@ -2227,7 +2230,7 @@ bfd_sym_scan (bfd *abfd, bfd_sym_version version, bfd_sym_data_struct *mdata)
   if (mdata->name_table == NULL)
     return -1;
 
-  bfdsec = bfd_make_section_anyway (abfd, name);
+  bfdsec = bfd_make_section_anyway_with_flags (abfd, name, SEC_HAS_CONTENTS);
   if (bfdsec == NULL)
     return -1;
 
@@ -2237,8 +2240,6 @@ bfd_sym_scan (bfd *abfd, bfd_sym_version version, bfd_sym_data_struct *mdata)
   bfdsec->filepos = 0;
   bfdsec->alignment_power = 0;
 
-  bfdsec->flags = SEC_HAS_CONTENTS;
-
   abfd->tdata.sym_data = mdata;
 
   return 0;
@@ -2276,11 +2277,7 @@ bfd_sym_object_p (bfd *abfd)
   return NULL;
 }
 
-asymbol *
-bfd_sym_make_empty_symbol (bfd *abfd)
-{
-  return bfd_alloc (abfd, sizeof (asymbol));
-}
+#define bfd_sym_make_empty_symbol _bfd_generic_make_empty_symbol
 
 void
 bfd_sym_get_symbol_info (bfd *abfd ATTRIBUTE_UNUSED, asymbol *symbol, symbol_info *ret)
@@ -2301,7 +2298,8 @@ bfd_sym_canonicalize_symtab (bfd *abfd ATTRIBUTE_UNUSED, asymbol **sym ATTRIBUTE
 }
 
 int
-bfd_sym_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED, bfd_boolean exec ATTRIBUTE_UNUSED)
+bfd_sym_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED,
+                       struct bfd_link_info *info ATTRIBUTE_UNUSED)
 {
   return 0;
 }
@@ -2350,7 +2348,7 @@ const bfd_target sym_vec =
   BFD_JUMP_TABLE_CORE (_bfd_nocore),
   BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive),
   BFD_JUMP_TABLE_SYMBOLS (bfd_sym),
-  BFD_JUMP_TABLE_RELOCS (bfd_sym),
+  BFD_JUMP_TABLE_RELOCS (_bfd_norelocs),
   BFD_JUMP_TABLE_WRITE (bfd_sym),
   BFD_JUMP_TABLE_LINK (bfd_sym),
   BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),