summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2011-05-18 16:35:00 +0000
committerNick Clifton <nickc@redhat.com>2011-05-18 16:35:00 +0000
commitc31f3915820b6d9f0feefb6488493617599129b4 (patch)
tree794c23f2e2da11ade0fbaf601591d35bd9d5f6f5
parent7f0c984f4d3fad034aefe604e6cadc5f07b60ec8 (diff)
downloadbinutils-redhat-c31f3915820b6d9f0feefb6488493617599129b4.tar.gz
PR binutils/12753
* nm.c (filter_symbols): Treat unique symbols as global symbols. * doc/binutils.texi (nm): Mention that some lowercase letters actually indicate global symbols. * lib/utils-lib.exp (run_dump_test): Allow nm as a program. * binutils-all/nm.exp: Test running "nm -g" on an object file containing a unique symbol.
-rw-r--r--binutils/ChangeLog7
-rw-r--r--binutils/doc/binutils.texi4
-rw-r--r--binutils/nm.c2
-rw-r--r--binutils/testsuite/ChangeLog7
-rw-r--r--binutils/testsuite/binutils-all/nm.exp35
-rw-r--r--binutils/testsuite/lib/utils-lib.exp1
6 files changed, 55 insertions, 1 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 8aefa2aa80..83a59c7597 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,10 @@
+2011-05-18 Nick Clifton <nickc@redhat.com>
+
+ PR binutils/12753
+ * nm.c (filter_symbols): Treat unique symbols as global symbols.
+ * doc/binutils.texi (nm): Mention that some lowercase letters
+ actually indicate global symbols.
+
2011-05-15 Tristan Gingold <gingold@adacore.com>
* od-xcoff.c: New file.
diff --git a/binutils/doc/binutils.texi b/binutils/doc/binutils.texi
index fb3948f4a9..64333cff79 100644
--- a/binutils/doc/binutils.texi
+++ b/binutils/doc/binutils.texi
@@ -724,7 +724,9 @@ hexadecimal by default.
@item
The symbol type. At least the following types are used; others are, as
well, depending on the object file format. If lowercase, the symbol is
-local; if uppercase, the symbol is global (external).
+usually local; if uppercase, the symbol is global (external). There
+are however a few lowercase symbols that are shown for special global
+symbols (@code{u}, @code{v} and @code{w}).
@c Some more detail on exactly what these symbol types are used for
@c would be nice.
diff --git a/binutils/nm.c b/binutils/nm.c
index 2c099aacf2..2fc13b4c31 100644
--- a/binutils/nm.c
+++ b/binutils/nm.c
@@ -436,6 +436,8 @@ filter_symbols (bfd *abfd, bfd_boolean is_dynamic, void *minisyms,
else if (external_only)
keep = ((sym->flags & BSF_GLOBAL) != 0
|| (sym->flags & BSF_WEAK) != 0
+ /* PR binutls/12753: Unique symbols are global too. */
+ || (sym->flags & BSF_GNU_UNIQUE) != 0
|| bfd_is_und_section (sym->section)
|| bfd_is_com_section (sym->section));
else
diff --git a/binutils/testsuite/ChangeLog b/binutils/testsuite/ChangeLog
index 758e574416..94dcdadc71 100644
--- a/binutils/testsuite/ChangeLog
+++ b/binutils/testsuite/ChangeLog
@@ -1,3 +1,10 @@
+2011-05-18 Nick Clifton <nickc@redhat.com>
+
+ PR binutils/12753
+ * lib/utils-lib.exp (run_dump_test): Allow nm as a program.
+ * binutils-all/nm.exp: Test running "nm -g" on an object file
+ containing a unique symbol.
+
2011-05-13 Alan Modra <amodra@gmail.com>
* binutils-all/objcopy.exp objcopy_text): Remove xfails for sh-rtems
diff --git a/binutils/testsuite/binutils-all/nm.exp b/binutils/testsuite/binutils-all/nm.exp
index 67d0cbdc08..685794d323 100644
--- a/binutils/testsuite/binutils-all/nm.exp
+++ b/binutils/testsuite/binutils-all/nm.exp
@@ -98,6 +98,41 @@ if {![info exists vars(text_symbol)] \
pass "nm -g"
}
+if [is_elf_format] {
+ # PR binutils/12753
+ # Test nm -g on a unique global symbol.
+
+ # Only some targets support unique symbols.
+ if {([istarget "i?86-*-*"]
+ || [istarget "x86_64-*-*"]
+ || [istarget "arm-*-*"]
+ || [istarget "powerpc*-*-*"]
+ || [istarget "sparc*-*-*"])} then {
+
+ if {![binutils_assemble $srcdir/$subdir/unique.s tmpdir/unique.o]} then {
+ fail "nm -g on unique symbols (assembling)"
+ } else {
+ if [is_remote host] {
+ set tmpfile [remote_download host tmpdir/unique.o]
+ } else {
+ set tmpfile tmpdir/unique.o
+ }
+
+ set got [binutils_run $NM "$NMFLAGS -g $tmpfile"]
+
+ if [regexp "u foo" $got] then {
+ pass "nm -g on unique symbols"
+ } else {
+ fail "nm -g on unique symbols"
+ }
+
+ if { $verbose < 1 } {
+ remote_file host delete "tmpdir/unique.o"
+ }
+ }
+ }
+}
+
# Test nm -P
# This test does not work correctly on ECOFF targets, because ECOFF
diff --git a/binutils/testsuite/lib/utils-lib.exp b/binutils/testsuite/lib/utils-lib.exp
index 72e368cbb3..b96043b4d7 100644
--- a/binutils/testsuite/lib/utils-lib.exp
+++ b/binutils/testsuite/lib/utils-lib.exp
@@ -354,6 +354,7 @@ proc run_dump_test { name {extra_options {}} } {
}
strings { set program strings }
elfedit { set program elfedit }
+ nm { set program nm }
default {
perror "unrecognized program option $opts(PROG) in $file.d"
unresolved $testname