summaryrefslogtreecommitdiff
path: root/binutils/nm.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@bigpond.net.au>2002-06-21 02:34:38 +0000
committerAlan Modra <amodra@bigpond.net.au>2002-06-21 02:34:38 +0000
commit26d49c9139d01b0df472128f3a3c962b980159e4 (patch)
tree42dd482d25d177caab708cb4d600d95d194d33f3 /binutils/nm.c
parent7a9ff7d978e444da7dae778a63c15706cf064bf4 (diff)
downloadbinutils-redhat-26d49c9139d01b0df472128f3a3c962b980159e4.tar.gz
* configure.in: Check for strcoll.
* configure: Regenerate. * config.in: Regenerate. * nm.c (main): Set locale for LC_COLLATE category. (non_numeric_forward): Use strcoll if available.
Diffstat (limited to 'binutils/nm.c')
-rw-r--r--binutils/nm.c28
1 files changed, 22 insertions, 6 deletions
diff --git a/binutils/nm.c b/binutils/nm.c
index 79658fe48d..306f2c60e3 100644
--- a/binutils/nm.c
+++ b/binutils/nm.c
@@ -51,7 +51,7 @@ struct get_relocs_info
asymbol **syms;
};
-struct extended_symbol_info
+struct extended_symbol_info
{
symbol_info *sinfo;
bfd_vma ssize;
@@ -355,6 +355,7 @@ main (argc, argv)
#endif
#if defined (HAVE_SETLOCALE)
setlocale (LC_CTYPE, "");
+ setlocale (LC_COLLATE, "");
#endif
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
@@ -705,8 +706,23 @@ non_numeric_forward (P_x, P_y)
xn = bfd_asymbol_name (x);
yn = bfd_asymbol_name (y);
- return ((xn == NULL) ? ((yn == NULL) ? 0 : -1) :
- ((yn == NULL) ? 1 : strcmp (xn, yn)));
+ if (yn == NULL)
+ return xn != NULL;
+ if (xn == NULL)
+ return -1;
+
+#ifdef HAVE_STRCOLL
+ /* Solaris 2.5 has a bug in strcoll.
+ strcoll returns invalid values when confronted with empty strings. */
+ if (*yn == '\0')
+ return *xn != '\0';
+ if (*xn == '\0')
+ return -1;
+
+ return strcoll (xn, yn);
+#else
+ return strcmp (xn, yn);
+#endif
}
static int
@@ -886,7 +902,7 @@ sort_symbols_by_size (abfd, dynamic, minisyms, symcount, size, symsizesp)
sec = bfd_get_section (sym);
- if (bfd_get_flavour (abfd) == bfd_target_elf_flavour)
+ if (bfd_get_flavour (abfd) == bfd_target_elf_flavour)
sz = ((elf_symbol_type *) sym)->internal_elf_sym.st_size;
else if (bfd_is_com_section (sec))
sz = sym->value;
@@ -1186,7 +1202,7 @@ print_symbol (abfd, sym, ssize, archive_bfd)
bfd_get_symbol_info (abfd, sym, &syminfo);
info.sinfo = &syminfo;
info.ssize = ssize;
- if (bfd_get_flavour (abfd) == bfd_target_elf_flavour)
+ if (bfd_get_flavour (abfd) == bfd_target_elf_flavour)
info.elfinfo = (elf_symbol_type *) sym;
else
info.elfinfo = NULL;
@@ -1545,7 +1561,7 @@ print_symbol_info_sysv (info, abfd)
printf ("| |"); /* Line, Section */
}
else
- {
+ {
/* Type, Size, Line, Section */
if (info->elfinfo)
printf ("%18s|",