summaryrefslogtreecommitdiff
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
parented9b6cbc2aad369c10f4ff0aad1789b0633a4e65 (diff)
downloadelfutils-b61c4cc4ab5d61d5d7c1a31e700bff8ad39fa079.tar.gz
Rewrite old-style parameters.
-rw-r--r--src/ChangeLog3
-rw-r--r--src/ld.c29
2 files changed, 32 insertions, 0 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 9b9157f2..bbc2708c 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -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.
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,