]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
Rewrite old-style parameters.
authorUlrich Drepper <drepper@redhat.com>
Wed, 30 Jan 2008 07:16:28 +0000 (07:16 +0000)
committerUlrich Drepper <drepper@redhat.com>
Wed, 30 Jan 2008 07:16:28 +0000 (07:16 +0000)
src/ChangeLog
src/ld.c

index 9b9157f290f6e9f6e9fc572d99f7a45854411d40..bbc2708c3067f92beecd987f01372eeb39a1f59f 100644 (file)
@@ -1,5 +1,8 @@
 2008-01-29  Ulrich Drepper  <drepper@redhat.com>
 
+       * ld.c (replace_args): New function.
+       (main): Use it to rewrite old-style parameters.
+
        * elf32-i386.script: Add .gnu.hash section.
        * ldgeneric.c (optimal_bucket_size): A tiny bit more efficient.
        (fillin_special_symbol): Initialize st_size.
index 24d5cb3d33d2bb42fa544a6f6c97c55021173838..6f8048f547faa5ac25760f0f72032e15b546976f 100644 (file)
--- a/src/ld.c
+++ b/src/ld.c
@@ -197,6 +197,7 @@ static const char doc[] = N_("Combine object and archive files.");
 static const char args_doc[] = N_("[FILE]...");
 
 /* Prototype for option handler.  */
+static void replace_args (int argc, char *argv[]);
 static error_t parse_opt_1st (int key, char *arg, struct argp_state *state);
 static error_t parse_opt_2nd (int key, char *arg, struct argp_state *state);
 
@@ -316,6 +317,9 @@ main (int argc, char *argv[])
 #define obstack_chunk_free free
   obstack_init (&ld_state.smem);
 
+  /* Recognize old-style parameters for compatibility.  */
+  replace_args (argc, argv);
+
   /* One quick pass over the parameters which allows us to scan for options
      with global effect which influence the rest of the processing.  */
   argp_parse (&argp_1st, argc, argv, ARGP_IN_ORDER, &remaining, NULL);
@@ -490,6 +494,31 @@ main (int argc, char *argv[])
 }
 
 
+static void
+replace_args (int argc, char *argv[])
+{
+  static const struct
+  {
+    const char *from;
+    const char *to;
+  } args[] =
+      {
+       { "-export-dynamic", "--export-dynamic" },
+       { "-dynamic-linker", "--dynamic-linker" }
+      };
+  const size_t nargs = sizeof (args) / sizeof (args[0]);
+
+  for (int i = 1; i < argc; ++i)
+    if (argv[i][0] == '-' && islower (argv[i][1]))
+      for (size_t j = 0; j < nargs; ++j)
+       if (strcmp (argv[i], args[j].from) == 0)
+         {
+           argv[i] = (char *) args[j].to;
+           break;
+         }
+}
+
+
 /* Quick scan of the parameter list for options with global effect.  */
 static error_t
 parse_opt_1st (int key, char *arg,