summaryrefslogtreecommitdiff
path: root/src/ld.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2008-01-30 07:16:28 +0000
committerUlrich Drepper <drepper@redhat.com>2008-01-30 07:16:28 +0000
commitb61c4cc4ab5d61d5d7c1a31e700bff8ad39fa079 (patch)
tree5117006c97209058d5e96fec3e87f553aec97686 /src/ld.c
parented9b6cbc2aad369c10f4ff0aad1789b0633a4e65 (diff)
downloadelfutils-b61c4cc4ab5d61d5d7c1a31e700bff8ad39fa079.tar.gz
Rewrite old-style parameters.
Diffstat (limited to 'src/ld.c')
-rw-r--r--src/ld.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/ld.c b/src/ld.c
index 24d5cb3d..6f8048f5 100644
--- 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,