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/lexsup.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    11/* Parse options for the GNU linker.
    22   Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
    3    2001
     3   2001, 2002, 2003
    44   Free Software Foundation, Inc.
    55
    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.  */
     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.  */
    2222
    2323#include "bfd.h"
     
    2626#include <stdio.h>
    2727#include <string.h>
    28 #include <ctype.h>
     28#include "safe-ctype.h"
    2929#include "getopt.h"
    3030#include "bfdlink.h"
     
    3434#include "ldexp.h"
    3535#include "ldlang.h"
    36 #include "ldgram.h"
     36#include <ldgram.h>
    3737#include "ldlex.h"
    3838#include "ldfile.h"
     
    5454#endif
    5555
    56 /* Omit args to avoid the possibility of clashing with a system header
    57    that might disagree about consts.  */
    58 unsigned long strtoul ();
    59 
    6056static int is_num PARAMS ((const char *, int, int, int));
    61 static void set_default_dirlist PARAMS ((char *dirlist_ptr));
    62 static void set_section_start PARAMS ((char *sect, char *valstr));
     57static void set_default_dirlist PARAMS ((char *));
     58static void set_section_start PARAMS ((char *, char *));
    6359static void help PARAMS ((void));
    6460
     
    110106#define OPTION_WARN_COMMON              (OPTION_VERSION_EXPORTS_SECTION + 1)
    111107#define OPTION_WARN_CONSTRUCTORS        (OPTION_WARN_COMMON + 1)
    112 #define OPTION_WARN_MULTIPLE_GP         (OPTION_WARN_CONSTRUCTORS + 1)
     108#define OPTION_WARN_FATAL               (OPTION_WARN_CONSTRUCTORS + 1)
     109#define OPTION_WARN_MULTIPLE_GP         (OPTION_WARN_FATAL + 1)
    113110#define OPTION_WARN_ONCE                (OPTION_WARN_MULTIPLE_GP + 1)
    114111#define OPTION_WARN_SECTION_ALIGN       (OPTION_WARN_ONCE + 1)
     
    130127#define OPTION_TARGET_HELP              (OPTION_UNIQUE + 1)
    131128#define OPTION_ALLOW_SHLIB_UNDEFINED    (OPTION_TARGET_HELP + 1)
     129#define OPTION_NO_ALLOW_SHLIB_UNDEFINED (OPTION_ALLOW_SHLIB_UNDEFINED + 1)
     130#define OPTION_ALLOW_MULTIPLE_DEFINITION (OPTION_NO_ALLOW_SHLIB_UNDEFINED + 1)
     131#define OPTION_NO_UNDEFINED_VERSION     (OPTION_ALLOW_MULTIPLE_DEFINITION + 1)
     132#define OPTION_DISCARD_NONE             (OPTION_NO_UNDEFINED_VERSION + 1)
     133#define OPTION_SPARE_DYNAMIC_TAGS       (OPTION_DISCARD_NONE + 1)
     134#define OPTION_NO_DEFINE_COMMON         (OPTION_SPARE_DYNAMIC_TAGS + 1)
     135#define OPTION_NOSTDLIB                 (OPTION_NO_DEFINE_COMMON + 1)
     136#define OPTION_NO_OMAGIC                (OPTION_NOSTDLIB + 1)
     137#define OPTION_STRIP_DISCARDED          (OPTION_NO_OMAGIC + 1)
     138#define OPTION_NO_STRIP_DISCARDED       (OPTION_STRIP_DISCARDED + 1)
     139#define OPTION_ACCEPT_UNKNOWN_INPUT_ARCH    (OPTION_NO_STRIP_DISCARDED + 1)
     140#define OPTION_NO_ACCEPT_UNKNOWN_INPUT_ARCH (OPTION_ACCEPT_UNKNOWN_INPUT_ARCH + 1)
    132141
    133142/* The long options.  This structure is used for both the option
     
    200209  { {"soname", required_argument, NULL, OPTION_SONAME},
    201210      'h', N_("FILENAME"), N_("Set internal name of shared library"), ONE_DASH },
     211  { {"dynamic-linker", required_argument, NULL, OPTION_DYNAMIC_LINKER},
     212      'I', N_("PROGRAM"), N_("Set PROGRAM as the dynamic linker to use"), TWO_DASHES },
    202213  { {"library", required_argument, NULL, 'l'},
    203214      'l', N_("LIBNAME"), N_("Search for library LIBNAME"), TWO_DASHES },
     
    213224      'N', NULL, N_("Do not page align data, do not make text readonly"),
    214225      EXACTLY_TWO_DASHES },
     226  { {"no-omagic", no_argument, NULL, OPTION_NO_OMAGIC},
     227      '\0', NULL, N_("Page align data, make text readonly"), EXACTLY_TWO_DASHES },
    215228  { {"output", required_argument, NULL, 'o'},
    216229      'o', N_("FILE"), N_("Set output file name"), EXACTLY_TWO_DASHES },
     
    232245  { {"strip-debug", no_argument, NULL, 'S'},
    233246      'S', NULL, N_("Strip debugging symbols"), TWO_DASHES },
     247  { {"strip-discarded", no_argument, NULL, OPTION_STRIP_DISCARDED},
     248      '\0', NULL, N_("Strip symbols in discarded sections"), TWO_DASHES },
     249  { {"no-strip-discarded", no_argument, NULL, OPTION_NO_STRIP_DISCARDED},
     250      '\0', NULL, N_("Do not strip symbols in discarded sections"), TWO_DASHES },
    234251  { {"trace", no_argument, NULL, 't'},
    235252      't', NULL, N_("Trace file opens"), TWO_DASHES },
     
    249266      'x', NULL, N_("Discard all local symbols"), TWO_DASHES },
    250267  { {"discard-locals", no_argument, NULL, 'X'},
    251       'X', NULL, N_("Discard temporary local symbols"), TWO_DASHES },
     268      'X', NULL, N_("Discard temporary local symbols (default)"), TWO_DASHES },
     269  { {"discard-none", no_argument, NULL, OPTION_DISCARD_NONE},
     270      '\0', NULL, N_("Don't discard any local symbols"), TWO_DASHES },
    252271  { {"trace-symbol", required_argument, NULL, 'y'},
    253272      'y', N_("SYMBOL"), N_("Trace mentions of SYMBOL"), TWO_DASHES },
     
    258277  { {"end-group", no_argument, NULL, ')'},
    259278      ')', NULL, N_("End a group"), TWO_DASHES },
     279  { {"accept-unknown-input-arch", no_argument, NULL, OPTION_ACCEPT_UNKNOWN_INPUT_ARCH},
     280    '\0', NULL, N_("Accept input files whose architecture cannot be determined"), TWO_DASHES },
     281  { {"no-accept-unknown-input-arch", no_argument, NULL, OPTION_NO_ACCEPT_UNKNOWN_INPUT_ARCH},
     282    '\0', NULL, N_("Reject input files whose architecture is unknown"), TWO_DASHES },
    260283  { {"assert", required_argument, NULL, OPTION_ASSERT},
    261284      '\0', N_("KEYWORD"), N_("Ignored for SunOS compatibility"), ONE_DASH },
     
    287310  { {"demangle", optional_argument, NULL, OPTION_DEMANGLE},
    288311      '\0', N_("[=STYLE]"), N_("Demangle symbol names [using STYLE]"), TWO_DASHES },
    289   { {"dynamic-linker", required_argument, NULL, OPTION_DYNAMIC_LINKER},
    290       '\0', N_("PROGRAM"), N_("Set the dynamic linker to use"), TWO_DASHES },
    291312  { {"embedded-relocs", no_argument, NULL, OPTION_EMBEDDED_RELOCS},
    292313      '\0', NULL, N_("Generate embedded relocs"), TWO_DASHES},
     
    307328  { {"Map", required_argument, NULL, OPTION_MAP},
    308329      '\0', N_("FILE"), N_("Write a map file"), ONE_DASH },
     330  { {"no-define-common", no_argument, NULL, OPTION_NO_DEFINE_COMMON},
     331      '\0', NULL, N_("Do not define Common storage"), TWO_DASHES },
    309332  { {"no-demangle", no_argument, NULL, OPTION_NO_DEMANGLE },
    310333      '\0', NULL, N_("Do not demangle symbol names"), TWO_DASHES },
     
    314337     '\0', NULL, N_("Allow no undefined symbols"), TWO_DASHES },
    315338  { {"allow-shlib-undefined", no_argument, NULL, OPTION_ALLOW_SHLIB_UNDEFINED},
    316      '\0', NULL, N_("Allow undefined symbols in shared objects"), TWO_DASHES },
     339     '\0', NULL, N_("Allow undefined symbols in shared objects (the default)"), TWO_DASHES },
     340  { {"no-allow-shlib-undefined", no_argument, NULL, OPTION_NO_ALLOW_SHLIB_UNDEFINED},
     341     '\0', NULL, N_("Do not allow undefined symbols in shared objects"), TWO_DASHES },
     342  { {"allow-multiple-definition", no_argument, NULL, OPTION_ALLOW_MULTIPLE_DEFINITION},
     343     '\0', NULL, N_("Allow multiple definitions"), TWO_DASHES },
     344  { {"no-undefined-version", no_argument, NULL, OPTION_NO_UNDEFINED_VERSION},
     345     '\0', NULL, N_("Disallow undefined version"), TWO_DASHES },
    317346  { {"no-warn-mismatch", no_argument, NULL, OPTION_NO_WARN_MISMATCH},
    318347      '\0', NULL, N_("Don't warn about mismatched input files"), TWO_DASHES},
     
    323352  { {"noinhibit_exec", no_argument, NULL, OPTION_NOINHIBIT_EXEC},
    324353      '\0', NULL, NULL, NO_HELP },
     354  { {"nostdlib", no_argument, NULL, OPTION_NOSTDLIB},
     355      '\0', NULL, N_("Only use library directories specified on\n\t\t\t\tthe command line"), ONE_DASH },
    325356  { {"oformat", required_argument, NULL, OPTION_OFORMAT},
    326357      '\0', N_("TARGET"), N_("Specify target of output file"), EXACTLY_TWO_DASHES },
     
    344375  { {"sort_common", no_argument, NULL, OPTION_SORT_COMMON},
    345376      '\0', NULL, NULL, NO_HELP },
     377  { {"spare-dynamic-tags", required_argument, NULL, OPTION_SPARE_DYNAMIC_TAGS},
     378      '\0', N_("COUNT"), N_("How many tags to reserve in .dynamic section"), TWO_DASHES },
    346379  { {"split-by-file", optional_argument, NULL, OPTION_SPLIT_BY_FILE},
    347380      '\0', N_("[=SIZE]"), N_("Split output sections every SIZE octets"), TWO_DASHES },
     
    386419      '\0', NULL, N_("Warn if start of section changes due to alignment"),
    387420      TWO_DASHES },
     421  { {"fatal-warnings", no_argument, NULL, OPTION_WARN_FATAL},
     422     '\0', NULL, N_("Treat warnings as errors"),
     423     TWO_DASHES },
    388424  { {"whole-archive", no_argument, NULL, OPTION_WHOLE_ARCHIVE},
    389425      '\0', NULL, N_("Include all objects from following archives"), TWO_DASHES },
     
    410446  for (; *string; ++string)
    411447    {
    412       if (! isdigit (*string))
     448      if (! ISDIGIT (*string))
    413449        {
    414450          result = err;
     
    432468  int ingroup = 0;
    433469  char *default_dirlist = NULL;
    434   char shortopts[OPTION_COUNT * 3 + 2];
    435   struct option longopts[OPTION_COUNT + 1];
    436   struct option really_longopts[OPTION_COUNT + 1];
     470  char *shortopts;
     471  struct option *longopts;
     472  struct option *really_longopts;
    437473  int last_optind;
     474
     475  shortopts = (char *) xmalloc (OPTION_COUNT * 3 + 2);
     476  longopts = (struct option *) xmalloc (sizeof (*longopts)
     477                                        * (OPTION_COUNT + 1));
     478  really_longopts = (struct option *) xmalloc (sizeof (*really_longopts)
     479                                               * (OPTION_COUNT + 1));
    438480
    439481  /* Starting the short option string with '-' is for programs that
     
    481523  really_longopts[irl].name = NULL;
    482524
     525  ldemul_add_options (is, &shortopts, il, &longopts, irl, &really_longopts);
     526
    483527  /* The -G option is ambiguous on different platforms.  Sometimes it
    484528     specifies the largest data size to put into the small data
     
    495539    if (strcmp (argv[i], "-G") == 0
    496540        && (i + 1 >= argc
    497             || ! isdigit ((unsigned char) argv[i + 1][0])))
     541            || ! ISDIGIT (argv[i + 1][0])))
    498542      argv[i] = (char *) "--shared";
    499543
     
    537581         loop around to pick up the -x.  */
    538582      if (optind != last_optind)
    539         {
    540           if (ldemul_parse_args (argc, argv))
    541             continue;
    542           last_optind = optind;
    543         }
     583        if (ldemul_parse_args (argc, argv))
     584          continue;
    544585
    545586      /* getopt_long_only is like getopt_long, but '-' as well as '--'
    546587         can indicate a long option.  */
    547588      opterr = 0;
     589      last_optind = optind;
    548590      optc = getopt_long_only (argc, argv, shortopts, longopts, &longind);
    549591      if (optc == '?')
    550592        {
    551           --optind;
    552           optc = getopt_long (argc, argv, shortopts, really_longopts, &longind);
     593          optind = last_optind;
     594          optc = getopt_long (argc, argv, "-", really_longopts, &longind);
    553595        }
     596
     597      if (ldemul_handle_option (optc))
     598        continue;
    554599
    555600      if (optc == -1)
     
    559604        {
    560605        case '?':
    561           fprintf (stderr, _("%s: unrecognized option '%s'\n"),
    562                    program_name, argv[optind - 1]);
     606          einfo (_("%P: unrecognized option '%s'\n"), argv[last_optind]);
    563607        default:
    564           fprintf (stderr,
    565                    _("%s: use the --help option for usage information\n"),
    566                    program_name);
    567           xexit (1);
     608          einfo (_("%P%F: use the --help option for usage information\n"));
     609
    568610        case 1:                 /* File name.  */
    569611          lang_add_input_file (optarg, lang_input_file_is_file_enum,
     
    578620             currently support shared libraries on HP/UX anyhow.  */
    579621          if (strcmp (optarg, "archive") == 0)
    580             config.dynamic_link = false;
     622            config.dynamic_link = FALSE;
    581623          else if (strcmp (optarg, "shared") == 0
    582624                   || strcmp (optarg, "default") == 0)
    583             config.dynamic_link = true;
     625            config.dynamic_link = TRUE;
    584626          else
    585627            einfo (_("%P%F: unrecognized -a option `%s'\n"), optarg);
     
    610652          break;
    611653        case OPTION_CALL_SHARED:
    612           config.dynamic_link = true;
     654          config.dynamic_link = TRUE;
    613655          break;
    614656        case OPTION_NON_SHARED:
    615           config.dynamic_link = false;
     657          config.dynamic_link = FALSE;
    616658          break;
    617659        case OPTION_CREF:
    618           command_line.cref = true;
    619           link_info.notice_all = true;
     660          command_line.cref = TRUE;
     661          link_info.notice_all = TRUE;
    620662          break;
    621663        case 'd':
    622           command_line.force_common_definition = true;
     664          command_line.force_common_definition = TRUE;
    623665          break;
    624666        case OPTION_DEFSYM:
     
    632674          break;
    633675        case OPTION_DEMANGLE:
    634           demangling = true;
     676          demangling = TRUE;
    635677          if (optarg != NULL)
    636678            {
     
    645687            }
    646688          break;
     689        case 'I':               /* Used on Solaris.  */
    647690        case OPTION_DYNAMIC_LINKER:
    648691          command_line.interpreter = optarg;
     
    655698          break;
    656699        case OPTION_EMBEDDED_RELOCS:
    657           command_line.embedded_relocs = true;
     700          command_line.embedded_relocs = TRUE;
    658701          break;
    659702        case OPTION_EXPORT_DYNAMIC:
    660703        case 'E': /* HP/UX compatibility.  */
    661           command_line.export_dynamic = true;
     704          link_info.export_dynamic = TRUE;
    662705          break;
    663706        case 'e':
    664           lang_add_entry (optarg, true);
     707          lang_add_entry (optarg, TRUE);
    665708          break;
    666709        case 'f':
     
    691734          break;
    692735        case OPTION_FORCE_EXE_SUFFIX:
    693           command_line.force_exe_suffix = true;
     736          command_line.force_exe_suffix = TRUE;
    694737          break;
    695738        case 'G':
     
    705748          break;
    706749        case OPTION_GC_SECTIONS:
    707           command_line.gc_sections = true;
     750          command_line.gc_sections = TRUE;
    708751          break;
    709752        case OPTION_HELP:
     
    712755          break;
    713756        case 'L':
    714           ldfile_add_library_path (optarg, true);
     757          ldfile_add_library_path (optarg, TRUE);
    715758          break;
    716759        case 'l':
     
    728771          break;
    729772        case 'N':
    730           config.text_read_only = false;
    731           config.magic_demand_paged = false;
    732           config.dynamic_link = false;
     773          config.text_read_only = FALSE;
     774          config.magic_demand_paged = FALSE;
     775          config.dynamic_link = FALSE;
     776          break;
     777        case OPTION_NO_OMAGIC:
     778          config.text_read_only = TRUE;
     779          config.magic_demand_paged = TRUE;
     780          /* NB/ Does not set dynamic_link to TRUE.
     781             Use --call-shared or -Bdynamic for this.  */
    733782          break;
    734783        case 'n':
    735           config.magic_demand_paged = false;
    736           config.dynamic_link = false;
     784          config.magic_demand_paged = FALSE;
     785          config.dynamic_link = FALSE;
     786          break;
     787        case OPTION_NO_DEFINE_COMMON:
     788          command_line.inhibit_common_definition = TRUE;
    737789          break;
    738790        case OPTION_NO_DEMANGLE:
    739           demangling = false;
     791          demangling = FALSE;
    740792          break;
    741793        case OPTION_NO_GC_SECTIONS:
    742           command_line.gc_sections = false;
     794          command_line.gc_sections = FALSE;
    743795          break;
    744796        case OPTION_NO_KEEP_MEMORY:
    745           link_info.keep_memory = false;
     797          link_info.keep_memory = FALSE;
    746798          break;
    747799        case OPTION_NO_UNDEFINED:
    748           link_info.no_undefined = true;
     800          link_info.no_undefined = TRUE;
    749801          break;
    750802        case OPTION_ALLOW_SHLIB_UNDEFINED:
    751           link_info.allow_shlib_undefined = true;
     803          link_info.allow_shlib_undefined = TRUE;
     804          break;
     805        case OPTION_NO_ALLOW_SHLIB_UNDEFINED:
     806          link_info.allow_shlib_undefined = FALSE;
     807          break;
     808        case OPTION_ALLOW_MULTIPLE_DEFINITION:
     809          link_info.allow_multiple_definition = TRUE;
     810          break;
     811        case OPTION_NO_UNDEFINED_VERSION:
     812          link_info.allow_undefined_version = FALSE;
    752813          break;
    753814        case OPTION_NO_WARN_MISMATCH:
    754           command_line.warn_mismatch = false;
     815          command_line.warn_mismatch = FALSE;
    755816          break;
    756817        case OPTION_NOINHIBIT_EXEC:
    757           force_make_executable = true;
     818          force_make_executable = TRUE;
     819          break;
     820        case OPTION_NOSTDLIB:
     821          config.only_cmd_line_lib_dirs = TRUE;
    758822          break;
    759823        case OPTION_NO_WHOLE_ARCHIVE:
    760           whole_archive = false;
     824          whole_archive = FALSE;
    761825          break;
    762826        case 'O':
     
    768832
    769833          /* Enable optimizations of output files.  */
    770           link_info.optimize = strtoul (optarg, NULL, 0) ? true : false;
     834          link_info.optimize = strtoul (optarg, NULL, 0) ? TRUE : FALSE;
    771835          break;
    772836        case 'o':
     
    777841          break;
    778842        case 'q':
    779           link_info.emitrelocations = true;
     843          link_info.emitrelocations = TRUE;
    780844          break;
    781845        case 'i':
    782846        case 'r':
    783           link_info.relocateable = true;
    784           config.build_constructors = false;
    785           config.magic_demand_paged = false;
    786           config.text_read_only = false;
    787           config.dynamic_link = false;
     847          if (optind == last_optind)
     848            /* This can happen if the user put "-rpath,a" on the command
     849               line.  (Or something similar.  The comma is important).
     850               Getopt becomes confused and thinks that this is a -r option
     851               but it cannot parse the text after the -r so it refuses to
     852               increment the optind counter.  Detect this case and issue
     853               an error message here.  We cannot just make this a warning,
     854               increment optind, and continue because getopt is too confused
     855               and will seg-fault the next time around.  */
     856            einfo(_("%P%F: bad -rpath option\n"));
     857
     858          link_info.relocateable = TRUE;
     859          config.build_constructors = FALSE;
     860          config.magic_demand_paged = FALSE;
     861          config.text_read_only = FALSE;
     862          config.dynamic_link = FALSE;
    788863          break;
    789864        case 'R':
     
    822897                {
    823898                  size_t idx = 0;
     899
    824900                  while (optarg[idx] != '\0' && optarg[idx] == cp[idx])
    825901                    ++idx;
     
    861937          break;
    862938        case OPTION_RELAX:
    863           command_line.relax = true;
     939          command_line.relax = TRUE;
    864940          break;
    865941        case OPTION_RETAIN_SYMBOLS_FILE:
     
    872948          link_info.strip = strip_all;
    873949          break;
     950        case OPTION_STRIP_DISCARDED:
     951          link_info.strip_discarded = TRUE;
     952          break;
     953        case OPTION_NO_STRIP_DISCARDED:
     954          link_info.strip_discarded = FALSE;
     955          break;
    874956        case OPTION_SHARED:
    875957          if (config.has_shared)
    876             link_info.shared = true;
     958            link_info.shared = TRUE;
    877959          else
    878960            einfo (_("%P%F: -shared not supported\n"));
     
    883965          break;
    884966        case OPTION_SORT_COMMON:
    885           config.sort_common = true;
     967          config.sort_common = TRUE;
    886968          break;
    887969        case OPTION_STATS:
    888           config.stats = true;
     970          config.stats = TRUE;
    889971          break;
    890972        case OPTION_SYMBOLIC:
    891           link_info.symbolic = true;
     973          link_info.symbolic = TRUE;
    892974          break;
    893975        case 't':
    894           trace_files = true;
     976          trace_files = TRUE;
    895977          break;
    896978        case 'T':
     
    908990            optarg2 = strchr (optarg, '=');
    909991            if (optarg2 == NULL)
    910               {
    911                 fprintf (stderr,
    912                          _("%s: Invalid argument to option \"--section-start\"\n"),
    913                          program_name);
    914                 xexit (1);
    915               }
     992              einfo (_("%P%F: invalid argument to option \"--section-start\"\n"));
    916993
    917994            optarg2++;
     
    919996            /* So far so good.  Are all the args present?  */
    920997            if ((*optarg == '\0') || (*optarg2 == '\0'))
    921               {
    922                 fprintf (stderr,
    923                          _("%s: Missing argument(s) to option \"--section-start\"\n"),
    924                          program_name);
    925                 xexit (1);
    926               }
     998              einfo (_("%P%F: missing argument(s) to option \"--section-start\"\n"));
    927999
    9281000            /* We must copy the section name as set_section_start
     
    9391011        case OPTION_TARGET_HELP:
    9401012          /* Mention any target specific options.  */
    941           ldemul_list_emulation_options (stdout);
    942           exit (0);
     1013          ldemul_list_emulation_options (stdout);
     1014          exit (0);
    9431015        case OPTION_TBSS:
    9441016          set_section_start (".bss", optarg);
     
    9511023          break;
    9521024        case OPTION_TRADITIONAL_FORMAT:
    953           link_info.traditional_format = true;
     1025          link_info.traditional_format = TRUE;
    9541026          break;
    9551027        case OPTION_TASK_LINK:
    956           link_info.task_link = true;
     1028          link_info.task_link = TRUE;
    9571029          /* Fall through - do an implied -r option.  */
    9581030        case OPTION_UR:
    959           link_info.relocateable = true;
    960           config.build_constructors = true;
    961           config.magic_demand_paged = false;
    962           config.text_read_only = false;
    963           config.dynamic_link = false;
     1031          link_info.relocateable = TRUE;
     1032          config.build_constructors = TRUE;
     1033          config.magic_demand_paged = FALSE;
     1034          config.text_read_only = FALSE;
     1035          config.dynamic_link = FALSE;
    9641036          break;
    9651037        case 'u':
     
    9701042            lang_add_unique (optarg);
    9711043          else
    972             config.unique_orphan_sections = true;
     1044            config.unique_orphan_sections = TRUE;
    9731045          break;
    9741046        case OPTION_VERBOSE:
    9751047          ldversion (1);
    976           version_printed = true;
    977           trace_file_tries = true;
     1048          version_printed = TRUE;
     1049          trace_file_tries = TRUE;
    9781050          break;
    9791051        case 'v':
    9801052          ldversion (0);
    981           version_printed = true;
     1053          version_printed = TRUE;
    9821054          break;
    9831055        case 'V':
    9841056          ldversion (1);
    985           version_printed = true;
     1057          version_printed = TRUE;
    9861058          break;
    9871059        case OPTION_VERSION:
    988           /* This output is intended to follow the GNU standards document.  */
    989           printf ("GNU ld %s\n", ld_program_version);
    990           printf (_("Copyright 2001 Free Software Foundation, Inc.\n"));
    991           printf (_("\
    992 This program is free software; you may redistribute it under the terms of\n\
    993 the GNU General Public License.  This program has absolutely no warranty.\n"));
    994           {
    995             ld_emulation_xfer_type **ptr = ld_emulations;
    996 
    997             printf (_("  Supported emulations:\n"));
    998             while (*ptr)
    999               {
    1000                 printf ("   %s\n", (*ptr)->emulation_name);
    1001                 ptr++;
    1002               }
    1003           }
     1060          ldversion (2);
    10041061          xexit (0);
    10051062          break;
     
    10091066             we've seen a linker script.  */
    10101067          {
    1011             boolean hold_had_script;
    1012 
    1013             hold_had_script = had_script;
     1068            FILE *hold_script_handle;
     1069
     1070            hold_script_handle = saved_script_handle;
    10141071            ldfile_open_command_file (optarg);
    1015             had_script = hold_had_script;
     1072            saved_script_handle = hold_script_handle;
    10161073            parser_input = input_version_script;
    10171074            yyparse ();
     
    10251082          break;
    10261083        case OPTION_WARN_COMMON:
    1027           config.warn_common = true;
     1084          config.warn_common = TRUE;
    10281085          break;
    10291086        case OPTION_WARN_CONSTRUCTORS:
    1030           config.warn_constructors = true;
     1087          config.warn_constructors = TRUE;
     1088          break;
     1089        case OPTION_WARN_FATAL:
     1090          config.fatal_warnings = TRUE;
    10311091          break;
    10321092        case OPTION_WARN_MULTIPLE_GP:
    1033           config.warn_multiple_gp = true;
     1093          config.warn_multiple_gp = TRUE;
    10341094          break;
    10351095        case OPTION_WARN_ONCE:
    1036           config.warn_once = true;
     1096          config.warn_once = TRUE;
    10371097          break;
    10381098        case OPTION_WARN_SECTION_ALIGN:
    1039           config.warn_section_align = true;
     1099          config.warn_section_align = TRUE;
    10401100          break;
    10411101        case OPTION_WHOLE_ARCHIVE:
    1042           whole_archive = true;
     1102          whole_archive = TRUE;
    10431103          break;
    10441104        case OPTION_WRAP:
    10451105          add_wrap (optarg);
     1106          break;
     1107        case OPTION_DISCARD_NONE:
     1108          link_info.discard = discard_none;
    10461109          break;
    10471110        case 'X':
     
    10541117          if (strncmp (optarg, "P,", 2) == 0)
    10551118            optarg += 2;
     1119          if (default_dirlist != NULL)
     1120            free (default_dirlist);
    10561121          default_dirlist = xstrdup (optarg);
    10571122          break;
    10581123        case 'y':
    10591124          add_ysym (optarg);
     1125          break;
     1126        case OPTION_SPARE_DYNAMIC_TAGS:
     1127          link_info.spare_dynamic_tags = strtoul (optarg, NULL, 0);
    10601128          break;
    10611129        case OPTION_SPLIT_BY_RELOC:
     
    10721140          break;
    10731141        case OPTION_CHECK_SECTIONS:
    1074           command_line.check_section_addresses = true;
     1142          command_line.check_section_addresses = TRUE;
    10751143          break;
    10761144        case OPTION_NO_CHECK_SECTIONS:
    1077           command_line.check_section_addresses = false;
     1145          command_line.check_section_addresses = FALSE;
     1146          break;
     1147        case OPTION_ACCEPT_UNKNOWN_INPUT_ARCH:
     1148          command_line.accept_unknown_input_arch = TRUE;
     1149          break;
     1150        case OPTION_NO_ACCEPT_UNKNOWN_INPUT_ARCH:
     1151          command_line.accept_unknown_input_arch = FALSE;
    10781152          break;
    10791153        case '(':
    10801154          if (ingroup)
    1081             {
    1082               fprintf (stderr,
    1083                        _("%s: may not nest groups (--help for usage)\n"),
    1084                        program_name);
    1085               xexit (1);
    1086             }
     1155            einfo (_("%P%F: may not nest groups (--help for usage)\n"));
     1156
    10871157          lang_enter_group ();
    10881158          ingroup = 1;
     
    10901160        case ')':
    10911161          if (! ingroup)
    1092             {
    1093               fprintf (stderr,
    1094                        _("%s: group ended before it began (--help for usage)\n"),
    1095                        program_name);
    1096               xexit (1);
    1097             }
     1162            einfo (_("%P%F: group ended before it began (--help for usage)\n"));
     1163
    10981164          lang_leave_group ();
    10991165          ingroup = 0;
    11001166          break;
    11011167        case OPTION_MPC860C0:
    1102           link_info.mpc860c0 = 20;      /* default value (in bytes) */
     1168          /* Default value (in bytes).  */
     1169          link_info.mpc860c0 = 20;
    11031170          if (optarg)
    11041171            {
     
    11071174              words = is_num (optarg, 1, 10, 0);
    11081175              if (words == 0)
    1109                 {
    1110                   fprintf (stderr,
    1111                            _("%s: Invalid argument to option \"mpc860c0\"\n"),
    1112                            program_name);
    1113                   xexit (1);
    1114                 }
    1115               link_info.mpc860c0 = words * 4;   /* convert words to bytes */
     1176                einfo (_("%P%F: invalid argument to option \"mpc860c0\"\n"));
     1177
     1178              /* Convert words to bytes.  */
     1179              link_info.mpc860c0 = words * 4;
    11161180            }
    1117           command_line.relax = true;
     1181          command_line.relax = TRUE;
    11181182          break;
    11191183
     
    11321196
    11331197  if (default_dirlist != NULL)
    1134     set_default_dirlist (default_dirlist);
    1135 
     1198    {
     1199      set_default_dirlist (default_dirlist);
     1200      free (default_dirlist);
     1201    }
    11361202}
    11371203
     
    11511217        *p = '\0';
    11521218      if (*dirlist_ptr != '\0')
    1153         ldfile_add_library_path (dirlist_ptr, true);
     1219        ldfile_add_library_path (dirlist_ptr, TRUE);
    11541220      if (p == NULL)
    11551221        break;
     
    11851251      if (ld_options[i].doc != NULL)
    11861252        {
    1187           boolean comma;
     1253          bfd_boolean comma;
    11881254          int len;
    11891255          unsigned j;
     
    11911257          printf ("  ");
    11921258
    1193           comma = false;
     1259          comma = FALSE;
    11941260          len = 2;
    11951261
     
    12121278                      len += strlen (_(ld_options[j].arg));
    12131279                    }
    1214                   comma = true;
     1280                  comma = TRUE;
    12151281                }
    12161282              ++j;
     
    12271293                    (ld_options[j].control == TWO_DASHES
    12281294                     || ld_options[j].control == EXACTLY_TWO_DASHES);
    1229                  
     1295
    12301296                  printf ("%s-%s%s",
    12311297                          comma ? ", " : "",
     
    12411307                      len += 1 + strlen (_(ld_options[j].arg));
    12421308                    }
    1243                   comma = true;
     1309                  comma = TRUE;
    12441310                }
    12451311              ++j;
Note: See TracChangeset for help on using the changeset viewer.