ld/testsuite/
[platform/upstream/binutils.git] / ld / testsuite / ld-i386 / i386.exp
1 # Expect script for ld-i386 tests
2 #   Copyright (C) 2002, 2005, 2006 Free Software Foundation
3 #
4 # This file is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2 of the License, or
7 # (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
17 #
18
19 # Test i386 linking; all types of relocs.  This tests the assembler and
20 # tools like objdump as well as the linker.
21
22 if {[istarget "i?86-*-vxworks"]} {
23     set i386tests {
24         {"VxWorks shared library test 1" "-shared -Tvxworks1.ld"
25          "" {vxworks1-lib.s}
26          {{readelf --relocs vxworks1-lib.rd} {objdump -dr vxworks1-lib.dd}}
27          "libvxworks1.so"}
28         {"VxWorks dynamic executable test 1" \
29          "tmpdir/libvxworks1.so -Tvxworks1.ld -q" "" {vxworks1.s}
30          {{readelf --relocs vxworks1.rd} {objdump -dr vxworks1.dd}}
31          "vxworks1"}
32     }
33     run_ld_link_tests $i386tests
34 }
35
36 if { !([istarget "i?86-*-elf*"]         
37        || ([istarget "i?86-*-linux*"]
38            && ![istarget "*-*-*aout*"]
39            && ![istarget "*-*-*oldld*"])
40        || [istarget "x86_64-*-linux*"]
41        || [istarget "amd64-*-linux*"]) } {
42     return
43 }
44
45 # List contains test-items with 3 items followed by 2 lists:
46 # 0:name 1:ld options 2:assembler options
47 # 3:filenames of assembler files 4: action and options. 5: name of output file
48
49 # Actions:
50 # objdump: Apply objdump options on result.  Compare with regex (last arg).
51 # nm: Apply nm options on result.  Compare with regex (last arg).
52 # readelf: Apply readelf options on result.  Compare with regex (last arg).
53
54 set i386tests {
55     {"TLS -fpic -shared transitions" "-shared -melf_i386"
56      "--32" {tlspic1.s tlspic2.s}
57      {{readelf -Ssrl tlspic.rd} {objdump -drj.text tlspic.dd}
58       {objdump -sj.got tlspic.sd} {objdump -sj.tdata tlspic.td}}
59       "libtlspic.so"}
60     {"TLS descriptor -fpic -shared transitions" "-shared -melf_i386"
61      "--32" {tlsdesc.s tlspic2.s}
62      {{readelf -Ssrl tlsdesc.rd} {objdump -drj.text tlsdesc.dd}
63       {objdump "-s -j.got -j.got.plt" tlsdesc.sd} {objdump -sj.tdata tlsdesc.td}}
64       "libtlsdesc.so"}
65     {"Helper shared library" "-shared -melf_i386"
66      "--32" {tlslib.s} {} "libtlslib.so"}
67     {"TLS -fpic and -fno-pic exec transitions"
68      "-melf_i386 tmpdir/libtlslib.so" "--32" {tlsbinpic.s tlsbin.s}
69      {{readelf -Ssrl tlsbin.rd} {objdump -drj.text tlsbin.dd}
70       {objdump -sj.got tlsbin.sd} {objdump -sj.tdata tlsbin.td}}
71       "tlsbin"}
72     {"TLS descriptor -fpic and -fno-pic exec transitions"
73      "-melf_i386 tmpdir/libtlslib.so" "--32" {tlsbindesc.s tlsbin.s}
74      {{readelf -Ssrl tlsbindesc.rd} {objdump -drj.text tlsbindesc.dd}
75       {objdump -sj.got tlsbindesc.sd} {objdump -sj.tdata tlsbindesc.td}}
76       "tlsbindesc"}
77     {"TLS -fno-pic -shared" "-shared -melf_i386"
78      "--32" {tlsnopic1.s tlsnopic2.s}
79      {{readelf -Ssrl tlsnopic.rd} {objdump -drj.text tlsnopic.dd}
80       {objdump -sj.got tlsnopic.sd}} "libtlsnopic.so"}
81     {"TLS with global dynamic and descriptors"
82         "-shared -melf_i386" "--32" {tlsgdesc.s}
83      {{readelf -Ssrl tlsgdesc.rd} {objdump -drj.text tlsgdesc.dd}}
84       "libtlsgdesc.so"}
85     {"TLS in debug sections" "-melf_i386"
86      "--32" {tlsg.s}
87      {{objdump -sj.debug_foobar tlsg.sd}} "tlsg"}
88     {"TLS @indntpoff with %eax" "-melf_i386" "--32" {tlsindntpoff.s}
89      {{objdump -drj.text tlsindntpoff.dd}} "tlsindntpoff"}
90     {"Reloc section order" "-shared -melf_i386 -z nocombreloc" "--32"
91      {reloc.s} {{objdump -hw reloc.d}} "reloc.so"}
92     {"Basic --emit-relocs support" "-shared -melf_i386 --emit-relocs" "--32"
93      {emit-relocs.s} {{readelf --relocs emit-relocs.d}} "emit-relocs.so"}
94     {"-z combreloc relocation sections" "-shared -melf_i386 -z combreloc"
95      "--32" {combreloc.s} {{readelf -r combreloc.d}} "combreloc.so"}
96 }
97
98 run_ld_link_tests $i386tests
99
100 run_dump_test "abs"
101 run_dump_test "pcrel8"
102 run_dump_test "pcrel16"