aboutsummaryrefslogtreecommitdiff
path: root/binutils
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1996-04-23 16:58:18 +0000
committerIan Lance Taylor <ian@airs.com>1996-04-23 16:58:18 +0000
commit17aa82848e4572bd25ce7260e4abb2e58ffac4b8 (patch)
treeb01b2749a28ffd5484e2b24483db57e51e73d680 /binutils
parented21219c4ef59aa3930261488aad3fee95cb9e48 (diff)
downloadgdb-17aa82848e4572bd25ce7260e4abb2e58ffac4b8.zip
gdb-17aa82848e4572bd25ce7260e4abb2e58ffac4b8.tar.gz
gdb-17aa82848e4572bd25ce7260e4abb2e58ffac4b8.tar.bz2
* objdump.c (compare_symbols): Sort symbols whose names start with
`.' after other symbols. If no other decision can be made, sort symbols by name.
Diffstat (limited to 'binutils')
-rw-r--r--binutils/ChangeLog6
-rw-r--r--binutils/objdump.c22
2 files changed, 25 insertions, 3 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index de07afc..4467390 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,9 @@
+Tue Apr 23 12:56:11 1996 Ian Lance Taylor <ian@cygnus.com>
+
+ * objdump.c (compare_symbols): Sort symbols whose names start with
+ `.' after other symbols. If no other decision can be made, sort
+ symbols by name.
+
Thu Apr 18 16:02:11 1996 Ian Lance Taylor <ian@cygnus.com>
* dep-in.sed: Substitute $(BFDDIR) for @BFDDIR@.
diff --git a/binutils/objdump.c b/binutils/objdump.c
index 782a265..7fbe135 100644
--- a/binutils/objdump.c
+++ b/binutils/objdump.c
@@ -432,8 +432,8 @@ compare_symbols (ap, bp)
if (! af && bf)
return -1;
- /* Finally, try to sort global symbols before local symbols before
- debugging symbols. */
+ /* Try to sort global symbols before local symbols before debugging
+ symbols. */
aflags = a->flags;
bflags = b->flags;
@@ -452,8 +452,24 @@ compare_symbols (ap, bp)
else
return -1;
}
+ if ((aflags & BSF_GLOBAL) != (bflags & BSF_GLOBAL))
+ {
+ if ((aflags & BSF_GLOBAL) != 0)
+ return -1;
+ else
+ return 1;
+ }
- return 0;
+ /* Symbols that start with '.' might be section names, so sort them
+ after symbols that don't start with '.'. */
+ if (an[0] == '.' && bn[0] != '.')
+ return 1;
+ if (an[0] != '.' && bn[0] == '.')
+ return -1;
+
+ /* Finally, if we can't distinguish them in any other way, try to
+ get consistent results by sorting the symbols by name. */
+ return strcmp (an, bn);
}
/* Sort relocs into address order. */