Fixed gold installation
[platform/upstream/binutils.git] / bfd / aout-tic30.c
index 8adca2a..e74464d 100644 (file)
@@ -1,13 +1,12 @@
 /* BFD back-end for TMS320C30 a.out binaries.
-   Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
-   Free Software Foundation, Inc.
+   Copyright (C) 1998-2014 Free Software Foundation, Inc.
    Contributed by Steven Haworth (steve@pm.cse.rmit.edu.au)
 
    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,8 +16,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
-   02111-1307, USA.  */
+   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+   02110-1301, USA.  */
 
 #define TARGET_IS_BIG_ENDIAN_P
 #define N_HEADER_IN_TEXT(x)    1
@@ -35,8 +34,8 @@
 #define TARGETNAME "a.out-tic30"
 #define NAME(x,y) CONCAT3 (tic30_aout,_32_,y)
 
-#include "bfd.h"
 #include "sysdep.h"
+#include "bfd.h"
 #include "libaout.h"
 #include "aout/aout64.h"
 #include "aout/stab_gnu.h"
@@ -188,7 +187,7 @@ tic30_aout_fix_16 (bfd *abfd,
   bfd_vma relocation;
 
   /* Make sure that the symbol's section is defined.  */
-  if (symbol->section == &bfd_und_section && (symbol->flags & BSF_WEAK) == 0)
+  if (bfd_is_und_section (symbol->section) && (symbol->flags & BSF_WEAK) == 0)
     return output_bfd ? bfd_reloc_ok : bfd_reloc_undefined;
   /* Get the size of the input section and turn it into the TMS320C30
      32-bit address format.  */
@@ -213,7 +212,7 @@ tic30_aout_fix_32 (bfd *abfd,
   bfd_vma relocation;
 
   /* Make sure that the symbol's section is defined.  */
-  if (symbol->section == &bfd_und_section && (symbol->flags & BSF_WEAK) == 0)
+  if (bfd_is_und_section (symbol->section) && (symbol->flags & BSF_WEAK) == 0)
     return output_bfd ? bfd_reloc_ok : bfd_reloc_undefined;
   /* Get the size of the input section and turn it into the TMS320C30
      32-bit address format.  */
@@ -271,6 +270,23 @@ tic30_aout_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
 }
 
 static reloc_howto_type *
+tic30_aout_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+                             const char *r_name)
+{
+  unsigned int i;
+
+  for (i = 0;
+       i < (sizeof (tic30_aout_howto_table)
+           / sizeof (tic30_aout_howto_table[0]));
+       i++)
+    if (tic30_aout_howto_table[i].name != NULL
+       && strcasecmp (tic30_aout_howto_table[i].name, r_name) == 0)
+      return &tic30_aout_howto_table[i];
+
+  return NULL;
+}
+
+static reloc_howto_type *
 tic30_aout_reloc_howto (bfd *abfd,
                        struct reloc_std_external *relocs,
                        int *r_index,
@@ -279,7 +295,7 @@ tic30_aout_reloc_howto (bfd *abfd,
 {
   unsigned int r_length;
   unsigned int r_pcrel_done;
-  int index;
+  int howto_index;
 
   *r_pcrel = 0;
   if (bfd_header_big_endian (abfd))
@@ -296,8 +312,8 @@ tic30_aout_reloc_howto (bfd *abfd,
       r_pcrel_done = (0 != (relocs->r_type[0] & RELOC_STD_BITS_PCREL_LITTLE));
       r_length = ((relocs->r_type[0] & RELOC_STD_BITS_LENGTH_LITTLE) >> RELOC_STD_BITS_LENGTH_SH_LITTLE);
     }
-  index = r_length + 4 * r_pcrel_done;
-  return tic30_aout_howto_table + index;
+  howto_index = r_length + 4 * r_pcrel_done;
+  return tic30_aout_howto_table + howto_index;
 }
 
 /* These macros will get 24-bit values from the bfd definition.
@@ -683,7 +699,7 @@ MY_final_link_callback (bfd *abfd,
 
   *ptreloff = obj_datasec (abfd)->filepos + execp->a_data;
   *pdreloff = *ptreloff + execp->a_trsize;
-  *psymoff = *pdreloff + execp->a_drsize;;
+  *psymoff = *pdreloff + execp->a_drsize;
 }
 
 #endif
@@ -820,6 +836,9 @@ tic30_aout_set_arch_mach (bfd *abfd,
 #ifndef MY_read_ar_hdr
 #define MY_read_ar_hdr                 _bfd_generic_read_ar_hdr
 #endif
+#ifndef MY_write_ar_hdr
+#define MY_write_ar_hdr                        _bfd_generic_write_ar_hdr
+#endif
 #ifndef        MY_truncate_arname
 #define        MY_truncate_arname              bfd_bsd_truncate_arname
 #endif
@@ -838,6 +857,9 @@ tic30_aout_set_arch_mach (bfd *abfd,
 #define        MY_core_file_matches_executable_p       \
                                _bfd_nocore_core_file_matches_executable_p
 #endif
+#ifndef        MY_core_file_pid
+#define        MY_core_file_pid                _bfd_nocore_core_file_pid
+#endif
 #ifndef        MY_core_file_p
 #define        MY_core_file_p                  _bfd_dummy_target
 #endif
@@ -904,6 +926,12 @@ tic30_aout_set_arch_mach (bfd *abfd,
 #ifndef MY_find_nearest_line
 #define MY_find_nearest_line NAME (aout, find_nearest_line)
 #endif
+#ifndef MY_find_line
+#define MY_find_line _bfd_nosymbols_find_line
+#endif
+#ifndef MY_find_inliner_info
+#define MY_find_inliner_info _bfd_nosymbols_find_inliner_info
+#endif
 #ifndef MY_sizeof_headers
 #define MY_sizeof_headers NAME (aout, sizeof_headers)
 #endif
@@ -917,6 +945,9 @@ tic30_aout_set_arch_mach (bfd *abfd,
 #ifndef MY_bfd_gc_sections
 #define MY_bfd_gc_sections bfd_generic_gc_sections
 #endif
+#ifndef MY_bfd_lookup_section_flags
+#define MY_bfd_lookup_section_flags bfd_generic_lookup_section_flags
+#endif
 #ifndef MY_bfd_merge_sections
 #define MY_bfd_merge_sections bfd_generic_merge_sections
 #endif
@@ -930,9 +961,15 @@ tic30_aout_set_arch_mach (bfd *abfd,
 #define MY_section_already_linked \
   _bfd_generic_section_already_linked
 #endif
+#ifndef MY_bfd_define_common_symbol
+#define MY_bfd_define_common_symbol bfd_generic_define_common_symbol
+#endif
 #ifndef MY_bfd_reloc_type_lookup
 #define MY_bfd_reloc_type_lookup tic30_aout_reloc_type_lookup
 #endif
+#ifndef MY_bfd_reloc_name_lookup
+#define MY_bfd_reloc_name_lookup tic30_aout_reloc_name_lookup
+#endif
 #ifndef MY_bfd_make_debug_symbol
 #define MY_bfd_make_debug_symbol 0
 #endif
@@ -945,15 +982,16 @@ tic30_aout_set_arch_mach (bfd *abfd,
 #ifndef MY_bfd_link_hash_table_create
 #define MY_bfd_link_hash_table_create NAME (aout, link_hash_table_create)
 #endif
-#ifndef MY_bfd_link_hash_table_free
-#define MY_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
-#endif
 #ifndef MY_bfd_link_add_symbols
 #define MY_bfd_link_add_symbols NAME (aout, link_add_symbols)
 #endif
 #ifndef MY_bfd_link_just_syms
 #define MY_bfd_link_just_syms _bfd_generic_link_just_syms
 #endif
+#ifndef MY_bfd_copy_link_hash_symbol_type
+#define MY_bfd_copy_link_hash_symbol_type \
+  _bfd_generic_copy_link_hash_symbol_type
+#endif
 #ifndef MY_bfd_link_split_section
 #define MY_bfd_link_split_section  _bfd_generic_link_split_section
 #endif
@@ -1043,6 +1081,7 @@ const bfd_target tic30_aout_vec =
   MY_symbol_leading_char,
   AR_PAD_CHAR,                 /* AR_pad_char.  */
   15,                          /* 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.  */