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/ld/ldmain.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    11/* Main program of GNU linker.
    2    Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000
     2   Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
     3   2002, 2003
    34   Free Software Foundation, Inc.
    45   Written by Steve Chamberlain steve@cygnus.com
    56
    6 This file is part of GLD, the Gnu Linker.
    7 
    8 GLD 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, or (at your option)
    11 any later version.
    12 
    13 GLD 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 GLD; see the file COPYING.  If not, write to the Free
    20 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
    21 02111-1307, USA.  */
     7   This file is part of GLD, the Gnu Linker.
     8
     9   GLD is free software; you can redistribute it and/or modify
     10   it under the terms of the GNU General Public License as published by
     11   the Free Software Foundation; either version 2, or (at your option)
     12   any later version.
     13
     14   GLD is distributed in the hope that it will be useful,
     15   but WITHOUT ANY WARRANTY; without even the implied warranty of
     16   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     17   GNU General Public License for more details.
     18
     19   You should have received a copy of the GNU General Public License
     20   along with GLD; see the file COPYING.  If not, write to the Free
     21   Software Foundation, 59 Temple Place - Suite 330, Boston, MA
     22   02111-1307, USA.  */
    2223
    2324#include "bfd.h"
    2425#include "sysdep.h"
    2526#include <stdio.h>
    26 #include <ctype.h>
     27#include "safe-ctype.h"
    2728#include "libiberty.h"
    2829#include "progress.h"
     
    3435#include "ldmisc.h"
    3536#include "ldwrite.h"
    36 #include "ldgram.h"
    3737#include "ldexp.h"
    3838#include "ldlang.h"
     39#include <ldgram.h>
    3940#include "ldlex.h"
    4041#include "ldfile.h"
     
    4243#include "ldctor.h"
    4344
    44 /* Somewhere above, sys/stat.h got included . . . .  */
     45/* Somewhere above, sys/stat.h got included.  */
    4546#if !defined(S_ISDIR) && defined(S_IFDIR)
    4647#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
     
    5556#endif
    5657
    57 static char *get_emulation PARAMS ((int, char **));
    58 static void set_scripts_dir PARAMS ((void));
     58#ifndef TARGET_SYSTEM_ROOT
     59#define TARGET_SYSTEM_ROOT ""
     60#endif
     61
     62int main PARAMS ((int, char **));
    5963
    6064/* EXPORTS */
     
    6670char *program_name;
    6771
     72/* The prefix for system library directories.  */
     73char *ld_sysroot;
     74
     75/* The canonical representation of ld_sysroot.  */
     76char * ld_canon_sysroot;
     77int ld_canon_sysroot_len;
     78
    6879/* The file that we're creating.  */
    6980bfd *output_bfd = 0;
     
    7384
    7485/* Nonzero means print names of input files as processed.  */
    75 boolean trace_files;
     86bfd_boolean trace_files;
    7687
    7788/* Nonzero means same, but note open failures, too.  */
    78 boolean trace_file_tries;
     89bfd_boolean trace_file_tries;
    7990
    8091/* Nonzero means version number was printed, so exit successfully
    8192   instead of complaining if no input files are given.  */
    82 boolean version_printed;
     93bfd_boolean version_printed;
    8394
    8495/* Nonzero means link in every member of an archive.  */
    85 boolean whole_archive;
    86 
    87 /* True if we should demangle symbol names.  */
    88 boolean demangling;
     96bfd_boolean whole_archive;
     97
     98/* TRUE if we should demangle symbol names.  */
     99bfd_boolean demangling;
    89100
    90101args_type command_line;
     
    92103ld_config_type config;
    93104
    94 static void remove_output PARAMS ((void));
    95 static boolean check_for_scripts_dir PARAMS ((char *dir));
    96 static boolean add_archive_element PARAMS ((struct bfd_link_info *, bfd *,
    97                                             const char *));
    98 static boolean multiple_definition PARAMS ((struct bfd_link_info *,
    99                                             const char *,
    100                                             bfd *, asection *, bfd_vma,
    101                                             bfd *, asection *, bfd_vma));
    102 static boolean multiple_common PARAMS ((struct bfd_link_info *,
    103                                         const char *, bfd *,
    104                                         enum bfd_link_hash_type, bfd_vma,
    105                                         bfd *, enum bfd_link_hash_type,
    106                                         bfd_vma));
    107 static boolean add_to_set PARAMS ((struct bfd_link_info *,
    108                                    struct bfd_link_hash_entry *,
    109                                    bfd_reloc_code_real_type,
    110                                    bfd *, asection *, bfd_vma));
    111 static boolean constructor_callback PARAMS ((struct bfd_link_info *,
    112                                              boolean constructor,
    113                                              const char *name,
    114                                              bfd *, asection *, bfd_vma));
    115 static boolean warning_callback PARAMS ((struct bfd_link_info *,
    116                                          const char *, const char *, bfd *,
    117                                          asection *, bfd_vma));
    118 static void warning_find_reloc PARAMS ((bfd *, asection *, PTR));
    119 static boolean undefined_symbol PARAMS ((struct bfd_link_info *,
    120                                          const char *, bfd *,
    121                                          asection *, bfd_vma, boolean));
    122 static boolean reloc_overflow PARAMS ((struct bfd_link_info *, const char *,
    123                                        const char *, bfd_vma,
    124                                        bfd *, asection *, bfd_vma));
    125 static boolean reloc_dangerous PARAMS ((struct bfd_link_info *, const char *,
    126                                         bfd *, asection *, bfd_vma));
    127 static boolean unattached_reloc PARAMS ((struct bfd_link_info *,
    128                                          const char *, bfd *, asection *,
    129                                          bfd_vma));
    130 static boolean notice PARAMS ((struct bfd_link_info *, const char *,
    131                                bfd *, asection *, bfd_vma));
    132 
    133 static struct bfd_link_callbacks link_callbacks = {
     105static char *get_emulation
     106  PARAMS ((int, char **));
     107static void set_scripts_dir
     108  PARAMS ((void));
     109static void remove_output
     110  PARAMS ((void));
     111static bfd_boolean check_for_scripts_dir
     112  PARAMS ((char *));
     113static bfd_boolean add_archive_element
     114  PARAMS ((struct bfd_link_info *, bfd *, const char *));
     115static bfd_boolean multiple_definition
     116  PARAMS ((struct bfd_link_info *, const char *, bfd *, asection *, bfd_vma,
     117           bfd *, asection *, bfd_vma));
     118static bfd_boolean multiple_common
     119  PARAMS ((struct bfd_link_info *, const char *, bfd *,
     120           enum bfd_link_hash_type, bfd_vma, bfd *, enum bfd_link_hash_type,
     121           bfd_vma));
     122static bfd_boolean add_to_set
     123  PARAMS ((struct bfd_link_info *, struct bfd_link_hash_entry *,
     124           bfd_reloc_code_real_type, bfd *, asection *, bfd_vma));
     125static bfd_boolean constructor_callback
     126  PARAMS ((struct bfd_link_info *, bfd_boolean, const char *, bfd *,
     127           asection *, bfd_vma));
     128static bfd_boolean warning_callback
     129  PARAMS ((struct bfd_link_info *, const char *, const char *, bfd *,
     130           asection *, bfd_vma));
     131static void warning_find_reloc
     132  PARAMS ((bfd *, asection *, PTR));
     133static bfd_boolean undefined_symbol
     134  PARAMS ((struct bfd_link_info *, const char *, bfd *, asection *, bfd_vma,
     135           bfd_boolean));
     136static bfd_boolean reloc_overflow
     137  PARAMS ((struct bfd_link_info *, const char *, const char *, bfd_vma,
     138           bfd *, asection *, bfd_vma));
     139static bfd_boolean reloc_dangerous
     140  PARAMS ((struct bfd_link_info *, const char *, bfd *, asection *, bfd_vma));
     141static bfd_boolean unattached_reloc
     142  PARAMS ((struct bfd_link_info *, const char *, bfd *, asection *, bfd_vma));
     143static bfd_boolean notice
     144  PARAMS ((struct bfd_link_info *, const char *, bfd *, asection *, bfd_vma));
     145
     146static struct bfd_link_callbacks link_callbacks =
     147{
    134148  add_archive_element,
    135149  multiple_definition,
     
    142156  reloc_dangerous,
    143157  unattached_reloc,
    144   notice
     158  notice,
     159  error_handler
    145160};
    146161
     
    171186  setlocale (LC_MESSAGES, "");
    172187#endif
     188#if defined (HAVE_SETLOCALE)
     189  setlocale (LC_CTYPE, "");
     190#endif
    173191  bindtextdomain (PACKAGE, LOCALEDIR);
    174192  textdomain (PACKAGE);
     
    184202
    185203  xatexit (remove_output);
     204
     205#ifdef TARGET_SYSTEM_ROOT_RELOCATABLE
     206  ld_sysroot = make_relative_prefix (program_name, BINDIR,
     207                                     TARGET_SYSTEM_ROOT);
     208
     209  if (ld_sysroot)
     210    {
     211      struct stat s;
     212      int res = stat (ld_sysroot, &s) == 0 && S_ISDIR (s.st_mode);
     213
     214      if (!res)
     215        {
     216          free (ld_sysroot);
     217          ld_sysroot = NULL;
     218        }
     219    }
     220
     221  if (! ld_sysroot)
     222    {
     223      ld_sysroot = make_relative_prefix (program_name, TOOLBINDIR,
     224                                         TARGET_SYSTEM_ROOT);
     225
     226      if (ld_sysroot)
     227        {
     228          struct stat s;
     229          int res = stat (ld_sysroot, &s) == 0 && S_ISDIR (s.st_mode);
     230
     231          if (!res)
     232            {
     233              free (ld_sysroot);
     234              ld_sysroot = NULL;
     235            }
     236        }
     237    }
     238
     239  if (! ld_sysroot)
     240#endif
     241    ld_sysroot = TARGET_SYSTEM_ROOT;
     242
     243  if (ld_sysroot && *ld_sysroot)
     244    ld_canon_sysroot = lrealpath (ld_sysroot);
     245
     246  if (ld_canon_sysroot)
     247    ld_canon_sysroot_len = strlen (ld_canon_sysroot);
     248  else
     249    ld_canon_sysroot_len = -1;
    186250
    187251  /* Set the default BFD target based on the configured target.  Doing
     
    195259    }
    196260
     261#if YYDEBUG
     262  {
     263    extern int yydebug;
     264    yydebug = 1;
     265  }
     266#endif
     267
    197268  /* Initialize the data about options.  */
    198   trace_files = trace_file_tries = version_printed = false;
    199   whole_archive = false;
    200   config.build_constructors = true;
    201   config.dynamic_link = false;
    202   config.has_shared = false;
     269  trace_files = trace_file_tries = version_printed = FALSE;
     270  whole_archive = FALSE;
     271  config.build_constructors = TRUE;
     272  config.dynamic_link = FALSE;
     273  config.has_shared = FALSE;
    203274  config.split_by_reloc = (unsigned) -1;
    204275  config.split_by_file = (bfd_size_type) -1;
    205   command_line.force_common_definition = false;
     276  command_line.force_common_definition = FALSE;
     277  command_line.inhibit_common_definition = FALSE;
    206278  command_line.interpreter = NULL;
    207279  command_line.rpath = NULL;
    208   command_line.warn_mismatch = true;
    209   command_line.check_section_addresses = true;
     280  command_line.warn_mismatch = TRUE;
     281  command_line.check_section_addresses = TRUE;
     282  command_line.accept_unknown_input_arch = FALSE;
    210283
    211284  /* We initialize DEMANGLING based on the environment variable
     
    216289  demangling = getenv ("COLLECT_NO_DEMANGLE") == NULL;
    217290
     291  link_info.relocateable = FALSE;
     292  link_info.emitrelocations = FALSE;
     293  link_info.task_link = FALSE;
     294  link_info.shared = FALSE;
     295  link_info.symbolic = FALSE;
     296  link_info.export_dynamic = FALSE;
     297  link_info.static_link = FALSE;
     298  link_info.traditional_format = FALSE;
     299  link_info.optimize = FALSE;
     300  link_info.no_undefined = FALSE;
     301  link_info.allow_shlib_undefined = TRUE;
     302  link_info.allow_multiple_definition = FALSE;
     303  link_info.allow_undefined_version = TRUE;
     304  link_info.keep_memory = TRUE;
     305  link_info.notice_all = FALSE;
     306  link_info.nocopyreloc = FALSE;
     307  link_info.new_dtags = FALSE;
     308  link_info.combreloc = TRUE;
     309  link_info.eh_frame_hdr = FALSE;
     310  link_info.strip_discarded = TRUE;
     311  link_info.strip = strip_none;
     312  link_info.discard = discard_sec_merge;
     313  link_info.common_skip_ar_aymbols = bfd_link_common_skip_none;
    218314  link_info.callbacks = &link_callbacks;
    219   link_info.relocateable = false;
    220   link_info.emitrelocations = false;
    221   link_info.shared = false;
    222   link_info.symbolic = false;
    223   link_info.static_link = false;
    224   link_info.traditional_format = false;
    225   link_info.optimize = false;
    226   link_info.no_undefined = false;
    227   link_info.allow_shlib_undefined = false;
    228   link_info.strip = strip_none;
    229   link_info.discard = discard_none;
    230   link_info.keep_memory = true;
     315  link_info.hash = NULL;
     316  link_info.keep_hash = NULL;
     317  link_info.notice_hash = NULL;
     318  link_info.wrap_hash = NULL;
    231319  link_info.input_bfds = NULL;
    232320  link_info.create_object_symbols_section = NULL;
    233   link_info.hash = NULL;
    234   link_info.keep_hash = NULL;
    235   link_info.notice_all = false;
    236   link_info.notice_hash = NULL;
    237   link_info.wrap_hash = NULL;
    238   link_info.mpc860c0 = 0;
     321  link_info.gc_sym_list = NULL;
     322  link_info.base_file = NULL;
    239323  /* SVR4 linkers seem to set DT_INIT and DT_FINI based on magic _init
    240324     and _fini symbols.  We are compatible.  */
    241325  link_info.init_function = "_init";
    242326  link_info.fini_function = "_fini";
    243   link_info.new_dtags = false;
     327  link_info.mpc860c0 = 0;
     328  link_info.pei386_auto_import = -1;
     329  link_info.pei386_runtime_pseudo_reloc = FALSE;
     330  link_info.spare_dynamic_tags = 5;
    244331  link_info.flags = (bfd_vma) 0;
    245332  link_info.flags_1 = (bfd_vma) 0;
     333  link_info.relax_finalizing = FALSE;
    246334
    247335  ldfile_add_arch ("");
    248336
    249   config.make_executable = true;
    250   force_make_executable = false;
    251   config.magic_demand_paged = true;
    252   config.text_read_only = true;
     337  config.make_executable = TRUE;
     338  force_make_executable = FALSE;
     339  config.magic_demand_paged = TRUE;
     340  config.text_read_only = TRUE;
    253341
    254342  emulation = get_emulation (argc, argv);
    255343  ldemul_choose_mode (emulation);
    256   default_target = ldemul_choose_target ();
     344  default_target = ldemul_choose_target (argc, argv);
    257345  lang_init ();
    258346  ldemul_before_parse ();
    259   lang_has_input_file = false;
     347  lang_has_input_file = FALSE;
    260348  parse_args (argc, argv);
    261349
     
    274362    }
    275363
     364  if (! link_info.shared)
     365    {
     366      if (command_line.filter_shlib)
     367        einfo (_("%P%F: -F may not be used without -shared\n"));
     368      if (command_line.auxiliary_filters)
     369        einfo (_("%P%F: -f may not be used without -shared\n"));
     370    }
     371
    276372  /* Treat ld -r -s as ld -r -S -x (i.e., strip all local symbols).  I
    277373     don't see how else this can be handled, since in this case we
     
    280376    {
    281377      link_info.strip = strip_debugger;
    282       if (link_info.discard == discard_none)
     378      if (link_info.discard == discard_sec_merge)
    283379        link_info.discard = discard_all;
    284380    }
     
    288384  set_scripts_dir ();
    289385
    290   if (had_script == false)
    291     {
    292       /* Read the emulation's appropriate default script.  */
     386  /* If we have not already opened and parsed a linker script
     387     read the emulation's appropriate default script.  */
     388  if (saved_script_handle == NULL)
     389    {
    293390      int isfile;
    294391      char *s = ldemul_get_script (&isfile);
     
    298395      else
    299396        {
    300           if (trace_file_tries)
    301             {
    302               info_msg (_("using internal linker script:\n"));
    303               info_msg ("==================================================\n");
    304               info_msg (s);
    305               info_msg ("\n==================================================\n");
    306             }
    307397          lex_string = s;
    308398          lex_redirect (s);
     
    313403    }
    314404
     405  if (trace_file_tries)
     406    {
     407      if (saved_script_handle)
     408        info_msg (_("using external linker script:"));
     409      else
     410        info_msg (_("using internal linker script:"));
     411      info_msg ("\n==================================================\n");
     412
     413      if (saved_script_handle)
     414        {
     415          static const int ld_bufsz = 8193;
     416          size_t n;
     417          char *buf = xmalloc (ld_bufsz);
     418
     419          rewind (saved_script_handle);
     420          while ((n = fread (buf, 1, ld_bufsz - 1, saved_script_handle)) > 0)
     421            {
     422              buf[n] = 0;
     423              info_msg (buf);
     424            }
     425          rewind (saved_script_handle);
     426          free (buf);
     427        }
     428      else
     429        {
     430          int isfile;
     431
     432          info_msg (ldemul_get_script (&isfile));
     433        }
     434
     435      info_msg ("\n==================================================\n");
     436    }
     437
    315438  lang_final ();
    316439
    317   if (lang_has_input_file == false)
     440  if (!lang_has_input_file)
    318441    {
    319442      if (version_printed)
     
    323446
    324447  if (trace_files)
    325     {
    326       info_msg (_("%P: mode %s\n"), emulation);
    327     }
     448    info_msg (_("%P: mode %s\n"), emulation);
    328449
    329450  ldemul_after_parse ();
     
    351472  /* Print error messages for any missing symbols, for any warning
    352473     symbols, and possibly multiple definitions.  */
    353 
    354   if (! link_info.relocateable)
    355     {
    356       /* Look for a text section and switch the readonly attribute in it.  */
    357       asection *found = bfd_get_section_by_name (output_bfd, ".text");
    358 
    359       if (found != (asection *) NULL)
    360         {
    361           if (config.text_read_only)
    362             found->flags |= SEC_READONLY;
    363           else
    364             found->flags &= ~SEC_READONLY;
    365         }
    366     }
    367 
    368474  if (link_info.relocateable)
    369475    output_bfd->flags &= ~EXEC_P;
     
    383489     be reported in the exit status.  (What non-fatal errors, if any, do we
    384490     want to ignore for relocateable output?)  */
    385 
    386   if (config.make_executable == false && force_make_executable == false)
    387     {
    388       if (trace_files == true)
    389         {
    390           einfo (_("%P: link errors found, deleting executable `%s'\n"),
    391                  output_filename);
    392         }
     491  if (!config.make_executable && !force_make_executable)
     492    {
     493      if (trace_files)
     494        einfo (_("%P: link errors found, deleting executable `%s'\n"),
     495               output_filename);
    393496
    394497      /* The file will be removed by remove_output.  */
    395 
    396498      xexit (1);
    397499    }
     
    407509        {
    408510          int len = strlen (output_filename);
     511
    409512          if (len < 4
    410513              || (strcasecmp (output_filename + len - 4, ".exe") != 0
     
    417520              int l;
    418521              char *dst_name = xmalloc (len + 5);
     522
    419523              strcpy (dst_name, output_filename);
    420524              strcat (dst_name, ".exe");
     
    429533                {
    430534                  int done = fwrite (buf, 1, l, dst);
     535
    431536                  if (done != l)
    432                     {
    433                       einfo (_("%P: Error writing file `%s'\n"), dst_name);
    434                     }
     537                    einfo (_("%P: Error writing file `%s'\n"), dst_name);
    435538                }
     539
    436540              fclose (src);
    437541              if (fclose (dst) == EOF)
    438                 {
    439                   einfo (_("%P: Error closing file `%s'\n"), dst_name);
    440                 }
     542                einfo (_("%P: Error closing file `%s'\n"), dst_name);
    441543              free (dst_name);
    442544              free (buf);
     
    497599                }
    498600              else
    499                 {
    500                   einfo (_("%P%F: missing argument to -m\n"));
    501                 }
     601                einfo (_("%P%F: missing argument to -m\n"));
    502602            }
    503603          else if (strcmp (argv[i], "-mips1") == 0
    504604                   || strcmp (argv[i], "-mips2") == 0
    505605                   || strcmp (argv[i], "-mips3") == 0
    506                    || strcmp (argv[i], "-mips4") == 0)
     606                   || strcmp (argv[i], "-mips4") == 0
     607                   || strcmp (argv[i], "-mips5") == 0
     608                   || strcmp (argv[i], "-mips32") == 0
     609                   || strcmp (argv[i], "-mips32r2") == 0
     610                   || strcmp (argv[i], "-mips64") == 0)
    507611            {
    508               /* FIXME: The arguments -mips1, -mips2 and -mips3 are
     612              /* FIXME: The arguments -mips1, -mips2, -mips3, etc. are
    509613                 passed to the linker by some MIPS compilers.  They
    510614                 generally tell the linker to use a slightly different
     
    532636
    533637/* If directory DIR contains an "ldscripts" subdirectory,
    534    add DIR to the library search path and return true,
    535    else return false.  */
    536 
    537 static boolean
     638   add DIR to the library search path and return TRUE,
     639   else return FALSE.  */
     640
     641static bfd_boolean
    538642check_for_scripts_dir (dir)
    539643     char *dir;
     
    542646  char *buf;
    543647  struct stat s;
    544   boolean res;
     648  bfd_boolean res;
    545649
    546650  dirlen = strlen (dir);
     
    552656  free (buf);
    553657  if (res)
    554     ldfile_add_library_path (dir, false);
     658    ldfile_add_library_path (dir, FALSE);
    555659  return res;
    556660}
     
    561665
    562666   SCRIPTDIR (passed from Makefile)
     667             (adjusted according to the current location of the binary)
     668   SCRIPTDIR (passed from Makefile)
    563669   the dir where this program is (for using it from the build tree)
    564    the dir where this program is/../lib (for installing the tool suite elsewhere) */
     670   the dir where this program is/../lib
     671             (for installing the tool suite elsewhere).  */
    565672
    566673static void
     
    569676  char *end, *dir;
    570677  size_t dirlen;
     678  bfd_boolean found;
     679
     680  dir = make_relative_prefix (program_name, BINDIR, SCRIPTDIR);
     681  if (dir)
     682    {
     683      found = check_for_scripts_dir (dir);
     684      free (dir);
     685      if (found)
     686        return;
     687    }
     688
     689  dir = make_relative_prefix (program_name, TOOLBINDIR, SCRIPTDIR);
     690  if (dir)
     691    {
     692      found = check_for_scripts_dir (dir);
     693      free (dir);
     694      if (found)
     695        return;
     696    }
    571697
    572698  if (check_for_scripts_dir (SCRIPTDIR))
     
    580706    /* We could have \foo\bar, or /foo\bar.  */
    581707    char *bslash = strrchr (program_name, '\\');
     708
    582709    if (end == NULL || (bslash != NULL && bslash > end))
    583710      end = bslash;
     
    586713
    587714  if (end == NULL)
    588     {
    589       /* Don't look for ldscripts in the current directory.  There is
    590          too much potential for confusion.  */
    591       return;
    592     }
     715    /* Don't look for ldscripts in the current directory.  There is
     716       too much potential for confusion.  */
     717    return;
    593718
    594719  dirlen = end - program_name;
     
    600725
    601726  if (check_for_scripts_dir (dir))
    602     /* Don't free dir.  */
    603     return;
     727    {
     728      free (dir);
     729      return;
     730    }
    604731
    605732  /* Look for "ldscripts" in <the dir where our binary is>/../lib.  */
    606733  strcpy (dir + dirlen, "/../lib");
    607   if (check_for_scripts_dir (dir))
    608     return;
    609 
    610   /* Well, we tried.  */
     734  check_for_scripts_dir (dir);
    611735  free (dir);
    612736}
     
    626750    }
    627751
    628   if (bfd_hash_lookup (link_info.notice_hash, name, true, true)
     752  if (bfd_hash_lookup (link_info.notice_hash, name, TRUE, TRUE)
    629753      == (struct bfd_hash_entry *) NULL)
    630754    einfo (_("%P%F: bfd_hash_lookup failed: %E\n"));
     
    646770        einfo (_("%P%F: bfd_hash_table_init failed: %E\n"));
    647771    }
    648   if (bfd_hash_lookup (link_info.wrap_hash, name, true, true) == NULL)
     772
     773  if (bfd_hash_lookup (link_info.wrap_hash, name, TRUE, TRUE) == NULL)
    649774    einfo (_("%P%F: bfd_hash_lookup failed: %E\n"));
    650775}
     
    683808  while (c != EOF)
    684809    {
    685       while (isspace (c))
     810      while (ISSPACE (c))
    686811        c = getc (file);
    687812
     
    690815          size_t len = 0;
    691816
    692           while (! isspace (c) && c != EOF)
     817          while (! ISSPACE (c) && c != EOF)
    693818            {
    694819              buf[len] = c;
     
    704829          buf[len] = '\0';
    705830
    706           if (bfd_hash_lookup (link_info.keep_hash, buf, true, true)
     831          if (bfd_hash_lookup (link_info.keep_hash, buf, TRUE, TRUE)
    707832              == (struct bfd_hash_entry *) NULL)
    708833            einfo (_("%P%F: bfd_hash_lookup for insertion failed: %E\n"));
     
    713838    einfo (_("%P: `-retain-symbols-file' overrides `-s' and `-S'\n"));
    714839
     840  free (buf);
    715841  link_info.strip = strip_some;
    716842}
     
    722848   a link.  */
    723849
    724 static boolean
     850static bfd_boolean
    725851add_archive_element (info, abfd, name)
    726852     struct bfd_link_info *info ATTRIBUTE_UNUSED;
     
    737863  input->asymbols = NULL;
    738864  input->next = NULL;
    739   input->just_syms_flag = false;
    740   input->loaded = false;
    741   input->search_dirs_flag = false;
     865  input->just_syms_flag = FALSE;
     866  input->loaded = FALSE;
     867  input->search_dirs_flag = FALSE;
    742868
    743869  /* FIXME: The following fields are not set: header.next,
     
    751877  if (config.map_file != (FILE *) NULL)
    752878    {
    753       static boolean header_printed;
     879      static bfd_boolean header_printed;
    754880      struct bfd_link_hash_entry *h;
    755881      bfd *from;
    756882      int len;
    757883
    758       h = bfd_link_hash_lookup (link_info.hash, name, false, false, true);
     884      h = bfd_link_hash_lookup (link_info.hash, name, FALSE, FALSE, TRUE);
    759885
    760886      if (h == NULL)
     
    788914          char buf[100];
    789915
    790           sprintf (buf, "%-29s %s\n\n", _("Archive member included"),
    791                    _("because of file (symbol)"));
     916          sprintf (buf, _("Archive member included because of file (symbol)\n\n"));
    792917          minfo ("%s", buf);
    793           header_printed = true;
     918          header_printed = TRUE;
    794919        }
    795920
     
    830955    info_msg ("%I\n", input);
    831956
    832   return true;
     957  return TRUE;
    833958}
    834959
     
    836961   multiple times.  */
    837962
    838 static boolean
     963static bfd_boolean
    839964multiple_definition (info, name, obfd, osec, oval, nbfd, nsec, nval)
    840965     struct bfd_link_info *info ATTRIBUTE_UNUSED;
     
    858983          && ! bfd_is_abs_section (nsec)
    859984          && bfd_is_abs_section (nsec->output_section)))
    860     return true;
     985    return TRUE;
    861986
    862987  einfo (_("%X%C: multiple definition of `%T'\n"),
     
    871996    }
    872997
    873   return true;
     998  return TRUE;
    874999}
    8751000
     
    8791004   -warn-common was used.  */
    8801005
    881 static boolean
     1006static bfd_boolean
    8821007multiple_common (info, name, obfd, otype, osize, nbfd, ntype, nsize)
    8831008     struct bfd_link_info *info ATTRIBUTE_UNUSED;
     
    8911016{
    8921017  if (! config.warn_common)
    893     return true;
     1018    return TRUE;
    8941019
    8951020  if (ntype == bfd_link_hash_defined
     
    9381063    }
    9391064
    940   return true;
     1065  return TRUE;
    9411066}
    9421067
     
    9451070   represent a value which should be added to the set.  */
    9461071
    947 static boolean
     1072static bfd_boolean
    9481073add_to_set (info, h, reloc, abfd, section, value)
    9491074     struct bfd_link_info *info ATTRIBUTE_UNUSED;
     
    9591084
    9601085  if (! config.build_constructors)
    961     return true;
     1086    return TRUE;
    9621087
    9631088  ldctor_add_set_entry (h, reloc, (const char *) NULL, section, value);
     
    9721097    }
    9731098
    974   return true;
     1099  return TRUE;
    9751100}
    9761101
     
    9801105   adding an element to a set, but less general.  */
    9811106
    982 static boolean
     1107static bfd_boolean
    9831108constructor_callback (info, constructor, name, abfd, section, value)
    9841109     struct bfd_link_info *info;
    985      boolean constructor;
     1110     bfd_boolean constructor;
    9861111     const char *name;
    9871112     bfd *abfd;
     
    9971122
    9981123  if (! config.build_constructors)
    999     return true;
     1124    return TRUE;
    10001125
    10011126  /* Ensure that BFD_RELOC_CTOR exists now, so that we can give a
     
    10141139    strcpy (s, "__DTOR_LIST__");
    10151140
    1016   h = bfd_link_hash_lookup (info->hash, set_name, true, true, true);
     1141  h = bfd_link_hash_lookup (info->hash, set_name, TRUE, TRUE, TRUE);
    10171142  if (h == (struct bfd_link_hash_entry *) NULL)
    10181143    einfo (_("%P%F: bfd_link_hash_lookup failed: %E\n"));
     
    10271152
    10281153  ldctor_add_set_entry (h, BFD_RELOC_CTOR, name, section, value);
    1029   return true;
     1154  return TRUE;
    10301155}
    10311156
     
    10331158   bfd_map_over_sections.  */
    10341159
    1035 struct warning_callback_info {
    1036   boolean found;
     1160struct warning_callback_info
     1161{
     1162  bfd_boolean found;
    10371163  const char *warning;
    10381164  const char *symbol;
     
    10421168/* This is called when there is a reference to a warning symbol.  */
    10431169
    1044 static boolean
     1170static bfd_boolean
    10451171warning_callback (info, warning, symbol, abfd, section, address)
    10461172     struct bfd_link_info *info ATTRIBUTE_UNUSED;
     
    10551181  if (! config.warn_multiple_gp
    10561182      && strcmp (warning, "using multiple gp values") == 0)
    1057     return true;
     1183    return TRUE;
    10581184
    10591185  if (section != NULL)
     
    10711197      /* Look through the relocs to see if we can find a plausible
    10721198         address.  */
    1073 
    10741199      entry = (lang_input_statement_type *) abfd->usrdata;
    10751200      if (entry != NULL && entry->asymbols != NULL)
     
    10941219        }
    10951220
    1096       info.found = false;
     1221      info.found = FALSE;
    10971222      info.warning = warning;
    10981223      info.symbol = symbol;
     
    11071232    }
    11081233
    1109   return true;
     1234  return TRUE;
    11101235}
    11111236
     
    11531278          /* We found a reloc for the symbol we are looking for.  */
    11541279          einfo ("%C: %s\n", abfd, sec, q->address, info->warning);
    1155           info->found = true;
     1280          info->found = TRUE;
    11561281          break;
    11571282        }
     
    11631288/* This is called when an undefined symbol is found.  */
    11641289
    1165 static boolean
     1290static bfd_boolean
    11661291undefined_symbol (info, name, abfd, section, address, fatal)
    11671292     struct bfd_link_info *info ATTRIBUTE_UNUSED;
     
    11701295     asection *section;
    11711296     bfd_vma address;
    1172      boolean fatal ATTRIBUTE_UNUSED;
     1297     bfd_boolean fatal ATTRIBUTE_UNUSED;
    11731298{
    11741299  static char *error_name;
     
    11821307
    11831308      /* Only warn once about a particular undefined symbol.  */
    1184 
    11851309      if (hash == NULL)
    11861310        {
     
    11911315        }
    11921316
    1193       if (bfd_hash_lookup (hash, name, false, false) != NULL)
    1194         return true;
    1195 
    1196       if (bfd_hash_lookup (hash, name, true, true) == NULL)
     1317      if (bfd_hash_lookup (hash, name, FALSE, FALSE) != NULL)
     1318        return TRUE;
     1319
     1320      if (bfd_hash_lookup (hash, name, TRUE, TRUE) == NULL)
    11971321        einfo (_("%F%P: bfd_hash_lookup failed: %E\n"));
    11981322    }
     
    12381362    }
    12391363
    1240   return true;
     1364  return TRUE;
    12411365}
    12421366
    12431367/* This is called when a reloc overflows.  */
    12441368
    1245 static boolean
     1369static bfd_boolean
    12461370reloc_overflow (info, name, reloc_name, addend, abfd, section, address)
    12471371     struct bfd_link_info *info ATTRIBUTE_UNUSED;
     
    12611385    einfo ("+%v", addend);
    12621386  einfo ("\n");
    1263   return true;
     1387  return TRUE;
    12641388}
    12651389
    12661390/* This is called when a dangerous relocation is made.  */
    12671391
    1268 static boolean
     1392static bfd_boolean
    12691393reloc_dangerous (info, message, abfd, section, address)
    12701394     struct bfd_link_info *info ATTRIBUTE_UNUSED;
     
    12791403    einfo ("%X%C:", abfd, section, address);
    12801404  einfo (_("dangerous relocation: %s\n"), message);
    1281   return true;
     1405  return TRUE;
    12821406}
    12831407
     
    12851409   that is not being output.  */
    12861410
    1287 static boolean
     1411static bfd_boolean
    12881412unattached_reloc (info, name, abfd, section, address)
    12891413     struct bfd_link_info *info ATTRIBUTE_UNUSED;
     
    12981422    einfo ("%X%C:", abfd, section, address);
    12991423  einfo (_(" reloc refers to symbol `%T' which is not being output\n"), name);
    1300   return true;
     1424  return TRUE;
    13011425}
    13021426
     
    13051429   using the -y option.  */
    13061430
    1307 static boolean
     1431static bfd_boolean
    13081432notice (info, name, abfd, section, value)
    13091433     struct bfd_link_info *info;
     
    13151439  if (! info->notice_all
    13161440      || (info->notice_hash != NULL
    1317           && bfd_hash_lookup (info->notice_hash, name, false, false) != NULL))
     1441          && bfd_hash_lookup (info->notice_hash, name, FALSE, FALSE) != NULL))
    13181442    {
    13191443      if (bfd_is_und_section (section))
     
    13261450    add_cref (name, abfd, section, value);
    13271451
    1328   return true;
    1329 }
     1452  return TRUE;
     1453}
Note: See TracChangeset for help on using the changeset viewer.