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