1 # Expect script
for ld-i386 tests
2 # Copyright
(C
) 2002, 2005, 2006, 2007 Free Software Foundation
4 # This file is part of the GNU Binutils.
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.
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.
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
,
22 # Test i386 linking
; all types of relocs. This tests the assembler and
23 # tools like objdump as well as the linker.
25 if {[istarget
"i?86-*-vxworks"]} {
27 {"VxWorks shared library test 1" "-shared -Tvxworks1.ld"
29 {{readelf
--relocs vxworks1
-lib.rd
} {objdump
-dr vxworks1
-lib.dd
}
30 {readelf
--symbols vxworks1
-lib.nd
} {readelf
-d vxworks1
-lib.td
}}
32 {"VxWorks executable test 1 (dynamic)" \
33 "tmpdir/libvxworks1.so -Tvxworks1.ld -q --force-dynamic"
35 {{readelf
--relocs vxworks1.rd
} {objdump
-dr vxworks1.dd
}}
37 {"VxWorks executable test 2 (dynamic)" \
38 "-Tvxworks1.ld -q --force-dynamic"
40 {{readelf
--segments vxworks2.sd
}}
42 {"VxWorks executable test 2 (static)"
45 {{readelf
--segments vxworks2
-static.sd
}}
48 run_ld_link_tests $i386tests
49 run_dump_test
"vxworks1-static"
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*"]) } {
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
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).
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
}}
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}}
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
}}
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
}}
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
}}
101 {"TLS in debug sections" "-melf_i386"
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"
114 {{objdump
-dwr tlsgd1.dd
}} "tlsgd1"}
115 {"TLS LD->LE transition" "-melf_i386"
117 {{objdump
-dwr tlsld1.dd
}} "tlsld1"}
118 {"TLS IE->LE transition" "-melf_i386"
120 {{objdump
-dwr tlsie1.dd
}} "tlsie1"}
123 run_ld_link_tests $i386tests
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"