Fix custom bcache hash regression.
[deliverable/binutils-gdb.git] / ld / testsuite / ld-x86-64 / x86-64.exp
CommitLineData
bffbf940 1# Expect script for ld-x86_64 tests
aa820537 2# Copyright (C) 2002, 2005, 2006, 2007, 2008, 2009 Free Software Foundation
bffbf940 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
bffbf940 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
bffbf940
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.
bffbf940
JJ
20#
21
22# Test x86_64 linking; all types of relocs. This tests the assembler and
23# tools like objdump as well as the linker.
24
25if { !([istarget "x86_64-*-elf*"]
26 || [istarget "x86_64-*-linux*"]) } {
27 return
28}
29
30# List contains test-items with 3 items followed by 2 lists:
31# 0:name 1:ld options 2:assembler options
32# 3:filenames of assembler files 4: action and options. 5: name of output file
33
34# Actions:
35# objdump: Apply objdump options on result. Compare with regex (last arg).
36# nm: Apply nm options on result. Compare with regex (last arg).
37# readelf: Apply readelf options on result. Compare with regex (last arg).
38
39set x86_64tests {
40 {"TLS -fpic -shared transitions" "-shared -melf_x86_64"
41 "--64" {tlspic1.s tlspic2.s}
42 {{readelf -WSsrl tlspic.rd} {objdump -drj.text tlspic.dd}
43 {objdump -sj.got tlspic.sd} {objdump -sj.tdata tlspic.td}}
44 "libtlspic.so"}
67a4f2b7
AO
45 {"TLS descriptor -fpic -shared transitions" "-shared -melf_x86_64"
46 "--64" {tlsdesc.s tlspic2.s}
47 {{readelf -WSsrld tlsdesc.rd} {objdump -drj.text tlsdesc.dd}
48 {objdump "-s -j.got -j.got.plt" tlsdesc.sd} {objdump -sj.tdata tlsdesc.td}
49 {objdump -drj.plt tlsdesc.pd}} "libtlsdesc.so"}
bffbf940
JJ
50 {"Helper shared library" "-shared -melf_x86_64"
51 "--64" {tlslib.s} {} "libtlslib.so"}
52 {"TLS -fpic and -fno-pic exec transitions"
53 "-melf_x86_64 tmpdir/libtlslib.so" "--64" {tlsbinpic.s tlsbin.s}
54 {{readelf -WSsrl tlsbin.rd} {objdump -drj.text tlsbin.dd}
55 {objdump -sj.got tlsbin.sd} {objdump -sj.tdata tlsbin.td}}
56 "tlsbin"}
67a4f2b7
AO
57 {"TLS descriptor -fpic and -fno-pic exec transitions"
58 "-melf_x86_64 tmpdir/libtlslib.so" "--64" {tlsbindesc.s tlsbin.s}
59 {{readelf -WSsrl tlsbindesc.rd} {objdump -drj.text tlsbindesc.dd}
60 {objdump -sj.got tlsbindesc.sd} {objdump -sj.tdata tlsbindesc.td}}
61 "tlsbindesc"}
62 {"TLS with global dynamic and descriptors"
63 "-shared -melf_x86_64" "--64" {tlsgdesc.s}
64 {{readelf -WSsrl tlsgdesc.rd} {objdump -drj.text tlsgdesc.dd}}
65 "libtlsgdesc.so"}
a45bb67d
JJ
66 {"TLS in debug sections" "-melf_x86_64"
67 "--64" {tlsg.s}
68 {{objdump -sj.debug_foobar tlsg.sd}} "tlsg"}
a3fadc9a
L
69 {"TLS GD->LE transition" "-melf_x86_64"
70 "--64" {tlsgd1.s}
71 {{objdump -dwr tlsgd1.dd}} "tlsgd1"}
72 {"TLS LD->LE transition" "-melf_x86_64"
73 "--64" {tlsld1.s}
74 {{objdump -dwr tlsld1.dd}} "tlsld1"}
dd1093aa
L
75 {"TLS IE->LE transition" "-melf_x86_64"
76 "--64" {tlsie1.s}
77 {{objdump -dwr tlsie1.dd}} "tlsie1"}
39334f3a
L
78 {"Helper 64bit object 1" "-r -melf_x86_64"
79 "--64" {mixed1a.s} {} "libmixe1a.o"}
80 {"Helper 32bit object 1" "-r -melf_i386"
81 "--32" {mixed1b.s} {} "libmixe1b.o"}
82 {"Helper 64bit object 2" "-r -melf_x86_64"
83 "--64" {mixed2a.s} {} "libmixe2a.o"}
84 {"Helper 32bit object 2" "-r -melf_i386"
85 "--32" {mixed2b.s} {} "libmixe2b.o"}
bffbf940
JJ
86}
87
88run_ld_link_tests $x86_64tests
ac2aa337 89
39334f3a
L
90global link_output
91global ld
92
b51176f1 93set test_name "Mixed x86_64 and i386 input test 1"
39334f3a
L
94set test mixed1
95if { ![ld_simple_link $ld tmpdir/$test "-melf_x86_64 tmpdir/${test}a.o tmpdir/${test}b.o"] } {
96 if [string match "*i386 architecture of input file `tmpdir/${test}b.o' is incompatible with i386:x86-64 output*" $link_output] {
97 pass "$test_name"
98 } {
99 fail "$test_name"
100 }
101}
102
b51176f1 103set test_name "Mixed x86_64 and i386 input test 2"
39334f3a
L
104set test mixed2
105if { ![ld_simple_link $ld tmpdir/$test "-melf_x86_64 tmpdir/${test}a.o tmpdir/${test}b.o"] } {
106 if [string match "*i386 architecture of input file `tmpdir/${test}b.o' is incompatible with i386:x86-64 output*" $link_output] {
107 pass "$test_name"
108 } {
109 fail "$test_name"
110 }
111}
112
ac2aa337 113run_dump_test "abs"
8a9036a4 114run_dump_test "abs-l1om"
ac2aa337
JB
115run_dump_test "pcrel8"
116run_dump_test "pcrel16"
dd1093aa
L
117run_dump_test "tlsgd2"
118run_dump_test "tlsgd3"
119run_dump_test "tlsie2"
120run_dump_test "tlsie3"
41bed6dd
L
121run_dump_test "hidden1"
122run_dump_test "hidden2"
123run_dump_test "hidden3"
124run_dump_test "protected1"
125run_dump_test "protected2"
8a9036a4 126run_dump_test "protected2-l1om"
41bed6dd 127run_dump_test "protected3"
8a9036a4 128run_dump_test "protected3-l1om"
9b769489 129run_dump_test "tlsle1"
1d85728f 130run_dump_test "tlspie1"
6f8bcf84 131run_dump_test "unique1"
a7b16ceb 132run_dump_test "nogot1"
56d4289c 133run_dump_test "discarded1"
25d17eb4
L
134
135if { ![istarget "x86_64-*-linux*"] } {
136 return
137}
138
139run_dump_test "compressed1"
This page took 0.364742 seconds and 4 git commands to generate.