Remove support for the (deprecated) openrisc and or32 configurations and replace
[deliverable/binutils-gdb.git] / binutils / testsuite / binutils-all / nm.exp
index 76c7c5f38c964ab5d27f6e48709283818c70c8e0..1a5667bb954c45e1eb83fffca3a96b5b9874fe39 100644 (file)
@@ -1,8 +1,8 @@
-#   Copyright (C) 1993, 1994, 1996, 1997 Free Software Foundation, Inc.
+#   Copyright (C) 1993-2014 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
+# the Free Software Foundation; either version 3 of the License, or
 # (at your option) any later version.
 # 
 # This program is distributed in the hope that it will be useful,
@@ -12,7 +12,7 @@
 # 
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
 
 # Please email any bugs, comments, and/or additions to this file to:
 # bug-dejagnu@prep.ai.mit.edu
@@ -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
@@ -120,4 +155,55 @@ if [regexp $want $got] then {
     fail "nm -P"
 }
 
+# Test nm --size-sort
+
+# The target exceptions here are intended for targets that have ELF as
+# an intermediate format or otherwise require the ELF-variant syntax
+# for proper size annotation.  It would be nice if is_elf_format found
+# all the ELF variants, but adding the patterns here to that proc then
+# introduces a whole slew of new regressions in the GAS and LD testsuites.
+if {   [is_elf_format]
+    || [istarget *-*-dragonfly*]
+    || [istarget *-*-*elf]
+    || [istarget *-*-freebsd*]
+    || [istarget *-*-lynxos*]
+    || [istarget "mmix-knuth-mmixware"]
+    || [istarget *-*-netware*]
+    || [istarget *-*-nto*]
+    || [istarget *-*-rdos*]
+    || [istarget *-*-tpf*]
+    || [istarget *-*-uclinux*]
+    || [istarget ia64-*-*vms*]
+    || [istarget *-*-vxworks*] } {
+    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.
This page took 0.053204 seconds and 4 git commands to generate.