PR gold/12525
[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 72# The unittests themselves
eb373049 73if NATIVE_OR_CROSS_LINKER
90e24de5
ILT
74if GCC
75
76# Infrastucture needed for the unittests: a directory where the linker
77# is named 'ld'. This is because the -B flag appends 'ld' to its arg.
78gcctestdir/ld: ../ld-new
79 test -d gcctestdir || mkdir -p gcctestdir
80 rm -f gcctestdir/ld
81 (cd gcctestdir && $(LN_S) ../../ld-new ld)
82
472076e4
CC
83# Some tests require the latest features of an in-tree assembler.
84gcctestdir/as: $(TEST_AS)
85 test -d gcctestdir || mkdir -p gcctestdir
86 rm -f gcctestdir/as
87 (cd gcctestdir && $(LN_S) $(abs_top_builddir)/../gas/as-new as)
88
90e24de5
ILT
89endif GCC
90
351a8000 91check_PROGRAMS += object_unittest
5a6f7e2d 92object_unittest_SOURCES = object_unittest.cc
22dc1b09 93
bc644c6c
ILT
94check_PROGRAMS += binary_unittest
95binary_unittest_SOURCES = binary_unittest.cc
96
eb373049 97endif NATIVE_OR_CROSS_LINKER
351a8000
ILT
98
99# ---------------------------------------------------------------------
100# These tests test the output of gold (end-to-end tests). In
101# particular, they make sure that gold can link "difficult" object
102# files, and the resulting object files run correctly. These can only
103# run if we've built ld-new for the native architecture (that is,
104# we're not cross-compiling it), since we run ld-new as part of these
105# tests. We use the gcc-specific flag '-B' to use our linker instead
106# of the default linker, which is why we only run our tests under gcc.
a360aedd 107
e2827e5f 108if NATIVE_LINKER
351a8000 109if GCC
e2827e5f 110
351a8000
ILT
111# Each of these .o's is a useful, small complete program. They're
112# particularly useful for making sure ld-new's flags do what they're
113# supposed to (hence their names), but are used for many tests that
114# don't actually involve analyzing input data.
43771f76
ILT
115flagstest_debug.o: constructor_test.cc
116 $(CXXCOMPILE) -O0 -g -c -o $@ $<
117flagstest_ndebug.o: constructor_test.cc
118 $(CXXCOMPILE) -O0 -c -o $@ $<
119
325e6408
RÁE
120check_SCRIPTS += incremental_test.sh
121check_DATA += incremental_test.stdout
122MOSTLYCLEANFILES += incremental_test
123incremental_test_1.o: incremental_test_1.c
124 $(COMPILE) -O0 -c -ffunction-sections -g -o $@ $<
125incremental_test_2.o: incremental_test_2.c
126 $(COMPILE) -O0 -c -ffunction-sections -g -o $@ $<
127incremental_test: incremental_test_1.o incremental_test_2.o gcctestdir/ld
8c21d9d3 128 $(LINK) -Bgcctestdir/ -Wl,--incremental-full incremental_test_1.o incremental_test_2.o -Wl,-debug 2> incremental_test.cmdline
325e6408
RÁE
129incremental_test.stdout: incremental_test ../incremental-dump
130 ../incremental-dump incremental_test > $@
43771f76 131
531813ad
ST
132check_SCRIPTS += gc_comdat_test.sh
133check_DATA += gc_comdat_test.stdout
72fef11a 134MOSTLYCLEANFILES += gc_comdat_test
531813ad 135gc_comdat_test_1.o: gc_comdat_test_1.cc
4daadc0d 136 $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
531813ad 137gc_comdat_test_2.o: gc_comdat_test_2.cc
4daadc0d 138 $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
531813ad 139gc_comdat_test: gc_comdat_test_1.o gc_comdat_test_2.o gcctestdir/ld
4daadc0d 140 $(CXXLINK) -Bgcctestdir/ -Wl,--gc-sections gc_comdat_test_1.o gc_comdat_test_2.o
531813ad
ST
141gc_comdat_test.stdout: gc_comdat_test
142 $(TEST_NM) -C gc_comdat_test > gc_comdat_test.stdout
143
27721062
ST
144check_SCRIPTS += gc_tls_test.sh
145check_DATA += gc_tls_test.stdout
72fef11a 146MOSTLYCLEANFILES += gc_tls_test
27721062
ST
147gc_tls_test.o: gc_tls_test.cc
148 $(CXXCOMPILE) -O0 -c -g -o $@ $<
149gc_tls_test:gc_tls_test.o gcctestdir/ld
150 $(CXXLINK) -Bgcctestdir/ -Wl,--gc-sections gc_tls_test.o
151gc_tls_test.stdout: gc_tls_test
152 $(TEST_NM) -C gc_tls_test > gc_tls_test.stdout
153
f1ec9ded
ST
154check_SCRIPTS += gc_orphan_section_test.sh
155check_DATA += gc_orphan_section_test.stdout
156MOSTLYCLEANFILES += gc_orphan_section_test
157gc_orphan_section_test.o: gc_orphan_section_test.cc
158 $(CXXCOMPILE) -O0 -c -g -o $@ $<
159gc_orphan_section_test:gc_orphan_section_test.o gcctestdir/ld
160 $(CXXLINK) -Bgcctestdir/ -Wl,--gc-sections gc_orphan_section_test.o
161gc_orphan_section_test.stdout: gc_orphan_section_test
162 $(TEST_NM) gc_orphan_section_test > gc_orphan_section_test.stdout
163
ef15dade
ST
164check_SCRIPTS += icf_test.sh
165check_DATA += icf_test.stdout
72fef11a 166MOSTLYCLEANFILES += icf_test
ef15dade
ST
167icf_test.o: icf_test.cc
168 $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
169icf_test: icf_test.o gcctestdir/ld
032ce4e9 170 $(CXXLINK) -Bgcctestdir/ -Wl,--icf=all icf_test.o
ef15dade
ST
171icf_test.stdout: icf_test
172 $(TEST_NM) -C icf_test > icf_test.stdout
173
48c187ce
ST
174check_SCRIPTS += icf_keep_unique_test.sh
175check_DATA += icf_keep_unique_test.stdout
72fef11a 176MOSTLYCLEANFILES += icf_keep_unique_test
48c187ce
ST
177icf_keep_unique_test.o: icf_keep_unique_test.cc
178 $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
179icf_keep_unique_test: icf_keep_unique_test.o gcctestdir/ld
032ce4e9 180 $(CXXLINK) -Bgcctestdir/ -Wl,--icf=all -Wl,--keep-unique,_Z11unique_funcv icf_keep_unique_test.o
48c187ce
ST
181icf_keep_unique_test.stdout: icf_keep_unique_test
182 $(TEST_NM) -C icf_keep_unique_test > icf_keep_unique_test.stdout
531813ad 183
032ce4e9 184check_SCRIPTS += icf_safe_test.sh
21bb3914 185check_DATA += icf_safe_test_1.stdout icf_safe_test_2.stdout
032ce4e9 186MOSTLYCLEANFILES += icf_safe_test
21bb3914 187icf_safe_test.o: icf_safe_test.cc
032ce4e9
ST
188 $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
189icf_safe_test: icf_safe_test.o gcctestdir/ld
190 $(CXXLINK) -Bgcctestdir/ -Wl,--icf=safe icf_safe_test.o
21bb3914
ST
191icf_safe_test_1.stdout: icf_safe_test
192 $(TEST_NM) icf_safe_test > icf_safe_test_1.stdout
193icf_safe_test_2.stdout: icf_safe_test
194 $(TEST_READELF) -h icf_safe_test > icf_safe_test_2.stdout
195
196check_SCRIPTS += icf_safe_so_test.sh
197check_DATA += icf_safe_so_test_1.stdout icf_safe_so_test_2.stdout
198MOSTLYCLEANFILES += icf_safe_so_test
199icf_safe_so_test.o: icf_safe_so_test.cc
200 $(CXXCOMPILE) -O0 -c -ffunction-sections -fPIC -g -o $@ $<
201icf_safe_so_test: icf_safe_so_test.o gcctestdir/ld
202 $(CXXLINK) -Bgcctestdir/ -Wl,--icf=safe icf_safe_so_test.o -fPIC -shared
203icf_safe_so_test_1.stdout: icf_safe_so_test
204 $(TEST_NM) icf_safe_so_test > icf_safe_so_test_1.stdout
205icf_safe_so_test_2.stdout: icf_safe_so_test
206 $(TEST_READELF) -h icf_safe_so_test > icf_safe_so_test_2.stdout
032ce4e9 207
6e9ba2ca
ST
208check_SCRIPTS += final_layout.sh
209check_DATA += final_layout.stdout
210MOSTLYCLEANFILES += final_layout
211final_layout.o: final_layout.cc
212 $(CXXCOMPILE) -O0 -c -ffunction-sections -fdata-sections -g -o $@ $<
213final_layout_sequence.txt:
214 (echo "*_Z3barv*" && echo ".text._Z3bazv" && echo "*_Z3foov*" && echo "*global_varb*" && echo "*global_vara*" && echo "*global_varc*") > final_layout_sequence.txt
215final_layout: final_layout.o final_layout_sequence.txt gcctestdir/ld
216 $(CXXLINK) -Bgcctestdir/ -Wl,--section-ordering-file,final_layout_sequence.txt final_layout.o
217final_layout.stdout: final_layout
30e1f9e6 218 $(TEST_NM) -n final_layout > final_layout.stdout
6e9ba2ca 219
2253bfba 220check_PROGRAMS += icf_virtual_function_folding_test
ce97fa81
ST
221MOSTLYCLEANFILES += icf_virtual_function_folding_test
222icf_virtual_function_folding_test.o: icf_virtual_function_folding_test.cc
223 $(CXXCOMPILE) -O0 -c -ffunction-sections -fPIE -g -o $@ $<
224icf_virtual_function_folding_test: icf_virtual_function_folding_test.o gcctestdir/ld
225 $(CXXLINK) -Bgcctestdir/ -Wl,--icf=all icf_virtual_function_folding_test.o -pie
226
227check_SCRIPTS += icf_preemptible_functions_test.sh
228check_DATA += icf_preemptible_functions_test.stdout
229MOSTLYCLEANFILES += icf_preemptible_functions_test
230icf_preemptible_functions_test.o: icf_preemptible_functions_test.cc
231 $(CXXCOMPILE) -O0 -c -ffunction-sections -fPIC -g -o $@ $<
232icf_preemptible_functions_test: icf_preemptible_functions_test.o gcctestdir/ld
233 $(CXXLINK) -Bgcctestdir/ -Wl,--icf=all icf_preemptible_functions_test.o -fPIC -shared
234icf_preemptible_functions_test.stdout: icf_preemptible_functions_test
235 $(TEST_NM) icf_preemptible_functions_test > icf_preemptible_functions_test.stdout
236
237check_SCRIPTS += icf_string_merge_test.sh
238check_DATA += icf_string_merge_test.stdout
239MOSTLYCLEANFILES += icf_string_merge_test
240icf_string_merge_test.o: icf_string_merge_test.cc
241 $(CXXCOMPILE) -O0 -c -ffunction-sections -fPIC -g -o $@ $<
242icf_string_merge_test: icf_string_merge_test.o gcctestdir/ld
243 $(CXXLINK) -Bgcctestdir/ -Wl,--icf=all icf_string_merge_test.o
244icf_string_merge_test.stdout: icf_string_merge_test
245 $(TEST_NM) icf_string_merge_test > icf_string_merge_test.stdout
246
41cbeecc
ST
247check_SCRIPTS += icf_sht_rel_addend_test.sh
248check_DATA += icf_sht_rel_addend_test.stdout
249MOSTLYCLEANFILES += icf_sht_rel_addend_test
250icf_sht_rel_addend_test_1.o: icf_sht_rel_addend_test_1.cc
251 $(CXXCOMPILE) -O0 -c -ffunction-sections -fPIC -g -o $@ $<
252icf_sht_rel_addend_test_2.o: icf_sht_rel_addend_test_2.cc
253 $(CXXCOMPILE) -O0 -c -ffunction-sections -fPIC -g -o $@ $<
254icf_sht_rel_addend_test: icf_sht_rel_addend_test_1.o icf_sht_rel_addend_test_2.o gcctestdir/ld
255 $(CXXLINK) -Bgcctestdir/ -Wl,--icf=all icf_sht_rel_addend_test_1.o icf_sht_rel_addend_test_2.o
256icf_sht_rel_addend_test.stdout: icf_sht_rel_addend_test
257 $(TEST_NM) icf_sht_rel_addend_test > icf_sht_rel_addend_test.stdout
258
351a8000 259check_PROGRAMS += basic_test
351a8000 260check_PROGRAMS += basic_pic_test
56ba9a23 261basic_test.o: basic_test.cc
22dc1b09 262 $(CXXCOMPILE) -O0 -c -o $@ $<
56ba9a23
ILT
263basic_test: basic_test.o gcctestdir/ld
264 $(CXXLINK) -Bgcctestdir/ basic_test.o
328c7c2f
ILT
265
266if HAVE_STATIC
267check_PROGRAMS += basic_static_test
56ba9a23
ILT
268basic_static_test: basic_test.o gcctestdir/ld
269 $(CXXLINK) -Bgcctestdir/ -static basic_test.o
328c7c2f 270endif
22dc1b09 271
56ba9a23 272basic_pic_test.o: basic_test.cc
22dc1b09 273 $(CXXCOMPILE) -O0 -c -fpic -o $@ $<
56ba9a23
ILT
274basic_pic_test: basic_pic_test.o gcctestdir/ld
275 $(CXXLINK) -Bgcctestdir/ basic_pic_test.o
328c7c2f
ILT
276
277if HAVE_STATIC
278check_PROGRAMS += basic_static_pic_test
56ba9a23
ILT
279basic_static_pic_test: basic_pic_test.o gcctestdir/ld
280 $(CXXLINK) -Bgcctestdir/ -static basic_pic_test.o
328c7c2f 281endif
22dc1b09 282
374ad285
ILT
283check_PROGRAMS += basic_pie_test
284basic_pie_test.o: basic_test.cc
285 $(CXXCOMPILE) -O0 -c -fpie -o $@ $<
286basic_pie_test: basic_pie_test.o gcctestdir/ld
287 $(CXXLINK) -Bgcctestdir/ -pie basic_pie_test.o
351a8000
ILT
288
289check_PROGRAMS += constructor_test
d5026652
ILT
290constructor_test_SOURCES = constructor_test.cc
291constructor_test_DEPENDENCIES = gcctestdir/ld
292constructor_test_LDFLAGS = -Bgcctestdir/
1abce4a6 293constructor_test_LDADD =
d5026652 294
328c7c2f
ILT
295if HAVE_STATIC
296check_PROGRAMS += constructor_static_test
351a8000
ILT
297constructor_static_test_SOURCES = $(constructor_test_SOURCES)
298constructor_static_test_DEPENDENCIES = $(constructor_test_DEPENDENCIES)
299constructor_static_test_LDFLAGS = $(constructor_test_LDFLAGS) -static
1abce4a6 300constructor_static_test_LDADD = $(constructor_test_LDADD)
328c7c2f 301endif
351a8000
ILT
302
303check_PROGRAMS += two_file_test
351a8000 304check_PROGRAMS += two_file_pic_test
3bd52c28
ILT
305two_file_test_SOURCES = \
306 two_file_test_1.cc \
03e8f2b2 307 two_file_test_1b.cc \
3bd52c28
ILT
308 two_file_test_2.cc \
309 two_file_test_main.cc \
310 two_file_test.h
311two_file_test_DEPENDENCIES = gcctestdir/ld
312two_file_test_LDFLAGS = -Bgcctestdir/
1abce4a6 313two_file_test_LDADD =
3bd52c28 314
328c7c2f
ILT
315if HAVE_STATIC
316check_PROGRAMS += two_file_static_test
351a8000
ILT
317two_file_static_test_SOURCES = $(two_file_test_SOURCES)
318two_file_static_test_DEPENDENCIES = $(two_file_test_DEPENDENCIES)
319two_file_static_test_LDFLAGS = $(two_file_test_LDFLAGS) -static
1abce4a6 320two_file_static_test_LDADD = $(two_file_test_LDADD)
328c7c2f 321endif
f958d5fc
ILT
322
323two_file_pic_test_SOURCES = two_file_test_main.cc
324two_file_pic_test_DEPENDENCIES = \
03e8f2b2 325 gcctestdir/ld two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o
f958d5fc 326two_file_pic_test_LDFLAGS = -Bgcctestdir/
03e8f2b2 327two_file_pic_test_LDADD = two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o
f958d5fc 328
351a8000
ILT
329
330check_PROGRAMS += two_file_shared_1_test
331check_PROGRAMS += two_file_shared_2_test
332check_PROGRAMS += two_file_shared_1_pic_2_test
333check_PROGRAMS += two_file_shared_2_pic_1_test
334check_PROGRAMS += two_file_same_shared_test
335check_PROGRAMS += two_file_separate_shared_12_test
336check_PROGRAMS += two_file_separate_shared_21_test
337two_file_test_1_pic.o: two_file_test_1.cc
338 $(CXXCOMPILE) -c -fpic -o $@ $<
03e8f2b2
ILT
339two_file_test_1b_pic.o: two_file_test_1b.cc
340 $(CXXCOMPILE) -c -fpic -o $@ $<
351a8000
ILT
341two_file_test_2_pic.o: two_file_test_2.cc
342 $(CXXCOMPILE) -c -fpic -o $@ $<
03e8f2b2
ILT
343two_file_shared_1.so: two_file_test_1_pic.o two_file_test_1b_pic.o gcctestdir/ld
344 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1_pic.o two_file_test_1b_pic.o
351a8000
ILT
345two_file_shared_2.so: two_file_test_2_pic.o gcctestdir/ld
346 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_2_pic.o
03e8f2b2
ILT
347two_file_shared.so: two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o gcctestdir/ld
348 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o
351a8000 349
3bd52c28
ILT
350two_file_shared_1_test_SOURCES = two_file_test_2.cc two_file_test_main.cc
351two_file_shared_1_test_DEPENDENCIES = gcctestdir/ld two_file_shared_1.so
352two_file_shared_1_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
353two_file_shared_1_test_LDADD = two_file_shared_1.so
354
03e8f2b2 355two_file_shared_2_test_SOURCES = two_file_test_1.cc two_file_test_1b.cc two_file_test_main.cc
3bd52c28
ILT
356two_file_shared_2_test_DEPENDENCIES = gcctestdir/ld two_file_shared_2.so
357two_file_shared_2_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
358two_file_shared_2_test_LDADD = two_file_shared_2.so
359
386c048c
ILT
360two_file_shared_1_pic_2_test_SOURCES = two_file_test_main.cc
361two_file_shared_1_pic_2_test_DEPENDENCIES = \
2f2de248 362 gcctestdir/ld two_file_shared_2.so two_file_test_1_pic.o two_file_test_1b_pic.o
386c048c 363two_file_shared_1_pic_2_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
03e8f2b2 364two_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
365
366two_file_shared_2_pic_1_test_SOURCES = two_file_test_main.cc
367two_file_shared_2_pic_1_test_DEPENDENCIES = \
368 gcctestdir/ld two_file_shared_2.so two_file_test_2_pic.o
369two_file_shared_2_pic_1_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
370two_file_shared_2_pic_1_test_LDADD = two_file_test_2_pic.o two_file_shared_1.so
371
3bd52c28
ILT
372two_file_same_shared_test_SOURCES = two_file_test_main.cc
373two_file_same_shared_test_DEPENDENCIES = gcctestdir/ld two_file_shared.so
374two_file_same_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
375two_file_same_shared_test_LDADD = two_file_shared.so
376
377two_file_separate_shared_12_test_SOURCES = two_file_test_main.cc
378two_file_separate_shared_12_test_DEPENDENCIES = \
379 gcctestdir/ld two_file_shared_1.so two_file_shared_2.so
380two_file_separate_shared_12_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
381two_file_separate_shared_12_test_LDADD = \
382 two_file_shared_1.so two_file_shared_2.so
383
384two_file_separate_shared_21_test_SOURCES = two_file_test_main.cc
385two_file_separate_shared_21_test_DEPENDENCIES = \
386 gcctestdir/ld two_file_shared_1.so two_file_shared_2.so
387two_file_separate_shared_21_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
388two_file_separate_shared_21_test_LDADD = \
389 two_file_shared_2.so two_file_shared_1.so
390
6a74a719
ILT
391check_PROGRAMS += two_file_relocatable_test
392two_file_relocatable_test_SOURCES = two_file_test_main.cc
393two_file_relocatable_test_DEPENDENCIES = \
394 gcctestdir/ld two_file_relocatable.o
395two_file_relocatable_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
396two_file_relocatable_test_LDADD = two_file_relocatable.o
397two_file_relocatable.o: gcctestdir/ld two_file_test_1.o two_file_test_1b.o two_file_test_2.o
398 gcctestdir/ld -r -o $@ two_file_test_1.o two_file_test_1b.o two_file_test_2.o
399
374ad285
ILT
400check_PROGRAMS += two_file_pie_test
401two_file_test_1_pie.o: two_file_test_1.cc
402 $(CXXCOMPILE) -c -fpie -o $@ $<
403two_file_test_1b_pie.o: two_file_test_1b.cc
404 $(CXXCOMPILE) -c -fpie -o $@ $<
405two_file_test_2_pie.o: two_file_test_2.cc
406 $(CXXCOMPILE) -c -fpie -o $@ $<
407two_file_test_main_pie.o: two_file_test_main.cc
408 $(CXXCOMPILE) -c -fpie -o $@ $<
409two_file_pie_test: two_file_test_1_pie.o two_file_test_1b_pie.o \
410 two_file_test_2_pie.o two_file_test_main_pie.o gcctestdir/ld
411 $(CXXLINK) -Bgcctestdir/ -pie two_file_test_1_pie.o two_file_test_1b_pie.o two_file_test_2_pie.o two_file_test_main_pie.o
412
031cdbed
ILT
413check_SCRIPTS += two_file_shared.sh
414check_DATA += two_file_shared.dbg
72fef11a 415MOSTLYCLEANFILES += two_file_shared.dbg
031cdbed
ILT
416two_file_shared.dbg: two_file_shared.so
417 $(TEST_READELF) -w $< >$@ 2>/dev/null
418
63402fe4
ILT
419# The nonpic tests will fail on platforms which can not put non-PIC
420# code into shared libraries, so we just don't run them in that case.
63402fe4 421if FN_PTRS_IN_SO_WITHOUT_PIC
3bd52c28 422
351a8000
ILT
423check_PROGRAMS += two_file_shared_1_nonpic_test
424check_PROGRAMS += two_file_shared_2_nonpic_test
425check_PROGRAMS += two_file_same_shared_nonpic_test
426check_PROGRAMS += two_file_separate_shared_12_nonpic_test
427check_PROGRAMS += two_file_separate_shared_21_nonpic_test
03e8f2b2
ILT
428check_PROGRAMS += two_file_mixed_shared_test
429check_PROGRAMS += two_file_mixed_2_shared_test
351a8000 430two_file_shared_1_nonpic.so: two_file_test_1.o gcctestdir/ld
611062c0 431 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1.o two_file_test_1b.o -Wl,-z,notext
351a8000
ILT
432two_file_shared_2_nonpic.so: two_file_test_2.o gcctestdir/ld
433 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_2.o
03e8f2b2 434two_file_shared_nonpic.so: two_file_test_1.o two_file_test_1b.o two_file_test_2.o gcctestdir/ld
611062c0 435 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1.o two_file_test_1b.o two_file_test_2.o -Wl,-z,notext
03e8f2b2 436two_file_shared_mixed.so: two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2.o gcctestdir/ld
611062c0 437 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2.o -Wl,-z,notext
03e8f2b2 438two_file_shared_mixed_1.so: two_file_test_1.o two_file_test_1b_pic.o two_file_shared_2.so gcctestdir/ld
611062c0 439 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1.o two_file_test_1b_pic.o two_file_shared_2.so -Wl,-z,notext
351a8000 440
3bd52c28
ILT
441two_file_shared_1_nonpic_test_SOURCES = \
442 two_file_test_2.cc two_file_test_main.cc
443two_file_shared_1_nonpic_test_DEPENDENCIES = \
444 gcctestdir/ld two_file_shared_1_nonpic.so
445two_file_shared_1_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
446two_file_shared_1_nonpic_test_LDADD = two_file_shared_1_nonpic.so
447
448two_file_shared_2_nonpic_test_SOURCES = \
03e8f2b2 449 two_file_test_1.cc two_file_test_1b.cc two_file_test_main.cc
3bd52c28
ILT
450two_file_shared_2_nonpic_test_DEPENDENCIES = \
451 gcctestdir/ld two_file_shared_2_nonpic.so
452two_file_shared_2_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
453two_file_shared_2_nonpic_test_LDADD = two_file_shared_2_nonpic.so
454
455two_file_same_shared_nonpic_test_SOURCES = two_file_test_main.cc
456two_file_same_shared_nonpic_test_DEPENDENCIES = \
457 gcctestdir/ld two_file_shared_nonpic.so
458two_file_same_shared_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
459two_file_same_shared_nonpic_test_LDADD = two_file_shared_nonpic.so
460
461two_file_separate_shared_12_nonpic_test_SOURCES = two_file_test_main.cc
462two_file_separate_shared_12_nonpic_test_DEPENDENCIES = \
463 gcctestdir/ld two_file_shared_1_nonpic.so two_file_shared_2_nonpic.so
464two_file_separate_shared_12_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
465two_file_separate_shared_12_nonpic_test_LDADD = \
466 two_file_shared_1_nonpic.so two_file_shared_2_nonpic.so
467
468two_file_separate_shared_21_nonpic_test_SOURCES = two_file_test_main.cc
469two_file_separate_shared_21_nonpic_test_DEPENDENCIES = \
470 gcctestdir/ld two_file_shared_1_nonpic.so two_file_shared_2_nonpic.so
471two_file_separate_shared_21_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
472two_file_separate_shared_21_nonpic_test_LDADD = \
473 two_file_shared_2_nonpic.so two_file_shared_1_nonpic.so
474
03e8f2b2
ILT
475two_file_mixed_shared_test_SOURCES = two_file_test_main.cc
476two_file_mixed_shared_test_DEPENDENCIES = gcctestdir/ld two_file_shared_mixed.so
477two_file_mixed_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
478two_file_mixed_shared_test_LDADD = two_file_shared_mixed.so
479
480two_file_mixed_2_shared_test_SOURCES = two_file_test_main.cc
481two_file_mixed_2_shared_test_DEPENDENCIES = gcctestdir/ld two_file_shared_mixed_1.so two_file_shared_2.so
482two_file_mixed_2_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
483two_file_mixed_2_shared_test_LDADD = two_file_shared_mixed_1.so two_file_shared_2.so
484
d89051bd
CC
485check_PROGRAMS += two_file_mixed_pie_test
486two_file_mixed_pie_test: two_file_test_1.o two_file_test_1b_pie.o \
487 two_file_test_main_pie.o two_file_shared_2.so gcctestdir/ld
488 $(CXXLINK) -Bgcctestdir/ -Wl,-R,. -pie two_file_test_1.o two_file_test_1b_pie.o two_file_test_main_pie.o two_file_shared_2.so
489
351a8000 490endif FN_PTRS_IN_SO_WITHOUT_PIC
3bd52c28 491
6835af53
ILT
492check_PROGRAMS += two_file_strip_test
493two_file_strip_test: two_file_test
494 $(TEST_STRIP) -o two_file_strip_test two_file_test
495
496check_PROGRAMS += two_file_same_shared_strip_test
497two_file_same_shared_strip_test_SOURCES = two_file_test_main.cc
498two_file_same_shared_strip_test_DEPENDENCIES = \
499 gcctestdir/ld two_file_shared_strip.so
500two_file_same_shared_strip_test_LDFLAGS = -Bgcctestdir/ -Wl,-R.
501two_file_same_shared_strip_test_LDADD = two_file_shared_strip.so
502two_file_shared_strip.so: two_file_shared.so
503 $(TEST_STRIP) -S -o two_file_shared_strip.so two_file_shared.so
504
49bdd526
ILT
505check_PROGRAMS += common_test_1
506common_test_1_SOURCES = common_test_1.c
507common_test_1_DEPENDENCIES = gcctestdir/ld
508common_test_1_LDFLAGS = -Bgcctestdir/
1abce4a6 509common_test_1_LDADD =
351a8000 510
eda294df
ILT
511check_PROGRAMS += common_test_2
512common_test_2_SOURCES = common_test_1.c
513common_test_2_DEPENDENCIES = common_test_2.so common_test_3.so gcctestdir/ld
514common_test_2_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
515common_test_2_LDADD = common_test_2.so common_test_3.so
516common_test_2_pic.o: common_test_2.c
517 $(COMPILE) -c -fpic -o $@ $<
518common_test_2.so: common_test_2_pic.o common_test_3.so gcctestdir/ld
519 $(LINK) -Bgcctestdir/ -shared common_test_2_pic.o common_test_3.so
520common_test_3_pic.o: common_test_3.c
521 $(COMPILE) -c -fpic -o $@ $<
522common_test_3.so: common_test_3_pic.o ver_test_2.script gcctestdir/ld
523 $(LINK) -Bgcctestdir/ -shared common_test_3_pic.o -Wl,--version-script,$(srcdir)/ver_test_2.script
524
351a8000 525check_PROGRAMS += exception_test
351a8000
ILT
526check_PROGRAMS += exception_shared_1_test
527check_PROGRAMS += exception_shared_2_test
528check_PROGRAMS += exception_same_shared_test
529check_PROGRAMS += exception_separate_shared_12_test
530check_PROGRAMS += exception_separate_shared_21_test
531exception_test_1_pic.o: exception_test_1.cc
532 $(CXXCOMPILE) -c -fpic -o $@ $<
533exception_test_2_pic.o: exception_test_2.cc
534 $(CXXCOMPILE) -c -fpic -o $@ $<
535exception_shared_1.so: exception_test_1_pic.o gcctestdir/ld
536 $(CXXLINK) -Bgcctestdir/ -shared exception_test_1_pic.o
537exception_shared_2.so: exception_test_2_pic.o gcctestdir/ld
538 $(CXXLINK) -Bgcctestdir/ -shared exception_test_2_pic.o
539exception_shared.so: exception_test_1_pic.o exception_test_2_pic.o gcctestdir/ld
540 $(CXXLINK) -Bgcctestdir/ -shared exception_test_1_pic.o exception_test_2_pic.o
63402fe4 541
3151305a
ILT
542exception_test_SOURCES = \
543 exception_test_main.cc \
544 exception_test_1.cc \
545 exception_test_2.cc \
546 exception_test.h
547exception_test_DEPENDENCIES = gcctestdir/ld
548exception_test_LDFLAGS = -Bgcctestdir/
1abce4a6 549exception_test_LDADD =
3151305a 550
328c7c2f
ILT
551if HAVE_STATIC
552check_PROGRAMS += exception_static_test
351a8000
ILT
553exception_static_test_SOURCES = $(exception_test_SOURCES)
554exception_static_test_DEPENDENCIES = $(exception_test_DEPENDENCIES)
555exception_static_test_LDFLAGS = $(exception_test_LDFLAGS) -static
1abce4a6 556exception_static_test_LDADD = $(exception_test_LDADD)
328c7c2f 557endif
3151305a
ILT
558
559exception_shared_1_test_SOURCES = exception_test_2.cc exception_test_main.cc
560exception_shared_1_test_DEPENDENCIES = gcctestdir/ld exception_shared_1.so
561exception_shared_1_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
562exception_shared_1_test_LDADD = exception_shared_1.so
563
564exception_shared_2_test_SOURCES = exception_test_1.cc exception_test_main.cc
565exception_shared_2_test_DEPENDENCIES = gcctestdir/ld exception_shared_2.so
566exception_shared_2_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
567exception_shared_2_test_LDADD = exception_shared_2.so
568
569exception_same_shared_test_SOURCES = exception_test_main.cc
570exception_same_shared_test_DEPENDENCIES = gcctestdir/ld exception_shared.so
571exception_same_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
572exception_same_shared_test_LDADD = exception_shared.so
573
574exception_separate_shared_12_test_SOURCES = exception_test_main.cc
575exception_separate_shared_12_test_DEPENDENCIES = \
576 gcctestdir/ld exception_shared_1.so exception_shared_2.so
577exception_separate_shared_12_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
578exception_separate_shared_12_test_LDADD = \
579 exception_shared_1.so exception_shared_2.so
580
581exception_separate_shared_21_test_SOURCES = exception_test_main.cc
582exception_separate_shared_21_test_DEPENDENCIES = \
583 gcctestdir/ld exception_shared_1.so exception_shared_2.so
584exception_separate_shared_21_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
585exception_separate_shared_21_test_LDADD = \
586 exception_shared_2.so exception_shared_1.so
587
3151305a 588
351a8000 589check_PROGRAMS += weak_test
a360aedd 590weak_test_SOURCES = weak_test.cc
0e470e5c 591weak_test_DEPENDENCIES = gcctestdir/ld
a360aedd 592weak_test_LDFLAGS = -Bgcctestdir/
1abce4a6 593weak_test_LDADD =
a360aedd 594
86925eef 595check_PROGRAMS += weak_undef_test
72fef11a 596MOSTLYCLEANFILES += alt/weak_undef_lib.so
86925eef
CC
597weak_undef_test_SOURCES = weak_undef_test.cc
598weak_undef_test_DEPENDENCIES = gcctestdir/ld weak_undef_lib.so alt/weak_undef_lib.so
599weak_undef_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,alt
600weak_undef_test_LDADD = -L . weak_undef_lib.so
601weak_undef_file1.o: weak_undef_file1.cc
602 $(CXXCOMPILE) -c -fpic -o $@ $<
603weak_undef_file2.o: weak_undef_file2.cc
604 $(CXXCOMPILE) -c -fpic -o $@ $<
605weak_undef_lib.so: weak_undef_file1.o
606 $(CXXLINK) -Bgcctestdir/ -shared weak_undef_file1.o
607alt/weak_undef_lib.so: weak_undef_file2.o
608 test -d alt || mkdir -p alt
609 $(CXXLINK) -Bgcctestdir/ -shared weak_undef_file2.o
351a8000 610
f3c69fca
CC
611if FN_PTRS_IN_SO_WITHOUT_PIC
612check_PROGRAMS += weak_undef_nonpic_test
72fef11a 613MOSTLYCLEANFILES += alt/weak_undef_lib_nonpic.so
f3c69fca
CC
614weak_undef_nonpic_test_SOURCES = weak_undef_test.cc
615weak_undef_nonpic_test_DEPENDENCIES = gcctestdir/ld weak_undef_lib_nonpic.so alt/weak_undef_lib_nonpic.so
616weak_undef_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,alt
617weak_undef_nonpic_test_LDADD = -L . weak_undef_lib_nonpic.so
618weak_undef_file1_nonpic.o: weak_undef_file1.cc
619 $(CXXCOMPILE) -c -o $@ $<
620weak_undef_file2_nonpic.o: weak_undef_file2.cc
621 $(CXXCOMPILE) -c -o $@ $<
622weak_undef_lib_nonpic.so: weak_undef_file1_nonpic.o
611062c0 623 $(CXXLINK) -Bgcctestdir/ -shared weak_undef_file1_nonpic.o -Wl,-z,notext
f3c69fca
CC
624alt/weak_undef_lib_nonpic.so: weak_undef_file2_nonpic.o
625 test -d alt || mkdir -p alt
611062c0 626 $(CXXLINK) -Bgcctestdir/ -shared weak_undef_file2_nonpic.o -Wl,-z,notext
f3c69fca
CC
627endif FN_PTRS_IN_SO_WITHOUT_PIC
628
629
99a37bfd
ILT
630check_PROGRAMS += weak_alias_test
631weak_alias_test_SOURCES = weak_alias_test_main.cc
632weak_alias_test_DEPENDENCIES = \
633 gcctestdir/ld weak_alias_test_1.so weak_alias_test_2.so \
634 weak_alias_test_3.o weak_alias_test_4.so
635weak_alias_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
636weak_alias_test_LDADD = \
637 weak_alias_test_1.so weak_alias_test_2.so weak_alias_test_3.o \
638 weak_alias_test_4.so
639weak_alias_test_1_pic.o: weak_alias_test_1.cc
640 $(CXXCOMPILE) -c -fpic -o $@ $<
de4c45bd 641weak_alias_test_1.so: weak_alias_test_1_pic.o gcctestdir/ld
99a37bfd
ILT
642 $(CXXLINK) -Bgcctestdir/ -shared weak_alias_test_1_pic.o
643weak_alias_test_2_pic.o: weak_alias_test_2.cc
644 $(CXXCOMPILE) -c -fpic -o $@ $<
de4c45bd 645weak_alias_test_2.so: weak_alias_test_2_pic.o gcctestdir/ld
99a37bfd
ILT
646 $(CXXLINK) -Bgcctestdir/ -shared weak_alias_test_2_pic.o
647weak_alias_test_3.o: weak_alias_test_3.cc
648 $(CXXCOMPILE) -c -o $@ $<
649weak_alias_test_4_pic.o: weak_alias_test_4.cc
650 $(CXXCOMPILE) -c -fpic -o $@ $<
de4c45bd 651weak_alias_test_4.so: weak_alias_test_4_pic.o gcctestdir/ld
99a37bfd
ILT
652 $(CXXLINK) -Bgcctestdir/ -shared weak_alias_test_4_pic.o
653
de4c45bd
ILT
654check_SCRIPTS += weak_plt.sh
655check_PROGRAMS += weak_plt
656check_DATA += weak_plt_shared.so
657weak_plt_main_pic.o: weak_plt_main.cc
658 $(CXXCOMPILE) -c -fpic -o $@ $<
659weak_plt: weak_plt_main_pic.o gcctestdir/ld
660 $(CXXLINK) -Bgcctestdir/ weak_plt_main_pic.o
661weak_plt_shared_pic.o: weak_plt_shared.cc
662 $(CXXCOMPILE) -c -fpic -o $@ $<
663weak_plt_shared.so: weak_plt_shared_pic.o gcctestdir/ld
664 $(CXXLINK) -Bgcctestdir/ -shared weak_plt_shared_pic.o
665
f34787f8
ILT
666check_PROGRAMS += copy_test
667copy_test_SOURCES = copy_test.cc
668copy_test_DEPENDENCIES = gcctestdir/ld copy_test_1.so copy_test_2.so
669copy_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
670copy_test_LDADD = copy_test_1.so copy_test_2.so
671copy_test_1_pic.o: copy_test_1.cc
672 $(CXXCOMPILE) -c -fpic -o $@ $<
673copy_test_1.so: gcctestdir/ld copy_test_1_pic.o
674 $(CXXLINK) -Bgcctestdir/ -shared copy_test_1_pic.o
675copy_test_2_pic.o: copy_test_2.cc
676 $(CXXCOMPILE) -c -fpic -o $@ $<
677copy_test_2.so: gcctestdir/ld copy_test_2_pic.o
678 $(CXXLINK) -Bgcctestdir/ -shared copy_test_2_pic.o
679
6eee141f
ILT
680if TLS
681
351a8000
ILT
682check_PROGRAMS += tls_test
683check_PROGRAMS += tls_pic_test
c7177d31 684check_PROGRAMS += tls_pie_test
b3705d2a 685check_PROGRAMS += tls_pie_pic_test
351a8000 686check_PROGRAMS += tls_shared_test
c03c7692 687check_PROGRAMS += tls_shared_ie_test
c2b45e22 688check_PROGRAMS += tls_shared_gd_to_ie_test
351a8000
ILT
689tls_test_pic.o: tls_test.cc
690 $(CXXCOMPILE) -c -fpic -o $@ $<
691tls_test_file2_pic.o: tls_test_file2.cc
692 $(CXXCOMPILE) -c -fpic -o $@ $<
155a0dd7
ILT
693tls_test_c_pic.o: tls_test_c.c
694 $(COMPILE) -c -fpic $(TLS_TEST_C_CFLAGS) -o $@ $<
695tls_test_shared.so: tls_test_pic.o tls_test_file2_pic.o tls_test_c_pic.o gcctestdir/ld
9c2d0ef9 696 $(CXXLINK) -Bgcctestdir/ -shared tls_test_pic.o tls_test_file2_pic.o tls_test_c_pic.o -Wl,-z,defs
c2b45e22
CC
697tls_test_shared2.so: tls_test_file2_pic.o gcctestdir/ld
698 $(CXXLINK) -Bgcctestdir/ -shared tls_test_file2_pic.o
351a8000 699
c03c7692
ILT
700tls_test_pic_ie.o: tls_test.cc
701 $(CXXCOMPILE) -c -fpic -ftls-model=initial-exec -o $@ $<
702tls_test_file2_pic_ie.o: tls_test_file2.cc
703 $(CXXCOMPILE) -c -fpic -ftls-model=initial-exec -o $@ $<
155a0dd7
ILT
704tls_test_c_pic_ie.o: tls_test_c.c
705 $(COMPILE) -c -fpic -ftls-model=initial-exec $(TLS_TEST_C_CFLAGS) -o $@ $<
706tls_test_ie_shared.so: tls_test_pic_ie.o tls_test_file2_pic_ie.o tls_test_c_pic_ie.o gcctestdir/ld
707 $(CXXLINK) -Bgcctestdir/ -shared tls_test_pic_ie.o tls_test_file2_pic_ie.o tls_test_c_pic_ie.o
c03c7692 708
e0374858 709tls_test_SOURCES = tls_test.cc tls_test_file2.cc tls_test_main.cc tls_test.h
155a0dd7 710tls_test_DEPENDENCIES = gcctestdir/ld tls_test_c.o
6eee141f 711tls_test_LDFLAGS = -Bgcctestdir/
155a0dd7
ILT
712tls_test_LDADD = tls_test_c.o -lpthread
713tls_test_c.o: tls_test_c.c
714 $(COMPILE) -c $(TLS_TEST_C_CFLAGS) -o $@ $<
6eee141f
ILT
715
716tls_pic_test_SOURCES = tls_test_main.cc
155a0dd7
ILT
717tls_pic_test_DEPENDENCIES = gcctestdir/ld tls_test_pic.o tls_test_file2_pic.o \
718 tls_test_c_pic.o
6eee141f 719tls_pic_test_LDFLAGS = -Bgcctestdir/
155a0dd7
ILT
720tls_pic_test_LDADD = tls_test_pic.o tls_test_file2_pic.o tls_test_c_pic.o \
721 -lpthread
6eee141f 722
c7177d31
ILT
723tls_test_main_pie.o: tls_test_main.cc tls_test.h
724 $(CXXCOMPILE) -c -fpie -o $@ $<
725tls_test_pie.o: tls_test.cc tls_test.h
726 $(CXXCOMPILE) -c -fpie -o $@ $<
727tls_test_file2_pie.o: tls_test_file2.cc tls_test.h
728 $(CXXCOMPILE) -c -fpie -o $@ $<
729tls_test_c_pie.o: tls_test_c.c
730 $(COMPILE) -c -fpic $(TLS_TEST_C_CFLAGS) -o $@ $<
731tls_pie_test: tls_test_main_pie.o tls_test_pie.o tls_test_file2_pie.o \
732 tls_test_c_pie.o gcctestdir/ld
733 $(CXXLINK) -Bgcctestdir/ -pie tls_test_main_pie.o tls_test_pie.o tls_test_file2_pie.o tls_test_c_pie.o -lpthread
734
b3705d2a
ILT
735tls_pie_pic_test: tls_test_main_pie.o tls_test_pic.o tls_test_file2_pic.o \
736 tls_test_c_pic.o gcctestdir/ld
737 $(CXXLINK) -Bgcctestdir/ -pie tls_test_main_pie.o tls_test_pic.o tls_test_file2_pic.o tls_test_c_pic.o -lpthread
738
6eee141f
ILT
739tls_shared_test_SOURCES = tls_test_main.cc
740tls_shared_test_DEPENDENCIES = gcctestdir/ld tls_test_shared.so
741tls_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
742tls_shared_test_LDADD = tls_test_shared.so -lpthread
743
c03c7692
ILT
744tls_shared_ie_test_SOURCES = tls_test_main.cc
745tls_shared_ie_test_DEPENDENCIES = gcctestdir/ld tls_test_ie_shared.so
746tls_shared_ie_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
747tls_shared_ie_test_LDADD = tls_test_ie_shared.so -lpthread
748
c2b45e22 749tls_shared_gd_to_ie_test_SOURCES = tls_test_main.cc
155a0dd7
ILT
750tls_shared_gd_to_ie_test_DEPENDENCIES = gcctestdir/ld tls_test_pic.o \
751 tls_test_c_pic.o tls_test_shared2.so
c2b45e22 752tls_shared_gd_to_ie_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
155a0dd7
ILT
753tls_shared_gd_to_ie_test_LDADD = tls_test_pic.o tls_test_c_pic.o \
754 tls_test_shared2.so -lpthread
c2b45e22
CC
755
756if TLS_GNU2_DIALECT
757
758check_PROGRAMS += tls_shared_gnu2_gd_to_ie_test
759
760tls_test_gnu2.o: tls_test.cc
761 $(CXXCOMPILE) -c -fpic -mtls-dialect=gnu2 -o $@ $<
762tls_test_file2_gnu2.o: tls_test_file2.cc
763 $(CXXCOMPILE) -c -fpic -mtls-dialect=gnu2 -o $@ $<
155a0dd7
ILT
764tls_test_c_gnu2.o: tls_test_c.c
765 $(COMPILE) -c -fpic -mtls-dialect=gnu2 $(TLS_TEST_C_CFLAGS) -o $@ $<
c2b45e22
CC
766tls_test_gnu2_shared2.so: tls_test_file2_gnu2.o gcctestdir/ld
767 $(CXXLINK) -Bgcctestdir/ -shared tls_test_file2_gnu2.o
768
769tls_shared_gnu2_gd_to_ie_test_SOURCES = tls_test_main.cc
155a0dd7
ILT
770tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES = gcctestdir/ld tls_test_gnu2.o \
771 tls_test_c_gnu2.o tls_test_gnu2_shared2.so
c2b45e22 772tls_shared_gnu2_gd_to_ie_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
155a0dd7
ILT
773tls_shared_gnu2_gd_to_ie_test_LDADD = tls_test_gnu2.o tls_test_c_gnu2.o \
774 tls_test_gnu2_shared2.so -lpthread
c2b45e22
CC
775
776if TLS_DESCRIPTORS
777
778check_PROGRAMS += tls_shared_gnu2_test
779
155a0dd7
ILT
780tls_test_gnu2_shared.so: tls_test_gnu2.o tls_test_file2_gnu2.o tls_test_c_gnu2.o gcctestdir/ld
781 $(CXXLINK) -Bgcctestdir/ -shared tls_test_gnu2.o tls_test_file2_gnu2.o tls_test_c_gnu2.o
c2b45e22
CC
782
783tls_shared_gnu2_test_SOURCES = tls_test_main.cc
784tls_shared_gnu2_test_DEPENDENCIES = gcctestdir/ld tls_test_gnu2_shared.so
785tls_shared_gnu2_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
786tls_shared_gnu2_test_LDADD = tls_test_gnu2_shared.so -lpthread
787
788endif TLS_DESCRIPTORS
789
790endif TLS_GNU2_DIALECT
791
328c7c2f 792if HAVE_STATIC
351a8000
ILT
793if STATIC_TLS
794check_PROGRAMS += tls_static_test
795check_PROGRAMS += tls_static_pic_test
796
797tls_static_test_SOURCES = $(tls_test_SOURCES)
798tls_static_test_DEPENDENCIES = $(tls_test_DEPENDENCIES)
799tls_static_test_LDFLAGS = $(tls_test_LDFLAGS) -static
800tls_static_test_LDADD = $(tls_test_LDADD)
801
802tls_static_pic_test_SOURCES = $(tls_pic_test_SOURCES)
803tls_static_pic_test_DEPENDENCIES = $(tls_pic_test_DEPENDENCIES)
804tls_static_pic_test_LDFLAGS = $(tls_pic_test_LDFLAGS) -static
805tls_static_pic_test_LDADD = $(tls_pic_test_LDADD)
806endif
328c7c2f 807endif
6eee141f
ILT
808
809if FN_PTRS_IN_SO_WITHOUT_PIC
351a8000 810check_PROGRAMS += tls_shared_nonpic_test
155a0dd7 811tls_test_shared_nonpic.so: tls_test.o tls_test_file2.o tls_test_c.o gcctestdir/ld
611062c0 812 $(CXXLINK) -Bgcctestdir/ -shared tls_test.o tls_test_file2.o tls_test_c.o -Wl,-z,notext
6eee141f
ILT
813
814tls_shared_nonpic_test_SOURCES = tls_test_main.cc
815tls_shared_nonpic_test_DEPENDENCIES = gcctestdir/ld tls_test_shared_nonpic.so
816tls_shared_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
817tls_shared_nonpic_test_LDADD = tls_test_shared_nonpic.so -lpthread
351a8000 818endif FN_PTRS_IN_SO_WITHOUT_PIC
6eee141f 819
351a8000 820endif TLS
6eee141f 821
d491d34e
ILT
822check_PROGRAMS += many_sections_test
823many_sections_test_SOURCES = many_sections_test.cc
824many_sections_test_DEPENDENCIES = gcctestdir/ld
825many_sections_test_LDFLAGS = -Bgcctestdir/ -rdynamic
1abce4a6 826many_sections_test_LDADD =
d491d34e
ILT
827
828BUILT_SOURCES += many_sections_define.h
72fef11a 829MOSTLYCLEANFILES += many_sections_define.h
d491d34e
ILT
830many_sections_define.h:
831 (for i in `seq 1 70000`; do \
832 echo "int var_$$i __attribute__((section(\"section_$$i\"))) = $$i;"; \
833 done) > $@.tmp
834 mv -f $@.tmp $@
835
836BUILT_SOURCES += many_sections_check.h
72fef11a 837MOSTLYCLEANFILES += many_sections_check.h
d491d34e 838many_sections_check.h:
4c94d6ae 839 (for i in `seq 1 1000 70000`; do \
d491d34e
ILT
840 echo "assert(var_$$i == $$i);"; \
841 done) > $@.tmp
842 mv -f $@.tmp $@
843
844check_PROGRAMS += many_sections_r_test
d491d34e
ILT
845many_sections_r_test.o: many_sections_test.o gcctestdir/ld
846 gcctestdir/ld -r -o $@ many_sections_test.o
7bc3e21a
ILT
847many_sections_r_test: many_sections_r_test.o gcctestdir/ld
848 $(CXXLINK) -Bgcctestdir/ many_sections_r_test.o $(LIBS)
6eee141f 849
2fd32231
ILT
850check_PROGRAMS += initpri1
851initpri1_SOURCES = initpri1.c
852initpri1_DEPENDENCIES = gcctestdir/ld
853initpri1_LDFLAGS = -Bgcctestdir/
1abce4a6 854initpri1_LDADD =
2fd32231 855
5393d741
ILT
856check_PROGRAMS += initpri2
857initpri2_SOURCES = initpri2.c
858initpri2_DEPENDENCIES = gcctestdir/ld
859initpri2_LDFLAGS = -Bgcctestdir/
860initpri2_LDADD =
2fd32231 861
487b39df
ILT
862check_PROGRAMS += initpri3a
863initpri3a_SOURCES = initpri3.c
864initpri3a_DEPENDENCIES = gcctestdir/ld
865initpri3a_LDFLAGS = -Bgcctestdir/
866initpri3a_LDADD =
867
868check_PROGRAMS += initpri3b
869initpri3b_SOURCES = initpri3.c
870initpri3b_DEPENDENCIES = gcctestdir/ld
871initpri3b_LDFLAGS = -Bgcctestdir/ -Wl,--no-ctors-in-init-array
872initpri3b_LDADD =
873
351a8000
ILT
874# Test --detect-odr-violations
875check_SCRIPTS += debug_msg.sh
6eee141f 876
351a8000
ILT
877# Create the data files that debug_msg.sh analyzes.
878check_DATA += debug_msg.err
879MOSTLYCLEANFILES += debug_msg.err
880debug_msg.o: debug_msg.cc
881 $(CXXCOMPILE) -O0 -g -c -w -o $@ $(srcdir)/debug_msg.cc
882odr_violation1.o: odr_violation1.cc
883 $(CXXCOMPILE) -O0 -g -c -w -o $@ $(srcdir)/odr_violation1.cc
71ff8986
ILT
884# Compile with different optimization flags to check that rearranged
885# instructions don't cause a false positive.
351a8000 886odr_violation2.o: odr_violation2.cc
71ff8986 887 $(CXXCOMPILE) -O2 -g -c -w -o $@ $(srcdir)/odr_violation2.cc
351a8000
ILT
888debug_msg.err: debug_msg.o odr_violation1.o odr_violation2.o gcctestdir/ld
889 @echo $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg debug_msg.o odr_violation1.o odr_violation2.o "2>$@"
890 @if $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg debug_msg.o odr_violation1.o odr_violation2.o 2>$@; \
891 then \
892 echo 1>&2 "Link of debug_msg should have failed"; \
893 rm -f $@; \
894 exit 1; \
895 fi
896
472076e4
CC
897
898if HAVE_ZLIB
899
900# Check that --detect-odr-violations works with compressed debug sections.
901check_DATA += debug_msg_cdebug.err
902MOSTLYCLEANFILES += debug_msg_cdebug.err
903debug_msg_cdebug.o: debug_msg.cc gcctestdir/as
904 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -Wa,--compress-debug-sections -c -w -o $@ $(srcdir)/debug_msg.cc
905odr_violation1_cdebug.o: odr_violation1.cc gcctestdir/as
906 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -Wa,--compress-debug-sections -c -w -o $@ $(srcdir)/odr_violation1.cc
907odr_violation2_cdebug.o: odr_violation2.cc gcctestdir/as
908 $(CXXCOMPILE) -Bgcctestdir/ -O2 -g -Wa,--compress-debug-sections -c -w -o $@ $(srcdir)/odr_violation2.cc
909debug_msg_cdebug.err: debug_msg_cdebug.o odr_violation1_cdebug.o odr_violation2_cdebug.o gcctestdir/ld
910 @echo $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_cdebug debug_msg_cdebug.o odr_violation1_cdebug.o odr_violation2_cdebug.o "2>$@"
911 @if $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_cdebug debug_msg_cdebug.o odr_violation1_cdebug.o odr_violation2_cdebug.o 2>$@; \
912 then \
913 echo 1>&2 "Link of debug_msg_cdebug should have failed"; \
914 rm -f $@; \
915 exit 1; \
916 fi
917
918endif HAVE_ZLIB
919
351a8000
ILT
920# See if we can also detect problems when we're linking .so's, not .o's.
921check_DATA += debug_msg_so.err
922MOSTLYCLEANFILES += debug_msg_so.err
923debug_msg.so: debug_msg.cc gcctestdir/ld
924 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -shared -fPIC -w -o $@ $(srcdir)/debug_msg.cc
925odr_violation1.so: odr_violation1.cc gcctestdir/ld
926 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -shared -fPIC -w -o $@ $(srcdir)/odr_violation1.cc
927odr_violation2.so: odr_violation2.cc gcctestdir/ld
71ff8986 928 $(CXXCOMPILE) -Bgcctestdir/ -O2 -g -shared -fPIC -w -o $@ $(srcdir)/odr_violation2.cc
351a8000
ILT
929debug_msg_so.err: debug_msg.so odr_violation1.so odr_violation2.so gcctestdir/ld
930 @echo $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_so debug_msg.so odr_violation1.so odr_violation2.so "2>$@"
931 @if $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_so debug_msg.so odr_violation1.so odr_violation2.so 2>$@; \
932 then \
933 echo 1>&2 "Link of debug_msg_so should have failed"; \
934 rm -f $@; \
935 exit 1; \
936 fi
937
938# We also want to make sure we do something reasonable when there's no
939# debug info available. For the best test, we use .so's.
940check_DATA += debug_msg_ndebug.err
941MOSTLYCLEANFILES += debug_msg_ndebug.err
942debug_msg_ndebug.so: debug_msg.cc gcctestdir/ld
943 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g0 -shared -fPIC -w -o $@ $(srcdir)/debug_msg.cc
944odr_violation1_ndebug.so: odr_violation1.cc gcctestdir/ld
945 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g0 -shared -fPIC -w -o $@ $(srcdir)/odr_violation1.cc
946odr_violation2_ndebug.so: odr_violation2.cc gcctestdir/ld
71ff8986 947 $(CXXCOMPILE) -Bgcctestdir/ -O2 -g0 -shared -fPIC -w -o $@ $(srcdir)/odr_violation2.cc
351a8000
ILT
948debug_msg_ndebug.err: debug_msg_ndebug.so odr_violation1_ndebug.so odr_violation2_ndebug.so gcctestdir/ld
949 @echo $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_ndebug debug_msg_ndebug.so odr_violation1_ndebug.so odr_violation2_ndebug.so "2>$@"
950 @if $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_ndebug debug_msg_ndebug.so odr_violation1_ndebug.so odr_violation2_ndebug.so 2>$@; \
951 then \
952 echo 1>&2 "Link of debug_msg_ndebug should have failed"; \
953 rm -f $@; \
954 exit 1; \
955 fi
956
957
958# Similar to --detect-odr-violations: check for undefined symbols in .so's
959check_SCRIPTS += undef_symbol.sh
960check_DATA += undef_symbol.err
961MOSTLYCLEANFILES += undef_symbol.err
962undef_symbol.o: undef_symbol.cc
963 $(CXXCOMPILE) -O0 -g -c -fPIC $<
964undef_symbol.so: undef_symbol.o gcctestdir/ld
965 $(CXXLINK) -Bgcctestdir/ -shared undef_symbol.o
966undef_symbol.err: undef_symbol_main.o undef_symbol.so gcctestdir/ld
967 @echo $(CXXLINK) -Bgcctestdir/ -o undef_symbol_test undef_symbol_main.o undef_symbol.so "2>$@"
968 @if $(CXXLINK) -Bgcctestdir/ -o undef_symbol_test undef_symbol_main.o undef_symbol.so 2>$@; \
969 then \
970 echo 1>&2 "Link of undef_symbol_test should have failed"; \
971 rm -f $@; \
972 exit 1; \
973 fi
974
975
351a8000
ILT
976# Test -o when emitting to a special file (such as something in /dev).
977check_PROGRAMS += flagstest_o_specialfile
0e470e5c 978flagstest_o_specialfile: flagstest_debug.o gcctestdir/ld
351a8000
ILT
979 $(CXXLINK) -Bgcctestdir/ -o /dev/stdout $< 2>&1 | cat > $@
980 chmod a+x $@
981 test -s $@
982
7fcd0256
ILT
983if HAVE_ZLIB
984
985# Test --compress-debug-sections. FIXME: check we actually compress.
986check_PROGRAMS += flagstest_compress_debug_sections
987flagstest_compress_debug_sections: flagstest_debug.o gcctestdir/ld
988 $(CXXLINK) -Bgcctestdir/ -o $@ $< -Wl,--compress-debug-sections=zlib
989 test -s $@
990
991
351a8000
ILT
992# The specialfile output has a tricky case when we also compress debug
993# sections, because it requires output-file resizing.
994check_PROGRAMS += flagstest_o_specialfile_and_compress_debug_sections
0e470e5c
ILT
995flagstest_o_specialfile_and_compress_debug_sections: flagstest_debug.o \
996 gcctestdir/ld
126f3ece 997 $(CXXLINK) -Bgcctestdir/ -o /dev/stdout $< -Wl,--compress-debug-sections=zlib 2>&1 | cat > $@
351a8000
ILT
998 chmod a+x $@
999 test -s $@
1000
7fcd0256
ILT
1001endif HAVE_ZLIB
1002
99f8faca
ILT
1003# Test symbol versioning.
1004check_PROGRAMS += ver_test
1005ver_test_SOURCES = ver_test_main.cc
1006ver_test_DEPENDENCIES = gcctestdir/ld ver_test_1.so ver_test_2.so ver_test_4.so
1007ver_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1008ver_test_LDADD = ver_test_1.so ver_test_2.so ver_test_4.so
1009ver_test_1.so: ver_test_1.o ver_test_2.so ver_test_3.o ver_test_4.so gcctestdir/ld
1010 $(CXXLINK) -Bgcctestdir/ -shared ver_test_1.o ver_test_2.so ver_test_3.o ver_test_4.so
09124467 1011ver_test_2.so: ver_test_2.o $(srcdir)/ver_test_2.script ver_test_4.so gcctestdir/ld
41d0ab5f 1012 $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_2.script -Wl,-R,. ver_test_2.o ver_test_4.so
09124467
ILT
1013ver_test_4.so: ver_test_4.o $(srcdir)/ver_test_4.script gcctestdir/ld
1014 $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_4.script ver_test_4.o
99f8faca
ILT
1015ver_test_1.o: ver_test_1.cc
1016 $(CXXCOMPILE) -c -fpic -o $@ $<
1017ver_test_2.o: ver_test_2.cc
1018 $(CXXCOMPILE) -c -fpic -o $@ $<
1019ver_test_3.o: ver_test_3.cc
1020 $(CXXCOMPILE) -c -fpic -o $@ $<
1021ver_test_4.o: ver_test_4.cc
1022 $(CXXCOMPILE) -c -fpic -o $@ $<
351a8000 1023
0602e05a
ILT
1024check_SCRIPTS += ver_test_1.sh
1025check_DATA += ver_test_1.syms
1026ver_test_1.syms: ver_test_1.so
1027 $(TEST_READELF) -s $< >$@ 2>/dev/null
1028
be3e6201
ILT
1029check_PROGRAMS += ver_test_2
1030ver_test_2_SOURCES = ver_test_main_2.cc
1031ver_test_2_DEPENDENCIES = gcctestdir/ld ver_test_4.so ver_test_2.so
1032ver_test_2_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1033ver_test_2_LDADD = ver_test_4.so ver_test_2.so
1034
be3e6201
ILT
1035check_SCRIPTS += ver_test_2.sh
1036check_DATA += ver_test_2.syms
1037ver_test_2.syms: ver_test_2
6835af53 1038 $(TEST_READELF) -s $< >$@ 2>/dev/null
be3e6201 1039
686c8caf
ILT
1040check_SCRIPTS += ver_test_4.sh
1041check_DATA += ver_test_4.syms
1042ver_test_4.syms: ver_test_4.so
6835af53 1043 $(TEST_READELF) -s $< >$@ 2>/dev/null
5871526f
ILT
1044
1045ver_test_5.so: ver_test_5.o $(srcdir)/ver_test_5.script ver_test_4.so gcctestdir/ld
1046 $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_5.script ver_test_5.o ver_test_4.so
1047ver_test_5.o: ver_test_5.cc
1048 $(CXXCOMPILE) -c -fpic -o $@ $<
1049check_SCRIPTS += ver_test_5.sh
1050check_DATA += ver_test_5.syms
1051ver_test_5.syms: ver_test_5.so
6835af53 1052 $(TEST_READELF) -s $< >$@ 2>/dev/null
5871526f 1053
18e6b24e
ILT
1054check_PROGRAMS += ver_test_6
1055ver_test_6_SOURCES = ver_test_6.c
1056ver_test_6_DEPENDENCIES = gcctestdir/ld ver_test_2.so
1057ver_test_6_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1058ver_test_6_LDADD = ver_test_2.so
1059
479f6503
ILT
1060ver_test_7.so: ver_test_4.o $(srcdir)/ver_test_4.script ver_test_7.o gcctestdir/ld
1061 $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_4.script ver_test_4.o ver_test_7.o
1062ver_test_7.o: ver_test_7.cc
1063 $(CXXCOMPILE) -c -fpic -o $@ $<
1064check_SCRIPTS += ver_test_7.sh
1065check_DATA += ver_test_7.syms
1066ver_test_7.syms: ver_test_7.so
6835af53 1067 $(TEST_READELF) -s $< >$@ 2>/dev/null
479f6503 1068
75517b77
ILT
1069check_PROGRAMS += ver_test_8
1070ver_test_8_SOURCES = two_file_test_main.cc
1071ver_test_8_DEPENDENCIES = gcctestdir/ld ver_test_8_1.so ver_test_8_2.so
1072ver_test_8_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1073ver_test_8_LDADD = ver_test_8_1.so ver_test_8_2.so
1074ver_test_8_1.so: two_file_test_1_pic.o two_file_test_1b_pic.o ver_test_8_2.so gcctestdir/ld
1075 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1_pic.o two_file_test_1b_pic.o ver_test_8_2.so
1076ver_test_8_2.so: two_file_test_2_pic.o $(srcdir)/ver_test_8.script gcctestdir/ld
1077 $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_8.script two_file_test_2_pic.o
1078
95d14cd3
ILT
1079check_PROGRAMS += ver_test_9
1080ver_test_9_SOURCES = ver_test_main.cc
1081ver_test_9_DEPENDENCIES = gcctestdir/ld ver_test_9.so
1082ver_test_9_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1083ver_test_9_LDADD = ver_test_9.so
1084ver_test_9.so: ver_test_9.o ver_test_4.so ver_test_5.so gcctestdir/ld
41d0ab5f 1085 $(CXXLINK) -Bgcctestdir/ -shared -Wl,-R,. ver_test_9.o ver_test_5.so ver_test_4.so
95d14cd3
ILT
1086ver_test_9.o: ver_test_9.cc
1087 $(CXXCOMPILE) -c -fpic -o $@ $<
1088
057ead22
ILT
1089check_SCRIPTS += ver_test_10.sh
1090check_DATA += ver_test_10.syms
1091ver_test_10.syms: ver_test_10.so
1092 $(TEST_READELF) -s $< >$@ 2>/dev/null
1093ver_test_10.so: gcctestdir/ld ver_test_2.o ver_test_10.script
1094 $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_10.script ver_test_2.o
1095
9c5b8369 1096check_PROGRAMS += ver_test_11
72fef11a 1097MOSTLYCLEANFILES += ver_test_11.a
9c5b8369
ILT
1098ver_test_11_SOURCES = ver_test_main_2.cc
1099ver_test_11_DEPENDENCIES = gcctestdir/ld ver_test_11.a
1100ver_test_11_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1101ver_test_11_LDADD = ver_test_11.a
1102ver_test_11.a: ver_test_1.o ver_test_2.o ver_test_4.o
1103 $(TEST_AR) rc $@ $^
1104
6d1c4efb
ILT
1105check_PROGRAMS += ver_test_12
1106ver_test_12_SOURCES = ver_test_main_2.cc
1107ver_test_12_DEPENDENCIES = gcctestdir/ld ver_test_12.o
1108ver_test_12_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1109ver_test_12_LDADD = ver_test_12.o
1110ver_test_12.o: gcctestdir/ld ver_test_1.o ver_test_2.o ver_test_4.o
1111 gcctestdir/ld -r -o $@ ver_test_1.o ver_test_2.o ver_test_4.o
1112
8bdcdf2c
ILT
1113check_PROGRAMS += protected_1
1114protected_1_SOURCES = \
1115 protected_main_1.cc protected_main_2.cc protected_main_3.cc
1116protected_1_DEPENDENCIES = gcctestdir/ld protected_1.so
1117protected_1_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1118protected_1_LDADD = protected_1.so
1119
1120protected_1.so: gcctestdir/ld protected_1_pic.o protected_2_pic.o protected_3_pic.o
1121 $(CXXLINK) -Bgcctestdir/ -shared protected_1_pic.o protected_2_pic.o protected_3_pic.o
1122protected_1_pic.o: protected_1.cc
1123 $(CXXCOMPILE) -c -fpic -o $@ $<
1124protected_2_pic.o: protected_2.cc
1125 $(CXXCOMPILE) -c -fpic -o $@ $<
1126protected_3_pic.o: protected_3.cc
1127 $(CXXCOMPILE) -c -fpic -o $@ $<
1128
1129check_PROGRAMS += protected_2
1130protected_2_SOURCES = protected_main_1.cc protected_3.cc
1131protected_2_DEPENDENCIES = gcctestdir/ld protected_1.so
1132protected_2_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1133protected_2_LDADD = protected_1.so
1134
837504c4
ILT
1135check_DATA += protected_3.err
1136MOSTLYCLEANFILES += protected_3.err
1137protected_4_pic.o: protected_4.cc
1138 $(CXXCOMPILE) -c -fpic -o $@ $<
1139protected_3.err: protected_4_pic.o gcctestdir/ld
1140 @echo $(CXXLINK) -Bgcctestdir/ -shared -o protected_4.so protected_4_pic.o "2>$@"
1141 @if $(CXXLINK) -Bgcctestdir/ -shared -o protected_4.so protected_4_pic.o 2>$@; then \
1142 echo 1>&2 "Link of protected_4.so should have failed"; \
1143 rm -f $@; \
1144 exit 1; \
1145 fi
1146
9f1d377b 1147check_PROGRAMS += relro_test
fc497986
CC
1148check_SCRIPTS += relro_test.sh
1149check_DATA += relro_test.stdout
9f1d377b
ILT
1150relro_test_SOURCES = relro_test_main.cc
1151relro_test_DEPENDENCIES = gcctestdir/ld relro_test.so
1152relro_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1153relro_test_LDADD = relro_test.so
1154relro_test.so: gcctestdir/ld relro_test_pic.o
1155 $(CXXLINK) -Bgcctestdir/ -shared -Wl,-z,relro relro_test_pic.o
1156relro_test_pic.o: relro_test.cc
1157 $(CXXCOMPILE) -c -fpic -o $@ $<
fc497986
CC
1158relro_test.stdout: relro_test.so
1159 $(TEST_READELF) -SlW relro_test.so > relro_test.stdout
9f1d377b 1160
5f1ab67a
ILT
1161check_PROGRAMS += relro_strip_test
1162relro_strip_test_SOURCES = relro_test_main.cc
1163relro_strip_test_DEPENDENCIES = gcctestdir/ld relro_strip_test.so
1164relro_strip_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1165relro_strip_test_LDADD = relro_strip_test.so
1166relro_strip_test.so: relro_test.so
1167 $(TEST_STRIP) -o $@ $<
1168
2d924fd9
ILT
1169check_PROGRAMS += relro_script_test
1170relro_script_test_SOURCES = relro_test_main.cc
1171relro_script_test_DEPENDENCIES = gcctestdir/ld relro_script_test.so
1172relro_script_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1173relro_script_test_LDADD = relro_script_test.so
1174relro_script_test.so: gcctestdir/ld relro_script_test.t relro_test_pic.o
1175 $(CXXLINK) -Bgcctestdir/ -shared -Wl,-z,relro -T $(srcdir)/relro_script_test.t relro_test_pic.o
1176
e5756efb
ILT
1177check_PROGRAMS += script_test_1
1178script_test_1_SOURCES = script_test_1.cc
1179script_test_1_DEPENDENCIES = gcctestdir/ld script_test_1.t
1180script_test_1_LDFLAGS = -Bgcctestdir/ -Wl,-R,. -T $(srcdir)/script_test_1.t
1abce4a6 1181script_test_1_LDADD =
e5756efb 1182
a445fddf
ILT
1183check_PROGRAMS += script_test_2
1184script_test_2_SOURCES = script_test_2.cc script_test_2a.cc script_test_2b.cc
1185script_test_2_DEPENDENCIES = gcctestdir/ld script_test_2.t
1186script_test_2_LDFLAGS = -Bgcctestdir/ -Wl,-R,. -T $(srcdir)/script_test_2.t
1abce4a6 1187script_test_2_LDADD =
a445fddf 1188
88dd47ac
ILT
1189check_PROGRAMS += justsyms
1190justsyms_SOURCES = justsyms_1.cc
1191justsyms_DEPENDENCIES = gcctestdir/ld justsyms_2r.o
1192justsyms_LDFLAGS = -Bgcctestdir/ -Wl,-R,justsyms_2r.o
1abce4a6 1193justsyms_LDADD =
88dd47ac
ILT
1194justsyms_2.o: justsyms_2.cc
1195 $(CXXCOMPILE) -c -o $@ $<
83bfb6b7 1196justsyms_2r.o: justsyms_2.o gcctestdir/ld $(srcdir)/justsyms.t
88dd47ac
ILT
1197 gcctestdir/ld -o $@ -r -T $(srcdir)/justsyms.t justsyms_2.o
1198
bc644c6c 1199check_PROGRAMS += binary_test
72fef11a 1200MOSTLYCLEANFILES += binary.txt
bc644c6c
ILT
1201binary_test_SOURCES = binary_test.cc
1202binary_test_DEPENDENCIES = gcctestdir/ld binary.txt
1203binary_test_LDFLAGS = -Bgcctestdir/ -Wl,--format,binary,binary.txt,--format,elf
1abce4a6 1204binary_test_LDADD =
bc644c6c
ILT
1205# Copy the file to the build directory to avoid worrying about the
1206# full pathname in the generated symbols.
1207binary.txt: $(srcdir)/binary.in
1208 rm -f $@
1209 $(LN_S) $< $@
1210
09124467
ILT
1211check_SCRIPTS += ver_matching_test.sh
1212check_DATA += ver_matching_test.stdout
1213MOSTLYCLEANFILES += ver_matching_test.stdout
2fbb4320
ILT
1214ver_matching_def.so: ver_matching_def_pic.o $(srcdir)/version_script.map gcctestdir/ld
1215 $(CXXLINK) -O0 -Bgcctestdir/ -shared ver_matching_def_pic.o -Wl,--version-script=$(srcdir)/version_script.map
1216ver_matching_def_pic.o: ver_matching_def.cc
1217 $(CXXCOMPILE) -O0 -c -fpic -o $@ $<
09124467 1218ver_matching_test.stdout: ver_matching_def.so
6835af53 1219 $(TEST_OBJDUMP) -T ver_matching_def.so | $(TEST_CXXFILT) > ver_matching_test.stdout
1c4f3631
ILT
1220
1221check_PROGRAMS += script_test_3
1222check_SCRIPTS += script_test_3.sh
1223check_DATA += script_test_3.stdout
1224MOSTLYCLEANFILES += script_test_3.stdout
1225script_test_3: basic_test.o gcctestdir/ld script_test_3.t
1226 $(CXXLINK) -Bgcctestdir/ basic_test.o -T $(srcdir)/script_test_3.t
1227script_test_3.stdout: script_test_3
2cefc357 1228 $(TEST_READELF) -SlW script_test_3 > script_test_3.stdout
09124467 1229
4ebf39db
ILT
1230check_PROGRAMS += tls_phdrs_script_test
1231tls_phdrs_script_test_SOURCES = $(tls_test_SOURCES)
1232tls_phdrs_script_test_DEPENDENCIES = $(tls_test_DEPENDENCIES) $(srcdir)/script_test_3.t
1233tls_phdrs_script_test_LDFLAGS = $(tls_test_LDFLAGS) -T $(srcdir)/script_test_3.t
1234tls_phdrs_script_test_LDADD = $(tls_test_LDADD)
1235
e6188289
ILT
1236check_SCRIPTS += script_test_4.sh
1237check_DATA += script_test_4.stdout
72fef11a 1238MOSTLYCLEANFILES += script_test_4
e6188289
ILT
1239script_test_4: basic_test.o gcctestdir/ld $(srcdir)/script_test_4.t
1240 $(CXXLINK) -Bgcctestdir/ basic_test.o -T $(srcdir)/script_test_4.t
1241script_test_4.stdout: script_test_4
1242 $(TEST_READELF) -SlW script_test_4 > script_test_4.stdout
1243
6c93b22c
ILT
1244check_PROGRAMS += tls_script_test
1245tls_script_test_SOURCES = $(tls_test_SOURCES)
1246tls_script_test_DEPENDENCIES = $(tls_test_DEPENDENCIES) $(srcdir)/script_test_4.t
1247tls_script_test_LDFLAGS = $(tls_test_LDFLAGS) -T $(srcdir)/script_test_4.t
1248tls_script_test_LDADD = $(tls_test_LDADD)
1249
401a9a73
CC
1250check_SCRIPTS += script_test_5.sh
1251check_DATA += script_test_5.stdout
72fef11a 1252MOSTLYCLEANFILES += script_test_5
401a9a73
CC
1253script_test_5: script_test_5.o gcctestdir/ld $(srcdir)/script_test_5.t
1254 $(CXXLINK) -Bgcctestdir/ script_test_5.o -T $(srcdir)/script_test_5.t
1255script_test_5.stdout: script_test_5
1256 $(TEST_READELF) -SW script_test_5 > script_test_5.stdout
1257
3c12dcdb
DK
1258check_SCRIPTS += script_test_6.sh
1259check_DATA += script_test_6.stdout
1260MOSTLYCLEANFILES += script_test_6
1261script_test_6: basic_test.o gcctestdir/ld $(srcdir)/script_test_6.t
1262 $(CXXLINK) -Bgcctestdir/ basic_test.o -T $(srcdir)/script_test_6.t \
1263 -Wl,-Ttext=0x10001000 -Wl,-Tdata=0x10200000 -Wl,-Tbss=0x10400000
1264script_test_6.stdout: script_test_6
1265 $(TEST_READELF) -SlW script_test_6 > script_test_6.stdout
1266
1267check_SCRIPTS += script_test_7.sh
1268check_DATA += script_test_7.stdout
1269MOSTLYCLEANFILES += script_test_7
1270script_test_7: basic_test.o gcctestdir/ld $(srcdir)/script_test_7.t
1271 $(CXXLINK) -Bgcctestdir/ basic_test.o -T $(srcdir)/script_test_7.t
1272script_test_7.stdout: script_test_7
1273 $(TEST_READELF) -SlW script_test_7 > script_test_7.stdout
1274
1275check_SCRIPTS += script_test_8.sh
1276check_DATA += script_test_8.stdout
1277MOSTLYCLEANFILES += script_test_8
1278script_test_8: basic_test.o gcctestdir/ld $(srcdir)/script_test_7.t
1279 $(CXXLINK) -Bgcctestdir/ basic_test.o -T $(srcdir)/script_test_7.t \
1280 -Wl,-Ttext=0x20001000 -Wl,-Tdata=0x20200000 -Wl,-Tbss=0x20400000
1281script_test_8.stdout: script_test_8
1282 $(TEST_READELF) -SlW script_test_8 > script_test_8.stdout
1283
d103a984
RÁE
1284
1285check_SCRIPTS += script_test_9.sh
1286check_DATA += script_test_9.stdout
1287script_test_9.o: script_test_9.cc
1288 $(CXXCOMPILE) -O0 -c -o $@ $<
1289script_test_9: gcctestdir/ld $(srcdir)/script_test_9.t script_test_9.o
1290 $(CXXLINK) -Bgcctestdir/ script_test_9.o -T $(srcdir)/script_test_9.t
1291script_test_9.stdout: script_test_9
1292 $(TEST_READELF) -lW script_test_9 > script_test_9.stdout
1293
1294
c82fbeee
CS
1295# Test --dynamic-list, --dynamic-list-data, --dynamic-list-cpp-new,
1296# and --dynamic-list-cpp-typeinfo
1297
1298check_SCRIPTS += dynamic_list.sh
1299check_DATA += dynamic_list.stdout
72fef11a 1300MOSTLYCLEANFILES += dynamic_list dynamic_list.stdout
c82fbeee
CS
1301dynamic_list: basic_test.o gcctestdir/ld $(srcdir)/dynamic_list.t
1302 $(CXXLINK) -Bgcctestdir/ basic_test.o \
1303 -Wl,--dynamic-list $(srcdir)/dynamic_list.t \
1304 -Wl,--dynamic-list-data \
1305 -Wl,--dynamic-list-cpp-new \
1306 -Wl,--dynamic-list-cpp-typeinfo
1307dynamic_list.stdout: dynamic_list
94e6ee91 1308 $(TEST_READELF) -W --dyn-syms dynamic_list > dynamic_list.stdout
c82fbeee 1309
fbd8a257 1310check_PROGRAMS += thin_archive_test_1
72fef11a
CC
1311MOSTLYCLEANFILES += libthin1.a libthin3.a libthinall.a \
1312 alt/thin_archive_test_2.o alt/thin_archive_test_4.o \
1313 alt/libthin2.a alt/libthin4.a
fbd8a257
CC
1314thin_archive_test_1_SOURCES = thin_archive_main.cc
1315thin_archive_test_1_DEPENDENCIES = gcctestdir/ld libthin1.a alt/libthin2.a
1316thin_archive_test_1_LDFLAGS = -Bgcctestdir/ -Lalt
1317thin_archive_test_1_LDADD = libthin1.a -lthin2
1318
1319check_PROGRAMS += thin_archive_test_2
1320thin_archive_test_2_SOURCES = thin_archive_main.cc
1321thin_archive_test_2_DEPENDENCIES = gcctestdir/ld libthinall.a
1322thin_archive_test_2_LDFLAGS = -Bgcctestdir/ -L.
1323thin_archive_test_2_LDADD = -lthinall
1324
1325libthin1.a: thin_archive_test_1.o alt/thin_archive_test_2.o
1326 rm -f $@
1327 $(TEST_AR) crT $@ $^
1328alt/libthin2.a: thin_archive_test_3.o alt/thin_archive_test_4.o
1329 rm -f $@
1330 $(TEST_AR) crT $@ $^
1331libthin3.a: thin_archive_test_1.o alt/thin_archive_test_4.o
1332 rm -f $@
1333 $(TEST_AR) crT $@ $^
1334alt/libthin4.a: alt/thin_archive_test_2.o thin_archive_test_3.o
1335 rm -f $@
1336 $(TEST_AR) crT $@ $^
1337libthinall.a: libthin3.a alt/libthin4.a
1338 rm -f $@
1339 $(TEST_AR) crT $@ $^
1340alt/thin_archive_test_2.o: thin_archive_test_2.cc
1341 test -d alt || mkdir -p alt
1342 $(CXXCOMPILE) -c -o $@ $<
1343alt/thin_archive_test_4.o: thin_archive_test_4.cc
1344 test -d alt || mkdir -p alt
1345 $(CXXCOMPILE) -c -o $@ $<
1346
89fc3421
CC
1347if PLUGINS
1348
1349check_PROGRAMS += plugin_test_1
1350check_SCRIPTS += plugin_test_1.sh
1351check_DATA += plugin_test_1.err
1352MOSTLYCLEANFILES += plugin_test_1.err
abc8dcba
CC
1353plugin_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
1354 $(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
1355plugin_test_1.err: plugin_test_1
1356 @touch plugin_test_1.err
1357
1358check_PROGRAMS += plugin_test_2
1359check_SCRIPTS += plugin_test_2.sh
1360check_DATA += plugin_test_2.err
1361MOSTLYCLEANFILES += plugin_test_2.err
1362plugin_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
1363 $(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
1364plugin_test_2.err: plugin_test_2
1365 @touch plugin_test_2.err
1366
d66a9eb3
CC
1367check_PROGRAMS += plugin_test_3
1368check_SCRIPTS += plugin_test_3.sh
1369check_DATA += plugin_test_3.err
1370MOSTLYCLEANFILES += plugin_test_3.err
1371plugin_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
1372 $(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
1373plugin_test_3.err: plugin_test_3
1374 @touch plugin_test_3.err
1375
0f7c0701
CC
1376check_PROGRAMS += plugin_test_4
1377check_SCRIPTS += plugin_test_4.sh
1378check_DATA += plugin_test_4.err
72fef11a 1379MOSTLYCLEANFILES += plugin_test_4.a plugin_test_4.err
0f7c0701
CC
1380plugin_test_4: two_file_test_main.o plugin_test_4.a gcctestdir/ld plugin_test.so
1381 $(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
1382plugin_test_4.err: plugin_test_4
1383 @touch plugin_test_4.err
1384
1385plugin_test_4.a: two_file_test_1.syms two_file_test_1b.syms two_file_test_2.syms
1386 $(TEST_AR) cr $@ $^
1387
24998053
CC
1388check_PROGRAMS += plugin_test_5
1389plugin_test_5: two_file_test_main.o two_file_test_1.syms two_file_test_1b.syms two_file_test_2.syms unused.syms gcctestdir/ld plugin_test.so
1390 $(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle,--plugin,"./plugin_test.so",--plugin-opt,"_Z4f13iv",--gc-sections two_file_test_main.o two_file_test_1.syms two_file_test_1b.syms two_file_test_2.syms unused.syms
1391
be234d88
CC
1392check_PROGRAMS += plugin_test_6
1393check_SCRIPTS += plugin_test_6.sh
1394check_DATA += plugin_test_6.err
1395MOSTLYCLEANFILES += plugin_test_6.err
1396plugin_test_6: plugin_common_test_1.syms plugin_common_test_2.syms gcctestdir/ld plugin_test.so
1397 $(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle,--plugin,"./plugin_test.so" plugin_common_test_1.syms plugin_common_test_2.syms 2>plugin_test_6.err
1398plugin_test_6.err: plugin_test_6
1399 @touch plugin_test_6.err
1400
5e0f337e
RÁE
1401check_PROGRAMS += plugin_test_7
1402check_SCRIPTS += plugin_test_7.sh
1403check_DATA += plugin_test_7.err plugin_test_7.syms
1404MOSTLYCLEANFILES += plugin_test_7.err
1405plugin_test_7: plugin_test_7_1.o plugin_test_7_1.syms plugin_test_7_2.o gcctestdir/ld plugin_test.so
1406 $(LINK) -Bgcctestdir/ -Wl,--no-demangle,--plugin,"./plugin_test.so",--gc-sections,--print-gc-sections plugin_test_7_1.syms plugin_test_7_2.o 2>plugin_test_7.err
1407plugin_test_7.syms: plugin_test_7
1408 $(TEST_READELF) -sW $< >$@ 2>/dev/null
1409plugin_test_7_1.o: plugin_test_7_1.c
1410 $(COMPILE) -DLTO -O0 -c -ffunction-sections -fdata-sections -o $@ $<
1411plugin_test_7_1_orig.o: plugin_test_7_1.c
1412 $(COMPILE) -O0 -c -ffunction-sections -fdata-sections -o $@ $<
1413plugin_test_7_1.syms: plugin_test_7_1_orig.o
1414 $(TEST_READELF) -sW $< >$@ 2>/dev/null
1415plugin_test_7_2.o: plugin_test_7_2.c
1416 $(COMPILE) -O0 -c -ffunction-sections -fdata-sections -o $@ $<
1417plugin_test_7.err: plugin_test_7
1418
f3a2388f
CC
1419# Test plugins with -r.
1420check_PROGRAMS += plugin_test_8
1421plugin_test_8.o: two_file_test_main.o two_file_test_1.syms two_file_test_1b.syms two_file_test_2.o ../ld-new plugin_test.so
1422 ../ld-new -r -o $@ --no-demangle --plugin "./plugin_test.so" two_file_test_main.o two_file_test_1.syms two_file_test_1b.syms two_file_test_2.o
1423plugin_test_8: plugin_test_8.o gcctestdir/ld
1424 $(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle plugin_test_8.o
1425
1426# Test that symbols known in the IR file but not in the replacement file
1427# produce an unresolved symbol error.
1428check_DATA += plugin_test_9.err
1429MOSTLYCLEANFILES += plugin_test_9.err
1430plugin_test_9.err: two_file_test_main.o two_file_test_1c.syms two_file_test_2.syms gcctestdir/ld plugin_test.so
1431 @echo $(CXXLINK) -Bgcctestdir/ -o plugin_test_9 -Wl,--no-demangle,--plugin,"./plugin_test.so" two_file_test_main.o two_file_test_1c.syms two_file_test_2.syms "2>$@"
1432 @if $(CXXLINK) -Bgcctestdir/ -o plugin_test_9 -Wl,--no-demangle,--plugin,"./plugin_test.so" two_file_test_main.o two_file_test_1c.syms two_file_test_2.syms 2>$@; then \
1433 echo 1>&2 "Link of plugin_test_9 should have failed"; \
1434 rm -f $@; \
1435 exit 1; \
1436 fi
1437# Make a .syms file that claims to define the symbol _Z4t16av.
1438two_file_test_1c.syms: two_file_test_1.syms two_file_test_1c.o
1439 cp two_file_test_1.syms $@.tmp
1440 grep "_Z4t16av" two_file_test_1b.syms >> $@.tmp
1441 mv -f $@.tmp $@
1442# Make a copy of two_file_test_1.o, which does not define the symbol _Z4t16av.
1443MOSTLYCLEANFILES += two_file_test_1c.o
1444two_file_test_1c.o: two_file_test_1.o
1445 cp two_file_test_1.o $@
1446
89fc3421
CC
1447plugin_test.so: plugin_test.o
1448 $(LINK) -Bgcctestdir/ -shared plugin_test.o
1449plugin_test.o: plugin_test.c
1450 $(COMPILE) -O0 -c -fpic -o $@ $<
1451
1452two_file_test_main.syms: two_file_test_main.o
1453 $(TEST_READELF) -sW $< >$@ 2>/dev/null
1454two_file_test_1.syms: two_file_test_1.o
1455 $(TEST_READELF) -sW $< >$@ 2>/dev/null
1456two_file_test_1b.syms: two_file_test_1b.o
1457 $(TEST_READELF) -sW $< >$@ 2>/dev/null
1458two_file_test_2.syms: two_file_test_2.o
1459 $(TEST_READELF) -sW $< >$@ 2>/dev/null
be234d88
CC
1460plugin_common_test_1.syms: plugin_common_test_1.o
1461 $(TEST_READELF) -sW $< >$@ 2>/dev/null
1462plugin_common_test_2.syms: plugin_common_test_2.o
1463 $(TEST_READELF) -sW $< >$@ 2>/dev/null
24998053 1464
abc8dcba 1465empty.syms:
24998053
CC
1466 @echo "" >$@
1467 @echo "Symbol table" >>$@
1468
1469MOSTLYCLEANFILES += unused.c
1470unused.syms: unused.o
1471 $(TEST_READELF) -sW $< >$@ 2>/dev/null
1472 @echo " 1: 00000000 4 FUNC GLOBAL DEFAULT 1 UNUSED" >>$@
1473unused.o: unused.c
1474 $(COMPILE) -c -o $@ $<
1475unused.c:
1476 @cp /dev/null $@
89fc3421
CC
1477
1478endif PLUGINS
1479
65514900
CC
1480check_PROGRAMS += exclude_libs_test
1481check_SCRIPTS += exclude_libs_test.sh
1482check_DATA += exclude_libs_test.syms
1483MOSTLYCLEANFILES += exclude_libs_test.syms libexclude_libs_test_1.a \
2fdd743f 1484 libexclude_libs_test_2.a alt/libexclude_libs_test_3.a
65514900
CC
1485exclude_libs_test_SOURCES = exclude_libs_test.c
1486exclude_libs_test_DEPENDENCIES = gcctestdir/ld libexclude_libs_test_1.a \
2fdd743f
DK
1487 libexclude_libs_test_2.a alt/libexclude_libs_test_3.a
1488exclude_libs_test_LDFLAGS = -Bgcctestdir/ -L. -Lalt \
1489 -Wl,--exclude-libs,dummy:libexclude_libs_test_1 \
1490 -Wl,--exclude-libs,libexclude_libs_test_3
1491exclude_libs_test_LDADD = -lexclude_libs_test_1 -lexclude_libs_test_2 \
1492 alt/libexclude_libs_test_3.a
65514900
CC
1493exclude_libs_test.syms: exclude_libs_test
1494 $(TEST_READELF) -sW $< >$@ 2>/dev/null
1495libexclude_libs_test_1.a: exclude_libs_test_1.o
1496 $(TEST_AR) rc $@ $^
1497libexclude_libs_test_2.a: exclude_libs_test_2.o
1498 $(TEST_AR) rc $@ $^
2fdd743f
DK
1499alt/libexclude_libs_test_3.a: exclude_libs_test_3.o
1500 test -d alt || mkdir -p alt
1501 $(TEST_AR) rc $@ $^
65514900 1502
805bb01c
DK
1503check_PROGRAMS += local_labels_test
1504local_labels_test.o: ver_test_6.c
1505 $(COMPILE) -g -c -Wa,-L -o $@ $<
1506local_labels_test: local_labels_test.o
1507 $(LINK) -Bgcctestdir/ local_labels_test.o
1508
bb04269c
DK
1509check_PROGRAMS += discard_locals_test
1510check_SCRIPTS += discard_locals_test.sh
d3bbad62
ILT
1511check_DATA += discard_locals_test.syms \
1512 discard_locals_relocatable_test1.syms \
1513 discard_locals_relocatable_test2.syms
1514MOSTLYCLEANFILES += discard_locals_test.syms \
1515 discard_locals_relocatable_test1.syms \
1516 discard_locals_relocatable_test2.syms \
1517 discard_locals_relocatable_test1.out \
1518 discard_locals_relocatable_test2.out
bb04269c
DK
1519discard_locals_test_SOURCES = discard_locals_test.c
1520discard_locals_test_LDFLAGS = -Bgcctestdir/ -Wl,--discard-locals
1521discard_locals_test.syms: discard_locals_test
1522 $(TEST_READELF) -sW $< >$@ 2>/dev/null
1523# '-Wa,-L' is required to preserve the local label used for testing.
1524discard_locals_test.o: discard_locals_test.c
1525 $(COMPILE) -c -Wa,-L -o $@ $<
1526
d3bbad62
ILT
1527discard_locals_relocatable_test1.syms: discard_locals_relocatable_test1.out
1528 $(TEST_READELF) -sW $< >$@ 2>/dev/null
1529discard_locals_relocatable_test.o: discard_locals_relocatable_test.c
1530 $(COMPILE) -c -Wa,-L -fPIC -o $@ $<
1531discard_locals_relocatable_test1.out: discard_locals_relocatable_test.o ../ld-new
1532 ../ld-new --discard-locals -relocatable -o $@ $<
1533
1534discard_locals_relocatable_test2.syms: discard_locals_relocatable_test2.out
1535 $(TEST_READELF) -sW $< >$@ 2>/dev/null
1536discard_locals_relocatable_test2.out: discard_locals_relocatable_test.o ../ld-new
1537 ../ld-new --discard-all -relocatable -o $@ $<
1538
8a5e3e08
ILT
1539if MCMODEL_MEDIUM
1540check_PROGRAMS += large
1541large_SOURCES = large.c
1542large_CFLAGS = -mcmodel=medium
1543large_DEPENDENCIES = gcctestdir/ld
1544large_LDFLAGS = -Bgcctestdir/
1abce4a6 1545large_LDADD =
8a5e3e08
ILT
1546endif MCMODEL_MEDIUM
1547
645afe0c
CC
1548# Test that hidden and internal symbols in the main program cannot be
1549# referenced by a shared library.
1550check_SCRIPTS += hidden_test.sh
1551check_DATA += hidden_test.err
1552MOSTLYCLEANFILES += hidden_test hidden_test.err
1553libhidden.so: hidden_test_1.c gcctestdir/ld
1554 $(COMPILE) -Bgcctestdir/ -g -shared -fPIC -w -o $@ $(srcdir)/hidden_test_1.c
1555hidden_test: hidden_test_main.o libhidden.so gcctestdir/ld
1556 $(LINK) -Bgcctestdir/ -Wl,-R,. hidden_test_main.o libhidden.so 2>hidden_test.err
1557hidden_test.err: hidden_test
1558 @touch hidden_test.err
1559
8c604651
CS
1560# Test -retain-symbols-file.
1561check_SCRIPTS += retain_symbols_file_test.sh
1562check_DATA += retain_symbols_file_test.stdout
1563MOSTLYCLEANFILES += retain_symbols_file_test retain_symbols_file_test.in \
1564 retain_symbols_file_test.stdout
1565retain_symbols_file_test.so: basic_pic_test.o gcctestdir/ld
1566 echo 'main' > retain_symbols_file_test.in
1567 echo 't1' >> retain_symbols_file_test.in
1568 echo '_ZN4t16bC1Ev' >> retain_symbols_file_test.in
1569 echo '_ZNK4t20a3getEv' >> retain_symbols_file_test.in
1570 echo '_Z3t18v' >> retain_symbols_file_test.in
1571 echo '__tcf_0' >> retain_symbols_file_test.in
1572 $(CXXLINK) -Bgcctestdir/ -shared -Wl,-retain-symbols-file,retain_symbols_file_test.in basic_pic_test.o
1573retain_symbols_file_test.stdout: retain_symbols_file_test.so
1574 $(TEST_NM) -C retain_symbols_file_test.so > $@
1575
1576
6a89f575
CC
1577# Test that if the output file already exists and is empty,
1578# it will get execute permission.
1579check_PROGRAMS += permission_test
1580permission_test: basic_test.o gcctestdir/ld
1581 umask 022; \
1582 rm -f $@; \
1583 touch $@; \
1584 chmod 600 $@; \
1585 $(CXXLINK) -Bgcctestdir/ basic_test.o
1586
ae3b5189
CD
1587# Check -l:foo.a
1588check_PROGRAMS += searched_file_test
1589MOSTLYCLEANFILES += searched_file_test searched_file_test_lib.o \
1590 alt/searched_file_test_lib.a
1591searched_file_test_SOURCES = searched_file_test.cc
1592searched_file_test_DEPENDENCIES = alt/searched_file_test_lib.a
1593searched_file_test_LDFLAGS = -Bgcctestdir/ -Lalt
1594searched_file_test_LDADD = -l:searched_file_test_lib.a
1595searched_file_test_lib.o: searched_file_test_lib.cc
1596 $(CXXCOMPILE) -c -o $@ $<
1597alt/searched_file_test_lib.a: searched_file_test_lib.o
1598 test -d alt || mkdir -p alt
1599 $(TEST_AR) rc $@ $^
1600
c5617f2f
DK
1601# Test that no .gnu.version sections are created when
1602# symbol versioning is not used.
1603check_SCRIPTS += no_version_test.sh
1604check_DATA += no_version_test.stdout
1605MOSTLYCLEANFILES += libno_version_test.so no_version_test.stdout
1606# We invoke the linker directly since gcc may include additional objects that
1607# uses symbol versioning.
1608libno_version_test.so: no_version_test.o gcctestdir/ld
1609 gcctestdir/ld -shared -o $@ no_version_test.o
1610no_version_test.o: no_version_test.c
1611 $(COMPILE) -o $@ -c -fPIC $<
1612no_version_test.stdout: libno_version_test.so
1613 $(TEST_OBJDUMP) -h $< > $@
1614
7223e9ca
ILT
1615# Test STT_GNU_IFUNC symbols.
1616if IFUNC
1617
1618ifuncmod1.o: ifuncmod1.c
1619 $(COMPILE) -c -fpic -o $@ $<
1620ifuncmod1.so: ifuncmod1.o gcctestdir/ld
1621 $(LINK) -Bgcctestdir/ -shared ifuncmod1.o
1622
1623ifuncdep1.o: ifuncmod1.c
1624 $(COMPILE) -c -o $@ $<
1625
1626ifuncmain1pic.o: ifuncmain1.c
1627 $(COMPILE) -c -fpic -o $@ $<
1628ifuncmain1pie.o: ifuncmain1.c
1629 $(COMPILE) -c -fpie -o $@ $<
1630
328c7c2f 1631if HAVE_STATIC
7223e9ca
ILT
1632check_PROGRAMS += ifuncmain1static
1633ifuncmain1static_SOURCES = ifuncmain1.c
1634ifuncmain1static_DEPENDENCIES = gcctestdir/ld ifuncdep1.o
1635ifuncmain1static_LDFLAGS = -Bgcctestdir/ -static
1636ifuncmain1static_LDADD = ifuncdep1.o
1637
1638check_PROGRAMS += ifuncmain1picstatic
1639ifuncmain1picstatic: ifuncmain1pic.o ifuncmod1.o gcctestdir/ld
1640 $(LINK) -Bgcctestdir/ -static ifuncmain1pic.o ifuncmod1.o
328c7c2f 1641endif
7223e9ca
ILT
1642
1643check_PROGRAMS += ifuncmain1
1644ifuncmain1_SOURCES = ifuncmain1.c
1645ifuncmain1_DEPENDENCIES = gcctestdir/ld ifuncmod1.so
1646ifuncmain1_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1647ifuncmain1_LDADD = ifuncmod1.so
1648
1649check_PROGRAMS += ifuncmain1pic
1650ifuncmain1pic: ifuncmain1pic.o ifuncmod1.so gcctestdir/ld
1651 $(LINK) -Bgcctestdir/ ifuncmain1pic.o ifuncmod1.so -Wl,-R,.
1652
1653check_PROGRAMS += ifuncmain1vis
1654ifuncmain1vis_SOURCES = ifuncmain1vis.c
1655ifuncmain1vis_DEPENDENCIES = gcctestdir/ld ifuncmod1.so
1656ifuncmain1vis_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1657ifuncmain1vis_LDADD = ifuncmod1.so
1658
1659check_PROGRAMS += ifuncmain1vispic
1660ifuncmain1vispic.o: ifuncmain1vis.c
1661 $(COMPILE) -c -fpic -o $@ $<
1662ifuncmain1vispic: ifuncmain1vispic.o ifuncmod1.so gcctestdir/ld
1663 $(LINK) -Bgcctestdir/ ifuncmain1pic.o ifuncmod1.so -Wl,-R,.
1664
1665check_PROGRAMS += ifuncmain1staticpic
1666ifuncmain1staticpic: ifuncmain1pic.o ifuncmod1.o gcctestdir/ld
1667 $(LINK) -Bgcctestdir/ ifuncmain1pic.o ifuncmod1.o
1668
1669check_PROGRAMS += ifuncmain1pie
1670ifuncmain1pie: ifuncmain1pie.o ifuncmod1.so gcctestdir/ld
1671 $(LINK) -Bgcctestdir/ -pie ifuncmain1pie.o ifuncmod1.so -Wl,-R,.
1672
1673check_PROGRAMS += ifuncmain1vispie
1674ifuncmain1vispie.o: ifuncmain1vis.c
1675 $(COMPILE) -c -fpie -o $@ $<
1676ifuncmain1vispie: ifuncmain1vispie.o ifuncmod1.so gcctestdir/ld
1677 $(LINK) -Bgcctestdir/ -pie ifuncmain1vispie.o ifuncmod1.so -Wl,-R,.
1678
1679check_PROGRAMS += ifuncmain1staticpie
1680ifuncmain1staticpie: ifuncmain1pie.o ifuncmod1.o gcctestdir/ld
1681 $(LINK) -Bgcctestdir/ -pie ifuncmain1pie.o ifuncmod1.o
1682
1683ifuncmain2pic.o: ifuncmain2.c
1684 $(COMPILE) -c -fpic -o $@ $<
1685
1686ifuncdep2pic.o: ifuncdep2.c
1687 $(COMPILE) -c -fpic -o $@ $<
1688
328c7c2f 1689if HAVE_STATIC
7223e9ca
ILT
1690check_PROGRAMS += ifuncmain2static
1691ifuncmain2static_SOURCES = ifuncmain2.c ifuncdep2.c
1692ifuncmain2static_DEPENDENCIES = gcctestdir/ld
1693ifuncmain2static_LDFLAGS = -Bgcctestdir/ -static
f8e9a930 1694ifuncmain2static_LDADD =
7223e9ca
ILT
1695
1696check_PROGRAMS += ifuncmain2picstatic
1697ifuncmain2picstatic: ifuncmain2pic.o ifuncdep2pic.o gcctestdir/ld
1698 $(LINK) -Bgcctestdir/ -static ifuncmain2pic.o ifuncdep2pic.o
328c7c2f 1699endif
7223e9ca
ILT
1700
1701check_PROGRAMS += ifuncmain2
1702ifuncmain2_SOURCES = ifuncmain2.c ifuncdep2.c
1703ifuncmain2_DEPENDENCIES = gcctestdir/ld
1704ifuncmain2_LDFLAGS = -Bgcctestdir/
f8e9a930 1705ifuncmain2_LDADD =
7223e9ca
ILT
1706
1707check_PROGRAMS += ifuncmain2pic
1708ifuncmain2pic: ifuncmain2pic.o ifuncdep2pic.o gcctestdir/ld
1709 $(LINK) -Bgcctestdir/ ifuncmain2pic.o ifuncdep2pic.o
1710
1711ifuncmod3.o: ifuncmod3.c
1712 $(COMPILE) -c -fpic -o $@ $<
1713ifuncmod3.so: ifuncmod3.o gcctestdir/ld
1714 $(LINK) -Bgcctestdir/ -shared ifuncmod3.o
1715
1716check_PROGRAMS += ifuncmain3
1717ifuncmain3_SOURCES = ifuncmain3.c
1718ifuncmain3_DEPENDENCIES = gcctestdir/ld ifuncmod3.so
1719ifuncmain3_LDFLAGS = -Bgcctestdir/ -Wl,--export-dynamic -Wl,-R,.
1720ifuncmain3_LDADD = -ldl
1721
1722ifuncmain4pic.o: ifuncmain4.c
1723 $(COMPILE) -c -fpic -o $@ $<
1724
328c7c2f 1725if HAVE_STATIC
7223e9ca
ILT
1726check_PROGRAMS += ifuncmain4static
1727ifuncmain4static_SOURCES = ifuncmain4.c
1728ifuncmain4static_DEPENDENCIES = gcctestdir/ld
1729ifuncmain4static_LDFLAGS = -Bgcctestdir/ -static
f8e9a930 1730ifuncmain4static_LDADD =
7223e9ca
ILT
1731
1732check_PROGRAMS += ifuncmain4picstatic
1733ifuncmain4picstatic: ifuncmain4pic.o gcctestdir/ld
1734 $(LINK) -Bgcctestdir/ -static ifuncmain4pic.o
328c7c2f 1735endif
7223e9ca
ILT
1736
1737check_PROGRAMS += ifuncmain4
1738ifuncmain4_SOURCES = ifuncmain4.c
1739ifuncmain4_DEPENDENCIES = gcctestdir/ld
1740ifuncmain4_LDFLAGS = -Bgcctestdir/
f8e9a930 1741ifuncmain4_LDADD =
7223e9ca
ILT
1742
1743ifuncmain5pic.o: ifuncmain5.c
1744 $(COMPILE) -c -fpic -o $@ $<
1745
1746ifuncmain5pie.o: ifuncmain5.c
1747 $(COMPILE) -c -fpie -o $@ $<
1748
1749ifuncmod5.o: ifuncmod5.c
1750 $(COMPILE) -c -fpic -o $@ $<
1751ifuncmod5.so: ifuncmod5.o gcctestdir/ld
1752 $(LINK) -Bgcctestdir/ -shared ifuncmod5.o
1753
1754ifuncdep5.o: ifuncmod5.c
1755 $(COMPILE) -c -o $@ $<
1756
328c7c2f 1757if HAVE_STATIC
7223e9ca
ILT
1758check_PROGRAMS += ifuncmain5static
1759ifuncmain5static_SOURCES = ifuncmain5.c
1760ifuncmain5static_DEPENDENCIES = gcctestdir/ld ifuncdep5.o
1761ifuncmain5static_LDFLAGS = -Bgcctestdir/ -static
1762ifuncmain5static_LDADD = ifuncdep5.o
1763
1764check_PROGRAMS += ifuncmain5picstatic
1765ifuncmain5picstatic: ifuncmain5pic.o ifuncmod5.o gcctestdir/ld
1766 $(LINK) -Bgcctestdir/ -static ifuncmain5pic.o ifuncmod5.o
328c7c2f 1767endif
7223e9ca
ILT
1768
1769check_PROGRAMS += ifuncmain5
1770ifuncmain5_SOURCES = ifuncmain5.c
1771ifuncmain5_DEPENDENCIES = gcctestdir/ld ifuncmod5.so
1772ifuncmain5_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1773ifuncmain5_LDADD = ifuncmod5.so
1774
1775check_PROGRAMS += ifuncmain5pic
1776ifuncmain5pic: ifuncmain5pic.o ifuncmod5.so gcctestdir/ld
1777 $(LINK) -Bgcctestdir/ ifuncmain5pic.o ifuncmod5.so -Wl,-R,.
1778
1779check_PROGRAMS += ifuncmain5staticpic
1780ifuncmain5staticpic: ifuncmain5pic.o ifuncmod5.o gcctestdir/ld
1781 $(LINK) -Bgcctestdir/ ifuncmain5pic.o ifuncmod5.o
1782
1783check_PROGRAMS += ifuncmain5pie
1784ifuncmain5pie: ifuncmain5pie.o ifuncmod5.so gcctestdir/ld
1785 $(LINK) -Bgcctestdir/ -pie ifuncmain5pie.o ifuncmod5.so -Wl,-R,.
1786
1787ifuncmain6pie.o: ifuncmain6pie.c
1788 $(COMPILE) -c -fpie -o $@ $<
1789
1790ifuncmod6.o: ifuncmod6.c
1791 $(COMPILE) -c -fpic -o $@ $<
1792ifuncmod6.so: ifuncmod6.o gcctestdir/ld
1793 $(LINK) -Bgcctestdir/ -shared ifuncmod6.o
1794
1795check_PROGRAMS += ifuncmain6pie
1796ifuncmain6pie: ifuncmain6pie.o ifuncmod6.so gcctestdir/ld
1797 $(LINK) -Bgcctestdir/ -pie ifuncmain6pie.o ifuncmod6.so -Wl,-R,.
1798
1799ifuncmain7pic.o: ifuncmain7.c
1800 $(COMPILE) -c -fpic -o $@ $<
1801
1802ifuncmain7pie.o: ifuncmain7.c
1803 $(COMPILE) -c -fpie -o $@ $<
1804
328c7c2f 1805if HAVE_STATIC
7223e9ca
ILT
1806check_PROGRAMS += ifuncmain7static
1807ifuncmain7static_SOURCES = ifuncmain7.c
1808ifuncmain7static_DEPENDENCIES = gcctestdir/ld
1809ifuncmain7static_LDFLAGS = -Bgcctestdir/ -static
f8e9a930 1810ifuncmain7static_LDADD =
7223e9ca
ILT
1811
1812check_PROGRAMS += ifuncmain7picstatic
1813ifuncmain7picstatic: ifuncmain7pic.o gcctestdir/ld
1814 $(LINK) -Bgcctestdir/ -static ifuncmain7pic.o
328c7c2f 1815endif
7223e9ca
ILT
1816
1817check_PROGRAMS += ifuncmain7
1818ifuncmain7_SOURCES = ifuncmain7.c
1819ifuncmain7_DEPENDENCIES = gcctestdir/ld
1820ifuncmain7_LDFLAGS = -Bgcctestdir/
f8e9a930 1821ifuncmain7_LDADD =
7223e9ca
ILT
1822
1823check_PROGRAMS += ifuncmain7pic
1824ifuncmain7pic: ifuncmain7pic.o gcctestdir/ld
1825 $(LINK) -Bgcctestdir/ ifuncmain7pic.o
1826
1827check_PROGRAMS += ifuncmain7pie
1828ifuncmain7pie: ifuncmain7pie.o gcctestdir/ld
1829 $(LINK) -Bgcctestdir/ -pie ifuncmain7pie.o
1830
1831endif IFUNC
1832
74f67560
DK
1833# Test that strong reference to a weak symbol in a DSO remains strong.
1834check_SCRIPTS += strong_ref_weak_def.sh
1835check_DATA += strong_ref_weak_def.stdout
1836MOSTLYCLEANFILES += strong_ref_weak_def_1.so strong_ref_weak_def_2.so \
1837 strong_ref_weak_def.stdout
1838strong_ref_weak_def_2.o: strong_ref_weak_def_2.c
1839 $(COMPILE) -o $@ -c -fPIC $<
1840strong_ref_weak_def_2.so: strong_ref_weak_def_2.o gcctestdir/ld
1841 gcctestdir/ld -shared -o $@ strong_ref_weak_def_2.o
1842strong_ref_weak_def_1.o: strong_ref_weak_def_1.c
1843 $(COMPILE) -o $@ -c -fPIC $<
1844strong_ref_weak_def_1.so: strong_ref_weak_def_1.o strong_ref_weak_def_2.so \
1845 gcctestdir/ld
1846 gcctestdir/ld -shared -o $@ strong_ref_weak_def_1.o \
1847 strong_ref_weak_def_2.so
1848strong_ref_weak_def.stdout: strong_ref_weak_def_1.so
1849 $(TEST_READELF) -sWD $< > $@
1850
a4649286
DK
1851# Test that a strong weak reference remains strong if there is another
1852# weak reference in a DSO.
1853check_SCRIPTS += dyn_weak_ref.sh
1854check_DATA += dyn_weak_ref.stdout
1855MOSTLYCLEANFILES += dyn_weak_ref_1.so dyn_weak_ref_2.so \
1856 dyn_weak_ref.stdout
1857dyn_weak_ref_2.o: dyn_weak_ref_2.c
1858 $(COMPILE) -o $@ -c -fPIC $<
1859dyn_weak_ref_2.so: dyn_weak_ref_2.o gcctestdir/ld
1860 gcctestdir/ld -shared -o $@ dyn_weak_ref_2.o
1861dyn_weak_ref_1.o: dyn_weak_ref_1.c
1862 $(COMPILE) -o $@ -c -fPIC $<
1863# We intentionally put dyn_weak_ref_2.so in front of dyn_weak_ref_1.o
1864# so that the weak ref there goes to gold's symbol table first.
1865dyn_weak_ref_1.so: dyn_weak_ref_1.o dyn_weak_ref_2.so gcctestdir/ld
1866 gcctestdir/ld -shared -o $@ dyn_weak_ref_2.so dyn_weak_ref_1.o
1867dyn_weak_ref.stdout: dyn_weak_ref_1.so
1868 $(TEST_READELF) -sWD $< > $@
1869
1870
97b4be1c
CC
1871# Test that --start-lib and --end-lib function correctly.
1872check_PROGRAMS += start_lib_test
1873start_lib_test: start_lib_test_main.o libstart_lib_test.a start_lib_test_2.o start_lib_test_3.o \
1874 gcctestdir/ld
1875 $(LINK) -Bgcctestdir/ -o $@ start_lib_test_main.o -L. -lstart_lib_test \
1876 -Wl,--start-lib start_lib_test_2.o start_lib_test_3.o -Wl,--end-lib
1877libstart_lib_test.a: start_lib_test_1.o
1878 $(TEST_AR) rc $@ $^
1879
7f8cd844
NC
1880# Test that MEMORY region support works.
1881check_SCRIPTS += memory_test.sh
1882check_DATA += memory_test.stdout
1883MOSTLYCLEANFILES += memory_test.stdout memory_test memory_test.o
d4d91489
ILT
1884memory_test.o: memory_test.s
1885 $(COMPILE) -o $@ -c $<
1886memory_test: memory_test.o gcctestdir/ld $(srcdir)/memory_test.t
7f8cd844
NC
1887 $(LINK) -Bgcctestdir/ -nostartfiles -nostdlib -T $(srcdir)/memory_test.t -o $@ memory_test.o
1888memory_test.stdout: memory_test
41a8542a 1889 $(TEST_READELF) -lWS $< > $@
7f8cd844 1890
2eedd706
CC
1891# End-to-end incremental linking tests.
1892# Incremental linking is currently supported only on the x86_64 target.
1893
1894if DEFAULT_TARGET_X86_64
1895
1896check_PROGRAMS += incremental_test_2
c49875be 1897MOSTLYCLEANFILES += two_file_test_tmp_2.o
2eedd706
CC
1898incremental_test_2: two_file_test_1_v1.o two_file_test_1.o two_file_test_1b.o \
1899 two_file_test_2.o two_file_test_main.o gcctestdir/ld
c49875be
ILT
1900 cp -f two_file_test_1_v1.o two_file_test_tmp_2.o
1901 $(CXXLINK) -Wl,--incremental-full -Bgcctestdir/ two_file_test_tmp_2.o two_file_test_1b.o two_file_test_2.o two_file_test_main.o
2eedd706 1902 @sleep 1
c49875be
ILT
1903 cp -f two_file_test_1.o two_file_test_tmp_2.o
1904 $(CXXLINK) -Wl,--incremental-update -Bgcctestdir/ two_file_test_tmp_2.o two_file_test_1b.o two_file_test_2.o two_file_test_main.o
2eedd706
CC
1905
1906check_PROGRAMS += incremental_test_3
c49875be 1907MOSTLYCLEANFILES += two_file_test_tmp_3.o
2eedd706
CC
1908incremental_test_3: two_file_test_1.o two_file_test_1b_v1.o two_file_test_1b.o \
1909 two_file_test_2.o two_file_test_main.o gcctestdir/ld
c49875be
ILT
1910 cp -f two_file_test_1b_v1.o two_file_test_tmp_3.o
1911 $(CXXLINK) -Wl,--incremental-full -Bgcctestdir/ two_file_test_1.o two_file_test_tmp_3.o two_file_test_2.o two_file_test_main.o
2eedd706 1912 @sleep 1
c49875be
ILT
1913 cp -f two_file_test_1b.o two_file_test_tmp_3.o
1914 $(CXXLINK) -Wl,--incremental-update -Bgcctestdir/ two_file_test_1.o two_file_test_tmp_3.o two_file_test_2.o two_file_test_main.o
2eedd706
CC
1915
1916check_PROGRAMS += incremental_test_4
c49875be 1917MOSTLYCLEANFILES += incremental_test_4.base two_file_test_tmp_4.o
2eedd706
CC
1918incremental_test_4: two_file_test_1.o two_file_test_1b.o two_file_test_2_v1.o \
1919 two_file_test_2.o two_file_test_main.o gcctestdir/ld
c49875be
ILT
1920 cp -f two_file_test_2_v1.o two_file_test_tmp_4.o
1921 $(CXXLINK) -Wl,--incremental-full -Bgcctestdir/ two_file_test_1.o two_file_test_1b.o two_file_test_tmp_4.o two_file_test_main.o
aa92d6ed 1922 mv -f incremental_test_4 incremental_test_4.base
2eedd706 1923 @sleep 1
c49875be
ILT
1924 cp -f two_file_test_2.o two_file_test_tmp_4.o
1925 $(CXXLINK) -Wl,--incremental-update,--incremental-base=incremental_test_4.base -Bgcctestdir/ two_file_test_1.o two_file_test_1b.o two_file_test_tmp_4.o two_file_test_main.o
2eedd706 1926
a5ee4d5d
CC
1927check_PROGRAMS += incremental_copy_test
1928incremental_copy_test: copy_test_v1.o copy_test.o copy_test_1.so copy_test_2.so
1929 cp -f copy_test_v1.o copy_test_tmp.o
1930 $(CXXLINK) -Wl,--incremental-full -Bgcctestdir/ -Wl,-R,. copy_test_tmp.o copy_test_1.so copy_test_2.so
1931 @sleep 1
1932 cp -f copy_test.o copy_test_tmp.o
1933 $(CXXLINK) -Wl,--incremental-update -Bgcctestdir/ -Wl,-R,. copy_test_tmp.o copy_test_1.so copy_test_2.so
1934
1935check_PROGRAMS += incremental_common_test_1
1936incremental_common_test_1: common_test_1_v1.o common_test_1_v2.o gcctestdir/ld
1937 cp -f common_test_1_v1.o common_test_1_tmp.o
1938 $(CXXLINK) -Wl,--incremental-full -Bgcctestdir/ common_test_1_tmp.o
1939 @sleep 1
1940 cp -f common_test_1_v2.o common_test_1_tmp.o
1941 $(CXXLINK) -Wl,--incremental-update -Bgcctestdir/ common_test_1_tmp.o
1942
2eedd706
CC
1943endif DEFAULT_TARGET_X86_64
1944
351a8000
ILT
1945endif GCC
1946endif NATIVE_LINKER
364c7fa5 1947
eb373049
ILT
1948# These tests work with native and cross linkers.
1949
1950if NATIVE_OR_CROSS_LINKER
1951
1952# Test script section order.
1953check_SCRIPTS += script_test_10.sh
1954check_DATA += script_test_10.stdout
1955script_test_10.o: script_test_10.s
1956 $(TEST_AS) -o $@ $<
1957script_test_10: $(srcdir)/script_test_10.t script_test_10.o gcctestdir/ld
1958 gcctestdir/ld -o $@ script_test_10.o -T $(srcdir)/script_test_10.t
1959script_test_10.stdout: script_test_10
1960 $(TEST_READELF) -SW script_test_10 > $@
1961
1962# These tests work with cross linkers only.
364c7fa5
ILT
1963
1964if DEFAULT_TARGET_I386
1965
1966check_SCRIPTS += split_i386.sh
1967check_DATA += split_i386_1.stdout split_i386_2.stdout \
1968 split_i386_3.stdout split_i386_4.stdout split_i386_r.stdout
1969SPLIT_DEFSYMS = --defsym __morestack=0x100 --defsym __morestack_non_split=0x200
1970split_i386_1.o: split_i386_1.s
1971 $(TEST_AS) -o $@ $<
1972split_i386_2.o: split_i386_2.s
1973 $(TEST_AS) -o $@ $<
1974split_i386_3.o: split_i386_3.s
1975 $(TEST_AS) -o $@ $<
1976split_i386_4.o: split_i386_4.s
1977 $(TEST_AS) -o $@ $<
1978split_i386_n.o: split_i386_n.s
1979 $(TEST_AS) -o $@ $<
1980split_i386_1: split_i386_1.o split_i386_n.o ../ld-new
1981 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_i386_1.o split_i386_n.o
1982split_i386_1.stdout: split_i386_1
1983 $(TEST_OBJDUMP) -d $< > $@
1984split_i386_2: split_i386_2.o split_i386_n.o ../ld-new
1985 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_i386_2.o split_i386_n.o
1986split_i386_2.stdout: split_i386_2
1987 $(TEST_OBJDUMP) -d $< > $@
1988split_i386_3.stdout: split_i386_3.o split_i386_n.o ../ld-new
1989 ../ld-new $(SPLIT_DEFSYMS) -o split_i386_3 split_i386_3.o split_i386_n.o > $@ 2>&1 || exit 0
1990split_i386_4: split_i386_4.o split_i386_n.o ../ld-new
1991 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_i386_4.o split_i386_n.o
1992split_i386_4.stdout: split_i386_4
1993 $(TEST_OBJDUMP) -d $< > $@
1994split_i386_r.stdout: split_i386_1.o split_i386_n.o ../ld-new
1995 ../ld-new -r split_i386_1.o split_i386_n.o -o split_i386_r > $@ 2>&1 || exit 0
1996MOSTLYCLEANFILES += split_i386_1 split_i386_2 split_i386_3 \
1997 split_i386_4 split_i386_r
1998
1999endif DEFAULT_TARGET_I386
2000
2001if DEFAULT_TARGET_X86_64
2002
2003check_SCRIPTS += split_x86_64.sh
2004check_DATA += split_x86_64_1.stdout split_x86_64_2.stdout \
2005 split_x86_64_3.stdout split_x86_64_4.stdout split_x86_64_r.stdout
2006SPLIT_DEFSYMS = --defsym __morestack=0x100 --defsym __morestack_non_split=0x200
2007split_x86_64_1.o: split_x86_64_1.s
2008 $(TEST_AS) -o $@ $<
2009split_x86_64_2.o: split_x86_64_2.s
2010 $(TEST_AS) -o $@ $<
2011split_x86_64_3.o: split_x86_64_3.s
2012 $(TEST_AS) -o $@ $<
2013split_x86_64_4.o: split_x86_64_4.s
2014 $(TEST_AS) -o $@ $<
2015split_x86_64_n.o: split_x86_64_n.s
2016 $(TEST_AS) -o $@ $<
2017split_x86_64_1: split_x86_64_1.o split_x86_64_n.o ../ld-new
2018 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x86_64_1.o split_x86_64_n.o
2019split_x86_64_1.stdout: split_x86_64_1
2020 $(TEST_OBJDUMP) -d $< > $@
2021split_x86_64_2: split_x86_64_2.o split_x86_64_n.o ../ld-new
2022 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x86_64_2.o split_x86_64_n.o
2023split_x86_64_2.stdout: split_x86_64_2
2024 $(TEST_OBJDUMP) -d $< > $@
2025split_x86_64_3.stdout: split_x86_64_3.o split_x86_64_n.o ../ld-new
2026 ../ld-new $(SPLIT_DEFSYMS) -o split_x86_64_3 split_x86_64_3.o split_x86_64_n.o > $@ 2>&1 || exit 0
2027split_x86_64_4: split_x86_64_4.o split_x86_64_n.o ../ld-new
2028 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x86_64_4.o split_x86_64_n.o
2029split_x86_64_4.stdout: split_x86_64_4
2030 $(TEST_OBJDUMP) -d $< > $@
2031split_x86_64_r.stdout: split_x86_64_1.o split_x86_64_n.o ../ld-new
2032 ../ld-new -r split_x86_64_1.o split_x86_64_n.o -o split_x86_64_r > $@ 2>&1 || exit 0
2033MOSTLYCLEANFILES += split_x86_64_1 split_x86_64_2 split_x86_64_3 \
2034 split_x86_64_4 split_x86_64_r
2035
2036endif DEFAULT_TARGET_X86_64
e4782e83
DK
2037
2038if DEFAULT_TARGET_ARM
2039
2040check_SCRIPTS += arm_abs_global.sh
2041check_DATA += arm_abs_global.stdout
2042arm_abs_lib.o: arm_abs_lib.s
2043 $(TEST_AS) -march=armv7-a -o $@ $<
d3bbad62 2044libarm_abs.so: arm_abs_lib.o ../ld-new
e4782e83
DK
2045 ../ld-new -shared -o $@ arm_abs_lib.o
2046arm_abs_global.o: arm_abs_global.s
2047 $(TEST_AS) -march=armv7-a -o $@ $<
d3bbad62 2048arm_abs_global: arm_abs_global.o libarm_abs.so ../ld-new
e4782e83
DK
2049 ../ld-new -o $@ arm_abs_global.o -L. -larm_abs
2050arm_abs_global.stdout: arm_abs_global
2051 $(TEST_READELF) -r $< > $@
2052
2053MOSTLYCLEANFILES += arm_abs_global
2054
aa98ff75 2055check_SCRIPTS += arm_branch_in_range.sh arm_branch_out_of_range.sh
2a2b6d42
DK
2056check_DATA += arm_bl_in_range.stdout arm_bl_out_of_range.stdout \
2057 thumb_bl_in_range.stdout thumb_bl_out_of_range.stdout \
a2c7281b
DK
2058 thumb2_bl_in_range.stdout thumb2_bl_out_of_range.stdout \
2059 thumb_blx_in_range.stdout thumb_blx_out_of_range.stdout \
aa98ff75 2060 thumb2_blx_in_range.stdout thumb2_blx_out_of_range.stdout \
57eb9b50
DK
2061 thumb_bl_out_of_range_local.stdout arm_thm_jump11.stdout \
2062 arm_thm_jump8.stdout
2a2b6d42
DK
2063
2064arm_bl_in_range.stdout: arm_bl_in_range
2065 $(TEST_OBJDUMP) -D $< > $@
2066
d3bbad62 2067arm_bl_in_range: arm_bl_in_range.o ../ld-new
2a2b6d42
DK
2068 ../ld-new -T $(srcdir)/arm_branch_range.t -o $@ $<
2069
2070arm_bl_in_range.o: arm_bl_in_range.s
2071 $(TEST_AS) -o $@ $<
2072
2073arm_bl_out_of_range.stdout: arm_bl_out_of_range
2074 $(TEST_OBJDUMP) -S $< > $@
2075
d3bbad62 2076arm_bl_out_of_range: arm_bl_out_of_range.o ../ld-new
2a2b6d42
DK
2077 ../ld-new -T $(srcdir)/arm_branch_range.t -o $@ $<
2078
2079arm_bl_out_of_range.o: arm_bl_out_of_range.s
2080 $(TEST_AS) -o $@ $<
2081
2082thumb_bl_in_range.stdout: thumb_bl_in_range
2083 $(TEST_OBJDUMP) -D $< > $@
2084
d3bbad62 2085thumb_bl_in_range: thumb_bl_in_range.o ../ld-new
2a2b6d42
DK
2086 ../ld-new -T $(srcdir)/thumb_branch_range.t -o $@ $<
2087
2088thumb_bl_in_range.o: thumb_bl_in_range.s
2089 $(TEST_AS) -o $@ -march=armv5te $<
2090
2091thumb_bl_out_of_range.stdout: thumb_bl_out_of_range
2092 $(TEST_OBJDUMP) -D $< > $@
2093
a2c7281b 2094thumb_bl_out_of_range: thumb_bl_out_of_range.o ../ld-new
2a2b6d42
DK
2095 ../ld-new -T $(srcdir)/thumb_branch_range.t -o $@ $<
2096
a2c7281b 2097thumb_bl_out_of_range.o: thumb_bl_out_of_range.s
2a2b6d42
DK
2098 $(TEST_AS) -o $@ -march=armv5te $<
2099
2100thumb2_bl_in_range.stdout: thumb2_bl_in_range
2101 $(TEST_OBJDUMP) -D $< > $@
2102
d3bbad62 2103thumb2_bl_in_range: thumb2_bl_in_range.o ../ld-new
2a2b6d42
DK
2104 ../ld-new -T $(srcdir)/thumb2_branch_range.t -o $@ $<
2105
2106thumb2_bl_in_range.o: thumb_bl_in_range.s
2107 $(TEST_AS) -o $@ -march=armv7-a $<
2108
2109thumb2_bl_out_of_range.stdout: thumb2_bl_out_of_range
2110 $(TEST_OBJDUMP) -D $< > $@
2111
a2c7281b 2112thumb2_bl_out_of_range: thumb2_bl_out_of_range.o ../ld-new
2a2b6d42
DK
2113 ../ld-new -T $(srcdir)/thumb2_branch_range.t -o $@ $<
2114
a2c7281b
DK
2115thumb2_bl_out_of_range.o: thumb_bl_out_of_range.s
2116 $(TEST_AS) -o $@ -march=armv7-a $<
2117
2118thumb_blx_in_range.stdout: thumb_blx_in_range
2119 $(TEST_OBJDUMP) -D $< > $@
2120
2121thumb_blx_in_range: thumb_blx_in_range.o ../ld-new
2122 ../ld-new -T $(srcdir)/thumb_branch_range.t -o $@ $<
2123
2124thumb_blx_in_range.o: thumb_blx_in_range.s
2125 $(TEST_AS) -o $@ -march=armv5te $<
2126
2127thumb_blx_out_of_range.stdout: thumb_blx_out_of_range
2128 $(TEST_OBJDUMP) -D $< > $@
2129
2130thumb_blx_out_of_range: thumb_blx_out_of_range.o ../ld-new
2131 ../ld-new -T $(srcdir)/thumb_branch_range.t -o $@ $<
2132
2133thumb_blx_out_of_range.o: thumb_blx_out_of_range.s
2134 $(TEST_AS) -o $@ -march=armv5te $<
2135
2136thumb2_blx_in_range.stdout: thumb2_blx_in_range
2137 $(TEST_OBJDUMP) -D $< > $@
2138
2139thumb2_blx_in_range: thumb2_blx_in_range.o ../ld-new
2140 ../ld-new -T $(srcdir)/thumb2_branch_range.t -o $@ $<
2141
2142thumb2_blx_in_range.o: thumb_blx_in_range.s
2143 $(TEST_AS) -o $@ -march=armv7-a $<
2144
2145thumb2_blx_out_of_range.stdout: thumb2_blx_out_of_range
2146 $(TEST_OBJDUMP) -D $< > $@
2147
2148thumb2_blx_out_of_range: thumb2_blx_out_of_range.o ../ld-new
2149 ../ld-new -T $(srcdir)/thumb2_branch_range.t -o $@ $<
2150
2151thumb2_blx_out_of_range.o: thumb_blx_out_of_range.s
2a2b6d42
DK
2152 $(TEST_AS) -o $@ -march=armv7-a $<
2153
aa98ff75
DK
2154thumb_bl_out_of_range_local.stdout: thumb_bl_out_of_range_local
2155 $(TEST_OBJDUMP) -D $< > $@
2156
2157thumb_bl_out_of_range_local: thumb_bl_out_of_range_local.o ../ld-new
2158 ../ld-new -T $(srcdir)/thumb_branch_range.t -o $@ $<
2159
2160thumb_bl_out_of_range_local.o: thumb_bl_out_of_range_local.s
2161 $(TEST_AS) -o $@ -march=armv5te $<
2162
57eb9b50
DK
2163arm_thm_jump11.stdout: arm_thm_jump11
2164 $(TEST_OBJDUMP) -D $< > $@
2165
2166arm_thm_jump11: arm_thm_jump11.o ../ld-new
2167 ../ld-new -T $(srcdir)/arm_thm_jump11.t -o $@ $<
2168
2169arm_thm_jump11.o: arm_thm_jump11.s
2170 $(TEST_AS) -o $@ $<
2171
2172arm_thm_jump8.stdout: arm_thm_jump8
2173 $(TEST_OBJDUMP) -D $< > $@
2174
2175arm_thm_jump8: arm_thm_jump8.o ../ld-new
2176 ../ld-new -T $(srcdir)/arm_thm_jump8.t -o $@ $<
2177
2178arm_thm_jump8.o: arm_thm_jump8.s
2179 $(TEST_AS) -o $@ $<
2180
2a2b6d42 2181MOSTLYCLEANFILES += arm_bl_in_range arm_bl_out_of_range thumb_bl_in_range \
a2c7281b
DK
2182 thumb_bl_out_of_range thumb2_bl_in_range thumb2_bl_out_of_range \
2183 thumb_blx_in_range thumb_blx_out_of_range thumb2_blx_in_range \
57eb9b50
DK
2184 thumb2_blx_out_of_range thumb_bl_out_of_range_local arm_thm_jump11 \
2185 arm_thm_jump8
2a2b6d42 2186
2fd9ae7a
DK
2187check_SCRIPTS += arm_fix_v4bx.sh
2188check_DATA += arm_fix_v4bx.stdout arm_fix_v4bx_interworking.stdout \
2189 arm_no_fix_v4bx.stdout
2190
2191arm_fix_v4bx.stdout: arm_fix_v4bx
2192 $(TEST_OBJDUMP) -D -j.text $< > $@
2193
d3bbad62 2194arm_fix_v4bx: arm_fix_v4bx.o ../ld-new
2fd9ae7a
DK
2195 ../ld-new --fix-v4bx -o $@ $<
2196
2197arm_fix_v4bx.o: arm_fix_v4bx.s
2198 $(TEST_AS) -o $@ $<
2199
2200arm_fix_v4bx_interworking.stdout: arm_fix_v4bx_interworking
2201 $(TEST_OBJDUMP) -D -j.text $< > $@
2202
d3bbad62 2203arm_fix_v4bx_interworking: arm_fix_v4bx.o ../ld-new
2fd9ae7a
DK
2204 ../ld-new --fix-v4bx-interworking -o $@ $<
2205
2206arm_no_fix_v4bx.stdout: arm_no_fix_v4bx
2207 $(TEST_OBJDUMP) -D -j.text $< > $@
2208
d3bbad62 2209arm_no_fix_v4bx: arm_fix_v4bx.o ../ld-new
2fd9ae7a
DK
2210 ../ld-new -o $@ $<
2211
2212MOSTLYCLEANFILES += arm_fix_v4bx arm_fix_v4bx_interworking arm_no_fix_v4bx
2213
da59ad79
DK
2214check_SCRIPTS += arm_attr_merge.sh
2215check_DATA += arm_attr_merge_6.stdout arm_attr_merge_6r.stdout \
2216 arm_attr_merge_7.stdout
2217
2218arm_attr_merge_6.stdout: arm_attr_merge_6
2219 $(TEST_READELF) -A $< > $@
2220
2221arm_attr_merge_6: arm_attr_merge_6a.o arm_attr_merge_6b.o
2222 ../ld-new -o $@ arm_attr_merge_6a.o arm_attr_merge_6b.o
2223
2224arm_attr_merge_6a.o: arm_attr_merge_6a.s
2225 $(TEST_AS) -o $@ $<
2226
2227arm_attr_merge_6b.o: arm_attr_merge_6b.s
2228 $(TEST_AS) -o $@ $<
2229
2230arm_attr_merge_6r.stdout: arm_attr_merge_6r
2231 $(TEST_READELF) -A $< > $@
2232
2233arm_attr_merge_6r: arm_attr_merge_6b.o arm_attr_merge_6a.o
2234 ../ld-new -o $@ arm_attr_merge_6b.o arm_attr_merge_6a.o
2235
2236arm_attr_merge_7.stdout: arm_attr_merge_7
2237 $(TEST_READELF) -A $< > $@
2238
2239arm_attr_merge_7: arm_attr_merge_7a.o arm_attr_merge_7b.o
2240 ../ld-new -o $@ arm_attr_merge_7a.o arm_attr_merge_7b.o
2241
2242arm_attr_merge_7a.o: arm_attr_merge_7a.s
2243 $(TEST_AS) -o $@ $<
2244
2245arm_attr_merge_7b.o: arm_attr_merge_7b.s
2246 $(TEST_AS) -o $@ $<
2247
2248MOSTLYCLEANFILES += arm_attr_merge_6 arm_attr_merge_6r arm_attr_merge_7
2249
aa98ff75
DK
2250# Cortex-A8 workaround test.
2251
2252check_SCRIPTS += arm_cortex_a8.sh
2253check_DATA += arm_cortex_a8_b_cond.stdout arm_cortex_a8_b.stdout \
2254 arm_cortex_a8_bl.stdout arm_cortex_a8_blx.stdout \
2255 arm_cortex_a8_local.stdout arm_cortex_a8_local_reloc.stdout
2256
2257arm_cortex_a8_b_cond.stdout: arm_cortex_a8_b_cond
2258 $(TEST_OBJDUMP) -D -j.text $< > $@
2259
2260arm_cortex_a8_b_cond: arm_cortex_a8_b_cond.o ../ld-new
2261 ../ld-new -o $@ $<
2262
2263arm_cortex_a8_b_cond.o: arm_cortex_a8_b_cond.s
2264 $(TEST_AS) -o $@ $<
2265
2266arm_cortex_a8_b.stdout: arm_cortex_a8_b
2267 $(TEST_OBJDUMP) -D -j.text $< > $@
2268
2269arm_cortex_a8_b: arm_cortex_a8_b.o ../ld-new
2270 ../ld-new --fix-cortex-a8 -o $@ $<
2271
2272arm_cortex_a8_b.o: arm_cortex_a8_b.s
2273 $(TEST_AS) -o $@ $<
2274
2275arm_cortex_a8_bl.stdout: arm_cortex_a8_bl
2276 $(TEST_OBJDUMP) -D -j.text $< > $@
2277
2278arm_cortex_a8_bl: arm_cortex_a8_bl.o ../ld-new
2279 ../ld-new -o $@ $<
2280
2281arm_cortex_a8_bl.o: arm_cortex_a8_bl.s
2282 $(TEST_AS) -o $@ $<
2283
2284arm_cortex_a8_blx.stdout: arm_cortex_a8_blx
2285 $(TEST_OBJDUMP) -D -j.text $< > $@
2286
2287arm_cortex_a8_blx: arm_cortex_a8_blx.o ../ld-new
2288 ../ld-new -o $@ $<
2289
2290arm_cortex_a8_blx.o: arm_cortex_a8_blx.s
2291 $(TEST_AS) -o $@ $<
2292
2293arm_cortex_a8_local.stdout: arm_cortex_a8_local
2294 $(TEST_OBJDUMP) -D -j.text $< > $@
2295
2296arm_cortex_a8_local: arm_cortex_a8_local.o ../ld-new
2297 ../ld-new -o $@ $<
2298
2299arm_cortex_a8_local.o: arm_cortex_a8_local.s
2300 $(TEST_AS) -o $@ $<
2301
2302arm_cortex_a8_local_reloc.stdout: arm_cortex_a8_local_reloc
2303 $(TEST_OBJDUMP) -D -j.text $< > $@
2304
2305arm_cortex_a8_local_reloc: arm_cortex_a8_local_reloc.o ../ld-new
2306 ../ld-new -o $@ $<
2307
2308arm_cortex_a8_local_reloc.o: arm_cortex_a8_local_reloc.s
2309 $(TEST_AS) -o $@ $<
2310
2311MOSTLYCLEANFILES += arm_cortex_a8_b_cond arm_cortex_a8_b arm_cortex_a8_bl \
2312 arm_cortex_a8_blx arm_cortex_a8_local arm_cortex_a8_local_reloc
2313
c87e4302
DK
2314check_SCRIPTS += arm_exidx_test.sh
2315check_DATA += arm_exidx_test.stdout
2316
2317arm_exidx_test.stdout: arm_exidx_test.so
2318 $(TEST_READELF) -S $< > $@
2319
2320arm_exidx_test.so: arm_exidx_test.o ../ld-new
2321 ../ld-new -shared -o $@ $<
2322
2323arm_exidx_test.o: arm_exidx_test.s
2324 $(TEST_AS) -o $@ $<
2325
f62a3ca7
DK
2326check_SCRIPTS += pr12826.sh
2327check_DATA += pr12826.stdout
2328
2329pr12826.stdout: pr12826.so
2330 $(TEST_READELF) -A $< > $@
2331
2332pr12826.so: pr12826_1.o pr12826_2.o ../ld-new
2333 ../ld-new -shared -o $@ $<
2334
2335pr12826_1.o: pr12826_1.s
2336 $(TEST_AS) -o $@ $<
2337
2338pr12826_2.o: pr12826_2.s
2339 $(TEST_AS) -o $@ $<
c87e4302 2340
e4782e83 2341endif DEFAULT_TARGET_ARM
eb373049
ILT
2342
2343endif NATIVE_OR_CROSS_LINKER
2344
This page took 0.326564 seconds and 4 git commands to generate.