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