This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 5/7] ld: Use full names for SORT_* specifiers in map files


When creating map files all SORT_* specifiers (SORT_BY_NAME,
SORT_BY_ALIGNMENT, etc) are all printed as just 'SORT'.  The result is
that in this area the map file does not present a full record of what
was going on.

After this commit the full name of the sort specifier is now used in
the map file.  I checked through the testsuite, and couldn't find any
tests covering this area.

As 'SORT' is an alias for 'SORT_BY_NAME' this does mean that some users
might be surprised by this change.  However, I felt that changing SORT
to SORT_BY_NAME was less confusing than changing SORT_BY_NAME to SORT.

In the case of filename lists where only SORT_BY_NAME (or its alias
SORT) are valid it could leaving things as they are at the
moment (always displaying 'SORT') would have been an option, however, I
changed to 'SORT_BY_NAME' because I thought consistency with the section
lists was a good thing, and we might as well make all the change in this
area in one go.

ld/ChangeLog:

	* ldlang.c (print_wild_statement): Use full names for SORT
	specifiers.
---
 ld/ChangeLog |  5 +++++
 ld/ldlang.c  | 46 +++++++++++++++++++++++++++++++++++++++++-----
 2 files changed, 46 insertions(+), 5 deletions(-)

diff --git a/ld/ldlang.c b/ld/ldlang.c
index b68204903e4..b8b214dfdb0 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -4413,7 +4413,7 @@ print_wild_statement (lang_wild_statement_type *w,
     }
 
   if (w->filenames_sorted)
-    minfo ("SORT(");
+    minfo ("SORT_BY_NAME(");
   if (w->filename != NULL)
     minfo ("%s", w->filename);
   else
@@ -4424,8 +4424,44 @@ print_wild_statement (lang_wild_statement_type *w,
   minfo ("(");
   for (sec = w->section_list; sec; sec = sec->next)
     {
-      if (sec->spec.sorted)
-	minfo ("SORT(");
+      int closing_paren = 0;
+
+      switch (sec->spec.sorted)
+        {
+        case none:
+          break;
+
+        case by_name:
+          minfo ("SORT_BY_NAME(");
+          closing_paren = 1;
+          break;
+
+        case by_alignment:
+          minfo ("SORT_BY_ALIGNMENT(");
+          closing_paren = 1;
+          break;
+
+        case by_name_alignment:
+          minfo ("SORT_BY_NAME(SORT_BY_ALIGNMENT(");
+          closing_paren = 2;
+          break;
+
+        case by_alignment_name:
+          minfo ("SORT_BY_ALIGNMENT(SORT_BY_NAME(");
+          closing_paren = 2;
+          break;
+
+        case by_none:
+          minfo ("SORT_NONE(");
+          closing_paren = 1;
+          break;
+
+        case by_init_priority:
+          minfo ("SORT_BY_INIT_PRIORITY(");
+          closing_paren = 1;
+          break;
+        }
+
       if (sec->spec.exclude_name_list != NULL)
 	{
 	  name_list *tmp;
@@ -4438,8 +4474,8 @@ print_wild_statement (lang_wild_statement_type *w,
 	minfo ("%s", sec->spec.name);
       else
 	minfo ("*");
-      if (sec->spec.sorted)
-	minfo (")");
+      for (;closing_paren > 0; closing_paren--)
+        minfo (")");
       if (sec->next)
 	minfo (" ");
     }
-- 
2.13.3


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]