From: Ulrich Drepper Date: Wed, 30 Jan 2008 07:16:28 +0000 (+0000) Subject: Rewrite old-style parameters. X-Git-Tag: elfutils-0.133~11 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b61c4cc4ab5d61d5d7c1a31e700bff8ad39fa079;p=thirdparty%2Felfutils.git Rewrite old-style parameters. --- diff --git a/src/ChangeLog b/src/ChangeLog index 9b9157f29..bbc2708c3 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2008-01-29 Ulrich Drepper + * 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 24d5cb3d3..6f8048f54 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,