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