From de7dd2bdee702cd4a187c09427bd42b7eee239ec Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Sat, 31 May 2008 16:35:56 +0000 Subject: PR ld/6430 * testsuite/ld-elfcomm/elfcomm.exp (test_sort_common): Test the ascending/descending argument to the --sort-common command line option. * testsuite/ld-elfcomm/sort-common.s: New file. * ld.h (enum sort_order): New. * ldlang.c (lang_check: Fix comment. (lang_common): Sort commons in ascending or descending order. (lang_one_common): Likewise. * lexsup.c (ld_options): Have --sort-common take an option argument. (parse_args): Handle argument to --sort-common. * ld.texinfo (--sort-common): Document new optional argument. * NEWS: Mention new feature. --- ld/lexsup.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'ld/lexsup.c') diff --git a/ld/lexsup.c b/ld/lexsup.c index 1e133d9..5a30cfb 100644 --- a/ld/lexsup.c +++ b/ld/lexsup.c @@ -473,8 +473,10 @@ static const struct ld_option ld_options[] = '\0', NULL, N_("Create a position independent executable"), ONE_DASH }, { {"pic-executable", no_argument, NULL, OPTION_PIE}, '\0', NULL, NULL, TWO_DASHES }, - { {"sort-common", no_argument, NULL, OPTION_SORT_COMMON}, - '\0', NULL, N_("Sort common symbols by size"), TWO_DASHES }, + { {"sort-common", optional_argument, NULL, OPTION_SORT_COMMON}, + '\0', N_("[=ascending|descending]"), + N_("Sort common symbols by alignment [in specified order]"), + TWO_DASHES }, { {"sort_common", no_argument, NULL, OPTION_SORT_COMMON}, '\0', NULL, NULL, NO_HELP }, { {"sort-section", required_argument, NULL, OPTION_SORT_SECTION}, @@ -1142,7 +1144,14 @@ parse_args (unsigned argc, char **argv) command_line.soname = optarg; break; case OPTION_SORT_COMMON: - config.sort_common = TRUE; + if (optarg == NULL + || strcmp (optarg, N_("descending")) == 0) + config.sort_common = sort_descending; + else if (strcmp (optarg, N_("ascending")) == 0) + config.sort_common = sort_ascending; + else + einfo (_("%P%F: invalid common section sorting option: %s\n"), + optarg); break; case OPTION_SORT_SECTION: if (strcmp (optarg, N_("name")) == 0) -- cgit v1.1