]>
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" | |
55255dae | 41 | {foo.c} {} "libfoov.so"} |
d2dee3b2 L |
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"} | |
55255dae L |
69 | {"Build libdl1.so" |
70 | "-shared" "-fPIC" | |
71 | {dl1.c} {} "libdl1.so"} | |
72 | {"Build libdl2a.so with --dynamic-list=dl2.list" | |
73 | "-shared -Wl,--dynamic-list=dl2.list" "-fPIC" | |
74 | {dl2.c dl2xxx.c} {} "libdl2a.so"} | |
75 | {"Build libdl2b.so with --dynamic-list=dl2.list and dl2xxx.list" | |
76 | "-shared -Wl,--dynamic-list=dl2.list,--dynamic-list=dl2xxx.list" "-fPIC" | |
77 | {dl2.c dl2xxx.c} {} "libdl2b.so"} | |
d2dee3b2 L |
78 | } |
79 | ||
80 | set run_tests { | |
81 | {"Run normal with libfoo.so" | |
82 | "tmpdir/begin.o tmpdir/libfoo.so tmpdir/end.o" "" | |
83 | {main.c} "normal" "normal.out"} | |
84 | {"Run protected with libfoo.so" | |
85 | "tmpdir/begin.o tmpdir/libfoo.so tmpdir/endprotected.o" "" | |
86 | {main.c} "protected" "normal.out"} | |
87 | {"Run hidden with libfoo.so" | |
88 | "tmpdir/begin.o tmpdir/libfoo.so tmpdir/endhidden.o" "" | |
89 | {main.c} "hidden" "hidden.out"} | |
90 | {"Run normal with versioned libfoo.so" | |
91 | "tmpdir/begin.o tmpdir/libfoov.so tmpdir/end.o" "" | |
92 | {main.c} "normalv" "normal.out"} | |
93 | {"Run protected with versioned libfoo.so" | |
94 | "tmpdir/begin.o tmpdir/libfoov.so tmpdir/endprotected.o" "" | |
95 | {main.c} "protected" "normal.out"} | |
96 | {"Run hidden with versioned libfoo.so" | |
97 | "tmpdir/begin.o tmpdir/libfoov.so tmpdir/endhidden.o" "" | |
98 | {main.c} "hiddenv" "hidden.out"} | |
99 | {"Run normal libbar.so with libfoo.so" | |
100 | "tmpdir/libbarfoo.so tmpdir/libfoo.so" "" | |
101 | {main.c} "normal" "normal.out"} | |
102 | {"Run protected libbar.so with libfoo.so" | |
103 | "tmpdir/libbarpfoo.so tmpdir/libfoo.so" "" | |
104 | {main.c} "protected" "normal.out"} | |
105 | {"Run hidden libbar.so with libfoo.so" | |
106 | "tmpdir/libbarhfoo.so tmpdir/libfoo.so" "" | |
107 | {main.c} "hidden" "hidden.out"} | |
108 | {"Run normal libbar.so with versioned libfoo.so" | |
109 | "tmpdir/libbarfoov.so tmpdir/libfoov.so" "" | |
110 | {main.c} "normal" "normal.out"} | |
111 | {"Run protected libbar.so with versioned libfoo.so" | |
112 | "tmpdir/libbarpfoov.so tmpdir/libfoov.so" "" | |
113 | {main.c} "protected" "normal.out"} | |
114 | {"Run hidden libbar.so with versioned libfoo.so" | |
115 | "tmpdir/libbarhfoov.so tmpdir/libfoov.so" "" | |
116 | {main.c} "hidden" "hidden.out"} | |
55255dae L |
117 | {"Run with dlopen on libdl1.so" |
118 | "--dynamic-list=dl1.list -ldl" "" | |
119 | {dl1main.c} "dl1" "dl1.out"} | |
120 | {"Run with libdl2a.so" | |
121 | "tmpdir/libdl2a.so" "" | |
122 | {dl2main.c} "dl2a" "dl2a.out"} | |
123 | {"Run with libdl2b.so" | |
124 | "tmpdir/libdl2b.so" "" | |
125 | {dl2main.c} "dl2b" "dl2b.out"} | |
d2dee3b2 L |
126 | } |
127 | ||
128 | run_cc_link_tests $build_tests | |
129 | # NetBSD ELF systems do not currently support the .*_array sections. | |
130 | run_ld_link_exec_tests [list "*-*-netbsdelf*"] $run_tests | |
55255dae L |
131 | |
132 | # Check if compiler works | |
133 | if { [which $CXX] == 0 } { | |
134 | return | |
135 | } | |
136 | ||
137 | set build_cxx_tests { | |
138 | {"Build libdl3a.so with --dynamic-list=dl3.list" | |
139 | "-shared -Wl,--dynamic-list=dl3.list" "-fPIC" | |
140 | {dl3.cc} {} "libdl3a.so" "c++"} | |
141 | {"Build libdl3b.so with -Bsymbolic" | |
142 | "-shared -Wl,-Bsymbolic" "-fPIC" | |
143 | {dl3.cc} {} "libdl3b.so" "c++"} | |
144 | {"Build libdl3a.so with --dynamic-list-cpp-typeinfo" | |
145 | "-shared -Wl,--dynamic-list-cpp-typeinfo" "-fPIC" | |
146 | {dl3.cc} {} "libdl3c.so" "c++"} | |
147 | } | |
148 | ||
149 | set run_cxx_tests { | |
150 | {"Run with libdl3a.so" | |
151 | "tmpdir/libdl3a.so" "" | |
152 | {dl3main.cc} "dl3a" "dl3a.out" "" "c++"} | |
153 | {"Run with libdl3b.so" | |
154 | "tmpdir/libdl3b.so" "" | |
155 | {dl3main.cc} "dl3b" "dl3b.out" "" "c++"} | |
156 | {"Run with libdl3c.so" | |
157 | "tmpdir/libdl3c.so" "" | |
158 | {dl3main.cc} "dl3c" "dl3a.out" "" "c++"} | |
159 | } | |
160 | ||
161 | run_cc_link_tests $build_cxx_tests | |
162 | run_ld_link_exec_tests [] $run_cxx_tests |