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