Update x86 nacl tests for section alignment change
[deliverable/binutils-gdb.git] / ld / testsuite / ld-size / size.exp
CommitLineData
8fd4256d
L
1# Expect script for linker support of size relocations.
2#
3# Copyright 2013 Free Software Foundation, Inc.
4#
5# This file is part of the GNU Binutils.
6#
7# This program is free software; you can redistribute it and/or modify
8# it under the terms of the GNU General Public License as published by
9# the Free Software Foundation; either version 3 of the License, or
10# (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU General Public License for more details.
16#
17# You should have received a copy of the GNU General Public License
18# along with this program; if not, write to the Free Software
19# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
20# MA 02110-1301, USA.
21#
22
23
24# Size relications have only been implemented for the ix86 and x86_64,
25# so far.
26if {!(([istarget "i?86-*-*"]
27 || [istarget "x86_64-*-*"])
28 && ([istarget "*-*-elf*"]
29 || [istarget "*-*-nacl*"]
30 || (([istarget "*-*-linux*"]
31 || [istarget "*-*-gnu*"])
32 && ![istarget "*-*-*aout*"]
33 && ![istarget "*-*-*oldld*"]))) } {
34 verbose "Size relocations tests not run - no target support"
35 return
36}
37
38set test_list [lsort [glob -nocomplain $srcdir/$subdir/*.d]]
39foreach t $test_list {
40 # We need to strip the ".d", but can leave the dirname.
41 verbose [file rootname $t]
42 run_dump_test [file rootname $t]
43}
44
45# We need a native system.
46if ![isnative] {
47 verbose "Natibe size relocation tests not run - not a native toolchain"
48 return
49}
50
51# We need a working compiler.
52if { [which $CC] == 0 } {
53 verbose "Native size relocation tests not run - no compiler available"
54 return
55}
56
57set build_tests {
1cf48f48
L
58 {"Build libsize-1.so"
59 "-shared" "-fPIC"
60 {size-1a.c size-1b.c} {} "libsize-1.so"}
61 {"Build libsize-2.so"
62 "-shared" "-fPIC"
63 {size-2a.c size-2b.c} {} "libsize-2.so"}
8fd4256d
L
64 {"Build libsize-3a.so"
65 "-shared" "-fPIC"
66 {size-3a.c} {} "libsize-3a.so"}
67 {"Build libsize-3b.so"
68 "-shared" "-fPIC"
69 {size-3b.c} {} "libsize-3b.so"}
70 {"Build libsize-3c.so"
71 "-shared" "-fPIC"
72 {size-3c.c} {} "libsize-3c.so"}
73 {"Build libsize-6b.so"
74 "-shared" "-fPIC"
75 {size-6b.c} {} "libsize-6b.so"}
76 {"Build libsize-7.so"
77 "-shared" "-fPIC"
78 {size-7b.c} {} "libsize-7.so"}
79 {"Build size-7"
e16fc3da 80 "-Wl,--no-as-needed tmpdir/libsize-7.so" ""
8fd4256d
L
81 {size-7a.c} {{readelf -rW size-7.rd}} "size-7.exe"}
82 {"Build libsize-8.so"
83 "-shared" "-fPIC"
84 {size-8b.c} {} "libsize-8.so"}
85 {"Build size-8"
e16fc3da 86 "-Wl,--no-as-needed tmpdir/libsize-8.so" ""
8fd4256d 87 {size-8a.c} {{readelf -rW size-8.rd}} "size-8.exe"}
9a645e5c
L
88 {"Build libsize-9.so"
89 "-shared" "-fPIC"
90 {size-9b.c} {{readelf -rW size-9.rd}} "libsize-9.so"}
91 {"Build libsize-10.so"
92 "-shared" "-fPIC"
93 {size-10b.c} {{readelf -rW size-10.rd}} "libsize-10.so"}
8fd4256d
L
94}
95
96run_cc_link_tests $build_tests
97
98set run_tests {
1cf48f48
L
99 {"Run size-1"
100 "tmpdir/libsize-1.so" ""
101 {size-1.c} "size-1" "size-1.out"}
102 {"Run size-2"
103 "tmpdir/libsize-2.so" ""
104 {size-2.c} "size-2" "size-2.out"}
8fd4256d
L
105 {"Run size-3a"
106 "" ""
107 {size-3.c size-3a.c} "size-3a" "size-3.out"}
108 {"Run size-3b"
109 "tmpdir/libsize-3a.so" ""
110 {size-3.c} "size-3b" "size-3.out"}
111 {"Run size-3c"
112 "" ""
113 {size-3.c size-3b.c} "size-3c" "size-3.out"}
114 {"Run size-3d"
115 "tmpdir/libsize-3b.so" ""
116 {size-3.c} "size-3d" "size-3.out"}
117 {"Run size-3d"
118 "" ""
119 {size-3.c size-3c.c} "size-3d" "size-3.out"}
120 {"Run size-3e"
121 "tmpdir/libsize-3c.so" ""
122 {size-3.c} "size-3e" "size-3.out"}
123 {"Run size-4a"
124 "" ""
125 {size-4a.c size-4b.c} "size-4a" "size-4.out"}
126 {"Run size-4b"
127 "" ""
128 {size-4b.c size-4a.c} "size-4b" "size-4.out"}
129 {"Run size-5a"
130 "" ""
131 {size-5a.c size-5b.c} "size-5a" "size-5.out"}
132 {"Run size-5b"
133 "" ""
134 {size-5b.c size-5a.c} "size-5b" "size-5.out"}
135 {"Run size-6"
136 "tmpdir/libsize-6b.so" ""
137 {size-6a.c} "size-6" "size-6.out"}
138}
139
140run_ld_link_exec_tests [] $run_tests
9a645e5c
L
141
142# Check if size relocation works at run-time.
143catch "exec tmpdir/size-7.exe > tmpdir/dump.out" exec_output
144if ![string match "" $exec_output] then {
145 send_log "No run-time size relocation support: $exec_output\n"
146 verbose "No run-time size relocation support: $exec_output" 1
147 return
148}
149
150if { [regexp_diff "tmpdir/dump.out" "$srcdir/$subdir/size-7.out" ] } then {
151 verbose "output is [file_contents "tmpdir/dump.out"]" 2
152 fail "Run-time size relocation"
153 return
154}
155
156# Run-time size relocation tests.
157set run_time_tests {
158 {"Run size-8"
20e52bd2 159 "tmpdir/libsize-8.so --hash-styl=gnu" ""
9a645e5c
L
160 {size-8a.c} "size-8" "size-8.out"}
161 {"Run size-9"
162 "tmpdir/libsize-9.so" ""
163 {size-9a.c} "size-9" "size-9.out"}
164 {"Run size-10"
165 "tmpdir/libsize-10.so" ""
166 {size-10a.c} "size-10" "size-10.out"}
167}
168
169run_ld_link_exec_tests [] $run_time_tests
This page took 0.060249 seconds and 4 git commands to generate.