OSDN Git Service

Remove STT_IFUNC support.
[pf3gnuchains/pf3gnuchains3x.git] / ld / testsuite / ld-i386 / i386.exp
1 # Expect script for ld-i386 tests
2 #   Copyright (C) 2002, 2005, 2006, 2007 Free Software Foundation
3 #
4 # This file is part of the GNU Binutils.
5 #
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 3 of the License, or
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
18 # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
19 # MA 02110-1301, USA.
20 #
21
22 # Test i386 linking; all types of relocs.  This tests the assembler and
23 # tools like objdump as well as the linker.
24
25 if {[istarget "i?86-*-vxworks"]} {
26     set i386tests {
27         {"VxWorks shared library test 1" "-shared -Tvxworks1.ld"
28          "" {vxworks1-lib.s}
29          {{readelf --relocs vxworks1-lib.rd} {objdump -dr vxworks1-lib.dd}
30           {readelf --symbols vxworks1-lib.nd} {readelf -d vxworks1-lib.td}}
31          "libvxworks1.so"}
32         {"VxWorks executable test 1 (dynamic)" \
33          "tmpdir/libvxworks1.so -Tvxworks1.ld -q --force-dynamic"
34          "" {vxworks1.s}
35          {{readelf --relocs vxworks1.rd} {objdump -dr vxworks1.dd}}
36          "vxworks1"}
37         {"VxWorks executable test 2 (dynamic)" \
38          "-Tvxworks1.ld -q --force-dynamic"
39          "" {vxworks2.s}
40          {{readelf --segments vxworks2.sd}}
41          "vxworks2"}
42         {"VxWorks executable test 2 (static)"
43          "-Tvxworks1.ld"
44          "" {vxworks2.s}
45          {{readelf --segments vxworks2-static.sd}}
46          "vxworks2"}
47     }
48     run_ld_link_tests $i386tests
49     run_dump_test "vxworks1-static"
50 }
51
52 if { !([istarget "i?86-*-elf*"]         
53        || ([istarget "i?86-*-linux*"]
54            && ![istarget "*-*-*aout*"]
55            && ![istarget "*-*-*oldld*"])
56        || [istarget "x86_64-*-linux*"]
57        || [istarget "amd64-*-linux*"]) } {
58     return
59 }
60
61 # List contains test-items with 3 items followed by 2 lists:
62 # 0:name 1:ld options 2:assembler options
63 # 3:filenames of assembler files 4: action and options. 5: name of output file
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
70 set i386tests {
71     {"TLS -fpic -shared transitions" "-shared -melf_i386"
72      "--32" {tlspic1.s tlspic2.s}
73      {{readelf -Ssrl tlspic.rd} {objdump -drj.text tlspic.dd}
74       {objdump -sj.got tlspic.sd} {objdump -sj.tdata tlspic.td}}
75       "libtlspic.so"}
76     {"TLS descriptor -fpic -shared transitions" "-shared -melf_i386"
77      "--32" {tlsdesc.s tlspic2.s}
78      {{readelf -Ssrl tlsdesc.rd} {objdump -drj.text tlsdesc.dd}
79       {objdump "-s -j.got -j.got.plt" tlsdesc.sd} {objdump -sj.tdata tlsdesc.td}}
80       "libtlsdesc.so"}
81     {"Helper shared library" "-shared -melf_i386"
82      "--32" {tlslib.s} {} "libtlslib.so"}
83     {"TLS -fpic and -fno-pic exec transitions"
84      "-melf_i386 tmpdir/libtlslib.so" "--32" {tlsbinpic.s tlsbin.s}
85      {{readelf -Ssrl tlsbin.rd} {objdump -drj.text tlsbin.dd}
86       {objdump -sj.got tlsbin.sd} {objdump -sj.tdata tlsbin.td}}
87       "tlsbin"}
88     {"TLS descriptor -fpic and -fno-pic exec transitions"
89      "-melf_i386 tmpdir/libtlslib.so" "--32" {tlsbindesc.s tlsbin.s}
90      {{readelf -Ssrl tlsbindesc.rd} {objdump -drj.text tlsbindesc.dd}
91       {objdump -sj.got tlsbindesc.sd} {objdump -sj.tdata tlsbindesc.td}}
92       "tlsbindesc"}
93     {"TLS -fno-pic -shared" "-shared -melf_i386"
94      "--32" {tlsnopic1.s tlsnopic2.s}
95      {{readelf -Ssrl tlsnopic.rd} {objdump -drj.text tlsnopic.dd}
96       {objdump -sj.got tlsnopic.sd}} "libtlsnopic.so"}
97     {"TLS with global dynamic and descriptors"
98         "-shared -melf_i386" "--32" {tlsgdesc.s}
99      {{readelf -Ssrl tlsgdesc.rd} {objdump -drj.text tlsgdesc.dd}}
100       "libtlsgdesc.so"}
101     {"TLS in debug sections" "-melf_i386"
102      "--32" {tlsg.s}
103      {{objdump -sj.debug_foobar tlsg.sd}} "tlsg"}
104     {"TLS @indntpoff with %eax" "-melf_i386" "--32" {tlsindntpoff.s}
105      {{objdump -drj.text tlsindntpoff.dd}} "tlsindntpoff"}
106     {"Reloc section order" "-shared -melf_i386 -z nocombreloc" "--32"
107      {reloc.s} {{objdump -hw reloc.d}} "reloc.so"}
108     {"Basic --emit-relocs support" "-shared -melf_i386 --emit-relocs" "--32"
109      {emit-relocs.s} {{readelf --relocs emit-relocs.d}} "emit-relocs.so"}
110     {"-z combreloc relocation sections" "-shared -melf_i386 -z combreloc"
111      "--32" {combreloc.s} {{readelf -r combreloc.d}} "combreloc.so"}
112     {"TLS GD->LE transition" "-melf_i386"
113      "--32" {tlsgd1.s}
114      {{objdump -dwr tlsgd1.dd}} "tlsgd1"}
115     {"TLS LD->LE transition" "-melf_i386"
116      "--32" {tlsld1.s}
117      {{objdump -dwr tlsld1.dd}} "tlsld1"}
118     {"TLS IE->LE transition" "-melf_i386"
119      "--32" {tlsie1.s}
120      {{objdump -dwr tlsie1.dd}} "tlsie1"}
121 }
122
123 run_ld_link_tests $i386tests
124
125 run_dump_test "abs"
126 run_dump_test "pcrel8"
127 run_dump_test "pcrel16"
128 run_dump_test "pcrel16abs"
129 run_dump_test "alloc"
130 run_dump_test "warn1"
131 run_dump_test "tlsie2"
132 run_dump_test "tlsie3"
133 run_dump_test "tlsie4"
134 run_dump_test "tlsie5"
135 run_dump_test "hidden1"
136 run_dump_test "hidden2"
137 run_dump_test "hidden3"
138 run_dump_test "protected1"
139 run_dump_test "protected2"
140 run_dump_test "protected3"