Fix PR ld/22263 on SPARC.
[deliverable/binutils-gdb.git] / ld / testsuite / ld-sparc / sparc.exp
CommitLineData
b9734f35 1# Expect script for ld-sparc tests
219d1afa 2# Copyright (C) 2002-2018 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
25if {[istarget "sparc-*-vxworks"]} {
26 set sparcvxworkstests {
bab55c05
AM
27 {"VxWorks shared library test 1"
28 "-shared -Tvxworks1.ld --hash-style=sysv" ""
910600e9
RS
29 "-KPIC" {vxworks1-lib.s}
30 {{readelf --relocs vxworks1-lib.rd} {objdump -dr vxworks1-lib.dd}
e68ed250 31 {readelf --symbols vxworks1-lib.nd} {readelf -d vxworks1-lib.td}}
910600e9
RS
32 "libvxworks1.so"}
33 {"VxWorks executable test 1 (dynamic)" \
bab55c05 34 "tmpdir/libvxworks1.so -Tvxworks1.ld --hash-style=sysv -q --force-dynamic" ""
910600e9
RS
35 "" {vxworks1.s}
36 {{readelf --relocs vxworks1.rd} {objdump -dr vxworks1.dd}}
37 "vxworks1"}
38 {"VxWorks executable test 2 (dynamic)" \
bab55c05 39 "-Tvxworks1.ld --hash-style=sysv -q --force-dynamic" ""
910600e9
RS
40 "" {vxworks2.s}
41 {{readelf --segments vxworks2.sd}}
42 "vxworks2"}
43 {"VxWorks executable test 2 (static)"
bab55c05 44 "-Tvxworks1.ld --hash-style=sysv" ""
910600e9
RS
45 "" {vxworks2.s}
46 {{readelf --segments vxworks2-static.sd}}
47 "vxworks2"}
48 }
49 run_ld_link_tests $sparcvxworkstests
50 run_dump_test "vxworks1-static"
51}
52
28f4cc59
EB
53if { !([istarget "sparc*-*-elf*"]
54 || [istarget "sparc*-sun-solaris*"]
b9734f35
JJ
55 || ([istarget "sparc*-*-linux*"]
56 && ![istarget "*-*-*aout*"]
57 && ![istarget "*-*-*oldld*"])) } {
58 return
59}
60
61# List contains test-items with 3 items followed by 2 lists:
897aea50
MR
62# 0:name 1:ld early options 2:ld late options 3:assembler options
63# 4:filenames of assembler files 5: action and options. 6: name of output file
b9734f35
JJ
64
65# Actions:
66# objdump: Apply objdump options on result. Compare with regex (last arg).
67# nm: Apply nm options on result. Compare with regex (last arg).
68# readelf: Apply readelf options on result. Compare with regex (last arg).
69
70set sparctests {
bab55c05
AM
71 {"32-bit: TLS -fpic -shared transitions"
72 "-shared -melf32_sparc --hash-style=sysv" ""
b9734f35
JJ
73 "--32 -K PIC" {tlssunpic32.s tlspic.s}
74 {{readelf -WSsrl tlssunpic32.rd} {objdump -drj.text tlssunpic32.dd}
75 {objdump -sj.got tlssunpic32.sd} {objdump -sj.tdata tlssunpic32.td}}
76 "libtlssunpic32.so"}
bb363086
EB
77 {"32-bit: Helper shared library"
78 "-shared -melf32_sparc -version-script tlslib.ver" ""
b9734f35 79 "--32 -K PIC" {tlslib.s} {} "libtlslib32.so"}
897aea50 80 {"32-bit: Another helper shared library" "-shared -melf32_sparc" ""
b9734f35 81 "--32 -K PIC" {tlssunbinpic32.s} {} "libtlssunbinpic32.so"}
40937810 82 {"32-bit: TLS -fpic and -fno-pic exec transitions"
bab55c05 83 "-melf32_sparc --hash-style=sysv tmpdir/libtlslib32.so tmpdir/tlssunbinpic32.o" ""
b9734f35
JJ
84 "--32" {tlssunbin32.s}
85 {{readelf -WSsrl tlssunbin32.rd} {objdump -drj.text tlssunbin32.dd}
86 {objdump -sj.got tlssunbin32.sd} {objdump -sj.tdata tlssunbin32.td}}
87 "tlssunbin32"}
bab55c05
AM
88 {"32-bit: TLS -fno-pic -shared"
89 "-shared -melf32_sparc --hash-style=sysv" ""
b9734f35
JJ
90 "--32" {tlssunnopic32.s tlsnopic.s}
91 {{readelf -WSsrl tlssunnopic32.rd} {objdump -drj.text tlssunnopic32.dd}
92 {objdump -sj.got tlssunnopic32.sd}} "libtlssunnopic32.so"}
897aea50 93 {"32-bit: TLS in debug sections" "-melf32_sparc" ""
b9734f35
JJ
94 "--32" {tlsg32.s}
95 {{objdump -sj.debug_foobar tlsg32.sd}} "tlsg32"}
bb363086
EB
96 {"32-bit: TLS -fpie" "-melf32_sparc -pie tmpdir/libtlslib32.so" ""
97 "--32 -K PIC" {tlspie32.s}
98 {{objdump -drj.text tlspie32.dd}} "tlspie32"}
bab55c05
AM
99 {"32-bit: GOTDATA relocations"
100 "-shared -melf32_sparc --hash-style=sysv" ""
739f7f82
DM
101 "--32 -K PIC" {gotop32.s}
102 {{readelf -WSsrl gotop32.rd} {objdump -drj.text gotop32.dd}
103 {objdump -sj.got gotop32.sd} {objdump -sj.data gotop32.td}}
104 "libgotop32.so"}
597e138c
AM
105 {"relaxed call WDISP30 relocation" "-static -melf32_sparc -relax" ""
106 "--32" {wdispcall.s}
107 {{objdump -dj.wdispcall wdispcall.dd}} "wdispcall"}
b9734f35
JJ
108}
109set sparc64tests {
bab55c05
AM
110 {"64-bit: TLS -fpic -shared transitions"
111 "-shared -melf64_sparc --hash-style=sysv" ""
b9734f35
JJ
112 "--64 -Av9 -K PIC" {tlssunpic64.s tlspic.s}
113 {{readelf -WSsrl tlssunpic64.rd} {objdump -drj.text tlssunpic64.dd}
114 {objdump -sj.got tlssunpic64.sd} {objdump -sj.tdata tlssunpic64.td}}
115 "libtlssunpic64.so"}
bb363086
EB
116 {"64-bit: Helper shared library"
117 "-shared -melf64_sparc -version-script tlslib.ver" ""
b9734f35 118 "--64 -Av9 -K PIC" {tlslib.s} {} "libtlslib64.so"}
897aea50 119 {"64-bit: Another helper shared library" "-shared -melf64_sparc" ""
b9734f35 120 "--64 -Av9 -K PIC" {tlssunbinpic64.s} {} "libtlssunbinpic64.so"}
40937810 121 {"64-bit: TLS -fpic and -fno-pic exec transitions"
bab55c05 122 "-melf64_sparc --hash-style=sysv tmpdir/libtlslib64.so tmpdir/tlssunbinpic64.o" ""
b9734f35
JJ
123 "--64 -Av9" {tlssunbin64.s}
124 {{readelf -WSsrl tlssunbin64.rd} {objdump -drj.text tlssunbin64.dd}
125 {objdump -sj.got tlssunbin64.sd} {objdump -sj.tdata tlssunbin64.td}}
126 "tlssunbin64"}
bab55c05
AM
127 {"64-bit: TLS -fno-pic -shared"
128 "-shared -melf64_sparc --hash-style=sysv" ""
b9734f35
JJ
129 "--64 -Av9" {tlssunnopic64.s tlsnopic.s}
130 {{readelf -WSsrl tlssunnopic64.rd} {objdump -drj.text tlssunnopic64.dd}
131 {objdump -sj.got tlssunnopic64.sd}} "libtlssunnopic64.so"}
897aea50 132 {"64-bit: TLS in debug sections" "-melf64_sparc" ""
b9734f35
JJ
133 "--64 -Av9" {tlsg64.s}
134 {{objdump -sj.debug_foobar tlsg64.sd}} "tlsg64"}
bb363086
EB
135 {"64-bit: TLS -fpie" "-melf64_sparc -pie tmpdir/libtlslib64.so" ""
136 "--64 -Av9 -K PIC" {tlspie64.s}
137 {{objdump -drj.text tlspie64.dd}} "tlspie64"}
bab55c05
AM
138 {"64-bit: GOTDATA relocations"
139 "-shared -melf64_sparc --hash-style=sysv" ""
bb363086 140 "--64 -Av9 -K PIC" {gotop64.s}
739f7f82
DM
141 {{readelf -WSsrl gotop64.rd} {objdump -drj.text gotop64.dd}
142 {objdump -sj.got gotop64.sd} {objdump -sj.data gotop64.td}}
143 "libgotop64.so"}
b9734f35
JJ
144}
145
28f4cc59
EB
146if { ![istarget "sparc64-*-elf*"] } {
147 run_ld_link_tests $sparctests
148}
ca6d06e5
EB
149if { !([istarget "sparc-*-elf*"]
150 || [istarget "sparc-sun-solaris2.5*"]
151 || [istarget "sparc-sun-solaris2.6"]) } {
40937810
JJ
152 run_ld_link_tests $sparc64tests
153}
This page took 0.779028 seconds and 4 git commands to generate.