Ignore:
Timestamp:
Aug 16, 2003, 6:59:22 PM (22 years ago)
Author:
bird
Message:

binutils v2.14 - offical sources.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/GNU/src/binutils/bfd/linker.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    11/* linker.c -- BFD linker routines
    2    Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
     2   Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
    33   Free Software Foundation, Inc.
    44   Written by Steve Chamberlain and Ian Lance Taylor, Cygnus Support
    55
    6 This file is part of BFD, the Binary File Descriptor library.
    7 
    8 This program is free software; you can redistribute it and/or modify
    9 it under the terms of the GNU General Public License as published by
    10 the Free Software Foundation; either version 2 of the License, or
    11 (at your option) any later version.
    12 
    13 This program is distributed in the hope that it will be useful,
    14 but WITHOUT ANY WARRANTY; without even the implied warranty of
    15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    16 GNU General Public License for more details.
    17 
    18 You should have received a copy of the GNU General Public License
    19 along with this program; if not, write to the Free Software
    20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
     6   This file is part of BFD, the Binary File Descriptor library.
     7
     8   This program is free software; you can redistribute it and/or modify
     9   it under the terms of the GNU General Public License as published by
     10   the Free Software Foundation; either version 2 of the License, or
     11   (at your option) any later version.
     12
     13   This program is distributed in the hope that it will be useful,
     14   but WITHOUT ANY WARRANTY; without even the implied warranty of
     15   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     16   GNU General Public License for more details.
     17
     18   You should have received a copy of the GNU General Public License
     19   along with this program; if not, write to the Free Software
     20   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
    2121
    2222#include "bfd.h"
     
    201201        routine should save it somewhere attached to the object file
    202202        BFD.  However, the information should only be saved if the
    203         <<keep_memory>> field of the <<info>> argument is true, so
     203        <<keep_memory>> field of the <<info>> argument is TRUE, so
    204204        that the <<-no-keep-memory>> linker switch is effective.
    205205
     
    407407*/
    408408
    409 static boolean generic_link_read_symbols
     409static bfd_boolean generic_link_read_symbols
    410410  PARAMS ((bfd *));
    411 static boolean generic_link_add_symbols
    412   PARAMS ((bfd *, struct bfd_link_info *, boolean collect));
    413 static boolean generic_link_add_object_symbols
    414   PARAMS ((bfd *, struct bfd_link_info *, boolean collect));
    415 static boolean generic_link_check_archive_element_no_collect
    416   PARAMS ((bfd *, struct bfd_link_info *, boolean *pneeded));
    417 static boolean generic_link_check_archive_element_collect
    418   PARAMS ((bfd *, struct bfd_link_info *, boolean *pneeded));
    419 static boolean generic_link_check_archive_element
    420   PARAMS ((bfd *, struct bfd_link_info *, boolean *pneeded, boolean collect));
    421 static boolean generic_link_add_symbol_list
     411static bfd_boolean generic_link_add_symbols
     412  PARAMS ((bfd *, struct bfd_link_info *, bfd_boolean collect));
     413static bfd_boolean generic_link_add_object_symbols
     414  PARAMS ((bfd *, struct bfd_link_info *, bfd_boolean collect));
     415static bfd_boolean generic_link_check_archive_element_no_collect
     416  PARAMS ((bfd *, struct bfd_link_info *, bfd_boolean *pneeded));
     417static bfd_boolean generic_link_check_archive_element_collect
     418  PARAMS ((bfd *, struct bfd_link_info *, bfd_boolean *pneeded));
     419static bfd_boolean generic_link_check_archive_element
     420  PARAMS ((bfd *, struct bfd_link_info *, bfd_boolean *pneeded,
     421           bfd_boolean collect));
     422static bfd_boolean generic_link_add_symbol_list
    422423  PARAMS ((bfd *, struct bfd_link_info *, bfd_size_type count, asymbol **,
    423            boolean collect));
    424 static bfd *hash_entry_bfd PARAMS ((struct bfd_link_hash_entry *));
     424           bfd_boolean collect));
     425static bfd *hash_entry_bfd
     426  PARAMS ((struct bfd_link_hash_entry *));
    425427static void set_symbol_from_hash
    426428  PARAMS ((asymbol *, struct bfd_link_hash_entry *));
    427 static boolean generic_add_output_symbol
     429static bfd_boolean generic_add_output_symbol
    428430  PARAMS ((bfd *, size_t *psymalloc, asymbol *));
    429 static boolean default_fill_link_order
     431static bfd_boolean default_data_link_order
    430432  PARAMS ((bfd *, struct bfd_link_info *, asection *,
    431433           struct bfd_link_order *));
    432 static boolean default_indirect_link_order
     434static bfd_boolean default_indirect_link_order
    433435  PARAMS ((bfd *, struct bfd_link_info *, asection *,
    434            struct bfd_link_order *, boolean));
     436           struct bfd_link_order *, bfd_boolean));
    435437
    436438/* The link hash table structure is defined in bfdlink.h.  It provides
     
    446448     const char *string;
    447449{
    448   struct bfd_link_hash_entry *ret = (struct bfd_link_hash_entry *) entry;
    449 
    450450  /* Allocate the structure if it has not already been allocated by a
    451451     subclass.  */
    452   if (ret == (struct bfd_link_hash_entry *) NULL)
    453     ret = ((struct bfd_link_hash_entry *)
    454            bfd_hash_allocate (table, sizeof (struct bfd_link_hash_entry)));
    455   if (ret == (struct bfd_link_hash_entry *) NULL)
    456     return NULL;
     452  if (entry == NULL)
     453    {
     454      entry = (struct bfd_hash_entry *)
     455        bfd_hash_allocate (table, sizeof (struct bfd_link_hash_entry));
     456      if (entry == NULL)
     457        return entry;
     458    }
    457459
    458460  /* Call the allocation method of the superclass.  */
    459   ret = ((struct bfd_link_hash_entry *)
    460          bfd_hash_newfunc ((struct bfd_hash_entry *) ret, table, string));
    461 
    462   if (ret)
    463     {
     461  entry = bfd_hash_newfunc (entry, table, string);
     462  if (entry)
     463    {
     464      struct bfd_link_hash_entry *h = (struct bfd_link_hash_entry *) entry;
     465
    464466      /* Initialize the local fields.  */
    465       ret->type = bfd_link_hash_new;
    466       ret->next = NULL;
    467     }
    468 
    469   return (struct bfd_hash_entry *) ret;
     467      h->type = bfd_link_hash_new;
     468      h->next = NULL;
     469    }
     470
     471  return entry;
    470472}
    471473
     
    473475   responsible for creating this table.  */
    474476
    475 boolean
     477bfd_boolean
    476478_bfd_link_hash_table_init (table, abfd, newfunc)
    477479     struct bfd_link_hash_table *table;
     
    484486  table->undefs = NULL;
    485487  table->undefs_tail = NULL;
     488  table->type = bfd_link_generic_hash_table;
     489
    486490  return bfd_hash_table_init (&table->table, newfunc);
    487491}
    488492
    489 /* Look up a symbol in a link hash table.  If follow is true, we
     493/* Look up a symbol in a link hash table.  If follow is TRUE, we
    490494   follow bfd_link_hash_indirect and bfd_link_hash_warning links to
    491495   the real symbol.  */
     
    495499     struct bfd_link_hash_table *table;
    496500     const char *string;
    497      boolean create;
    498      boolean copy;
    499      boolean follow;
     501     bfd_boolean create;
     502     bfd_boolean copy;
     503     bfd_boolean follow;
    500504{
    501505  struct bfd_link_hash_entry *ret;
     
    523527     struct bfd_link_info *info;
    524528     const char *string;
    525      boolean create;
    526      boolean copy;
    527      boolean follow;
    528 {
     529     bfd_boolean create;
     530     bfd_boolean copy;
     531     bfd_boolean follow;
     532{
     533  bfd_size_type amt;
     534
    529535  if (info->wrap_hash != NULL)
    530536    {
     
    538544#define WRAP "__wrap_"
    539545
    540       if (bfd_hash_lookup (info->wrap_hash, l, false, false) != NULL)
     546      if (bfd_hash_lookup (info->wrap_hash, l, FALSE, FALSE) != NULL)
    541547        {
    542548          char *n;
     
    546552             references to SYM with references to __wrap_SYM.  */
    547553
    548           n = (char *) bfd_malloc (strlen (l) + sizeof WRAP + 1);
     554          amt = strlen (l) + sizeof WRAP + 1;
     555          n = (char *) bfd_malloc (amt);
    549556          if (n == NULL)
    550557            return NULL;
     
    555562          strcat (n, WRAP);
    556563          strcat (n, l);
    557           h = bfd_link_hash_lookup (info->hash, n, create, true, follow);
     564          h = bfd_link_hash_lookup (info->hash, n, create, TRUE, follow);
    558565          free (n);
    559566          return h;
     
    568575          && strncmp (l, REAL, sizeof REAL - 1) == 0
    569576          && bfd_hash_lookup (info->wrap_hash, l + sizeof REAL - 1,
    570                               false, false) != NULL)
     577                              FALSE, FALSE) != NULL)
    571578        {
    572579          char *n;
     
    577584             with references to SYM.  */
    578585
    579           n = (char *) bfd_malloc (strlen (l + sizeof REAL - 1) + 2);
     586          amt = strlen (l + sizeof REAL - 1) + 2;
     587          n = (char *) bfd_malloc (amt);
    580588          if (n == NULL)
    581589            return NULL;
     
    585593          n[1] = '\0';
    586594          strcat (n, l + sizeof REAL - 1);
    587           h = bfd_link_hash_lookup (info->hash, n, create, true, follow);
     595          h = bfd_link_hash_lookup (info->hash, n, create, TRUE, follow);
    588596          free (n);
    589597          return h;
     
    605613bfd_link_hash_traverse (table, func, info)
    606614     struct bfd_link_hash_table *table;
    607      boolean (*func) PARAMS ((struct bfd_link_hash_entry *, PTR));
     615     bfd_boolean (*func) PARAMS ((struct bfd_link_hash_entry *, PTR));
    608616     PTR info;
    609617{
    610618  bfd_hash_traverse (&table->table,
    611                      ((boolean (*) PARAMS ((struct bfd_hash_entry *, PTR)))
     619                     ((bfd_boolean (*) PARAMS ((struct bfd_hash_entry *, PTR)))
    612620                      func),
    613621                     info);
     
    630638
    631639
    632 /* Routine to create an entry in an generic link hash table.  */
     640/* Routine to create an entry in a generic link hash table.  */
    633641
    634642struct bfd_hash_entry *
     
    638646     const char *string;
    639647{
    640   struct generic_link_hash_entry *ret =
    641     (struct generic_link_hash_entry *) entry;
    642 
    643648  /* Allocate the structure if it has not already been allocated by a
    644649     subclass.  */
    645   if (ret == (struct generic_link_hash_entry *) NULL)
    646     ret = ((struct generic_link_hash_entry *)
    647            bfd_hash_allocate (table, sizeof (struct generic_link_hash_entry)));
    648   if (ret == (struct generic_link_hash_entry *) NULL)
    649     return NULL;
     650  if (entry == NULL)
     651    {
     652      entry = (struct bfd_hash_entry *)
     653        bfd_hash_allocate (table, sizeof (struct generic_link_hash_entry));
     654      if (entry == NULL)
     655        return entry;
     656    }
    650657
    651658  /* Call the allocation method of the superclass.  */
    652   ret = ((struct generic_link_hash_entry *)
    653          _bfd_link_hash_newfunc ((struct bfd_hash_entry *) ret,
    654                                  table, string));
    655 
    656   if (ret)
    657     {
     659  entry = _bfd_link_hash_newfunc (entry, table, string);
     660  if (entry)
     661    {
     662      struct generic_link_hash_entry *ret;
     663
    658664      /* Set local fields.  */
    659       ret->written = false;
     665      ret = (struct generic_link_hash_entry *) entry;
     666      ret->written = FALSE;
    660667      ret->sym = NULL;
    661668    }
    662669
    663   return (struct bfd_hash_entry *) ret;
    664 }
    665 
    666 /* Create an generic link hash table.  */
     670  return entry;
     671}
     672
     673/* Create a generic link hash table.  */
    667674
    668675struct bfd_link_hash_table *
     
    671678{
    672679  struct generic_link_hash_table *ret;
    673 
    674   ret = ((struct generic_link_hash_table *)
    675          bfd_alloc (abfd, sizeof (struct generic_link_hash_table)));
     680  bfd_size_type amt = sizeof (struct generic_link_hash_table);
     681
     682  ret = (struct generic_link_hash_table *) bfd_malloc (amt);
    676683  if (ret == NULL)
    677684    return (struct bfd_link_hash_table *) NULL;
     
    683690    }
    684691  return &ret->root;
     692}
     693
     694void
     695_bfd_generic_link_hash_table_free (hash)
     696     struct bfd_link_hash_table *hash;
     697{
     698  struct generic_link_hash_table *ret
     699    = (struct generic_link_hash_table *) hash;
     700
     701  bfd_hash_table_free (&ret->root.table);
     702  free (ret);
    685703}
    686704
     
    692710   structure.  */
    693711
    694 static boolean
     712static bfd_boolean
    695713generic_link_read_symbols (abfd)
    696714     bfd *abfd;
     
    703721      symsize = bfd_get_symtab_upper_bound (abfd);
    704722      if (symsize < 0)
    705         return false;
    706       bfd_get_outsymbols (abfd) = (asymbol **) bfd_alloc (abfd, symsize);
     723        return FALSE;
     724      bfd_get_outsymbols (abfd) =
     725        (asymbol **) bfd_alloc (abfd, (bfd_size_type) symsize);
    707726      if (bfd_get_outsymbols (abfd) == NULL && symsize != 0)
    708         return false;
     727        return FALSE;
    709728      symcount = bfd_canonicalize_symtab (abfd, bfd_get_outsymbols (abfd));
    710729      if (symcount < 0)
    711         return false;
     730        return FALSE;
    712731      bfd_get_symcount (abfd) = symcount;
    713732    }
    714733
    715   return true;
     734  return TRUE;
    716735}
    717736
     
    721740   constructors by name.  */
    722741
    723 boolean
     742bfd_boolean
    724743_bfd_generic_link_add_symbols (abfd, info)
    725744     bfd *abfd;
    726745     struct bfd_link_info *info;
    727746{
    728   return generic_link_add_symbols (abfd, info, false);
     747  return generic_link_add_symbols (abfd, info, FALSE);
    729748}
    730749
     
    736755   for which gcc uses collect2 and do not support stabs.  */
    737756
    738 boolean
     757bfd_boolean
    739758_bfd_generic_link_add_symbols_collect (abfd, info)
    740759     bfd *abfd;
    741760     struct bfd_link_info *info;
    742761{
    743   return generic_link_add_symbols (abfd, info, true);
     762  return generic_link_add_symbols (abfd, info, TRUE);
     763}
     764
     765/* Indicate that we are only retrieving symbol values from this
     766   section.  We want the symbols to act as though the values in the
     767   file are absolute.  */
     768
     769void
     770_bfd_generic_link_just_syms (sec, info)
     771     asection *sec;
     772     struct bfd_link_info *info ATTRIBUTE_UNUSED;
     773{
     774  sec->output_section = bfd_abs_section_ptr;
     775  sec->output_offset = sec->vma;
    744776}
    745777
    746778/* Add symbols from an object file to the global hash table.  */
    747779
    748 static boolean
     780static bfd_boolean
    749781generic_link_add_symbols (abfd, info, collect)
    750782     bfd *abfd;
    751783     struct bfd_link_info *info;
    752      boolean collect;
    753 {
    754   boolean ret;
     784     bfd_boolean collect;
     785{
     786  bfd_boolean ret;
    755787
    756788  switch (bfd_get_format (abfd))
     
    768800    default:
    769801      bfd_set_error (bfd_error_wrong_format);
    770       ret = false;
     802      ret = FALSE;
    771803    }
    772804
     
    776808/* Add symbols from an object file to the global hash table.  */
    777809
    778 static boolean
     810static bfd_boolean
    779811generic_link_add_object_symbols (abfd, info, collect)
    780812     bfd *abfd;
    781813     struct bfd_link_info *info;
    782      boolean collect;
    783 {
     814     bfd_boolean collect;
     815{
     816  bfd_size_type symcount;
     817  struct symbol_cache_entry **outsyms;
     818
    784819  if (! generic_link_read_symbols (abfd))
    785     return false;
    786   return generic_link_add_symbol_list (abfd, info,
    787                                        _bfd_generic_link_get_symcount (abfd),
    788                                        _bfd_generic_link_get_symbols (abfd),
    789                                        collect);
     820    return FALSE;
     821  symcount = _bfd_generic_link_get_symcount (abfd);
     822  outsyms = _bfd_generic_link_get_symbols (abfd);
     823  return generic_link_add_symbol_list (abfd, info, symcount, outsyms, collect);
    790824}
    791825
     
    799833{
    800834  struct archive_list *next;
    801   int indx;
     835  unsigned int indx;
    802836};
    803837
     
    820854static struct bfd_hash_entry *archive_hash_newfunc
    821855  PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
    822 static boolean archive_hash_table_init
     856static bfd_boolean archive_hash_table_init
    823857  PARAMS ((struct archive_hash_table *,
    824858           struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
     
    859893/* Initialize an archive hash table.  */
    860894
    861 static boolean
     895static bfd_boolean
    862896archive_hash_table_init (table, newfunc)
    863897     struct archive_hash_table *table;
     
    899933
    900934   The CHECKFN argument is used to see if an object file should be
    901    included.  CHECKFN should set *PNEEDED to true if the object file
     935   included.  CHECKFN should set *PNEEDED to TRUE if the object file
    902936   should be included, and must also call the bfd_link_info
    903937   add_archive_element callback function and handle adding the symbols
    904    to the global hash table.  CHECKFN should only return false if some
     938   to the global hash table.  CHECKFN should only return FALSE if some
    905939   sort of error occurs.
    906940
     
    916950   object file to be included.  */
    917951
    918 boolean
     952bfd_boolean
    919953_bfd_generic_link_add_archive_symbols (abfd, info, checkfn)
    920954     bfd *abfd;
    921955     struct bfd_link_info *info;
    922      boolean (*checkfn) PARAMS ((bfd *, struct bfd_link_info *,
    923                                  boolean *pneeded));
     956     bfd_boolean (*checkfn)
     957       PARAMS ((bfd *, struct bfd_link_info *, bfd_boolean *pneeded));
    924958{
    925959  carsym *arsyms;
     
    928962  int pass;
    929963  struct archive_hash_table arsym_hash;
    930   int indx;
     964  unsigned int indx;
    931965  struct bfd_link_hash_entry **pundef;
    932966
     
    935969      /* An empty archive is a special case.  */
    936970      if (bfd_openr_next_archived_file (abfd, (bfd *) NULL) == NULL)
    937         return true;
     971        return TRUE;
    938972      bfd_set_error (bfd_error_no_armap);
    939       return false;
     973      return FALSE;
    940974    }
    941975
     
    946980     this archive, we build a hash table of the symbols.  */
    947981  if (! archive_hash_table_init (&arsym_hash, archive_hash_newfunc))
    948     return false;
     982    return FALSE;
    949983  for (arsym = arsyms, indx = 0; arsym < arsym_end; arsym++, indx++)
    950984    {
     
    952986      struct archive_list *l, **pp;
    953987
    954       arh = archive_hash_lookup (&arsym_hash, arsym->name, true, false);
     988      arh = archive_hash_lookup (&arsym_hash, arsym->name, TRUE, FALSE);
    955989      if (arh == (struct archive_hash_entry *) NULL)
    956990        goto error_return;
     
    10041038
    10051039      /* Look for this symbol in the archive symbol map.  */
    1006       arh = archive_hash_lookup (&arsym_hash, h->root.string, false, false);
     1040      arh = archive_hash_lookup (&arsym_hash, h->root.string, FALSE, FALSE);
    10071041      if (arh == (struct archive_hash_entry *) NULL)
    10081042        {
    1009           pundef = &(*pundef)->next;
    1010           continue;
     1043          /* If we haven't found the exact symbol we're looking for,
     1044             let's look for its import thunk */
     1045          if (info->pei386_auto_import)
     1046            {
     1047              bfd_size_type amt = strlen (h->root.string) + 10;
     1048              char *buf = (char *) bfd_malloc (amt);
     1049              if (buf == NULL)
     1050                return FALSE;
     1051
     1052              sprintf (buf, "__imp_%s", h->root.string);
     1053              arh = archive_hash_lookup (&arsym_hash, buf, FALSE, FALSE);
     1054              free(buf);
     1055            }
     1056          if (arh == (struct archive_hash_entry *) NULL)
     1057            {
     1058              pundef = &(*pundef)->next;
     1059              continue;
     1060            }
    10111061        }
    1012 
    10131062      /* Look at all the objects which define this symbol.  */
    10141063      for (l = arh->defs; l != (struct archive_list *) NULL; l = l->next)
    10151064        {
    10161065          bfd *element;
    1017           boolean needed;
     1066          bfd_boolean needed;
    10181067
    10191068          /* If the symbol has gotten defined along the way, quit.  */
     
    10641113  abfd->archive_pass = pass;
    10651114
    1066   return true;
     1115  return TRUE;
    10671116
    10681117 error_return:
    10691118  archive_hash_table_free (&arsym_hash);
    1070   return false;
     1119  return FALSE;
    10711120}
    10721121
     
    10771126   for finding them.  */
    10781127
    1079 static boolean
     1128static bfd_boolean
    10801129generic_link_check_archive_element_no_collect (abfd, info, pneeded)
    10811130     bfd *abfd;
    10821131     struct bfd_link_info *info;
    1083      boolean *pneeded;
    1084 {
    1085   return generic_link_check_archive_element (abfd, info, pneeded, false);
     1132     bfd_boolean *pneeded;
     1133{
     1134  return generic_link_check_archive_element (abfd, info, pneeded, FALSE);
    10861135}
    10871136
     
    10901139   symbol name, as collect2 does.  */
    10911140
    1092 static boolean
     1141static bfd_boolean
    10931142generic_link_check_archive_element_collect (abfd, info, pneeded)
    10941143     bfd *abfd;
    10951144     struct bfd_link_info *info;
    1096      boolean *pneeded;
    1097 {
    1098   return generic_link_check_archive_element (abfd, info, pneeded, true);
     1145     bfd_boolean *pneeded;
     1146{
     1147  return generic_link_check_archive_element (abfd, info, pneeded, TRUE);
    10991148}
    11001149
     
    11021151   constructors.  */
    11031152
    1104 static boolean
     1153static bfd_boolean
    11051154generic_link_check_archive_element (abfd, info, pneeded, collect)
    11061155     bfd *abfd;
    11071156     struct bfd_link_info *info;
    1108      boolean *pneeded;
    1109      boolean collect;
     1157     bfd_boolean *pneeded;
     1158     bfd_boolean collect;
    11101159{
    11111160  asymbol **pp, **ppend;
    11121161
    1113   *pneeded = false;
     1162  *pneeded = FALSE;
    11141163
    11151164  if (! generic_link_read_symbols (abfd))
    1116     return false;
     1165    return FALSE;
    11171166
    11181167  pp = _bfd_generic_link_get_symbols (abfd);
     
    11351184         a reference when pulling files out of an archive.  See the
    11361185         SVR4 ABI, p. 4-27.  */
    1137       h = bfd_link_hash_lookup (info->hash, bfd_asymbol_name (p), false,
    1138                                 false, true);
     1186      h = bfd_link_hash_lookup (info->hash, bfd_asymbol_name (p), FALSE,
     1187                                FALSE, TRUE);
    11391188      if (h == (struct bfd_link_hash_entry *) NULL
    11401189          || (h->type != bfd_link_hash_undefined
     
    11521201          if (! (*info->callbacks->add_archive_element) (info, abfd,
    11531202                                                         bfd_asymbol_name (p)))
    1154             return false;
     1203            return FALSE;
    11551204          symcount = _bfd_generic_link_get_symcount (abfd);
    11561205          symbols = _bfd_generic_link_get_symbols (abfd);
    11571206          if (! generic_link_add_symbol_list (abfd, info, symcount,
    11581207                                              symbols, collect))
    1159             return false;
    1160           *pneeded = true;
    1161           return true;
     1208            return FALSE;
     1209          *pneeded = TRUE;
     1210          return TRUE;
    11621211        }
    11631212
     
    11781227              if (! (*info->callbacks->add_archive_element)
    11791228                  (info, abfd, bfd_asymbol_name (p)))
    1180                 return false;
    1181               *pneeded = true;
    1182               return true;
     1229                return FALSE;
     1230              *pneeded = TRUE;
     1231              return TRUE;
    11831232            }
    11841233
     
    11961245                                sizeof (struct bfd_link_hash_common_entry)));
    11971246          if (h->u.c.p == NULL)
    1198             return false;
     1247            return FALSE;
    11991248
    12001249          size = bfd_asymbol_value (p);
     
    12251274
    12261275  /* This archive element is not needed.  */
    1227   return true;
     1276  return TRUE;
    12281277}
    12291278
     
    12311280   is the object file.  INFO is the linker information.  SYMBOL_COUNT
    12321281   is the number of symbols.  SYMBOLS is the list of symbols.  COLLECT
    1233    is true if constructors should be automatically collected by name
     1282   is TRUE if constructors should be automatically collected by name
    12341283   as is done by collect2.  */
    12351284
    1236 static boolean
     1285static bfd_boolean
    12371286generic_link_add_symbol_list (abfd, info, symbol_count, symbols, collect)
    12381287     bfd *abfd;
     
    12401289     bfd_size_type symbol_count;
    12411290     asymbol **symbols;
    1242      boolean collect;
     1291     bfd_boolean collect;
    12431292{
    12441293  asymbol **pp, **ppend;
     
    12641313          const char *string;
    12651314          struct generic_link_hash_entry *h;
     1315          struct bfd_link_hash_entry *bh;
    12661316
    12671317          name = bfd_asymbol_name (p);
     
    12851335            string = NULL;
    12861336
    1287           h = NULL;
     1337          bh = NULL;
    12881338          if (! (_bfd_generic_link_add_one_symbol
    12891339                 (info, abfd, name, p->flags, bfd_get_section (p),
    1290                   p->value, string, false, collect,
    1291                   (struct bfd_link_hash_entry **) &h)))
    1292             return false;
     1340                  p->value, string, FALSE, collect, &bh)))
     1341            return FALSE;
     1342          h = (struct generic_link_hash_entry *) bh;
    12931343
    12941344          /* If this is a constructor symbol, and the linker didn't do
     
    13361386    }
    13371387
    1338   return true;
     1388  return TRUE;
    13391389}
    13401390
     
    14011451  /* DEF_ROW    */  {DEF,   DEF,   DEF,   MDEF,  DEF,   CDEF,  MDEF,  CYCLE },
    14021452  /* DEFW_ROW   */  {DEFW,  DEFW,  DEFW,  NOACT, NOACT, NOACT, NOACT, CYCLE },
    1403   /* COMMON_ROW */  {COM,   COM,   COM,   CREF,  CREF,  BIG,   REFC,  WARNC },
     1453  /* COMMON_ROW */  {COM,   COM,   COM,   CREF,  COM,   BIG,   REFC,  WARNC },
    14041454  /* INDR_ROW   */  {IND,   IND,   IND,   MDEF,  IND,   CIND,  MIND,  CYCLE },
    1405   /* WARN_ROW   */  {MWARN, WARN,  WARN,  CWARN, CWARN, WARN,  CWARN, MWARN },
     1455  /* WARN_ROW   */  {MWARN, WARN,  WARN,  CWARN, CWARN, WARN,  CWARN, NOACT },
    14061456  /* SET_ROW    */  {SET,   SET,   SET,   SET,   SET,   SET,   CYCLE, CYCLE }
    14071457};
     
    14641514     the name of the symbol to indirect to, or a warning symbol, in
    14651515     which case it is the warning string.
    1466    COPY is true if NAME or STRING must be copied into locally
     1516   COPY is TRUE if NAME or STRING must be copied into locally
    14671517     allocated memory if they need to be saved.
    1468    COLLECT is true if we should automatically collect gcc constructor
     1518   COLLECT is TRUE if we should automatically collect gcc constructor
    14691519     or destructor names as collect2 does.
    14701520   HASHP, if not NULL, is a place to store the created hash table
     
    14721522     the hash table entry, and stored it in *HASHP.  */
    14731523
    1474 boolean
     1524bfd_boolean
    14751525_bfd_generic_link_add_one_symbol (info, abfd, name, flags, section, value,
    14761526                                  string, copy, collect, hashp)
     
    14821532     bfd_vma value;
    14831533     const char *string;
    1484      boolean copy;
    1485      boolean collect;
     1534     bfd_boolean copy;
     1535     bfd_boolean collect;
    14861536     struct bfd_link_hash_entry **hashp;
    14871537{
    14881538  enum link_row row;
    14891539  struct bfd_link_hash_entry *h;
    1490   boolean cycle;
     1540  bfd_boolean cycle;
    14911541
    14921542  if (bfd_is_ind_section (section)
     
    15161566    {
    15171567      if (row == UNDEF_ROW || row == UNDEFW_ROW)
    1518         h = bfd_wrapped_link_hash_lookup (abfd, info, name, true, copy, false);
     1568        h = bfd_wrapped_link_hash_lookup (abfd, info, name, TRUE, copy, FALSE);
    15191569      else
    1520         h = bfd_link_hash_lookup (info->hash, name, true, copy, false);
     1570        h = bfd_link_hash_lookup (info->hash, name, TRUE, copy, FALSE);
    15211571      if (h == NULL)
    15221572        {
    15231573          if (hashp != NULL)
    15241574            *hashp = NULL;
    1525           return false;
     1575          return FALSE;
    15261576        }
    15271577    }
     
    15291579  if (info->notice_all
    15301580      || (info->notice_hash != (struct bfd_hash_table *) NULL
    1531           && (bfd_hash_lookup (info->notice_hash, name, false, false)
     1581          && (bfd_hash_lookup (info->notice_hash, name, FALSE, FALSE)
    15321582              != (struct bfd_hash_entry *) NULL)))
    15331583    {
    15341584      if (! (*info->callbacks->notice) (info, h->root.string, abfd, section,
    15351585                                        value))
    1536         return false;
     1586        return FALSE;
    15371587    }
    15381588
     
    15441594      enum link_action action;
    15451595
    1546       cycle = false;
     1596      cycle = FALSE;
    15471597      action = link_action[(int) row][(int) h->type];
    15481598      switch (action)
     
    15761626                  h->u.c.p->section->owner, bfd_link_hash_common, h->u.c.size,
    15771627                  abfd, bfd_link_hash_defined, (bfd_vma) 0)))
    1578             return false;
     1628            return FALSE;
    15791629          /* Fall through.  */
    15801630        case DEF:
     
    16341684
    16351685                        if (! ((*info->callbacks->constructor)
    1636                                (info,
    1637                                 c == 'I' ? true : false,
     1686                               (info, c == 'I',
    16381687                                h->root.string, abfd, section, value)))
    1639                           return false;
     1688                          return FALSE;
    16401689                      }
    16411690                  }
     
    16551704                                sizeof (struct bfd_link_hash_common_entry)));
    16561705          if (h->u.c.p == NULL)
    1657             return false;
     1706            return FALSE;
    16581707
    16591708          h->u.c.size = value;
     
    17041753          /* We have found a common definition for a symbol which
    17051754             already had a common definition.  Use the maximum of the
    1706              two sizes.  */
     1755             two sizes, and use the section required by the larger symbol.  */
    17071756          BFD_ASSERT (h->type == bfd_link_hash_common);
    17081757          if (! ((*info->callbacks->multiple_common)
     
    17101759                  h->u.c.p->section->owner, bfd_link_hash_common, h->u.c.size,
    17111760                  abfd, bfd_link_hash_common, value)))
    1712             return false;
     1761            return FALSE;
    17131762          if (value > h->u.c.size)
    17141763            {
     
    17231772                power = 4;
    17241773              h->u.c.p->alignment_power = power;
     1774
     1775              /* Some systems have special treatment for small commons,
     1776                 hence we want to select the section used by the larger
     1777                 symbol.  This makes sure the symbol does not go in a
     1778                 small common section if it is now too large.  */
     1779              if (section == bfd_com_section_ptr)
     1780                {
     1781                  h->u.c.p->section
     1782                    = bfd_make_section_old_way (abfd, "COMMON");
     1783                  h->u.c.p->section->flags = SEC_ALLOC;
     1784                }
     1785              else if (section->owner != abfd)
     1786                {
     1787                  h->u.c.p->section
     1788                    = bfd_make_section_old_way (abfd, section->name);
     1789                  h->u.c.p->section->flags = SEC_ALLOC;
     1790                }
     1791              else
     1792                h->u.c.p->section = section;
    17251793            }
    17261794          break;
     
    17421810                   (info, h->root.string, obfd, h->type, (bfd_vma) 0,
    17431811                    abfd, bfd_link_hash_common, value)))
    1744               return false;
     1812              return FALSE;
    17451813          }
    17461814          break;
     
    17541822        case MDEF:
    17551823          /* Handle a multiple definition.  */
    1756           {
    1757             asection *msec = NULL;
    1758             bfd_vma mval = 0;
    1759 
    1760             switch (h->type)
    1761               {
    1762               case bfd_link_hash_defined:
    1763                 msec = h->u.def.section;
    1764                 mval = h->u.def.value;
     1824          if (!info->allow_multiple_definition)
     1825            {
     1826              asection *msec = NULL;
     1827              bfd_vma mval = 0;
     1828
     1829              switch (h->type)
     1830                {
     1831                case bfd_link_hash_defined:
     1832                  msec = h->u.def.section;
     1833                  mval = h->u.def.value;
     1834                  break;
     1835                case bfd_link_hash_indirect:
     1836                  msec = bfd_ind_section_ptr;
     1837                  mval = 0;
     1838                  break;
     1839                default:
     1840                  abort ();
     1841                }
     1842
     1843              /* Ignore a redefinition of an absolute symbol to the
     1844                 same value; it's harmless.  */
     1845              if (h->type == bfd_link_hash_defined
     1846                  && bfd_is_abs_section (msec)
     1847                  && bfd_is_abs_section (section)
     1848                  && value == mval)
    17651849                break;
    1766               case bfd_link_hash_indirect:
    1767                 msec = bfd_ind_section_ptr;
    1768                 mval = 0;
    1769                 break;
    1770               default:
    1771                 abort ();
    1772               }
    1773 
    1774             /* Ignore a redefinition of an absolute symbol to the same
    1775                value; it's harmless.  */
    1776             if (h->type == bfd_link_hash_defined
    1777                 && bfd_is_abs_section (msec)
    1778                 && bfd_is_abs_section (section)
    1779                 && value == mval)
    1780               break;
    1781 
    1782             if (! ((*info->callbacks->multiple_definition)
    1783                    (info, h->root.string, msec->owner, msec, mval, abfd,
    1784                     section, value)))
    1785               return false;
    1786           }
     1850
     1851              if (! ((*info->callbacks->multiple_definition)
     1852                     (info, h->root.string, msec->owner, msec, mval,
     1853                      abfd, section, value)))
     1854                return FALSE;
     1855            }
    17871856          break;
    17881857
     
    17941863                  h->u.c.p->section->owner, bfd_link_hash_common, h->u.c.size,
    17951864                  abfd, bfd_link_hash_indirect, (bfd_vma) 0)))
    1796             return false;
     1865            return FALSE;
    17971866          /* Fall through.  */
    17981867        case IND:
     
    18031872            /* STRING is the name of the symbol we want to indirect
    18041873               to.  */
    1805             inh = bfd_wrapped_link_hash_lookup (abfd, info, string, true,
    1806                                                 copy, false);
     1874            inh = bfd_wrapped_link_hash_lookup (abfd, info, string, TRUE,
     1875                                                copy, FALSE);
    18071876            if (inh == (struct bfd_link_hash_entry *) NULL)
    1808               return false;
     1877              return FALSE;
    18091878            if (inh->type == bfd_link_hash_indirect
    18101879                && inh->u.i.link == h)
    18111880              {
    18121881                (*_bfd_error_handler)
    1813                   (_("%s: indirect symbol `%s' to `%s' is a loop"), 
    1814                    bfd_get_filename (abfd), name, string);
     1882                  (_("%s: indirect symbol `%s' to `%s' is a loop"),
     1883                   bfd_archive_filename (abfd), name, string);
    18151884                bfd_set_error (bfd_error_invalid_operation);
    1816                 return false;
     1885                return FALSE;
    18171886              }
    18181887            if (inh->type == bfd_link_hash_new)
     
    18291898              {
    18301899                row = UNDEF_ROW;
    1831                 cycle = true;
     1900                cycle = TRUE;
    18321901              }
    18331902
     
    18411910          if (! (*info->callbacks->add_to_set) (info, h, BFD_RELOC_CTOR,
    18421911                                                abfd, section, value))
    1843             return false;
     1912            return FALSE;
    18441913          break;
    18451914
     
    18521921                                                 (asection *) NULL,
    18531922                                                 (bfd_vma) 0))
    1854                 return false;
     1923                return FALSE;
    18551924              /* Only issue a warning once.  */
    18561925              h->u.i.warning = NULL;
     
    18601929          /* Try again with the referenced symbol.  */
    18611930          h = h->u.i.link;
    1862           cycle = true;
     1931          cycle = TRUE;
    18631932          break;
    18641933
     
    18681937            h->next = h;
    18691938          h = h->u.i.link;
    1870           cycle = true;
     1939          cycle = TRUE;
    18711940          break;
    18721941
     
    18761945                                             hash_entry_bfd (h),
    18771946                                             (asection *) NULL, (bfd_vma) 0))
    1878             return false;
     1947            return FALSE;
    18791948          break;
    18801949
     
    18911960                                                 (asection *) NULL,
    18921961                                                 (bfd_vma) 0))
    1893                 return false;
     1962                return FALSE;
    18941963              break;
    18951964            }
     
    19061975                     h->root.string)));
    19071976            if (sub == NULL)
    1908               return false;
     1977              return FALSE;
    19091978            *sub = *h;
    19101979            sub->type = bfd_link_hash_warning;
     
    19151984              {
    19161985                char *w;
    1917 
    1918                 w = bfd_hash_allocate (&info->hash->table,
    1919                                        strlen (string) + 1);
     1986                size_t len = strlen (string) + 1;
     1987
     1988                w = bfd_hash_allocate (&info->hash->table, len);
    19201989                if (w == NULL)
    1921                   return false;
    1922                 strcpy (w, string);
     1990                  return FALSE;
     1991                memcpy (w, string, len);
    19231992                sub->u.i.warning = w;
    19241993              }
     
    19352004  while (cycle);
    19362005
    1937   return true;
     2006  return TRUE;
    19382007}
    19392008
     
    19412010/* Generic final link routine.  */
    19422011
    1943 boolean
     2012bfd_boolean
    19442013_bfd_generic_final_link (abfd, info)
    19452014     bfd *abfd;
     
    19602029    for (p = o->link_order_head; p != NULL; p = p->next)
    19612030      if (p->type == bfd_indirect_link_order)
    1962         p->u.indirect.section->linker_mark = true;
     2031        p->u.indirect.section->linker_mark = TRUE;
    19632032
    19642033  /* Build the output symbol table.  */
    19652034  for (sub = info->input_bfds; sub != (bfd *) NULL; sub = sub->link_next)
    19662035    if (! _bfd_generic_link_output_symbols (abfd, sub, info, &outsymalloc))
    1967       return false;
     2036      return FALSE;
    19682037
    19692038  /* Accumulate the global symbols.  */
     
    19792048     code still expects one.  */
    19802049  if (! generic_add_output_symbol (abfd, &outsymalloc, NULL))
    1981     return false;
     2050    return FALSE;
    19822051
    19832052  if (info->relocateable)
     
    20102079                                                       input_section);
    20112080                  if (relsize < 0)
    2012                     return false;
    2013                   relocs = (arelent **) bfd_malloc ((size_t) relsize);
     2081                    return FALSE;
     2082                  relocs = (arelent **) bfd_malloc ((bfd_size_type) relsize);
    20142083                  if (!relocs && relsize != 0)
    2015                     return false;
     2084                    return FALSE;
    20162085                  symbols = _bfd_generic_link_get_symbols (input_bfd);
    20172086                  reloc_count = bfd_canonicalize_reloc (input_bfd,
     
    20192088                                                        relocs,
    20202089                                                        symbols);
     2090                  free (relocs);
    20212091                  if (reloc_count < 0)
    2022                     return false;
     2092                    return FALSE;
    20232093                  BFD_ASSERT ((unsigned long) reloc_count
    20242094                              == input_section->reloc_count);
    20252095                  o->reloc_count += reloc_count;
    2026                   free (relocs);
    20272096                }
    20282097            }
    20292098          if (o->reloc_count > 0)
    20302099            {
    2031               o->orelocation = ((arelent **)
    2032                                 bfd_alloc (abfd,
    2033                                            (o->reloc_count
    2034                                             * sizeof (arelent *))));
     2100              bfd_size_type amt;
     2101
     2102              amt = o->reloc_count;
     2103              amt *= sizeof (arelent *);
     2104              o->orelocation = (arelent **) bfd_alloc (abfd, amt);
    20352105              if (!o->orelocation)
    2036                 return false;
     2106                return FALSE;
    20372107              o->flags |= SEC_RELOC;
    20382108              /* Reset the count so that it can be used as an index
     
    20572127            case bfd_symbol_reloc_link_order:
    20582128              if (! _bfd_generic_reloc_link_order (abfd, info, o, p))
    2059                 return false;
     2129                return FALSE;
    20602130              break;
    20612131            case bfd_indirect_link_order:
    2062               if (! default_indirect_link_order (abfd, info, o, p, true))
    2063                 return false;
     2132              if (! default_indirect_link_order (abfd, info, o, p, TRUE))
     2133                return FALSE;
    20642134              break;
    20652135            default:
    20662136              if (! _bfd_default_link_order (abfd, info, o, p))
    2067                 return false;
     2137                return FALSE;
    20682138              break;
    20692139            }
     
    20712141    }
    20722142
    2073   return true;
     2143  return TRUE;
    20742144}
    20752145
    20762146/* Add an output symbol to the output BFD.  */
    20772147
    2078 static boolean
     2148static bfd_boolean
    20792149generic_add_output_symbol (output_bfd, psymalloc, sym)
    20802150     bfd *output_bfd;
     
    20852155    {
    20862156      asymbol **newsyms;
     2157      bfd_size_type amt;
    20872158
    20882159      if (*psymalloc == 0)
     
    20902161      else
    20912162        *psymalloc *= 2;
    2092       newsyms = (asymbol **) bfd_realloc (bfd_get_outsymbols (output_bfd),
    2093                                           *psymalloc * sizeof (asymbol *));
     2163      amt = *psymalloc;
     2164      amt *= sizeof (asymbol *);
     2165      newsyms = (asymbol **) bfd_realloc (bfd_get_outsymbols (output_bfd), amt);
    20942166      if (newsyms == (asymbol **) NULL)
    2095         return false;
     2167        return FALSE;
    20962168      bfd_get_outsymbols (output_bfd) = newsyms;
    20972169    }
     
    21012173    ++ bfd_get_symcount (output_bfd);
    21022174
    2103   return true;
     2175  return TRUE;
    21042176}
    21052177
    21062178/* Handle the symbols for an input BFD.  */
    21072179
    2108 boolean
     2180bfd_boolean
    21092181_bfd_generic_link_output_symbols (output_bfd, input_bfd, info, psymalloc)
    21102182     bfd *output_bfd;
     
    21172189
    21182190  if (! generic_link_read_symbols (input_bfd))
    2119     return false;
     2191    return FALSE;
    21202192
    21212193  /* Create a filename symbol if we are supposed to.  */
     
    21342206              newsym = bfd_make_empty_symbol (input_bfd);
    21352207              if (!newsym)
    2136                 return false;
     2208                return FALSE;
    21372209              newsym->name = input_bfd->filename;
    21382210              newsym->value = 0;
     
    21422214              if (! generic_add_output_symbol (output_bfd, psymalloc,
    21432215                                               newsym))
    2144                 return false;
     2216                return FALSE;
    21452217
    21462218              break;
     
    21572229      asymbol *sym;
    21582230      struct generic_link_hash_entry *h;
    2159       boolean output;
     2231      bfd_boolean output;
    21602232
    21612233      h = (struct generic_link_hash_entry *) NULL;
     
    21882260                 bfd_wrapped_link_hash_lookup (output_bfd, info,
    21892261                                               bfd_asymbol_name (sym),
    2190                                                false, false, true));
     2262                                               FALSE, FALSE, TRUE));
    21912263          else
    21922264            h = _bfd_generic_link_hash_lookup (_bfd_generic_hash_table (info),
    21932265                                               bfd_asymbol_name (sym),
    2194                                                false, false, true);
     2266                                               FALSE, FALSE, TRUE);
    21952267
    21962268          if (h != (struct generic_link_hash_entry *) NULL)
     
    22562328          || (info->strip == strip_some
    22572329              && (bfd_hash_lookup (info->keep_hash, bfd_asymbol_name (sym),
    2258                                    false, false)
     2330                                   FALSE, FALSE)
    22592331                  == (struct bfd_hash_entry *) NULL)))
    2260         output = false;
     2332        output = FALSE;
    22612333      else if ((sym->flags & (BSF_GLOBAL | BSF_WEAK)) != 0)
    22622334        {
     
    22672339          if (bfd_asymbol_bfd (sym) == input_bfd
    22682340              && (sym->flags & BSF_NOT_AT_END) != 0)
    2269             output = true;
     2341            output = TRUE;
    22702342          else
    2271             output = false;
     2343            output = FALSE;
    22722344        }
    22732345      else if (bfd_is_ind_section (sym->section))
    2274         output = false;
     2346        output = FALSE;
    22752347      else if ((sym->flags & BSF_DEBUGGING) != 0)
    22762348        {
    22772349          if (info->strip == strip_none)
    2278             output = true;
     2350            output = TRUE;
    22792351          else
    2280             output = false;
     2352            output = FALSE;
    22812353        }
    22822354      else if (bfd_is_und_section (sym->section)
    22832355               || bfd_is_com_section (sym->section))
    2284         output = false;
     2356        output = FALSE;
    22852357      else if ((sym->flags & BSF_LOCAL) != 0)
    22862358        {
    22872359          if ((sym->flags & BSF_WARNING) != 0)
    2288             output = false;
     2360            output = FALSE;
    22892361          else
    22902362            {
     
    22932365                default:
    22942366                case discard_all:
    2295                   output = false;
     2367                  output = FALSE;
    22962368                  break;
     2369                case discard_sec_merge:
     2370                  output = TRUE;
     2371                  if (info->relocateable
     2372                      || ! (sym->section->flags & SEC_MERGE))
     2373                    break;
     2374                  /* FALLTHROUGH */
    22972375                case discard_l:
    22982376                  if (bfd_is_local_label (input_bfd, sym))
    2299                     output = false;
     2377                    output = FALSE;
    23002378                  else
    2301                     output = true;
     2379                    output = TRUE;
    23022380                  break;
    23032381                case discard_none:
    2304                   output = true;
     2382                  output = TRUE;
    23052383                  break;
    23062384                }
     
    23102388        {
    23112389          if (info->strip != strip_all)
    2312             output = true;
     2390            output = TRUE;
    23132391          else
    2314             output = false;
     2392            output = FALSE;
    23152393        }
    23162394      else
     
    23232401         field set.  */
    23242402      if ((sym->section->flags & SEC_HAS_CONTENTS) != 0
    2325           && sym->section->linker_mark == false)
    2326         output = false;
     2403          && ! sym->section->linker_mark)
     2404        output = FALSE;
    23272405
    23282406      if (output)
    23292407        {
    23302408          if (! generic_add_output_symbol (output_bfd, psymalloc, sym))
    2331             return false;
     2409            return FALSE;
    23322410          if (h != (struct generic_link_hash_entry *) NULL)
    2333             h->written = true;
     2411            h->written = TRUE;
    23342412        }
    23352413    }
    23362414
    2337   return true;
     2415  return TRUE;
    23382416}
    23392417
     
    24042482   This is called for each symbol in the hash table.  */
    24052483
    2406 boolean
     2484bfd_boolean
    24072485_bfd_generic_link_write_global_symbol (h, data)
    24082486     struct generic_link_hash_entry *h;
     
    24132491  asymbol *sym;
    24142492
     2493  if (h->root.type == bfd_link_hash_warning)
     2494    h = (struct generic_link_hash_entry *) h->root.u.i.link;
     2495
    24152496  if (h->written)
    2416     return true;
    2417 
    2418   h->written = true;
     2497    return TRUE;
     2498
     2499  h->written = TRUE;
    24192500
    24202501  if (wginfo->info->strip == strip_all
    24212502      || (wginfo->info->strip == strip_some
    24222503          && bfd_hash_lookup (wginfo->info->keep_hash, h->root.root.string,
    2423                               false, false) == NULL))
    2424     return true;
     2504                              FALSE, FALSE) == NULL))
     2505    return TRUE;
    24252506
    24262507  if (h->sym != (asymbol *) NULL)
     
    24302511      sym = bfd_make_empty_symbol (wginfo->output_bfd);
    24312512      if (!sym)
    2432         return false;
     2513        return FALSE;
    24332514      sym->name = h->root.root.string;
    24342515      sym->flags = 0;
     
    24462527    }
    24472528
    2448   return true;
     2529  return TRUE;
    24492530}
    24502531
    24512532/* Create a relocation.  */
    24522533
    2453 boolean
     2534bfd_boolean
    24542535_bfd_generic_reloc_link_order (abfd, info, sec, link_order)
    24552536     bfd *abfd;
     
    24652546    abort ();
    24662547
    2467   r = (arelent *) bfd_alloc (abfd, sizeof (arelent));
     2548  r = (arelent *) bfd_alloc (abfd, (bfd_size_type) sizeof (arelent));
    24682549  if (r == (arelent *) NULL)
    2469     return false;
     2550    return FALSE;
    24702551
    24712552  r->address = link_order->offset;
     
    24742555    {
    24752556      bfd_set_error (bfd_error_bad_value);
    2476       return false;
     2557      return FALSE;
    24772558    }
    24782559
     
    24872568           bfd_wrapped_link_hash_lookup (abfd, info,
    24882569                                         link_order->u.reloc.p->u.name,
    2489                                          false, false, true));
     2570                                         FALSE, FALSE, TRUE));
    24902571      if (h == (struct generic_link_hash_entry *) NULL
    24912572          || ! h->written)
     
    24942575                 (info, link_order->u.reloc.p->u.name,
    24952576                  (bfd *) NULL, (asection *) NULL, (bfd_vma) 0)))
    2496             return false;
     2577            return FALSE;
    24972578          bfd_set_error (bfd_error_bad_value);
    2498           return false;
     2579          return FALSE;
    24992580        }
    25002581      r->sym_ptr_ptr = &h->sym;
     
    25102591      bfd_reloc_status_type rstat;
    25112592      bfd_byte *buf;
    2512       boolean ok;
     2593      bfd_boolean ok;
     2594      file_ptr loc;
    25132595
    25142596      size = bfd_get_reloc_size (r->howto);
    25152597      buf = (bfd_byte *) bfd_zmalloc (size);
    25162598      if (buf == (bfd_byte *) NULL)
    2517         return false;
     2599        return FALSE;
    25182600      rstat = _bfd_relocate_contents (r->howto, abfd,
    2519                                       link_order->u.reloc.p->addend, buf);
     2601                                      (bfd_vma) link_order->u.reloc.p->addend,
     2602                                      buf);
    25202603      switch (rstat)
    25212604        {
     
    25352618            {
    25362619              free (buf);
    2537               return false;
     2620              return FALSE;
    25382621            }
    25392622          break;
    25402623        }
    2541       ok = bfd_set_section_contents (abfd, sec, (PTR) buf,
    2542                                      (file_ptr)
    2543                                      (link_order->offset *
    2544                                       bfd_octets_per_byte (abfd)), size);
     2624      loc = link_order->offset * bfd_octets_per_byte (abfd);
     2625      ok = bfd_set_section_contents (abfd, sec, (PTR) buf, loc,
     2626                                     (bfd_size_type) size);
    25452627      free (buf);
    25462628      if (! ok)
    2547         return false;
     2629        return FALSE;
    25482630
    25492631      r->addend = 0;
     
    25532635  ++sec->reloc_count;
    25542636
    2555   return true;
     2637  return TRUE;
    25562638}
    25572639
     
    25642646     asection *section;
    25652647{
     2648  bfd_size_type amt = sizeof (struct bfd_link_order);
    25662649  struct bfd_link_order *new;
    25672650
    2568   new = ((struct bfd_link_order *)
    2569          bfd_alloc (abfd, sizeof (struct bfd_link_order)));
     2651  new = (struct bfd_link_order *) bfd_zalloc (abfd, amt);
    25702652  if (!new)
    25712653    return NULL;
    25722654
    25732655  new->type = bfd_undefined_link_order;
    2574   new->offset = 0;
    2575   new->size = 0;
    2576   new->next = (struct bfd_link_order *) NULL;
    25772656
    25782657  if (section->link_order_tail != (struct bfd_link_order *) NULL)
     
    25892668   of how the particular backends generates relocs.  */
    25902669
    2591 boolean
     2670bfd_boolean
    25922671_bfd_default_link_order (abfd, info, sec, link_order)
    25932672     bfd *abfd;
     
    26052684    case bfd_indirect_link_order:
    26062685      return default_indirect_link_order (abfd, info, sec, link_order,
    2607                                           false);
    2608     case bfd_fill_link_order:
    2609       return default_fill_link_order (abfd, info, sec, link_order);
     2686                                          FALSE);
    26102687    case bfd_data_link_order:
    2611       return bfd_set_section_contents (abfd, sec,
    2612                                        (PTR) link_order->u.data.contents,
    2613                                        (file_ptr)
    2614                                        (link_order->offset *
    2615                                         bfd_octets_per_byte (abfd)),
    2616                                        link_order->size);
    2617     }
    2618 }
    2619 
    2620 /* Default routine to handle a bfd_fill_link_order.  */
    2621 
    2622 static boolean
    2623 default_fill_link_order (abfd, info, sec, link_order)
     2688      return default_data_link_order (abfd, info, sec, link_order);
     2689    }
     2690}
     2691
     2692/* Default routine to handle a bfd_data_link_order.  */
     2693
     2694static bfd_boolean
     2695default_data_link_order (abfd, info, sec, link_order)
    26242696     bfd *abfd;
    26252697     struct bfd_link_info *info ATTRIBUTE_UNUSED;
     
    26272699     struct bfd_link_order *link_order;
    26282700{
    2629   size_t size;
    2630   char *space;
    2631   size_t i;
    2632   int fill;
    2633   boolean result;
     2701  bfd_size_type size;
     2702  size_t fill_size;
     2703  bfd_byte *fill;
     2704  file_ptr loc;
     2705  bfd_boolean result;
    26342706
    26352707  BFD_ASSERT ((sec->flags & SEC_HAS_CONTENTS) != 0);
    26362708
    2637   size = (size_t) link_order->size;
    2638   space = (char *) bfd_malloc (size);
    2639   if (space == NULL && size != 0)
    2640     return false;
    2641 
    2642   fill = link_order->u.fill.value;
    2643   for (i = 0; i < size; i += 2)
    2644     space[i] = fill >> 8;
    2645   for (i = 1; i < size; i += 2)
    2646     space[i] = fill;
    2647   result = bfd_set_section_contents (abfd, sec, space,
    2648                                      (file_ptr)
    2649                                      (link_order->offset *
    2650                                       bfd_octets_per_byte (abfd)),
    2651                                      link_order->size);
    2652   free (space);
     2709  size = link_order->size;
     2710  if (size == 0)
     2711    return TRUE;
     2712
     2713  fill = link_order->u.data.contents;
     2714  fill_size = link_order->u.data.size;
     2715  if (fill_size != 0 && fill_size < size)
     2716    {
     2717      bfd_byte *p;
     2718      fill = (bfd_byte *) bfd_malloc (size);
     2719      if (fill == NULL)
     2720        return FALSE;
     2721      p = fill;
     2722      if (fill_size == 1)
     2723        memset (p, (int) link_order->u.data.contents[0], (size_t) size);
     2724      else
     2725        {
     2726          do
     2727            {
     2728              memcpy (p, link_order->u.data.contents, fill_size);
     2729              p += fill_size;
     2730              size -= fill_size;
     2731            }
     2732          while (size >= fill_size);
     2733          if (size != 0)
     2734            memcpy (p, link_order->u.data.contents, (size_t) size);
     2735          size = link_order->size;
     2736        }
     2737    }
     2738
     2739  loc = link_order->offset * bfd_octets_per_byte (abfd);
     2740  result = bfd_set_section_contents (abfd, sec, fill, loc, size);
     2741
     2742  if (fill != link_order->u.data.contents)
     2743    free (fill);
    26532744  return result;
    26542745}
     
    26562747/* Default routine to handle a bfd_indirect_link_order.  */
    26572748
    2658 static boolean
     2749static bfd_boolean
    26592750default_indirect_link_order (output_bfd, info, output_section, link_order,
    26602751                             generic_linker)
     
    26632754     asection *output_section;
    26642755     struct bfd_link_order *link_order;
    2665      boolean generic_linker;
     2756     bfd_boolean generic_linker;
    26662757{
    26672758  asection *input_section;
     
    26692760  bfd_byte *contents = NULL;
    26702761  bfd_byte *new_contents;
     2762  bfd_size_type sec_size;
     2763  file_ptr loc;
    26712764
    26722765  BFD_ASSERT ((output_section->flags & SEC_HAS_CONTENTS) != 0);
    26732766
    26742767  if (link_order->size == 0)
    2675     return true;
     2768    return TRUE;
    26762769
    26772770  input_section = link_order->u.indirect.section;
     
    26952788         bfd_get_target (input_bfd), bfd_get_target (output_bfd));
    26962789      bfd_set_error (bfd_error_wrong_format);
    2697       return false;
     2790      return FALSE;
    26982791    }
    26992792
     
    27082801         different types of object files together.  */
    27092802      if (! generic_link_read_symbols (input_bfd))
    2710         return false;
     2803        return FALSE;
    27112804
    27122805      /* Since we have been called by a specific linker, rather than
     
    27402833                h = bfd_wrapped_link_hash_lookup (output_bfd, info,
    27412834                                                  bfd_asymbol_name (sym),
    2742                                                   false, false, true);
     2835                                                  FALSE, FALSE, TRUE);
    27432836              else
    27442837                h = bfd_link_hash_lookup (info->hash,
    27452838                                          bfd_asymbol_name (sym),
    2746                                           false, false, true);
     2839                                          FALSE, FALSE, TRUE);
    27472840              if (h != NULL)
    27482841                set_symbol_from_hash (sym, h);
     
    27522845
    27532846  /* Get and relocate the section contents.  */
    2754   contents = ((bfd_byte *)
    2755               bfd_malloc (bfd_section_size (input_bfd, input_section)));
    2756   if (contents == NULL && bfd_section_size (input_bfd, input_section) != 0)
     2847  sec_size = bfd_section_size (input_bfd, input_section);
     2848  contents = ((bfd_byte *) bfd_malloc (sec_size));
     2849  if (contents == NULL && sec_size != 0)
    27572850    goto error_return;
    27582851  new_contents = (bfd_get_relocated_section_contents
     
    27632856
    27642857  /* Output the section contents.  */
     2858  loc = link_order->offset * bfd_octets_per_byte (output_bfd);
    27652859  if (! bfd_set_section_contents (output_bfd, output_section,
    2766                                   (PTR) new_contents,
    2767                                   (file_ptr)
    2768                                   (link_order->offset *
    2769                                    bfd_octets_per_byte (output_bfd)),
    2770                                   link_order->size))
     2860                                  (PTR) new_contents, loc, link_order->size))
    27712861    goto error_return;
    27722862
    27732863  if (contents != NULL)
    27742864    free (contents);
    2775   return true;
     2865  return TRUE;
    27762866
    27772867 error_return:
    27782868  if (contents != NULL)
    27792869    free (contents);
    2780   return false;
     2870  return FALSE;
    27812871}
    27822872
     
    28072897
    28082898SYNOPSIS
    2809         boolean bfd_link_split_section(bfd *abfd, asection *sec);
     2899        bfd_boolean bfd_link_split_section(bfd *abfd, asection *sec);
    28102900
    28112901DESCRIPTION
     
    28192909*/
    28202910
    2821 boolean
     2911bfd_boolean
    28222912_bfd_generic_link_split_section (abfd, sec)
    28232913     bfd *abfd ATTRIBUTE_UNUSED;
    28242914     asection *sec ATTRIBUTE_UNUSED;
    28252915{
    2826   return false;
    2827 }
     2916  return FALSE;
     2917}
Note: See TracChangeset for help on using the changeset viewer.