]>
Commit | Line | Data |
---|---|---|
bffbf940 | 1 | # Expect script for ld-x86_64 tests |
889a4d3e L |
2 | # Copyright (C) 2002, 2005, 2006, 2007, 2008, 2009, 2010, 2011 |
3 | # Free Software Foundation | |
bffbf940 | 4 | # |
f96b4a7b NC |
5 | # This file is part of the GNU Binutils. |
6 | # | |
7 | # This program is free software; you can redistribute it and/or modify | |
bffbf940 | 8 | # it under the terms of the GNU General Public License as published by |
f96b4a7b | 9 | # the Free Software Foundation; either version 3 of the License, or |
bffbf940 JJ |
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 | |
f96b4a7b NC |
19 | # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, |
20 | # MA 02110-1301, USA. | |
bffbf940 JJ |
21 | # |
22 | ||
23 | # Test x86_64 linking; all types of relocs. This tests the assembler and | |
24 | # tools like objdump as well as the linker. | |
25 | ||
26 | if { !([istarget "x86_64-*-elf*"] | |
27 | || [istarget "x86_64-*-linux*"]) } { | |
28 | return | |
29 | } | |
30 | ||
31 | # List contains test-items with 3 items followed by 2 lists: | |
32 | # 0:name 1:ld options 2:assembler options | |
33 | # 3:filenames of assembler files 4: action and options. 5: name of output file | |
34 | ||
35 | # Actions: | |
36 | # objdump: Apply objdump options on result. Compare with regex (last arg). | |
37 | # nm: Apply nm options on result. Compare with regex (last arg). | |
38 | # readelf: Apply readelf options on result. Compare with regex (last arg). | |
39 | ||
40 | set x86_64tests { | |
41 | {"TLS -fpic -shared transitions" "-shared -melf_x86_64" | |
42 | "--64" {tlspic1.s tlspic2.s} | |
43 | {{readelf -WSsrl tlspic.rd} {objdump -drj.text tlspic.dd} | |
44 | {objdump -sj.got tlspic.sd} {objdump -sj.tdata tlspic.td}} | |
45 | "libtlspic.so"} | |
67a4f2b7 AO |
46 | {"TLS descriptor -fpic -shared transitions" "-shared -melf_x86_64" |
47 | "--64" {tlsdesc.s tlspic2.s} | |
48 | {{readelf -WSsrld tlsdesc.rd} {objdump -drj.text tlsdesc.dd} | |
49 | {objdump "-s -j.got -j.got.plt" tlsdesc.sd} {objdump -sj.tdata tlsdesc.td} | |
50 | {objdump -drj.plt tlsdesc.pd}} "libtlsdesc.so"} | |
bffbf940 JJ |
51 | {"Helper shared library" "-shared -melf_x86_64" |
52 | "--64" {tlslib.s} {} "libtlslib.so"} | |
53 | {"TLS -fpic and -fno-pic exec transitions" | |
54 | "-melf_x86_64 tmpdir/libtlslib.so" "--64" {tlsbinpic.s tlsbin.s} | |
55 | {{readelf -WSsrl tlsbin.rd} {objdump -drj.text tlsbin.dd} | |
56 | {objdump -sj.got tlsbin.sd} {objdump -sj.tdata tlsbin.td}} | |
57 | "tlsbin"} | |
67a4f2b7 AO |
58 | {"TLS descriptor -fpic and -fno-pic exec transitions" |
59 | "-melf_x86_64 tmpdir/libtlslib.so" "--64" {tlsbindesc.s tlsbin.s} | |
60 | {{readelf -WSsrl tlsbindesc.rd} {objdump -drj.text tlsbindesc.dd} | |
61 | {objdump -sj.got tlsbindesc.sd} {objdump -sj.tdata tlsbindesc.td}} | |
62 | "tlsbindesc"} | |
63 | {"TLS with global dynamic and descriptors" | |
64 | "-shared -melf_x86_64" "--64" {tlsgdesc.s} | |
65 | {{readelf -WSsrl tlsgdesc.rd} {objdump -drj.text tlsgdesc.dd}} | |
66 | "libtlsgdesc.so"} | |
a45bb67d JJ |
67 | {"TLS in debug sections" "-melf_x86_64" |
68 | "--64" {tlsg.s} | |
69 | {{objdump -sj.debug_foobar tlsg.sd}} "tlsg"} | |
a3fadc9a L |
70 | {"TLS GD->LE transition" "-melf_x86_64" |
71 | "--64" {tlsgd1.s} | |
72 | {{objdump -dwr tlsgd1.dd}} "tlsgd1"} | |
73 | {"TLS LD->LE transition" "-melf_x86_64" | |
74 | "--64" {tlsld1.s} | |
75 | {{objdump -dwr tlsld1.dd}} "tlsld1"} | |
dd1093aa L |
76 | {"TLS IE->LE transition" "-melf_x86_64" |
77 | "--64" {tlsie1.s} | |
78 | {{objdump -dwr tlsie1.dd}} "tlsie1"} | |
39334f3a L |
79 | {"Helper 64bit object 1" "-r -melf_x86_64" |
80 | "--64" {mixed1a.s} {} "libmixe1a.o"} | |
81 | {"Helper 32bit object 1" "-r -melf_i386" | |
82 | "--32" {mixed1b.s} {} "libmixe1b.o"} | |
83 | {"Helper 64bit object 2" "-r -melf_x86_64" | |
84 | "--64" {mixed2a.s} {} "libmixe2a.o"} | |
85 | {"Helper 32bit object 2" "-r -melf_i386" | |
86 | "--32" {mixed2b.s} {} "libmixe2b.o"} | |
3dbcc61d NC |
87 | {"Split by file with 'l' flag on section." "-split-by-file -r" |
88 | "--64" {split-by-file1.s split-by-file2.s} | |
89 | {{readelf -SW split-by-file.rd}} "split-by-file.o"} | |
4a4c5f25 L |
90 | {"TLS X32 IE->LE transition" "-melf32_x86_64" |
91 | "--x32" {tlsie4.s} | |
92 | {{objdump -dwr tlsie4.dd}} "tlsie4"} | |
bffbf940 JJ |
93 | } |
94 | ||
95 | run_ld_link_tests $x86_64tests | |
ac2aa337 | 96 | |
39334f3a L |
97 | global link_output |
98 | global ld | |
99 | ||
b51176f1 | 100 | set test_name "Mixed x86_64 and i386 input test 1" |
39334f3a L |
101 | set test mixed1 |
102 | if { ![ld_simple_link $ld tmpdir/$test "-melf_x86_64 tmpdir/${test}a.o tmpdir/${test}b.o"] } { | |
103 | if [string match "*i386 architecture of input file `tmpdir/${test}b.o' is incompatible with i386:x86-64 output*" $link_output] { | |
104 | pass "$test_name" | |
105 | } { | |
106 | fail "$test_name" | |
107 | } | |
108 | } | |
109 | ||
b51176f1 | 110 | set test_name "Mixed x86_64 and i386 input test 2" |
39334f3a L |
111 | set test mixed2 |
112 | if { ![ld_simple_link $ld tmpdir/$test "-melf_x86_64 tmpdir/${test}a.o tmpdir/${test}b.o"] } { | |
113 | if [string match "*i386 architecture of input file `tmpdir/${test}b.o' is incompatible with i386:x86-64 output*" $link_output] { | |
114 | pass "$test_name" | |
115 | } { | |
116 | fail "$test_name" | |
117 | } | |
118 | } | |
119 | ||
ac2aa337 | 120 | run_dump_test "abs" |
8a9036a4 | 121 | run_dump_test "abs-l1om" |
ac2aa337 JB |
122 | run_dump_test "pcrel8" |
123 | run_dump_test "pcrel16" | |
dd1093aa L |
124 | run_dump_test "tlsgd2" |
125 | run_dump_test "tlsgd3" | |
126 | run_dump_test "tlsie2" | |
127 | run_dump_test "tlsie3" | |
41bed6dd L |
128 | run_dump_test "hidden1" |
129 | run_dump_test "hidden2" | |
130 | run_dump_test "hidden3" | |
131 | run_dump_test "protected1" | |
132 | run_dump_test "protected2" | |
8a9036a4 | 133 | run_dump_test "protected2-l1om" |
41bed6dd | 134 | run_dump_test "protected3" |
8a9036a4 | 135 | run_dump_test "protected3-l1om" |
9b769489 | 136 | run_dump_test "tlsle1" |
1d85728f | 137 | run_dump_test "tlspie1" |
6f8bcf84 | 138 | run_dump_test "unique1" |
a7b16ceb | 139 | run_dump_test "nogot1" |
0629d0af | 140 | run_dump_test "nogot2" |
56d4289c | 141 | run_dump_test "discarded1" |
25d17eb4 L |
142 | |
143 | if { ![istarget "x86_64-*-linux*"] } { | |
144 | return | |
145 | } | |
146 | ||
570561f7 | 147 | if ![ld_assemble $as "--x32 $srcdir/$subdir/start.s" tmpdir/startx32.o] { |
889a4d3e L |
148 | unresolved "Build ILP32 start.o" |
149 | return | |
150 | } | |
151 | ||
152 | if ![ld_assemble $as "--32 $srcdir/$subdir/start.s" tmpdir/start32.o] { | |
153 | unresolved "Build ia32 start.o" | |
154 | return | |
155 | } | |
156 | ||
157 | if ![ld_assemble $as "--64 $srcdir/$subdir/start.s" tmpdir/start64.o] { | |
158 | unresolved "Build LP64 start.o" | |
159 | return | |
160 | } | |
161 | ||
570561f7 | 162 | if ![ld_assemble $as "--x32 $srcdir/$subdir/foo.s" tmpdir/foox32.o] { |
889a4d3e L |
163 | unresolved "Build ILP32 foo.o" |
164 | return | |
165 | } | |
166 | ||
167 | if ![ld_assemble $as "--32 $srcdir/$subdir/foo.s" tmpdir/foo32.o] { | |
168 | unresolved "Build ia32 foo.o" | |
169 | return | |
170 | } | |
171 | ||
172 | if ![ld_assemble $as "--64 $srcdir/$subdir/foo.s" tmpdir/foo64.o] { | |
173 | unresolved "Build LP64 foo.o" | |
174 | return | |
175 | } | |
176 | ||
25d17eb4 | 177 | run_dump_test "compressed1" |
889a4d3e L |
178 | run_dump_test "ilp32-1" |
179 | run_dump_test "ilp32-2" | |
180 | run_dump_test "ilp32-3" | |
82e96e07 | 181 | run_dump_test "ilp32-4" |
248775ba | 182 | run_dump_test "ilp32-5" |
889a4d3e L |
183 | run_dump_test "ia32-1" |
184 | run_dump_test "ia32-2" | |
185 | run_dump_test "ia32-3" | |
186 | run_dump_test "lp64-1" | |
187 | run_dump_test "lp64-2" | |
188 | run_dump_test "lp64-3" |