1 # Expect script
for simple PE tests that require the just
-built binutils only.
2 # Copyright
(C
) 2004-2024 Free Software Foundation
, Inc.
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 # These tests can only be run
on PE
/COFF platforms.
23 if {![is_pecoff_format
]} {
27 # This test can only be run
on PE
/COFF platforms that support .secrel32.
28 if {[istarget i
*86-*-cygwin
*]
29 ||
[istarget i
*86-*-pe
]
30 ||
[istarget i
*86-*-mingw
*]
31 ||
[istarget x86_64
-*-mingw
*]
32 ||
[istarget x86_64
-*-cygwin
*]
33 ||
[istarget arm
-wince
-pe
] } {
35 if {[istarget x86_64
-*-mingw
*] } {
37 {".secrel32" "--disable-reloc-section" "" "" {secrel1.s secrel2.s}
38 {{objdump
-s secrel_64.d
}} "secrel.x"}
39 {".secidx" "--disable-reloc-section" "" "" {secidx1.s secidx2.s}
40 {{objdump
-s secidx_64.d
}} "secidx.x"}
41 {".secrel32 w/ relocs" "--enable-reloc-section" "" "" {secrel1.s secrel2.s}
42 {{objdump
-p secrel
-reloc.d
}} "secrel.x"}
43 {".secidx w/ relocs" "--enable-reloc-section" "" "" {secidx1.s secidx2.s}
44 {{objdump
-p secidx
-reloc.d
}} "secidx.x"}
45 {"Empty export table" "" "" "" "exports.s"
46 {{objdump
-p exports64.d
}} "exports.dll"}
47 {"TLS directory entry" "" "" "" "tlssec.s"
48 {{objdump
-p tlssec64.d
}} "tlssec.dll"}
50 } elseif
{[istarget x86_64
-*-cygwin
*]} {
52 {".secrel32" "--disable-auto-import --disable-reloc-section" "" "" {secrel1.s secrel2.s}
53 {{objdump
-s secrel_64.d
}} "secrel.x"}
54 {".secidx" "--disable-auto-import --disable-reloc-section" "" "" {secidx1.s secidx2.s}
55 {{objdump
-s secidx_64.d
}} "secidx.x"}
56 {".secrel32 w/ relocs" "--disable-auto-import --enable-reloc-section" "" "" {secrel1.s secrel2.s}
57 {{objdump
-p secrel
-reloc.d
}} "secrel.x"}
58 {".secidx w/ relocs" "--disable-auto-import --enable-reloc-section" "" "" {secidx1.s secidx2.s}
59 {{objdump
-p secidx
-reloc.d
}} "secidx.x"}
60 {"Empty export table" "" "" "" "exports.s"
61 {{objdump
-p exports64.d
}} "exports.dll"}
62 {"TLS directory entry" "" "" "" "tlssec.s"
63 {{objdump
-p tlssec64.d
}} "tlssec.dll"}
65 } elseif
{[istarget i
*86-*-cygwin
*] } {
67 {".secrel32" "--disable-auto-import --disable-reloc-section" "" "" {secrel1.s secrel2.s}
68 {{objdump
-s secrel.d
}} "secrel.x"}
69 {".secidx" "--disable-auto-import --disable-reloc-section" "" "" {secidx1.s secidx2.s}
70 {{objdump
-s secidx.d
}} "secidx.x"}
71 {".secrel32 w/ relocs" "--disable-auto-import --enable-reloc-section" "" "" {secrel1.s secrel2.s}
72 {{objdump
-p secrel
-reloc.d
}} "secrel-reloc.x"}
73 {".secidx w/ relocs" "--disable-auto-import --enable-reloc-section" "" "" {secidx1.s secidx2.s}
74 {{objdump
-p secidx
-reloc.d
}} "secidx-reloc.x"}
75 {"Empty export table" "" "" "" "exports.s"
76 {{objdump
-p exports.d
}} "exports.dll"}
77 {"TLS directory entry" "" "" "" "tlssec.s"
78 {{objdump
-p tlssec32.d
}} "tlssec.dll"}
80 } elseif
{[istarget arm
-wince
-pe
] } {
82 {".secrel32" "--disable-reloc-section" "" "" {secrel1.s secrel2.s}
83 {{objdump
-s secrel.d
}} "secrel.x"}
84 {".secrel32 w/ relocs" "" "" "" {secrel1.s secrel2.s}
85 {{objdump
-p secrel
-reloc.d
}} "secrel-reloc.x"}
86 {"Empty export table" "" "" "" "exports.s"
87 {{objdump
-p exports.d
}} "exports.dll"}
88 {"TLS directory entry" "" "" "" "tlssec.s"
89 {{objdump
-p tlssec32.d
}} "tlssec.dll"}
93 {".secrel32" "--disable-reloc-section" "" "" {secrel1.s secrel2.s}
94 {{objdump
-s secrel.d
}} "secrel.x"}
95 {".secidx" "--disable-reloc-section" "" "" {secidx1.s secidx2.s}
96 {{objdump
-s secidx.d
}} "secidx.x"}
97 {".secrel32 w/ relocs" " --enable-reloc-section" "" "" {secrel1.s secrel2.s}
98 {{objdump
-p secrel
-reloc.d
}} "secrel-reloc.x"}
99 {".secidx w/ relocs" " --enable-reloc-section" "" "" {secidx1.s secidx2.s}
100 {{objdump
-p secidx
-reloc.d
}} "secidx-reloc.x"}
101 {"Empty export table" "" "" "" "exports.s"
102 {{objdump
-p exports.d
}} "exports.dll"}
103 {"TLS directory entry" "" "" "" "tlssec.s"
104 {{objdump
-p tlssec32.d
}} "tlssec.dll"}
108 run_ld_link_tests $pe_tests
111 if {[istarget
"aarch64-*-pe*"] || [istarget "aarch64-*-mingw*"]} {
112 run_dump_test
"pe-aarch64"
115 {"aarch64" "--image-base 0x1000" "" "" {aarch64a.s aarch64b.s}
116 {{objdump
-dr aarch64.d
}} "aarch64.x"}
117 {".secrel32" "--disable-reloc-section" "" "" {secrel1.s secrel2.s}
118 {{objdump
-s secrel_64.d
}} "secrel.x"}
119 {".secidx" "--disable-reloc-section" "" "" {secidx1.s secidx2.s}
120 {{objdump
-s secidx_aarch64.d
}} "secidx.x"}
123 run_ld_link_tests $pe_tests
126 run_dump_test
"image_size"
127 run_dump_test
"export_dynamic_warning"
129 run_dump_test
"longsecn"
130 run_dump_test
"longsecn-1"
131 run_dump_test
"longsecn-2"
132 run_dump_test
"longsecn-3"
133 run_dump_test
"longsecn-4"
134 run_dump_test
"longsecn-5"
136 run_dump_test
"orphan"
137 run_dump_test
"orphan_nu"
139 run_dump_test
"reloc"
141 run_dump_test
"weakdef-1"
143 run_dump_test
"pr19803"
144 run_dump_test
"pr26659-weak-undef-sym"
146 { "PR 19803: not exporting swept symbols"
147 "-shared --out-implib dx.dll --gc-sections"
149 {{objdump
"--syms dx.dll" pr19803.e}}
152 # This test is
*supposed
* to fail.
If the symbol defined in pr19803.e is
153 # found
then it was not stripped from the
export dll
, despite the fact that
154 # it
(should have been
) garbage collected from the executable.
156 run_ld_link_tests $pr19803_dll
158 if {[istarget x86_64
-*-mingw
*] } {
160 } elseif
{[istarget i
*86-*-cygwin
*] ||
[istarget i
*86-*-mingw
*] } {
161 run_dump_test
"cfi32"
164 set foreign_sym_test
{
165 {"non-C aligned common" "" "" "" {non-c-lang-syms.s}
166 {{nm
-C non
-c
-lang
-syms.d
}} "non-c-lang-syms.x"}
169 # MCore rearranges symbol order.
170 setup_xfail mcore
-*-pe
171 run_ld_link_tests $foreign_sym_test
173 run_dump_test
"exclude-symbols-embedded-i386"
174 run_dump_test
"exclude-symbols-embedded-x86_64"
175 run_dump_test
"exclude-symbols-def-i386"
176 run_dump_test
"exclude-symbols-def-x86_64"
178 if [check_shared_lib_support
] {
179 set old_ASFLAGS $ASFLAGS
180 if [is_underscore_target
] {
181 append ASFLAGS
" --defsym UNDERSCORE=1"
183 run_dump_test
"symbols-ordinals-hints-exports-ld"
184 # no dlltool
for these two
185 setup_xfail aarch64
-*-* sh
-*-*
186 run_dump_test
"symbols-ordinals-hints-exports-dlltool"
187 run_dump_test
"symbols-ordinals-hints-imports-ld"
188 setup_xfail aarch64
-*-* sh
-*-*
189 run_dump_test
"symbols-ordinals-hints-imports-dlltool"
190 set ASFLAGS $old_ASFLAGS