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