Don't use BFD_TRADITIONAL_FORMAT flag in COFF support
authorAlan Modra <amodra@gmail.com>
Tue, 1 Dec 2015 01:10:25 +0000 (11:40 +1030)
committerAlan Modra <amodra@gmail.com>
Tue, 1 Dec 2015 03:10:04 +0000 (13:40 +1030)
info->traditional_format is available, or can be easily made
available.  This relegates BFD_TRADITIONAL_FORMAT to AOUT use only.

* coff-rs6000.c (_bfd_xcoff_put_symbol_name): Replace abfd param
with info param.  Test info->traditional_format rather than
BFD_TRADITIONAL_FORMAT flag.
* coff64-rs6000.c (_bfd_xcoff64_put_symbol_name): Likewise.
* libxcoff.h (struct xcoff_backend_data_rec): Update
_xcoff_put_symbol_name prototype.
(bfd_xcoff_put_symbol_name): Add info param.
* xcofflink.c (xcoff_find_tc0): Update bfd_xcoff_put_symbol_name call.
(xcoff_write_global_symbol): Likewise.
(xcoff_link_input_bfd): Test info->traditional_format rather than
BFD_TRADITIONAL_FORMAT flag.
* cofflink.c (_bfd_coff_final_link): Likewise.
(_bfd_coff_link_input_bfd, _bfd_coff_write_global_sym): Likewise.

bfd/ChangeLog
bfd/coff-rs6000.c
bfd/coff64-rs6000.c
bfd/cofflink.c
bfd/libxcoff.h
bfd/xcofflink.c

index bebe839f7e24dcad3884ed7adf920d5ce8d6dba0..eb5cf11441934ed9f1ef90377cdda39f30412962 100644 (file)
@@ -1,3 +1,19 @@
+2015-12-01  Alan Modra  <amodra@gmail.com>
+
+       * coff-rs6000.c (_bfd_xcoff_put_symbol_name): Replace abfd param
+       with info param.  Test info->traditional_format rather than
+       BFD_TRADITIONAL_FORMAT flag.
+       * coff64-rs6000.c (_bfd_xcoff64_put_symbol_name): Likewise.
+       * libxcoff.h (struct xcoff_backend_data_rec): Update
+       _xcoff_put_symbol_name prototype.
+       (bfd_xcoff_put_symbol_name): Add info param.
+       * xcofflink.c (xcoff_find_tc0): Update bfd_xcoff_put_symbol_name call.
+       (xcoff_write_global_symbol): Likewise.
+       (xcoff_link_input_bfd): Test info->traditional_format rather than
+       BFD_TRADITIONAL_FORMAT flag.
+       * cofflink.c (_bfd_coff_final_link): Likewise.
+       (_bfd_coff_link_input_bfd, _bfd_coff_write_global_sym): Likewise.
+
 2015-12-01  Alan Modra  <amodra@gmail.com>
 
        * po/SRC-POTFILES.in: Regenerate.
index b7098a1d9c3b77d8d7849b275686a60a85c73e31..2269012e4dab8e53623e96fa888e62be9c73381d 100644 (file)
@@ -3523,7 +3523,8 @@ _bfd_xcoff_put_ldsymbol_name (bfd *abfd ATTRIBUTE_UNUSED,
 }
 
 static bfd_boolean
-_bfd_xcoff_put_symbol_name (bfd *abfd, struct bfd_strtab_hash *strtab,
+_bfd_xcoff_put_symbol_name (struct bfd_link_info *info,
+                           struct bfd_strtab_hash *strtab,
                            struct internal_syment *sym,
                            const char *name)
 {
@@ -3536,9 +3537,7 @@ _bfd_xcoff_put_symbol_name (bfd *abfd, struct bfd_strtab_hash *strtab,
       bfd_boolean hash;
       bfd_size_type indx;
 
-      hash = TRUE;
-      if ((abfd->flags & BFD_TRADITIONAL_FORMAT) != 0)
-       hash = FALSE;
+      hash = !info->traditional_format;
       indx = _bfd_stringtab_add (strtab, name, hash, FALSE);
       if (indx == (bfd_size_type) -1)
        return FALSE;
index a9da59c400a1cd1955587d1bb7c4e0d1c4ef40c9..ab4106307976f97c7140e1c08adb86b1f0e8a3d6 100644 (file)
@@ -87,7 +87,8 @@ static void _bfd_xcoff64_swap_lineno_in
 static unsigned int _bfd_xcoff64_swap_lineno_out
   (bfd *, void *, void *);
 static bfd_boolean _bfd_xcoff64_put_symbol_name
-  (bfd *, struct bfd_strtab_hash *, struct internal_syment *, const char *);
+  (struct bfd_link_info *, struct bfd_strtab_hash *,
+   struct internal_syment *, const char *);
 static bfd_boolean _bfd_xcoff64_put_ldsymbol_name
   (bfd *, struct xcoff_loader_info *, struct internal_ldsym *, const char *);
 static void _bfd_xcoff64_swap_sym_in
@@ -518,18 +519,15 @@ _bfd_xcoff64_swap_aux_out (bfd *abfd, void *inp, int type, int in_class,
 }
 
 static bfd_boolean
-_bfd_xcoff64_put_symbol_name (bfd *abfd, struct bfd_strtab_hash *strtab,
+_bfd_xcoff64_put_symbol_name (struct bfd_link_info *info,
+                             struct bfd_strtab_hash *strtab,
                               struct internal_syment *sym,
                               const char *name)
 {
   bfd_boolean hash;
   bfd_size_type indx;
 
-  hash = TRUE;
-
-  if ((abfd->flags & BFD_TRADITIONAL_FORMAT) != 0)
-    hash = FALSE;
-
+  hash = !info->traditional_format;
   indx = _bfd_stringtab_add (strtab, name, hash, FALSE);
 
   if (indx == (bfd_size_type) -1)
index 8d98fec2146ecd4de12dee94219f435dd284687e..13d773aca5b4fc00c08f939b538c75c4037514e4 100644 (file)
@@ -906,7 +906,7 @@ _bfd_coff_final_link (bfd *abfd,
 
              if (string_size)
                {
-                 bfd_boolean hash = ! (abfd->flags & BFD_TRADITIONAL_FORMAT);
+                 bfd_boolean hash = !flaginfo.info->traditional_format;
                  bfd_size_type indx;
 
                  indx = _bfd_stringtab_add (flaginfo.strtab,
@@ -1413,7 +1413,7 @@ _bfd_coff_link_input_bfd (struct coff_final_link_info *flaginfo, bfd *input_bfd)
   if (! flaginfo->info->keep_memory)
     copy = TRUE;
   hash = TRUE;
-  if ((output_bfd->flags & BFD_TRADITIONAL_FORMAT) != 0)
+  if (flaginfo->info->traditional_format)
     hash = FALSE;
 
   if (! _bfd_coff_get_external_symbols (input_bfd))
@@ -1591,7 +1591,7 @@ _bfd_coff_link_input_bfd (struct coff_final_link_info *flaginfo, bfd *input_bfd)
       /* If this is an enum, struct, or union tag, see if we have
          already output an identical type.  */
       if (! skip
-         && (flaginfo->output_bfd->flags & BFD_TRADITIONAL_FORMAT) == 0
+         && !flaginfo->info->traditional_format
          && (isym.n_sclass == C_ENTAG
              || isym.n_sclass == C_STRTAG
              || isym.n_sclass == C_UNTAG)
@@ -2602,7 +2602,7 @@ _bfd_coff_write_global_sym (struct bfd_hash_entry *bh, void *data)
       bfd_size_type indx;
 
       hash = TRUE;
-      if ((output_bfd->flags & BFD_TRADITIONAL_FORMAT) != 0)
+      if (flaginfo->info->traditional_format)
        hash = FALSE;
       indx = _bfd_stringtab_add (flaginfo->strtab, h->root.root.string, hash,
                                 FALSE);
index d991dbf373ea6c06c064e5fa881a5842fe937a22..60872d498771eeb4de0f8ebd4d0ed9e7e58c40c0 100644 (file)
@@ -64,8 +64,8 @@ struct xcoff_backend_data_rec
   unsigned long _xcoff_ldhdr_version;
 
   bfd_boolean (* _xcoff_put_symbol_name)
-    (bfd *, struct bfd_strtab_hash *, struct internal_syment *,
-     const char *);
+    (struct bfd_link_info *, struct bfd_strtab_hash *,
+     struct internal_syment *, const char *);
 
   bfd_boolean (* _xcoff_put_ldsymbol_name)
     (bfd *, struct xcoff_loader_info *, struct internal_ldsym *,
@@ -154,8 +154,8 @@ struct xcoff_backend_data_rec
 
 #define bfd_xcoff_ldhdr_version(a) ((xcoff_backend (a)->_xcoff_ldhdr_version))
 
-#define bfd_xcoff_put_symbol_name(a, b, c, d) \
-  ((xcoff_backend (a)->_xcoff_put_symbol_name) ((a), (b), (c), (d)))
+#define bfd_xcoff_put_symbol_name(a, b, c, d, e) \
+  ((xcoff_backend (a)->_xcoff_put_symbol_name) ((b), (c), (d), (e)))
 
 #define bfd_xcoff_put_ldsymbol_name(a, b, c, d) \
   ((xcoff_backend (a)->_xcoff_put_ldsymbol_name) ((a), (b), (c), (d)))
index 75977501a89290f71a48254524a19ac608f314d0..443ff770228e466320fd6ff2bf3a78182143da3c 100644 (file)
@@ -4145,7 +4145,7 @@ xcoff_link_input_bfd (struct xcoff_final_link_info *flinfo,
   if (! flinfo->info->keep_memory)
     copy = TRUE;
   hash = TRUE;
-  if ((output_bfd->flags & BFD_TRADITIONAL_FORMAT) != 0)
+  if (flinfo->info->traditional_format)
     hash = FALSE;
 
   if (! _bfd_coff_get_external_symbols (input_bfd))
@@ -5118,7 +5118,8 @@ xcoff_find_tc0 (bfd *output_bfd, struct xcoff_final_link_info *flinfo)
   xcoff_data (output_bfd)->sntoc = section_index;
 
   /* Fill out the TC0 symbol.  */
-  if (!bfd_xcoff_put_symbol_name (output_bfd, flinfo->strtab, &irsym, "TOC"))
+  if (!bfd_xcoff_put_symbol_name (output_bfd, flinfo->info, flinfo->strtab,
+                                 &irsym, "TOC"))
     return FALSE;
   irsym.n_value = best_address;
   irsym.n_scnum = section_index;
@@ -5383,7 +5384,8 @@ xcoff_write_global_symbol (struct bfd_hash_entry *bh, void * inf)
         the reloc.  */
       if (flinfo->info->strip != strip_all)
        {
-         result = bfd_xcoff_put_symbol_name (output_bfd, flinfo->strtab,
+         result = bfd_xcoff_put_symbol_name (output_bfd, flinfo->info,
+                                             flinfo->strtab,
                                              &irsym, h->root.root.string);
          if (!result)
            return FALSE;
@@ -5557,8 +5559,8 @@ xcoff_write_global_symbol (struct bfd_hash_entry *bh, void * inf)
 
   h->indx = obj_raw_syment_count (output_bfd);
 
-  result = bfd_xcoff_put_symbol_name (output_bfd, flinfo->strtab, &isym,
-                                     h->root.root.string);
+  result = bfd_xcoff_put_symbol_name (output_bfd, flinfo->info, flinfo->strtab,
+                                     &isym, h->root.root.string);
   if (!result)
     return FALSE;