]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gold/testsuite/Makefile.am
* configure.ac: Export new conditional variable HAVE_ZLIB.
[thirdparty/binutils-gdb.git] / gold / testsuite / Makefile.am
CommitLineData
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
7AUTOMAKE_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.
494e05f4 12AM_CXXFLAGS = $(WARN_CXXFLAGS) $(LFS_CFLAGS) -fmerge-constants
5a6f7e2d 13
fa99aa09 14INCLUDES = \
5a6f7e2d
ILT
15 -I$(srcdir) -I$(srcdir)/.. -I$(srcdir)/../../include \
16 -I$(srcdir)/../../elfcpp \
17 -DLOCALEDIR="\"$(datadir)/locale\"" \
18 @INCINTL@
19
6835af53
ILT
20TEST_READELF = $(top_builddir)/../binutils/readelf
21TEST_OBJDUMP = $(top_builddir)/../binutils/objdump
22TEST_CXXFILT = $(top_builddir)/../binutils/cxxfilt
23TEST_STRIP = $(top_builddir)/../binutils/strip-new
24
fe9a4c12
ILT
25if THREADS
26THREADSLIB = -lpthread
27endif
28
351a8000
ILT
29# 'make clean' is good about deleting some intermediate files (such as
30# .o's), but not all of them (such as .so's and .err files). We
31# improve on that here. automake-1.9 info docs say "mostlyclean" is
32# the right choice for files 'make' builds that people rebuild.
33MOSTLYCLEANFILES = *.so
6eee141f 34
6eee141f 35
351a8000
ILT
36# We will add to these later, for each individual test. Note
37# that we add each test under check_SCRIPTS or check_PROGRAMS;
38# the TESTS variable is automatically populated from these.
39check_SCRIPTS =
40check_DATA =
41check_PROGRAMS =
42TESTS = $(check_SCRIPTS) $(check_PROGRAMS)
22dc1b09 43
351a8000
ILT
44# ---------------------------------------------------------------------
45# These tests test the internals of gold (unittests).
5a6f7e2d 46
351a8000 47# Infrastucture needed for the unittests
5a6f7e2d
ILT
48check_LIBRARIES = libgoldtest.a
49libgoldtest_a_SOURCES = test.cc testmain.cc testfile.cc
50
ad2d6943
ILT
51DEPENDENCIES = \
52 libgoldtest.a ../libgold.a ../../libiberty/libiberty.a $(LIBINTL_DEP)
fe9a4c12
ILT
53LDADD = libgoldtest.a ../libgold.a ../../libiberty/libiberty.a $(LIBINTL) \
54 $(THREADSLIB)
5a6f7e2d 55
5a6f7e2d 56
351a8000
ILT
57# The unittests themselves
58check_PROGRAMS += object_unittest
5a6f7e2d 59object_unittest_SOURCES = object_unittest.cc
22dc1b09 60
bc644c6c
ILT
61check_PROGRAMS += binary_unittest
62binary_unittest_SOURCES = binary_unittest.cc
63
351a8000
ILT
64
65# ---------------------------------------------------------------------
66# These tests test the output of gold (end-to-end tests). In
67# particular, they make sure that gold can link "difficult" object
68# files, and the resulting object files run correctly. These can only
69# run if we've built ld-new for the native architecture (that is,
70# we're not cross-compiling it), since we run ld-new as part of these
71# tests. We use the gcc-specific flag '-B' to use our linker instead
72# of the default linker, which is why we only run our tests under gcc.
a360aedd 73
e2827e5f 74if NATIVE_LINKER
351a8000 75if GCC
e2827e5f 76
351a8000
ILT
77# Infrastucture needed for the unittests: a directory where the linker
78# is named 'ld'. This is because the -B flag appends 'ld' to its arg.
e2827e5f
ILT
79gcctestdir/ld: ../ld-new
80 test -d gcctestdir || mkdir -p gcctestdir
81 rm -f gcctestdir/ld
82 (cd gcctestdir && $(LN_S) ../../ld-new ld)
83
351a8000
ILT
84# Each of these .o's is a useful, small complete program. They're
85# particularly useful for making sure ld-new's flags do what they're
86# supposed to (hence their names), but are used for many tests that
87# don't actually involve analyzing input data.
43771f76
ILT
88flagstest_debug.o: constructor_test.cc
89 $(CXXCOMPILE) -O0 -g -c -o $@ $<
90flagstest_ndebug.o: constructor_test.cc
91 $(CXXCOMPILE) -O0 -c -o $@ $<
92
43771f76 93
351a8000
ILT
94check_PROGRAMS += basic_test
95check_PROGRAMS += basic_static_test
96check_PROGRAMS += basic_pic_test
97check_PROGRAMS += basic_static_pic_test
56ba9a23 98basic_test.o: basic_test.cc
22dc1b09 99 $(CXXCOMPILE) -O0 -c -o $@ $<
56ba9a23
ILT
100basic_test: basic_test.o gcctestdir/ld
101 $(CXXLINK) -Bgcctestdir/ basic_test.o
102basic_static_test: basic_test.o gcctestdir/ld
103 $(CXXLINK) -Bgcctestdir/ -static basic_test.o
22dc1b09 104
56ba9a23 105basic_pic_test.o: basic_test.cc
22dc1b09 106 $(CXXCOMPILE) -O0 -c -fpic -o $@ $<
56ba9a23
ILT
107basic_pic_test: basic_pic_test.o gcctestdir/ld
108 $(CXXLINK) -Bgcctestdir/ basic_pic_test.o
109basic_static_pic_test: basic_pic_test.o gcctestdir/ld
110 $(CXXLINK) -Bgcctestdir/ -static basic_pic_test.o
22dc1b09 111
351a8000
ILT
112
113check_PROGRAMS += constructor_test
114check_PROGRAMS += constructor_static_test
d5026652
ILT
115constructor_test_SOURCES = constructor_test.cc
116constructor_test_DEPENDENCIES = gcctestdir/ld
117constructor_test_LDFLAGS = -Bgcctestdir/
118
351a8000
ILT
119constructor_static_test_SOURCES = $(constructor_test_SOURCES)
120constructor_static_test_DEPENDENCIES = $(constructor_test_DEPENDENCIES)
121constructor_static_test_LDFLAGS = $(constructor_test_LDFLAGS) -static
cb615bc1 122
351a8000
ILT
123
124check_PROGRAMS += two_file_test
125check_PROGRAMS += two_file_static_test
126check_PROGRAMS += two_file_pic_test
3bd52c28
ILT
127two_file_test_SOURCES = \
128 two_file_test_1.cc \
03e8f2b2 129 two_file_test_1b.cc \
3bd52c28
ILT
130 two_file_test_2.cc \
131 two_file_test_main.cc \
132 two_file_test.h
133two_file_test_DEPENDENCIES = gcctestdir/ld
134two_file_test_LDFLAGS = -Bgcctestdir/
135
351a8000
ILT
136two_file_static_test_SOURCES = $(two_file_test_SOURCES)
137two_file_static_test_DEPENDENCIES = $(two_file_test_DEPENDENCIES)
138two_file_static_test_LDFLAGS = $(two_file_test_LDFLAGS) -static
f958d5fc
ILT
139
140two_file_pic_test_SOURCES = two_file_test_main.cc
141two_file_pic_test_DEPENDENCIES = \
03e8f2b2 142 gcctestdir/ld two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o
f958d5fc 143two_file_pic_test_LDFLAGS = -Bgcctestdir/
03e8f2b2 144two_file_pic_test_LDADD = two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o
f958d5fc 145
351a8000
ILT
146
147check_PROGRAMS += two_file_shared_1_test
148check_PROGRAMS += two_file_shared_2_test
149check_PROGRAMS += two_file_shared_1_pic_2_test
150check_PROGRAMS += two_file_shared_2_pic_1_test
151check_PROGRAMS += two_file_same_shared_test
152check_PROGRAMS += two_file_separate_shared_12_test
153check_PROGRAMS += two_file_separate_shared_21_test
154two_file_test_1_pic.o: two_file_test_1.cc
155 $(CXXCOMPILE) -c -fpic -o $@ $<
03e8f2b2
ILT
156two_file_test_1b_pic.o: two_file_test_1b.cc
157 $(CXXCOMPILE) -c -fpic -o $@ $<
351a8000
ILT
158two_file_test_2_pic.o: two_file_test_2.cc
159 $(CXXCOMPILE) -c -fpic -o $@ $<
03e8f2b2
ILT
160two_file_shared_1.so: two_file_test_1_pic.o two_file_test_1b_pic.o gcctestdir/ld
161 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1_pic.o two_file_test_1b_pic.o
351a8000
ILT
162two_file_shared_2.so: two_file_test_2_pic.o gcctestdir/ld
163 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_2_pic.o
03e8f2b2
ILT
164two_file_shared.so: two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o gcctestdir/ld
165 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o
351a8000 166
3bd52c28
ILT
167two_file_shared_1_test_SOURCES = two_file_test_2.cc two_file_test_main.cc
168two_file_shared_1_test_DEPENDENCIES = gcctestdir/ld two_file_shared_1.so
169two_file_shared_1_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
170two_file_shared_1_test_LDADD = two_file_shared_1.so
171
03e8f2b2 172two_file_shared_2_test_SOURCES = two_file_test_1.cc two_file_test_1b.cc two_file_test_main.cc
3bd52c28
ILT
173two_file_shared_2_test_DEPENDENCIES = gcctestdir/ld two_file_shared_2.so
174two_file_shared_2_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
175two_file_shared_2_test_LDADD = two_file_shared_2.so
176
386c048c
ILT
177two_file_shared_1_pic_2_test_SOURCES = two_file_test_main.cc
178two_file_shared_1_pic_2_test_DEPENDENCIES = \
03e8f2b2 179 gcctestdir/ld two_file_shared_1.so two_file_test_1_pic.o two_file_test_1b_pic.o
386c048c 180two_file_shared_1_pic_2_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
03e8f2b2 181two_file_shared_1_pic_2_test_LDADD = two_file_test_1_pic.o two_file_test_1b_pic.o two_file_shared_2.so
386c048c
ILT
182
183two_file_shared_2_pic_1_test_SOURCES = two_file_test_main.cc
184two_file_shared_2_pic_1_test_DEPENDENCIES = \
185 gcctestdir/ld two_file_shared_2.so two_file_test_2_pic.o
186two_file_shared_2_pic_1_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
187two_file_shared_2_pic_1_test_LDADD = two_file_test_2_pic.o two_file_shared_1.so
188
3bd52c28
ILT
189two_file_same_shared_test_SOURCES = two_file_test_main.cc
190two_file_same_shared_test_DEPENDENCIES = gcctestdir/ld two_file_shared.so
191two_file_same_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
192two_file_same_shared_test_LDADD = two_file_shared.so
193
194two_file_separate_shared_12_test_SOURCES = two_file_test_main.cc
195two_file_separate_shared_12_test_DEPENDENCIES = \
196 gcctestdir/ld two_file_shared_1.so two_file_shared_2.so
197two_file_separate_shared_12_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
198two_file_separate_shared_12_test_LDADD = \
199 two_file_shared_1.so two_file_shared_2.so
200
201two_file_separate_shared_21_test_SOURCES = two_file_test_main.cc
202two_file_separate_shared_21_test_DEPENDENCIES = \
203 gcctestdir/ld two_file_shared_1.so two_file_shared_2.so
204two_file_separate_shared_21_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
205two_file_separate_shared_21_test_LDADD = \
206 two_file_shared_2.so two_file_shared_1.so
207
6a74a719
ILT
208check_PROGRAMS += two_file_relocatable_test
209two_file_relocatable_test_SOURCES = two_file_test_main.cc
210two_file_relocatable_test_DEPENDENCIES = \
211 gcctestdir/ld two_file_relocatable.o
212two_file_relocatable_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
213two_file_relocatable_test_LDADD = two_file_relocatable.o
214two_file_relocatable.o: gcctestdir/ld two_file_test_1.o two_file_test_1b.o two_file_test_2.o
215 gcctestdir/ld -r -o $@ two_file_test_1.o two_file_test_1b.o two_file_test_2.o
216
63402fe4
ILT
217# The nonpic tests will fail on platforms which can not put non-PIC
218# code into shared libraries, so we just don't run them in that case.
63402fe4 219if FN_PTRS_IN_SO_WITHOUT_PIC
3bd52c28 220
351a8000
ILT
221check_PROGRAMS += two_file_shared_1_nonpic_test
222check_PROGRAMS += two_file_shared_2_nonpic_test
223check_PROGRAMS += two_file_same_shared_nonpic_test
224check_PROGRAMS += two_file_separate_shared_12_nonpic_test
225check_PROGRAMS += two_file_separate_shared_21_nonpic_test
03e8f2b2
ILT
226check_PROGRAMS += two_file_mixed_shared_test
227check_PROGRAMS += two_file_mixed_2_shared_test
351a8000 228two_file_shared_1_nonpic.so: two_file_test_1.o gcctestdir/ld
03e8f2b2 229 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1.o two_file_test_1b.o
351a8000
ILT
230two_file_shared_2_nonpic.so: two_file_test_2.o gcctestdir/ld
231 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_2.o
03e8f2b2
ILT
232two_file_shared_nonpic.so: two_file_test_1.o two_file_test_1b.o two_file_test_2.o gcctestdir/ld
233 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1.o two_file_test_1b.o two_file_test_2.o
234two_file_shared_mixed.so: two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2.o gcctestdir/ld
235 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2.o
236two_file_shared_mixed_1.so: two_file_test_1.o two_file_test_1b_pic.o two_file_shared_2.so gcctestdir/ld
237 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1.o two_file_test_1b_pic.o two_file_shared_2.so
351a8000 238
3bd52c28
ILT
239two_file_shared_1_nonpic_test_SOURCES = \
240 two_file_test_2.cc two_file_test_main.cc
241two_file_shared_1_nonpic_test_DEPENDENCIES = \
242 gcctestdir/ld two_file_shared_1_nonpic.so
243two_file_shared_1_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
244two_file_shared_1_nonpic_test_LDADD = two_file_shared_1_nonpic.so
245
246two_file_shared_2_nonpic_test_SOURCES = \
03e8f2b2 247 two_file_test_1.cc two_file_test_1b.cc two_file_test_main.cc
3bd52c28
ILT
248two_file_shared_2_nonpic_test_DEPENDENCIES = \
249 gcctestdir/ld two_file_shared_2_nonpic.so
250two_file_shared_2_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
251two_file_shared_2_nonpic_test_LDADD = two_file_shared_2_nonpic.so
252
253two_file_same_shared_nonpic_test_SOURCES = two_file_test_main.cc
254two_file_same_shared_nonpic_test_DEPENDENCIES = \
255 gcctestdir/ld two_file_shared_nonpic.so
256two_file_same_shared_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
257two_file_same_shared_nonpic_test_LDADD = two_file_shared_nonpic.so
258
259two_file_separate_shared_12_nonpic_test_SOURCES = two_file_test_main.cc
260two_file_separate_shared_12_nonpic_test_DEPENDENCIES = \
261 gcctestdir/ld two_file_shared_1_nonpic.so two_file_shared_2_nonpic.so
262two_file_separate_shared_12_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
263two_file_separate_shared_12_nonpic_test_LDADD = \
264 two_file_shared_1_nonpic.so two_file_shared_2_nonpic.so
265
266two_file_separate_shared_21_nonpic_test_SOURCES = two_file_test_main.cc
267two_file_separate_shared_21_nonpic_test_DEPENDENCIES = \
268 gcctestdir/ld two_file_shared_1_nonpic.so two_file_shared_2_nonpic.so
269two_file_separate_shared_21_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
270two_file_separate_shared_21_nonpic_test_LDADD = \
271 two_file_shared_2_nonpic.so two_file_shared_1_nonpic.so
272
03e8f2b2
ILT
273two_file_mixed_shared_test_SOURCES = two_file_test_main.cc
274two_file_mixed_shared_test_DEPENDENCIES = gcctestdir/ld two_file_shared_mixed.so
275two_file_mixed_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
276two_file_mixed_shared_test_LDADD = two_file_shared_mixed.so
277
278two_file_mixed_2_shared_test_SOURCES = two_file_test_main.cc
279two_file_mixed_2_shared_test_DEPENDENCIES = gcctestdir/ld two_file_shared_mixed_1.so two_file_shared_2.so
280two_file_mixed_2_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
281two_file_mixed_2_shared_test_LDADD = two_file_shared_mixed_1.so two_file_shared_2.so
282
351a8000 283endif FN_PTRS_IN_SO_WITHOUT_PIC
3bd52c28 284
6835af53
ILT
285check_PROGRAMS += two_file_strip_test
286two_file_strip_test: two_file_test
287 $(TEST_STRIP) -o two_file_strip_test two_file_test
288
289check_PROGRAMS += two_file_same_shared_strip_test
290two_file_same_shared_strip_test_SOURCES = two_file_test_main.cc
291two_file_same_shared_strip_test_DEPENDENCIES = \
292 gcctestdir/ld two_file_shared_strip.so
293two_file_same_shared_strip_test_LDFLAGS = -Bgcctestdir/ -Wl,-R.
294two_file_same_shared_strip_test_LDADD = two_file_shared_strip.so
295two_file_shared_strip.so: two_file_shared.so
296 $(TEST_STRIP) -S -o two_file_shared_strip.so two_file_shared.so
297
49bdd526
ILT
298check_PROGRAMS += common_test_1
299common_test_1_SOURCES = common_test_1.c
300common_test_1_DEPENDENCIES = gcctestdir/ld
301common_test_1_LDFLAGS = -Bgcctestdir/
351a8000
ILT
302
303check_PROGRAMS += exception_test
304check_PROGRAMS += exception_static_test
305check_PROGRAMS += exception_shared_1_test
306check_PROGRAMS += exception_shared_2_test
307check_PROGRAMS += exception_same_shared_test
308check_PROGRAMS += exception_separate_shared_12_test
309check_PROGRAMS += exception_separate_shared_21_test
310exception_test_1_pic.o: exception_test_1.cc
311 $(CXXCOMPILE) -c -fpic -o $@ $<
312exception_test_2_pic.o: exception_test_2.cc
313 $(CXXCOMPILE) -c -fpic -o $@ $<
314exception_shared_1.so: exception_test_1_pic.o gcctestdir/ld
315 $(CXXLINK) -Bgcctestdir/ -shared exception_test_1_pic.o
316exception_shared_2.so: exception_test_2_pic.o gcctestdir/ld
317 $(CXXLINK) -Bgcctestdir/ -shared exception_test_2_pic.o
318exception_shared.so: exception_test_1_pic.o exception_test_2_pic.o gcctestdir/ld
319 $(CXXLINK) -Bgcctestdir/ -shared exception_test_1_pic.o exception_test_2_pic.o
63402fe4 320
3151305a
ILT
321exception_test_SOURCES = \
322 exception_test_main.cc \
323 exception_test_1.cc \
324 exception_test_2.cc \
325 exception_test.h
326exception_test_DEPENDENCIES = gcctestdir/ld
327exception_test_LDFLAGS = -Bgcctestdir/
328
351a8000
ILT
329exception_static_test_SOURCES = $(exception_test_SOURCES)
330exception_static_test_DEPENDENCIES = $(exception_test_DEPENDENCIES)
331exception_static_test_LDFLAGS = $(exception_test_LDFLAGS) -static
3151305a
ILT
332
333exception_shared_1_test_SOURCES = exception_test_2.cc exception_test_main.cc
334exception_shared_1_test_DEPENDENCIES = gcctestdir/ld exception_shared_1.so
335exception_shared_1_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
336exception_shared_1_test_LDADD = exception_shared_1.so
337
338exception_shared_2_test_SOURCES = exception_test_1.cc exception_test_main.cc
339exception_shared_2_test_DEPENDENCIES = gcctestdir/ld exception_shared_2.so
340exception_shared_2_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
341exception_shared_2_test_LDADD = exception_shared_2.so
342
343exception_same_shared_test_SOURCES = exception_test_main.cc
344exception_same_shared_test_DEPENDENCIES = gcctestdir/ld exception_shared.so
345exception_same_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
346exception_same_shared_test_LDADD = exception_shared.so
347
348exception_separate_shared_12_test_SOURCES = exception_test_main.cc
349exception_separate_shared_12_test_DEPENDENCIES = \
350 gcctestdir/ld exception_shared_1.so exception_shared_2.so
351exception_separate_shared_12_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
352exception_separate_shared_12_test_LDADD = \
353 exception_shared_1.so exception_shared_2.so
354
355exception_separate_shared_21_test_SOURCES = exception_test_main.cc
356exception_separate_shared_21_test_DEPENDENCIES = \
357 gcctestdir/ld exception_shared_1.so exception_shared_2.so
358exception_separate_shared_21_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
359exception_separate_shared_21_test_LDADD = \
360 exception_shared_2.so exception_shared_1.so
361
3151305a 362
351a8000 363check_PROGRAMS += weak_test
a360aedd 364weak_test_SOURCES = weak_test.cc
0e470e5c 365weak_test_DEPENDENCIES = gcctestdir/ld
a360aedd
ILT
366weak_test_LDFLAGS = -Bgcctestdir/
367
86925eef
CC
368check_PROGRAMS += weak_undef_test
369weak_undef_test_SOURCES = weak_undef_test.cc
370weak_undef_test_DEPENDENCIES = gcctestdir/ld weak_undef_lib.so alt/weak_undef_lib.so
371weak_undef_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,alt
372weak_undef_test_LDADD = -L . weak_undef_lib.so
373weak_undef_file1.o: weak_undef_file1.cc
374 $(CXXCOMPILE) -c -fpic -o $@ $<
375weak_undef_file2.o: weak_undef_file2.cc
376 $(CXXCOMPILE) -c -fpic -o $@ $<
377weak_undef_lib.so: weak_undef_file1.o
378 $(CXXLINK) -Bgcctestdir/ -shared weak_undef_file1.o
379alt/weak_undef_lib.so: weak_undef_file2.o
380 test -d alt || mkdir -p alt
381 $(CXXLINK) -Bgcctestdir/ -shared weak_undef_file2.o
351a8000 382
6eee141f
ILT
383if TLS
384
351a8000
ILT
385check_PROGRAMS += tls_test
386check_PROGRAMS += tls_pic_test
387check_PROGRAMS += tls_shared_test
c03c7692 388check_PROGRAMS += tls_shared_ie_test
351a8000
ILT
389tls_test_pic.o: tls_test.cc
390 $(CXXCOMPILE) -c -fpic -o $@ $<
391tls_test_file2_pic.o: tls_test_file2.cc
392 $(CXXCOMPILE) -c -fpic -o $@ $<
393tls_test_shared.so: tls_test_pic.o tls_test_file2_pic.o gcctestdir/ld
394 $(CXXLINK) -Bgcctestdir/ -shared tls_test_pic.o tls_test_file2_pic.o
395
c03c7692
ILT
396tls_test_pic_ie.o: tls_test.cc
397 $(CXXCOMPILE) -c -fpic -ftls-model=initial-exec -o $@ $<
398tls_test_file2_pic_ie.o: tls_test_file2.cc
399 $(CXXCOMPILE) -c -fpic -ftls-model=initial-exec -o $@ $<
400tls_test_ie_shared.so: tls_test_pic_ie.o tls_test_file2_pic_ie.o gcctestdir/ld
401 $(CXXLINK) -Bgcctestdir/ -shared tls_test_pic_ie.o tls_test_file2_pic_ie.o
402
e0374858 403tls_test_SOURCES = tls_test.cc tls_test_file2.cc tls_test_main.cc tls_test.h
6eee141f
ILT
404tls_test_DEPENDENCIES = gcctestdir/ld
405tls_test_LDFLAGS = -Bgcctestdir/
406tls_test_LDADD = -lpthread
407
408tls_pic_test_SOURCES = tls_test_main.cc
e0374858 409tls_pic_test_DEPENDENCIES = gcctestdir/ld tls_test_pic.o tls_test_file2_pic.o
6eee141f 410tls_pic_test_LDFLAGS = -Bgcctestdir/
e0374858 411tls_pic_test_LDADD = tls_test_pic.o tls_test_file2_pic.o -lpthread
6eee141f 412
6eee141f
ILT
413tls_shared_test_SOURCES = tls_test_main.cc
414tls_shared_test_DEPENDENCIES = gcctestdir/ld tls_test_shared.so
415tls_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
416tls_shared_test_LDADD = tls_test_shared.so -lpthread
417
c03c7692
ILT
418tls_shared_ie_test_SOURCES = tls_test_main.cc
419tls_shared_ie_test_DEPENDENCIES = gcctestdir/ld tls_test_ie_shared.so
420tls_shared_ie_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
421tls_shared_ie_test_LDADD = tls_test_ie_shared.so -lpthread
422
351a8000
ILT
423if STATIC_TLS
424check_PROGRAMS += tls_static_test
425check_PROGRAMS += tls_static_pic_test
426
427tls_static_test_SOURCES = $(tls_test_SOURCES)
428tls_static_test_DEPENDENCIES = $(tls_test_DEPENDENCIES)
429tls_static_test_LDFLAGS = $(tls_test_LDFLAGS) -static
430tls_static_test_LDADD = $(tls_test_LDADD)
431
432tls_static_pic_test_SOURCES = $(tls_pic_test_SOURCES)
433tls_static_pic_test_DEPENDENCIES = $(tls_pic_test_DEPENDENCIES)
434tls_static_pic_test_LDFLAGS = $(tls_pic_test_LDFLAGS) -static
435tls_static_pic_test_LDADD = $(tls_pic_test_LDADD)
436endif
6eee141f
ILT
437
438if FN_PTRS_IN_SO_WITHOUT_PIC
351a8000
ILT
439check_PROGRAMS += tls_shared_nonpic_test
440tls_test_shared_nonpic.so: tls_test.o tls_test_file2.o gcctestdir/ld
441 $(CXXLINK) -Bgcctestdir/ -shared tls_test.o tls_test_file2.o
6eee141f
ILT
442
443tls_shared_nonpic_test_SOURCES = tls_test_main.cc
444tls_shared_nonpic_test_DEPENDENCIES = gcctestdir/ld tls_test_shared_nonpic.so
445tls_shared_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
446tls_shared_nonpic_test_LDADD = tls_test_shared_nonpic.so -lpthread
351a8000 447endif FN_PTRS_IN_SO_WITHOUT_PIC
6eee141f 448
351a8000 449endif TLS
6eee141f 450
6eee141f 451
2fd32231
ILT
452if CONSTRUCTOR_PRIORITY
453
454check_PROGRAMS += initpri1
455initpri1_SOURCES = initpri1.c
456initpri1_DEPENDENCIES = gcctestdir/ld
457initpri1_LDFLAGS = -Bgcctestdir/
458
459endif
460
461
351a8000
ILT
462# Test --detect-odr-violations
463check_SCRIPTS += debug_msg.sh
6eee141f 464
351a8000
ILT
465# Create the data files that debug_msg.sh analyzes.
466check_DATA += debug_msg.err
467MOSTLYCLEANFILES += debug_msg.err
468debug_msg.o: debug_msg.cc
469 $(CXXCOMPILE) -O0 -g -c -w -o $@ $(srcdir)/debug_msg.cc
470odr_violation1.o: odr_violation1.cc
471 $(CXXCOMPILE) -O0 -g -c -w -o $@ $(srcdir)/odr_violation1.cc
472odr_violation2.o: odr_violation2.cc
473 $(CXXCOMPILE) -O0 -g -c -w -o $@ $(srcdir)/odr_violation2.cc
474debug_msg.err: debug_msg.o odr_violation1.o odr_violation2.o gcctestdir/ld
475 @echo $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg debug_msg.o odr_violation1.o odr_violation2.o "2>$@"
476 @if $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg debug_msg.o odr_violation1.o odr_violation2.o 2>$@; \
477 then \
478 echo 1>&2 "Link of debug_msg should have failed"; \
479 rm -f $@; \
480 exit 1; \
481 fi
482
483# See if we can also detect problems when we're linking .so's, not .o's.
484check_DATA += debug_msg_so.err
485MOSTLYCLEANFILES += debug_msg_so.err
486debug_msg.so: debug_msg.cc gcctestdir/ld
487 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -shared -fPIC -w -o $@ $(srcdir)/debug_msg.cc
488odr_violation1.so: odr_violation1.cc gcctestdir/ld
489 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -shared -fPIC -w -o $@ $(srcdir)/odr_violation1.cc
490odr_violation2.so: odr_violation2.cc gcctestdir/ld
491 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -shared -fPIC -w -o $@ $(srcdir)/odr_violation2.cc
492debug_msg_so.err: debug_msg.so odr_violation1.so odr_violation2.so gcctestdir/ld
493 @echo $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_so debug_msg.so odr_violation1.so odr_violation2.so "2>$@"
494 @if $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_so debug_msg.so odr_violation1.so odr_violation2.so 2>$@; \
495 then \
496 echo 1>&2 "Link of debug_msg_so should have failed"; \
497 rm -f $@; \
498 exit 1; \
499 fi
500
501# We also want to make sure we do something reasonable when there's no
502# debug info available. For the best test, we use .so's.
503check_DATA += debug_msg_ndebug.err
504MOSTLYCLEANFILES += debug_msg_ndebug.err
505debug_msg_ndebug.so: debug_msg.cc gcctestdir/ld
506 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g0 -shared -fPIC -w -o $@ $(srcdir)/debug_msg.cc
507odr_violation1_ndebug.so: odr_violation1.cc gcctestdir/ld
508 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g0 -shared -fPIC -w -o $@ $(srcdir)/odr_violation1.cc
509odr_violation2_ndebug.so: odr_violation2.cc gcctestdir/ld
510 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g0 -shared -fPIC -w -o $@ $(srcdir)/odr_violation2.cc
511debug_msg_ndebug.err: debug_msg_ndebug.so odr_violation1_ndebug.so odr_violation2_ndebug.so gcctestdir/ld
512 @echo $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_ndebug debug_msg_ndebug.so odr_violation1_ndebug.so odr_violation2_ndebug.so "2>$@"
513 @if $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_ndebug debug_msg_ndebug.so odr_violation1_ndebug.so odr_violation2_ndebug.so 2>$@; \
514 then \
515 echo 1>&2 "Link of debug_msg_ndebug should have failed"; \
516 rm -f $@; \
517 exit 1; \
518 fi
519
520
521# Similar to --detect-odr-violations: check for undefined symbols in .so's
522check_SCRIPTS += undef_symbol.sh
523check_DATA += undef_symbol.err
524MOSTLYCLEANFILES += undef_symbol.err
525undef_symbol.o: undef_symbol.cc
526 $(CXXCOMPILE) -O0 -g -c -fPIC $<
527undef_symbol.so: undef_symbol.o gcctestdir/ld
528 $(CXXLINK) -Bgcctestdir/ -shared undef_symbol.o
529undef_symbol.err: undef_symbol_main.o undef_symbol.so gcctestdir/ld
530 @echo $(CXXLINK) -Bgcctestdir/ -o undef_symbol_test undef_symbol_main.o undef_symbol.so "2>$@"
531 @if $(CXXLINK) -Bgcctestdir/ -o undef_symbol_test undef_symbol_main.o undef_symbol.so 2>$@; \
532 then \
533 echo 1>&2 "Link of undef_symbol_test should have failed"; \
534 rm -f $@; \
535 exit 1; \
536 fi
537
538
351a8000
ILT
539# Test -o when emitting to a special file (such as something in /dev).
540check_PROGRAMS += flagstest_o_specialfile
0e470e5c 541flagstest_o_specialfile: flagstest_debug.o gcctestdir/ld
351a8000
ILT
542 $(CXXLINK) -Bgcctestdir/ -o /dev/stdout $< 2>&1 | cat > $@
543 chmod a+x $@
544 test -s $@
545
7fcd0256
ILT
546if HAVE_ZLIB
547
548# Test --compress-debug-sections. FIXME: check we actually compress.
549check_PROGRAMS += flagstest_compress_debug_sections
550flagstest_compress_debug_sections: flagstest_debug.o gcctestdir/ld
551 $(CXXLINK) -Bgcctestdir/ -o $@ $< -Wl,--compress-debug-sections=zlib
552 test -s $@
553
554
351a8000
ILT
555# The specialfile output has a tricky case when we also compress debug
556# sections, because it requires output-file resizing.
557check_PROGRAMS += flagstest_o_specialfile_and_compress_debug_sections
0e470e5c
ILT
558flagstest_o_specialfile_and_compress_debug_sections: flagstest_debug.o \
559 gcctestdir/ld
126f3ece 560 $(CXXLINK) -Bgcctestdir/ -o /dev/stdout $< -Wl,--compress-debug-sections=zlib 2>&1 | cat > $@
351a8000
ILT
561 chmod a+x $@
562 test -s $@
563
7fcd0256
ILT
564endif HAVE_ZLIB
565
99f8faca
ILT
566# Test symbol versioning.
567check_PROGRAMS += ver_test
568ver_test_SOURCES = ver_test_main.cc
569ver_test_DEPENDENCIES = gcctestdir/ld ver_test_1.so ver_test_2.so ver_test_4.so
570ver_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
571ver_test_LDADD = ver_test_1.so ver_test_2.so ver_test_4.so
572ver_test_1.so: ver_test_1.o ver_test_2.so ver_test_3.o ver_test_4.so gcctestdir/ld
573 $(CXXLINK) -Bgcctestdir/ -shared ver_test_1.o ver_test_2.so ver_test_3.o ver_test_4.so
09124467
ILT
574ver_test_2.so: ver_test_2.o $(srcdir)/ver_test_2.script ver_test_4.so gcctestdir/ld
575 $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_2.script ver_test_2.o ver_test_4.so
576ver_test_4.so: ver_test_4.o $(srcdir)/ver_test_4.script gcctestdir/ld
577 $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_4.script ver_test_4.o
99f8faca
ILT
578ver_test_1.o: ver_test_1.cc
579 $(CXXCOMPILE) -c -fpic -o $@ $<
580ver_test_2.o: ver_test_2.cc
581 $(CXXCOMPILE) -c -fpic -o $@ $<
582ver_test_3.o: ver_test_3.cc
583 $(CXXCOMPILE) -c -fpic -o $@ $<
584ver_test_4.o: ver_test_4.cc
585 $(CXXCOMPILE) -c -fpic -o $@ $<
351a8000 586
be3e6201
ILT
587check_PROGRAMS += ver_test_2
588ver_test_2_SOURCES = ver_test_main_2.cc
589ver_test_2_DEPENDENCIES = gcctestdir/ld ver_test_4.so ver_test_2.so
590ver_test_2_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
591ver_test_2_LDADD = ver_test_4.so ver_test_2.so
592
be3e6201
ILT
593check_SCRIPTS += ver_test_2.sh
594check_DATA += ver_test_2.syms
595ver_test_2.syms: ver_test_2
6835af53 596 $(TEST_READELF) -s $< >$@ 2>/dev/null
be3e6201 597
686c8caf
ILT
598check_SCRIPTS += ver_test_4.sh
599check_DATA += ver_test_4.syms
600ver_test_4.syms: ver_test_4.so
6835af53 601 $(TEST_READELF) -s $< >$@ 2>/dev/null
5871526f
ILT
602
603ver_test_5.so: ver_test_5.o $(srcdir)/ver_test_5.script ver_test_4.so gcctestdir/ld
604 $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_5.script ver_test_5.o ver_test_4.so
605ver_test_5.o: ver_test_5.cc
606 $(CXXCOMPILE) -c -fpic -o $@ $<
607check_SCRIPTS += ver_test_5.sh
608check_DATA += ver_test_5.syms
609ver_test_5.syms: ver_test_5.so
6835af53 610 $(TEST_READELF) -s $< >$@ 2>/dev/null
5871526f 611
18e6b24e
ILT
612check_PROGRAMS += ver_test_6
613ver_test_6_SOURCES = ver_test_6.c
614ver_test_6_DEPENDENCIES = gcctestdir/ld ver_test_2.so
615ver_test_6_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
616ver_test_6_LDADD = ver_test_2.so
617
479f6503
ILT
618ver_test_7.so: ver_test_4.o $(srcdir)/ver_test_4.script ver_test_7.o gcctestdir/ld
619 $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_4.script ver_test_4.o ver_test_7.o
620ver_test_7.o: ver_test_7.cc
621 $(CXXCOMPILE) -c -fpic -o $@ $<
622check_SCRIPTS += ver_test_7.sh
623check_DATA += ver_test_7.syms
624ver_test_7.syms: ver_test_7.so
6835af53 625 $(TEST_READELF) -s $< >$@ 2>/dev/null
479f6503 626
e5756efb
ILT
627check_PROGRAMS += script_test_1
628script_test_1_SOURCES = script_test_1.cc
629script_test_1_DEPENDENCIES = gcctestdir/ld script_test_1.t
630script_test_1_LDFLAGS = -Bgcctestdir/ -Wl,-R,. -T $(srcdir)/script_test_1.t
631
a445fddf
ILT
632check_PROGRAMS += script_test_2
633script_test_2_SOURCES = script_test_2.cc script_test_2a.cc script_test_2b.cc
634script_test_2_DEPENDENCIES = gcctestdir/ld script_test_2.t
635script_test_2_LDFLAGS = -Bgcctestdir/ -Wl,-R,. -T $(srcdir)/script_test_2.t
636
88dd47ac
ILT
637check_PROGRAMS += justsyms
638justsyms_SOURCES = justsyms_1.cc
639justsyms_DEPENDENCIES = gcctestdir/ld justsyms_2r.o
640justsyms_LDFLAGS = -Bgcctestdir/ -Wl,-R,justsyms_2r.o
641justsyms_2.o: justsyms_2.cc
642 $(CXXCOMPILE) -c -o $@ $<
643justsyms_2r.o: justsyms_2.o gcctestdir/ld
644 gcctestdir/ld -o $@ -r -T $(srcdir)/justsyms.t justsyms_2.o
645
bc644c6c
ILT
646check_PROGRAMS += binary_test
647binary_test_SOURCES = binary_test.cc
648binary_test_DEPENDENCIES = gcctestdir/ld binary.txt
649binary_test_LDFLAGS = -Bgcctestdir/ -Wl,--format,binary,binary.txt,--format,elf
650# Copy the file to the build directory to avoid worrying about the
651# full pathname in the generated symbols.
652binary.txt: $(srcdir)/binary.in
653 rm -f $@
654 $(LN_S) $< $@
655
09124467
ILT
656check_SCRIPTS += ver_matching_test.sh
657check_DATA += ver_matching_test.stdout
658MOSTLYCLEANFILES += ver_matching_test.stdout
659ver_matching_def.so: ver_matching_def.cc gcctestdir/ld
660 $(CXXLINK) -O0 -Bgcctestdir/ -shared $(srcdir)/ver_matching_def.cc -Wl,--version-script=$(srcdir)/version_script.map
661ver_matching_test.stdout: ver_matching_def.so
6835af53 662 $(TEST_OBJDUMP) -T ver_matching_def.so | $(TEST_CXXFILT) > ver_matching_test.stdout
1c4f3631
ILT
663
664check_PROGRAMS += script_test_3
665check_SCRIPTS += script_test_3.sh
666check_DATA += script_test_3.stdout
667MOSTLYCLEANFILES += script_test_3.stdout
668script_test_3: basic_test.o gcctestdir/ld script_test_3.t
669 $(CXXLINK) -Bgcctestdir/ basic_test.o -T $(srcdir)/script_test_3.t
670script_test_3.stdout: script_test_3
6835af53 671 $(TEST_OBJDUMP) -p script_test_3 > script_test_3.stdout
09124467 672
351a8000
ILT
673endif GCC
674endif NATIVE_LINKER