summaryrefslogtreecommitdiff
path: root/binutils/testsuite/binutils-all/nm.exp
diff options
context:
space:
mode:
authorTristan Gingold <gingold@adacore.com>2013-08-19 15:08:52 +0000
committerTristan Gingold <gingold@adacore.com>2013-08-19 15:08:52 +0000
commit9afa44a338b1780d603ac39c4693aadd1f4026ca (patch)
tree3920f59e64eb9aa01d5f0f576ddfa8e912e343be /binutils/testsuite/binutils-all/nm.exp
parent41bd9b3a007c56379f487d31de039694113ac9cb (diff)
downloadbinutils-redhat-9afa44a338b1780d603ac39c4693aadd1f4026ca.tar.gz
binutils/
2013-08-19 Tristan Gingold <gingold@adacore.com> * nm.c (print_size_symbols): Directly get symbol size. binutils/testsuite/ 2013-08-19 Tristan Gingold <gingold@adacore.com> * binutils-all/nm.exp: Add a test for nm --size-sort * binutils-all/nm-elf-1.s: New file. * binutils-all/nm-1.s: New file.
Diffstat (limited to 'binutils/testsuite/binutils-all/nm.exp')
-rw-r--r--binutils/testsuite/binutils-all/nm.exp34
1 files changed, 34 insertions, 0 deletions
diff --git a/binutils/testsuite/binutils-all/nm.exp b/binutils/testsuite/binutils-all/nm.exp
index 685794d323..226704b779 100644
--- a/binutils/testsuite/binutils-all/nm.exp
+++ b/binutils/testsuite/binutils-all/nm.exp
@@ -155,4 +155,38 @@ if [regexp $want $got] then {
fail "nm -P"
}
+# Test nm --size-sort
+
+if [is_elf_format] {
+ set nm_1_src "nm-elf-1.s"
+} else {
+ set nm_1_src "nm-1.s"
+}
+
+if {![binutils_assemble $srcdir/$subdir/$nm_1_src tmpdir/nm-1.o]} then {
+ return
+}
+
+if [is_remote host] {
+ set tempfile [remote_download host tmpdir/nm-1.o]
+} else {
+ set tempfile tmpdir/nm-1.o
+}
+
+# This test does not work correctly on ECOFF targets, because ECOFF
+# stores most symbols twice, which messes up the nm output.
+setup_xfail "alpha*-*-osf*" "alpha*-*-netware*"
+setup_xfail "mips*-*-ultrix*" "mips*-*-ecoff*" "mips*-*-irix4*"
+setup_xfail "mips*-*-riscos*" "mips*-*-sysv3*" "mips*-sony-bsd*"
+
+set got [binutils_run $NM "$NMFLAGS --size-sort $tempfile"]
+
+set want "0*4 T text_symbol3.*0*8 T text_symbol2.*0*c T text_symbol1"
+
+if [regexp $want $got] then {
+ pass "nm --size-sort"
+} else {
+ fail "nm --size-sort"
+}
+
# There are certainly other tests that could be run.