]>
Commit | Line | Data |
---|---|---|
5a6f7e2d ILT |
1 | # Process this file with automake to generate Makefile.in |
2 | ||
537b5f51 ILT |
3 | # As far as I can tell automake testing support assumes that the build |
4 | # system and the host system are the same. So these tests will not | |
5 | # work when building with a cross-compiler. | |
6 | ||
5a6f7e2d ILT |
7 | AUTOMAKE_OPTIONS = |
8 | ||
f958d5fc ILT |
9 | # The two_file_test tests -fmerge-constants, so we simply always turn |
10 | # it on. This may need to be controlled by a configure option | |
11 | # eventually. | |
12 | AM_CXXFLAGS = $(WARN_CXXFLAGS) $(LFS_CXXFLAGS) -fmerge-constants | |
5a6f7e2d | 13 | |
fa99aa09 | 14 | INCLUDES = \ |
5a6f7e2d ILT |
15 | -I$(srcdir) -I$(srcdir)/.. -I$(srcdir)/../../include \ |
16 | -I$(srcdir)/../../elfcpp \ | |
17 | -DLOCALEDIR="\"$(datadir)/locale\"" \ | |
18 | @INCINTL@ | |
19 | ||
fe9a4c12 ILT |
20 | if THREADS |
21 | THREADSLIB = -lpthread | |
22 | endif | |
23 | ||
351a8000 ILT |
24 | # 'make clean' is good about deleting some intermediate files (such as |
25 | # .o's), but not all of them (such as .so's and .err files). We | |
26 | # improve on that here. automake-1.9 info docs say "mostlyclean" is | |
27 | # the right choice for files 'make' builds that people rebuild. | |
28 | MOSTLYCLEANFILES = *.so | |
6eee141f | 29 | |
6eee141f | 30 | |
351a8000 ILT |
31 | # We will add to these later, for each individual test. Note |
32 | # that we add each test under check_SCRIPTS or check_PROGRAMS; | |
33 | # the TESTS variable is automatically populated from these. | |
34 | check_SCRIPTS = | |
35 | check_DATA = | |
36 | check_PROGRAMS = | |
37 | TESTS = $(check_SCRIPTS) $(check_PROGRAMS) | |
22dc1b09 | 38 | |
351a8000 ILT |
39 | # --------------------------------------------------------------------- |
40 | # These tests test the internals of gold (unittests). | |
5a6f7e2d | 41 | |
351a8000 | 42 | # Infrastucture needed for the unittests |
5a6f7e2d ILT |
43 | check_LIBRARIES = libgoldtest.a |
44 | libgoldtest_a_SOURCES = test.cc testmain.cc testfile.cc | |
45 | ||
ad2d6943 ILT |
46 | DEPENDENCIES = \ |
47 | libgoldtest.a ../libgold.a ../../libiberty/libiberty.a $(LIBINTL_DEP) | |
fe9a4c12 ILT |
48 | LDADD = libgoldtest.a ../libgold.a ../../libiberty/libiberty.a $(LIBINTL) \ |
49 | $(THREADSLIB) | |
5a6f7e2d | 50 | |
5a6f7e2d | 51 | |
351a8000 ILT |
52 | # The unittests themselves |
53 | check_PROGRAMS += object_unittest | |
5a6f7e2d | 54 | object_unittest_SOURCES = object_unittest.cc |
22dc1b09 | 55 | |
351a8000 ILT |
56 | |
57 | # --------------------------------------------------------------------- | |
58 | # These tests test the output of gold (end-to-end tests). In | |
59 | # particular, they make sure that gold can link "difficult" object | |
60 | # files, and the resulting object files run correctly. These can only | |
61 | # run if we've built ld-new for the native architecture (that is, | |
62 | # we're not cross-compiling it), since we run ld-new as part of these | |
63 | # tests. We use the gcc-specific flag '-B' to use our linker instead | |
64 | # of the default linker, which is why we only run our tests under gcc. | |
a360aedd | 65 | |
e2827e5f | 66 | if NATIVE_LINKER |
351a8000 | 67 | if GCC |
e2827e5f | 68 | |
351a8000 ILT |
69 | # Infrastucture needed for the unittests: a directory where the linker |
70 | # is named 'ld'. This is because the -B flag appends 'ld' to its arg. | |
e2827e5f ILT |
71 | gcctestdir/ld: ../ld-new |
72 | test -d gcctestdir || mkdir -p gcctestdir | |
73 | rm -f gcctestdir/ld | |
74 | (cd gcctestdir && $(LN_S) ../../ld-new ld) | |
75 | ||
351a8000 ILT |
76 | # Each of these .o's is a useful, small complete program. They're |
77 | # particularly useful for making sure ld-new's flags do what they're | |
78 | # supposed to (hence their names), but are used for many tests that | |
79 | # don't actually involve analyzing input data. | |
43771f76 ILT |
80 | flagstest_debug.o: constructor_test.cc |
81 | $(CXXCOMPILE) -O0 -g -c -o $@ $< | |
82 | flagstest_ndebug.o: constructor_test.cc | |
83 | $(CXXCOMPILE) -O0 -c -o $@ $< | |
84 | ||
43771f76 | 85 | |
351a8000 ILT |
86 | check_PROGRAMS += basic_test |
87 | check_PROGRAMS += basic_static_test | |
88 | check_PROGRAMS += basic_pic_test | |
89 | check_PROGRAMS += basic_static_pic_test | |
56ba9a23 | 90 | basic_test.o: basic_test.cc |
22dc1b09 | 91 | $(CXXCOMPILE) -O0 -c -o $@ $< |
56ba9a23 ILT |
92 | basic_test: basic_test.o gcctestdir/ld |
93 | $(CXXLINK) -Bgcctestdir/ basic_test.o | |
94 | basic_static_test: basic_test.o gcctestdir/ld | |
95 | $(CXXLINK) -Bgcctestdir/ -static basic_test.o | |
22dc1b09 | 96 | |
56ba9a23 | 97 | basic_pic_test.o: basic_test.cc |
22dc1b09 | 98 | $(CXXCOMPILE) -O0 -c -fpic -o $@ $< |
56ba9a23 ILT |
99 | basic_pic_test: basic_pic_test.o gcctestdir/ld |
100 | $(CXXLINK) -Bgcctestdir/ basic_pic_test.o | |
101 | basic_static_pic_test: basic_pic_test.o gcctestdir/ld | |
102 | $(CXXLINK) -Bgcctestdir/ -static basic_pic_test.o | |
22dc1b09 | 103 | |
351a8000 ILT |
104 | |
105 | check_PROGRAMS += constructor_test | |
106 | check_PROGRAMS += constructor_static_test | |
d5026652 ILT |
107 | constructor_test_SOURCES = constructor_test.cc |
108 | constructor_test_DEPENDENCIES = gcctestdir/ld | |
109 | constructor_test_LDFLAGS = -Bgcctestdir/ | |
110 | ||
351a8000 ILT |
111 | constructor_static_test_SOURCES = $(constructor_test_SOURCES) |
112 | constructor_static_test_DEPENDENCIES = $(constructor_test_DEPENDENCIES) | |
113 | constructor_static_test_LDFLAGS = $(constructor_test_LDFLAGS) -static | |
cb615bc1 | 114 | |
351a8000 ILT |
115 | |
116 | check_PROGRAMS += two_file_test | |
117 | check_PROGRAMS += two_file_static_test | |
118 | check_PROGRAMS += two_file_pic_test | |
3bd52c28 ILT |
119 | two_file_test_SOURCES = \ |
120 | two_file_test_1.cc \ | |
121 | two_file_test_2.cc \ | |
122 | two_file_test_main.cc \ | |
123 | two_file_test.h | |
124 | two_file_test_DEPENDENCIES = gcctestdir/ld | |
125 | two_file_test_LDFLAGS = -Bgcctestdir/ | |
126 | ||
351a8000 ILT |
127 | two_file_static_test_SOURCES = $(two_file_test_SOURCES) |
128 | two_file_static_test_DEPENDENCIES = $(two_file_test_DEPENDENCIES) | |
129 | two_file_static_test_LDFLAGS = $(two_file_test_LDFLAGS) -static | |
f958d5fc ILT |
130 | |
131 | two_file_pic_test_SOURCES = two_file_test_main.cc | |
132 | two_file_pic_test_DEPENDENCIES = \ | |
133 | gcctestdir/ld two_file_test_1_pic.o two_file_test_2_pic.o | |
134 | two_file_pic_test_LDFLAGS = -Bgcctestdir/ | |
135 | two_file_pic_test_LDADD = two_file_test_1_pic.o two_file_test_2_pic.o | |
136 | ||
351a8000 ILT |
137 | |
138 | check_PROGRAMS += two_file_shared_1_test | |
139 | check_PROGRAMS += two_file_shared_2_test | |
140 | check_PROGRAMS += two_file_shared_1_pic_2_test | |
141 | check_PROGRAMS += two_file_shared_2_pic_1_test | |
142 | check_PROGRAMS += two_file_same_shared_test | |
143 | check_PROGRAMS += two_file_separate_shared_12_test | |
144 | check_PROGRAMS += two_file_separate_shared_21_test | |
145 | two_file_test_1_pic.o: two_file_test_1.cc | |
146 | $(CXXCOMPILE) -c -fpic -o $@ $< | |
147 | two_file_test_2_pic.o: two_file_test_2.cc | |
148 | $(CXXCOMPILE) -c -fpic -o $@ $< | |
149 | two_file_shared_1.so: two_file_test_1_pic.o gcctestdir/ld | |
150 | $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1_pic.o | |
151 | two_file_shared_2.so: two_file_test_2_pic.o gcctestdir/ld | |
152 | $(CXXLINK) -Bgcctestdir/ -shared two_file_test_2_pic.o | |
153 | two_file_shared.so: two_file_test_1_pic.o two_file_test_2_pic.o gcctestdir/ld | |
154 | $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1_pic.o two_file_test_2_pic.o | |
155 | ||
3bd52c28 ILT |
156 | two_file_shared_1_test_SOURCES = two_file_test_2.cc two_file_test_main.cc |
157 | two_file_shared_1_test_DEPENDENCIES = gcctestdir/ld two_file_shared_1.so | |
158 | two_file_shared_1_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
159 | two_file_shared_1_test_LDADD = two_file_shared_1.so | |
160 | ||
161 | two_file_shared_2_test_SOURCES = two_file_test_1.cc two_file_test_main.cc | |
162 | two_file_shared_2_test_DEPENDENCIES = gcctestdir/ld two_file_shared_2.so | |
163 | two_file_shared_2_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
164 | two_file_shared_2_test_LDADD = two_file_shared_2.so | |
165 | ||
386c048c ILT |
166 | two_file_shared_1_pic_2_test_SOURCES = two_file_test_main.cc |
167 | two_file_shared_1_pic_2_test_DEPENDENCIES = \ | |
168 | gcctestdir/ld two_file_shared_1.so two_file_test_1_pic.o | |
169 | two_file_shared_1_pic_2_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
170 | two_file_shared_1_pic_2_test_LDADD = two_file_test_1_pic.o two_file_shared_2.so | |
171 | ||
172 | two_file_shared_2_pic_1_test_SOURCES = two_file_test_main.cc | |
173 | two_file_shared_2_pic_1_test_DEPENDENCIES = \ | |
174 | gcctestdir/ld two_file_shared_2.so two_file_test_2_pic.o | |
175 | two_file_shared_2_pic_1_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
176 | two_file_shared_2_pic_1_test_LDADD = two_file_test_2_pic.o two_file_shared_1.so | |
177 | ||
3bd52c28 ILT |
178 | two_file_same_shared_test_SOURCES = two_file_test_main.cc |
179 | two_file_same_shared_test_DEPENDENCIES = gcctestdir/ld two_file_shared.so | |
180 | two_file_same_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
181 | two_file_same_shared_test_LDADD = two_file_shared.so | |
182 | ||
183 | two_file_separate_shared_12_test_SOURCES = two_file_test_main.cc | |
184 | two_file_separate_shared_12_test_DEPENDENCIES = \ | |
185 | gcctestdir/ld two_file_shared_1.so two_file_shared_2.so | |
186 | two_file_separate_shared_12_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
187 | two_file_separate_shared_12_test_LDADD = \ | |
188 | two_file_shared_1.so two_file_shared_2.so | |
189 | ||
190 | two_file_separate_shared_21_test_SOURCES = two_file_test_main.cc | |
191 | two_file_separate_shared_21_test_DEPENDENCIES = \ | |
192 | gcctestdir/ld two_file_shared_1.so two_file_shared_2.so | |
193 | two_file_separate_shared_21_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
194 | two_file_separate_shared_21_test_LDADD = \ | |
195 | two_file_shared_2.so two_file_shared_1.so | |
196 | ||
63402fe4 ILT |
197 | # The nonpic tests will fail on platforms which can not put non-PIC |
198 | # code into shared libraries, so we just don't run them in that case. | |
63402fe4 | 199 | if FN_PTRS_IN_SO_WITHOUT_PIC |
3bd52c28 | 200 | |
351a8000 ILT |
201 | check_PROGRAMS += two_file_shared_1_nonpic_test |
202 | check_PROGRAMS += two_file_shared_2_nonpic_test | |
203 | check_PROGRAMS += two_file_same_shared_nonpic_test | |
204 | check_PROGRAMS += two_file_separate_shared_12_nonpic_test | |
205 | check_PROGRAMS += two_file_separate_shared_21_nonpic_test | |
206 | two_file_shared_1_nonpic.so: two_file_test_1.o gcctestdir/ld | |
207 | $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1.o | |
208 | two_file_shared_2_nonpic.so: two_file_test_2.o gcctestdir/ld | |
209 | $(CXXLINK) -Bgcctestdir/ -shared two_file_test_2.o | |
210 | two_file_shared_nonpic.so: two_file_test_1.o two_file_test_2.o gcctestdir/ld | |
211 | $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1.o two_file_test_2.o | |
212 | ||
3bd52c28 ILT |
213 | two_file_shared_1_nonpic_test_SOURCES = \ |
214 | two_file_test_2.cc two_file_test_main.cc | |
215 | two_file_shared_1_nonpic_test_DEPENDENCIES = \ | |
216 | gcctestdir/ld two_file_shared_1_nonpic.so | |
217 | two_file_shared_1_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
218 | two_file_shared_1_nonpic_test_LDADD = two_file_shared_1_nonpic.so | |
219 | ||
220 | two_file_shared_2_nonpic_test_SOURCES = \ | |
221 | two_file_test_1.cc two_file_test_main.cc | |
222 | two_file_shared_2_nonpic_test_DEPENDENCIES = \ | |
223 | gcctestdir/ld two_file_shared_2_nonpic.so | |
224 | two_file_shared_2_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
225 | two_file_shared_2_nonpic_test_LDADD = two_file_shared_2_nonpic.so | |
226 | ||
227 | two_file_same_shared_nonpic_test_SOURCES = two_file_test_main.cc | |
228 | two_file_same_shared_nonpic_test_DEPENDENCIES = \ | |
229 | gcctestdir/ld two_file_shared_nonpic.so | |
230 | two_file_same_shared_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
231 | two_file_same_shared_nonpic_test_LDADD = two_file_shared_nonpic.so | |
232 | ||
233 | two_file_separate_shared_12_nonpic_test_SOURCES = two_file_test_main.cc | |
234 | two_file_separate_shared_12_nonpic_test_DEPENDENCIES = \ | |
235 | gcctestdir/ld two_file_shared_1_nonpic.so two_file_shared_2_nonpic.so | |
236 | two_file_separate_shared_12_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
237 | two_file_separate_shared_12_nonpic_test_LDADD = \ | |
238 | two_file_shared_1_nonpic.so two_file_shared_2_nonpic.so | |
239 | ||
240 | two_file_separate_shared_21_nonpic_test_SOURCES = two_file_test_main.cc | |
241 | two_file_separate_shared_21_nonpic_test_DEPENDENCIES = \ | |
242 | gcctestdir/ld two_file_shared_1_nonpic.so two_file_shared_2_nonpic.so | |
243 | two_file_separate_shared_21_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
244 | two_file_separate_shared_21_nonpic_test_LDADD = \ | |
245 | two_file_shared_2_nonpic.so two_file_shared_1_nonpic.so | |
246 | ||
351a8000 | 247 | endif FN_PTRS_IN_SO_WITHOUT_PIC |
3bd52c28 | 248 | |
351a8000 ILT |
249 | |
250 | check_PROGRAMS += exception_test | |
251 | check_PROGRAMS += exception_static_test | |
252 | check_PROGRAMS += exception_shared_1_test | |
253 | check_PROGRAMS += exception_shared_2_test | |
254 | check_PROGRAMS += exception_same_shared_test | |
255 | check_PROGRAMS += exception_separate_shared_12_test | |
256 | check_PROGRAMS += exception_separate_shared_21_test | |
257 | exception_test_1_pic.o: exception_test_1.cc | |
258 | $(CXXCOMPILE) -c -fpic -o $@ $< | |
259 | exception_test_2_pic.o: exception_test_2.cc | |
260 | $(CXXCOMPILE) -c -fpic -o $@ $< | |
261 | exception_shared_1.so: exception_test_1_pic.o gcctestdir/ld | |
262 | $(CXXLINK) -Bgcctestdir/ -shared exception_test_1_pic.o | |
263 | exception_shared_2.so: exception_test_2_pic.o gcctestdir/ld | |
264 | $(CXXLINK) -Bgcctestdir/ -shared exception_test_2_pic.o | |
265 | exception_shared.so: exception_test_1_pic.o exception_test_2_pic.o gcctestdir/ld | |
266 | $(CXXLINK) -Bgcctestdir/ -shared exception_test_1_pic.o exception_test_2_pic.o | |
63402fe4 | 267 | |
3151305a ILT |
268 | exception_test_SOURCES = \ |
269 | exception_test_main.cc \ | |
270 | exception_test_1.cc \ | |
271 | exception_test_2.cc \ | |
272 | exception_test.h | |
273 | exception_test_DEPENDENCIES = gcctestdir/ld | |
274 | exception_test_LDFLAGS = -Bgcctestdir/ | |
275 | ||
351a8000 ILT |
276 | exception_static_test_SOURCES = $(exception_test_SOURCES) |
277 | exception_static_test_DEPENDENCIES = $(exception_test_DEPENDENCIES) | |
278 | exception_static_test_LDFLAGS = $(exception_test_LDFLAGS) -static | |
3151305a ILT |
279 | |
280 | exception_shared_1_test_SOURCES = exception_test_2.cc exception_test_main.cc | |
281 | exception_shared_1_test_DEPENDENCIES = gcctestdir/ld exception_shared_1.so | |
282 | exception_shared_1_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
283 | exception_shared_1_test_LDADD = exception_shared_1.so | |
284 | ||
285 | exception_shared_2_test_SOURCES = exception_test_1.cc exception_test_main.cc | |
286 | exception_shared_2_test_DEPENDENCIES = gcctestdir/ld exception_shared_2.so | |
287 | exception_shared_2_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
288 | exception_shared_2_test_LDADD = exception_shared_2.so | |
289 | ||
290 | exception_same_shared_test_SOURCES = exception_test_main.cc | |
291 | exception_same_shared_test_DEPENDENCIES = gcctestdir/ld exception_shared.so | |
292 | exception_same_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
293 | exception_same_shared_test_LDADD = exception_shared.so | |
294 | ||
295 | exception_separate_shared_12_test_SOURCES = exception_test_main.cc | |
296 | exception_separate_shared_12_test_DEPENDENCIES = \ | |
297 | gcctestdir/ld exception_shared_1.so exception_shared_2.so | |
298 | exception_separate_shared_12_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
299 | exception_separate_shared_12_test_LDADD = \ | |
300 | exception_shared_1.so exception_shared_2.so | |
301 | ||
302 | exception_separate_shared_21_test_SOURCES = exception_test_main.cc | |
303 | exception_separate_shared_21_test_DEPENDENCIES = \ | |
304 | gcctestdir/ld exception_shared_1.so exception_shared_2.so | |
305 | exception_separate_shared_21_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
306 | exception_separate_shared_21_test_LDADD = \ | |
307 | exception_shared_2.so exception_shared_1.so | |
308 | ||
3151305a | 309 | |
351a8000 | 310 | check_PROGRAMS += weak_test |
a360aedd ILT |
311 | weak_test_SOURCES = weak_test.cc |
312 | weak_test_LDFLAGS = -Bgcctestdir/ | |
313 | ||
351a8000 | 314 | |
6eee141f ILT |
315 | if TLS |
316 | ||
351a8000 ILT |
317 | check_PROGRAMS += tls_test |
318 | check_PROGRAMS += tls_pic_test | |
319 | check_PROGRAMS += tls_shared_test | |
320 | tls_test_pic.o: tls_test.cc | |
321 | $(CXXCOMPILE) -c -fpic -o $@ $< | |
322 | tls_test_file2_pic.o: tls_test_file2.cc | |
323 | $(CXXCOMPILE) -c -fpic -o $@ $< | |
324 | tls_test_shared.so: tls_test_pic.o tls_test_file2_pic.o gcctestdir/ld | |
325 | $(CXXLINK) -Bgcctestdir/ -shared tls_test_pic.o tls_test_file2_pic.o | |
326 | ||
e0374858 | 327 | tls_test_SOURCES = tls_test.cc tls_test_file2.cc tls_test_main.cc tls_test.h |
6eee141f ILT |
328 | tls_test_DEPENDENCIES = gcctestdir/ld |
329 | tls_test_LDFLAGS = -Bgcctestdir/ | |
330 | tls_test_LDADD = -lpthread | |
331 | ||
332 | tls_pic_test_SOURCES = tls_test_main.cc | |
e0374858 | 333 | tls_pic_test_DEPENDENCIES = gcctestdir/ld tls_test_pic.o tls_test_file2_pic.o |
6eee141f | 334 | tls_pic_test_LDFLAGS = -Bgcctestdir/ |
e0374858 | 335 | tls_pic_test_LDADD = tls_test_pic.o tls_test_file2_pic.o -lpthread |
6eee141f | 336 | |
6eee141f ILT |
337 | tls_shared_test_SOURCES = tls_test_main.cc |
338 | tls_shared_test_DEPENDENCIES = gcctestdir/ld tls_test_shared.so | |
339 | tls_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
340 | tls_shared_test_LDADD = tls_test_shared.so -lpthread | |
341 | ||
351a8000 ILT |
342 | if STATIC_TLS |
343 | check_PROGRAMS += tls_static_test | |
344 | check_PROGRAMS += tls_static_pic_test | |
345 | ||
346 | tls_static_test_SOURCES = $(tls_test_SOURCES) | |
347 | tls_static_test_DEPENDENCIES = $(tls_test_DEPENDENCIES) | |
348 | tls_static_test_LDFLAGS = $(tls_test_LDFLAGS) -static | |
349 | tls_static_test_LDADD = $(tls_test_LDADD) | |
350 | ||
351 | tls_static_pic_test_SOURCES = $(tls_pic_test_SOURCES) | |
352 | tls_static_pic_test_DEPENDENCIES = $(tls_pic_test_DEPENDENCIES) | |
353 | tls_static_pic_test_LDFLAGS = $(tls_pic_test_LDFLAGS) -static | |
354 | tls_static_pic_test_LDADD = $(tls_pic_test_LDADD) | |
355 | endif | |
6eee141f ILT |
356 | |
357 | if FN_PTRS_IN_SO_WITHOUT_PIC | |
351a8000 ILT |
358 | check_PROGRAMS += tls_shared_nonpic_test |
359 | tls_test_shared_nonpic.so: tls_test.o tls_test_file2.o gcctestdir/ld | |
360 | $(CXXLINK) -Bgcctestdir/ -shared tls_test.o tls_test_file2.o | |
6eee141f ILT |
361 | |
362 | tls_shared_nonpic_test_SOURCES = tls_test_main.cc | |
363 | tls_shared_nonpic_test_DEPENDENCIES = gcctestdir/ld tls_test_shared_nonpic.so | |
364 | tls_shared_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
365 | tls_shared_nonpic_test_LDADD = tls_test_shared_nonpic.so -lpthread | |
351a8000 | 366 | endif FN_PTRS_IN_SO_WITHOUT_PIC |
6eee141f | 367 | |
351a8000 | 368 | endif TLS |
6eee141f | 369 | |
6eee141f | 370 | |
351a8000 ILT |
371 | # Test --detect-odr-violations |
372 | check_SCRIPTS += debug_msg.sh | |
6eee141f | 373 | |
351a8000 ILT |
374 | # Create the data files that debug_msg.sh analyzes. |
375 | check_DATA += debug_msg.err | |
376 | MOSTLYCLEANFILES += debug_msg.err | |
377 | debug_msg.o: debug_msg.cc | |
378 | $(CXXCOMPILE) -O0 -g -c -w -o $@ $(srcdir)/debug_msg.cc | |
379 | odr_violation1.o: odr_violation1.cc | |
380 | $(CXXCOMPILE) -O0 -g -c -w -o $@ $(srcdir)/odr_violation1.cc | |
381 | odr_violation2.o: odr_violation2.cc | |
382 | $(CXXCOMPILE) -O0 -g -c -w -o $@ $(srcdir)/odr_violation2.cc | |
383 | debug_msg.err: debug_msg.o odr_violation1.o odr_violation2.o gcctestdir/ld | |
384 | @echo $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg debug_msg.o odr_violation1.o odr_violation2.o "2>$@" | |
385 | @if $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg debug_msg.o odr_violation1.o odr_violation2.o 2>$@; \ | |
386 | then \ | |
387 | echo 1>&2 "Link of debug_msg should have failed"; \ | |
388 | rm -f $@; \ | |
389 | exit 1; \ | |
390 | fi | |
391 | ||
392 | # See if we can also detect problems when we're linking .so's, not .o's. | |
393 | check_DATA += debug_msg_so.err | |
394 | MOSTLYCLEANFILES += debug_msg_so.err | |
395 | debug_msg.so: debug_msg.cc gcctestdir/ld | |
396 | $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -shared -fPIC -w -o $@ $(srcdir)/debug_msg.cc | |
397 | odr_violation1.so: odr_violation1.cc gcctestdir/ld | |
398 | $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -shared -fPIC -w -o $@ $(srcdir)/odr_violation1.cc | |
399 | odr_violation2.so: odr_violation2.cc gcctestdir/ld | |
400 | $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -shared -fPIC -w -o $@ $(srcdir)/odr_violation2.cc | |
401 | debug_msg_so.err: debug_msg.so odr_violation1.so odr_violation2.so gcctestdir/ld | |
402 | @echo $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_so debug_msg.so odr_violation1.so odr_violation2.so "2>$@" | |
403 | @if $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_so debug_msg.so odr_violation1.so odr_violation2.so 2>$@; \ | |
404 | then \ | |
405 | echo 1>&2 "Link of debug_msg_so should have failed"; \ | |
406 | rm -f $@; \ | |
407 | exit 1; \ | |
408 | fi | |
409 | ||
410 | # We also want to make sure we do something reasonable when there's no | |
411 | # debug info available. For the best test, we use .so's. | |
412 | check_DATA += debug_msg_ndebug.err | |
413 | MOSTLYCLEANFILES += debug_msg_ndebug.err | |
414 | debug_msg_ndebug.so: debug_msg.cc gcctestdir/ld | |
415 | $(CXXCOMPILE) -Bgcctestdir/ -O0 -g0 -shared -fPIC -w -o $@ $(srcdir)/debug_msg.cc | |
416 | odr_violation1_ndebug.so: odr_violation1.cc gcctestdir/ld | |
417 | $(CXXCOMPILE) -Bgcctestdir/ -O0 -g0 -shared -fPIC -w -o $@ $(srcdir)/odr_violation1.cc | |
418 | odr_violation2_ndebug.so: odr_violation2.cc gcctestdir/ld | |
419 | $(CXXCOMPILE) -Bgcctestdir/ -O0 -g0 -shared -fPIC -w -o $@ $(srcdir)/odr_violation2.cc | |
420 | debug_msg_ndebug.err: debug_msg_ndebug.so odr_violation1_ndebug.so odr_violation2_ndebug.so gcctestdir/ld | |
421 | @echo $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_ndebug debug_msg_ndebug.so odr_violation1_ndebug.so odr_violation2_ndebug.so "2>$@" | |
422 | @if $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_ndebug debug_msg_ndebug.so odr_violation1_ndebug.so odr_violation2_ndebug.so 2>$@; \ | |
423 | then \ | |
424 | echo 1>&2 "Link of debug_msg_ndebug should have failed"; \ | |
425 | rm -f $@; \ | |
426 | exit 1; \ | |
427 | fi | |
428 | ||
429 | ||
430 | # Similar to --detect-odr-violations: check for undefined symbols in .so's | |
431 | check_SCRIPTS += undef_symbol.sh | |
432 | check_DATA += undef_symbol.err | |
433 | MOSTLYCLEANFILES += undef_symbol.err | |
434 | undef_symbol.o: undef_symbol.cc | |
435 | $(CXXCOMPILE) -O0 -g -c -fPIC $< | |
436 | undef_symbol.so: undef_symbol.o gcctestdir/ld | |
437 | $(CXXLINK) -Bgcctestdir/ -shared undef_symbol.o | |
438 | undef_symbol.err: undef_symbol_main.o undef_symbol.so gcctestdir/ld | |
439 | @echo $(CXXLINK) -Bgcctestdir/ -o undef_symbol_test undef_symbol_main.o undef_symbol.so "2>$@" | |
440 | @if $(CXXLINK) -Bgcctestdir/ -o undef_symbol_test undef_symbol_main.o undef_symbol.so 2>$@; \ | |
441 | then \ | |
442 | echo 1>&2 "Link of undef_symbol_test should have failed"; \ | |
443 | rm -f $@; \ | |
444 | exit 1; \ | |
445 | fi | |
446 | ||
447 | ||
448 | # Test --compress-debug-sections. FIXME: check we actually compress. | |
449 | check_PROGRAMS += flagstest_compress_debug_sections | |
450 | flagstest_compress_debug_sections: flagstest_debug.o | |
451 | $(CXXLINK) -Bgcctestdir/ -o $@ $< --compress-debug-sections=zlib | |
452 | test -s $@ | |
453 | ||
454 | ||
455 | # Test -o when emitting to a special file (such as something in /dev). | |
456 | check_PROGRAMS += flagstest_o_specialfile | |
457 | flagstest_o_specialfile: flagstest_debug.o | |
458 | $(CXXLINK) -Bgcctestdir/ -o /dev/stdout $< 2>&1 | cat > $@ | |
459 | chmod a+x $@ | |
460 | test -s $@ | |
461 | ||
462 | # The specialfile output has a tricky case when we also compress debug | |
463 | # sections, because it requires output-file resizing. | |
464 | check_PROGRAMS += flagstest_o_specialfile_and_compress_debug_sections | |
465 | flagstest_o_specialfile_and_compress_debug_sections: flagstest_debug.o | |
466 | $(CXXLINK) -Bgcctestdir/ -o /dev/stdout $< --compress-debug-sections=zlib 2>&1 | cat > $@ | |
467 | chmod a+x $@ | |
468 | test -s $@ | |
469 | ||
470 | ||
471 | endif GCC | |
472 | endif NATIVE_LINKER |