* hppa-dis.c (print_insn_hppa): Change condition args to use
[deliverable/binutils-gdb.git] / ld / lexsup.c
index 98b77e5887d06a6b25cc93d7332963ee2057d4d8..8f4785b1b2dc988fd177f4a3e71650bc4a07a95e 100644 (file)
@@ -1,5 +1,5 @@
 /* Parse options for the GNU linker.
-   Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 1998
+   Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 1999
    Free Software Foundation, Inc.
 
 This file is part of GLD, the Gnu Linker.
@@ -69,7 +69,8 @@ int parsing_defsym = 0;
 #define OPTION_CALL_SHARED             (OPTION_ASSERT + 1)
 #define OPTION_CREF                    (OPTION_CALL_SHARED + 1)
 #define OPTION_DEFSYM                  (OPTION_CREF + 1)
-#define OPTION_DYNAMIC_LINKER          (OPTION_DEFSYM + 1)
+#define OPTION_DEMANGLE                        (OPTION_DEFSYM + 1)
+#define OPTION_DYNAMIC_LINKER          (OPTION_DEMANGLE + 1)
 #define OPTION_EB                      (OPTION_DYNAMIC_LINKER + 1)
 #define OPTION_EL                      (OPTION_EB + 1)
 #define OPTION_EMBEDDED_RELOCS         (OPTION_EL + 1)
@@ -77,7 +78,8 @@ int parsing_defsym = 0;
 #define OPTION_HELP                    (OPTION_EXPORT_DYNAMIC + 1)
 #define OPTION_IGNORE                  (OPTION_HELP + 1)
 #define OPTION_MAP                     (OPTION_IGNORE + 1)
-#define OPTION_NO_KEEP_MEMORY          (OPTION_MAP + 1)
+#define OPTION_NO_DEMANGLE             (OPTION_MAP + 1)
+#define OPTION_NO_KEEP_MEMORY          (OPTION_NO_DEMANGLE + 1)
 #define OPTION_NO_WARN_MISMATCH                (OPTION_NO_KEEP_MEMORY + 1)
 #define OPTION_NOINHIBIT_EXEC          (OPTION_NO_WARN_MISMATCH + 1)
 #define OPTION_NON_SHARED              (OPTION_NOINHIBIT_EXEC + 1)
@@ -116,6 +118,10 @@ int parsing_defsym = 0;
 #define OPTION_NO_GC_SECTIONS          (OPTION_GC_SECTIONS + 1)
 #define OPTION_CHECK_SECTIONS          (OPTION_NO_GC_SECTIONS + 1)
 #define OPTION_NO_CHECK_SECTIONS       (OPTION_CHECK_SECTIONS + 1)
+#define OPTION_MPC860C0                 (OPTION_NO_CHECK_SECTIONS + 1)
+#define OPTION_NO_UNDEFINED            (OPTION_MPC860C0 + 1)
+#define OPTION_INIT                     (OPTION_NO_UNDEFINED + 1)
+#define OPTION_FINI                     (OPTION_INIT + 1)
 
 /* The long options.  This structure is used for both the option
    parsing and the help text.  */
@@ -260,10 +266,14 @@ static const struct ld_option ld_options[] =
       '\0', NULL, N_("Output cross reference table"), TWO_DASHES },
   { {"defsym", required_argument, NULL, OPTION_DEFSYM},
       '\0', N_("SYMBOL=EXPRESSION"), N_("Define a symbol"), TWO_DASHES },
+  { {"demangle", no_argument, NULL, OPTION_DEMANGLE},
+      '\0', NULL, N_("Demangle symbol names"), TWO_DASHES },
   { {"dynamic-linker", required_argument, NULL, OPTION_DYNAMIC_LINKER},
       '\0', N_("PROGRAM"), N_("Set the dynamic linker to use"), TWO_DASHES },
   { {"embedded-relocs", no_argument, NULL, OPTION_EMBEDDED_RELOCS},
       '\0', NULL, N_("Generate embedded relocs"), TWO_DASHES},
+  { {"fini", required_argument, NULL, OPTION_FINI},
+     '\0', N_("SYMBOL"), N_("Call SYMBOL at unload-time"), ONE_DASH },
   { {"force-exe-suffix", no_argument, NULL, OPTION_FORCE_EXE_SUFFIX},
       '\0', NULL, N_("Force generation of file with .exe suffix"), TWO_DASHES},
   { {"gc-sections", no_argument, NULL, OPTION_GC_SECTIONS},
@@ -274,10 +284,16 @@ static const struct ld_option ld_options[] =
       TWO_DASHES },
   { {"help", no_argument, NULL, OPTION_HELP},
       '\0', NULL, N_("Print option help"), TWO_DASHES },
+  { {"init", required_argument, NULL, OPTION_INIT},
+     '\0', N_("SYMBOL"), N_("Call SYMBOL at load-time"), ONE_DASH },
   { {"Map", required_argument, NULL, OPTION_MAP},
       '\0', N_("FILE"), N_("Write a map file"), ONE_DASH },
+  { {"no-demangle", no_argument, NULL, OPTION_NO_DEMANGLE },
+      '\0', NULL, N_("Do not demangle symbol names"), TWO_DASHES },
   { {"no-keep-memory", no_argument, NULL, OPTION_NO_KEEP_MEMORY},
       '\0', NULL, N_("Use less memory and more disk I/O"), TWO_DASHES },
+  { {"no-undefined", no_argument, NULL, OPTION_NO_UNDEFINED},
+     '\0', NULL, N_("Allow no undefined symbols"), TWO_DASHES },
   { {"no-warn-mismatch", no_argument, NULL, OPTION_NO_WARN_MISMATCH},
       '\0', NULL, N_("Don't warn about mismatched input files"), TWO_DASHES},
   { {"no-whole-archive", no_argument, NULL, OPTION_NO_WHOLE_ARCHIVE},
@@ -331,7 +347,7 @@ static const struct ld_option ld_options[] =
       '\0', N_("FILE"), N_("Read version information script"), TWO_DASHES },
   { {"version-exports-section", required_argument, NULL,
      OPTION_VERSION_EXPORTS_SECTION },
-    '\0', N_("SYMBOL"), N_("Take export symbols list from .exports, using SYMBOL as the version."),
+    '\0', N_("SYMBOL"), N_("Take export symbols list from .exports, using\n\t\t\t\tSYMBOL as the version."),
     TWO_DASHES },
   { {"warn-common", no_argument, NULL, OPTION_WARN_COMMON},
       '\0', NULL, N_("Warn about duplicate common symbols"), TWO_DASHES },
@@ -348,11 +364,35 @@ static const struct ld_option ld_options[] =
   { {"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},
-      '\0', N_("SYMBOL"), N_("Use wrapper functions for SYMBOL"), TWO_DASHES }
+      '\0', N_("SYMBOL"), N_("Use wrapper functions for SYMBOL"), TWO_DASHES },
+  { {"mpc860c0", optional_argument, NULL, OPTION_MPC860C0},
+      '\0', N_("[=WORDS]"), N_("Modify problematic branches in last WORDS (1-10,\n\t\t\t\tdefault 5) words of a page"), TWO_DASHES }
 };
 
 #define OPTION_COUNT ((int) (sizeof ld_options / sizeof ld_options[0]))
 
+/* Test "string" for containing a string of digits that form a number
+between "min" and "max".  The return value is the number or "err". */
+static
+int is_num( char *string, int min, int max, int err)
+{
+  int result = 0;
+
+  for ( ; *string; ++string)
+  {
+    if (!isdigit(*string))
+    {
+      result = err;
+      break;
+    }
+    result = result * 10 + (*string - '0');
+  }
+  if (result < min || result > max)
+    result = err;
+
+  return result;
+}
+
 void
 parse_args (argc, argv)
      int argc;
@@ -536,6 +576,9 @@ parse_args (argc, argv)
          parsing_defsym = 0;
          lex_string = NULL;
          break;
+       case OPTION_DEMANGLE:
+         demangling = true;
+         break;
        case OPTION_DYNAMIC_LINKER:
          command_line.interpreter = optarg;
          break;
@@ -627,12 +670,18 @@ parse_args (argc, argv)
          config.magic_demand_paged = false;
          config.dynamic_link = false;
          break;
+       case OPTION_NO_DEMANGLE:
+         demangling = false;
+         break;
        case OPTION_NO_GC_SECTIONS:
          command_line.gc_sections = false;
          break;
        case OPTION_NO_KEEP_MEMORY:
          link_info.keep_memory = false;
          break;
+       case OPTION_NO_UNDEFINED:
+         link_info.no_undefined = true;
+         break;
        case OPTION_NO_WARN_MISMATCH:
          command_line.warn_mismatch = false;
          break;
@@ -929,7 +978,30 @@ the GNU General Public License.  This program has absolutely no warranty.\n"));
          lang_leave_group ();
          ingroup = 0;
          break;
+      case OPTION_MPC860C0:
+          link_info.mpc860c0 = 20;      /* default value (in bytes) */
+          if (optarg)
+            {
+              unsigned words;
 
+              words = is_num (optarg, 1, 10, 0);
+              if (words == 0)
+                {
+                  fprintf (stderr, _("Invalid argument to option \"mpc860c0\"\n"));
+                  xexit (1);
+                }
+              link_info.mpc860c0 = words * 4;   /* convert words to bytes */
+            }
+          command_line.relax = true;
+          break;
+
+       case OPTION_INIT:
+         link_info.init_function = optarg;
+         break;
+         
+       case OPTION_FINI:
+         link_info.fini_function = optarg;
+         break;
        }
     }
 
@@ -1060,6 +1132,8 @@ help ()
        }
     }
 
+  /* Note: Various tools (such as libtool) depend upon the
+     format of the listings below - do not change them.  */
   /* xgettext:c-format */
   printf (_("%s: supported targets:"), program_name);
   targets = bfd_target_list ();
This page took 0.025269 seconds and 4 git commands to generate.