aboutsummaryrefslogtreecommitdiff
path: root/ld/lexsup.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2004-10-04 16:45:51 +0000
committerH.J. Lu <hjl.tools@gmail.com>2004-10-04 16:45:51 +0000
commitbcaa7b3eb9571ac0699402a62bf1bfae3a263413 (patch)
treea3101f1a003e9bb9ff9579fc1a0c3d016cc52821 /ld/lexsup.c
parenta4f5ad884ecd1b56c973e0d562d97720140d1ec8 (diff)
downloadgdb-bcaa7b3eb9571ac0699402a62bf1bfae3a263413.zip
gdb-bcaa7b3eb9571ac0699402a62bf1bfae3a263413.tar.gz
gdb-bcaa7b3eb9571ac0699402a62bf1bfae3a263413.tar.bz2
ld/
2004-10-04 H.J. Lu <hongjiu.lu@intel.com> * NEWS: Mention SORT_BY_NAME, SORT_BY_ALIGNMENT and --sort-section name|alignment. * ld.texinfo: Document SORT_BY_NAME, SORT_BY_ALIGNMENT and --sort-section name|alignment. * ld.h (sort_type): New enum. (wildcard_spec): Change the type of `sorted' to sort_type. * ldgram.y (SORT): Removed. (SORT_BY_NAME): Added. (SORT_BY_ALIGNMENT): Added. (wildcard_spec): Updated `sorted'. Handle SORT_BY_NAME and SORT_BY_ALIGNMENT. (input_section_spec_no_keep): Updated `sorted'. (statement): Replace SORT with SORT_BY_NAME. * ldlang.c (compare_section): New function to compare 2 sections with different sorting schemes. (wild_sort): Updated. Use compare_section. (update_wild_statements): New function. (lang_process): Call update_wild_statements before map_input_to_output_sections. * ldlex.l (SORT_BY_NAME): New. (SORT_BY_ALIGNMENT): New. (SORT): Return SORT_BY_NAME. * ldmain.c (sort_section): New. Defined. (main): Initialize it to none. * lexsup.c (option_values): Add OPTION_SORT_SECTION. (ld_options): Add an entry for OPTION_SORT_SECTION. (parse_args): Handle OPTION_SORT_SECTION. * mri.c (mri_draw_tree): Updated `sorted'. ld/testsuite/ 2004-10-04 H.J. Lu <hongjiu.lu@intel.com> * ld-scripts/sort.exp: New file for section sorting tests. * ld-scripts/sort_b_a.d: Likewise * ld-scripts/sort_b_a.s: Likewise * ld-scripts/sort_b_a.t: Likewise * ld-scripts/sort_b_a_a-1.d: Likewise * ld-scripts/sort_b_a_a-2.d: Likewise * ld-scripts/sort_b_a_a-3.d: Likewise * ld-scripts/sort_b_a_a.t: Likewise * ld-scripts/sort_b_a_n-1.d: Likewise * ld-scripts/sort_b_a_n-2.d: Likewise * ld-scripts/sort_b_a_n-3.d: Likewise * ld-scripts/sort_b_a_n.t: Likewise * ld-scripts/sort_b_n.d: Likewise * ld-scripts/sort_b_n.s: Likewise * ld-scripts/sort_b_n.t: Likewise * ld-scripts/sort_b_n_a-1.d: Likewise * ld-scripts/sort_b_n_a-2.d: Likewise * ld-scripts/sort_b_n_a-3.d: Likewise * ld-scripts/sort_b_n_a.t: Likewise * ld-scripts/sort_b_n_n-1.d: Likewise * ld-scripts/sort_b_n_n-2.d: Likewise * ld-scripts/sort_b_n_n-3.d: Likewise * ld-scripts/sort_b_n_n.t: Likewise * ld-scripts/sort_n_a-a.s: Likewise * ld-scripts/sort_n_a-b.s: Likewise * ld-scripts/sort_no-1.d: Likewise * ld-scripts/sort_no-2.d: Likewise * ld-scripts/sort_no.t: Likewise
Diffstat (limited to 'ld/lexsup.c')
-rw-r--r--ld/lexsup.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/ld/lexsup.c b/ld/lexsup.c
index 9a599a3..2340006 100644
--- a/ld/lexsup.c
+++ b/ld/lexsup.c
@@ -91,6 +91,7 @@ enum option_values
OPTION_SHARED,
OPTION_SONAME,
OPTION_SORT_COMMON,
+ OPTION_SORT_SECTION,
OPTION_STATS,
OPTION_SYMBOLIC,
OPTION_TASK_LINK,
@@ -419,6 +420,9 @@ static const struct ld_option ld_options[] =
'\0', NULL, N_("Sort common symbols by size"), TWO_DASHES },
{ {"sort_common", no_argument, NULL, OPTION_SORT_COMMON},
'\0', NULL, NULL, NO_HELP },
+ { {"sort-section", required_argument, NULL, OPTION_SORT_SECTION},
+ '\0', N_("name|alignment"),
+ N_("Sort sections by name or maximum alignment"), TWO_DASHES },
{ {"spare-dynamic-tags", required_argument, NULL, OPTION_SPARE_DYNAMIC_TAGS},
'\0', N_("COUNT"), N_("How many tags to reserve in .dynamic section"),
TWO_DASHES },
@@ -1066,6 +1070,15 @@ parse_args (unsigned argc, char **argv)
case OPTION_SORT_COMMON:
config.sort_common = TRUE;
break;
+ case OPTION_SORT_SECTION:
+ if (strcmp (optarg, N_("name")) == 0)
+ sort_section = by_name;
+ else if (strcmp (optarg, N_("alignment")) == 0)
+ sort_section = by_alignment;
+ else
+ einfo (_("%P%F: invalid section sorting option: %s\n"),
+ optarg);
+ break;
case OPTION_STATS:
config.stats = TRUE;
break;