The following changes avoid polluting global namespace with the
[deliverable/binutils-gdb.git] / ld / lexsup.c
index fb2e3f53deca130aecd7d8da07d6ecdc39adf44b..91a1f1dc39c4bc898d67798bc389308b7f562f32 100644 (file)
@@ -201,6 +201,8 @@ static const struct ld_option ld_options[] =
       TWO_DASHES },
   { {"soname", required_argument, NULL, OPTION_SONAME},
       'h', N_("FILENAME"), N_("Set internal name of shared library"), ONE_DASH },
+  { {"dynamic-linker", required_argument, NULL, OPTION_DYNAMIC_LINKER},
+      'I', N_("PROGRAM"), N_("Set the dynamic linker to use"), TWO_DASHES },
   { {"library", required_argument, NULL, 'l'},
       'l', N_("LIBNAME"), N_("Search for library LIBNAME"), TWO_DASHES },
   { {"library-path", required_argument, NULL, 'L'},
@@ -290,8 +292,6 @@ static const struct ld_option ld_options[] =
       '\0', N_("SYMBOL=EXPRESSION"), N_("Define a symbol"), TWO_DASHES },
   { {"demangle", optional_argument, NULL, OPTION_DEMANGLE},
       '\0', N_("[=STYLE]"), N_("Demangle symbol names [using STYLE]"), 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},
@@ -533,7 +533,7 @@ parse_args (argc, argv)
   last_optind = -1;
   while (1)
     {
-      int longind;
+      int longind, errind;
       int optc;
 
       /* Using last_optind lets us avoid calling ldemul_parse_args
@@ -552,6 +552,7 @@ parse_args (argc, argv)
       /* getopt_long_only is like getopt_long, but '-' as well as '--'
         can indicate a long option.  */
       opterr = 0;
+      errind = optind;
       optc = getopt_long_only (argc, argv, shortopts, longopts, &longind);
       if (optc == '?')
        {
@@ -566,7 +567,7 @@ parse_args (argc, argv)
        {
        case '?':
          fprintf (stderr, _("%s: unrecognized option '%s'\n"),
-                  program_name, argv[optind - 1]);
+                  program_name, argv[errind]);
        default:
          fprintf (stderr,
                   _("%s: use the --help option for usage information\n"),
@@ -651,6 +652,7 @@ parse_args (argc, argv)
              cplus_demangle_set_style (style);
            }
          break;
+       case 'I':               /* Used on Solaris.  */
        case OPTION_DYNAMIC_LINKER:
          command_line.interpreter = optarg;
          break;
@@ -665,7 +667,7 @@ parse_args (argc, argv)
          break;
        case OPTION_EXPORT_DYNAMIC:
        case 'E': /* HP/UX compatibility.  */
-         command_line.export_dynamic = true;
+         link_info.export_dynamic = true;
          break;
        case 'e':
          lang_add_entry (optarg, true);
@@ -816,7 +818,7 @@ parse_args (argc, argv)
          /* Fall through.  */
        case OPTION_RPATH:
          if (command_line.rpath == NULL)
-           command_line.rpath = buystring (optarg);
+           command_line.rpath = xstrdup (optarg);
          else
            {
              size_t rpath_len = strlen (command_line.rpath);
@@ -853,7 +855,7 @@ parse_args (argc, argv)
          break;
        case OPTION_RPATH_LINK:
          if (command_line.rpath_link == NULL)
-           command_line.rpath_link = buystring (optarg);
+           command_line.rpath_link = xstrdup (optarg);
          else
            {
              char *buf;
This page took 0.024305 seconds and 4 git commands to generate.