Ignore:
Timestamp:
Aug 16, 2003, 11:33:53 PM (22 years ago)
Author:
bird
Message:

Joined the port of 2.11.2 with 2.14.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/binutils/ld/ldmain.c

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r617 r618  
    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
     
    170185#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
    171186  setlocale (LC_MESSAGES, "");
     187#endif
     188#if defined (HAVE_SETLOCALE)
     189  setlocale (LC_CTYPE, "");
    172190#endif
    173191  bindtextdomain (PACKAGE, LOCALEDIR);
     
    190208  xatexit (remove_output);
    191209
     210#ifdef TARGET_SYSTEM_ROOT_RELOCATABLE
     211  ld_sysroot = make_relative_prefix (program_name, BINDIR,
     212                                     TARGET_SYSTEM_ROOT);
     213
     214  if (ld_sysroot)
     215    {
     216      struct stat s;
     217      int res = stat (ld_sysroot, &s) == 0 && S_ISDIR (s.st_mode);
     218
     219      if (!res)
     220        {
     221          free (ld_sysroot);
     222          ld_sysroot = NULL;
     223        }
     224    }
     225
     226  if (! ld_sysroot)
     227    {
     228      ld_sysroot = make_relative_prefix (program_name, TOOLBINDIR,
     229                                         TARGET_SYSTEM_ROOT);
     230
     231      if (ld_sysroot)
     232        {
     233          struct stat s;
     234          int res = stat (ld_sysroot, &s) == 0 && S_ISDIR (s.st_mode);
     235
     236          if (!res)
     237            {
     238              free (ld_sysroot);
     239              ld_sysroot = NULL;
     240            }
     241        }
     242    }
     243
     244  if (! ld_sysroot)
     245#endif
     246    ld_sysroot = TARGET_SYSTEM_ROOT;
     247
     248  if (ld_sysroot && *ld_sysroot)
     249    ld_canon_sysroot = lrealpath (ld_sysroot);
     250
     251  if (ld_canon_sysroot)
     252    ld_canon_sysroot_len = strlen (ld_canon_sysroot);
     253  else
     254    ld_canon_sysroot_len = -1;
     255
    192256  /* Set the default BFD target based on the configured target.  Doing
    193257     this permits the linker to be configured for a particular target,
     
    200264    }
    201265
     266#if YYDEBUG
     267  {
     268    extern int yydebug;
     269    yydebug = 1;
     270  }
     271#endif
     272
    202273  /* Initialize the data about options.  */
    203   trace_files = trace_file_tries = version_printed = false;
    204   whole_archive = false;
    205   config.build_constructors = true;
    206   config.dynamic_link = false;
    207   config.has_shared = false;
     274  trace_files = trace_file_tries = version_printed = FALSE;
     275  whole_archive = FALSE;
     276  config.build_constructors = TRUE;
     277  config.dynamic_link = FALSE;
     278  config.has_shared = FALSE;
    208279  config.split_by_reloc = (unsigned) -1;
    209280  config.split_by_file = (bfd_size_type) -1;
    210   command_line.force_common_definition = false;
     281  command_line.force_common_definition = FALSE;
     282  command_line.inhibit_common_definition = FALSE;
    211283  command_line.interpreter = NULL;
    212284  command_line.rpath = NULL;
    213   command_line.warn_mismatch = true;
    214   command_line.check_section_addresses = true;
     285  command_line.warn_mismatch = TRUE;
     286  command_line.check_section_addresses = TRUE;
     287  command_line.accept_unknown_input_arch = FALSE;
    215288
    216289  /* We initialize DEMANGLING based on the environment variable
     
    221294  demangling = getenv ("COLLECT_NO_DEMANGLE") == NULL;
    222295
     296  link_info.relocateable = FALSE;
     297  link_info.emitrelocations = FALSE;
     298  link_info.task_link = FALSE;
     299  link_info.shared = FALSE;
     300  link_info.symbolic = FALSE;
     301  link_info.export_dynamic = FALSE;
     302  link_info.static_link = FALSE;
     303  link_info.traditional_format = FALSE;
     304  link_info.optimize = FALSE;
     305  link_info.no_undefined = FALSE;
     306  link_info.allow_shlib_undefined = TRUE;
     307  link_info.allow_multiple_definition = FALSE;
     308  link_info.allow_undefined_version = TRUE;
     309  link_info.keep_memory = TRUE;
     310  link_info.notice_all = FALSE;
     311  link_info.nocopyreloc = FALSE;
     312  link_info.new_dtags = FALSE;
     313  link_info.combreloc = TRUE;
     314  link_info.eh_frame_hdr = FALSE;
     315  link_info.strip_discarded = TRUE;
     316  link_info.strip = strip_none;
     317  link_info.discard = discard_sec_merge;
     318  link_info.common_skip_ar_aymbols = bfd_link_common_skip_none;
    223319  link_info.callbacks = &link_callbacks;
    224   link_info.relocateable = false;
    225   link_info.emitrelocations = false;
    226   link_info.shared = false;
    227   link_info.symbolic = false;
    228   link_info.static_link = false;
    229   link_info.traditional_format = false;
    230   link_info.optimize = false;
    231   link_info.no_undefined = false;
    232   link_info.allow_shlib_undefined = false;
    233   link_info.strip = strip_none;
    234   link_info.discard = discard_none;
    235   link_info.keep_memory = true;
     320  link_info.hash = NULL;
     321  link_info.keep_hash = NULL;
     322  link_info.notice_hash = NULL;
     323  link_info.wrap_hash = NULL;
    236324  link_info.input_bfds = NULL;
    237325  link_info.create_object_symbols_section = NULL;
    238   link_info.hash = NULL;
    239   link_info.keep_hash = NULL;
    240   link_info.notice_all = false;
    241   link_info.notice_hash = NULL;
    242   link_info.wrap_hash = NULL;
    243   link_info.mpc860c0 = 0;
     326  link_info.gc_sym_list = NULL;
     327  link_info.base_file = NULL;
    244328  /* SVR4 linkers seem to set DT_INIT and DT_FINI based on magic _init
    245329     and _fini symbols.  We are compatible.  */
    246330  link_info.init_function = "_init";
    247331  link_info.fini_function = "_fini";
    248   link_info.new_dtags = false;
     332  link_info.mpc860c0 = 0;
     333  link_info.pei386_auto_import = -1;
     334  link_info.pei386_runtime_pseudo_reloc = FALSE;
     335  link_info.spare_dynamic_tags = 5;
    249336  link_info.flags = (bfd_vma) 0;
    250337  link_info.flags_1 = (bfd_vma) 0;
     338  link_info.relax_finalizing = FALSE;
    251339
    252340  ldfile_add_arch ("");
    253341
    254   config.make_executable = true;
    255   force_make_executable = false;
    256   config.magic_demand_paged = true;
    257   config.text_read_only = true;
     342  config.make_executable = TRUE;
     343  force_make_executable = FALSE;
     344  config.magic_demand_paged = TRUE;
     345  config.text_read_only = TRUE;
    258346
    259347  emulation = get_emulation (argc, argv);
    260348  ldemul_choose_mode (emulation);
    261   default_target = ldemul_choose_target ();
     349  default_target = ldemul_choose_target (argc, argv);
    262350  lang_init ();
    263351  ldemul_before_parse ();
    264   lang_has_input_file = false;
     352  lang_has_input_file = FALSE;
    265353  parse_args (argc, argv);
    266354
     
    279367    }
    280368
     369  if (! link_info.shared)
     370    {
     371      if (command_line.filter_shlib)
     372        einfo (_("%P%F: -F may not be used without -shared\n"));
     373      if (command_line.auxiliary_filters)
     374        einfo (_("%P%F: -f may not be used without -shared\n"));
     375    }
     376
    281377  /* Treat ld -r -s as ld -r -S -x (i.e., strip all local symbols).  I
    282378     don't see how else this can be handled, since in this case we
     
    285381    {
    286382      link_info.strip = strip_debugger;
    287       if (link_info.discard == discard_none)
     383      if (link_info.discard == discard_sec_merge)
    288384        link_info.discard = discard_all;
    289385    }
     
    293389  set_scripts_dir ();
    294390
    295   if (had_script == false)
    296     {
    297       /* Read the emulation's appropriate default script.  */
     391  /* If we have not already opened and parsed a linker script
     392     read the emulation's appropriate default script.  */
     393  if (saved_script_handle == NULL)
     394    {
    298395      int isfile;
    299396      char *s = ldemul_get_script (&isfile);
     
    303400      else
    304401        {
    305           if (trace_file_tries)
    306             {
    307               info_msg (_("using internal linker script:\n"));
    308               info_msg ("==================================================\n");
    309               info_msg (s);
    310               info_msg ("\n==================================================\n");
    311             }
    312402          lex_string = s;
    313403          lex_redirect (s);
     
    318408    }
    319409
     410  if (trace_file_tries)
     411    {
     412      if (saved_script_handle)
     413        info_msg (_("using external linker script:"));
     414      else
     415        info_msg (_("using internal linker script:"));
     416      info_msg ("\n==================================================\n");
     417
     418      if (saved_script_handle)
     419        {
     420          static const int ld_bufsz = 8193;
     421          size_t n;
     422          char *buf = xmalloc (ld_bufsz);
     423
     424          rewind (saved_script_handle);
     425          while ((n = fread (buf, 1, ld_bufsz - 1, saved_script_handle)) > 0)
     426            {
     427              buf[n] = 0;
     428              info_msg (buf);
     429            }
     430          rewind (saved_script_handle);
     431          free (buf);
     432        }
     433      else
     434        {
     435          int isfile;
     436
     437          info_msg (ldemul_get_script (&isfile));
     438        }
     439
     440      info_msg ("\n==================================================\n");
     441    }
     442
    320443  lang_final ();
    321444
    322   if (lang_has_input_file == false)
     445  if (!lang_has_input_file)
    323446    {
    324447      if (version_printed)
     
    328451
    329452  if (trace_files)
    330     {
    331       info_msg (_("%P: mode %s\n"), emulation);
    332     }
     453    info_msg (_("%P: mode %s\n"), emulation);
    333454
    334455  ldemul_after_parse ();
     
    356477  /* Print error messages for any missing symbols, for any warning
    357478     symbols, and possibly multiple definitions.  */
    358 
    359   if (! link_info.relocateable)
    360     {
    361       /* Look for a text section and switch the readonly attribute in it.  */
    362       asection *found = bfd_get_section_by_name (output_bfd, ".text");
    363 
    364       if (found != (asection *) NULL)
    365         {
    366           if (config.text_read_only)
    367             found->flags |= SEC_READONLY;
    368           else
    369             found->flags &= ~SEC_READONLY;
    370         }
    371     }
    372 
    373479  if (link_info.relocateable)
    374480    output_bfd->flags &= ~EXEC_P;
     
    388494     be reported in the exit status.  (What non-fatal errors, if any, do we
    389495     want to ignore for relocateable output?)  */
    390 
    391   if (config.make_executable == false && force_make_executable == false)
    392     {
    393       if (trace_files == true)
    394         {
    395           einfo (_("%P: link errors found, deleting executable `%s'\n"),
    396                  output_filename);
    397         }
     496  if (!config.make_executable && !force_make_executable)
     497    {
     498      if (trace_files)
     499        einfo (_("%P: link errors found, deleting executable `%s'\n"),
     500               output_filename);
    398501
    399502      /* The file will be removed by remove_output.  */
    400 
    401503      xexit (1);
    402504    }
     
    416518        {
    417519          int len = strlen (output_filename);
     520
    418521          if (len < 4
    419522              || (strcasecmp (output_filename + len - 4, ".exe") != 0
     
    426529              int l;
    427530              char *dst_name = xmalloc (len + 5);
     531
    428532              strcpy (dst_name, output_filename);
    429533              strcat (dst_name, ".exe");
     
    438542                {
    439543                  int done = fwrite (buf, 1, l, dst);
     544
    440545                  if (done != l)
    441                     {
    442                       einfo (_("%P: Error writing file `%s'\n"), dst_name);
    443                     }
     546                    einfo (_("%P: Error writing file `%s'\n"), dst_name);
    444547                }
     548
    445549              fclose (src);
    446550              if (fclose (dst) == EOF)
    447                 {
    448                   einfo (_("%P: Error closing file `%s'\n"), dst_name);
    449                 }
     551                einfo (_("%P: Error closing file `%s'\n"), dst_name);
    450552              free (dst_name);
    451553              free (buf);
     
    506608                }
    507609              else
    508                 {
    509                   einfo (_("%P%F: missing argument to -m\n"));
    510                 }
     610                einfo (_("%P%F: missing argument to -m\n"));
    511611            }
    512612          else if (strcmp (argv[i], "-mips1") == 0
    513613                   || strcmp (argv[i], "-mips2") == 0
    514614                   || strcmp (argv[i], "-mips3") == 0
    515                    || strcmp (argv[i], "-mips4") == 0)
     615                   || strcmp (argv[i], "-mips4") == 0
     616                   || strcmp (argv[i], "-mips5") == 0
     617                   || strcmp (argv[i], "-mips32") == 0
     618                   || strcmp (argv[i], "-mips32r2") == 0
     619                   || strcmp (argv[i], "-mips64") == 0)
    516620            {
    517               /* FIXME: The arguments -mips1, -mips2 and -mips3 are
     621              /* FIXME: The arguments -mips1, -mips2, -mips3, etc. are
    518622                 passed to the linker by some MIPS compilers.  They
    519623                 generally tell the linker to use a slightly different
     
    541645
    542646/* If directory DIR contains an "ldscripts" subdirectory,
    543    add DIR to the library search path and return true,
    544    else return false.  */
    545 
    546 static boolean
     647   add DIR to the library search path and return TRUE,
     648   else return FALSE.  */
     649
     650static bfd_boolean
    547651check_for_scripts_dir (dir)
    548652     char *dir;
     
    551655  char *buf;
    552656  struct stat s;
    553   boolean res;
     657  bfd_boolean res;
    554658
    555659  dirlen = strlen (dir);
     
    561665  free (buf);
    562666  if (res)
    563     ldfile_add_library_path (dir, false);
     667    ldfile_add_library_path (dir, FALSE);
    564668  return res;
    565669}
     
    570674
    571675   SCRIPTDIR (passed from Makefile)
     676             (adjusted according to the current location of the binary)
     677   SCRIPTDIR (passed from Makefile)
    572678   the dir where this program is (for using it from the build tree)
    573    the dir where this program is/../lib (for installing the tool suite elsewhere) */
     679   the dir where this program is/../lib
     680             (for installing the tool suite elsewhere).  */
    574681
    575682static void
     
    578685  char *end, *dir;
    579686  size_t dirlen;
     687  bfd_boolean found;
     688
     689  dir = make_relative_prefix (program_name, BINDIR, SCRIPTDIR);
     690  if (dir)
     691    {
     692      found = check_for_scripts_dir (dir);
     693      free (dir);
     694      if (found)
     695        return;
     696    }
     697
     698  dir = make_relative_prefix (program_name, TOOLBINDIR, SCRIPTDIR);
     699  if (dir)
     700    {
     701      found = check_for_scripts_dir (dir);
     702      free (dir);
     703      if (found)
     704        return;
     705    }
    580706
    581707  if (check_for_scripts_dir (SCRIPTDIR))
     
    589715    /* We could have \foo\bar, or /foo\bar.  */
    590716    char *bslash = strrchr (program_name, '\\');
     717
    591718    if (end == NULL || (bslash != NULL && bslash > end))
    592719      end = bslash;
     
    595722
    596723  if (end == NULL)
    597     {
    598       /* Don't look for ldscripts in the current directory.  There is
    599          too much potential for confusion.  */
    600       return;
    601     }
     724    /* Don't look for ldscripts in the current directory.  There is
     725       too much potential for confusion.  */
     726    return;
    602727
    603728  dirlen = end - program_name;
     
    609734
    610735  if (check_for_scripts_dir (dir))
    611     /* Don't free dir.  */
    612     return;
     736    {
     737      free (dir);
     738      return;
     739    }
    613740
    614741  /* Look for "ldscripts" in <the dir where our binary is>/../lib.  */
    615742  strcpy (dir + dirlen, "/../lib");
    616   if (check_for_scripts_dir (dir))
    617     return;
    618 
    619   /* Well, we tried.  */
     743  check_for_scripts_dir (dir);
    620744  free (dir);
    621745}
     
    635759    }
    636760
    637   if (bfd_hash_lookup (link_info.notice_hash, name, true, true)
     761  if (bfd_hash_lookup (link_info.notice_hash, name, TRUE, TRUE)
    638762      == (struct bfd_hash_entry *) NULL)
    639763    einfo (_("%P%F: bfd_hash_lookup failed: %E\n"));
     
    655779        einfo (_("%P%F: bfd_hash_table_init failed: %E\n"));
    656780    }
    657   if (bfd_hash_lookup (link_info.wrap_hash, name, true, true) == NULL)
     781
     782  if (bfd_hash_lookup (link_info.wrap_hash, name, TRUE, TRUE) == NULL)
    658783    einfo (_("%P%F: bfd_hash_lookup failed: %E\n"));
    659784}
     
    692817  while (c != EOF)
    693818    {
    694       while (isspace (c))
     819      while (ISSPACE (c))
    695820        c = getc (file);
    696821
     
    699824          size_t len = 0;
    700825
    701           while (! isspace (c) && c != EOF)
     826          while (! ISSPACE (c) && c != EOF)
    702827            {
    703828              buf[len] = c;
     
    713838          buf[len] = '\0';
    714839
    715           if (bfd_hash_lookup (link_info.keep_hash, buf, true, true)
     840          if (bfd_hash_lookup (link_info.keep_hash, buf, TRUE, TRUE)
    716841              == (struct bfd_hash_entry *) NULL)
    717842            einfo (_("%P%F: bfd_hash_lookup for insertion failed: %E\n"));
     
    722847    einfo (_("%P: `-retain-symbols-file' overrides `-s' and `-S'\n"));
    723848
     849  free (buf);
    724850  link_info.strip = strip_some;
    725851}
     
    731857   a link.  */
    732858
    733 static boolean
     859static bfd_boolean
    734860add_archive_element (info, abfd, name)
    735861     struct bfd_link_info *info ATTRIBUTE_UNUSED;
     
    746872  input->asymbols = NULL;
    747873  input->next = NULL;
    748   input->just_syms_flag = false;
    749   input->loaded = false;
    750   input->search_dirs_flag = false;
     874  input->just_syms_flag = FALSE;
     875  input->loaded = FALSE;
     876  input->search_dirs_flag = FALSE;
    751877
    752878  /* FIXME: The following fields are not set: header.next,
     
    760886  if (config.map_file != (FILE *) NULL)
    761887    {
    762       static boolean header_printed;
     888      static bfd_boolean header_printed;
    763889      struct bfd_link_hash_entry *h;
    764890      bfd *from;
    765891      int len;
    766892
    767       h = bfd_link_hash_lookup (link_info.hash, name, false, false, true);
     893      h = bfd_link_hash_lookup (link_info.hash, name, FALSE, FALSE, TRUE);
    768894
    769895      if (h == NULL)
     
    797923          char buf[100];
    798924
    799           sprintf (buf, "%-29s %s\n\n", _("Archive member included"),
    800                    _("because of file (symbol)"));
     925          sprintf (buf, _("Archive member included because of file (symbol)\n\n"));
    801926          minfo ("%s", buf);
    802           header_printed = true;
     927          header_printed = TRUE;
    803928        }
    804929
     
    839964    info_msg ("%I\n", input);
    840965
    841   return true;
     966  return TRUE;
    842967}
    843968
     
    845970   multiple times.  */
    846971
    847 static boolean
     972static bfd_boolean
    848973multiple_definition (info, name, obfd, osec, oval, nbfd, nsec, nval)
    849974     struct bfd_link_info *info ATTRIBUTE_UNUSED;
     
    867992          && ! bfd_is_abs_section (nsec)
    868993          && bfd_is_abs_section (nsec->output_section)))
    869     return true;
     994    return TRUE;
    870995
    871996  einfo (_("%X%C: multiple definition of `%T'\n"),
     
    8801005    }
    8811006
    882   return true;
     1007  return TRUE;
    8831008}
    8841009
     
    8881013   -warn-common was used.  */
    8891014
    890 static boolean
     1015static bfd_boolean
    8911016multiple_common (info, name, obfd, otype, osize, nbfd, ntype, nsize)
    8921017     struct bfd_link_info *info ATTRIBUTE_UNUSED;
     
    9001025{
    9011026  if (! config.warn_common)
    902     return true;
     1027    return TRUE;
    9031028
    9041029  if (ntype == bfd_link_hash_defined
     
    9471072    }
    9481073
    949   return true;
     1074  return TRUE;
    9501075}
    9511076
     
    9541079   represent a value which should be added to the set.  */
    9551080
    956 static boolean
     1081static bfd_boolean
    9571082add_to_set (info, h, reloc, abfd, section, value)
    9581083     struct bfd_link_info *info ATTRIBUTE_UNUSED;
     
    9681093
    9691094  if (! config.build_constructors)
    970     return true;
     1095    return TRUE;
    9711096
    9721097  ldctor_add_set_entry (h, reloc, (const char *) NULL, section, value);
     
    9811106    }
    9821107
    983   return true;
     1108  return TRUE;
    9841109}
    9851110
     
    9891114   adding an element to a set, but less general.  */
    9901115
    991 static boolean
     1116static bfd_boolean
    9921117constructor_callback (info, constructor, name, abfd, section, value)
    9931118     struct bfd_link_info *info;
    994      boolean constructor;
     1119     bfd_boolean constructor;
    9951120     const char *name;
    9961121     bfd *abfd;
     
    10061131
    10071132  if (! config.build_constructors)
    1008     return true;
     1133    return TRUE;
    10091134
    10101135  /* Ensure that BFD_RELOC_CTOR exists now, so that we can give a
     
    10231148    strcpy (s, "__DTOR_LIST__");
    10241149
    1025   h = bfd_link_hash_lookup (info->hash, set_name, true, true, true);
     1150  h = bfd_link_hash_lookup (info->hash, set_name, TRUE, TRUE, TRUE);
    10261151  if (h == (struct bfd_link_hash_entry *) NULL)
    10271152    einfo (_("%P%F: bfd_link_hash_lookup failed: %E\n"));
     
    10361161
    10371162  ldctor_add_set_entry (h, BFD_RELOC_CTOR, name, section, value);
    1038   return true;
     1163  return TRUE;
    10391164}
    10401165
     
    10421167   bfd_map_over_sections.  */
    10431168
    1044 struct warning_callback_info {
    1045   boolean found;
     1169struct warning_callback_info
     1170{
     1171  bfd_boolean found;
    10461172  const char *warning;
    10471173  const char *symbol;
     
    10511177/* This is called when there is a reference to a warning symbol.  */
    10521178
    1053 static boolean
     1179static bfd_boolean
    10541180warning_callback (info, warning, symbol, abfd, section, address)
    10551181     struct bfd_link_info *info ATTRIBUTE_UNUSED;
     
    10641190  if (! config.warn_multiple_gp
    10651191      && strcmp (warning, "using multiple gp values") == 0)
    1066     return true;
     1192    return TRUE;
    10671193
    10681194  if (section != NULL)
     
    10801206      /* Look through the relocs to see if we can find a plausible
    10811207         address.  */
    1082 
    10831208      entry = (lang_input_statement_type *) abfd->usrdata;
    10841209      if (entry != NULL && entry->asymbols != NULL)
     
    11031228        }
    11041229
    1105       info.found = false;
     1230      info.found = FALSE;
    11061231      info.warning = warning;
    11071232      info.symbol = symbol;
     
    11161241    }
    11171242
    1118   return true;
     1243  return TRUE;
    11191244}
    11201245
     
    11621287          /* We found a reloc for the symbol we are looking for.  */
    11631288          einfo ("%C: %s\n", abfd, sec, q->address, info->warning);
    1164           info->found = true;
     1289          info->found = TRUE;
    11651290          break;
    11661291        }
     
    11721297/* This is called when an undefined symbol is found.  */
    11731298
    1174 static boolean
     1299static bfd_boolean
    11751300undefined_symbol (info, name, abfd, section, address, fatal)
    11761301     struct bfd_link_info *info ATTRIBUTE_UNUSED;
     
    11791304     asection *section;
    11801305     bfd_vma address;
    1181      boolean fatal ATTRIBUTE_UNUSED;
     1306     bfd_boolean fatal ATTRIBUTE_UNUSED;
    11821307{
    11831308  static char *error_name;
     
    11911316
    11921317      /* Only warn once about a particular undefined symbol.  */
    1193 
    11941318      if (hash == NULL)
    11951319        {
     
    12001324        }
    12011325
    1202       if (bfd_hash_lookup (hash, name, false, false) != NULL)
    1203         return true;
    1204 
    1205       if (bfd_hash_lookup (hash, name, true, true) == NULL)
     1326      if (bfd_hash_lookup (hash, name, FALSE, FALSE) != NULL)
     1327        return TRUE;
     1328
     1329      if (bfd_hash_lookup (hash, name, TRUE, TRUE) == NULL)
    12061330        einfo (_("%F%P: bfd_hash_lookup failed: %E\n"));
    12071331    }
     
    12471371    }
    12481372
    1249   return true;
     1373  return TRUE;
    12501374}
    12511375
    12521376/* This is called when a reloc overflows.  */
    12531377
    1254 static boolean
     1378static bfd_boolean
    12551379reloc_overflow (info, name, reloc_name, addend, abfd, section, address)
    12561380     struct bfd_link_info *info ATTRIBUTE_UNUSED;
     
    12701394    einfo ("+%v", addend);
    12711395  einfo ("\n");
    1272   return true;
     1396  return TRUE;
    12731397}
    12741398
    12751399/* This is called when a dangerous relocation is made.  */
    12761400
    1277 static boolean
     1401static bfd_boolean
    12781402reloc_dangerous (info, message, abfd, section, address)
    12791403     struct bfd_link_info *info ATTRIBUTE_UNUSED;
     
    12881412    einfo ("%X%C:", abfd, section, address);
    12891413  einfo (_("dangerous relocation: %s\n"), message);
    1290   return true;
     1414  return TRUE;
    12911415}
    12921416
     
    12941418   that is not being output.  */
    12951419
    1296 static boolean
     1420static bfd_boolean
    12971421unattached_reloc (info, name, abfd, section, address)
    12981422     struct bfd_link_info *info ATTRIBUTE_UNUSED;
     
    13071431    einfo ("%X%C:", abfd, section, address);
    13081432  einfo (_(" reloc refers to symbol `%T' which is not being output\n"), name);
    1309   return true;
     1433  return TRUE;
    13101434}
    13111435
     
    13141438   using the -y option.  */
    13151439
    1316 static boolean
     1440static bfd_boolean
    13171441notice (info, name, abfd, section, value)
    13181442     struct bfd_link_info *info;
     
    13241448  if (! info->notice_all
    13251449      || (info->notice_hash != NULL
    1326           && bfd_hash_lookup (info->notice_hash, name, false, false) != NULL))
     1450          && bfd_hash_lookup (info->notice_hash, name, FALSE, FALSE) != NULL))
    13271451    {
    13281452      if (bfd_is_und_section (section))
     
    13351459    add_cref (name, abfd, section, value);
    13361460
    1337   return true;
    1338 }
     1461  return TRUE;
     1462}
Note: See TracChangeset for help on using the changeset viewer.