summaryrefslogtreecommitdiffstats
path: root/ld/lexsup.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2008-05-31 16:35:56 +0000
committerNick Clifton <nickc@redhat.com>2008-05-31 16:35:56 +0000
commitde7dd2bdee702cd4a187c09427bd42b7eee239ec (patch)
tree40d84aa2c577867c71021aeb9f0ddc5bc74c6614 /ld/lexsup.c
parentc7eb6be45e424188fd6f1035ca747f4295f2588c (diff)
downloadppe42-binutils-de7dd2bdee702cd4a187c09427bd42b7eee239ec.tar.gz
ppe42-binutils-de7dd2bdee702cd4a187c09427bd42b7eee239ec.zip
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.
Diffstat (limited to 'ld/lexsup.c')
-rw-r--r--ld/lexsup.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/ld/lexsup.c b/ld/lexsup.c
index 1e133d9f9a..5a30cfb13e 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)
OpenPOWER on IntegriCloud