gas:
[binutils/dougsmingw.git] / ld / testsuite / ld-pe / pe-compile.exp
blobb9bc4af22dc318841e1a5209759c2336f13326ff
1 # Expect script for complex PE tests that require a C compiler
2 # in addition to the just-built binutils.
3 # Copyright 2009
4 # Free Software Foundation, Inc.
6 # This file is part of the GNU Binutils.
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 3 of the License, or
11 # (at your option) any later version.
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software
20 # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
21 # MA 02110-1301, USA.
24 # These tests can only be run on PE/COFF platforms.
25 if {![is_pecoff_format]} {
26 return
29 # No compiler, no test.
30 if { [which $CC] == 0 } {
31 untested "PE version scripts"
32 untested "aligned common tests"
33 # Add more "untested" directives here when adding more tests below.
34 return
37 proc build_vers_script_dll_o {} {
38 global CC
39 global CFLAGS
40 global srcdir
41 global subdir
43 # Compile the object file.
44 if ![ld_compile "$CC $CFLAGS -shared" $srcdir/$subdir/vers-script-dll.c tmpdir/vers-script-dll.o] {
45 fail "compiling shared lib object"
49 proc run_ver_script_test { testname } {
50 global CC
51 global srcdir
52 global subdir
53 global verbose
55 if ![ld_simple_link "$CC -shared \
56 -Wl,--version-script,$srcdir/$subdir/$testname.ver \
57 -Wl,--output-def,tmpdir/$testname.def" tmpdir/$testname.dll \
58 "tmpdir/vers-script-dll.o"] {
59 fail "linking DLL"
62 if { $verbose > 2 } then { verbose "output is [file_contents tmpdir/$testname.def]" 3 }
63 if { [regexp_diff tmpdir/$testname.def $srcdir/$subdir/$testname.d] } then {
64 fail $testname
65 if { $verbose == 2 } then { verbose "output is [file_contents tmpdir/$testname.def]" 2 }
66 return
69 pass "$testname"
73 build_vers_script_dll_o
75 run_ver_script_test "vers-script-1"
76 run_ver_script_test "vers-script-2"
77 run_ver_script_test "vers-script-3"
78 run_ver_script_test "vers-script-4"
80 set align_tests {
81 {"aligned common 1" "" "" {aligncomm-1.c}
82 {{nm -C aligncomm.d}} "aligncomm-1.x"}
83 {"aligned common 2" "" "" {aligncomm-2.c}
84 {{nm -C aligncomm.d}} "aligncomm-2.x"}
85 {"aligned common 3" "" "" {aligncomm-3.c}
86 {{nm -C aligncomm.d}} "aligncomm-3.x"}
87 {"aligned common 4" "" "" {aligncomm-4.c}
88 {{nm -C aligncomm.d}} "aligncomm-4.x"}
91 run_ld_link_tests $align_tests