1 # Expect script for complex PE tests that require a C compiler
2 # in addition to the just-built binutils.
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,
24 # These tests can only be run on PE/COFF platforms.
25 if {![is_pecoff_format]} {
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.
37 proc build_vers_script_dll_o {} {
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 } {
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"] {
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 {
65 if { $verbose == 2 } then { verbose "output is [file_contents tmpdir/$testname.def]" 2 }
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"
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