Commit | Line | Data |
---|---|---|
b9734f35 | 1 | # Expect script for ld-sparc tests |
2571583a | 2 | # Copyright (C) 2002-2017 Free Software Foundation, Inc. |
b9734f35 | 3 | # |
f96b4a7b NC |
4 | # This file is part of the GNU Binutils. |
5 | # | |
6 | # This program is free software; you can redistribute it and/or modify | |
b9734f35 | 7 | # it under the terms of the GNU General Public License as published by |
f96b4a7b | 8 | # the Free Software Foundation; either version 3 of the License, or |
b9734f35 JJ |
9 | # (at your option) any later version. |
10 | # | |
11 | # This program is distributed in the hope that it will be useful, | |
12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | # GNU General Public License for more details. | |
15 | # | |
16 | # You should have received a copy of the GNU General Public License | |
17 | # along with this program; if not, write to the Free Software | |
f96b4a7b NC |
18 | # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, |
19 | # MA 02110-1301, USA. | |
b9734f35 JJ |
20 | # |
21 | ||
28f4cc59 | 22 | # Test SPARC linking; all types of relocs. This tests the assembler and |
b9734f35 JJ |
23 | # tools like objdump as well as the linker. |
24 | ||
910600e9 RS |
25 | if {[istarget "sparc-*-vxworks"]} { |
26 | set sparcvxworkstests { | |
897aea50 | 27 | {"VxWorks shared library test 1" "-shared -Tvxworks1.ld" "" |
910600e9 RS |
28 | "-KPIC" {vxworks1-lib.s} |
29 | {{readelf --relocs vxworks1-lib.rd} {objdump -dr vxworks1-lib.dd} | |
e68ed250 | 30 | {readelf --symbols vxworks1-lib.nd} {readelf -d vxworks1-lib.td}} |
910600e9 RS |
31 | "libvxworks1.so"} |
32 | {"VxWorks executable test 1 (dynamic)" \ | |
897aea50 | 33 | "tmpdir/libvxworks1.so -Tvxworks1.ld -q --force-dynamic" "" |
910600e9 RS |
34 | "" {vxworks1.s} |
35 | {{readelf --relocs vxworks1.rd} {objdump -dr vxworks1.dd}} | |
36 | "vxworks1"} | |
37 | {"VxWorks executable test 2 (dynamic)" \ | |
897aea50 | 38 | "-Tvxworks1.ld -q --force-dynamic" "" |
910600e9 RS |
39 | "" {vxworks2.s} |
40 | {{readelf --segments vxworks2.sd}} | |
41 | "vxworks2"} | |
42 | {"VxWorks executable test 2 (static)" | |
897aea50 | 43 | "-Tvxworks1.ld" "" |
910600e9 RS |
44 | "" {vxworks2.s} |
45 | {{readelf --segments vxworks2-static.sd}} | |
46 | "vxworks2"} | |
47 | } | |
48 | run_ld_link_tests $sparcvxworkstests | |
49 | run_dump_test "vxworks1-static" | |
50 | } | |
51 | ||
28f4cc59 EB |
52 | if { !([istarget "sparc*-*-elf*"] |
53 | || [istarget "sparc*-sun-solaris*"] | |
b9734f35 JJ |
54 | || ([istarget "sparc*-*-linux*"] |
55 | && ![istarget "*-*-*aout*"] | |
56 | && ![istarget "*-*-*oldld*"])) } { | |
57 | return | |
58 | } | |
59 | ||
60 | # List contains test-items with 3 items followed by 2 lists: | |
897aea50 MR |
61 | # 0:name 1:ld early options 2:ld late options 3:assembler options |
62 | # 4:filenames of assembler files 5: action and options. 6: name of output file | |
b9734f35 JJ |
63 | |
64 | # Actions: | |
65 | # objdump: Apply objdump options on result. Compare with regex (last arg). | |
66 | # nm: Apply nm options on result. Compare with regex (last arg). | |
67 | # readelf: Apply readelf options on result. Compare with regex (last arg). | |
68 | ||
69 | set sparctests { | |
897aea50 | 70 | {"32-bit: TLS -fpic -shared transitions" "-shared -melf32_sparc" "" |
b9734f35 JJ |
71 | "--32 -K PIC" {tlssunpic32.s tlspic.s} |
72 | {{readelf -WSsrl tlssunpic32.rd} {objdump -drj.text tlssunpic32.dd} | |
73 | {objdump -sj.got tlssunpic32.sd} {objdump -sj.tdata tlssunpic32.td}} | |
74 | "libtlssunpic32.so"} | |
897aea50 | 75 | {"32-bit: Helper shared library" "-shared -melf32_sparc" "" |
b9734f35 | 76 | "--32 -K PIC" {tlslib.s} {} "libtlslib32.so"} |
897aea50 | 77 | {"32-bit: Another helper shared library" "-shared -melf32_sparc" "" |
b9734f35 | 78 | "--32 -K PIC" {tlssunbinpic32.s} {} "libtlssunbinpic32.so"} |
40937810 | 79 | {"32-bit: TLS -fpic and -fno-pic exec transitions" |
897aea50 | 80 | "-melf32_sparc tmpdir/libtlslib32.so tmpdir/tlssunbinpic32.o" "" |
b9734f35 JJ |
81 | "--32" {tlssunbin32.s} |
82 | {{readelf -WSsrl tlssunbin32.rd} {objdump -drj.text tlssunbin32.dd} | |
83 | {objdump -sj.got tlssunbin32.sd} {objdump -sj.tdata tlssunbin32.td}} | |
84 | "tlssunbin32"} | |
897aea50 | 85 | {"32-bit: TLS -fno-pic -shared" "-shared -melf32_sparc" "" |
b9734f35 JJ |
86 | "--32" {tlssunnopic32.s tlsnopic.s} |
87 | {{readelf -WSsrl tlssunnopic32.rd} {objdump -drj.text tlssunnopic32.dd} | |
88 | {objdump -sj.got tlssunnopic32.sd}} "libtlssunnopic32.so"} | |
897aea50 | 89 | {"32-bit: TLS in debug sections" "-melf32_sparc" "" |
b9734f35 JJ |
90 | "--32" {tlsg32.s} |
91 | {{objdump -sj.debug_foobar tlsg32.sd}} "tlsg32"} | |
897aea50 | 92 | {"32-bit: GOTDATA relocations" "-shared -melf32_sparc" "" |
739f7f82 DM |
93 | "--32 -K PIC" {gotop32.s} |
94 | {{readelf -WSsrl gotop32.rd} {objdump -drj.text gotop32.dd} | |
95 | {objdump -sj.got gotop32.sd} {objdump -sj.data gotop32.td}} | |
96 | "libgotop32.so"} | |
597e138c AM |
97 | {"relaxed call WDISP30 relocation" "-static -melf32_sparc -relax" "" |
98 | "--32" {wdispcall.s} | |
99 | {{objdump -dj.wdispcall wdispcall.dd}} "wdispcall"} | |
b9734f35 JJ |
100 | } |
101 | set sparc64tests { | |
897aea50 | 102 | {"64-bit: TLS -fpic -shared transitions" "-shared -melf64_sparc" "" |
b9734f35 JJ |
103 | "--64 -Av9 -K PIC" {tlssunpic64.s tlspic.s} |
104 | {{readelf -WSsrl tlssunpic64.rd} {objdump -drj.text tlssunpic64.dd} | |
105 | {objdump -sj.got tlssunpic64.sd} {objdump -sj.tdata tlssunpic64.td}} | |
106 | "libtlssunpic64.so"} | |
897aea50 | 107 | {"64-bit: Helper shared library" "-shared -melf64_sparc" "" |
b9734f35 | 108 | "--64 -Av9 -K PIC" {tlslib.s} {} "libtlslib64.so"} |
897aea50 | 109 | {"64-bit: Another helper shared library" "-shared -melf64_sparc" "" |
b9734f35 | 110 | "--64 -Av9 -K PIC" {tlssunbinpic64.s} {} "libtlssunbinpic64.so"} |
40937810 | 111 | {"64-bit: TLS -fpic and -fno-pic exec transitions" |
897aea50 | 112 | "-melf64_sparc tmpdir/libtlslib64.so tmpdir/tlssunbinpic64.o" "" |
b9734f35 JJ |
113 | "--64 -Av9" {tlssunbin64.s} |
114 | {{readelf -WSsrl tlssunbin64.rd} {objdump -drj.text tlssunbin64.dd} | |
115 | {objdump -sj.got tlssunbin64.sd} {objdump -sj.tdata tlssunbin64.td}} | |
116 | "tlssunbin64"} | |
897aea50 | 117 | {"64-bit: TLS -fno-pic -shared" "-shared -melf64_sparc" "" |
b9734f35 JJ |
118 | "--64 -Av9" {tlssunnopic64.s tlsnopic.s} |
119 | {{readelf -WSsrl tlssunnopic64.rd} {objdump -drj.text tlssunnopic64.dd} | |
120 | {objdump -sj.got tlssunnopic64.sd}} "libtlssunnopic64.so"} | |
897aea50 | 121 | {"64-bit: TLS in debug sections" "-melf64_sparc" "" |
b9734f35 JJ |
122 | "--64 -Av9" {tlsg64.s} |
123 | {{objdump -sj.debug_foobar tlsg64.sd}} "tlsg64"} | |
897aea50 | 124 | {"64-bit: GOTDATA relocations" "-shared -melf64_sparc" "" |
739f7f82 DM |
125 | "--64 -K PIC" {gotop64.s} |
126 | {{readelf -WSsrl gotop64.rd} {objdump -drj.text gotop64.dd} | |
127 | {objdump -sj.got gotop64.sd} {objdump -sj.data gotop64.td}} | |
128 | "libgotop64.so"} | |
b9734f35 JJ |
129 | } |
130 | ||
28f4cc59 EB |
131 | if { ![istarget "sparc64-*-elf*"] } { |
132 | run_ld_link_tests $sparctests | |
133 | } | |
ca6d06e5 EB |
134 | if { !([istarget "sparc-*-elf*"] |
135 | || [istarget "sparc-sun-solaris2.5*"] | |
136 | || [istarget "sparc-sun-solaris2.6"]) } { | |
40937810 JJ |
137 | run_ld_link_tests $sparc64tests |
138 | } |