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