]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gold/testsuite/Makefile.am
* object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
[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
14ec8efd
RW
7# Ignore warning about AM_PROG_CC_C_O due to large_CFLAGS
8AUTOMAKE_OPTIONS = foreign -Wno-portability
5a6f7e2d 9
f958d5fc
ILT
10# The two_file_test tests -fmerge-constants, so we simply always turn
11# it on. This may need to be controlled by a configure option
12# eventually.
89fc3421 13AM_CFLAGS = $(WARN_CFLAGS) $(LFS_CFLAGS) -fmerge-constants
494e05f4 14AM_CXXFLAGS = $(WARN_CXXFLAGS) $(LFS_CFLAGS) -fmerge-constants
5a6f7e2d 15
14ec8efd 16AM_CPPFLAGS = \
5a6f7e2d 17 -I$(srcdir) -I$(srcdir)/.. -I$(srcdir)/../../include \
155a0dd7 18 -I$(srcdir)/../../elfcpp -I.. \
5a6f7e2d
ILT
19 -DLOCALEDIR="\"$(datadir)/locale\"" \
20 @INCINTL@
21
6835af53
ILT
22TEST_READELF = $(top_builddir)/../binutils/readelf
23TEST_OBJDUMP = $(top_builddir)/../binutils/objdump
24TEST_CXXFILT = $(top_builddir)/../binutils/cxxfilt
25TEST_STRIP = $(top_builddir)/../binutils/strip-new
fbd8a257 26TEST_AR = $(top_builddir)/../binutils/ar
531813ad 27TEST_NM = $(top_builddir)/../binutils/nm-new
6835af53 28
89fc3421
CC
29if PLUGINS
30LIBDL = -ldl
31endif
32
fe9a4c12
ILT
33if THREADS
34THREADSLIB = -lpthread
35endif
36
155a0dd7
ILT
37if OMP_SUPPORT
38TLS_TEST_C_CFLAGS = -fopenmp
39endif
40
351a8000
ILT
41# 'make clean' is good about deleting some intermediate files (such as
42# .o's), but not all of them (such as .so's and .err files). We
43# improve on that here. automake-1.9 info docs say "mostlyclean" is
44# the right choice for files 'make' builds that people rebuild.
72fef11a 45MOSTLYCLEANFILES = *.so *.syms *.stdout
6eee141f 46
6eee141f 47
351a8000
ILT
48# We will add to these later, for each individual test. Note
49# that we add each test under check_SCRIPTS or check_PROGRAMS;
50# the TESTS variable is automatically populated from these.
51check_SCRIPTS =
52check_DATA =
53check_PROGRAMS =
d491d34e
ILT
54BUILT_SOURCES =
55
351a8000 56TESTS = $(check_SCRIPTS) $(check_PROGRAMS)
22dc1b09 57
351a8000
ILT
58# ---------------------------------------------------------------------
59# These tests test the internals of gold (unittests).
5a6f7e2d 60
351a8000 61# Infrastucture needed for the unittests
5a6f7e2d
ILT
62check_LIBRARIES = libgoldtest.a
63libgoldtest_a_SOURCES = test.cc testmain.cc testfile.cc
64
ad2d6943
ILT
65DEPENDENCIES = \
66 libgoldtest.a ../libgold.a ../../libiberty/libiberty.a $(LIBINTL_DEP)
fe9a4c12 67LDADD = libgoldtest.a ../libgold.a ../../libiberty/libiberty.a $(LIBINTL) \
89fc3421 68 $(THREADSLIB) $(LIBDL)
5a6f7e2d 69
5a6f7e2d 70
351a8000
ILT
71# The unittests themselves
72check_PROGRAMS += object_unittest
5a6f7e2d 73object_unittest_SOURCES = object_unittest.cc
22dc1b09 74
bc644c6c
ILT
75check_PROGRAMS += binary_unittest
76binary_unittest_SOURCES = binary_unittest.cc
77
351a8000
ILT
78
79# ---------------------------------------------------------------------
80# These tests test the output of gold (end-to-end tests). In
81# particular, they make sure that gold can link "difficult" object
82# files, and the resulting object files run correctly. These can only
83# run if we've built ld-new for the native architecture (that is,
84# we're not cross-compiling it), since we run ld-new as part of these
85# tests. We use the gcc-specific flag '-B' to use our linker instead
86# of the default linker, which is why we only run our tests under gcc.
a360aedd 87
e2827e5f 88if NATIVE_LINKER
351a8000 89if GCC
e2827e5f 90
351a8000
ILT
91# Infrastucture needed for the unittests: a directory where the linker
92# is named 'ld'. This is because the -B flag appends 'ld' to its arg.
e2827e5f
ILT
93gcctestdir/ld: ../ld-new
94 test -d gcctestdir || mkdir -p gcctestdir
95 rm -f gcctestdir/ld
96 (cd gcctestdir && $(LN_S) ../../ld-new ld)
97
351a8000
ILT
98# Each of these .o's is a useful, small complete program. They're
99# particularly useful for making sure ld-new's flags do what they're
100# supposed to (hence their names), but are used for many tests that
101# don't actually involve analyzing input data.
43771f76
ILT
102flagstest_debug.o: constructor_test.cc
103 $(CXXCOMPILE) -O0 -g -c -o $@ $<
104flagstest_ndebug.o: constructor_test.cc
105 $(CXXCOMPILE) -O0 -c -o $@ $<
106
43771f76 107
531813ad
ST
108check_SCRIPTS += gc_comdat_test.sh
109check_DATA += gc_comdat_test.stdout
72fef11a 110MOSTLYCLEANFILES += gc_comdat_test
531813ad 111gc_comdat_test_1.o: gc_comdat_test_1.cc
4daadc0d 112 $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
531813ad 113gc_comdat_test_2.o: gc_comdat_test_2.cc
4daadc0d 114 $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
531813ad 115gc_comdat_test: gc_comdat_test_1.o gc_comdat_test_2.o gcctestdir/ld
4daadc0d 116 $(CXXLINK) -Bgcctestdir/ -Wl,--gc-sections gc_comdat_test_1.o gc_comdat_test_2.o
531813ad
ST
117gc_comdat_test.stdout: gc_comdat_test
118 $(TEST_NM) -C gc_comdat_test > gc_comdat_test.stdout
119
27721062
ST
120check_SCRIPTS += gc_tls_test.sh
121check_DATA += gc_tls_test.stdout
72fef11a 122MOSTLYCLEANFILES += gc_tls_test
27721062
ST
123gc_tls_test.o: gc_tls_test.cc
124 $(CXXCOMPILE) -O0 -c -g -o $@ $<
125gc_tls_test:gc_tls_test.o gcctestdir/ld
126 $(CXXLINK) -Bgcctestdir/ -Wl,--gc-sections gc_tls_test.o
127gc_tls_test.stdout: gc_tls_test
128 $(TEST_NM) -C gc_tls_test > gc_tls_test.stdout
129
ef15dade
ST
130check_SCRIPTS += icf_test.sh
131check_DATA += icf_test.stdout
72fef11a 132MOSTLYCLEANFILES += icf_test
ef15dade
ST
133icf_test.o: icf_test.cc
134 $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
135icf_test: icf_test.o gcctestdir/ld
136 $(CXXLINK) -Bgcctestdir/ -Wl,--icf icf_test.o
137icf_test.stdout: icf_test
138 $(TEST_NM) -C icf_test > icf_test.stdout
139
48c187ce
ST
140check_SCRIPTS += icf_keep_unique_test.sh
141check_DATA += icf_keep_unique_test.stdout
72fef11a 142MOSTLYCLEANFILES += icf_keep_unique_test
48c187ce
ST
143icf_keep_unique_test.o: icf_keep_unique_test.cc
144 $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
145icf_keep_unique_test: icf_keep_unique_test.o gcctestdir/ld
146 $(CXXLINK) -Bgcctestdir/ -Wl,--icf -Wl,--keep-unique,_Z11unique_funcv icf_keep_unique_test.o
147icf_keep_unique_test.stdout: icf_keep_unique_test
148 $(TEST_NM) -C icf_keep_unique_test > icf_keep_unique_test.stdout
531813ad 149
351a8000
ILT
150check_PROGRAMS += basic_test
151check_PROGRAMS += basic_static_test
152check_PROGRAMS += basic_pic_test
153check_PROGRAMS += basic_static_pic_test
56ba9a23 154basic_test.o: basic_test.cc
22dc1b09 155 $(CXXCOMPILE) -O0 -c -o $@ $<
56ba9a23
ILT
156basic_test: basic_test.o gcctestdir/ld
157 $(CXXLINK) -Bgcctestdir/ basic_test.o
158basic_static_test: basic_test.o gcctestdir/ld
159 $(CXXLINK) -Bgcctestdir/ -static basic_test.o
22dc1b09 160
56ba9a23 161basic_pic_test.o: basic_test.cc
22dc1b09 162 $(CXXCOMPILE) -O0 -c -fpic -o $@ $<
56ba9a23
ILT
163basic_pic_test: basic_pic_test.o gcctestdir/ld
164 $(CXXLINK) -Bgcctestdir/ basic_pic_test.o
165basic_static_pic_test: basic_pic_test.o gcctestdir/ld
166 $(CXXLINK) -Bgcctestdir/ -static basic_pic_test.o
22dc1b09 167
351a8000
ILT
168
169check_PROGRAMS += constructor_test
170check_PROGRAMS += constructor_static_test
d5026652
ILT
171constructor_test_SOURCES = constructor_test.cc
172constructor_test_DEPENDENCIES = gcctestdir/ld
173constructor_test_LDFLAGS = -Bgcctestdir/
174
351a8000
ILT
175constructor_static_test_SOURCES = $(constructor_test_SOURCES)
176constructor_static_test_DEPENDENCIES = $(constructor_test_DEPENDENCIES)
177constructor_static_test_LDFLAGS = $(constructor_test_LDFLAGS) -static
cb615bc1 178
351a8000
ILT
179
180check_PROGRAMS += two_file_test
181check_PROGRAMS += two_file_static_test
182check_PROGRAMS += two_file_pic_test
3bd52c28
ILT
183two_file_test_SOURCES = \
184 two_file_test_1.cc \
03e8f2b2 185 two_file_test_1b.cc \
3bd52c28
ILT
186 two_file_test_2.cc \
187 two_file_test_main.cc \
188 two_file_test.h
189two_file_test_DEPENDENCIES = gcctestdir/ld
190two_file_test_LDFLAGS = -Bgcctestdir/
191
351a8000
ILT
192two_file_static_test_SOURCES = $(two_file_test_SOURCES)
193two_file_static_test_DEPENDENCIES = $(two_file_test_DEPENDENCIES)
194two_file_static_test_LDFLAGS = $(two_file_test_LDFLAGS) -static
f958d5fc
ILT
195
196two_file_pic_test_SOURCES = two_file_test_main.cc
197two_file_pic_test_DEPENDENCIES = \
03e8f2b2 198 gcctestdir/ld two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o
f958d5fc 199two_file_pic_test_LDFLAGS = -Bgcctestdir/
03e8f2b2 200two_file_pic_test_LDADD = two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o
f958d5fc 201
351a8000
ILT
202
203check_PROGRAMS += two_file_shared_1_test
204check_PROGRAMS += two_file_shared_2_test
205check_PROGRAMS += two_file_shared_1_pic_2_test
206check_PROGRAMS += two_file_shared_2_pic_1_test
207check_PROGRAMS += two_file_same_shared_test
208check_PROGRAMS += two_file_separate_shared_12_test
209check_PROGRAMS += two_file_separate_shared_21_test
210two_file_test_1_pic.o: two_file_test_1.cc
211 $(CXXCOMPILE) -c -fpic -o $@ $<
03e8f2b2
ILT
212two_file_test_1b_pic.o: two_file_test_1b.cc
213 $(CXXCOMPILE) -c -fpic -o $@ $<
351a8000
ILT
214two_file_test_2_pic.o: two_file_test_2.cc
215 $(CXXCOMPILE) -c -fpic -o $@ $<
03e8f2b2
ILT
216two_file_shared_1.so: two_file_test_1_pic.o two_file_test_1b_pic.o gcctestdir/ld
217 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1_pic.o two_file_test_1b_pic.o
351a8000
ILT
218two_file_shared_2.so: two_file_test_2_pic.o gcctestdir/ld
219 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_2_pic.o
03e8f2b2
ILT
220two_file_shared.so: two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o gcctestdir/ld
221 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o
351a8000 222
3bd52c28
ILT
223two_file_shared_1_test_SOURCES = two_file_test_2.cc two_file_test_main.cc
224two_file_shared_1_test_DEPENDENCIES = gcctestdir/ld two_file_shared_1.so
225two_file_shared_1_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
226two_file_shared_1_test_LDADD = two_file_shared_1.so
227
03e8f2b2 228two_file_shared_2_test_SOURCES = two_file_test_1.cc two_file_test_1b.cc two_file_test_main.cc
3bd52c28
ILT
229two_file_shared_2_test_DEPENDENCIES = gcctestdir/ld two_file_shared_2.so
230two_file_shared_2_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
231two_file_shared_2_test_LDADD = two_file_shared_2.so
232
386c048c
ILT
233two_file_shared_1_pic_2_test_SOURCES = two_file_test_main.cc
234two_file_shared_1_pic_2_test_DEPENDENCIES = \
03e8f2b2 235 gcctestdir/ld two_file_shared_1.so two_file_test_1_pic.o two_file_test_1b_pic.o
386c048c 236two_file_shared_1_pic_2_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
03e8f2b2 237two_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
238
239two_file_shared_2_pic_1_test_SOURCES = two_file_test_main.cc
240two_file_shared_2_pic_1_test_DEPENDENCIES = \
241 gcctestdir/ld two_file_shared_2.so two_file_test_2_pic.o
242two_file_shared_2_pic_1_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
243two_file_shared_2_pic_1_test_LDADD = two_file_test_2_pic.o two_file_shared_1.so
244
3bd52c28
ILT
245two_file_same_shared_test_SOURCES = two_file_test_main.cc
246two_file_same_shared_test_DEPENDENCIES = gcctestdir/ld two_file_shared.so
247two_file_same_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
248two_file_same_shared_test_LDADD = two_file_shared.so
249
250two_file_separate_shared_12_test_SOURCES = two_file_test_main.cc
251two_file_separate_shared_12_test_DEPENDENCIES = \
252 gcctestdir/ld two_file_shared_1.so two_file_shared_2.so
253two_file_separate_shared_12_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
254two_file_separate_shared_12_test_LDADD = \
255 two_file_shared_1.so two_file_shared_2.so
256
257two_file_separate_shared_21_test_SOURCES = two_file_test_main.cc
258two_file_separate_shared_21_test_DEPENDENCIES = \
259 gcctestdir/ld two_file_shared_1.so two_file_shared_2.so
260two_file_separate_shared_21_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
261two_file_separate_shared_21_test_LDADD = \
262 two_file_shared_2.so two_file_shared_1.so
263
6a74a719
ILT
264check_PROGRAMS += two_file_relocatable_test
265two_file_relocatable_test_SOURCES = two_file_test_main.cc
266two_file_relocatable_test_DEPENDENCIES = \
267 gcctestdir/ld two_file_relocatable.o
268two_file_relocatable_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
269two_file_relocatable_test_LDADD = two_file_relocatable.o
270two_file_relocatable.o: gcctestdir/ld two_file_test_1.o two_file_test_1b.o two_file_test_2.o
271 gcctestdir/ld -r -o $@ two_file_test_1.o two_file_test_1b.o two_file_test_2.o
272
031cdbed
ILT
273check_SCRIPTS += two_file_shared.sh
274check_DATA += two_file_shared.dbg
72fef11a 275MOSTLYCLEANFILES += two_file_shared.dbg
031cdbed
ILT
276two_file_shared.dbg: two_file_shared.so
277 $(TEST_READELF) -w $< >$@ 2>/dev/null
278
63402fe4
ILT
279# The nonpic tests will fail on platforms which can not put non-PIC
280# code into shared libraries, so we just don't run them in that case.
63402fe4 281if FN_PTRS_IN_SO_WITHOUT_PIC
3bd52c28 282
351a8000
ILT
283check_PROGRAMS += two_file_shared_1_nonpic_test
284check_PROGRAMS += two_file_shared_2_nonpic_test
285check_PROGRAMS += two_file_same_shared_nonpic_test
286check_PROGRAMS += two_file_separate_shared_12_nonpic_test
287check_PROGRAMS += two_file_separate_shared_21_nonpic_test
03e8f2b2
ILT
288check_PROGRAMS += two_file_mixed_shared_test
289check_PROGRAMS += two_file_mixed_2_shared_test
351a8000 290two_file_shared_1_nonpic.so: two_file_test_1.o gcctestdir/ld
03e8f2b2 291 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1.o two_file_test_1b.o
351a8000
ILT
292two_file_shared_2_nonpic.so: two_file_test_2.o gcctestdir/ld
293 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_2.o
03e8f2b2
ILT
294two_file_shared_nonpic.so: two_file_test_1.o two_file_test_1b.o two_file_test_2.o gcctestdir/ld
295 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1.o two_file_test_1b.o two_file_test_2.o
296two_file_shared_mixed.so: two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2.o gcctestdir/ld
297 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2.o
298two_file_shared_mixed_1.so: two_file_test_1.o two_file_test_1b_pic.o two_file_shared_2.so gcctestdir/ld
299 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1.o two_file_test_1b_pic.o two_file_shared_2.so
351a8000 300
3bd52c28
ILT
301two_file_shared_1_nonpic_test_SOURCES = \
302 two_file_test_2.cc two_file_test_main.cc
303two_file_shared_1_nonpic_test_DEPENDENCIES = \
304 gcctestdir/ld two_file_shared_1_nonpic.so
305two_file_shared_1_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
306two_file_shared_1_nonpic_test_LDADD = two_file_shared_1_nonpic.so
307
308two_file_shared_2_nonpic_test_SOURCES = \
03e8f2b2 309 two_file_test_1.cc two_file_test_1b.cc two_file_test_main.cc
3bd52c28
ILT
310two_file_shared_2_nonpic_test_DEPENDENCIES = \
311 gcctestdir/ld two_file_shared_2_nonpic.so
312two_file_shared_2_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
313two_file_shared_2_nonpic_test_LDADD = two_file_shared_2_nonpic.so
314
315two_file_same_shared_nonpic_test_SOURCES = two_file_test_main.cc
316two_file_same_shared_nonpic_test_DEPENDENCIES = \
317 gcctestdir/ld two_file_shared_nonpic.so
318two_file_same_shared_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
319two_file_same_shared_nonpic_test_LDADD = two_file_shared_nonpic.so
320
321two_file_separate_shared_12_nonpic_test_SOURCES = two_file_test_main.cc
322two_file_separate_shared_12_nonpic_test_DEPENDENCIES = \
323 gcctestdir/ld two_file_shared_1_nonpic.so two_file_shared_2_nonpic.so
324two_file_separate_shared_12_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
325two_file_separate_shared_12_nonpic_test_LDADD = \
326 two_file_shared_1_nonpic.so two_file_shared_2_nonpic.so
327
328two_file_separate_shared_21_nonpic_test_SOURCES = two_file_test_main.cc
329two_file_separate_shared_21_nonpic_test_DEPENDENCIES = \
330 gcctestdir/ld two_file_shared_1_nonpic.so two_file_shared_2_nonpic.so
331two_file_separate_shared_21_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
332two_file_separate_shared_21_nonpic_test_LDADD = \
333 two_file_shared_2_nonpic.so two_file_shared_1_nonpic.so
334
03e8f2b2
ILT
335two_file_mixed_shared_test_SOURCES = two_file_test_main.cc
336two_file_mixed_shared_test_DEPENDENCIES = gcctestdir/ld two_file_shared_mixed.so
337two_file_mixed_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
338two_file_mixed_shared_test_LDADD = two_file_shared_mixed.so
339
340two_file_mixed_2_shared_test_SOURCES = two_file_test_main.cc
341two_file_mixed_2_shared_test_DEPENDENCIES = gcctestdir/ld two_file_shared_mixed_1.so two_file_shared_2.so
342two_file_mixed_2_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
343two_file_mixed_2_shared_test_LDADD = two_file_shared_mixed_1.so two_file_shared_2.so
344
351a8000 345endif FN_PTRS_IN_SO_WITHOUT_PIC
3bd52c28 346
6835af53
ILT
347check_PROGRAMS += two_file_strip_test
348two_file_strip_test: two_file_test
349 $(TEST_STRIP) -o two_file_strip_test two_file_test
350
351check_PROGRAMS += two_file_same_shared_strip_test
352two_file_same_shared_strip_test_SOURCES = two_file_test_main.cc
353two_file_same_shared_strip_test_DEPENDENCIES = \
354 gcctestdir/ld two_file_shared_strip.so
355two_file_same_shared_strip_test_LDFLAGS = -Bgcctestdir/ -Wl,-R.
356two_file_same_shared_strip_test_LDADD = two_file_shared_strip.so
357two_file_shared_strip.so: two_file_shared.so
358 $(TEST_STRIP) -S -o two_file_shared_strip.so two_file_shared.so
359
49bdd526
ILT
360check_PROGRAMS += common_test_1
361common_test_1_SOURCES = common_test_1.c
362common_test_1_DEPENDENCIES = gcctestdir/ld
363common_test_1_LDFLAGS = -Bgcctestdir/
351a8000
ILT
364
365check_PROGRAMS += exception_test
366check_PROGRAMS += exception_static_test
367check_PROGRAMS += exception_shared_1_test
368check_PROGRAMS += exception_shared_2_test
369check_PROGRAMS += exception_same_shared_test
370check_PROGRAMS += exception_separate_shared_12_test
371check_PROGRAMS += exception_separate_shared_21_test
372exception_test_1_pic.o: exception_test_1.cc
373 $(CXXCOMPILE) -c -fpic -o $@ $<
374exception_test_2_pic.o: exception_test_2.cc
375 $(CXXCOMPILE) -c -fpic -o $@ $<
376exception_shared_1.so: exception_test_1_pic.o gcctestdir/ld
377 $(CXXLINK) -Bgcctestdir/ -shared exception_test_1_pic.o
378exception_shared_2.so: exception_test_2_pic.o gcctestdir/ld
379 $(CXXLINK) -Bgcctestdir/ -shared exception_test_2_pic.o
380exception_shared.so: exception_test_1_pic.o exception_test_2_pic.o gcctestdir/ld
381 $(CXXLINK) -Bgcctestdir/ -shared exception_test_1_pic.o exception_test_2_pic.o
63402fe4 382
3151305a
ILT
383exception_test_SOURCES = \
384 exception_test_main.cc \
385 exception_test_1.cc \
386 exception_test_2.cc \
387 exception_test.h
388exception_test_DEPENDENCIES = gcctestdir/ld
389exception_test_LDFLAGS = -Bgcctestdir/
390
351a8000
ILT
391exception_static_test_SOURCES = $(exception_test_SOURCES)
392exception_static_test_DEPENDENCIES = $(exception_test_DEPENDENCIES)
393exception_static_test_LDFLAGS = $(exception_test_LDFLAGS) -static
3151305a
ILT
394
395exception_shared_1_test_SOURCES = exception_test_2.cc exception_test_main.cc
396exception_shared_1_test_DEPENDENCIES = gcctestdir/ld exception_shared_1.so
397exception_shared_1_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
398exception_shared_1_test_LDADD = exception_shared_1.so
399
400exception_shared_2_test_SOURCES = exception_test_1.cc exception_test_main.cc
401exception_shared_2_test_DEPENDENCIES = gcctestdir/ld exception_shared_2.so
402exception_shared_2_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
403exception_shared_2_test_LDADD = exception_shared_2.so
404
405exception_same_shared_test_SOURCES = exception_test_main.cc
406exception_same_shared_test_DEPENDENCIES = gcctestdir/ld exception_shared.so
407exception_same_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
408exception_same_shared_test_LDADD = exception_shared.so
409
410exception_separate_shared_12_test_SOURCES = exception_test_main.cc
411exception_separate_shared_12_test_DEPENDENCIES = \
412 gcctestdir/ld exception_shared_1.so exception_shared_2.so
413exception_separate_shared_12_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
414exception_separate_shared_12_test_LDADD = \
415 exception_shared_1.so exception_shared_2.so
416
417exception_separate_shared_21_test_SOURCES = exception_test_main.cc
418exception_separate_shared_21_test_DEPENDENCIES = \
419 gcctestdir/ld exception_shared_1.so exception_shared_2.so
420exception_separate_shared_21_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
421exception_separate_shared_21_test_LDADD = \
422 exception_shared_2.so exception_shared_1.so
423
3151305a 424
351a8000 425check_PROGRAMS += weak_test
a360aedd 426weak_test_SOURCES = weak_test.cc
0e470e5c 427weak_test_DEPENDENCIES = gcctestdir/ld
a360aedd
ILT
428weak_test_LDFLAGS = -Bgcctestdir/
429
86925eef 430check_PROGRAMS += weak_undef_test
72fef11a 431MOSTLYCLEANFILES += alt/weak_undef_lib.so
86925eef
CC
432weak_undef_test_SOURCES = weak_undef_test.cc
433weak_undef_test_DEPENDENCIES = gcctestdir/ld weak_undef_lib.so alt/weak_undef_lib.so
434weak_undef_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,alt
435weak_undef_test_LDADD = -L . weak_undef_lib.so
436weak_undef_file1.o: weak_undef_file1.cc
437 $(CXXCOMPILE) -c -fpic -o $@ $<
438weak_undef_file2.o: weak_undef_file2.cc
439 $(CXXCOMPILE) -c -fpic -o $@ $<
440weak_undef_lib.so: weak_undef_file1.o
441 $(CXXLINK) -Bgcctestdir/ -shared weak_undef_file1.o
442alt/weak_undef_lib.so: weak_undef_file2.o
443 test -d alt || mkdir -p alt
444 $(CXXLINK) -Bgcctestdir/ -shared weak_undef_file2.o
351a8000 445
f3c69fca
CC
446if FN_PTRS_IN_SO_WITHOUT_PIC
447check_PROGRAMS += weak_undef_nonpic_test
72fef11a 448MOSTLYCLEANFILES += alt/weak_undef_lib_nonpic.so
f3c69fca
CC
449weak_undef_nonpic_test_SOURCES = weak_undef_test.cc
450weak_undef_nonpic_test_DEPENDENCIES = gcctestdir/ld weak_undef_lib_nonpic.so alt/weak_undef_lib_nonpic.so
451weak_undef_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,alt
452weak_undef_nonpic_test_LDADD = -L . weak_undef_lib_nonpic.so
453weak_undef_file1_nonpic.o: weak_undef_file1.cc
454 $(CXXCOMPILE) -c -o $@ $<
455weak_undef_file2_nonpic.o: weak_undef_file2.cc
456 $(CXXCOMPILE) -c -o $@ $<
457weak_undef_lib_nonpic.so: weak_undef_file1_nonpic.o
458 $(CXXLINK) -Bgcctestdir/ -shared weak_undef_file1_nonpic.o
459alt/weak_undef_lib_nonpic.so: weak_undef_file2_nonpic.o
460 test -d alt || mkdir -p alt
461 $(CXXLINK) -Bgcctestdir/ -shared weak_undef_file2_nonpic.o
462endif FN_PTRS_IN_SO_WITHOUT_PIC
463
464
99a37bfd
ILT
465check_PROGRAMS += weak_alias_test
466weak_alias_test_SOURCES = weak_alias_test_main.cc
467weak_alias_test_DEPENDENCIES = \
468 gcctestdir/ld weak_alias_test_1.so weak_alias_test_2.so \
469 weak_alias_test_3.o weak_alias_test_4.so
470weak_alias_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
471weak_alias_test_LDADD = \
472 weak_alias_test_1.so weak_alias_test_2.so weak_alias_test_3.o \
473 weak_alias_test_4.so
474weak_alias_test_1_pic.o: weak_alias_test_1.cc
475 $(CXXCOMPILE) -c -fpic -o $@ $<
de4c45bd 476weak_alias_test_1.so: weak_alias_test_1_pic.o gcctestdir/ld
99a37bfd
ILT
477 $(CXXLINK) -Bgcctestdir/ -shared weak_alias_test_1_pic.o
478weak_alias_test_2_pic.o: weak_alias_test_2.cc
479 $(CXXCOMPILE) -c -fpic -o $@ $<
de4c45bd 480weak_alias_test_2.so: weak_alias_test_2_pic.o gcctestdir/ld
99a37bfd
ILT
481 $(CXXLINK) -Bgcctestdir/ -shared weak_alias_test_2_pic.o
482weak_alias_test_3.o: weak_alias_test_3.cc
483 $(CXXCOMPILE) -c -o $@ $<
484weak_alias_test_4_pic.o: weak_alias_test_4.cc
485 $(CXXCOMPILE) -c -fpic -o $@ $<
de4c45bd 486weak_alias_test_4.so: weak_alias_test_4_pic.o gcctestdir/ld
99a37bfd
ILT
487 $(CXXLINK) -Bgcctestdir/ -shared weak_alias_test_4_pic.o
488
de4c45bd
ILT
489check_SCRIPTS += weak_plt.sh
490check_PROGRAMS += weak_plt
491check_DATA += weak_plt_shared.so
492weak_plt_main_pic.o: weak_plt_main.cc
493 $(CXXCOMPILE) -c -fpic -o $@ $<
494weak_plt: weak_plt_main_pic.o gcctestdir/ld
495 $(CXXLINK) -Bgcctestdir/ weak_plt_main_pic.o
496weak_plt_shared_pic.o: weak_plt_shared.cc
497 $(CXXCOMPILE) -c -fpic -o $@ $<
498weak_plt_shared.so: weak_plt_shared_pic.o gcctestdir/ld
499 $(CXXLINK) -Bgcctestdir/ -shared weak_plt_shared_pic.o
500
f34787f8
ILT
501check_PROGRAMS += copy_test
502copy_test_SOURCES = copy_test.cc
503copy_test_DEPENDENCIES = gcctestdir/ld copy_test_1.so copy_test_2.so
504copy_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
505copy_test_LDADD = copy_test_1.so copy_test_2.so
506copy_test_1_pic.o: copy_test_1.cc
507 $(CXXCOMPILE) -c -fpic -o $@ $<
508copy_test_1.so: gcctestdir/ld copy_test_1_pic.o
509 $(CXXLINK) -Bgcctestdir/ -shared copy_test_1_pic.o
510copy_test_2_pic.o: copy_test_2.cc
511 $(CXXCOMPILE) -c -fpic -o $@ $<
512copy_test_2.so: gcctestdir/ld copy_test_2_pic.o
513 $(CXXLINK) -Bgcctestdir/ -shared copy_test_2_pic.o
514
6eee141f
ILT
515if TLS
516
351a8000
ILT
517check_PROGRAMS += tls_test
518check_PROGRAMS += tls_pic_test
519check_PROGRAMS += tls_shared_test
c03c7692 520check_PROGRAMS += tls_shared_ie_test
c2b45e22 521check_PROGRAMS += tls_shared_gd_to_ie_test
351a8000
ILT
522tls_test_pic.o: tls_test.cc
523 $(CXXCOMPILE) -c -fpic -o $@ $<
524tls_test_file2_pic.o: tls_test_file2.cc
525 $(CXXCOMPILE) -c -fpic -o $@ $<
155a0dd7
ILT
526tls_test_c_pic.o: tls_test_c.c
527 $(COMPILE) -c -fpic $(TLS_TEST_C_CFLAGS) -o $@ $<
528tls_test_shared.so: tls_test_pic.o tls_test_file2_pic.o tls_test_c_pic.o gcctestdir/ld
9c2d0ef9 529 $(CXXLINK) -Bgcctestdir/ -shared tls_test_pic.o tls_test_file2_pic.o tls_test_c_pic.o -Wl,-z,defs
c2b45e22
CC
530tls_test_shared2.so: tls_test_file2_pic.o gcctestdir/ld
531 $(CXXLINK) -Bgcctestdir/ -shared tls_test_file2_pic.o
351a8000 532
c03c7692
ILT
533tls_test_pic_ie.o: tls_test.cc
534 $(CXXCOMPILE) -c -fpic -ftls-model=initial-exec -o $@ $<
535tls_test_file2_pic_ie.o: tls_test_file2.cc
536 $(CXXCOMPILE) -c -fpic -ftls-model=initial-exec -o $@ $<
155a0dd7
ILT
537tls_test_c_pic_ie.o: tls_test_c.c
538 $(COMPILE) -c -fpic -ftls-model=initial-exec $(TLS_TEST_C_CFLAGS) -o $@ $<
539tls_test_ie_shared.so: tls_test_pic_ie.o tls_test_file2_pic_ie.o tls_test_c_pic_ie.o gcctestdir/ld
540 $(CXXLINK) -Bgcctestdir/ -shared tls_test_pic_ie.o tls_test_file2_pic_ie.o tls_test_c_pic_ie.o
c03c7692 541
e0374858 542tls_test_SOURCES = tls_test.cc tls_test_file2.cc tls_test_main.cc tls_test.h
155a0dd7 543tls_test_DEPENDENCIES = gcctestdir/ld tls_test_c.o
6eee141f 544tls_test_LDFLAGS = -Bgcctestdir/
155a0dd7
ILT
545tls_test_LDADD = tls_test_c.o -lpthread
546tls_test_c.o: tls_test_c.c
547 $(COMPILE) -c $(TLS_TEST_C_CFLAGS) -o $@ $<
6eee141f
ILT
548
549tls_pic_test_SOURCES = tls_test_main.cc
155a0dd7
ILT
550tls_pic_test_DEPENDENCIES = gcctestdir/ld tls_test_pic.o tls_test_file2_pic.o \
551 tls_test_c_pic.o
6eee141f 552tls_pic_test_LDFLAGS = -Bgcctestdir/
155a0dd7
ILT
553tls_pic_test_LDADD = tls_test_pic.o tls_test_file2_pic.o tls_test_c_pic.o \
554 -lpthread
6eee141f 555
6eee141f
ILT
556tls_shared_test_SOURCES = tls_test_main.cc
557tls_shared_test_DEPENDENCIES = gcctestdir/ld tls_test_shared.so
558tls_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
559tls_shared_test_LDADD = tls_test_shared.so -lpthread
560
c03c7692
ILT
561tls_shared_ie_test_SOURCES = tls_test_main.cc
562tls_shared_ie_test_DEPENDENCIES = gcctestdir/ld tls_test_ie_shared.so
563tls_shared_ie_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
564tls_shared_ie_test_LDADD = tls_test_ie_shared.so -lpthread
565
c2b45e22 566tls_shared_gd_to_ie_test_SOURCES = tls_test_main.cc
155a0dd7
ILT
567tls_shared_gd_to_ie_test_DEPENDENCIES = gcctestdir/ld tls_test_pic.o \
568 tls_test_c_pic.o tls_test_shared2.so
c2b45e22 569tls_shared_gd_to_ie_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
155a0dd7
ILT
570tls_shared_gd_to_ie_test_LDADD = tls_test_pic.o tls_test_c_pic.o \
571 tls_test_shared2.so -lpthread
c2b45e22
CC
572
573if TLS_GNU2_DIALECT
574
575check_PROGRAMS += tls_shared_gnu2_gd_to_ie_test
576
577tls_test_gnu2.o: tls_test.cc
578 $(CXXCOMPILE) -c -fpic -mtls-dialect=gnu2 -o $@ $<
579tls_test_file2_gnu2.o: tls_test_file2.cc
580 $(CXXCOMPILE) -c -fpic -mtls-dialect=gnu2 -o $@ $<
155a0dd7
ILT
581tls_test_c_gnu2.o: tls_test_c.c
582 $(COMPILE) -c -fpic -mtls-dialect=gnu2 $(TLS_TEST_C_CFLAGS) -o $@ $<
c2b45e22
CC
583tls_test_gnu2_shared2.so: tls_test_file2_gnu2.o gcctestdir/ld
584 $(CXXLINK) -Bgcctestdir/ -shared tls_test_file2_gnu2.o
585
586tls_shared_gnu2_gd_to_ie_test_SOURCES = tls_test_main.cc
155a0dd7
ILT
587tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES = gcctestdir/ld tls_test_gnu2.o \
588 tls_test_c_gnu2.o tls_test_gnu2_shared2.so
c2b45e22 589tls_shared_gnu2_gd_to_ie_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
155a0dd7
ILT
590tls_shared_gnu2_gd_to_ie_test_LDADD = tls_test_gnu2.o tls_test_c_gnu2.o \
591 tls_test_gnu2_shared2.so -lpthread
c2b45e22
CC
592
593if TLS_DESCRIPTORS
594
595check_PROGRAMS += tls_shared_gnu2_test
596
155a0dd7
ILT
597tls_test_gnu2_shared.so: tls_test_gnu2.o tls_test_file2_gnu2.o tls_test_c_gnu2.o gcctestdir/ld
598 $(CXXLINK) -Bgcctestdir/ -shared tls_test_gnu2.o tls_test_file2_gnu2.o tls_test_c_gnu2.o
c2b45e22
CC
599
600tls_shared_gnu2_test_SOURCES = tls_test_main.cc
601tls_shared_gnu2_test_DEPENDENCIES = gcctestdir/ld tls_test_gnu2_shared.so
602tls_shared_gnu2_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
603tls_shared_gnu2_test_LDADD = tls_test_gnu2_shared.so -lpthread
604
605endif TLS_DESCRIPTORS
606
607endif TLS_GNU2_DIALECT
608
351a8000
ILT
609if STATIC_TLS
610check_PROGRAMS += tls_static_test
611check_PROGRAMS += tls_static_pic_test
612
613tls_static_test_SOURCES = $(tls_test_SOURCES)
614tls_static_test_DEPENDENCIES = $(tls_test_DEPENDENCIES)
615tls_static_test_LDFLAGS = $(tls_test_LDFLAGS) -static
616tls_static_test_LDADD = $(tls_test_LDADD)
617
618tls_static_pic_test_SOURCES = $(tls_pic_test_SOURCES)
619tls_static_pic_test_DEPENDENCIES = $(tls_pic_test_DEPENDENCIES)
620tls_static_pic_test_LDFLAGS = $(tls_pic_test_LDFLAGS) -static
621tls_static_pic_test_LDADD = $(tls_pic_test_LDADD)
622endif
6eee141f
ILT
623
624if FN_PTRS_IN_SO_WITHOUT_PIC
351a8000 625check_PROGRAMS += tls_shared_nonpic_test
155a0dd7
ILT
626tls_test_shared_nonpic.so: tls_test.o tls_test_file2.o tls_test_c.o gcctestdir/ld
627 $(CXXLINK) -Bgcctestdir/ -shared tls_test.o tls_test_file2.o tls_test_c.o
6eee141f
ILT
628
629tls_shared_nonpic_test_SOURCES = tls_test_main.cc
630tls_shared_nonpic_test_DEPENDENCIES = gcctestdir/ld tls_test_shared_nonpic.so
631tls_shared_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
632tls_shared_nonpic_test_LDADD = tls_test_shared_nonpic.so -lpthread
351a8000 633endif FN_PTRS_IN_SO_WITHOUT_PIC
6eee141f 634
351a8000 635endif TLS
6eee141f 636
d491d34e
ILT
637check_PROGRAMS += many_sections_test
638many_sections_test_SOURCES = many_sections_test.cc
639many_sections_test_DEPENDENCIES = gcctestdir/ld
640many_sections_test_LDFLAGS = -Bgcctestdir/ -rdynamic
641
642BUILT_SOURCES += many_sections_define.h
72fef11a 643MOSTLYCLEANFILES += many_sections_define.h
d491d34e
ILT
644many_sections_define.h:
645 (for i in `seq 1 70000`; do \
646 echo "int var_$$i __attribute__((section(\"section_$$i\"))) = $$i;"; \
647 done) > $@.tmp
648 mv -f $@.tmp $@
649
650BUILT_SOURCES += many_sections_check.h
72fef11a 651MOSTLYCLEANFILES += many_sections_check.h
d491d34e 652many_sections_check.h:
4c94d6ae 653 (for i in `seq 1 1000 70000`; do \
d491d34e
ILT
654 echo "assert(var_$$i == $$i);"; \
655 done) > $@.tmp
656 mv -f $@.tmp $@
657
658check_PROGRAMS += many_sections_r_test
d491d34e
ILT
659many_sections_r_test.o: many_sections_test.o gcctestdir/ld
660 gcctestdir/ld -r -o $@ many_sections_test.o
7bc3e21a
ILT
661many_sections_r_test: many_sections_r_test.o gcctestdir/ld
662 $(CXXLINK) -Bgcctestdir/ many_sections_r_test.o $(LIBS)
6eee141f 663
2fd32231
ILT
664if CONSTRUCTOR_PRIORITY
665
666check_PROGRAMS += initpri1
667initpri1_SOURCES = initpri1.c
668initpri1_DEPENDENCIES = gcctestdir/ld
669initpri1_LDFLAGS = -Bgcctestdir/
670
671endif
672
673
351a8000
ILT
674# Test --detect-odr-violations
675check_SCRIPTS += debug_msg.sh
6eee141f 676
351a8000
ILT
677# Create the data files that debug_msg.sh analyzes.
678check_DATA += debug_msg.err
679MOSTLYCLEANFILES += debug_msg.err
680debug_msg.o: debug_msg.cc
681 $(CXXCOMPILE) -O0 -g -c -w -o $@ $(srcdir)/debug_msg.cc
682odr_violation1.o: odr_violation1.cc
683 $(CXXCOMPILE) -O0 -g -c -w -o $@ $(srcdir)/odr_violation1.cc
684odr_violation2.o: odr_violation2.cc
685 $(CXXCOMPILE) -O0 -g -c -w -o $@ $(srcdir)/odr_violation2.cc
686debug_msg.err: debug_msg.o odr_violation1.o odr_violation2.o gcctestdir/ld
687 @echo $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg debug_msg.o odr_violation1.o odr_violation2.o "2>$@"
688 @if $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg debug_msg.o odr_violation1.o odr_violation2.o 2>$@; \
689 then \
690 echo 1>&2 "Link of debug_msg should have failed"; \
691 rm -f $@; \
692 exit 1; \
693 fi
694
695# See if we can also detect problems when we're linking .so's, not .o's.
696check_DATA += debug_msg_so.err
697MOSTLYCLEANFILES += debug_msg_so.err
698debug_msg.so: debug_msg.cc gcctestdir/ld
699 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -shared -fPIC -w -o $@ $(srcdir)/debug_msg.cc
700odr_violation1.so: odr_violation1.cc gcctestdir/ld
701 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -shared -fPIC -w -o $@ $(srcdir)/odr_violation1.cc
702odr_violation2.so: odr_violation2.cc gcctestdir/ld
703 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -shared -fPIC -w -o $@ $(srcdir)/odr_violation2.cc
704debug_msg_so.err: debug_msg.so odr_violation1.so odr_violation2.so gcctestdir/ld
705 @echo $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_so debug_msg.so odr_violation1.so odr_violation2.so "2>$@"
706 @if $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_so debug_msg.so odr_violation1.so odr_violation2.so 2>$@; \
707 then \
708 echo 1>&2 "Link of debug_msg_so should have failed"; \
709 rm -f $@; \
710 exit 1; \
711 fi
712
713# We also want to make sure we do something reasonable when there's no
714# debug info available. For the best test, we use .so's.
715check_DATA += debug_msg_ndebug.err
716MOSTLYCLEANFILES += debug_msg_ndebug.err
717debug_msg_ndebug.so: debug_msg.cc gcctestdir/ld
718 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g0 -shared -fPIC -w -o $@ $(srcdir)/debug_msg.cc
719odr_violation1_ndebug.so: odr_violation1.cc gcctestdir/ld
720 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g0 -shared -fPIC -w -o $@ $(srcdir)/odr_violation1.cc
721odr_violation2_ndebug.so: odr_violation2.cc gcctestdir/ld
722 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g0 -shared -fPIC -w -o $@ $(srcdir)/odr_violation2.cc
723debug_msg_ndebug.err: debug_msg_ndebug.so odr_violation1_ndebug.so odr_violation2_ndebug.so gcctestdir/ld
724 @echo $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_ndebug debug_msg_ndebug.so odr_violation1_ndebug.so odr_violation2_ndebug.so "2>$@"
725 @if $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_ndebug debug_msg_ndebug.so odr_violation1_ndebug.so odr_violation2_ndebug.so 2>$@; \
726 then \
727 echo 1>&2 "Link of debug_msg_ndebug should have failed"; \
728 rm -f $@; \
729 exit 1; \
730 fi
731
732
733# Similar to --detect-odr-violations: check for undefined symbols in .so's
734check_SCRIPTS += undef_symbol.sh
735check_DATA += undef_symbol.err
736MOSTLYCLEANFILES += undef_symbol.err
737undef_symbol.o: undef_symbol.cc
738 $(CXXCOMPILE) -O0 -g -c -fPIC $<
739undef_symbol.so: undef_symbol.o gcctestdir/ld
740 $(CXXLINK) -Bgcctestdir/ -shared undef_symbol.o
741undef_symbol.err: undef_symbol_main.o undef_symbol.so gcctestdir/ld
742 @echo $(CXXLINK) -Bgcctestdir/ -o undef_symbol_test undef_symbol_main.o undef_symbol.so "2>$@"
743 @if $(CXXLINK) -Bgcctestdir/ -o undef_symbol_test undef_symbol_main.o undef_symbol.so 2>$@; \
744 then \
745 echo 1>&2 "Link of undef_symbol_test should have failed"; \
746 rm -f $@; \
747 exit 1; \
748 fi
749
750
351a8000
ILT
751# Test -o when emitting to a special file (such as something in /dev).
752check_PROGRAMS += flagstest_o_specialfile
0e470e5c 753flagstest_o_specialfile: flagstest_debug.o gcctestdir/ld
351a8000
ILT
754 $(CXXLINK) -Bgcctestdir/ -o /dev/stdout $< 2>&1 | cat > $@
755 chmod a+x $@
756 test -s $@
757
7fcd0256
ILT
758if HAVE_ZLIB
759
760# Test --compress-debug-sections. FIXME: check we actually compress.
761check_PROGRAMS += flagstest_compress_debug_sections
762flagstest_compress_debug_sections: flagstest_debug.o gcctestdir/ld
763 $(CXXLINK) -Bgcctestdir/ -o $@ $< -Wl,--compress-debug-sections=zlib
764 test -s $@
765
766
351a8000
ILT
767# The specialfile output has a tricky case when we also compress debug
768# sections, because it requires output-file resizing.
769check_PROGRAMS += flagstest_o_specialfile_and_compress_debug_sections
0e470e5c
ILT
770flagstest_o_specialfile_and_compress_debug_sections: flagstest_debug.o \
771 gcctestdir/ld
126f3ece 772 $(CXXLINK) -Bgcctestdir/ -o /dev/stdout $< -Wl,--compress-debug-sections=zlib 2>&1 | cat > $@
351a8000
ILT
773 chmod a+x $@
774 test -s $@
775
7fcd0256
ILT
776endif HAVE_ZLIB
777
99f8faca
ILT
778# Test symbol versioning.
779check_PROGRAMS += ver_test
780ver_test_SOURCES = ver_test_main.cc
781ver_test_DEPENDENCIES = gcctestdir/ld ver_test_1.so ver_test_2.so ver_test_4.so
782ver_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
783ver_test_LDADD = ver_test_1.so ver_test_2.so ver_test_4.so
784ver_test_1.so: ver_test_1.o ver_test_2.so ver_test_3.o ver_test_4.so gcctestdir/ld
785 $(CXXLINK) -Bgcctestdir/ -shared ver_test_1.o ver_test_2.so ver_test_3.o ver_test_4.so
09124467
ILT
786ver_test_2.so: ver_test_2.o $(srcdir)/ver_test_2.script ver_test_4.so gcctestdir/ld
787 $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_2.script ver_test_2.o ver_test_4.so
788ver_test_4.so: ver_test_4.o $(srcdir)/ver_test_4.script gcctestdir/ld
789 $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_4.script ver_test_4.o
99f8faca
ILT
790ver_test_1.o: ver_test_1.cc
791 $(CXXCOMPILE) -c -fpic -o $@ $<
792ver_test_2.o: ver_test_2.cc
793 $(CXXCOMPILE) -c -fpic -o $@ $<
794ver_test_3.o: ver_test_3.cc
795 $(CXXCOMPILE) -c -fpic -o $@ $<
796ver_test_4.o: ver_test_4.cc
797 $(CXXCOMPILE) -c -fpic -o $@ $<
351a8000 798
0602e05a
ILT
799check_SCRIPTS += ver_test_1.sh
800check_DATA += ver_test_1.syms
801ver_test_1.syms: ver_test_1.so
802 $(TEST_READELF) -s $< >$@ 2>/dev/null
803
be3e6201
ILT
804check_PROGRAMS += ver_test_2
805ver_test_2_SOURCES = ver_test_main_2.cc
806ver_test_2_DEPENDENCIES = gcctestdir/ld ver_test_4.so ver_test_2.so
807ver_test_2_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
808ver_test_2_LDADD = ver_test_4.so ver_test_2.so
809
be3e6201
ILT
810check_SCRIPTS += ver_test_2.sh
811check_DATA += ver_test_2.syms
812ver_test_2.syms: ver_test_2
6835af53 813 $(TEST_READELF) -s $< >$@ 2>/dev/null
be3e6201 814
686c8caf
ILT
815check_SCRIPTS += ver_test_4.sh
816check_DATA += ver_test_4.syms
817ver_test_4.syms: ver_test_4.so
6835af53 818 $(TEST_READELF) -s $< >$@ 2>/dev/null
5871526f
ILT
819
820ver_test_5.so: ver_test_5.o $(srcdir)/ver_test_5.script ver_test_4.so gcctestdir/ld
821 $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_5.script ver_test_5.o ver_test_4.so
822ver_test_5.o: ver_test_5.cc
823 $(CXXCOMPILE) -c -fpic -o $@ $<
824check_SCRIPTS += ver_test_5.sh
825check_DATA += ver_test_5.syms
826ver_test_5.syms: ver_test_5.so
6835af53 827 $(TEST_READELF) -s $< >$@ 2>/dev/null
5871526f 828
18e6b24e
ILT
829check_PROGRAMS += ver_test_6
830ver_test_6_SOURCES = ver_test_6.c
831ver_test_6_DEPENDENCIES = gcctestdir/ld ver_test_2.so
832ver_test_6_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
833ver_test_6_LDADD = ver_test_2.so
834
479f6503
ILT
835ver_test_7.so: ver_test_4.o $(srcdir)/ver_test_4.script ver_test_7.o gcctestdir/ld
836 $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_4.script ver_test_4.o ver_test_7.o
837ver_test_7.o: ver_test_7.cc
838 $(CXXCOMPILE) -c -fpic -o $@ $<
839check_SCRIPTS += ver_test_7.sh
840check_DATA += ver_test_7.syms
841ver_test_7.syms: ver_test_7.so
6835af53 842 $(TEST_READELF) -s $< >$@ 2>/dev/null
479f6503 843
75517b77
ILT
844check_PROGRAMS += ver_test_8
845ver_test_8_SOURCES = two_file_test_main.cc
846ver_test_8_DEPENDENCIES = gcctestdir/ld ver_test_8_1.so ver_test_8_2.so
847ver_test_8_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
848ver_test_8_LDADD = ver_test_8_1.so ver_test_8_2.so
849ver_test_8_1.so: two_file_test_1_pic.o two_file_test_1b_pic.o ver_test_8_2.so gcctestdir/ld
850 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1_pic.o two_file_test_1b_pic.o ver_test_8_2.so
851ver_test_8_2.so: two_file_test_2_pic.o $(srcdir)/ver_test_8.script gcctestdir/ld
852 $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_8.script two_file_test_2_pic.o
853
95d14cd3
ILT
854check_PROGRAMS += ver_test_9
855ver_test_9_SOURCES = ver_test_main.cc
856ver_test_9_DEPENDENCIES = gcctestdir/ld ver_test_9.so
857ver_test_9_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
858ver_test_9_LDADD = ver_test_9.so
859ver_test_9.so: ver_test_9.o ver_test_4.so ver_test_5.so gcctestdir/ld
860 $(CXXLINK) -Bgcctestdir/ -shared ver_test_9.o ver_test_5.so ver_test_4.so
861ver_test_9.o: ver_test_9.cc
862 $(CXXCOMPILE) -c -fpic -o $@ $<
863
057ead22
ILT
864check_SCRIPTS += ver_test_10.sh
865check_DATA += ver_test_10.syms
866ver_test_10.syms: ver_test_10.so
867 $(TEST_READELF) -s $< >$@ 2>/dev/null
868ver_test_10.so: gcctestdir/ld ver_test_2.o ver_test_10.script
869 $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_10.script ver_test_2.o
870
9c5b8369 871check_PROGRAMS += ver_test_11
72fef11a 872MOSTLYCLEANFILES += ver_test_11.a
9c5b8369
ILT
873ver_test_11_SOURCES = ver_test_main_2.cc
874ver_test_11_DEPENDENCIES = gcctestdir/ld ver_test_11.a
875ver_test_11_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
876ver_test_11_LDADD = ver_test_11.a
877ver_test_11.a: ver_test_1.o ver_test_2.o ver_test_4.o
878 $(TEST_AR) rc $@ $^
879
8bdcdf2c
ILT
880check_PROGRAMS += protected_1
881protected_1_SOURCES = \
882 protected_main_1.cc protected_main_2.cc protected_main_3.cc
883protected_1_DEPENDENCIES = gcctestdir/ld protected_1.so
884protected_1_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
885protected_1_LDADD = protected_1.so
886
887protected_1.so: gcctestdir/ld protected_1_pic.o protected_2_pic.o protected_3_pic.o
888 $(CXXLINK) -Bgcctestdir/ -shared protected_1_pic.o protected_2_pic.o protected_3_pic.o
889protected_1_pic.o: protected_1.cc
890 $(CXXCOMPILE) -c -fpic -o $@ $<
891protected_2_pic.o: protected_2.cc
892 $(CXXCOMPILE) -c -fpic -o $@ $<
893protected_3_pic.o: protected_3.cc
894 $(CXXCOMPILE) -c -fpic -o $@ $<
895
896check_PROGRAMS += protected_2
897protected_2_SOURCES = protected_main_1.cc protected_3.cc
898protected_2_DEPENDENCIES = gcctestdir/ld protected_1.so
899protected_2_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
900protected_2_LDADD = protected_1.so
901
9f1d377b
ILT
902check_PROGRAMS += relro_test
903relro_test_SOURCES = relro_test_main.cc
904relro_test_DEPENDENCIES = gcctestdir/ld relro_test.so
905relro_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
906relro_test_LDADD = relro_test.so
907relro_test.so: gcctestdir/ld relro_test_pic.o
908 $(CXXLINK) -Bgcctestdir/ -shared -Wl,-z,relro relro_test_pic.o
909relro_test_pic.o: relro_test.cc
910 $(CXXCOMPILE) -c -fpic -o $@ $<
911
2d924fd9
ILT
912check_PROGRAMS += relro_script_test
913relro_script_test_SOURCES = relro_test_main.cc
914relro_script_test_DEPENDENCIES = gcctestdir/ld relro_script_test.so
915relro_script_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
916relro_script_test_LDADD = relro_script_test.so
917relro_script_test.so: gcctestdir/ld relro_script_test.t relro_test_pic.o
918 $(CXXLINK) -Bgcctestdir/ -shared -Wl,-z,relro -T $(srcdir)/relro_script_test.t relro_test_pic.o
919
e5756efb
ILT
920check_PROGRAMS += script_test_1
921script_test_1_SOURCES = script_test_1.cc
922script_test_1_DEPENDENCIES = gcctestdir/ld script_test_1.t
923script_test_1_LDFLAGS = -Bgcctestdir/ -Wl,-R,. -T $(srcdir)/script_test_1.t
924
a445fddf
ILT
925check_PROGRAMS += script_test_2
926script_test_2_SOURCES = script_test_2.cc script_test_2a.cc script_test_2b.cc
927script_test_2_DEPENDENCIES = gcctestdir/ld script_test_2.t
928script_test_2_LDFLAGS = -Bgcctestdir/ -Wl,-R,. -T $(srcdir)/script_test_2.t
929
88dd47ac
ILT
930check_PROGRAMS += justsyms
931justsyms_SOURCES = justsyms_1.cc
932justsyms_DEPENDENCIES = gcctestdir/ld justsyms_2r.o
933justsyms_LDFLAGS = -Bgcctestdir/ -Wl,-R,justsyms_2r.o
934justsyms_2.o: justsyms_2.cc
935 $(CXXCOMPILE) -c -o $@ $<
83bfb6b7 936justsyms_2r.o: justsyms_2.o gcctestdir/ld $(srcdir)/justsyms.t
88dd47ac
ILT
937 gcctestdir/ld -o $@ -r -T $(srcdir)/justsyms.t justsyms_2.o
938
bc644c6c 939check_PROGRAMS += binary_test
72fef11a 940MOSTLYCLEANFILES += binary.txt
bc644c6c
ILT
941binary_test_SOURCES = binary_test.cc
942binary_test_DEPENDENCIES = gcctestdir/ld binary.txt
943binary_test_LDFLAGS = -Bgcctestdir/ -Wl,--format,binary,binary.txt,--format,elf
944# Copy the file to the build directory to avoid worrying about the
945# full pathname in the generated symbols.
946binary.txt: $(srcdir)/binary.in
947 rm -f $@
948 $(LN_S) $< $@
949
09124467
ILT
950check_SCRIPTS += ver_matching_test.sh
951check_DATA += ver_matching_test.stdout
952MOSTLYCLEANFILES += ver_matching_test.stdout
953ver_matching_def.so: ver_matching_def.cc gcctestdir/ld
954 $(CXXLINK) -O0 -Bgcctestdir/ -shared $(srcdir)/ver_matching_def.cc -Wl,--version-script=$(srcdir)/version_script.map
955ver_matching_test.stdout: ver_matching_def.so
6835af53 956 $(TEST_OBJDUMP) -T ver_matching_def.so | $(TEST_CXXFILT) > ver_matching_test.stdout
1c4f3631
ILT
957
958check_PROGRAMS += script_test_3
959check_SCRIPTS += script_test_3.sh
960check_DATA += script_test_3.stdout
961MOSTLYCLEANFILES += script_test_3.stdout
962script_test_3: basic_test.o gcctestdir/ld script_test_3.t
963 $(CXXLINK) -Bgcctestdir/ basic_test.o -T $(srcdir)/script_test_3.t
964script_test_3.stdout: script_test_3
2cefc357 965 $(TEST_READELF) -SlW script_test_3 > script_test_3.stdout
09124467 966
e6188289
ILT
967check_SCRIPTS += script_test_4.sh
968check_DATA += script_test_4.stdout
72fef11a 969MOSTLYCLEANFILES += script_test_4
e6188289
ILT
970script_test_4: basic_test.o gcctestdir/ld $(srcdir)/script_test_4.t
971 $(CXXLINK) -Bgcctestdir/ basic_test.o -T $(srcdir)/script_test_4.t
972script_test_4.stdout: script_test_4
973 $(TEST_READELF) -SlW script_test_4 > script_test_4.stdout
974
401a9a73
CC
975check_SCRIPTS += script_test_5.sh
976check_DATA += script_test_5.stdout
72fef11a 977MOSTLYCLEANFILES += script_test_5
401a9a73
CC
978script_test_5: script_test_5.o gcctestdir/ld $(srcdir)/script_test_5.t
979 $(CXXLINK) -Bgcctestdir/ script_test_5.o -T $(srcdir)/script_test_5.t
980script_test_5.stdout: script_test_5
981 $(TEST_READELF) -SW script_test_5 > script_test_5.stdout
982
c82fbeee
CS
983# Test --dynamic-list, --dynamic-list-data, --dynamic-list-cpp-new,
984# and --dynamic-list-cpp-typeinfo
985
986check_SCRIPTS += dynamic_list.sh
987check_DATA += dynamic_list.stdout
72fef11a 988MOSTLYCLEANFILES += dynamic_list dynamic_list.stdout
c82fbeee
CS
989dynamic_list: basic_test.o gcctestdir/ld $(srcdir)/dynamic_list.t
990 $(CXXLINK) -Bgcctestdir/ basic_test.o \
991 -Wl,--dynamic-list $(srcdir)/dynamic_list.t \
992 -Wl,--dynamic-list-data \
993 -Wl,--dynamic-list-cpp-new \
994 -Wl,--dynamic-list-cpp-typeinfo
995dynamic_list.stdout: dynamic_list
996 $(TEST_READELF) -DWs dynamic_list > dynamic_list.stdout
997
fbd8a257 998check_PROGRAMS += thin_archive_test_1
72fef11a
CC
999MOSTLYCLEANFILES += libthin1.a libthin3.a libthinall.a \
1000 alt/thin_archive_test_2.o alt/thin_archive_test_4.o \
1001 alt/libthin2.a alt/libthin4.a
fbd8a257
CC
1002thin_archive_test_1_SOURCES = thin_archive_main.cc
1003thin_archive_test_1_DEPENDENCIES = gcctestdir/ld libthin1.a alt/libthin2.a
1004thin_archive_test_1_LDFLAGS = -Bgcctestdir/ -Lalt
1005thin_archive_test_1_LDADD = libthin1.a -lthin2
1006
1007check_PROGRAMS += thin_archive_test_2
1008thin_archive_test_2_SOURCES = thin_archive_main.cc
1009thin_archive_test_2_DEPENDENCIES = gcctestdir/ld libthinall.a
1010thin_archive_test_2_LDFLAGS = -Bgcctestdir/ -L.
1011thin_archive_test_2_LDADD = -lthinall
1012
1013libthin1.a: thin_archive_test_1.o alt/thin_archive_test_2.o
1014 rm -f $@
1015 $(TEST_AR) crT $@ $^
1016alt/libthin2.a: thin_archive_test_3.o alt/thin_archive_test_4.o
1017 rm -f $@
1018 $(TEST_AR) crT $@ $^
1019libthin3.a: thin_archive_test_1.o alt/thin_archive_test_4.o
1020 rm -f $@
1021 $(TEST_AR) crT $@ $^
1022alt/libthin4.a: alt/thin_archive_test_2.o thin_archive_test_3.o
1023 rm -f $@
1024 $(TEST_AR) crT $@ $^
1025libthinall.a: libthin3.a alt/libthin4.a
1026 rm -f $@
1027 $(TEST_AR) crT $@ $^
1028alt/thin_archive_test_2.o: thin_archive_test_2.cc
1029 test -d alt || mkdir -p alt
1030 $(CXXCOMPILE) -c -o $@ $<
1031alt/thin_archive_test_4.o: thin_archive_test_4.cc
1032 test -d alt || mkdir -p alt
1033 $(CXXCOMPILE) -c -o $@ $<
1034
89fc3421
CC
1035if PLUGINS
1036
1037check_PROGRAMS += plugin_test_1
1038check_SCRIPTS += plugin_test_1.sh
1039check_DATA += plugin_test_1.err
1040MOSTLYCLEANFILES += plugin_test_1.err
abc8dcba
CC
1041plugin_test_1: two_file_test_main.o two_file_test_1.syms two_file_test_1b.syms two_file_test_2.syms empty.syms gcctestdir/ld plugin_test.so
1042 $(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle,--plugin,"./plugin_test.so",--plugin-opt,"_Z4f13iv" two_file_test_main.o two_file_test_1.syms two_file_test_1b.syms two_file_test_2.syms empty.syms 2>plugin_test_1.err
89fc3421
CC
1043plugin_test_1.err: plugin_test_1
1044 @touch plugin_test_1.err
1045
1046check_PROGRAMS += plugin_test_2
1047check_SCRIPTS += plugin_test_2.sh
1048check_DATA += plugin_test_2.err
1049MOSTLYCLEANFILES += plugin_test_2.err
1050plugin_test_2: two_file_test_main.o two_file_test_1.syms two_file_test_1b.syms two_file_shared_2.so gcctestdir/ld plugin_test.so
1051 $(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle,-R,.,--plugin,"./plugin_test.so" two_file_test_main.o two_file_test_1.syms two_file_test_1b.syms two_file_shared_2.so 2>plugin_test_2.err
1052plugin_test_2.err: plugin_test_2
1053 @touch plugin_test_2.err
1054
d66a9eb3
CC
1055check_PROGRAMS += plugin_test_3
1056check_SCRIPTS += plugin_test_3.sh
1057check_DATA += plugin_test_3.err
1058MOSTLYCLEANFILES += plugin_test_3.err
1059plugin_test_3: two_file_test_main.o two_file_test_1.syms two_file_test_1b.syms two_file_test_2.syms empty.syms gcctestdir/ld plugin_test.so
1060 $(CXXLINK) -Bgcctestdir/ -Wl,--export-dynamic -Wl,--no-demangle,--plugin,"./plugin_test.so",--plugin-opt,"_Z4f13iv" two_file_test_main.o two_file_test_1.syms two_file_test_1b.syms two_file_test_2.syms empty.syms 2>plugin_test_3.err
1061plugin_test_3.err: plugin_test_3
1062 @touch plugin_test_3.err
1063
0f7c0701
CC
1064check_PROGRAMS += plugin_test_4
1065check_SCRIPTS += plugin_test_4.sh
1066check_DATA += plugin_test_4.err
72fef11a 1067MOSTLYCLEANFILES += plugin_test_4.a plugin_test_4.err
0f7c0701
CC
1068plugin_test_4: two_file_test_main.o plugin_test_4.a gcctestdir/ld plugin_test.so
1069 $(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle,--plugin,"./plugin_test.so",--plugin-opt,"_Z4f13iv" two_file_test_main.o -Wl,--whole-archive,plugin_test_4.a,--no-whole-archive 2>plugin_test_4.err
1070plugin_test_4.err: plugin_test_4
1071 @touch plugin_test_4.err
1072
1073plugin_test_4.a: two_file_test_1.syms two_file_test_1b.syms two_file_test_2.syms
1074 $(TEST_AR) cr $@ $^
1075
89fc3421
CC
1076plugin_test.so: plugin_test.o
1077 $(LINK) -Bgcctestdir/ -shared plugin_test.o
1078plugin_test.o: plugin_test.c
1079 $(COMPILE) -O0 -c -fpic -o $@ $<
1080
1081two_file_test_main.syms: two_file_test_main.o
1082 $(TEST_READELF) -sW $< >$@ 2>/dev/null
1083two_file_test_1.syms: two_file_test_1.o
1084 $(TEST_READELF) -sW $< >$@ 2>/dev/null
1085two_file_test_1b.syms: two_file_test_1b.o
1086 $(TEST_READELF) -sW $< >$@ 2>/dev/null
1087two_file_test_2.syms: two_file_test_2.o
1088 $(TEST_READELF) -sW $< >$@ 2>/dev/null
abc8dcba
CC
1089empty.syms:
1090 @echo "" >empty.syms
1091 @echo "Symbol table" >>empty.syms
89fc3421
CC
1092
1093endif PLUGINS
1094
65514900
CC
1095check_PROGRAMS += exclude_libs_test
1096check_SCRIPTS += exclude_libs_test.sh
1097check_DATA += exclude_libs_test.syms
1098MOSTLYCLEANFILES += exclude_libs_test.syms libexclude_libs_test_1.a \
2fdd743f 1099 libexclude_libs_test_2.a alt/libexclude_libs_test_3.a
65514900
CC
1100exclude_libs_test_SOURCES = exclude_libs_test.c
1101exclude_libs_test_DEPENDENCIES = gcctestdir/ld libexclude_libs_test_1.a \
2fdd743f
DK
1102 libexclude_libs_test_2.a alt/libexclude_libs_test_3.a
1103exclude_libs_test_LDFLAGS = -Bgcctestdir/ -L. -Lalt \
1104 -Wl,--exclude-libs,dummy:libexclude_libs_test_1 \
1105 -Wl,--exclude-libs,libexclude_libs_test_3
1106exclude_libs_test_LDADD = -lexclude_libs_test_1 -lexclude_libs_test_2 \
1107 alt/libexclude_libs_test_3.a
65514900
CC
1108exclude_libs_test.syms: exclude_libs_test
1109 $(TEST_READELF) -sW $< >$@ 2>/dev/null
1110libexclude_libs_test_1.a: exclude_libs_test_1.o
1111 $(TEST_AR) rc $@ $^
1112libexclude_libs_test_2.a: exclude_libs_test_2.o
1113 $(TEST_AR) rc $@ $^
2fdd743f
DK
1114alt/libexclude_libs_test_3.a: exclude_libs_test_3.o
1115 test -d alt || mkdir -p alt
1116 $(TEST_AR) rc $@ $^
65514900 1117
805bb01c
DK
1118check_PROGRAMS += local_labels_test
1119local_labels_test.o: ver_test_6.c
1120 $(COMPILE) -g -c -Wa,-L -o $@ $<
1121local_labels_test: local_labels_test.o
1122 $(LINK) -Bgcctestdir/ local_labels_test.o
1123
bb04269c
DK
1124check_PROGRAMS += discard_locals_test
1125check_SCRIPTS += discard_locals_test.sh
1126check_DATA += discard_locals_test.syms
1127MOSTLYCLEANFILES += discard_locals_test.syms
1128discard_locals_test_SOURCES = discard_locals_test.c
1129discard_locals_test_LDFLAGS = -Bgcctestdir/ -Wl,--discard-locals
1130discard_locals_test.syms: discard_locals_test
1131 $(TEST_READELF) -sW $< >$@ 2>/dev/null
1132# '-Wa,-L' is required to preserve the local label used for testing.
1133discard_locals_test.o: discard_locals_test.c
1134 $(COMPILE) -c -Wa,-L -o $@ $<
1135
8a5e3e08
ILT
1136if MCMODEL_MEDIUM
1137check_PROGRAMS += large
1138large_SOURCES = large.c
1139large_CFLAGS = -mcmodel=medium
1140large_DEPENDENCIES = gcctestdir/ld
1141large_LDFLAGS = -Bgcctestdir/
1142endif MCMODEL_MEDIUM
1143
645afe0c
CC
1144# Test that hidden and internal symbols in the main program cannot be
1145# referenced by a shared library.
1146check_SCRIPTS += hidden_test.sh
1147check_DATA += hidden_test.err
1148MOSTLYCLEANFILES += hidden_test hidden_test.err
1149libhidden.so: hidden_test_1.c gcctestdir/ld
1150 $(COMPILE) -Bgcctestdir/ -g -shared -fPIC -w -o $@ $(srcdir)/hidden_test_1.c
1151hidden_test: hidden_test_main.o libhidden.so gcctestdir/ld
1152 $(LINK) -Bgcctestdir/ -Wl,-R,. hidden_test_main.o libhidden.so 2>hidden_test.err
1153hidden_test.err: hidden_test
1154 @touch hidden_test.err
1155
8c604651
CS
1156# Test -retain-symbols-file.
1157check_SCRIPTS += retain_symbols_file_test.sh
1158check_DATA += retain_symbols_file_test.stdout
1159MOSTLYCLEANFILES += retain_symbols_file_test retain_symbols_file_test.in \
1160 retain_symbols_file_test.stdout
1161retain_symbols_file_test.so: basic_pic_test.o gcctestdir/ld
1162 echo 'main' > retain_symbols_file_test.in
1163 echo 't1' >> retain_symbols_file_test.in
1164 echo '_ZN4t16bC1Ev' >> retain_symbols_file_test.in
1165 echo '_ZNK4t20a3getEv' >> retain_symbols_file_test.in
1166 echo '_Z3t18v' >> retain_symbols_file_test.in
1167 echo '__tcf_0' >> retain_symbols_file_test.in
1168 $(CXXLINK) -Bgcctestdir/ -shared -Wl,-retain-symbols-file,retain_symbols_file_test.in basic_pic_test.o
1169retain_symbols_file_test.stdout: retain_symbols_file_test.so
1170 $(TEST_NM) -C retain_symbols_file_test.so > $@
1171
1172
6a89f575
CC
1173# Test that if the output file already exists and is empty,
1174# it will get execute permission.
1175check_PROGRAMS += permission_test
1176permission_test: basic_test.o gcctestdir/ld
1177 umask 022; \
1178 rm -f $@; \
1179 touch $@; \
1180 chmod 600 $@; \
1181 $(CXXLINK) -Bgcctestdir/ basic_test.o
1182
351a8000
ILT
1183endif GCC
1184endif NATIVE_LINKER