From 0ba0c2b3438846e98e254ea2019901ea42bd986f Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Wed, 18 May 2011 16:35:03 +0000 Subject: 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. --- binutils/testsuite/ChangeLog | 7 +++++++ binutils/testsuite/binutils-all/nm.exp | 35 ++++++++++++++++++++++++++++++++++ binutils/testsuite/lib/utils-lib.exp | 1 + 3 files changed, 43 insertions(+) (limited to 'binutils/testsuite') diff --git a/binutils/testsuite/ChangeLog b/binutils/testsuite/ChangeLog index 758e574..94dcdad 100644 --- a/binutils/testsuite/ChangeLog +++ b/binutils/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2011-05-18 Nick Clifton + + 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 * 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 67d0cbd..685794d 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 72e368c..b96043b 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 -- cgit v1.1