]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - ld/testsuite/ld-pe/pe.exp
Update year range in copyright notice of binutils files
[thirdparty/binutils-gdb.git] / ld / testsuite / ld-pe / pe.exp
CommitLineData
c1711530 1# Expect script for simple PE tests that require the just-built binutils only.
d87bef3a 2# Copyright (C) 2004-2023 Free Software Foundation, Inc.
d127ecce
AM
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# These tests can only be run on PE/COFF platforms.
23if {![is_pecoff_format]} {
24 return
25}
26
27# This test can only be run on PE/COFF platforms that support .secrel32.
28if {[istarget i*86-*-cygwin*]
29 || [istarget i*86-*-pe]
30 || [istarget i*86-*-mingw*]
31 || [istarget x86_64-*-mingw*]
32 || [istarget arm-wince-pe] } {
33
34 if {[istarget x86_64-*-mingw*] } {
35 set pe_tests {
514b4e19 36 {".secrel32" "--disable-reloc-section" "" "" {secrel1.s secrel2.s}
177b81d6 37 {{objdump -s secrel_64.d}} "secrel.x"}
145667f8
MH
38 {".secidx" "--disable-reloc-section" "" "" {secidx1.s secidx2.s}
39 {{objdump -s secidx_64.d}} "secidx.x"}
897aea50 40 {"Empty export table" "" "" "" "exports.s"
177b81d6 41 {{objdump -p exports64.d}} "exports.dll"}
897aea50 42 {"TLS directory entry" "" "" "" "tlssec.s"
c91a930c 43 {{objdump -p tlssec64.d}} "tlssec.dll"}
d127ecce
AM
44 }
45 } elseif {[istarget i*86-*-cygwin*] } {
46 set pe_tests {
514b4e19 47 {".secrel32" "--disable-auto-import --disable-reloc-section" "" "" {secrel1.s secrel2.s}
d127ecce 48 {{objdump -s secrel.d}} "secrel.x"}
145667f8
MH
49 {".secidx" "--disable-auto-import --disable-reloc-section" "" "" {secidx1.s secidx2.s}
50 {{objdump -s secidx.d}} "secidx.x"}
51 {"Empty export table" "" "" "" "exports.s"
52 {{objdump -p exports.d}} "exports.dll"}
53 {"TLS directory entry" "" "" "" "tlssec.s"
54 {{objdump -p tlssec32.d}} "tlssec.dll"}
55 }
56 } elseif {[istarget arm-wince-pe] } {
57 set pe_tests {
58 {".secrel32" "--disable-reloc-section" "" "" {secrel1.s secrel2.s}
59 {{objdump -s secrel.d}} "secrel.x"}
897aea50 60 {"Empty export table" "" "" "" "exports.s"
177b81d6 61 {{objdump -p exports.d}} "exports.dll"}
897aea50 62 {"TLS directory entry" "" "" "" "tlssec.s"
c91a930c 63 {{objdump -p tlssec32.d}} "tlssec.dll"}
d127ecce
AM
64 }
65 } else {
66 set pe_tests {
514b4e19 67 {".secrel32" "--disable-reloc-section" "" "" {secrel1.s secrel2.s}
d127ecce 68 {{objdump -s secrel.d}} "secrel.x"}
145667f8
MH
69 {".secidx" "--disable-reloc-section" "" "" {secidx1.s secidx2.s}
70 {{objdump -s secidx.d}} "secidx.x"}
897aea50 71 {"Empty export table" "" "" "" "exports.s"
177b81d6 72 {{objdump -p exports.d}} "exports.dll"}
897aea50 73 {"TLS directory entry" "" "" "" "tlssec.s"
c91a930c 74 {{objdump -p tlssec32.d}} "tlssec.dll"}
d127ecce
AM
75 }
76 }
77
78 run_ld_link_tests $pe_tests
79}
80
c60b3806
JT
81if {[istarget "aarch64-*-pe*"]} {
82 run_dump_test "pe-aarch64"
83}
84
85
d127ecce
AM
86run_dump_test "image_size"
87run_dump_test "export_dynamic_warning"
88
89run_dump_test "longsecn"
90run_dump_test "longsecn-1"
91run_dump_test "longsecn-2"
92run_dump_test "longsecn-3"
93run_dump_test "longsecn-4"
94run_dump_test "longsecn-5"
95
96run_dump_test "orphan"
c51297b4 97run_dump_test "orphan_nu"
05056a8d 98
6fa7408d
JB
99run_dump_test "reloc"
100
1fd6d111
TG
101run_dump_test "weakdef-1"
102
41f46ed9 103run_dump_test "pr19803"
74edb473 104run_dump_test "pr26659-weak-undef-sym"
41f46ed9
SKS
105set pr19803_dll {
106 { "PR 19803: not exporting swept symbols"
107 "-shared --out-implib dx.dll --gc-sections"
108 "" "" {pr19803.s}
109 {{objdump "--syms dx.dll" pr19803.e}}
110 "a.exe"}
111}
112# This test is *supposed* to fail. If the symbol defined in pr19803.e is
113# found then it was not stripped from the export dll, despite the fact that
114# it (should have been) garbage collected from the executable.
115setup_xfail *-*-*
116run_ld_link_tests $pr19803_dll
117
72b016b4
NC
118if {[istarget x86_64-*-mingw*] } {
119 run_dump_test "cfi"
120} elseif {[istarget i*86-*-cygwin*] || [istarget i*86-*-mingw*] } {
121 run_dump_test "cfi32"
122}
123
05056a8d 124set foreign_sym_test {
897aea50 125 {"non-C aligned common" "" "" "" {non-c-lang-syms.s}
05056a8d
DK
126 {{nm -C non-c-lang-syms.d}} "non-c-lang-syms.x"}
127}
128
1b857aee
NC
129# MCore rearranges symbol order.
130setup_xfail mcore-*-pe
05056a8d 131run_ld_link_tests $foreign_sym_test
37513c1e
MS
132
133run_dump_test "exclude-symbols-embedded-i386"
134run_dump_test "exclude-symbols-embedded-x86_64"
61f6b650
MS
135run_dump_test "exclude-symbols-def-i386"
136run_dump_test "exclude-symbols-def-x86_64"