Commit | Line | Data |
---|---|---|
d2dee3b2 L |
1 | # Expect script for various ELF tests. |
2 | # Copyright 2006 Free Software Foundation, Inc. | |
3 | # | |
4 | # This file is free software; you can redistribute it and/or modify | |
5 | # it under the terms of the GNU General Public License as published by | |
6 | # the Free Software Foundation; either version 2 of the License, or | |
7 | # (at your option) any later version. | |
8 | # | |
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. | |
13 | # | |
14 | # You should have received a copy of the GNU General Public License | |
15 | # along with this program; if not, write to the Free Software | |
16 | # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. | |
17 | # | |
18 | ||
19 | # Exclude non-ELF targets. | |
20 | ||
21 | if ![is_elf_format] { | |
22 | return | |
23 | } | |
24 | ||
25 | # The following tests require running the executable generated by ld. | |
26 | if ![isnative] { | |
27 | return | |
28 | } | |
29 | ||
30 | # Check if compiler works | |
31 | if { [which $CC] == 0 } { | |
32 | return | |
33 | } | |
34 | ||
35 | set build_tests { | |
36 | {"Build libfoo.so" | |
37 | "-shared" "-fPIC" | |
38 | {foo.c} {} "libfoo.so"} | |
39 | {"Build versioned libfoo.so" | |
40 | "-shared -Wl,--version-script=foo.map" "-fPIC" | |
41 | {foo.c} {} "libfoov.so" "-fPIC"} | |
42 | {"Build libbar.so" | |
43 | "-shared" "-fPIC" | |
44 | {begin.c end.c} {} "libbar.so"} | |
45 | {"Build hidden libbar.so" | |
46 | "-shared" "-fPIC" | |
47 | {begin.c endhidden.c} {} "libbarh.so"} | |
48 | {"Build protected libbar.so" | |
49 | "-shared" "-fPIC" | |
50 | {begin.c endprotected.c} {} "libbarp.so"} | |
51 | {"Build libbar.so with libfoo.so" | |
52 | "-shared tmpdir/begin.o tmpdir/libfoo.so" "-fPIC" | |
53 | {end.c} {} "libbarfoo.so"} | |
54 | {"Build libar.so with versioned libfoo.so" | |
55 | "-shared tmpdir/begin.o tmpdir/libfoov.so" "-fPIC" | |
56 | {end.c} {} "libbarfoov.so"} | |
57 | {"Build hidden libbar.so with libfoo.so" | |
58 | "-shared tmpdir/begin.o tmpdir/libfoo.so" "-fPIC" | |
59 | {endhidden.c} {} "libbarhfoo.so"} | |
60 | {"Build hidden libar.so with versioned libfoo.so" | |
61 | "-shared tmpdir/begin.o tmpdir/libfoov.so" "-fPIC" | |
62 | {endhidden.c} {} "libbarhfoov.so"} | |
63 | {"Build protected libbar.so with libfoo.so" | |
64 | "-shared tmpdir/begin.o tmpdir/libfoo.so" "-fPIC" | |
65 | {endprotected.c} {} "libbarpfoo.so"} | |
66 | {"Build protected libbar.so with versioned libfoo.so" | |
67 | "-shared tmpdir/begin.o tmpdir/libfoov.so" "-fPIC" | |
68 | {endprotected.c} {} "libbarpfoov.so"} | |
69 | } | |
70 | ||
71 | set run_tests { | |
72 | {"Run normal with libfoo.so" | |
73 | "tmpdir/begin.o tmpdir/libfoo.so tmpdir/end.o" "" | |
74 | {main.c} "normal" "normal.out"} | |
75 | {"Run protected with libfoo.so" | |
76 | "tmpdir/begin.o tmpdir/libfoo.so tmpdir/endprotected.o" "" | |
77 | {main.c} "protected" "normal.out"} | |
78 | {"Run hidden with libfoo.so" | |
79 | "tmpdir/begin.o tmpdir/libfoo.so tmpdir/endhidden.o" "" | |
80 | {main.c} "hidden" "hidden.out"} | |
81 | {"Run normal with versioned libfoo.so" | |
82 | "tmpdir/begin.o tmpdir/libfoov.so tmpdir/end.o" "" | |
83 | {main.c} "normalv" "normal.out"} | |
84 | {"Run protected with versioned libfoo.so" | |
85 | "tmpdir/begin.o tmpdir/libfoov.so tmpdir/endprotected.o" "" | |
86 | {main.c} "protected" "normal.out"} | |
87 | {"Run hidden with versioned libfoo.so" | |
88 | "tmpdir/begin.o tmpdir/libfoov.so tmpdir/endhidden.o" "" | |
89 | {main.c} "hiddenv" "hidden.out"} | |
90 | {"Run normal libbar.so with libfoo.so" | |
91 | "tmpdir/libbarfoo.so tmpdir/libfoo.so" "" | |
92 | {main.c} "normal" "normal.out"} | |
93 | {"Run protected libbar.so with libfoo.so" | |
94 | "tmpdir/libbarpfoo.so tmpdir/libfoo.so" "" | |
95 | {main.c} "protected" "normal.out"} | |
96 | {"Run hidden libbar.so with libfoo.so" | |
97 | "tmpdir/libbarhfoo.so tmpdir/libfoo.so" "" | |
98 | {main.c} "hidden" "hidden.out"} | |
99 | {"Run normal libbar.so with versioned libfoo.so" | |
100 | "tmpdir/libbarfoov.so tmpdir/libfoov.so" "" | |
101 | {main.c} "normal" "normal.out"} | |
102 | {"Run protected libbar.so with versioned libfoo.so" | |
103 | "tmpdir/libbarpfoov.so tmpdir/libfoov.so" "" | |
104 | {main.c} "protected" "normal.out"} | |
105 | {"Run hidden libbar.so with versioned libfoo.so" | |
106 | "tmpdir/libbarhfoov.so tmpdir/libfoov.so" "" | |
107 | {main.c} "hidden" "hidden.out"} | |
108 | } | |
109 | ||
110 | run_cc_link_tests $build_tests | |
111 | # NetBSD ELF systems do not currently support the .*_array sections. | |
112 | run_ld_link_exec_tests [list "*-*-netbsdelf*"] $run_tests |