merge from gcc
[external/binutils.git] / ld / testsuite / ld-sparc / sparc.exp
index e4840db..2ecded2 100644 (file)
@@ -1,9 +1,11 @@
 # Expect script for ld-sparc tests
-#   Copyright (C) 2002, 2003, 2005 Free Software Foundation
+#   Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008 Free Software Foundation
 #
-# This file is free software; you can redistribute it and/or modify
+# This file is part of the GNU Binutils.
+#
+# 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,
 #
 # 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+# MA 02110-1301, USA.
 #
 
 # Test SPARC linking; all types of relocs.  This tests the assembler and
 # tools like objdump as well as the linker.
 
+if {[istarget "sparc-*-vxworks"]} {
+    set sparcvxworkstests {
+       {"VxWorks shared library test 1" "-shared -Tvxworks1.ld"
+        "-KPIC" {vxworks1-lib.s}
+        {{readelf --relocs vxworks1-lib.rd} {objdump -dr vxworks1-lib.dd}
+         {readelf --symbols vxworks1-lib.nd} {readelf -d vxworks1-lib.td}}
+        "libvxworks1.so"}
+       {"VxWorks executable test 1 (dynamic)" \
+        "tmpdir/libvxworks1.so -Tvxworks1.ld -q --force-dynamic"
+        "" {vxworks1.s}
+        {{readelf --relocs vxworks1.rd} {objdump -dr vxworks1.dd}}
+        "vxworks1"}
+       {"VxWorks executable test 2 (dynamic)" \
+        "-Tvxworks1.ld -q --force-dynamic"
+        "" {vxworks2.s}
+        {{readelf --segments vxworks2.sd}}
+        "vxworks2"}
+       {"VxWorks executable test 2 (static)"
+        "-Tvxworks1.ld"
+        "" {vxworks2.s}
+        {{readelf --segments vxworks2-static.sd}}
+        "vxworks2"}
+    }
+    run_ld_link_tests $sparcvxworkstests
+    run_dump_test "vxworks1-static"
+}
+
 if { !([istarget "sparc*-*-elf*"]
        || [istarget "sparc*-sun-solaris*"]
        || ([istarget "sparc*-*-linux*"]
@@ -59,6 +89,11 @@ set sparctests {
     {"32-bit: TLS in debug sections" "-melf32_sparc"
      "--32" {tlsg32.s}
      {{objdump -sj.debug_foobar tlsg32.sd}} "tlsg32"}
+    {"32-bit: GOTDATA relocations" "-shared -melf32_sparc"
+     "--32 -K PIC" {gotop32.s}
+     {{readelf -WSsrl gotop32.rd} {objdump -drj.text gotop32.dd}
+      {objdump -sj.got gotop32.sd} {objdump -sj.data gotop32.td}}
+     "libgotop32.so"}
 }
 set sparc64tests {
     {"64-bit: TLS -fpic -shared transitions" "-shared -melf64_sparc"
@@ -83,11 +118,18 @@ set sparc64tests {
     {"64-bit: TLS in debug sections" "-melf64_sparc"
      "--64 -Av9" {tlsg64.s}
      {{objdump -sj.debug_foobar tlsg64.sd}} "tlsg64"}
+    {"64-bit: GOTDATA relocations" "-shared -melf64_sparc"
+     "--64 -K PIC" {gotop64.s}
+     {{readelf -WSsrl gotop64.rd} {objdump -drj.text gotop64.dd}
+      {objdump -sj.got gotop64.sd} {objdump -sj.data gotop64.td}}
+     "libgotop64.so"}
 }
 
 if { ![istarget "sparc64-*-elf*"] } {
     run_ld_link_tests $sparctests
 }
-if { ![istarget "sparc-*-elf*"] } {
+if { !([istarget "sparc-*-elf*"]
+       || [istarget "sparc-sun-solaris2.5*"]
+       || [istarget "sparc-sun-solaris2.6"]) } {
     run_ld_link_tests $sparc64tests
 }