Changeset 609 for branches/GNU/src/binutils/ld/lexsup.c
- Timestamp:
- Aug 16, 2003, 6:59:22 PM (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GNU/src/binutils/ld/lexsup.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.1.1.2
r608 r609 1 1 /* Parse options for the GNU linker. 2 2 Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 3 2001 3 2001, 2002, 2003 4 4 Free Software Foundation, Inc. 5 5 6 This file is part of GLD, the Gnu Linker.7 8 GLD is free software; you can redistribute it and/or modify9 it under the terms of the GNU General Public License as published by10 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 of15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the16 GNU General Public License for more details.17 18 You should have received a copy of the GNU General Public License19 along with GLD; see the file COPYING. If not, write to the Free20 Software Foundation, 59 Temple Place - Suite 330, Boston, MA21 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. */ 22 22 23 23 #include "bfd.h" … … 26 26 #include <stdio.h> 27 27 #include <string.h> 28 #include <ctype.h>28 #include "safe-ctype.h" 29 29 #include "getopt.h" 30 30 #include "bfdlink.h" … … 34 34 #include "ldexp.h" 35 35 #include "ldlang.h" 36 #include "ldgram.h"36 #include <ldgram.h> 37 37 #include "ldlex.h" 38 38 #include "ldfile.h" … … 54 54 #endif 55 55 56 /* Omit args to avoid the possibility of clashing with a system header57 that might disagree about consts. */58 unsigned long strtoul ();59 60 56 static 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));57 static void set_default_dirlist PARAMS ((char *)); 58 static void set_section_start PARAMS ((char *, char *)); 63 59 static void help PARAMS ((void)); 64 60 … … 110 106 #define OPTION_WARN_COMMON (OPTION_VERSION_EXPORTS_SECTION + 1) 111 107 #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) 113 110 #define OPTION_WARN_ONCE (OPTION_WARN_MULTIPLE_GP + 1) 114 111 #define OPTION_WARN_SECTION_ALIGN (OPTION_WARN_ONCE + 1) … … 130 127 #define OPTION_TARGET_HELP (OPTION_UNIQUE + 1) 131 128 #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) 132 141 133 142 /* The long options. This structure is used for both the option … … 200 209 { {"soname", required_argument, NULL, OPTION_SONAME}, 201 210 '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 }, 202 213 { {"library", required_argument, NULL, 'l'}, 203 214 'l', N_("LIBNAME"), N_("Search for library LIBNAME"), TWO_DASHES }, … … 213 224 'N', NULL, N_("Do not page align data, do not make text readonly"), 214 225 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 }, 215 228 { {"output", required_argument, NULL, 'o'}, 216 229 'o', N_("FILE"), N_("Set output file name"), EXACTLY_TWO_DASHES }, … … 232 245 { {"strip-debug", no_argument, NULL, 'S'}, 233 246 '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 }, 234 251 { {"trace", no_argument, NULL, 't'}, 235 252 't', NULL, N_("Trace file opens"), TWO_DASHES }, … … 249 266 'x', NULL, N_("Discard all local symbols"), TWO_DASHES }, 250 267 { {"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 }, 252 271 { {"trace-symbol", required_argument, NULL, 'y'}, 253 272 'y', N_("SYMBOL"), N_("Trace mentions of SYMBOL"), TWO_DASHES }, … … 258 277 { {"end-group", no_argument, NULL, ')'}, 259 278 ')', 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 }, 260 283 { {"assert", required_argument, NULL, OPTION_ASSERT}, 261 284 '\0', N_("KEYWORD"), N_("Ignored for SunOS compatibility"), ONE_DASH }, … … 287 310 { {"demangle", optional_argument, NULL, OPTION_DEMANGLE}, 288 311 '\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 },291 312 { {"embedded-relocs", no_argument, NULL, OPTION_EMBEDDED_RELOCS}, 292 313 '\0', NULL, N_("Generate embedded relocs"), TWO_DASHES}, … … 307 328 { {"Map", required_argument, NULL, OPTION_MAP}, 308 329 '\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 }, 309 332 { {"no-demangle", no_argument, NULL, OPTION_NO_DEMANGLE }, 310 333 '\0', NULL, N_("Do not demangle symbol names"), TWO_DASHES }, … … 314 337 '\0', NULL, N_("Allow no undefined symbols"), TWO_DASHES }, 315 338 { {"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 }, 317 346 { {"no-warn-mismatch", no_argument, NULL, OPTION_NO_WARN_MISMATCH}, 318 347 '\0', NULL, N_("Don't warn about mismatched input files"), TWO_DASHES}, … … 323 352 { {"noinhibit_exec", no_argument, NULL, OPTION_NOINHIBIT_EXEC}, 324 353 '\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 }, 325 356 { {"oformat", required_argument, NULL, OPTION_OFORMAT}, 326 357 '\0', N_("TARGET"), N_("Specify target of output file"), EXACTLY_TWO_DASHES }, … … 344 375 { {"sort_common", no_argument, NULL, OPTION_SORT_COMMON}, 345 376 '\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 }, 346 379 { {"split-by-file", optional_argument, NULL, OPTION_SPLIT_BY_FILE}, 347 380 '\0', N_("[=SIZE]"), N_("Split output sections every SIZE octets"), TWO_DASHES }, … … 386 419 '\0', NULL, N_("Warn if start of section changes due to alignment"), 387 420 TWO_DASHES }, 421 { {"fatal-warnings", no_argument, NULL, OPTION_WARN_FATAL}, 422 '\0', NULL, N_("Treat warnings as errors"), 423 TWO_DASHES }, 388 424 { {"whole-archive", no_argument, NULL, OPTION_WHOLE_ARCHIVE}, 389 425 '\0', NULL, N_("Include all objects from following archives"), TWO_DASHES }, … … 410 446 for (; *string; ++string) 411 447 { 412 if (! isdigit(*string))448 if (! ISDIGIT (*string)) 413 449 { 414 450 result = err; … … 432 468 int ingroup = 0; 433 469 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; 437 473 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)); 438 480 439 481 /* Starting the short option string with '-' is for programs that … … 481 523 really_longopts[irl].name = NULL; 482 524 525 ldemul_add_options (is, &shortopts, il, &longopts, irl, &really_longopts); 526 483 527 /* The -G option is ambiguous on different platforms. Sometimes it 484 528 specifies the largest data size to put into the small data … … 495 539 if (strcmp (argv[i], "-G") == 0 496 540 && (i + 1 >= argc 497 || ! isdigit ((unsigned char)argv[i + 1][0])))541 || ! ISDIGIT (argv[i + 1][0]))) 498 542 argv[i] = (char *) "--shared"; 499 543 … … 537 581 loop around to pick up the -x. */ 538 582 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; 544 585 545 586 /* getopt_long_only is like getopt_long, but '-' as well as '--' 546 587 can indicate a long option. */ 547 588 opterr = 0; 589 last_optind = optind; 548 590 optc = getopt_long_only (argc, argv, shortopts, longopts, &longind); 549 591 if (optc == '?') 550 592 { 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); 553 595 } 596 597 if (ldemul_handle_option (optc)) 598 continue; 554 599 555 600 if (optc == -1) … … 559 604 { 560 605 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]); 563 607 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 568 610 case 1: /* File name. */ 569 611 lang_add_input_file (optarg, lang_input_file_is_file_enum, … … 578 620 currently support shared libraries on HP/UX anyhow. */ 579 621 if (strcmp (optarg, "archive") == 0) 580 config.dynamic_link = false;622 config.dynamic_link = FALSE; 581 623 else if (strcmp (optarg, "shared") == 0 582 624 || strcmp (optarg, "default") == 0) 583 config.dynamic_link = true;625 config.dynamic_link = TRUE; 584 626 else 585 627 einfo (_("%P%F: unrecognized -a option `%s'\n"), optarg); … … 610 652 break; 611 653 case OPTION_CALL_SHARED: 612 config.dynamic_link = true;654 config.dynamic_link = TRUE; 613 655 break; 614 656 case OPTION_NON_SHARED: 615 config.dynamic_link = false;657 config.dynamic_link = FALSE; 616 658 break; 617 659 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; 620 662 break; 621 663 case 'd': 622 command_line.force_common_definition = true;664 command_line.force_common_definition = TRUE; 623 665 break; 624 666 case OPTION_DEFSYM: … … 632 674 break; 633 675 case OPTION_DEMANGLE: 634 demangling = true;676 demangling = TRUE; 635 677 if (optarg != NULL) 636 678 { … … 645 687 } 646 688 break; 689 case 'I': /* Used on Solaris. */ 647 690 case OPTION_DYNAMIC_LINKER: 648 691 command_line.interpreter = optarg; … … 655 698 break; 656 699 case OPTION_EMBEDDED_RELOCS: 657 command_line.embedded_relocs = true;700 command_line.embedded_relocs = TRUE; 658 701 break; 659 702 case OPTION_EXPORT_DYNAMIC: 660 703 case 'E': /* HP/UX compatibility. */ 661 command_line.export_dynamic = true;704 link_info.export_dynamic = TRUE; 662 705 break; 663 706 case 'e': 664 lang_add_entry (optarg, true);707 lang_add_entry (optarg, TRUE); 665 708 break; 666 709 case 'f': … … 691 734 break; 692 735 case OPTION_FORCE_EXE_SUFFIX: 693 command_line.force_exe_suffix = true;736 command_line.force_exe_suffix = TRUE; 694 737 break; 695 738 case 'G': … … 705 748 break; 706 749 case OPTION_GC_SECTIONS: 707 command_line.gc_sections = true;750 command_line.gc_sections = TRUE; 708 751 break; 709 752 case OPTION_HELP: … … 712 755 break; 713 756 case 'L': 714 ldfile_add_library_path (optarg, true);757 ldfile_add_library_path (optarg, TRUE); 715 758 break; 716 759 case 'l': … … 728 771 break; 729 772 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. */ 733 782 break; 734 783 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; 737 789 break; 738 790 case OPTION_NO_DEMANGLE: 739 demangling = false;791 demangling = FALSE; 740 792 break; 741 793 case OPTION_NO_GC_SECTIONS: 742 command_line.gc_sections = false;794 command_line.gc_sections = FALSE; 743 795 break; 744 796 case OPTION_NO_KEEP_MEMORY: 745 link_info.keep_memory = false;797 link_info.keep_memory = FALSE; 746 798 break; 747 799 case OPTION_NO_UNDEFINED: 748 link_info.no_undefined = true;800 link_info.no_undefined = TRUE; 749 801 break; 750 802 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; 752 813 break; 753 814 case OPTION_NO_WARN_MISMATCH: 754 command_line.warn_mismatch = false;815 command_line.warn_mismatch = FALSE; 755 816 break; 756 817 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; 758 822 break; 759 823 case OPTION_NO_WHOLE_ARCHIVE: 760 whole_archive = false;824 whole_archive = FALSE; 761 825 break; 762 826 case 'O': … … 768 832 769 833 /* 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; 771 835 break; 772 836 case 'o': … … 777 841 break; 778 842 case 'q': 779 link_info.emitrelocations = true;843 link_info.emitrelocations = TRUE; 780 844 break; 781 845 case 'i': 782 846 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; 788 863 break; 789 864 case 'R': … … 822 897 { 823 898 size_t idx = 0; 899 824 900 while (optarg[idx] != '\0' && optarg[idx] == cp[idx]) 825 901 ++idx; … … 861 937 break; 862 938 case OPTION_RELAX: 863 command_line.relax = true;939 command_line.relax = TRUE; 864 940 break; 865 941 case OPTION_RETAIN_SYMBOLS_FILE: … … 872 948 link_info.strip = strip_all; 873 949 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; 874 956 case OPTION_SHARED: 875 957 if (config.has_shared) 876 link_info.shared = true;958 link_info.shared = TRUE; 877 959 else 878 960 einfo (_("%P%F: -shared not supported\n")); … … 883 965 break; 884 966 case OPTION_SORT_COMMON: 885 config.sort_common = true;967 config.sort_common = TRUE; 886 968 break; 887 969 case OPTION_STATS: 888 config.stats = true;970 config.stats = TRUE; 889 971 break; 890 972 case OPTION_SYMBOLIC: 891 link_info.symbolic = true;973 link_info.symbolic = TRUE; 892 974 break; 893 975 case 't': 894 trace_files = true;976 trace_files = TRUE; 895 977 break; 896 978 case 'T': … … 908 990 optarg2 = strchr (optarg, '='); 909 991 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")); 916 993 917 994 optarg2++; … … 919 996 /* So far so good. Are all the args present? */ 920 997 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")); 927 999 928 1000 /* We must copy the section name as set_section_start … … 939 1011 case OPTION_TARGET_HELP: 940 1012 /* Mention any target specific options. */ 941 942 1013 ldemul_list_emulation_options (stdout); 1014 exit (0); 943 1015 case OPTION_TBSS: 944 1016 set_section_start (".bss", optarg); … … 951 1023 break; 952 1024 case OPTION_TRADITIONAL_FORMAT: 953 link_info.traditional_format = true;1025 link_info.traditional_format = TRUE; 954 1026 break; 955 1027 case OPTION_TASK_LINK: 956 link_info.task_link = true;1028 link_info.task_link = TRUE; 957 1029 /* Fall through - do an implied -r option. */ 958 1030 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; 964 1036 break; 965 1037 case 'u': … … 970 1042 lang_add_unique (optarg); 971 1043 else 972 config.unique_orphan_sections = true;1044 config.unique_orphan_sections = TRUE; 973 1045 break; 974 1046 case OPTION_VERBOSE: 975 1047 ldversion (1); 976 version_printed = true;977 trace_file_tries = true;1048 version_printed = TRUE; 1049 trace_file_tries = TRUE; 978 1050 break; 979 1051 case 'v': 980 1052 ldversion (0); 981 version_printed = true;1053 version_printed = TRUE; 982 1054 break; 983 1055 case 'V': 984 1056 ldversion (1); 985 version_printed = true;1057 version_printed = TRUE; 986 1058 break; 987 1059 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); 1004 1061 xexit (0); 1005 1062 break; … … 1009 1066 we've seen a linker script. */ 1010 1067 { 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; 1014 1071 ldfile_open_command_file (optarg); 1015 had_script = hold_had_script;1072 saved_script_handle = hold_script_handle; 1016 1073 parser_input = input_version_script; 1017 1074 yyparse (); … … 1025 1082 break; 1026 1083 case OPTION_WARN_COMMON: 1027 config.warn_common = true;1084 config.warn_common = TRUE; 1028 1085 break; 1029 1086 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; 1031 1091 break; 1032 1092 case OPTION_WARN_MULTIPLE_GP: 1033 config.warn_multiple_gp = true;1093 config.warn_multiple_gp = TRUE; 1034 1094 break; 1035 1095 case OPTION_WARN_ONCE: 1036 config.warn_once = true;1096 config.warn_once = TRUE; 1037 1097 break; 1038 1098 case OPTION_WARN_SECTION_ALIGN: 1039 config.warn_section_align = true;1099 config.warn_section_align = TRUE; 1040 1100 break; 1041 1101 case OPTION_WHOLE_ARCHIVE: 1042 whole_archive = true;1102 whole_archive = TRUE; 1043 1103 break; 1044 1104 case OPTION_WRAP: 1045 1105 add_wrap (optarg); 1106 break; 1107 case OPTION_DISCARD_NONE: 1108 link_info.discard = discard_none; 1046 1109 break; 1047 1110 case 'X': … … 1054 1117 if (strncmp (optarg, "P,", 2) == 0) 1055 1118 optarg += 2; 1119 if (default_dirlist != NULL) 1120 free (default_dirlist); 1056 1121 default_dirlist = xstrdup (optarg); 1057 1122 break; 1058 1123 case 'y': 1059 1124 add_ysym (optarg); 1125 break; 1126 case OPTION_SPARE_DYNAMIC_TAGS: 1127 link_info.spare_dynamic_tags = strtoul (optarg, NULL, 0); 1060 1128 break; 1061 1129 case OPTION_SPLIT_BY_RELOC: … … 1072 1140 break; 1073 1141 case OPTION_CHECK_SECTIONS: 1074 command_line.check_section_addresses = true;1142 command_line.check_section_addresses = TRUE; 1075 1143 break; 1076 1144 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; 1078 1152 break; 1079 1153 case '(': 1080 1154 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 1087 1157 lang_enter_group (); 1088 1158 ingroup = 1; … … 1090 1160 case ')': 1091 1161 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 1098 1164 lang_leave_group (); 1099 1165 ingroup = 0; 1100 1166 break; 1101 1167 case OPTION_MPC860C0: 1102 link_info.mpc860c0 = 20; /* default value (in bytes) */ 1168 /* Default value (in bytes). */ 1169 link_info.mpc860c0 = 20; 1103 1170 if (optarg) 1104 1171 { … … 1107 1174 words = is_num (optarg, 1, 10, 0); 1108 1175 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; 1116 1180 } 1117 command_line.relax = true;1181 command_line.relax = TRUE; 1118 1182 break; 1119 1183 … … 1132 1196 1133 1197 if (default_dirlist != NULL) 1134 set_default_dirlist (default_dirlist); 1135 1198 { 1199 set_default_dirlist (default_dirlist); 1200 free (default_dirlist); 1201 } 1136 1202 } 1137 1203 … … 1151 1217 *p = '\0'; 1152 1218 if (*dirlist_ptr != '\0') 1153 ldfile_add_library_path (dirlist_ptr, true);1219 ldfile_add_library_path (dirlist_ptr, TRUE); 1154 1220 if (p == NULL) 1155 1221 break; … … 1185 1251 if (ld_options[i].doc != NULL) 1186 1252 { 1187 b oolean comma;1253 bfd_boolean comma; 1188 1254 int len; 1189 1255 unsigned j; … … 1191 1257 printf (" "); 1192 1258 1193 comma = false;1259 comma = FALSE; 1194 1260 len = 2; 1195 1261 … … 1212 1278 len += strlen (_(ld_options[j].arg)); 1213 1279 } 1214 comma = true;1280 comma = TRUE; 1215 1281 } 1216 1282 ++j; … … 1227 1293 (ld_options[j].control == TWO_DASHES 1228 1294 || ld_options[j].control == EXACTLY_TWO_DASHES); 1229 1295 1230 1296 printf ("%s-%s%s", 1231 1297 comma ? ", " : "", … … 1241 1307 len += 1 + strlen (_(ld_options[j].arg)); 1242 1308 } 1243 comma = true;1309 comma = TRUE; 1244 1310 } 1245 1311 ++j; -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.