* ld.texinfo: Document --fatal-warnings.
[deliverable/binutils-gdb.git] / ld / lexsup.c
index 80ccc6e0e2de5d473264b59648793ca7546478da..fb2e3f53deca130aecd7d8da07d6ecdc39adf44b 100644 (file)
@@ -1,5 +1,6 @@
 /* Parse options for the GNU linker.
-   Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000
+   Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
+   2001
    Free Software Foundation, Inc.
 
 This file is part of GLD, the Gnu Linker.
@@ -108,7 +109,8 @@ int parsing_defsym = 0;
 #define OPTION_VERSION_EXPORTS_SECTION (OPTION_VERSION_SCRIPT + 1)
 #define OPTION_WARN_COMMON             (OPTION_VERSION_EXPORTS_SECTION + 1)
 #define OPTION_WARN_CONSTRUCTORS       (OPTION_WARN_COMMON + 1)
-#define OPTION_WARN_MULTIPLE_GP                (OPTION_WARN_CONSTRUCTORS + 1)
+#define OPTION_WARN_FATAL              (OPTION_WARN_CONSTRUCTORS + 1)
+#define OPTION_WARN_MULTIPLE_GP                (OPTION_WARN_FATAL + 1)
 #define OPTION_WARN_ONCE               (OPTION_WARN_MULTIPLE_GP + 1)
 #define OPTION_WARN_SECTION_ALIGN      (OPTION_WARN_ONCE + 1)
 #define OPTION_SPLIT_BY_RELOC          (OPTION_WARN_SECTION_ALIGN + 1)
@@ -128,6 +130,7 @@ int parsing_defsym = 0;
 #define OPTION_UNIQUE                  (OPTION_SECTION_START + 1)
 #define OPTION_TARGET_HELP              (OPTION_UNIQUE + 1)
 #define OPTION_ALLOW_SHLIB_UNDEFINED   (OPTION_TARGET_HELP + 1)
+#define OPTION_DISCARD_NONE            (OPTION_ALLOW_SHLIB_UNDEFINED + 1)
 
 /* The long options.  This structure is used for both the option
    parsing and the help text.  */
@@ -236,8 +239,8 @@ static const struct ld_option ld_options[] =
       'T', N_("FILE"), N_("Read linker script"), TWO_DASHES },
   { {"undefined", required_argument, NULL, 'u'},
       'u', N_("SYMBOL"), N_("Start with undefined reference to SYMBOL"), TWO_DASHES },
-  { {"unique", no_argument, NULL, OPTION_UNIQUE},
-      '\0', NULL, N_("Don't merge orphan sections with the same name"), TWO_DASHES },
+  { {"unique", optional_argument, NULL, OPTION_UNIQUE},
+      '\0', N_("[=SECTION]"), N_("Don't merge input [SECTION | orphan] sections"), TWO_DASHES },
   { {"Ur", no_argument, NULL, OPTION_UR},
       '\0', NULL, N_("Build global constructor/destructor tables"), ONE_DASH },
   { {"version", no_argument, NULL, OPTION_VERSION},
@@ -247,7 +250,9 @@ static const struct ld_option ld_options[] =
   { {"discard-all", no_argument, NULL, 'x'},
       'x', NULL, N_("Discard all local symbols"), TWO_DASHES },
   { {"discard-locals", no_argument, NULL, 'X'},
-      'X', NULL, N_("Discard temporary local symbols"), TWO_DASHES },
+      'X', NULL, N_("Discard temporary local symbols (default)"), TWO_DASHES },
+  { {"discard-none", no_argument, NULL, OPTION_DISCARD_NONE},
+      '\0', NULL, N_("Don't discard any local symbols"), TWO_DASHES },
   { {"trace-symbol", required_argument, NULL, 'y'},
       'y', N_("SYMBOL"), N_("Trace mentions of SYMBOL"), TWO_DASHES },
   { {NULL, required_argument, NULL, '\0'},
@@ -384,6 +389,9 @@ static const struct ld_option ld_options[] =
   { {"warn-section-align", no_argument, NULL, OPTION_WARN_SECTION_ALIGN},
       '\0', NULL, N_("Warn if start of section changes due to alignment"),
       TWO_DASHES },
+  { {"fatal-warnings", no_argument, NULL, OPTION_WARN_FATAL},
+     '\0', NULL, N_("Treat warnings as errors"),
+     TWO_DASHES },
   { {"whole-archive", no_argument, NULL, OPTION_WHOLE_ARCHIVE},
       '\0', NULL, N_("Include all objects from following archives"), TWO_DASHES },
   { {"wrap", required_argument, NULL, OPTION_WRAP},
@@ -550,7 +558,7 @@ parse_args (argc, argv)
          --optind;
          optc = getopt_long (argc, argv, shortopts, really_longopts, &longind);
        }
-  
+
       if (optc == -1)
        break;
 
@@ -965,7 +973,10 @@ parse_args (argc, argv)
          ldlang_add_undef (optarg);
          break;
        case OPTION_UNIQUE:
-         config.unique_orphan_sections = true;
+         if (optarg != NULL)
+           lang_add_unique (optarg);
+         else
+           config.unique_orphan_sections = true;
          break;
        case OPTION_VERBOSE:
          ldversion (1);
@@ -983,7 +994,7 @@ parse_args (argc, argv)
        case OPTION_VERSION:
          /* This output is intended to follow the GNU standards document.  */
          printf ("GNU ld %s\n", ld_program_version);
-         printf (_("Copyright 2000 Free Software Foundation, Inc.\n"));
+         printf (_("Copyright 2001 Free Software Foundation, Inc.\n"));
          printf (_("\
 This program is free software; you may redistribute it under the terms of\n\
 the GNU General Public License.  This program has absolutely no warranty.\n"));
@@ -1025,6 +1036,9 @@ the GNU General Public License.  This program has absolutely no warranty.\n"));
        case OPTION_WARN_CONSTRUCTORS:
          config.warn_constructors = true;
          break;
+       case OPTION_WARN_FATAL:
+         config.fatal_warnings = true;
+         break;
        case OPTION_WARN_MULTIPLE_GP:
          config.warn_multiple_gp = true;
          break;
@@ -1040,6 +1054,9 @@ the GNU General Public License.  This program has absolutely no warranty.\n"));
        case OPTION_WRAP:
          add_wrap (optarg);
          break;
+       case OPTION_DISCARD_NONE:
+         link_info.discard = discard_none;
+         break;
        case 'X':
          link_info.discard = discard_l;
          break;
This page took 0.024674 seconds and 4 git commands to generate.