Get rid of VEC(interp_factory_p)
[deliverable/binutils-gdb.git] / gold / testsuite / Makefile.am
CommitLineData
5a6f7e2d
ILT
1# Process this file with automake to generate Makefile.in
2
537b5f51
ILT
3# As far as I can tell automake testing support assumes that the build
4# system and the host system are the same. So these tests will not
5# work when building with a cross-compiler.
6
14ec8efd
RW
7# Ignore warning about AM_PROG_CC_C_O due to large_CFLAGS
8AUTOMAKE_OPTIONS = foreign -Wno-portability
5a6f7e2d 9
918357b9
L
10# This is where we get zlib from. zlib is in ../../zlib unless we were
11# configured with --with-system-zlib, in which case ../../zlib either
12# doesn't exist or not configured.
13ZLIB = -L../../zlib -lz
14
f958d5fc 15# The two_file_test tests -fmerge-constants, so we simply always turn
2b64b551
RM
16# it on. For compilers that do not support the command-line option,
17# we assume they just always emit SHF_MERGE sections unconditionally.
18AM_CFLAGS = $(WARN_CFLAGS) $(LFS_CFLAGS) $(MERGE_CONSTANTS_FLAG)
19AM_CXXFLAGS = $(WARN_CXXFLAGS) $(LFS_CFLAGS) $(MERGE_CONSTANTS_FLAG)
5a6f7e2d 20
14ec8efd 21AM_CPPFLAGS = \
5a6f7e2d 22 -I$(srcdir) -I$(srcdir)/.. -I$(srcdir)/../../include \
155a0dd7 23 -I$(srcdir)/../../elfcpp -I.. \
5a6f7e2d
ILT
24 -DLOCALEDIR="\"$(datadir)/locale\"" \
25 @INCINTL@
26
ae447ddd
CC
27# Some versions of GCC now automatically enable linker plugins,
28# but we want to run our tests without GCC's plugins.
29if HAVE_NO_USE_LINKER_PLUGIN
30OPT_NO_PLUGINS = -fno-use-linker-plugin
31endif
32
aa543512
L
33# COMPILE1, LINK1, CXXCOMPILE1, CXXLINK1 are renamed from COMPILE, LINK,
34# CXXCOMPILE and CXXLINK generated by automake 1.11.1. FIXME: they should
35# be updated if they are different from automake used by gold.
36COMPILE1 = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
37 $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
ae447ddd
CC
38LINK1 = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(OPT_NO_PLUGINS) \
39 $(AM_LDFLAGS) $(LDFLAGS) -o $@
aa543512
L
40CXXCOMPILE1 = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
41 $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
ae447ddd
CC
42CXXLINK1 = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(OPT_NO_PLUGINS) \
43 $(AM_LDFLAGS) $(LDFLAGS) -o $@
aa543512 44
ae447ddd 45# Strip out -Wp,-D_FORTIFY_SOURCE=, which is irrelevant for the gold
aa543512
L
46# testsuite and incompatible with -O0 used in gold tests, from
47# COMPILE, LINK, CXXCOMPILE and CXXLINK.
48COMPILE = `echo $(COMPILE1) | sed -e 's/-Wp,-D_FORTIFY_SOURCE=[0-9[0-9]]*//'`
49LINK = `echo $(LINK1) | sed -e 's/-Wp,-D_FORTIFY_SOURCE=[0-9][0-9]*//'`
50CXXCOMPILE = `echo $(CXXCOMPILE1) | sed -e 's/-Wp,-D_FORTIFY_SOURCE=[0-9][0-9]*//'`
51CXXLINK = `echo $(CXXLINK1) | sed -e 's/-Wp,-D_FORTIFY_SOURCE=[0-9][0-9]*//'`
52
3d587466
CC
53# Strip out -static-libgcc and -static-libstdc++ options, for tests
54# that must have these libraries linked dynamically. The -shared-libgcc
55# option does not work correctly, and there is no -shared-libstdc++ option.
56# (See GCC PR 55781 and PR 55782.)
57CXXLINK_S = `echo $(CXXLINK1) | sed -e 's/-static-lib\\(gcc\\|stdc++\\)//g'`
58
6835af53
ILT
59TEST_READELF = $(top_builddir)/../binutils/readelf
60TEST_OBJDUMP = $(top_builddir)/../binutils/objdump
35c813e2 61TEST_OBJCOPY = $(top_builddir)/../binutils/objcopy
6835af53
ILT
62TEST_CXXFILT = $(top_builddir)/../binutils/cxxfilt
63TEST_STRIP = $(top_builddir)/../binutils/strip-new
fbd8a257 64TEST_AR = $(top_builddir)/../binutils/ar
531813ad 65TEST_NM = $(top_builddir)/../binutils/nm-new
364c7fa5 66TEST_AS = $(top_builddir)/../gas/as-new
6835af53 67
89fc3421
CC
68if PLUGINS
69LIBDL = -ldl
70endif
71
fe9a4c12
ILT
72if THREADS
73THREADSLIB = -lpthread
74endif
75
155a0dd7
ILT
76if OMP_SUPPORT
77TLS_TEST_C_CFLAGS = -fopenmp
78endif
79
351a8000
ILT
80# 'make clean' is good about deleting some intermediate files (such as
81# .o's), but not all of them (such as .so's and .err files). We
82# improve on that here. automake-1.9 info docs say "mostlyclean" is
83# the right choice for files 'make' builds that people rebuild.
72fef11a 84MOSTLYCLEANFILES = *.so *.syms *.stdout
6eee141f 85
9df9de2c
CC
86# Export make variables to the shell scripts so that they can see
87# (for example) DEFAULT_TARGET.
88.EXPORT_ALL_VARIABLES:
2b64b551 89
351a8000
ILT
90# We will add to these later, for each individual test. Note
91# that we add each test under check_SCRIPTS or check_PROGRAMS;
92# the TESTS variable is automatically populated from these.
93check_SCRIPTS =
94check_DATA =
95check_PROGRAMS =
d491d34e
ILT
96BUILT_SOURCES =
97
351a8000 98TESTS = $(check_SCRIPTS) $(check_PROGRAMS)
22dc1b09 99
351a8000
ILT
100# ---------------------------------------------------------------------
101# These tests test the internals of gold (unittests).
5a6f7e2d 102
351a8000 103# Infrastucture needed for the unittests
5a6f7e2d
ILT
104check_LIBRARIES = libgoldtest.a
105libgoldtest_a_SOURCES = test.cc testmain.cc testfile.cc
106
ad2d6943
ILT
107DEPENDENCIES = \
108 libgoldtest.a ../libgold.a ../../libiberty/libiberty.a $(LIBINTL_DEP)
fe9a4c12 109LDADD = libgoldtest.a ../libgold.a ../../libiberty/libiberty.a $(LIBINTL) \
918357b9 110 $(THREADSLIB) $(LIBDL) $(ZLIB)
5a6f7e2d 111
5a6f7e2d 112
351a8000 113# The unittests themselves
eb373049 114if NATIVE_OR_CROSS_LINKER
90e24de5
ILT
115if GCC
116
117# Infrastucture needed for the unittests: a directory where the linker
118# is named 'ld'. This is because the -B flag appends 'ld' to its arg.
119gcctestdir/ld: ../ld-new
120 test -d gcctestdir || mkdir -p gcctestdir
121 rm -f gcctestdir/ld
122 (cd gcctestdir && $(LN_S) ../../ld-new ld)
123
472076e4
CC
124# Some tests require the latest features of an in-tree assembler.
125gcctestdir/as: $(TEST_AS)
126 test -d gcctestdir || mkdir -p gcctestdir
127 rm -f gcctestdir/as
128 (cd gcctestdir && $(LN_S) $(abs_top_builddir)/../gas/as-new as)
129
90e24de5
ILT
130endif GCC
131
351a8000 132check_PROGRAMS += object_unittest
5a6f7e2d 133object_unittest_SOURCES = object_unittest.cc
22dc1b09 134
bc644c6c
ILT
135check_PROGRAMS += binary_unittest
136binary_unittest_SOURCES = binary_unittest.cc
137
c2c7840a
CC
138check_PROGRAMS += leb128_unittest
139leb128_unittest_SOURCES = leb128_unittest.cc
140
44803b5d
CC
141check_PROGRAMS += overflow_unittest
142overflow_unittest_SOURCES = overflow_unittest.cc
143overflow_unittest.o: overflow_unittest.cc
144 $(CXXCOMPILE) -O3 -c -o $@ $<
145
eb373049 146endif NATIVE_OR_CROSS_LINKER
351a8000
ILT
147
148# ---------------------------------------------------------------------
149# These tests test the output of gold (end-to-end tests). In
150# particular, they make sure that gold can link "difficult" object
151# files, and the resulting object files run correctly. These can only
152# run if we've built ld-new for the native architecture (that is,
153# we're not cross-compiling it), since we run ld-new as part of these
154# tests. We use the gcc-specific flag '-B' to use our linker instead
155# of the default linker, which is why we only run our tests under gcc.
a360aedd 156
e2827e5f 157if NATIVE_LINKER
351a8000 158if GCC
e2827e5f 159
351a8000
ILT
160# Each of these .o's is a useful, small complete program. They're
161# particularly useful for making sure ld-new's flags do what they're
162# supposed to (hence their names), but are used for many tests that
163# don't actually involve analyzing input data.
43771f76
ILT
164flagstest_debug.o: constructor_test.cc
165 $(CXXCOMPILE) -O0 -g -c -o $@ $<
166flagstest_ndebug.o: constructor_test.cc
167 $(CXXCOMPILE) -O0 -c -o $@ $<
168
325e6408
RÁE
169check_SCRIPTS += incremental_test.sh
170check_DATA += incremental_test.stdout
0ec6429b 171MOSTLYCLEANFILES += incremental_test incremental_test.cmdline
325e6408
RÁE
172incremental_test_1.o: incremental_test_1.c
173 $(COMPILE) -O0 -c -ffunction-sections -g -o $@ $<
174incremental_test_2.o: incremental_test_2.c
175 $(COMPILE) -O0 -c -ffunction-sections -g -o $@ $<
176incremental_test: incremental_test_1.o incremental_test_2.o gcctestdir/ld
943c8b43 177 $(LINK) -Bgcctestdir/ -Wl,--incremental-full -Wl,-z,norelro incremental_test_1.o incremental_test_2.o -Wl,-debug 2> incremental_test.cmdline
325e6408
RÁE
178incremental_test.stdout: incremental_test ../incremental-dump
179 ../incremental-dump incremental_test > $@
43771f76 180
531813ad
ST
181check_SCRIPTS += gc_comdat_test.sh
182check_DATA += gc_comdat_test.stdout
72fef11a 183MOSTLYCLEANFILES += gc_comdat_test
2b64b551 184gc_comdat_test_1.o: gc_comdat_test_1.cc
4daadc0d 185 $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
2b64b551 186gc_comdat_test_2.o: gc_comdat_test_2.cc
4daadc0d 187 $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
531813ad 188gc_comdat_test: gc_comdat_test_1.o gc_comdat_test_2.o gcctestdir/ld
4daadc0d 189 $(CXXLINK) -Bgcctestdir/ -Wl,--gc-sections gc_comdat_test_1.o gc_comdat_test_2.o
531813ad
ST
190gc_comdat_test.stdout: gc_comdat_test
191 $(TEST_NM) -C gc_comdat_test > gc_comdat_test.stdout
192
27721062
ST
193check_SCRIPTS += gc_tls_test.sh
194check_DATA += gc_tls_test.stdout
72fef11a 195MOSTLYCLEANFILES += gc_tls_test
27721062
ST
196gc_tls_test.o: gc_tls_test.cc
197 $(CXXCOMPILE) -O0 -c -g -o $@ $<
198gc_tls_test:gc_tls_test.o gcctestdir/ld
199 $(CXXLINK) -Bgcctestdir/ -Wl,--gc-sections gc_tls_test.o
200gc_tls_test.stdout: gc_tls_test
201 $(TEST_NM) -C gc_tls_test > gc_tls_test.stdout
202
f1ec9ded
ST
203check_SCRIPTS += gc_orphan_section_test.sh
204check_DATA += gc_orphan_section_test.stdout
205MOSTLYCLEANFILES += gc_orphan_section_test
206gc_orphan_section_test.o: gc_orphan_section_test.cc
207 $(CXXCOMPILE) -O0 -c -g -o $@ $<
208gc_orphan_section_test:gc_orphan_section_test.o gcctestdir/ld
209 $(CXXLINK) -Bgcctestdir/ -Wl,--gc-sections gc_orphan_section_test.o
210gc_orphan_section_test.stdout: gc_orphan_section_test
211 $(TEST_NM) gc_orphan_section_test > gc_orphan_section_test.stdout
212
b9b2ae8b
NC
213check_SCRIPTS += pr14265.sh
214check_DATA += pr14265.stdout
215MOSTLYCLEANFILES += pr14265
216pr14265.o: pr14265.c
217 $(COMPILE) -O0 -c -o $@ $<
78d9f182 218pr14265: pr14265.o gcctestdir/ld $(srcdir)/pr14265.t
1496b446 219 $(LINK) -Bgcctestdir/ -Wl,--gc-sections -Wl,-T,$(srcdir)/pr14265.t -o $@ $<
b9b2ae8b
NC
220pr14265.stdout: pr14265
221 $(TEST_NM) --format=bsd --numeric-sort $< > $@
222
cc90de49
IK
223check_SCRIPTS += pr20717.sh
224check_DATA += pr20717.stdout
225MOSTLYCLEANFILES += pr20717
226pr20717.o: pr20717.c
227 $(COMPILE) -O0 -ffunction-sections -c -o $@ $<
228pr20717: pr20717.o gcctestdir/ld $(srcdir)/pr20717.t
229 $(LINK) -Bgcctestdir/ -Wl,--gc-sections -Wl,-T,$(srcdir)/pr20717.t -o $@ $<
230pr20717.stdout: pr20717
231 $(TEST_NM) $< > $@
232
fd834e57
CC
233check_SCRIPTS += gc_dynamic_list_test.sh
234check_DATA += gc_dynamic_list_test.stdout
235MOSTLYCLEANFILES += gc_dynamic_list_test
236gc_dynamic_list_test.o: gc_dynamic_list_test.c
237 $(COMPILE) -c -ffunction-sections -o $@ $<
238gc_dynamic_list_test: gc_dynamic_list_test.o gcctestdir/ld $(srcdir)/gc_dynamic_list_test.t
239 $(LINK) -Bgcctestdir/ -Wl,--gc-sections -Wl,--dynamic-list,$(srcdir)/gc_dynamic_list_test.t gc_dynamic_list_test.o
240gc_dynamic_list_test.stdout: gc_dynamic_list_test
241 $(TEST_NM) gc_dynamic_list_test > $@
242
ef15dade 243check_SCRIPTS += icf_test.sh
4d9aa155
AM
244check_DATA += icf_test.map
245MOSTLYCLEANFILES += icf_test icf_test.map
2b64b551 246icf_test.o: icf_test.cc
ef15dade 247 $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
54de2ea6 248icf_test: icf_test.o gcctestdir/ld
4d9aa155 249 $(CXXLINK) -o icf_test -Bgcctestdir/ -Wl,--icf=all,-Map,icf_test.map icf_test.o
54de2ea6
CC
250icf_test.map: icf_test
251 @touch icf_test.map
ef15dade 252
48c187ce
ST
253check_SCRIPTS += icf_keep_unique_test.sh
254check_DATA += icf_keep_unique_test.stdout
72fef11a 255MOSTLYCLEANFILES += icf_keep_unique_test
48c187ce
ST
256icf_keep_unique_test.o: icf_keep_unique_test.cc
257 $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
258icf_keep_unique_test: icf_keep_unique_test.o gcctestdir/ld
032ce4e9 259 $(CXXLINK) -Bgcctestdir/ -Wl,--icf=all -Wl,--keep-unique,_Z11unique_funcv icf_keep_unique_test.o
48c187ce 260icf_keep_unique_test.stdout: icf_keep_unique_test
4d9aa155 261 $(TEST_NM) -C $< > $@
531813ad 262
032ce4e9 263check_SCRIPTS += icf_safe_test.sh
4d9aa155
AM
264check_DATA += icf_safe_test_1.stdout icf_safe_test_2.stdout icf_safe_test.map
265MOSTLYCLEANFILES += icf_safe_test icf_safe_test.map
21bb3914 266icf_safe_test.o: icf_safe_test.cc
032ce4e9 267 $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
54de2ea6 268icf_safe_test: icf_safe_test.o gcctestdir/ld
4d9aa155 269 $(CXXLINK) -o icf_safe_test -Bgcctestdir/ -Wl,--icf=safe,-Map,icf_safe_test.map icf_safe_test.o
54de2ea6
CC
270icf_safe_test.map: icf_safe_test
271 @touch icf_safe_test.map
21bb3914 272icf_safe_test_1.stdout: icf_safe_test
4d9aa155 273 $(TEST_NM) $< > $@
21bb3914 274icf_safe_test_2.stdout: icf_safe_test
4d9aa155 275 $(TEST_READELF) -h $< > $@
21bb3914 276
4aebb631
RC
277check_SCRIPTS += icf_safe_pie_test.sh
278check_DATA += icf_safe_pie_test_1.stdout icf_safe_pie_test_2.stdout icf_safe_pie_test.map
279MOSTLYCLEANFILES += icf_safe_pie_test icf_safe_pie_test.map
280icf_safe_pie_test.o: icf_safe_test.cc
281 $(CXXCOMPILE) -O0 -c -ffunction-sections -fPIE -g -o $@ $<
282icf_safe_pie_test: icf_safe_pie_test.o gcctestdir/ld
283 $(CXXLINK) -o icf_safe_pie_test -Bgcctestdir/ -Wl,--icf=safe,-Map,icf_safe_pie_test.map icf_safe_pie_test.o -pie
284icf_safe_pie_test.map: icf_safe_pie_test
285 @touch icf_safe_pie_test.map
286icf_safe_pie_test_1.stdout: icf_safe_pie_test
287 $(TEST_NM) $< > $@
288icf_safe_pie_test_2.stdout: icf_safe_pie_test
289 $(TEST_READELF) -h $< > $@
290
21bb3914 291check_SCRIPTS += icf_safe_so_test.sh
4d9aa155
AM
292check_DATA += icf_safe_so_test_1.stdout icf_safe_so_test_2.stdout icf_safe_so_test.map
293MOSTLYCLEANFILES += icf_safe_so_test icf_safe_so_test.map
21bb3914
ST
294icf_safe_so_test.o: icf_safe_so_test.cc
295 $(CXXCOMPILE) -O0 -c -ffunction-sections -fPIC -g -o $@ $<
54de2ea6 296icf_safe_so_test: icf_safe_so_test.o gcctestdir/ld
4d9aa155 297 $(CXXLINK) -o icf_safe_so_test -Bgcctestdir/ -Wl,--icf=safe,-Map,icf_safe_so_test.map icf_safe_so_test.o -fPIC -shared
54de2ea6
CC
298icf_safe_so_test.map:
299 @touch icf_safe_so_test.map
21bb3914 300icf_safe_so_test_1.stdout: icf_safe_so_test
4d9aa155 301 $(TEST_NM) $< > $@
21bb3914 302icf_safe_so_test_2.stdout: icf_safe_so_test
4d9aa155 303 $(TEST_READELF) -h $< > $@
032ce4e9 304
6e9ba2ca
ST
305check_SCRIPTS += final_layout.sh
306check_DATA += final_layout.stdout
9e9143bc 307MOSTLYCLEANFILES += final_layout final_layout_sequence.txt final_layout_script.lds
6e9ba2ca
ST
308final_layout.o: final_layout.cc
309 $(CXXCOMPILE) -O0 -c -ffunction-sections -fdata-sections -g -o $@ $<
310final_layout_sequence.txt:
311 (echo "*_Z3barv*" && echo ".text._Z3bazv" && echo "*_Z3foov*" && echo "*global_varb*" && echo "*global_vara*" && echo "*global_varc*") > final_layout_sequence.txt
9e9143bc 312final_layout_script.lds:
a39e4af6 313 (echo "SECTIONS { .text : { *(.text*) } .got : { *(.got .toc) } .sbss : { *(.sbss*) } .bss : { *(.bss*) } }") > final_layout_script.lds
9e9143bc
ST
314final_layout: final_layout.o final_layout_sequence.txt final_layout_script.lds gcctestdir/ld
315 $(CXXLINK) -Bgcctestdir/ -Wl,--section-ordering-file,final_layout_sequence.txt -Wl,-T,final_layout_script.lds final_layout.o
6e9ba2ca 316final_layout.stdout: final_layout
864a1b56 317 $(TEST_NM) -n --synthetic final_layout > final_layout.stdout
6e9ba2ca 318
28f2a4ac 319check_SCRIPTS += text_section_grouping.sh
c6ac678d
ST
320check_DATA += text_section_grouping.stdout text_section_no_grouping.stdout
321MOSTLYCLEANFILES += text_section_grouping text_section_no_grouping
28f2a4ac
ST
322text_section_grouping.o: text_section_grouping.cc
323 $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
324text_section_grouping: text_section_grouping.o gcctestdir/ld
325 $(CXXLINK) -Bgcctestdir/ text_section_grouping.o
c6ac678d
ST
326text_section_no_grouping: text_section_grouping.o gcctestdir/ld
327 $(CXXLINK) -Bgcctestdir/ -Wl,--no-text-reorder text_section_grouping.o
28f2a4ac 328text_section_grouping.stdout: text_section_grouping
c6ac678d
ST
329 $(TEST_NM) -n --synthetic text_section_grouping > text_section_grouping.stdout
330text_section_no_grouping.stdout: text_section_no_grouping
2b64b551 331 $(TEST_NM) -n --synthetic text_section_no_grouping > text_section_no_grouping.stdout
28f2a4ac 332
6934001a
CC
333check_SCRIPTS += section_sorting_name.sh
334check_DATA += section_sorting_name.stdout
335MOSTLYCLEANFILES += section_sorting_name
336section_sorting_name.o: section_sorting_name.cc
337 $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
338section_sorting_name: section_sorting_name.o gcctestdir/ld
339 $(CXXLINK) -Bgcctestdir/ -Wl,--sort-section=name section_sorting_name.o
340section_sorting_name.stdout: section_sorting_name
341 $(TEST_NM) -n --synthetic section_sorting_name > section_sorting_name.stdout
342
2253bfba 343check_PROGRAMS += icf_virtual_function_folding_test
0ec6429b 344MOSTLYCLEANFILES += icf_virtual_function_folding_test icf_virtual_function_folding_test.map
ce97fa81
ST
345icf_virtual_function_folding_test.o: icf_virtual_function_folding_test.cc
346 $(CXXCOMPILE) -O0 -c -ffunction-sections -fPIE -g -o $@ $<
347icf_virtual_function_folding_test: icf_virtual_function_folding_test.o gcctestdir/ld
348 $(CXXLINK) -Bgcctestdir/ -Wl,--icf=all icf_virtual_function_folding_test.o -pie
349
350check_SCRIPTS += icf_preemptible_functions_test.sh
351check_DATA += icf_preemptible_functions_test.stdout
352MOSTLYCLEANFILES += icf_preemptible_functions_test
353icf_preemptible_functions_test.o: icf_preemptible_functions_test.cc
354 $(CXXCOMPILE) -O0 -c -ffunction-sections -fPIC -g -o $@ $<
355icf_preemptible_functions_test: icf_preemptible_functions_test.o gcctestdir/ld
356 $(CXXLINK) -Bgcctestdir/ -Wl,--icf=all icf_preemptible_functions_test.o -fPIC -shared
357icf_preemptible_functions_test.stdout: icf_preemptible_functions_test
358 $(TEST_NM) icf_preemptible_functions_test > icf_preemptible_functions_test.stdout
359
360check_SCRIPTS += icf_string_merge_test.sh
361check_DATA += icf_string_merge_test.stdout
362MOSTLYCLEANFILES += icf_string_merge_test
363icf_string_merge_test.o: icf_string_merge_test.cc
364 $(CXXCOMPILE) -O0 -c -ffunction-sections -fPIC -g -o $@ $<
365icf_string_merge_test: icf_string_merge_test.o gcctestdir/ld
366 $(CXXLINK) -Bgcctestdir/ -Wl,--icf=all icf_string_merge_test.o
367icf_string_merge_test.stdout: icf_string_merge_test
368 $(TEST_NM) icf_string_merge_test > icf_string_merge_test.stdout
369
41cbeecc
ST
370check_SCRIPTS += icf_sht_rel_addend_test.sh
371check_DATA += icf_sht_rel_addend_test.stdout
372MOSTLYCLEANFILES += icf_sht_rel_addend_test
373icf_sht_rel_addend_test_1.o: icf_sht_rel_addend_test_1.cc
374 $(CXXCOMPILE) -O0 -c -ffunction-sections -fPIC -g -o $@ $<
375icf_sht_rel_addend_test_2.o: icf_sht_rel_addend_test_2.cc
376 $(CXXCOMPILE) -O0 -c -ffunction-sections -fPIC -g -o $@ $<
377icf_sht_rel_addend_test: icf_sht_rel_addend_test_1.o icf_sht_rel_addend_test_2.o gcctestdir/ld
378 $(CXXLINK) -Bgcctestdir/ -Wl,--icf=all icf_sht_rel_addend_test_1.o icf_sht_rel_addend_test_2.o
379icf_sht_rel_addend_test.stdout: icf_sht_rel_addend_test
380 $(TEST_NM) icf_sht_rel_addend_test > icf_sht_rel_addend_test.stdout
381
7fb47cc9
CC
382check_PROGRAMS += large_symbol_alignment
383large_symbol_alignment_SOURCES = large_symbol_alignment.cc
384large_symbol_alignment_DEPENDENCIES = gcctestdir/ld
385large_symbol_alignment_LDFLAGS = -Bgcctestdir/
54de2ea6 386large_symbol_alignment_LDADD =
7fb47cc9 387
e31908b6
CC
388check_SCRIPTS += merge_string_literals.sh
389check_DATA += merge_string_literals.stdout
390MOSTLYCLEANFILES += merge_string_literals
2b64b551 391merge_string_literals_1.o: merge_string_literals_1.cc
e31908b6 392 $(CXXCOMPILE) -O2 -c -fPIC -g -o $@ $<
2b64b551 393merge_string_literals_2.o: merge_string_literals_2.cc
e31908b6
CC
394 $(CXXCOMPILE) -O2 -c -fPIC -g -o $@ $<
395merge_string_literals: merge_string_literals_1.o merge_string_literals_2.o gcctestdir/ld
396 $(CXXLINK) -Bgcctestdir/ merge_string_literals_1.o merge_string_literals_2.o -O2 -shared -nostdlib
397merge_string_literals.stdout: merge_string_literals
398 $(TEST_OBJDUMP) -s -j.rodata merge_string_literals > merge_string_literals.stdout
399
351a8000 400check_PROGRAMS += basic_test
351a8000 401check_PROGRAMS += basic_pic_test
56ba9a23 402basic_test.o: basic_test.cc
22dc1b09 403 $(CXXCOMPILE) -O0 -c -o $@ $<
56ba9a23
ILT
404basic_test: basic_test.o gcctestdir/ld
405 $(CXXLINK) -Bgcctestdir/ basic_test.o
328c7c2f 406
cfbf0e3c
RÁE
407check_PROGRAMS += eh_test
408eh_test_a.o: eh_test_a.cc
409 $(CXXCOMPILE) -O0 -c -o $@ $<
410eh_test_b.o: eh_test_b.cc
411 $(CXXCOMPILE) -O0 -c -o $@ $<
412eh_test: eh_test_a.o eh_test_b.o gcctestdir/ld
413 $(CXXLINK_S) -Bgcctestdir/ eh_test_a.o eh_test_b.o
414
698400bf
CC
415check_SCRIPTS += eh_test_2.sh
416check_DATA += eh_test_2.sects
8db8e694 417MOSTLYCLEANFILES += eh_test_2 eh_test_2.sects
698400bf
CC
418eh_test_r.o: eh_test_a.o eh_test_b.o gcctestdir/ld
419 gcctestdir/ld -r -o $@ eh_test_a.o eh_test_b.o
420eh_test_2: eh_test_r.o gcctestdir/ld
421 $(CXXLINK_S) -Bgcctestdir/ -Wl,--eh-frame-hdr eh_test_r.o
422eh_test_2.sects: eh_test_2
423 $(TEST_READELF) -SW $< >$@ 2>/dev/null
424
328c7c2f
ILT
425if HAVE_STATIC
426check_PROGRAMS += basic_static_test
56ba9a23
ILT
427basic_static_test: basic_test.o gcctestdir/ld
428 $(CXXLINK) -Bgcctestdir/ -static basic_test.o
328c7c2f 429endif
22dc1b09 430
56ba9a23 431basic_pic_test.o: basic_test.cc
22dc1b09 432 $(CXXCOMPILE) -O0 -c -fpic -o $@ $<
56ba9a23
ILT
433basic_pic_test: basic_pic_test.o gcctestdir/ld
434 $(CXXLINK) -Bgcctestdir/ basic_pic_test.o
328c7c2f
ILT
435
436if HAVE_STATIC
437check_PROGRAMS += basic_static_pic_test
56ba9a23
ILT
438basic_static_pic_test: basic_pic_test.o gcctestdir/ld
439 $(CXXLINK) -Bgcctestdir/ -static basic_pic_test.o
328c7c2f 440endif
22dc1b09 441
374ad285
ILT
442check_PROGRAMS += basic_pie_test
443basic_pie_test.o: basic_test.cc
444 $(CXXCOMPILE) -O0 -c -fpie -o $@ $<
445basic_pie_test: basic_pie_test.o gcctestdir/ld
446 $(CXXLINK) -Bgcctestdir/ -pie basic_pie_test.o
351a8000
ILT
447
448check_PROGRAMS += constructor_test
d5026652
ILT
449constructor_test_SOURCES = constructor_test.cc
450constructor_test_DEPENDENCIES = gcctestdir/ld
451constructor_test_LDFLAGS = -Bgcctestdir/
1abce4a6 452constructor_test_LDADD =
d5026652 453
328c7c2f
ILT
454if HAVE_STATIC
455check_PROGRAMS += constructor_static_test
351a8000
ILT
456constructor_static_test_SOURCES = $(constructor_test_SOURCES)
457constructor_static_test_DEPENDENCIES = $(constructor_test_DEPENDENCIES)
458constructor_static_test_LDFLAGS = $(constructor_test_LDFLAGS) -static
1abce4a6 459constructor_static_test_LDADD = $(constructor_test_LDADD)
328c7c2f 460endif
351a8000
ILT
461
462check_PROGRAMS += two_file_test
351a8000 463check_PROGRAMS += two_file_pic_test
3bd52c28
ILT
464two_file_test_SOURCES = \
465 two_file_test_1.cc \
03e8f2b2 466 two_file_test_1b.cc \
3bd52c28
ILT
467 two_file_test_2.cc \
468 two_file_test_main.cc \
469 two_file_test.h
470two_file_test_DEPENDENCIES = gcctestdir/ld
471two_file_test_LDFLAGS = -Bgcctestdir/
1abce4a6 472two_file_test_LDADD =
3bd52c28 473
328c7c2f
ILT
474if HAVE_STATIC
475check_PROGRAMS += two_file_static_test
351a8000
ILT
476two_file_static_test_SOURCES = $(two_file_test_SOURCES)
477two_file_static_test_DEPENDENCIES = $(two_file_test_DEPENDENCIES)
478two_file_static_test_LDFLAGS = $(two_file_test_LDFLAGS) -static
1abce4a6 479two_file_static_test_LDADD = $(two_file_test_LDADD)
328c7c2f 480endif
f958d5fc
ILT
481
482two_file_pic_test_SOURCES = two_file_test_main.cc
483two_file_pic_test_DEPENDENCIES = \
03e8f2b2 484 gcctestdir/ld two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o
f958d5fc 485two_file_pic_test_LDFLAGS = -Bgcctestdir/
03e8f2b2 486two_file_pic_test_LDADD = two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o
f958d5fc 487
351a8000
ILT
488
489check_PROGRAMS += two_file_shared_1_test
490check_PROGRAMS += two_file_shared_2_test
491check_PROGRAMS += two_file_shared_1_pic_2_test
492check_PROGRAMS += two_file_shared_2_pic_1_test
493check_PROGRAMS += two_file_same_shared_test
494check_PROGRAMS += two_file_separate_shared_12_test
495check_PROGRAMS += two_file_separate_shared_21_test
496two_file_test_1_pic.o: two_file_test_1.cc
497 $(CXXCOMPILE) -c -fpic -o $@ $<
03e8f2b2
ILT
498two_file_test_1b_pic.o: two_file_test_1b.cc
499 $(CXXCOMPILE) -c -fpic -o $@ $<
351a8000
ILT
500two_file_test_2_pic.o: two_file_test_2.cc
501 $(CXXCOMPILE) -c -fpic -o $@ $<
03e8f2b2
ILT
502two_file_shared_1.so: two_file_test_1_pic.o two_file_test_1b_pic.o gcctestdir/ld
503 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1_pic.o two_file_test_1b_pic.o
351a8000
ILT
504two_file_shared_2.so: two_file_test_2_pic.o gcctestdir/ld
505 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_2_pic.o
03e8f2b2
ILT
506two_file_shared.so: two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o gcctestdir/ld
507 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o
351a8000 508
3bd52c28
ILT
509two_file_shared_1_test_SOURCES = two_file_test_2.cc two_file_test_main.cc
510two_file_shared_1_test_DEPENDENCIES = gcctestdir/ld two_file_shared_1.so
511two_file_shared_1_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
512two_file_shared_1_test_LDADD = two_file_shared_1.so
513
03e8f2b2 514two_file_shared_2_test_SOURCES = two_file_test_1.cc two_file_test_1b.cc two_file_test_main.cc
3bd52c28
ILT
515two_file_shared_2_test_DEPENDENCIES = gcctestdir/ld two_file_shared_2.so
516two_file_shared_2_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
517two_file_shared_2_test_LDADD = two_file_shared_2.so
518
386c048c
ILT
519two_file_shared_1_pic_2_test_SOURCES = two_file_test_main.cc
520two_file_shared_1_pic_2_test_DEPENDENCIES = \
2f2de248 521 gcctestdir/ld two_file_shared_2.so two_file_test_1_pic.o two_file_test_1b_pic.o
386c048c 522two_file_shared_1_pic_2_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
03e8f2b2 523two_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
524
525two_file_shared_2_pic_1_test_SOURCES = two_file_test_main.cc
526two_file_shared_2_pic_1_test_DEPENDENCIES = \
e051a5b5 527 gcctestdir/ld two_file_shared_1.so two_file_test_2_pic.o
386c048c
ILT
528two_file_shared_2_pic_1_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
529two_file_shared_2_pic_1_test_LDADD = two_file_test_2_pic.o two_file_shared_1.so
530
3bd52c28
ILT
531two_file_same_shared_test_SOURCES = two_file_test_main.cc
532two_file_same_shared_test_DEPENDENCIES = gcctestdir/ld two_file_shared.so
533two_file_same_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
534two_file_same_shared_test_LDADD = two_file_shared.so
535
536two_file_separate_shared_12_test_SOURCES = two_file_test_main.cc
537two_file_separate_shared_12_test_DEPENDENCIES = \
538 gcctestdir/ld two_file_shared_1.so two_file_shared_2.so
539two_file_separate_shared_12_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
540two_file_separate_shared_12_test_LDADD = \
541 two_file_shared_1.so two_file_shared_2.so
542
543two_file_separate_shared_21_test_SOURCES = two_file_test_main.cc
544two_file_separate_shared_21_test_DEPENDENCIES = \
545 gcctestdir/ld two_file_shared_1.so two_file_shared_2.so
546two_file_separate_shared_21_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
547two_file_separate_shared_21_test_LDADD = \
548 two_file_shared_2.so two_file_shared_1.so
549
6a74a719
ILT
550check_PROGRAMS += two_file_relocatable_test
551two_file_relocatable_test_SOURCES = two_file_test_main.cc
552two_file_relocatable_test_DEPENDENCIES = \
553 gcctestdir/ld two_file_relocatable.o
554two_file_relocatable_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
555two_file_relocatable_test_LDADD = two_file_relocatable.o
556two_file_relocatable.o: gcctestdir/ld two_file_test_1.o two_file_test_1b.o two_file_test_2.o
557 gcctestdir/ld -r -o $@ two_file_test_1.o two_file_test_1b.o two_file_test_2.o
558
374ad285
ILT
559check_PROGRAMS += two_file_pie_test
560two_file_test_1_pie.o: two_file_test_1.cc
561 $(CXXCOMPILE) -c -fpie -o $@ $<
562two_file_test_1b_pie.o: two_file_test_1b.cc
563 $(CXXCOMPILE) -c -fpie -o $@ $<
564two_file_test_2_pie.o: two_file_test_2.cc
565 $(CXXCOMPILE) -c -fpie -o $@ $<
566two_file_test_main_pie.o: two_file_test_main.cc
567 $(CXXCOMPILE) -c -fpie -o $@ $<
568two_file_pie_test: two_file_test_1_pie.o two_file_test_1b_pie.o \
569 two_file_test_2_pie.o two_file_test_main_pie.o gcctestdir/ld
570 $(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
571
a82bef93
ST
572check_PROGRAMS += pie_copyrelocs_test
573pie_copyrelocs_test_SOURCES = pie_copyrelocs_test.cc
574pie_copyrelocs_test_DEPENDENCIES = gcctestdir/ld pie_copyrelocs_shared_test.so
4759c34e 575pie_copyrelocs_test_CXXFLAGS = -fno-exceptions -fno-asynchronous-unwind-tables
a82bef93
ST
576pie_copyrelocs_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. -pie
577pie_copyrelocs_test_LDADD = pie_copyrelocs_shared_test.so
578pie_copyrelocs_shared_test.o: pie_copyrelocs_shared_test.cc
579 $(CXXCOMPILE) -O2 -fpic -c -o $@ $<
580pie_copyrelocs_shared_test.so: pie_copyrelocs_shared_test.o gcctestdir/ld
581 $(CXXLINK) -Bgcctestdir/ -shared pie_copyrelocs_shared_test.o
582
a100d66f
ST
583check_PROGRAMS += weak_unresolved_symbols_test
584weak_unresolved_symbols_test_SOURCES = weak_unresolved_symbols_test.cc
585weak_unresolved_symbols_test_CXXFLAGS = -fPIE
586weak_unresolved_symbols_test_LDFLAGS = -Bgcctestdir/ -pie -Wl,--weak-unresolved-symbols
587
031cdbed
ILT
588check_SCRIPTS += two_file_shared.sh
589check_DATA += two_file_shared.dbg
72fef11a 590MOSTLYCLEANFILES += two_file_shared.dbg
031cdbed
ILT
591two_file_shared.dbg: two_file_shared.so
592 $(TEST_READELF) -w $< >$@ 2>/dev/null
593
63402fe4
ILT
594# The nonpic tests will fail on platforms which can not put non-PIC
595# code into shared libraries, so we just don't run them in that case.
63402fe4 596if FN_PTRS_IN_SO_WITHOUT_PIC
3bd52c28 597
351a8000
ILT
598check_PROGRAMS += two_file_shared_1_nonpic_test
599check_PROGRAMS += two_file_shared_2_nonpic_test
600check_PROGRAMS += two_file_same_shared_nonpic_test
601check_PROGRAMS += two_file_separate_shared_12_nonpic_test
602check_PROGRAMS += two_file_separate_shared_21_nonpic_test
03e8f2b2
ILT
603check_PROGRAMS += two_file_mixed_shared_test
604check_PROGRAMS += two_file_mixed_2_shared_test
351a8000 605two_file_shared_1_nonpic.so: two_file_test_1.o gcctestdir/ld
611062c0 606 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1.o two_file_test_1b.o -Wl,-z,notext
351a8000
ILT
607two_file_shared_2_nonpic.so: two_file_test_2.o gcctestdir/ld
608 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_2.o
03e8f2b2 609two_file_shared_nonpic.so: two_file_test_1.o two_file_test_1b.o two_file_test_2.o gcctestdir/ld
611062c0 610 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1.o two_file_test_1b.o two_file_test_2.o -Wl,-z,notext
03e8f2b2 611two_file_shared_mixed.so: two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2.o gcctestdir/ld
611062c0 612 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2.o -Wl,-z,notext
03e8f2b2 613two_file_shared_mixed_1.so: two_file_test_1.o two_file_test_1b_pic.o two_file_shared_2.so gcctestdir/ld
611062c0 614 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1.o two_file_test_1b_pic.o two_file_shared_2.so -Wl,-z,notext
351a8000 615
3bd52c28
ILT
616two_file_shared_1_nonpic_test_SOURCES = \
617 two_file_test_2.cc two_file_test_main.cc
618two_file_shared_1_nonpic_test_DEPENDENCIES = \
619 gcctestdir/ld two_file_shared_1_nonpic.so
620two_file_shared_1_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
621two_file_shared_1_nonpic_test_LDADD = two_file_shared_1_nonpic.so
622
623two_file_shared_2_nonpic_test_SOURCES = \
03e8f2b2 624 two_file_test_1.cc two_file_test_1b.cc two_file_test_main.cc
3bd52c28
ILT
625two_file_shared_2_nonpic_test_DEPENDENCIES = \
626 gcctestdir/ld two_file_shared_2_nonpic.so
627two_file_shared_2_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
628two_file_shared_2_nonpic_test_LDADD = two_file_shared_2_nonpic.so
629
630two_file_same_shared_nonpic_test_SOURCES = two_file_test_main.cc
631two_file_same_shared_nonpic_test_DEPENDENCIES = \
632 gcctestdir/ld two_file_shared_nonpic.so
633two_file_same_shared_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
634two_file_same_shared_nonpic_test_LDADD = two_file_shared_nonpic.so
635
636two_file_separate_shared_12_nonpic_test_SOURCES = two_file_test_main.cc
637two_file_separate_shared_12_nonpic_test_DEPENDENCIES = \
638 gcctestdir/ld two_file_shared_1_nonpic.so two_file_shared_2_nonpic.so
639two_file_separate_shared_12_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
640two_file_separate_shared_12_nonpic_test_LDADD = \
641 two_file_shared_1_nonpic.so two_file_shared_2_nonpic.so
642
643two_file_separate_shared_21_nonpic_test_SOURCES = two_file_test_main.cc
644two_file_separate_shared_21_nonpic_test_DEPENDENCIES = \
645 gcctestdir/ld two_file_shared_1_nonpic.so two_file_shared_2_nonpic.so
646two_file_separate_shared_21_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
647two_file_separate_shared_21_nonpic_test_LDADD = \
648 two_file_shared_2_nonpic.so two_file_shared_1_nonpic.so
649
03e8f2b2
ILT
650two_file_mixed_shared_test_SOURCES = two_file_test_main.cc
651two_file_mixed_shared_test_DEPENDENCIES = gcctestdir/ld two_file_shared_mixed.so
652two_file_mixed_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
653two_file_mixed_shared_test_LDADD = two_file_shared_mixed.so
654
655two_file_mixed_2_shared_test_SOURCES = two_file_test_main.cc
656two_file_mixed_2_shared_test_DEPENDENCIES = gcctestdir/ld two_file_shared_mixed_1.so two_file_shared_2.so
657two_file_mixed_2_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
658two_file_mixed_2_shared_test_LDADD = two_file_shared_mixed_1.so two_file_shared_2.so
659
d89051bd
CC
660check_PROGRAMS += two_file_mixed_pie_test
661two_file_mixed_pie_test: two_file_test_1.o two_file_test_1b_pie.o \
662 two_file_test_main_pie.o two_file_shared_2.so gcctestdir/ld
663 $(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
664
351a8000 665endif FN_PTRS_IN_SO_WITHOUT_PIC
3bd52c28 666
6835af53
ILT
667check_PROGRAMS += two_file_strip_test
668two_file_strip_test: two_file_test
669 $(TEST_STRIP) -o two_file_strip_test two_file_test
670
671check_PROGRAMS += two_file_same_shared_strip_test
672two_file_same_shared_strip_test_SOURCES = two_file_test_main.cc
673two_file_same_shared_strip_test_DEPENDENCIES = \
674 gcctestdir/ld two_file_shared_strip.so
675two_file_same_shared_strip_test_LDFLAGS = -Bgcctestdir/ -Wl,-R.
676two_file_same_shared_strip_test_LDADD = two_file_shared_strip.so
677two_file_shared_strip.so: two_file_shared.so
678 $(TEST_STRIP) -S -o two_file_shared_strip.so two_file_shared.so
679
49bdd526
ILT
680check_PROGRAMS += common_test_1
681common_test_1_SOURCES = common_test_1.c
682common_test_1_DEPENDENCIES = gcctestdir/ld
683common_test_1_LDFLAGS = -Bgcctestdir/
1abce4a6 684common_test_1_LDADD =
351a8000 685
eda294df
ILT
686check_PROGRAMS += common_test_2
687common_test_2_SOURCES = common_test_1.c
688common_test_2_DEPENDENCIES = common_test_2.so common_test_3.so gcctestdir/ld
689common_test_2_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
690common_test_2_LDADD = common_test_2.so common_test_3.so
691common_test_2_pic.o: common_test_2.c
692 $(COMPILE) -c -fpic -o $@ $<
693common_test_2.so: common_test_2_pic.o common_test_3.so gcctestdir/ld
694 $(LINK) -Bgcctestdir/ -shared common_test_2_pic.o common_test_3.so
695common_test_3_pic.o: common_test_3.c
696 $(COMPILE) -c -fpic -o $@ $<
697common_test_3.so: common_test_3_pic.o ver_test_2.script gcctestdir/ld
698 $(LINK) -Bgcctestdir/ -shared common_test_3_pic.o -Wl,--version-script,$(srcdir)/ver_test_2.script
699
351a8000 700check_PROGRAMS += exception_test
351a8000
ILT
701check_PROGRAMS += exception_shared_1_test
702check_PROGRAMS += exception_shared_2_test
703check_PROGRAMS += exception_same_shared_test
704check_PROGRAMS += exception_separate_shared_12_test
705check_PROGRAMS += exception_separate_shared_21_test
706exception_test_1_pic.o: exception_test_1.cc
707 $(CXXCOMPILE) -c -fpic -o $@ $<
708exception_test_2_pic.o: exception_test_2.cc
709 $(CXXCOMPILE) -c -fpic -o $@ $<
710exception_shared_1.so: exception_test_1_pic.o gcctestdir/ld
711 $(CXXLINK) -Bgcctestdir/ -shared exception_test_1_pic.o
712exception_shared_2.so: exception_test_2_pic.o gcctestdir/ld
713 $(CXXLINK) -Bgcctestdir/ -shared exception_test_2_pic.o
714exception_shared.so: exception_test_1_pic.o exception_test_2_pic.o gcctestdir/ld
715 $(CXXLINK) -Bgcctestdir/ -shared exception_test_1_pic.o exception_test_2_pic.o
63402fe4 716
3151305a
ILT
717exception_test_SOURCES = \
718 exception_test_main.cc \
719 exception_test_1.cc \
720 exception_test_2.cc \
721 exception_test.h
722exception_test_DEPENDENCIES = gcctestdir/ld
723exception_test_LDFLAGS = -Bgcctestdir/
1abce4a6 724exception_test_LDADD =
3151305a 725
328c7c2f
ILT
726if HAVE_STATIC
727check_PROGRAMS += exception_static_test
351a8000
ILT
728exception_static_test_SOURCES = $(exception_test_SOURCES)
729exception_static_test_DEPENDENCIES = $(exception_test_DEPENDENCIES)
730exception_static_test_LDFLAGS = $(exception_test_LDFLAGS) -static
1abce4a6 731exception_static_test_LDADD = $(exception_test_LDADD)
328c7c2f 732endif
3151305a
ILT
733
734exception_shared_1_test_SOURCES = exception_test_2.cc exception_test_main.cc
735exception_shared_1_test_DEPENDENCIES = gcctestdir/ld exception_shared_1.so
736exception_shared_1_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
737exception_shared_1_test_LDADD = exception_shared_1.so
738
739exception_shared_2_test_SOURCES = exception_test_1.cc exception_test_main.cc
740exception_shared_2_test_DEPENDENCIES = gcctestdir/ld exception_shared_2.so
741exception_shared_2_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
742exception_shared_2_test_LDADD = exception_shared_2.so
743
744exception_same_shared_test_SOURCES = exception_test_main.cc
745exception_same_shared_test_DEPENDENCIES = gcctestdir/ld exception_shared.so
746exception_same_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
747exception_same_shared_test_LDADD = exception_shared.so
748
749exception_separate_shared_12_test_SOURCES = exception_test_main.cc
750exception_separate_shared_12_test_DEPENDENCIES = \
751 gcctestdir/ld exception_shared_1.so exception_shared_2.so
59965708
CC
752exception_separate_shared_12_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. \
753 -Wl,--no-as-needed
3151305a
ILT
754exception_separate_shared_12_test_LDADD = \
755 exception_shared_1.so exception_shared_2.so
756
757exception_separate_shared_21_test_SOURCES = exception_test_main.cc
758exception_separate_shared_21_test_DEPENDENCIES = \
759 gcctestdir/ld exception_shared_1.so exception_shared_2.so
59965708
CC
760exception_separate_shared_21_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. \
761 -Wl,--no-as-needed
3151305a
ILT
762exception_separate_shared_21_test_LDADD = \
763 exception_shared_2.so exception_shared_1.so
764
3151305a 765
351a8000 766check_PROGRAMS += weak_test
a360aedd 767weak_test_SOURCES = weak_test.cc
0e470e5c 768weak_test_DEPENDENCIES = gcctestdir/ld
a360aedd 769weak_test_LDFLAGS = -Bgcctestdir/
1abce4a6 770weak_test_LDADD =
a360aedd 771
86925eef 772check_PROGRAMS += weak_undef_test
72fef11a 773MOSTLYCLEANFILES += alt/weak_undef_lib.so
86925eef
CC
774weak_undef_test_SOURCES = weak_undef_test.cc
775weak_undef_test_DEPENDENCIES = gcctestdir/ld weak_undef_lib.so alt/weak_undef_lib.so
776weak_undef_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,alt
777weak_undef_test_LDADD = -L . weak_undef_lib.so
778weak_undef_file1.o: weak_undef_file1.cc
779 $(CXXCOMPILE) -c -fpic -o $@ $<
780weak_undef_file2.o: weak_undef_file2.cc
781 $(CXXCOMPILE) -c -fpic -o $@ $<
78d9f182 782weak_undef_lib.so: weak_undef_file1.o gcctestdir/ld
86925eef 783 $(CXXLINK) -Bgcctestdir/ -shared weak_undef_file1.o
78d9f182 784alt/weak_undef_lib.so: weak_undef_file2.o gcctestdir/ld
86925eef
CC
785 test -d alt || mkdir -p alt
786 $(CXXLINK) -Bgcctestdir/ -shared weak_undef_file2.o
351a8000 787
1f25b93b
CC
788check_PROGRAMS += weak_undef_test_2
789weak_undef_test_2_SOURCES = weak_undef_test_2.cc
790weak_undef_test_2_DEPENDENCIES = gcctestdir/ld libweak_undef_2.a
791weak_undef_test_2_LDFLAGS = -Bgcctestdir/ -u weak_undef_2
792weak_undef_test_2_LDADD = -L . -lweak_undef_2
dddcc5b9 793MOSTLYCLEANFILES += libweak_undef_2.a
1f25b93b
CC
794libweak_undef_2.a: weak_undef_file3.o weak_undef_file4.o
795 $(TEST_AR) rc $@ $^
796weak_undef_file3.o: weak_undef_file3.cc
797 $(CXXCOMPILE) -c -o $@ $<
798weak_undef_file4.o: weak_undef_file4.cc
799 $(CXXCOMPILE) -c -o $@ $<
800
f3c69fca
CC
801if FN_PTRS_IN_SO_WITHOUT_PIC
802check_PROGRAMS += weak_undef_nonpic_test
72fef11a 803MOSTLYCLEANFILES += alt/weak_undef_lib_nonpic.so
f3c69fca
CC
804weak_undef_nonpic_test_SOURCES = weak_undef_test.cc
805weak_undef_nonpic_test_DEPENDENCIES = gcctestdir/ld weak_undef_lib_nonpic.so alt/weak_undef_lib_nonpic.so
806weak_undef_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,alt
807weak_undef_nonpic_test_LDADD = -L . weak_undef_lib_nonpic.so
808weak_undef_file1_nonpic.o: weak_undef_file1.cc
809 $(CXXCOMPILE) -c -o $@ $<
810weak_undef_file2_nonpic.o: weak_undef_file2.cc
811 $(CXXCOMPILE) -c -o $@ $<
812weak_undef_lib_nonpic.so: weak_undef_file1_nonpic.o
611062c0 813 $(CXXLINK) -Bgcctestdir/ -shared weak_undef_file1_nonpic.o -Wl,-z,notext
f3c69fca
CC
814alt/weak_undef_lib_nonpic.so: weak_undef_file2_nonpic.o
815 test -d alt || mkdir -p alt
611062c0 816 $(CXXLINK) -Bgcctestdir/ -shared weak_undef_file2_nonpic.o -Wl,-z,notext
f3c69fca
CC
817endif FN_PTRS_IN_SO_WITHOUT_PIC
818
819
99a37bfd
ILT
820check_PROGRAMS += weak_alias_test
821weak_alias_test_SOURCES = weak_alias_test_main.cc
822weak_alias_test_DEPENDENCIES = \
823 gcctestdir/ld weak_alias_test_1.so weak_alias_test_2.so \
21131061 824 weak_alias_test_3.o weak_alias_test_4.so weak_alias_test_5.so
99a37bfd
ILT
825weak_alias_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
826weak_alias_test_LDADD = \
827 weak_alias_test_1.so weak_alias_test_2.so weak_alias_test_3.o \
21131061 828 weak_alias_test_4.so weak_alias_test_5.so
99a37bfd
ILT
829weak_alias_test_1_pic.o: weak_alias_test_1.cc
830 $(CXXCOMPILE) -c -fpic -o $@ $<
de4c45bd 831weak_alias_test_1.so: weak_alias_test_1_pic.o gcctestdir/ld
99a37bfd
ILT
832 $(CXXLINK) -Bgcctestdir/ -shared weak_alias_test_1_pic.o
833weak_alias_test_2_pic.o: weak_alias_test_2.cc
834 $(CXXCOMPILE) -c -fpic -o $@ $<
de4c45bd 835weak_alias_test_2.so: weak_alias_test_2_pic.o gcctestdir/ld
99a37bfd
ILT
836 $(CXXLINK) -Bgcctestdir/ -shared weak_alias_test_2_pic.o
837weak_alias_test_3.o: weak_alias_test_3.cc
838 $(CXXCOMPILE) -c -o $@ $<
839weak_alias_test_4_pic.o: weak_alias_test_4.cc
840 $(CXXCOMPILE) -c -fpic -o $@ $<
de4c45bd 841weak_alias_test_4.so: weak_alias_test_4_pic.o gcctestdir/ld
99a37bfd 842 $(CXXLINK) -Bgcctestdir/ -shared weak_alias_test_4_pic.o
21131061
ILT
843weak_alias_test_5_pic.o: weak_alias_test_5.cc
844 $(CXXCOMPILE) -c -fpic -o $@ $<
845weak_alias_test_5.so: weak_alias_test_5_pic.o $(srcdir)/weak_alias_test.script gcctestdir/ld
846 $(CXXLINK) -Bgcctestdir/ -shared weak_alias_test_5_pic.o \
847 -Wl,--version-script,$(srcdir)/weak_alias_test.script
99a37bfd 848
de4c45bd
ILT
849check_SCRIPTS += weak_plt.sh
850check_PROGRAMS += weak_plt
851check_DATA += weak_plt_shared.so
852weak_plt_main_pic.o: weak_plt_main.cc
853 $(CXXCOMPILE) -c -fpic -o $@ $<
854weak_plt: weak_plt_main_pic.o gcctestdir/ld
855 $(CXXLINK) -Bgcctestdir/ weak_plt_main_pic.o
856weak_plt_shared_pic.o: weak_plt_shared.cc
857 $(CXXCOMPILE) -c -fpic -o $@ $<
858weak_plt_shared.so: weak_plt_shared_pic.o gcctestdir/ld
859 $(CXXLINK) -Bgcctestdir/ -shared weak_plt_shared_pic.o
860
f34787f8
ILT
861check_PROGRAMS += copy_test
862copy_test_SOURCES = copy_test.cc
863copy_test_DEPENDENCIES = gcctestdir/ld copy_test_1.so copy_test_2.so
864copy_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
865copy_test_LDADD = copy_test_1.so copy_test_2.so
866copy_test_1_pic.o: copy_test_1.cc
867 $(CXXCOMPILE) -c -fpic -o $@ $<
868copy_test_1.so: gcctestdir/ld copy_test_1_pic.o
869 $(CXXLINK) -Bgcctestdir/ -shared copy_test_1_pic.o
870copy_test_2_pic.o: copy_test_2.cc
871 $(CXXCOMPILE) -c -fpic -o $@ $<
872copy_test_2.so: gcctestdir/ld copy_test_2_pic.o
873 $(CXXLINK) -Bgcctestdir/ -shared copy_test_2_pic.o
874
b733bcb7
CC
875check_PROGRAMS += copy_test_relro
876copy_test_relro_SOURCES = copy_test_relro.cc
877copy_test_relro_DEPENDENCIES = gcctestdir/ld copy_test_relro_1.so
878copy_test_relro_LDFLAGS = -Bgcctestdir/ -Wl,-R,. -Wl,-z,relro
879copy_test_relro_LDADD = copy_test_relro_1.so
880copy_test_relro_1_pic.o: copy_test_relro_1.cc
881 $(CXXCOMPILE) -c -fpic -o $@ $<
882copy_test_relro_1.so: gcctestdir/ld copy_test_relro_1_pic.o
883 $(CXXLINK) -Bgcctestdir/ -shared -Wl,-z,relro copy_test_relro_1_pic.o
884
38ac44ac 885if !DEFAULT_TARGET_POWERPC
6eeb0170
CC
886check_SCRIPTS += copy_test_protected.sh
887check_DATA += copy_test_protected.err
888MOSTLYCLEANFILES += copy_test_protected.err
889copy_test_protected.err: copy_test_protected.o copy_test_2.so gcctestdir/ld
890 @echo $(CXXLINK) -Bgcctestdir/ -o copy_test_protected copy_test_protected.o copy_test_2.so -Wl,-R,. "2>$@"
891 @if $(CXXLINK) -Bgcctestdir/ -o copy_test_protected copy_test_protected.o copy_test_2.so -Wl,-R,. 2>$@; \
892 then \
893 echo 1>&2 "Link of copy_test_protected should have failed"; \
894 rm -f $@; \
895 exit 1; \
896 fi
38ac44ac 897endif
6eeb0170 898
6eee141f
ILT
899if TLS
900
351a8000
ILT
901check_PROGRAMS += tls_test
902check_PROGRAMS += tls_pic_test
c7177d31 903check_PROGRAMS += tls_pie_test
b3705d2a 904check_PROGRAMS += tls_pie_pic_test
351a8000 905check_PROGRAMS += tls_shared_test
c03c7692 906check_PROGRAMS += tls_shared_ie_test
c2b45e22 907check_PROGRAMS += tls_shared_gd_to_ie_test
351a8000
ILT
908tls_test_pic.o: tls_test.cc
909 $(CXXCOMPILE) -c -fpic -o $@ $<
910tls_test_file2_pic.o: tls_test_file2.cc
911 $(CXXCOMPILE) -c -fpic -o $@ $<
155a0dd7
ILT
912tls_test_c_pic.o: tls_test_c.c
913 $(COMPILE) -c -fpic $(TLS_TEST_C_CFLAGS) -o $@ $<
914tls_test_shared.so: tls_test_pic.o tls_test_file2_pic.o tls_test_c_pic.o gcctestdir/ld
9c2d0ef9 915 $(CXXLINK) -Bgcctestdir/ -shared tls_test_pic.o tls_test_file2_pic.o tls_test_c_pic.o -Wl,-z,defs
c2b45e22
CC
916tls_test_shared2.so: tls_test_file2_pic.o gcctestdir/ld
917 $(CXXLINK) -Bgcctestdir/ -shared tls_test_file2_pic.o
351a8000 918
c03c7692
ILT
919tls_test_pic_ie.o: tls_test.cc
920 $(CXXCOMPILE) -c -fpic -ftls-model=initial-exec -o $@ $<
921tls_test_file2_pic_ie.o: tls_test_file2.cc
922 $(CXXCOMPILE) -c -fpic -ftls-model=initial-exec -o $@ $<
155a0dd7
ILT
923tls_test_c_pic_ie.o: tls_test_c.c
924 $(COMPILE) -c -fpic -ftls-model=initial-exec $(TLS_TEST_C_CFLAGS) -o $@ $<
925tls_test_ie_shared.so: tls_test_pic_ie.o tls_test_file2_pic_ie.o tls_test_c_pic_ie.o gcctestdir/ld
926 $(CXXLINK) -Bgcctestdir/ -shared tls_test_pic_ie.o tls_test_file2_pic_ie.o tls_test_c_pic_ie.o
c03c7692 927
e0374858 928tls_test_SOURCES = tls_test.cc tls_test_file2.cc tls_test_main.cc tls_test.h
155a0dd7 929tls_test_DEPENDENCIES = gcctestdir/ld tls_test_c.o
6eee141f 930tls_test_LDFLAGS = -Bgcctestdir/
155a0dd7
ILT
931tls_test_LDADD = tls_test_c.o -lpthread
932tls_test_c.o: tls_test_c.c
933 $(COMPILE) -c $(TLS_TEST_C_CFLAGS) -o $@ $<
6eee141f
ILT
934
935tls_pic_test_SOURCES = tls_test_main.cc
155a0dd7
ILT
936tls_pic_test_DEPENDENCIES = gcctestdir/ld tls_test_pic.o tls_test_file2_pic.o \
937 tls_test_c_pic.o
6eee141f 938tls_pic_test_LDFLAGS = -Bgcctestdir/
155a0dd7
ILT
939tls_pic_test_LDADD = tls_test_pic.o tls_test_file2_pic.o tls_test_c_pic.o \
940 -lpthread
6eee141f 941
c7177d31
ILT
942tls_test_main_pie.o: tls_test_main.cc tls_test.h
943 $(CXXCOMPILE) -c -fpie -o $@ $<
944tls_test_pie.o: tls_test.cc tls_test.h
945 $(CXXCOMPILE) -c -fpie -o $@ $<
946tls_test_file2_pie.o: tls_test_file2.cc tls_test.h
947 $(CXXCOMPILE) -c -fpie -o $@ $<
948tls_test_c_pie.o: tls_test_c.c
949 $(COMPILE) -c -fpic $(TLS_TEST_C_CFLAGS) -o $@ $<
950tls_pie_test: tls_test_main_pie.o tls_test_pie.o tls_test_file2_pie.o \
951 tls_test_c_pie.o gcctestdir/ld
952 $(CXXLINK) -Bgcctestdir/ -pie tls_test_main_pie.o tls_test_pie.o tls_test_file2_pie.o tls_test_c_pie.o -lpthread
953
a6a17750
CC
954check_SCRIPTS += tls_pie_test.sh
955check_DATA += tls_pie_test.stdout
956tls_pie_test.stdout: tls_pie_test
957 $(TEST_READELF) -rW $< > $@ 2>/dev/null
958
b3705d2a
ILT
959tls_pie_pic_test: tls_test_main_pie.o tls_test_pic.o tls_test_file2_pic.o \
960 tls_test_c_pic.o gcctestdir/ld
961 $(CXXLINK) -Bgcctestdir/ -pie tls_test_main_pie.o tls_test_pic.o tls_test_file2_pic.o tls_test_c_pic.o -lpthread
962
6eee141f
ILT
963tls_shared_test_SOURCES = tls_test_main.cc
964tls_shared_test_DEPENDENCIES = gcctestdir/ld tls_test_shared.so
965tls_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
966tls_shared_test_LDADD = tls_test_shared.so -lpthread
967
c03c7692
ILT
968tls_shared_ie_test_SOURCES = tls_test_main.cc
969tls_shared_ie_test_DEPENDENCIES = gcctestdir/ld tls_test_ie_shared.so
970tls_shared_ie_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
971tls_shared_ie_test_LDADD = tls_test_ie_shared.so -lpthread
972
c2b45e22 973tls_shared_gd_to_ie_test_SOURCES = tls_test_main.cc
155a0dd7
ILT
974tls_shared_gd_to_ie_test_DEPENDENCIES = gcctestdir/ld tls_test_pic.o \
975 tls_test_c_pic.o tls_test_shared2.so
c2b45e22 976tls_shared_gd_to_ie_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
155a0dd7
ILT
977tls_shared_gd_to_ie_test_LDADD = tls_test_pic.o tls_test_c_pic.o \
978 tls_test_shared2.so -lpthread
c2b45e22
CC
979
980if TLS_GNU2_DIALECT
981
982check_PROGRAMS += tls_shared_gnu2_gd_to_ie_test
983
984tls_test_gnu2.o: tls_test.cc
985 $(CXXCOMPILE) -c -fpic -mtls-dialect=gnu2 -o $@ $<
986tls_test_file2_gnu2.o: tls_test_file2.cc
987 $(CXXCOMPILE) -c -fpic -mtls-dialect=gnu2 -o $@ $<
155a0dd7
ILT
988tls_test_c_gnu2.o: tls_test_c.c
989 $(COMPILE) -c -fpic -mtls-dialect=gnu2 $(TLS_TEST_C_CFLAGS) -o $@ $<
c2b45e22
CC
990tls_test_gnu2_shared2.so: tls_test_file2_gnu2.o gcctestdir/ld
991 $(CXXLINK) -Bgcctestdir/ -shared tls_test_file2_gnu2.o
992
993tls_shared_gnu2_gd_to_ie_test_SOURCES = tls_test_main.cc
155a0dd7
ILT
994tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES = gcctestdir/ld tls_test_gnu2.o \
995 tls_test_c_gnu2.o tls_test_gnu2_shared2.so
c2b45e22 996tls_shared_gnu2_gd_to_ie_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
155a0dd7
ILT
997tls_shared_gnu2_gd_to_ie_test_LDADD = tls_test_gnu2.o tls_test_c_gnu2.o \
998 tls_test_gnu2_shared2.so -lpthread
c2b45e22
CC
999
1000if TLS_DESCRIPTORS
1001
1002check_PROGRAMS += tls_shared_gnu2_test
1003
155a0dd7
ILT
1004tls_test_gnu2_shared.so: tls_test_gnu2.o tls_test_file2_gnu2.o tls_test_c_gnu2.o gcctestdir/ld
1005 $(CXXLINK) -Bgcctestdir/ -shared tls_test_gnu2.o tls_test_file2_gnu2.o tls_test_c_gnu2.o
c2b45e22
CC
1006
1007tls_shared_gnu2_test_SOURCES = tls_test_main.cc
1008tls_shared_gnu2_test_DEPENDENCIES = gcctestdir/ld tls_test_gnu2_shared.so
1009tls_shared_gnu2_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1010tls_shared_gnu2_test_LDADD = tls_test_gnu2_shared.so -lpthread
1011
1012endif TLS_DESCRIPTORS
1013
1014endif TLS_GNU2_DIALECT
1015
328c7c2f 1016if HAVE_STATIC
351a8000
ILT
1017if STATIC_TLS
1018check_PROGRAMS += tls_static_test
1019check_PROGRAMS += tls_static_pic_test
1020
1021tls_static_test_SOURCES = $(tls_test_SOURCES)
1022tls_static_test_DEPENDENCIES = $(tls_test_DEPENDENCIES)
1023tls_static_test_LDFLAGS = $(tls_test_LDFLAGS) -static
1024tls_static_test_LDADD = $(tls_test_LDADD)
1025
1026tls_static_pic_test_SOURCES = $(tls_pic_test_SOURCES)
1027tls_static_pic_test_DEPENDENCIES = $(tls_pic_test_DEPENDENCIES)
1028tls_static_pic_test_LDFLAGS = $(tls_pic_test_LDFLAGS) -static
1029tls_static_pic_test_LDADD = $(tls_pic_test_LDADD)
1030endif
328c7c2f 1031endif
6eee141f
ILT
1032
1033if FN_PTRS_IN_SO_WITHOUT_PIC
351a8000 1034check_PROGRAMS += tls_shared_nonpic_test
155a0dd7 1035tls_test_shared_nonpic.so: tls_test.o tls_test_file2.o tls_test_c.o gcctestdir/ld
611062c0 1036 $(CXXLINK) -Bgcctestdir/ -shared tls_test.o tls_test_file2.o tls_test_c.o -Wl,-z,notext
6eee141f
ILT
1037
1038tls_shared_nonpic_test_SOURCES = tls_test_main.cc
1039tls_shared_nonpic_test_DEPENDENCIES = gcctestdir/ld tls_test_shared_nonpic.so
1040tls_shared_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1041tls_shared_nonpic_test_LDADD = tls_test_shared_nonpic.so -lpthread
351a8000 1042endif FN_PTRS_IN_SO_WITHOUT_PIC
6eee141f 1043
351a8000 1044endif TLS
6eee141f 1045
1fa29f10
IT
1046if DEFAULT_TARGET_X86_64
1047
1048check_SCRIPTS += x86_64_mov_to_lea.sh
1049check_DATA += x86_64_mov_to_lea1.stdout x86_64_mov_to_lea2.stdout \
1050 x86_64_mov_to_lea3.stdout x86_64_mov_to_lea4.stdout \
1051 x86_64_mov_to_lea5.stdout x86_64_mov_to_lea6.stdout \
1052 x86_64_mov_to_lea7.stdout x86_64_mov_to_lea8.stdout \
1053 x86_64_mov_to_lea9.stdout x86_64_mov_to_lea10.stdout \
1054 x86_64_mov_to_lea11.stdout x86_64_mov_to_lea12.stdout \
1055 x86_64_mov_to_lea13.stdout x86_64_mov_to_lea14.stdout
1056MOSTLYCLEANFILES += x86_64_mov_to_lea1 x86_64_mov_to_lea2 \
1057 x86_64_mov_to_lea3 x86_64_mov_to_lea4 x86_64_mov_to_lea5 \
1058 x86_64_mov_to_lea6 x86_64_mov_to_lea7 x86_64_mov_to_lea8 \
1059 x86_64_mov_to_lea9 x86_64_mov_to_lea10 x86_64_mov_to_lea11 \
1060 x86_64_mov_to_lea12 x86_64_mov_to_lea13 x86_64_mov_to_lea14
1061
1062x86_64_mov_to_lea1.o: x86_64_mov_to_lea1.s
1063 $(TEST_AS) --64 -o $@ $<
1064x86_64_mov_to_lea2.o: x86_64_mov_to_lea1.s
1065 $(TEST_AS) --x32 -o $@ $<
1066x86_64_mov_to_lea3.o: x86_64_mov_to_lea2.s
1067 $(TEST_AS) --x32 -o $@ $<
1068x86_64_mov_to_lea4.o: x86_64_mov_to_lea2.s
1069 $(TEST_AS) --64 -o $@ $<
1070x86_64_mov_to_lea5.o: x86_64_mov_to_lea3.s
1cd17042 1071 $(TEST_AS) --x32 -mrelax-relocations=yes -o $@ $<
1fa29f10 1072x86_64_mov_to_lea6.o: x86_64_mov_to_lea3.s
1cd17042 1073 $(TEST_AS) --64 -mrelax-relocations=yes -o $@ $<
1fa29f10
IT
1074x86_64_mov_to_lea7.o: x86_64_mov_to_lea4.s
1075 $(TEST_AS) --x32 -o $@ $<
1076x86_64_mov_to_lea8.o: x86_64_mov_to_lea4.s
1077 $(TEST_AS) --64 -o $@ $<
78d9f182 1078x86_64_mov_to_lea1: x86_64_mov_to_lea1.o ../ld-new
1fa29f10 1079 ../ld-new -Bsymbolic -shared -melf_x86_64 -o $@ $<
78d9f182 1080x86_64_mov_to_lea2: x86_64_mov_to_lea1.o ../ld-new
1fa29f10 1081 ../ld-new -pie -melf_x86_64 -o $@ $<
78d9f182 1082x86_64_mov_to_lea3: x86_64_mov_to_lea1.o ../ld-new
1fa29f10 1083 ../ld-new -melf_x86_64 -o $@ $<
78d9f182 1084x86_64_mov_to_lea4: x86_64_mov_to_lea2.o ../ld-new
1fa29f10 1085 ../ld-new -Bsymbolic -shared -melf32_x86_64 -o $@ $<
78d9f182 1086x86_64_mov_to_lea5: x86_64_mov_to_lea2.o ../ld-new
1fa29f10 1087 ../ld-new -pie -melf32_x86_64 -o $@ $<
78d9f182 1088x86_64_mov_to_lea6: x86_64_mov_to_lea2.o ../ld-new
1fa29f10 1089 ../ld-new -melf32_x86_64 -o $@ $<
78d9f182 1090x86_64_mov_to_lea7: x86_64_mov_to_lea3.o ../ld-new
1fa29f10 1091 ../ld-new -melf32_x86_64 -pie -o $@ $<
78d9f182 1092x86_64_mov_to_lea8: x86_64_mov_to_lea4.o ../ld-new
1fa29f10 1093 ../ld-new -melf_x86_64 -pie -o $@ $<
78d9f182 1094x86_64_mov_to_lea9: x86_64_mov_to_lea5.o ../ld-new
1fa29f10 1095 ../ld-new -melf32_x86_64 -o $@ $<
78d9f182 1096x86_64_mov_to_lea10: x86_64_mov_to_lea6.o ../ld-new
1fa29f10 1097 ../ld-new -melf_x86_64 -o $@ $<
78d9f182 1098x86_64_mov_to_lea11: x86_64_mov_to_lea2.o ../ld-new
1fa29f10 1099 ../ld-new -melf32_x86_64 -shared -o $@ $<
78d9f182 1100x86_64_mov_to_lea12: x86_64_mov_to_lea1.o ../ld-new
1fa29f10 1101 ../ld-new -melf_x86_64 -shared -o $@ $<
78d9f182 1102x86_64_mov_to_lea13: x86_64_mov_to_lea7.o ../ld-new
1fa29f10 1103 ../ld-new -melf32_x86_64 -shared -o $@ $<
78d9f182 1104x86_64_mov_to_lea14: x86_64_mov_to_lea8.o ../ld-new
1fa29f10
IT
1105 ../ld-new -melf_x86_64 -shared -o $@ $<
1106x86_64_mov_to_lea1.stdout: x86_64_mov_to_lea1
1107 $(TEST_OBJDUMP) -dw $< > $@
1108x86_64_mov_to_lea2.stdout: x86_64_mov_to_lea2
1109 $(TEST_OBJDUMP) -dw $< > $@
1110x86_64_mov_to_lea3.stdout: x86_64_mov_to_lea3
1111 $(TEST_OBJDUMP) -dw $< > $@
1112x86_64_mov_to_lea4.stdout: x86_64_mov_to_lea4
1113 $(TEST_OBJDUMP) -dw $< > $@
1114x86_64_mov_to_lea5.stdout: x86_64_mov_to_lea5
1115 $(TEST_OBJDUMP) -dw $< > $@
1116x86_64_mov_to_lea6.stdout: x86_64_mov_to_lea6
1117 $(TEST_OBJDUMP) -dw $< > $@
1118x86_64_mov_to_lea7.stdout: x86_64_mov_to_lea7
1119 $(TEST_OBJDUMP) -dw $< > $@
1120x86_64_mov_to_lea8.stdout: x86_64_mov_to_lea8
1121 $(TEST_OBJDUMP) -dw $< > $@
1122x86_64_mov_to_lea9.stdout: x86_64_mov_to_lea9
1123 $(TEST_OBJDUMP) -dw $< > $@
1124x86_64_mov_to_lea10.stdout: x86_64_mov_to_lea10
1125 $(TEST_OBJDUMP) -dw $< > $@
1126x86_64_mov_to_lea11.stdout: x86_64_mov_to_lea11
1127 $(TEST_OBJDUMP) -dw $< > $@
1128x86_64_mov_to_lea12.stdout: x86_64_mov_to_lea12
1129 $(TEST_OBJDUMP) -dw $< > $@
1130x86_64_mov_to_lea13.stdout: x86_64_mov_to_lea13
1131 $(TEST_OBJDUMP) -dw $< > $@
1132x86_64_mov_to_lea14.stdout: x86_64_mov_to_lea14
1133 $(TEST_OBJDUMP) -dw $< > $@
1134
3a4f096e
ST
1135check_SCRIPTS += x86_64_indirect_call_to_direct.sh
1136check_DATA += x86_64_indirect_call_to_direct1.stdout \
1137 x86_64_indirect_jump_to_direct1.stdout
1138MOSTLYCLEANFILES += x86_64_indirect_call_to_direct1 \
1139 x86_64_indirect_jump_to_direct1
1140
1141x86_64_indirect_call_to_direct1.o: x86_64_indirect_call_to_direct1.s
1142 $(TEST_AS) --64 -mrelax-relocations=yes -o $@ $<
1143x86_64_indirect_call_to_direct1: x86_64_indirect_call_to_direct1.o gcctestdir/ld
1144 gcctestdir/ld -o $@ $<
1145x86_64_indirect_call_to_direct1.stdout: x86_64_indirect_call_to_direct1
1146 $(TEST_OBJDUMP) -dw $< > $@
1147x86_64_indirect_jump_to_direct1.o: x86_64_indirect_jump_to_direct1.s
1148 $(TEST_AS) --64 -mrelax-relocations=yes -o $@ $<
1149x86_64_indirect_jump_to_direct1: x86_64_indirect_jump_to_direct1.o gcctestdir/ld
1150 gcctestdir/ld -o $@ $<
1151x86_64_indirect_jump_to_direct1.stdout: x86_64_indirect_jump_to_direct1
1152 $(TEST_OBJDUMP) -dw $< > $@
1153
c34c98ed
CC
1154check_SCRIPTS += x86_64_overflow_pc32.sh
1155check_DATA += x86_64_overflow_pc32.err
1156MOSTLYCLEANFILES += x86_64_overflow_pc32.err
1157x86_64_overflow_pc32.o: x86_64_overflow_pc32.s
1158 $(TEST_AS) -o $@ $<
1159x86_64_overflow_pc32.err: x86_64_overflow_pc32.o gcctestdir/ld
19ef3f4d
CC
1160 @echo gcctestdir/ld -e bar -Tdata=0x81000000 -o x86_64_overflow_pc32 x86_64_overflow_pc32.o "2>$@"
1161 @if gcctestdir/ld -e bar -Tdata=0x81000000 -o x86_64_overflow_pc32 x86_64_overflow_pc32.o 2>$@; \
c34c98ed
CC
1162 then \
1163 echo 1>&2 "Link of x86_64_overflow_pc32 should have failed"; \
1164 rm -f $@; \
1165 exit 1; \
1166 fi
1167
ac423761
GN
1168check_PROGRAMS += pr17704a_test
1169pr17704a_test.o: pr17704a_test.s
1170 $(TEST_AS) --64 -o $@ $<
1171pr17704a_test: pr17704a_test.o gcctestdir/ld
1172 gcctestdir/ld --icf=all -o $@ $<
1173
19ef3f4d
CC
1174check_SCRIPTS += x32_overflow_pc32.sh
1175check_DATA += x32_overflow_pc32.err
1176MOSTLYCLEANFILES += x32_overflow_pc32.err
19ef3f4d
CC
1177x32_overflow_pc32.o: x86_64_overflow_pc32.s
1178 $(TEST_AS) --x32 -o $@ $<
1179x32_overflow_pc32.err: x32_overflow_pc32.o gcctestdir/ld
1180 @echo gcctestdir/ld -e bar -Tdata=0x81000000 -o x32_overflow_pc32 x32_overflow_pc32.o "2>$@"
1181 @if gcctestdir/ld -e bar -Tdata=0x81000000 -o x32_overflow_pc32 x32_overflow_pc32.o 2>$@; \
1182 then \
1183 echo 1>&2 "Link of x32_overflow_pc32 should have failed"; \
1184 rm -f $@; \
1185 exit 1; \
1186 fi
1187
1fa29f10
IT
1188endif DEFAULT_TARGET_X86_64
1189
ad961eab
L
1190if DEFAULT_TARGET_X86_64_OR_X32
1191
1192check_PROGRAMS += pr20216a_test
1193pr20216a_test_SOURCES = pr20216_main.c pr20216_def.c
1194pr20216a_test_DEPENDENCIES = pr20216_gd.o pr20216_ld.o gcctestdir/ld gcctestdir/as
1195pr20216a_test_CFLAGS = -Bgcctestdir/ -fPIE
1196pr20216a_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1197pr20216a_test_LDADD = pr20216_gd.o pr20216_ld.o
1198
1199check_PROGRAMS += pr20216b_test
1200pr20216b_test_SOURCES = pr20216_main.c pr20216_def.c
1201pr20216b_test_DEPENDENCIES = pr20216_gd.o pr20216_ld.o gcctestdir/ld gcctestdir/as
1202pr20216b_test_CFLAGS = -Bgcctestdir/ -fPIE
1203pr20216b_test_LDFLAGS = -pie -Bgcctestdir/ -Wl,-R,.
1204pr20216b_test_LDADD = pr20216_gd.o pr20216_ld.o
1205
1206check_PROGRAMS += pr20216c_test
1207pr20216c_test_SOURCES = pr20216_main.c pr20216_def.c
1208pr20216c_test_DEPENDENCIES = pr20216_gd.o pr20216_ld.o gcctestdir/ld gcctestdir/as
1209pr20216c_test_CFLAGS = -Bgcctestdir/ -fPIE
1210pr20216c_test_LDFLAGS = -static -Bgcctestdir/ -Wl,-R,.
1211pr20216c_test_LDADD = pr20216_gd.o pr20216_ld.o
1212
1213check_PROGRAMS += pr20216d_test
1214pr20216d_test_SOURCES = pr20216_main.c pr20216_def.c
1215pr20216d_test_DEPENDENCIES = pr20216a.so gcctestdir/ld gcctestdir/as
1216pr20216d_test_CFLAGS = -Bgcctestdir/ -fPIE
1217pr20216d_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1218pr20216d_test_LDADD = pr20216a.so
1219
1220check_PROGRAMS += pr20216e_test
1221pr20216e_test_SOURCES = pr20216_main.c
1222pr20216e_test_DEPENDENCIES = pr20216_gd.o pr20216_ld.o pr20216b.so gcctestdir/ld gcctestdir/as
1223pr20216e_test_CFLAGS = -Bgcctestdir/ -fPIE
1224pr20216e_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1225pr20216e_test_LDADD = pr20216_gd.o pr20216_ld.o pr20216b.so
1226
1227MOSTLYCLEANFILES += pr20216a.so pr20216b.so
1228
1229pr20216a.so: pr20216_gd.o pr20216_ld.o gcctestdir/ld
1230 $(LINK) -Bgcctestdir/ -shared pr20216_gd.o pr20216_ld.o
1231
1232pr20216b.so: pr20216_def.o gcctestdir/ld
1233 $(LINK) -Bgcctestdir/ -shared pr20216_def.o
1234
a4aa1f5f 1235pr20216_gd.o: pr20216_gd.S gcctestdir/as
f5713901 1236 $(COMPILE) -Bgcctestdir/ -c -o $@ $<
ad961eab 1237
a4aa1f5f 1238pr20216_ld.o: pr20216_ld.S gcctestdir/as
f5713901 1239 $(COMPILE) -Bgcctestdir/ -c -o $@ $<
ad961eab
L
1240
1241endif DEFAULT_TARGET_X86_64_OR_X32
1242
c4fc4724
IT
1243if DEFAULT_TARGET_I386
1244
1245check_SCRIPTS += i386_mov_to_lea.sh
1246check_DATA += i386_mov_to_lea1.stdout i386_mov_to_lea2.stdout \
1247 i386_mov_to_lea3.stdout i386_mov_to_lea4.stdout \
1248 i386_mov_to_lea5.stdout i386_mov_to_lea6.stdout \
1249 i386_mov_to_lea7.stdout i386_mov_to_lea8.stdout
1250MOSTLYCLEANFILES += i386_mov_to_lea1 i386_mov_to_lea2 i386_mov_to_lea3 \
1251 i386_mov_to_lea4 i386_mov_to_lea5 i386_mov_to_lea6 \
1252 i386_mov_to_lea7 i386_mov_to_lea8
1253
1254i386_mov_to_lea1.o: i386_mov_to_lea1.s
1255 $(TEST_AS) --32 -o $@ $<
1256i386_mov_to_lea2.o: i386_mov_to_lea2.s
1257 $(TEST_AS) --32 -o $@ $<
1258i386_mov_to_lea3.o: i386_mov_to_lea3.s
1259 $(TEST_AS) --32 -o $@ $<
1260i386_mov_to_lea4.o: i386_mov_to_lea4.s
1261 $(TEST_AS) --32 -o $@ $<
1262i386_mov_to_lea5.o: i386_mov_to_lea5.s
1263 $(TEST_AS) --32 -o $@ $<
78d9f182 1264i386_mov_to_lea1: i386_mov_to_lea1.o ../ld-new
c4fc4724 1265 ../ld-new -Bsymbolic -shared -melf_i386 -o $@ $<
78d9f182 1266i386_mov_to_lea2: i386_mov_to_lea1.o ../ld-new
c4fc4724 1267 ../ld-new -pie -melf_i386 -o $@ $<
78d9f182 1268i386_mov_to_lea3: i386_mov_to_lea1.o ../ld-new
c4fc4724 1269 ../ld-new -melf_i386 -o $@ $<
78d9f182 1270i386_mov_to_lea4: i386_mov_to_lea1.o ../ld-new
c4fc4724 1271 ../ld-new -melf_i386 -shared -o $@ $<
78d9f182 1272i386_mov_to_lea5: i386_mov_to_lea2.o ../ld-new
c4fc4724 1273 ../ld-new -melf_i386 -shared -o $@ $<
78d9f182 1274i386_mov_to_lea6: i386_mov_to_lea3.o ../ld-new
c4fc4724 1275 ../ld-new -melf_i386 -shared -o $@ $<
78d9f182 1276i386_mov_to_lea7: i386_mov_to_lea4.o ../ld-new
c4fc4724 1277 ../ld-new -melf_i386 -shared -o $@ $<
78d9f182 1278i386_mov_to_lea8: i386_mov_to_lea5.o ../ld-new
c4fc4724
IT
1279 ../ld-new -melf_i386 -shared -o $@ $<
1280i386_mov_to_lea1.stdout: i386_mov_to_lea1
1281 $(TEST_OBJDUMP) -dw $< > $@
1282i386_mov_to_lea2.stdout: i386_mov_to_lea2
1283 $(TEST_OBJDUMP) -dw $< > $@
1284i386_mov_to_lea3.stdout: i386_mov_to_lea3
1285 $(TEST_OBJDUMP) -dw $< > $@
1286i386_mov_to_lea4.stdout: i386_mov_to_lea4
1287 $(TEST_OBJDUMP) -dw $< > $@
1288i386_mov_to_lea5.stdout: i386_mov_to_lea5
1289 $(TEST_OBJDUMP) -dw $< > $@
1290i386_mov_to_lea6.stdout: i386_mov_to_lea6
1291 $(TEST_OBJDUMP) -dw $< > $@
1292i386_mov_to_lea7.stdout: i386_mov_to_lea7
1293 $(TEST_OBJDUMP) -dw $< > $@
1294i386_mov_to_lea8.stdout: i386_mov_to_lea8
1295 $(TEST_OBJDUMP) -dw $< > $@
1296
b287eca3
L
1297check_PROGRAMS += pr20308a_test
1298pr20308a_test_SOURCES = pr20308_main.c pr20308_def.c
1299pr20308a_test_DEPENDENCIES = pr20308_gd.o pr20308_ld.o gcctestdir/ld gcctestdir/as
1300pr20308a_test_CFLAGS = -Bgcctestdir/ -fPIE
1301pr20308a_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1302pr20308a_test_LDADD = pr20308_gd.o pr20308_ld.o
1303
1304check_PROGRAMS += pr20308b_test
1305pr20308b_test_SOURCES = pr20308_main.c pr20308_def.c
1306pr20308b_test_DEPENDENCIES = pr20308_gd.o pr20308_ld.o gcctestdir/ld gcctestdir/as
1307pr20308b_test_CFLAGS = -Bgcctestdir/ -fPIE
1308pr20308b_test_LDFLAGS = -pie -Bgcctestdir/ -Wl,-R,.
1309pr20308b_test_LDADD = pr20308_gd.o pr20308_ld.o
1310
1311check_PROGRAMS += pr20308c_test
1312pr20308c_test_SOURCES = pr20308_main.c pr20308_def.c
1313pr20308c_test_DEPENDENCIES = pr20308_gd.o pr20308_ld.o gcctestdir/ld gcctestdir/as
1314pr20308c_test_CFLAGS = -Bgcctestdir/ -fPIE
1315pr20308c_test_LDFLAGS = -static -Bgcctestdir/ -Wl,-R,.
1316pr20308c_test_LDADD = pr20308_gd.o pr20308_ld.o
1317
1318check_PROGRAMS += pr20308d_test
1319pr20308d_test_SOURCES = pr20308_main.c pr20308_def.c
1320pr20308d_test_DEPENDENCIES = pr20308a.so gcctestdir/ld gcctestdir/as
1321pr20308d_test_CFLAGS = -Bgcctestdir/ -fPIE
1322pr20308d_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1323pr20308d_test_LDADD = pr20308a.so
1324
1325check_PROGRAMS += pr20308e_test
1326pr20308e_test_SOURCES = pr20308_main.c
1327pr20308e_test_DEPENDENCIES = pr20308_gd.o pr20308_ld.o pr20308b.so gcctestdir/ld gcctestdir/as
1328pr20308e_test_CFLAGS = -Bgcctestdir/ -fPIE
1329pr20308e_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1330pr20308e_test_LDADD = pr20308_gd.o pr20308_ld.o pr20308b.so
1331
1332MOSTLYCLEANFILES += pr20308a.so pr20308b.so
1333
1334pr20308a.so: pr20308_gd.o pr20308_ld.o gcctestdir/ld
1335 $(LINK) -Bgcctestdir/ -shared pr20308_gd.o pr20308_ld.o
1336
1337pr20308b.so: pr20308_def.o gcctestdir/ld
1338 $(LINK) -Bgcctestdir/ -shared pr20308_def.o
1339
a4aa1f5f
CC
1340pr20308_gd.o: pr20308_gd.S gcctestdir/as
1341 $(COMPILE) -Bgcctestdir/ -c -o $@ $<
b287eca3 1342
a4aa1f5f
CC
1343pr20308_ld.o: pr20308_ld.S gcctestdir/as
1344 $(COMPILE) -Bgcctestdir/ -c -o $@ $<
b287eca3 1345
c4fc4724
IT
1346endif DEFAULT_TARGET_I386
1347
d491d34e
ILT
1348check_PROGRAMS += many_sections_test
1349many_sections_test_SOURCES = many_sections_test.cc
1350many_sections_test_DEPENDENCIES = gcctestdir/ld
1351many_sections_test_LDFLAGS = -Bgcctestdir/ -rdynamic
1abce4a6 1352many_sections_test_LDADD =
d491d34e
ILT
1353
1354BUILT_SOURCES += many_sections_define.h
72fef11a 1355MOSTLYCLEANFILES += many_sections_define.h
d491d34e
ILT
1356many_sections_define.h:
1357 (for i in `seq 1 70000`; do \
1358 echo "int var_$$i __attribute__((section(\"section_$$i\"))) = $$i;"; \
1359 done) > $@.tmp
1360 mv -f $@.tmp $@
1361
1362BUILT_SOURCES += many_sections_check.h
72fef11a 1363MOSTLYCLEANFILES += many_sections_check.h
d491d34e 1364many_sections_check.h:
4c94d6ae 1365 (for i in `seq 1 1000 70000`; do \
d491d34e
ILT
1366 echo "assert(var_$$i == $$i);"; \
1367 done) > $@.tmp
1368 mv -f $@.tmp $@
1369
1370check_PROGRAMS += many_sections_r_test
d491d34e
ILT
1371many_sections_r_test.o: many_sections_test.o gcctestdir/ld
1372 gcctestdir/ld -r -o $@ many_sections_test.o
7bc3e21a
ILT
1373many_sections_r_test: many_sections_r_test.o gcctestdir/ld
1374 $(CXXLINK) -Bgcctestdir/ many_sections_r_test.o $(LIBS)
6eee141f 1375
82d93790
CC
1376check_SCRIPTS += file_in_many_sections_test.sh
1377check_DATA += file_in_many_sections.stdout
1378MOSTLYCLEANFILES += file_in_many_sections
1379file_in_many_sections.o: file_in_many_sections.c many_sections_define.h
1380 $(COMPILE) -c -fdata-sections -o $@ $(srcdir)/file_in_many_sections.c
1381file_in_many_sections: file_in_many_sections.o gcctestdir/ld
1382 $(LINK) -Bgcctestdir/ file_in_many_sections.o -Wl,--gc-sections
1383file_in_many_sections.stdout: file_in_many_sections
1384 $(TEST_READELF) -s $< > $@
1385
2fd32231
ILT
1386check_PROGRAMS += initpri1
1387initpri1_SOURCES = initpri1.c
1388initpri1_DEPENDENCIES = gcctestdir/ld
1389initpri1_LDFLAGS = -Bgcctestdir/
1abce4a6 1390initpri1_LDADD =
2fd32231 1391
5393d741
ILT
1392check_PROGRAMS += initpri2
1393initpri2_SOURCES = initpri2.c
1394initpri2_DEPENDENCIES = gcctestdir/ld
7b5de7ee 1395initpri2_LDFLAGS = -Bgcctestdir/ -Wl,--ctors-in-init-array
5393d741 1396initpri2_LDADD =
2fd32231 1397
487b39df
ILT
1398check_PROGRAMS += initpri3a
1399initpri3a_SOURCES = initpri3.c
1400initpri3a_DEPENDENCIES = gcctestdir/ld
1401initpri3a_LDFLAGS = -Bgcctestdir/
1402initpri3a_LDADD =
1403
7c6109da
DK
1404# This test fails on targets not using .ctors and .dtors sections (e.g. ARM
1405# EABI). Given that gcc is moving towards using .init_array in all cases,
1406# this test is commented out. A better fix would be checking whether gcc
1407# uses .ctors or .init_array sections in configure.
1408
1409# check_PROGRAMS += initpri3b
1410# initpri3b_SOURCES = initpri3.c
1411# initpri3b_DEPENDENCIES = gcctestdir/ld
1412# initpri3b_LDFLAGS = -Bgcctestdir/ -Wl,--no-ctors-in-init-array
1413# initpri3b_LDADD =
487b39df 1414
351a8000
ILT
1415# Test --detect-odr-violations
1416check_SCRIPTS += debug_msg.sh
6eee141f 1417
351a8000
ILT
1418# Create the data files that debug_msg.sh analyzes.
1419check_DATA += debug_msg.err
1420MOSTLYCLEANFILES += debug_msg.err
1421debug_msg.o: debug_msg.cc
1422 $(CXXCOMPILE) -O0 -g -c -w -o $@ $(srcdir)/debug_msg.cc
1423odr_violation1.o: odr_violation1.cc
1424 $(CXXCOMPILE) -O0 -g -c -w -o $@ $(srcdir)/odr_violation1.cc
71ff8986
ILT
1425# Compile with different optimization flags to check that rearranged
1426# instructions don't cause a false positive.
351a8000 1427odr_violation2.o: odr_violation2.cc
71ff8986 1428 $(CXXCOMPILE) -O2 -g -c -w -o $@ $(srcdir)/odr_violation2.cc
351a8000
ILT
1429debug_msg.err: debug_msg.o odr_violation1.o odr_violation2.o gcctestdir/ld
1430 @echo $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg debug_msg.o odr_violation1.o odr_violation2.o "2>$@"
1431 @if $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg debug_msg.o odr_violation1.o odr_violation2.o 2>$@; \
1432 then \
1433 echo 1>&2 "Link of debug_msg should have failed"; \
1434 rm -f $@; \
1435 exit 1; \
1436 fi
1437
93acabad
CC
1438# Test error message when a vtable is undefined.
1439check_SCRIPTS += missing_key_func.sh
1440check_DATA += missing_key_func.err
1441MOSTLYCLEANFILES += missing_key_func.err
1442missing_key_func.o: missing_key_func.cc
1443 $(CXXCOMPILE) -O0 -g -c -o $@ $(srcdir)/missing_key_func.cc
1444missing_key_func.err: missing_key_func.o gcctestdir/ld
1445 @echo $(CXXLINK) -Bgcctestdir/ -o missing_key_func missing_key_func.o "2>$@"
1446 @if $(CXXLINK) -Bgcctestdir/ -o missing_key_func missing_key_func.o 2>$@; \
1447 then \
1448 echo 1>&2 "Link of missing_key_func should have failed"; \
1449 rm -f $@; \
1450 exit 1; \
1451 fi
472076e4 1452
472076e4
CC
1453# Check that --detect-odr-violations works with compressed debug sections.
1454check_DATA += debug_msg_cdebug.err
1455MOSTLYCLEANFILES += debug_msg_cdebug.err
1456debug_msg_cdebug.o: debug_msg.cc gcctestdir/as
1457 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -Wa,--compress-debug-sections -c -w -o $@ $(srcdir)/debug_msg.cc
1458odr_violation1_cdebug.o: odr_violation1.cc gcctestdir/as
1459 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -Wa,--compress-debug-sections -c -w -o $@ $(srcdir)/odr_violation1.cc
1460odr_violation2_cdebug.o: odr_violation2.cc gcctestdir/as
1461 $(CXXCOMPILE) -Bgcctestdir/ -O2 -g -Wa,--compress-debug-sections -c -w -o $@ $(srcdir)/odr_violation2.cc
1462debug_msg_cdebug.err: debug_msg_cdebug.o odr_violation1_cdebug.o odr_violation2_cdebug.o gcctestdir/ld
1463 @echo $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_cdebug debug_msg_cdebug.o odr_violation1_cdebug.o odr_violation2_cdebug.o "2>$@"
1464 @if $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_cdebug debug_msg_cdebug.o odr_violation1_cdebug.o odr_violation2_cdebug.o 2>$@; \
1465 then \
1466 echo 1>&2 "Link of debug_msg_cdebug should have failed"; \
1467 rm -f $@; \
1468 exit 1; \
1469 fi
48058663
L
1470check_DATA += debug_msg_cdebug_gabi.err
1471MOSTLYCLEANFILES += debug_msg_cdebug_gabi.err
1472debug_msg_cdebug_gabi.o: debug_msg.cc gcctestdir/as
1473 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -Wa,--compress-debug-sections=zlib-gabi -c -w -o $@ $(srcdir)/debug_msg.cc
1474odr_violation1_cdebug_gabi.o: odr_violation1.cc gcctestdir/as
1475 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -Wa,--compress-debug-sections=zlib-gabi -c -w -o $@ $(srcdir)/odr_violation1.cc
1476odr_violation2_cdebug_gabi.o: odr_violation2.cc gcctestdir/as
1477 $(CXXCOMPILE) -Bgcctestdir/ -O2 -g -Wa,--compress-debug-sections=zlib-gabi -c -w -o $@ $(srcdir)/odr_violation2.cc
1478debug_msg_cdebug_gabi.err: debug_msg_cdebug_gabi.o odr_violation1_cdebug_gabi.o odr_violation2_cdebug_gabi.o gcctestdir/ld
1479 @echo $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_cdebug debug_msg_cdebug_gabi.o odr_violation1_cdebug_gabi.o odr_violation2_cdebug_gabi.o "2>$@"
1480 @if $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_cdebug_gabi debug_msg_cdebug_gabi.o odr_violation1_cdebug_gabi.o odr_violation2_cdebug_gabi.o 2>$@; \
1481 then \
1482 echo 1>&2 "Link of debug_msg_cdebug_gabi should have failed"; \
1483 rm -f $@; \
1484 exit 1; \
1485 fi
472076e4 1486
351a8000
ILT
1487# See if we can also detect problems when we're linking .so's, not .o's.
1488check_DATA += debug_msg_so.err
1489MOSTLYCLEANFILES += debug_msg_so.err
1490debug_msg.so: debug_msg.cc gcctestdir/ld
1491 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -shared -fPIC -w -o $@ $(srcdir)/debug_msg.cc
1492odr_violation1.so: odr_violation1.cc gcctestdir/ld
1493 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -shared -fPIC -w -o $@ $(srcdir)/odr_violation1.cc
1494odr_violation2.so: odr_violation2.cc gcctestdir/ld
71ff8986 1495 $(CXXCOMPILE) -Bgcctestdir/ -O2 -g -shared -fPIC -w -o $@ $(srcdir)/odr_violation2.cc
351a8000 1496debug_msg_so.err: debug_msg.so odr_violation1.so odr_violation2.so gcctestdir/ld
3d587466
CC
1497 @echo $(CXXLINK_S) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_so debug_msg.so odr_violation1.so odr_violation2.so "2>$@"
1498 @if $(CXXLINK_S) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_so debug_msg.so odr_violation1.so odr_violation2.so 2>$@; \
351a8000
ILT
1499 then \
1500 echo 1>&2 "Link of debug_msg_so should have failed"; \
1501 rm -f $@; \
1502 exit 1; \
1503 fi
1504
1505# We also want to make sure we do something reasonable when there's no
1506# debug info available. For the best test, we use .so's.
1507check_DATA += debug_msg_ndebug.err
1508MOSTLYCLEANFILES += debug_msg_ndebug.err
1509debug_msg_ndebug.so: debug_msg.cc gcctestdir/ld
1510 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g0 -shared -fPIC -w -o $@ $(srcdir)/debug_msg.cc
1511odr_violation1_ndebug.so: odr_violation1.cc gcctestdir/ld
1512 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g0 -shared -fPIC -w -o $@ $(srcdir)/odr_violation1.cc
1513odr_violation2_ndebug.so: odr_violation2.cc gcctestdir/ld
71ff8986 1514 $(CXXCOMPILE) -Bgcctestdir/ -O2 -g0 -shared -fPIC -w -o $@ $(srcdir)/odr_violation2.cc
351a8000 1515debug_msg_ndebug.err: debug_msg_ndebug.so odr_violation1_ndebug.so odr_violation2_ndebug.so gcctestdir/ld
3d587466
CC
1516 @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>$@"
1517 @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
1518 then \
1519 echo 1>&2 "Link of debug_msg_ndebug should have failed"; \
1520 rm -f $@; \
1521 exit 1; \
1522 fi
1523
1524
1525# Similar to --detect-odr-violations: check for undefined symbols in .so's
1526check_SCRIPTS += undef_symbol.sh
1527check_DATA += undef_symbol.err
1528MOSTLYCLEANFILES += undef_symbol.err
1529undef_symbol.o: undef_symbol.cc
1530 $(CXXCOMPILE) -O0 -g -c -fPIC $<
1531undef_symbol.so: undef_symbol.o gcctestdir/ld
1532 $(CXXLINK) -Bgcctestdir/ -shared undef_symbol.o
1533undef_symbol.err: undef_symbol_main.o undef_symbol.so gcctestdir/ld
1534 @echo $(CXXLINK) -Bgcctestdir/ -o undef_symbol_test undef_symbol_main.o undef_symbol.so "2>$@"
1535 @if $(CXXLINK) -Bgcctestdir/ -o undef_symbol_test undef_symbol_main.o undef_symbol.so 2>$@; \
1536 then \
1537 echo 1>&2 "Link of undef_symbol_test should have failed"; \
1538 rm -f $@; \
1539 exit 1; \
1540 fi
1541
1542
351a8000
ILT
1543# Test -o when emitting to a special file (such as something in /dev).
1544check_PROGRAMS += flagstest_o_specialfile
0e470e5c 1545flagstest_o_specialfile: flagstest_debug.o gcctestdir/ld
351a8000
ILT
1546 $(CXXLINK) -Bgcctestdir/ -o /dev/stdout $< 2>&1 | cat > $@
1547 chmod a+x $@
1548 test -s $@
1549
fb8b9dbc
L
1550# Test --compress-debug-sections.
1551check_PROGRAMS += flagstest_compress_debug_sections_none
1552check_DATA += flagstest_compress_debug_sections_none.stdout
1553flagstest_compress_debug_sections_none: flagstest_debug.o gcctestdir/ld
1554 $(CXXLINK) -Bgcctestdir/ -o $@ $< -Wl,--compress-debug-sections=none
1555 test -s $@
1556
1557# Dump DWARF debug sections.
1558flagstest_compress_debug_sections_none.stdout: flagstest_compress_debug_sections_none
1559 $(TEST_READELF) -w $< > $@.tmp
1560 mv -f $@.tmp $@
1561
7fcd0256 1562check_PROGRAMS += flagstest_compress_debug_sections
fb8b9dbc
L
1563check_DATA += flagstest_compress_debug_sections.stdout \
1564 flagstest_compress_debug_sections.cmp \
1565 flagstest_compress_debug_sections.check
0863441e
CC
1566MOSTLYCLEANFILES += flagstest_compress_debug_sections.check \
1567 flagstest_compress_debug_sections.cmp
7fcd0256
ILT
1568flagstest_compress_debug_sections: flagstest_debug.o gcctestdir/ld
1569 $(CXXLINK) -Bgcctestdir/ -o $@ $< -Wl,--compress-debug-sections=zlib
1570 test -s $@
1571
9c7fe3c5
CC
1572# Test --compress-debug-sections with --build-id=tree.
1573check_PROGRAMS += flagstest_compress_debug_sections_and_build_id_tree
1574flagstest_compress_debug_sections_and_build_id_tree: flagstest_debug.o gcctestdir/ld
1575 $(CXXLINK) -Bgcctestdir/ -o $@ $< -Wl,--compress-debug-sections=zlib \
1576 -Wl,--build-id=tree \
1577 -Wl,--build-id-chunk-size-for-treehash=4096 \
1578 -Wl,--build-id-min-file-size-for-treehash=0
1579 test -s $@
7fcd0256 1580
fb8b9dbc
L
1581# Dump compressed DWARF debug sections.
1582flagstest_compress_debug_sections.stdout: flagstest_compress_debug_sections
1583 $(TEST_READELF) -w $< | sed -e "s/.zdebug_/.debug_/" > $@.tmp
1584 mv -f $@.tmp $@
1585
19a7fe52 1586# Check there are compressed DWARF .debug_* sections.
fb8b9dbc 1587flagstest_compress_debug_sections.check: flagstest_compress_debug_sections
19a7fe52 1588 $(TEST_READELF) -SW $< | egrep ".debug_.* C *" > $@.tmp
fb8b9dbc
L
1589 mv -f $@.tmp $@
1590
1591# Compare DWARF debug info.
1592flagstest_compress_debug_sections.cmp: flagstest_compress_debug_sections.stdout \
1593 flagstest_compress_debug_sections_none.stdout
1594 cmp flagstest_compress_debug_sections.stdout \
1595 flagstest_compress_debug_sections_none.stdout > $@.tmp
1596 mv -f $@.tmp $@
1597
1598check_PROGRAMS += flagstest_compress_debug_sections_gnu
1599check_DATA += flagstest_compress_debug_sections_gnu.stdout \
1600 flagstest_compress_debug_sections_gnu.cmp \
1601 flagstest_compress_debug_sections_gnu.check
0863441e
CC
1602MOSTLYCLEANFILES += flagstest_compress_debug_sections_gnu.check \
1603 flagstest_compress_debug_sections_gnu.cmp
fb8b9dbc
L
1604flagstest_compress_debug_sections_gnu: flagstest_debug.o gcctestdir/ld
1605 $(CXXLINK) -Bgcctestdir/ -o $@ $< -Wl,--compress-debug-sections=zlib-gnu
1606 test -s $@
1607
1608# Dump compressed DWARF debug sections.
1609flagstest_compress_debug_sections_gnu.stdout: flagstest_compress_debug_sections_gnu
1610 $(TEST_READELF) -w $< | sed -e "s/.zdebug_/.debug_/" > $@.tmp
1611 mv -f $@.tmp $@
1612
1613# Check there are compressed DWARF .zdebug_* sections.
1614flagstest_compress_debug_sections_gnu.check: flagstest_compress_debug_sections_gnu
1615 $(TEST_READELF) -SW $< | grep ".zdebug_" > $@.tmp
1616 mv -f $@.tmp $@
1617
1618# Compare DWARF debug info.
1619flagstest_compress_debug_sections_gnu.cmp: flagstest_compress_debug_sections_gnu.stdout \
1620 flagstest_compress_debug_sections_none.stdout
1621 cmp flagstest_compress_debug_sections_gnu.stdout \
1622 flagstest_compress_debug_sections_none.stdout > $@.tmp
1623 mv -f $@.tmp $@
1624
1625check_PROGRAMS += flagstest_compress_debug_sections_gabi
1626check_DATA += flagstest_compress_debug_sections_gabi.stdout \
1627 flagstest_compress_debug_sections_gabi.cmp \
1628 flagstest_compress_debug_sections_gabi.check
0863441e
CC
1629MOSTLYCLEANFILES += flagstest_compress_debug_sections_gabi.cmp \
1630 flagstest_compress_debug_sections_gabi.check
fb8b9dbc
L
1631flagstest_compress_debug_sections_gabi: flagstest_debug.o gcctestdir/ld
1632 $(CXXLINK) -Bgcctestdir/ -o $@ $< -Wl,--compress-debug-sections=zlib-gabi
1633 test -s $@
1634
1635# Dump compressed DWARF debug sections.
1636flagstest_compress_debug_sections_gabi.stdout: flagstest_compress_debug_sections_gabi
1637 $(TEST_READELF) -w $< > $@.tmp
1638 mv -f $@.tmp $@
1639
1640# Check there are compressed DWARF .debug_* sections.
1641flagstest_compress_debug_sections_gabi.check: flagstest_compress_debug_sections_gabi
1642 $(TEST_READELF) -tW $< | grep "COMPRESSED" > $@.tmp
1643 mv -f $@.tmp $@
1644
1645# Compare DWARF debug info.
1646flagstest_compress_debug_sections_gabi.cmp: flagstest_compress_debug_sections_gabi.stdout \
1647 flagstest_compress_debug_sections_none.stdout
1648 cmp flagstest_compress_debug_sections_gabi.stdout \
1649 flagstest_compress_debug_sections_none.stdout > $@.tmp
1650 mv -f $@.tmp $@
1651
351a8000
ILT
1652# The specialfile output has a tricky case when we also compress debug
1653# sections, because it requires output-file resizing.
1654check_PROGRAMS += flagstest_o_specialfile_and_compress_debug_sections
0e470e5c
ILT
1655flagstest_o_specialfile_and_compress_debug_sections: flagstest_debug.o \
1656 gcctestdir/ld
126f3ece 1657 $(CXXLINK) -Bgcctestdir/ -o /dev/stdout $< -Wl,--compress-debug-sections=zlib 2>&1 | cat > $@
351a8000
ILT
1658 chmod a+x $@
1659 test -s $@
1660
f54f5e31
L
1661check_SCRIPTS += pr18689.sh
1662check_DATA += pr18689.stdout
1663MOSTLYCLEANFILES += pr18689a.o pr18689b.o
1664
1665pr18689.stdout: pr18689b.o
1666 $(TEST_READELF) -SW $< > $@
1667
1668pr18689a.o: pr18689.o ../ld-new
1669 ../ld-new -r -o $@ $<
1670
1671pr18689b.o: pr18689a.o ../ld-new
1672 ../ld-new -r -o $@ $<
1673
1674pr18689.o: pr18689.c gcctestdir/as
1675 $(COMPILE) -Bgcctestdir/ -ggdb3 -g -Wa,--compress-debug-sections=zlib-gabi -c -w -o $@ $(srcdir)/pr18689.c
1676
d12a5ea8
ILT
1677# Test -TText and -Tdata.
1678check_PROGRAMS += flagstest_o_ttext_1
1679flagstest_o_ttext_1: flagstest_debug.o gcctestdir/ld
1680 $(CXXLINK) -Bgcctestdir/ -o $@ $< -Wl,-Ttext,0x400000 -Wl,-Tdata,0x800000
1681
1682# This version won't be runnable, because there is no way to put the
1683# PT_PHDR segment at file offset 0. We just make sure that we can
1684# build it without error.
1685check_DATA += flagstest_o_ttext_2
0ec6429b 1686MOSTLYCLEANFILES += flagstest_o_ttext_2
d12a5ea8
ILT
1687flagstest_o_ttext_2: flagstest_debug.o gcctestdir/ld
1688 $(CXXLINK) -Bgcctestdir/ -o $@ $< -Wl,-Ttext,0x400010 -Wl,-Tdata,0x800010
1689
99f8faca
ILT
1690# Test symbol versioning.
1691check_PROGRAMS += ver_test
1692ver_test_SOURCES = ver_test_main.cc
1693ver_test_DEPENDENCIES = gcctestdir/ld ver_test_1.so ver_test_2.so ver_test_4.so
1694ver_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1695ver_test_LDADD = ver_test_1.so ver_test_2.so ver_test_4.so
1696ver_test_1.so: ver_test_1.o ver_test_2.so ver_test_3.o ver_test_4.so gcctestdir/ld
1697 $(CXXLINK) -Bgcctestdir/ -shared ver_test_1.o ver_test_2.so ver_test_3.o ver_test_4.so
09124467 1698ver_test_2.so: ver_test_2.o $(srcdir)/ver_test_2.script ver_test_4.so gcctestdir/ld
41d0ab5f 1699 $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_2.script -Wl,-R,. ver_test_2.o ver_test_4.so
09124467
ILT
1700ver_test_4.so: ver_test_4.o $(srcdir)/ver_test_4.script gcctestdir/ld
1701 $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_4.script ver_test_4.o
99f8faca
ILT
1702ver_test_1.o: ver_test_1.cc
1703 $(CXXCOMPILE) -c -fpic -o $@ $<
1704ver_test_2.o: ver_test_2.cc
1705 $(CXXCOMPILE) -c -fpic -o $@ $<
1706ver_test_3.o: ver_test_3.cc
1707 $(CXXCOMPILE) -c -fpic -o $@ $<
1708ver_test_4.o: ver_test_4.cc
1709 $(CXXCOMPILE) -c -fpic -o $@ $<
351a8000 1710
0602e05a
ILT
1711check_SCRIPTS += ver_test_1.sh
1712check_DATA += ver_test_1.syms
1713ver_test_1.syms: ver_test_1.so
1714 $(TEST_READELF) -s $< >$@ 2>/dev/null
1715
be3e6201
ILT
1716check_PROGRAMS += ver_test_2
1717ver_test_2_SOURCES = ver_test_main_2.cc
1718ver_test_2_DEPENDENCIES = gcctestdir/ld ver_test_4.so ver_test_2.so
1719ver_test_2_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1720ver_test_2_LDADD = ver_test_4.so ver_test_2.so
1721
be3e6201
ILT
1722check_SCRIPTS += ver_test_2.sh
1723check_DATA += ver_test_2.syms
1724ver_test_2.syms: ver_test_2
6835af53 1725 $(TEST_READELF) -s $< >$@ 2>/dev/null
be3e6201 1726
686c8caf
ILT
1727check_SCRIPTS += ver_test_4.sh
1728check_DATA += ver_test_4.syms
1729ver_test_4.syms: ver_test_4.so
6835af53 1730 $(TEST_READELF) -s $< >$@ 2>/dev/null
5871526f
ILT
1731
1732ver_test_5.so: ver_test_5.o $(srcdir)/ver_test_5.script ver_test_4.so gcctestdir/ld
1733 $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_5.script ver_test_5.o ver_test_4.so
1734ver_test_5.o: ver_test_5.cc
1735 $(CXXCOMPILE) -c -fpic -o $@ $<
1736check_SCRIPTS += ver_test_5.sh
1737check_DATA += ver_test_5.syms
1738ver_test_5.syms: ver_test_5.so
6835af53 1739 $(TEST_READELF) -s $< >$@ 2>/dev/null
5871526f 1740
18e6b24e
ILT
1741check_PROGRAMS += ver_test_6
1742ver_test_6_SOURCES = ver_test_6.c
1743ver_test_6_DEPENDENCIES = gcctestdir/ld ver_test_2.so
1744ver_test_6_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1745ver_test_6_LDADD = ver_test_2.so
1746
479f6503
ILT
1747ver_test_7.so: ver_test_4.o $(srcdir)/ver_test_4.script ver_test_7.o gcctestdir/ld
1748 $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_4.script ver_test_4.o ver_test_7.o
1749ver_test_7.o: ver_test_7.cc
1750 $(CXXCOMPILE) -c -fpic -o $@ $<
1751check_SCRIPTS += ver_test_7.sh
1752check_DATA += ver_test_7.syms
1753ver_test_7.syms: ver_test_7.so
6835af53 1754 $(TEST_READELF) -s $< >$@ 2>/dev/null
479f6503 1755
75517b77
ILT
1756check_PROGRAMS += ver_test_8
1757ver_test_8_SOURCES = two_file_test_main.cc
1758ver_test_8_DEPENDENCIES = gcctestdir/ld ver_test_8_1.so ver_test_8_2.so
1759ver_test_8_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1760ver_test_8_LDADD = ver_test_8_1.so ver_test_8_2.so
1761ver_test_8_1.so: two_file_test_1_pic.o two_file_test_1b_pic.o ver_test_8_2.so gcctestdir/ld
1762 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1_pic.o two_file_test_1b_pic.o ver_test_8_2.so
1763ver_test_8_2.so: two_file_test_2_pic.o $(srcdir)/ver_test_8.script gcctestdir/ld
1764 $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_8.script two_file_test_2_pic.o
1765
40d7d93f
CC
1766check_SCRIPTS += ver_test_8.sh
1767check_DATA += ver_test_8_2.so.syms
1768ver_test_8_2.so.syms: ver_test_8_2.so
1769 $(TEST_READELF) -s $< >$@ 2>/dev/null
1770
95d14cd3
ILT
1771check_PROGRAMS += ver_test_9
1772ver_test_9_SOURCES = ver_test_main.cc
1773ver_test_9_DEPENDENCIES = gcctestdir/ld ver_test_9.so
1774ver_test_9_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1775ver_test_9_LDADD = ver_test_9.so
1776ver_test_9.so: ver_test_9.o ver_test_4.so ver_test_5.so gcctestdir/ld
41d0ab5f 1777 $(CXXLINK) -Bgcctestdir/ -shared -Wl,-R,. ver_test_9.o ver_test_5.so ver_test_4.so
95d14cd3
ILT
1778ver_test_9.o: ver_test_9.cc
1779 $(CXXCOMPILE) -c -fpic -o $@ $<
1780
057ead22
ILT
1781check_SCRIPTS += ver_test_10.sh
1782check_DATA += ver_test_10.syms
1783ver_test_10.syms: ver_test_10.so
1784 $(TEST_READELF) -s $< >$@ 2>/dev/null
1785ver_test_10.so: gcctestdir/ld ver_test_2.o ver_test_10.script
1786 $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_10.script ver_test_2.o
1787
9c5b8369 1788check_PROGRAMS += ver_test_11
72fef11a 1789MOSTLYCLEANFILES += ver_test_11.a
9c5b8369
ILT
1790ver_test_11_SOURCES = ver_test_main_2.cc
1791ver_test_11_DEPENDENCIES = gcctestdir/ld ver_test_11.a
1792ver_test_11_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1793ver_test_11_LDADD = ver_test_11.a
1794ver_test_11.a: ver_test_1.o ver_test_2.o ver_test_4.o
1795 $(TEST_AR) rc $@ $^
1796
6d1c4efb
ILT
1797check_PROGRAMS += ver_test_12
1798ver_test_12_SOURCES = ver_test_main_2.cc
1799ver_test_12_DEPENDENCIES = gcctestdir/ld ver_test_12.o
1800ver_test_12_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1801ver_test_12_LDADD = ver_test_12.o
1802ver_test_12.o: gcctestdir/ld ver_test_1.o ver_test_2.o ver_test_4.o
1803 gcctestdir/ld -r -o $@ ver_test_1.o ver_test_2.o ver_test_4.o
1804
b45e00b3
CC
1805check_SCRIPTS += ver_test_13.sh
1806check_DATA += ver_test_13.syms
1807ver_test_13.syms: ver_test_13.so
1808 $(TEST_READELF) -s $< >$@ 2>/dev/null
1809ver_test_13.so: gcctestdir/ld ver_test_13.o ver_test_13.script
1810 $(LINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_13.script ver_test_13.o
1811ver_test_13.o: ver_test_13.c
1812 $(COMPILE) -c -fpic -o $@ $<
1813
8bdcdf2c
ILT
1814check_PROGRAMS += protected_1
1815protected_1_SOURCES = \
1816 protected_main_1.cc protected_main_2.cc protected_main_3.cc
1817protected_1_DEPENDENCIES = gcctestdir/ld protected_1.so
1818protected_1_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1819protected_1_LDADD = protected_1.so
1820
1821protected_1.so: gcctestdir/ld protected_1_pic.o protected_2_pic.o protected_3_pic.o
1822 $(CXXLINK) -Bgcctestdir/ -shared protected_1_pic.o protected_2_pic.o protected_3_pic.o
1823protected_1_pic.o: protected_1.cc
1824 $(CXXCOMPILE) -c -fpic -o $@ $<
1825protected_2_pic.o: protected_2.cc
1826 $(CXXCOMPILE) -c -fpic -o $@ $<
1827protected_3_pic.o: protected_3.cc
1828 $(CXXCOMPILE) -c -fpic -o $@ $<
1829
1830check_PROGRAMS += protected_2
1831protected_2_SOURCES = protected_main_1.cc protected_3.cc
1832protected_2_DEPENDENCIES = gcctestdir/ld protected_1.so
1833protected_2_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1834protected_2_LDADD = protected_1.so
1835
837504c4
ILT
1836check_DATA += protected_3.err
1837MOSTLYCLEANFILES += protected_3.err
1838protected_4_pic.o: protected_4.cc
1839 $(CXXCOMPILE) -c -fpic -o $@ $<
1840protected_3.err: protected_4_pic.o gcctestdir/ld
1841 @echo $(CXXLINK) -Bgcctestdir/ -shared -o protected_4.so protected_4_pic.o "2>$@"
1842 @if $(CXXLINK) -Bgcctestdir/ -shared -o protected_4.so protected_4_pic.o 2>$@; then \
1843 echo 1>&2 "Link of protected_4.so should have failed"; \
1844 rm -f $@; \
1845 exit 1; \
1846 fi
1847
9f1d377b 1848check_PROGRAMS += relro_test
fc497986
CC
1849check_SCRIPTS += relro_test.sh
1850check_DATA += relro_test.stdout
9f1d377b
ILT
1851relro_test_SOURCES = relro_test_main.cc
1852relro_test_DEPENDENCIES = gcctestdir/ld relro_test.so
1853relro_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1854relro_test_LDADD = relro_test.so
1855relro_test.so: gcctestdir/ld relro_test_pic.o
1856 $(CXXLINK) -Bgcctestdir/ -shared -Wl,-z,relro relro_test_pic.o
1857relro_test_pic.o: relro_test.cc
1858 $(CXXCOMPILE) -c -fpic -o $@ $<
fc497986
CC
1859relro_test.stdout: relro_test.so
1860 $(TEST_READELF) -SlW relro_test.so > relro_test.stdout
9f1d377b 1861
9446efde
ILT
1862check_PROGRAMS += relro_now_test
1863relro_now_test_SOURCES = relro_test_main.cc
1864relro_now_test_DEPENDENCIES = gcctestdir/ld relro_now_test.so
1865relro_now_test_LDFLAGS = -Bgcctestdir -Wl,-R,. -Wl,-z,relro -Wl,-z,now
1866relro_now_test_LDADD = relro_now_test.so
1867relro_now_test.so: gcctestdir/ld relro_test_pic.o
1868 $(CXXLINK) -Bgcctestdir/ -shared -Wl,-z,relro -Wl,-z,now relro_test_pic.o
1869
5f1ab67a
ILT
1870check_PROGRAMS += relro_strip_test
1871relro_strip_test_SOURCES = relro_test_main.cc
1872relro_strip_test_DEPENDENCIES = gcctestdir/ld relro_strip_test.so
1873relro_strip_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1874relro_strip_test_LDADD = relro_strip_test.so
1875relro_strip_test.so: relro_test.so
1876 $(TEST_STRIP) -o $@ $<
1877
2d924fd9
ILT
1878check_PROGRAMS += relro_script_test
1879relro_script_test_SOURCES = relro_test_main.cc
1880relro_script_test_DEPENDENCIES = gcctestdir/ld relro_script_test.so
1881relro_script_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1882relro_script_test_LDADD = relro_script_test.so
1883relro_script_test.so: gcctestdir/ld relro_script_test.t relro_test_pic.o
1496b446 1884 $(CXXLINK) -Bgcctestdir/ -shared -Wl,-z,relro -Wl,-T,$(srcdir)/relro_script_test.t relro_test_pic.o
2d924fd9 1885
e5756efb 1886check_PROGRAMS += script_test_1
5b2af7dd 1887script_test_1_SOURCES = script_test_1a.cc script_test_1b.cc
e5756efb 1888script_test_1_DEPENDENCIES = gcctestdir/ld script_test_1.t
1496b446 1889script_test_1_LDFLAGS = -Bgcctestdir/ -Wl,-R,. -Wl,-T,$(srcdir)/script_test_1.t
1abce4a6 1890script_test_1_LDADD =
e5756efb 1891
a445fddf
ILT
1892check_PROGRAMS += script_test_2
1893script_test_2_SOURCES = script_test_2.cc script_test_2a.cc script_test_2b.cc
1894script_test_2_DEPENDENCIES = gcctestdir/ld script_test_2.t
1496b446 1895script_test_2_LDFLAGS = -Bgcctestdir/ -Wl,-R,. -Wl,-T,$(srcdir)/script_test_2.t
1abce4a6 1896script_test_2_LDADD =
a445fddf 1897
88dd47ac
ILT
1898check_PROGRAMS += justsyms
1899justsyms_SOURCES = justsyms_1.cc
1900justsyms_DEPENDENCIES = gcctestdir/ld justsyms_2r.o
1901justsyms_LDFLAGS = -Bgcctestdir/ -Wl,-R,justsyms_2r.o
1abce4a6 1902justsyms_LDADD =
88dd47ac
ILT
1903justsyms_2.o: justsyms_2.cc
1904 $(CXXCOMPILE) -c -o $@ $<
83bfb6b7 1905justsyms_2r.o: justsyms_2.o gcctestdir/ld $(srcdir)/justsyms.t
52dc3f9c 1906 gcctestdir/ld -o $@ -r -T $(srcdir)/justsyms.t justsyms_2.o
88dd47ac 1907
c3f7b0e5
CC
1908check_PROGRAMS += justsyms_exec
1909justsyms_exec_SOURCES = justsyms_exec.c
1910justsyms_exec_DEPENDENCIES = gcctestdir/ld justsyms_lib
1911justsyms_exec_LDFLAGS = -Bgcctestdir/ -Wl,-R,justsyms_lib
1912justsyms_exec_LDADD =
0ec6429b 1913MOSTLYCLEANFILES += justsyms_lib
c3f7b0e5
CC
1914justsyms_lib.o: justsyms_lib.c
1915 $(COMPILE) -c -o $@ $<
1916justsyms_lib: justsyms_lib.o gcctestdir/ld
1917 gcctestdir/ld -o $@ -Ttext=0x1000200 -Tdata=0x2000000 -e exported_func justsyms_lib.o
1918
bc644c6c 1919check_PROGRAMS += binary_test
72fef11a 1920MOSTLYCLEANFILES += binary.txt
bc644c6c
ILT
1921binary_test_SOURCES = binary_test.cc
1922binary_test_DEPENDENCIES = gcctestdir/ld binary.txt
1923binary_test_LDFLAGS = -Bgcctestdir/ -Wl,--format,binary,binary.txt,--format,elf
1abce4a6 1924binary_test_LDADD =
bc644c6c
ILT
1925# Copy the file to the build directory to avoid worrying about the
1926# full pathname in the generated symbols.
1927binary.txt: $(srcdir)/binary.in
1928 rm -f $@
1929 $(LN_S) $< $@
1930
09124467
ILT
1931check_SCRIPTS += ver_matching_test.sh
1932check_DATA += ver_matching_test.stdout
1933MOSTLYCLEANFILES += ver_matching_test.stdout
2fbb4320
ILT
1934ver_matching_def.so: ver_matching_def_pic.o $(srcdir)/version_script.map gcctestdir/ld
1935 $(CXXLINK) -O0 -Bgcctestdir/ -shared ver_matching_def_pic.o -Wl,--version-script=$(srcdir)/version_script.map
1936ver_matching_def_pic.o: ver_matching_def.cc
1937 $(CXXCOMPILE) -O0 -c -fpic -o $@ $<
09124467 1938ver_matching_test.stdout: ver_matching_def.so
52dc3f9c 1939 $(TEST_OBJDUMP) -T ver_matching_def.so | $(TEST_CXXFILT) > ver_matching_test.stdout
1c4f3631
ILT
1940
1941check_PROGRAMS += script_test_3
1942check_SCRIPTS += script_test_3.sh
1943check_DATA += script_test_3.stdout
1944MOSTLYCLEANFILES += script_test_3.stdout
1945script_test_3: basic_test.o gcctestdir/ld script_test_3.t
1496b446 1946 $(CXXLINK) -Bgcctestdir/ basic_test.o -Wl,-T,$(srcdir)/script_test_3.t
1c4f3631 1947script_test_3.stdout: script_test_3
2cefc357 1948 $(TEST_READELF) -SlW script_test_3 > script_test_3.stdout
09124467 1949
4ebf39db
ILT
1950check_PROGRAMS += tls_phdrs_script_test
1951tls_phdrs_script_test_SOURCES = $(tls_test_SOURCES)
1952tls_phdrs_script_test_DEPENDENCIES = $(tls_test_DEPENDENCIES) $(srcdir)/script_test_3.t
1496b446 1953tls_phdrs_script_test_LDFLAGS = $(tls_test_LDFLAGS) -Wl,-T,$(srcdir)/script_test_3.t
4ebf39db
ILT
1954tls_phdrs_script_test_LDADD = $(tls_test_LDADD)
1955
e6188289
ILT
1956check_SCRIPTS += script_test_4.sh
1957check_DATA += script_test_4.stdout
72fef11a 1958MOSTLYCLEANFILES += script_test_4
e6188289 1959script_test_4: basic_test.o gcctestdir/ld $(srcdir)/script_test_4.t
1496b446 1960 $(CXXLINK) -Bgcctestdir/ basic_test.o -Wl,-T,$(srcdir)/script_test_4.t
e6188289
ILT
1961script_test_4.stdout: script_test_4
1962 $(TEST_READELF) -SlW script_test_4 > script_test_4.stdout
1963
6c93b22c
ILT
1964check_PROGRAMS += tls_script_test
1965tls_script_test_SOURCES = $(tls_test_SOURCES)
1966tls_script_test_DEPENDENCIES = $(tls_test_DEPENDENCIES) $(srcdir)/script_test_4.t
1496b446 1967tls_script_test_LDFLAGS = $(tls_test_LDFLAGS) -Wl,-T,$(srcdir)/script_test_4.t
6c93b22c
ILT
1968tls_script_test_LDADD = $(tls_test_LDADD)
1969
401a9a73
CC
1970check_SCRIPTS += script_test_5.sh
1971check_DATA += script_test_5.stdout
72fef11a 1972MOSTLYCLEANFILES += script_test_5
401a9a73 1973script_test_5: script_test_5.o gcctestdir/ld $(srcdir)/script_test_5.t
1496b446 1974 $(CXXLINK) -Bgcctestdir/ script_test_5.o -Wl,-T,$(srcdir)/script_test_5.t
401a9a73
CC
1975script_test_5.stdout: script_test_5
1976 $(TEST_READELF) -SW script_test_5 > script_test_5.stdout
1977
3c12dcdb
DK
1978check_SCRIPTS += script_test_6.sh
1979check_DATA += script_test_6.stdout
1980MOSTLYCLEANFILES += script_test_6
1981script_test_6: basic_test.o gcctestdir/ld $(srcdir)/script_test_6.t
1496b446 1982 $(CXXLINK) -Bgcctestdir/ basic_test.o -Wl,-T,$(srcdir)/script_test_6.t \
3c12dcdb
DK
1983 -Wl,-Ttext=0x10001000 -Wl,-Tdata=0x10200000 -Wl,-Tbss=0x10400000
1984script_test_6.stdout: script_test_6
1985 $(TEST_READELF) -SlW script_test_6 > script_test_6.stdout
1986
1987check_SCRIPTS += script_test_7.sh
1988check_DATA += script_test_7.stdout
1989MOSTLYCLEANFILES += script_test_7
1990script_test_7: basic_test.o gcctestdir/ld $(srcdir)/script_test_7.t
1496b446 1991 $(CXXLINK) -Bgcctestdir/ basic_test.o -Wl,-T,$(srcdir)/script_test_7.t
3c12dcdb
DK
1992script_test_7.stdout: script_test_7
1993 $(TEST_READELF) -SlW script_test_7 > script_test_7.stdout
1994
1995check_SCRIPTS += script_test_8.sh
1996check_DATA += script_test_8.stdout
1997MOSTLYCLEANFILES += script_test_8
1998script_test_8: basic_test.o gcctestdir/ld $(srcdir)/script_test_7.t
1496b446 1999 $(CXXLINK) -Bgcctestdir/ basic_test.o -Wl,-T,$(srcdir)/script_test_7.t \
3c12dcdb
DK
2000 -Wl,-Ttext=0x20001000 -Wl,-Tdata=0x20200000 -Wl,-Tbss=0x20400000
2001script_test_8.stdout: script_test_8
2002 $(TEST_READELF) -SlW script_test_8 > script_test_8.stdout
2003
d103a984
RÁE
2004check_SCRIPTS += script_test_9.sh
2005check_DATA += script_test_9.stdout
0ec6429b 2006MOSTLYCLEANFILES += script_test_9
d103a984
RÁE
2007script_test_9.o: script_test_9.cc
2008 $(CXXCOMPILE) -O0 -c -o $@ $<
2009script_test_9: gcctestdir/ld $(srcdir)/script_test_9.t script_test_9.o
1496b446 2010 $(CXXLINK) -Bgcctestdir/ script_test_9.o -Wl,-T,$(srcdir)/script_test_9.t
d103a984
RÁE
2011script_test_9.stdout: script_test_9
2012 $(TEST_READELF) -lW script_test_9 > script_test_9.stdout
2013
502e8a84
CC
2014# Test scripts with a relocatable link.
2015# The -g option is necessary to trigger a bug where a section
2016# declared in a script file is assigned a non-zero starting address.
2017check_PROGRAMS += script_test_11
2018script_test_11: gcctestdir/ld script_test_11_r.o
2019 $(LINK) -Bgcctestdir/ script_test_11_r.o
5b2af7dd
L
2020script_test_11_r.o: gcctestdir/ld $(srcdir)/script_test_11.t script_test_11a.o script_test_11b.o
2021 gcctestdir/ld -r -o $@ -T $(srcdir)/script_test_11.t script_test_11a.o script_test_11b.o
2022script_test_11a.o: script_test_11a.c
2023 $(COMPILE) -c -g -o $@ $<
2024script_test_11b.o: script_test_11b.c
502e8a84 2025 $(COMPILE) -c -g -o $@ $<
d103a984 2026
374082df
CC
2027# Test difference between "*(a b)" and "*(a) *(b)" in input section spec.
2028check_PROGRAMS += script_test_12
2029script_test_12: gcctestdir/ld $(srcdir)/script_test_12.t script_test_12a.o script_test_12b.o
2030 $(LINK) -Bgcctestdir/ -Wl,-T,$(srcdir)/script_test_12.t script_test_12a.o script_test_12b.o
2031
2032check_PROGRAMS += script_test_12i
2033script_test_12i: gcctestdir/ld $(srcdir)/script_test_12i.t script_test_12a.o script_test_12b.o
2034 $(LINK) -Bgcctestdir/ -Wl,-T,$(srcdir)/script_test_12i.t script_test_12a.o script_test_12b.o
a3a0c391
JY
2035script_test_12a.o: script_test_12a.c
2036 $(COMPILE) -O0 -c -o $@ $<
2037script_test_12b.o: script_test_12b.c
2038 $(COMPILE) -O0 -c -o $@ $<
374082df 2039
bfbf34de
CC
2040# Test for ordering internally created sections with a linker script.
2041check_SCRIPTS += script_test_13.sh
2042check_DATA += script_test_13.stdout
2043MOSTLYCLEANFILES += script_test_13
2044script_test_13.o: script_test_13.c
2045 $(COMPILE) -O0 -c -fPIC -o $@ $<
2046script_test_13: $(srcdir)/script_test_13.t script_test_13.o gcctestdir/ld
2047 gcctestdir/ld -shared -o $@ script_test_13.o -T $(srcdir)/script_test_13.t
2048script_test_13.stdout: script_test_13
2049 $(TEST_READELF) -SW script_test_13 > $@
2050
f224a3c5
IK
2051# Test for SORT_BY_INIT_PRIORITY.
2052check_SCRIPTS += script_test_14.sh
2053check_DATA += script_test_14.stdout
2054MOSTLYCLEANFILES += script_test_14
2055script_test_14.o: script_test_14.s
2056 $(TEST_AS) -o $@ $<
2057script_test_14: $(srcdir)/script_test_14.t script_test_14.o gcctestdir/ld
2058 gcctestdir/ld -o $@ script_test_14.o -T $(srcdir)/script_test_14.t
2059script_test_14.stdout: script_test_14
2060 $(TEST_OBJDUMP) -s script_test_14 > $@
2061
5d9f66cb
CC
2062# Test BSS section placement at end of segment.
2063check_SCRIPTS += script_test_15a.sh
2064check_DATA += script_test_15a.stdout
2065MOSTLYCLEANFILES += script_test_15a
2066script_test_15a: $(srcdir)/script_test_15a.t script_test_15.o gcctestdir/ld
2067 gcctestdir/ld -o $@ script_test_15.o -T $(srcdir)/script_test_15a.t
2068script_test_15a.stdout: script_test_15a
2069 $(TEST_READELF) -lSW script_test_15a > $@
2070
2071# Test BSS section placement in middle of segment.
2072check_SCRIPTS += script_test_15b.sh
2073check_DATA += script_test_15b.stdout
2074MOSTLYCLEANFILES += script_test_15b
2075script_test_15b: $(srcdir)/script_test_15b.t script_test_15.o gcctestdir/ld
2076 gcctestdir/ld -o $@ script_test_15.o -T $(srcdir)/script_test_15b.t
2077script_test_15b.stdout: script_test_15b
2078 $(TEST_READELF) -lSW script_test_15b > $@
2079
2080# Test orphan BSS section placement.
2081check_SCRIPTS += script_test_15c.sh
2082check_DATA += script_test_15c.stdout
2083MOSTLYCLEANFILES += script_test_15c
2084script_test_15c: $(srcdir)/script_test_15c.t script_test_15.o gcctestdir/ld
2085 gcctestdir/ld -o $@ script_test_15.o -T $(srcdir)/script_test_15c.t
2086script_test_15c.stdout: script_test_15c
2087 $(TEST_READELF) -lSW script_test_15c > $@
2088
c82fbeee
CS
2089# Test --dynamic-list, --dynamic-list-data, --dynamic-list-cpp-new,
2090# and --dynamic-list-cpp-typeinfo
2091
2092check_SCRIPTS += dynamic_list.sh
2093check_DATA += dynamic_list.stdout
72fef11a 2094MOSTLYCLEANFILES += dynamic_list dynamic_list.stdout
c82fbeee
CS
2095dynamic_list: basic_test.o gcctestdir/ld $(srcdir)/dynamic_list.t
2096 $(CXXLINK) -Bgcctestdir/ basic_test.o \
2097 -Wl,--dynamic-list $(srcdir)/dynamic_list.t \
2098 -Wl,--dynamic-list-data \
2099 -Wl,--dynamic-list-cpp-new \
2100 -Wl,--dynamic-list-cpp-typeinfo
2101dynamic_list.stdout: dynamic_list
94e6ee91 2102 $(TEST_READELF) -W --dyn-syms dynamic_list > dynamic_list.stdout
c82fbeee 2103
fd834e57
CC
2104check_PROGRAMS += dynamic_list_2
2105dynamic_list_2_SOURCES = dynamic_list_2.cc
2106dynamic_list_2_DEPENDENCIES = gcctestdir/ld dynamic_list_lib1.so dynamic_list_lib2.so
2107dynamic_list_2_LDFLAGS = -Bgcctestdir/ -L. -Wl,-R,. -Wl,--no-as-needed
2108dynamic_list_2_LDADD = dynamic_list_lib1.so dynamic_list_lib2.so
2109
2110dynamic_list_lib1.so: gcctestdir/ld dynamic_list_lib1.o
2111 $(CXXLINK) -Bgcctestdir/ -shared dynamic_list_lib1.o
2112dynamic_list_lib1.o: dynamic_list_lib1.cc
2113 $(CXXCOMPILE) -c -fpic -o $@ $<
2114
2115dynamic_list_lib2.so: gcctestdir/ld dynamic_list_lib2.o $(srcdir)/dynamic_list_2.t
e9c1bdad 2116 $(CXXLINK) -Bgcctestdir/ -shared -Wl,-Bsymbolic-functions -Wl,--dynamic-list,$(srcdir)/dynamic_list_2.t dynamic_list_lib2.o
fd834e57
CC
2117dynamic_list_lib2.o: dynamic_list_lib2.cc
2118 $(CXXCOMPILE) -c -fpic -o $@ $<
2119
fbd8a257 2120check_PROGRAMS += thin_archive_test_1
72fef11a
CC
2121MOSTLYCLEANFILES += libthin1.a libthin3.a libthinall.a \
2122 alt/thin_archive_test_2.o alt/thin_archive_test_4.o \
2123 alt/libthin2.a alt/libthin4.a
fbd8a257
CC
2124thin_archive_test_1_SOURCES = thin_archive_main.cc
2125thin_archive_test_1_DEPENDENCIES = gcctestdir/ld libthin1.a alt/libthin2.a
2126thin_archive_test_1_LDFLAGS = -Bgcctestdir/ -Lalt
2127thin_archive_test_1_LDADD = libthin1.a -lthin2
2128
2129check_PROGRAMS += thin_archive_test_2
2130thin_archive_test_2_SOURCES = thin_archive_main.cc
2131thin_archive_test_2_DEPENDENCIES = gcctestdir/ld libthinall.a
2132thin_archive_test_2_LDFLAGS = -Bgcctestdir/ -L.
2133thin_archive_test_2_LDADD = -lthinall
2134
2135libthin1.a: thin_archive_test_1.o alt/thin_archive_test_2.o
2136 rm -f $@
2137 $(TEST_AR) crT $@ $^
2138alt/libthin2.a: thin_archive_test_3.o alt/thin_archive_test_4.o
2139 rm -f $@
2140 $(TEST_AR) crT $@ $^
2141libthin3.a: thin_archive_test_1.o alt/thin_archive_test_4.o
2142 rm -f $@
2143 $(TEST_AR) crT $@ $^
2144alt/libthin4.a: alt/thin_archive_test_2.o thin_archive_test_3.o
2145 rm -f $@
2146 $(TEST_AR) crT $@ $^
2147libthinall.a: libthin3.a alt/libthin4.a
2148 rm -f $@
2149 $(TEST_AR) crT $@ $^
2150alt/thin_archive_test_2.o: thin_archive_test_2.cc
2151 test -d alt || mkdir -p alt
2152 $(CXXCOMPILE) -c -o $@ $<
2153alt/thin_archive_test_4.o: thin_archive_test_4.cc
2154 test -d alt || mkdir -p alt
2155 $(CXXCOMPILE) -c -o $@ $<
2156
89fc3421
CC
2157if PLUGINS
2158
2159check_PROGRAMS += plugin_test_1
2160check_SCRIPTS += plugin_test_1.sh
2161check_DATA += plugin_test_1.err
2162MOSTLYCLEANFILES += plugin_test_1.err
2cfbf2fe
CC
2163plugin_test_1: two_file_test_main.o two_file_test_1.o.syms two_file_test_1b.o.syms two_file_test_2.o.syms empty.o.syms gcctestdir/ld plugin_test.so
2164 $(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle,--plugin,"./plugin_test.so",--plugin-opt,"_Z4f13iv" two_file_test_main.o two_file_test_1.o.syms two_file_test_1b.o.syms two_file_test_2.o.syms empty.o.syms 2>plugin_test_1.err
89fc3421
CC
2165plugin_test_1.err: plugin_test_1
2166 @touch plugin_test_1.err
2167
2168check_PROGRAMS += plugin_test_2
2169check_SCRIPTS += plugin_test_2.sh
2170check_DATA += plugin_test_2.err
2171MOSTLYCLEANFILES += plugin_test_2.err
2cfbf2fe
CC
2172plugin_test_2: two_file_test_main.o two_file_test_1.o.syms two_file_test_1b.o.syms two_file_shared_2.so gcctestdir/ld plugin_test.so
2173 $(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle,-R,.,--plugin,"./plugin_test.so" two_file_test_main.o two_file_test_1.o.syms two_file_test_1b.o.syms two_file_shared_2.so 2>plugin_test_2.err
89fc3421
CC
2174plugin_test_2.err: plugin_test_2
2175 @touch plugin_test_2.err
2176
d66a9eb3
CC
2177check_PROGRAMS += plugin_test_3
2178check_SCRIPTS += plugin_test_3.sh
2179check_DATA += plugin_test_3.err
2180MOSTLYCLEANFILES += plugin_test_3.err
2cfbf2fe
CC
2181plugin_test_3: two_file_test_main.o two_file_test_1.o.syms two_file_test_1b.o.syms two_file_test_2.o.syms empty.o.syms gcctestdir/ld plugin_test.so
2182 $(CXXLINK) -Bgcctestdir/ -Wl,--export-dynamic -Wl,--no-demangle,--plugin,"./plugin_test.so",--plugin-opt,"_Z4f13iv" two_file_test_main.o two_file_test_1.o.syms two_file_test_1b.o.syms two_file_test_2.o.syms empty.o.syms 2>plugin_test_3.err
d66a9eb3
CC
2183plugin_test_3.err: plugin_test_3
2184 @touch plugin_test_3.err
2185
0f7c0701
CC
2186check_PROGRAMS += plugin_test_4
2187check_SCRIPTS += plugin_test_4.sh
2188check_DATA += plugin_test_4.err
72fef11a 2189MOSTLYCLEANFILES += plugin_test_4.a plugin_test_4.err
0f7c0701
CC
2190plugin_test_4: two_file_test_main.o plugin_test_4.a gcctestdir/ld plugin_test.so
2191 $(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
2192plugin_test_4.err: plugin_test_4
2193 @touch plugin_test_4.err
2194
2cfbf2fe 2195plugin_test_4.a: two_file_test_1.o.syms two_file_test_1b.o.syms two_file_test_2.o.syms
0f7c0701
CC
2196 $(TEST_AR) cr $@ $^
2197
24998053 2198check_PROGRAMS += plugin_test_5
2cfbf2fe
CC
2199plugin_test_5: two_file_test_main.o two_file_test_1.o.syms two_file_test_1b.o.syms two_file_test_2.o.syms unused.o.syms gcctestdir/ld plugin_test.so
2200 $(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle,--plugin,"./plugin_test.so",--plugin-opt,"_Z4f13iv",--gc-sections two_file_test_main.o two_file_test_1.o.syms two_file_test_1b.o.syms two_file_test_2.o.syms unused.o.syms
24998053 2201
be234d88
CC
2202check_PROGRAMS += plugin_test_6
2203check_SCRIPTS += plugin_test_6.sh
2204check_DATA += plugin_test_6.err
2205MOSTLYCLEANFILES += plugin_test_6.err
2cfbf2fe
CC
2206plugin_test_6: plugin_common_test_1.o.syms plugin_common_test_2.o.syms gcctestdir/ld plugin_test.so
2207 $(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle,--plugin,"./plugin_test.so" plugin_common_test_1.o.syms plugin_common_test_2.o.syms 2>plugin_test_6.err
be234d88
CC
2208plugin_test_6.err: plugin_test_6
2209 @touch plugin_test_6.err
2210
5e0f337e
RÁE
2211check_PROGRAMS += plugin_test_7
2212check_SCRIPTS += plugin_test_7.sh
2cfbf2fe 2213check_DATA += plugin_test_7.err plugin_test_7.o.syms
5e0f337e 2214MOSTLYCLEANFILES += plugin_test_7.err
2cfbf2fe
CC
2215plugin_test_7: plugin_test_7_1.o plugin_test_7_1.o.syms plugin_test_7_2.o gcctestdir/ld plugin_test.so
2216 $(LINK) -Bgcctestdir/ -Wl,--no-demangle,--plugin,"./plugin_test.so",--gc-sections,--print-gc-sections plugin_test_7_1.o.syms plugin_test_7_2.o 2>plugin_test_7.err
2217plugin_test_7.o.syms: plugin_test_7
5e0f337e
RÁE
2218 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2219plugin_test_7_1.o: plugin_test_7_1.c
2220 $(COMPILE) -DLTO -O0 -c -ffunction-sections -fdata-sections -o $@ $<
2221plugin_test_7_1_orig.o: plugin_test_7_1.c
2222 $(COMPILE) -O0 -c -ffunction-sections -fdata-sections -o $@ $<
2cfbf2fe 2223plugin_test_7_1.o.syms: plugin_test_7_1_orig.o
5e0f337e
RÁE
2224 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2225plugin_test_7_2.o: plugin_test_7_2.c
2226 $(COMPILE) -O0 -c -ffunction-sections -fdata-sections -o $@ $<
2227plugin_test_7.err: plugin_test_7
2228
f3a2388f
CC
2229# Test plugins with -r.
2230check_PROGRAMS += plugin_test_8
2cfbf2fe
CC
2231plugin_test_8.o: two_file_test_main.o two_file_test_1.o.syms two_file_test_1b.o.syms two_file_test_2.o ../ld-new plugin_test.so
2232 ../ld-new -r -o $@ --no-demangle --plugin "./plugin_test.so" two_file_test_main.o two_file_test_1.o.syms two_file_test_1b.o.syms two_file_test_2.o
f3a2388f
CC
2233plugin_test_8: plugin_test_8.o gcctestdir/ld
2234 $(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle plugin_test_8.o
2235
2236# Test that symbols known in the IR file but not in the replacement file
2237# produce an unresolved symbol error.
2238check_DATA += plugin_test_9.err
2239MOSTLYCLEANFILES += plugin_test_9.err
2cfbf2fe
CC
2240plugin_test_9.err: two_file_test_main.o two_file_test_1c.o.syms two_file_test_2.o.syms gcctestdir/ld plugin_test.so
2241 @echo $(CXXLINK) -Bgcctestdir/ -o plugin_test_9 -Wl,--no-demangle,--plugin,"./plugin_test.so" two_file_test_main.o two_file_test_1c.o.syms two_file_test_2.o.syms "2>$@"
2242 @if $(CXXLINK) -Bgcctestdir/ -o plugin_test_9 -Wl,--no-demangle,--plugin,"./plugin_test.so" two_file_test_main.o two_file_test_1c.o.syms two_file_test_2.o.syms 2>$@; then \
f3a2388f
CC
2243 echo 1>&2 "Link of plugin_test_9 should have failed"; \
2244 rm -f $@; \
2245 exit 1; \
2246 fi
2247# Make a .syms file that claims to define the symbol _Z4t16av.
2cfbf2fe
CC
2248two_file_test_1c.o.syms: two_file_test_1.o.syms two_file_test_1c.o
2249 cp two_file_test_1.o.syms $@.tmp
2250 grep "_Z4t16av" two_file_test_1b.o.syms >> $@.tmp
f3a2388f
CC
2251 mv -f $@.tmp $@
2252# Make a copy of two_file_test_1.o, which does not define the symbol _Z4t16av.
2253MOSTLYCLEANFILES += two_file_test_1c.o
2254two_file_test_1c.o: two_file_test_1.o
2255 cp two_file_test_1.o $@
2256
648c5cbb
CC
2257# As above, but check COMDAT case, where a non-IR file contains a duplicate
2258# of a COMDAT group in an IR file.
2259check_DATA += plugin_test_9b.err
2260MOSTLYCLEANFILES += plugin_test_9b.err
2261plugin_test_9b.err: plugin_test_9b_ir.o.syms plugin_test_9b_ir.o plugin_test_9b_elf.o gcctestdir/ld plugin_test.so
2262 @echo $(CXXLINK) -Bgcctestdir/ -o plugin_test_9b -Wl,--no-demangle,--plugin,"./plugin_test.so",--plugin-opt,"_ZN1A5printEv" plugin_test_9b_ir.o plugin_test_9b_elf.o "2>$@"
2263 @if $(CXXLINK) -Bgcctestdir/ -o plugin_test_9b -Wl,--no-demangle,--plugin,"./plugin_test.so",--plugin-opt,"_ZN1A5printEv" plugin_test_9b_ir.o plugin_test_9b_elf.o 2>$@; then \
2264 echo 1>&2 "Link of plugin_test_9b should have failed"; \
2265 rm -f $@; \
2266 exit 1; \
2267 fi
2268# Make a .syms file that claims to define a method in class A in a COMDAT group.
2269# The real plugin_test_9b_ir.o will be compiled without the -D, and will not
2270# define any methods in class A.
2271plugin_test_9b_ir.o.syms: plugin_test_9b_ir_witha.o
2272 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2273plugin_test_9b_ir_witha.o: plugin_test_9b_ir.cc
2274 $(CXXCOMPILE) -c -DUSE_CLASS_A -o $@ $<
2275
c0c71592
RÁE
2276check_PROGRAMS += plugin_test_10
2277check_SCRIPTS += plugin_test_10.sh
2278check_DATA += plugin_test_10.sections
2279MOSTLYCLEANFILES += plugin_test_10.sections
2cfbf2fe
CC
2280plugin_test_10: plugin_common_test_1.o.syms plugin_common_test_2.o gcctestdir/ld plugin_test.so
2281 $(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle,--plugin,"./plugin_test.so" plugin_common_test_1.o.syms plugin_common_test_2.o
c0c71592
RÁE
2282plugin_test_10.sections: plugin_test_10
2283 $(TEST_READELF) -SW $< >$@ 2>/dev/null
2284
2cfbf2fe
CC
2285check_PROGRAMS += plugin_test_11
2286check_SCRIPTS += plugin_test_11.sh
2287check_DATA += plugin_test_11.err
dddcc5b9 2288MOSTLYCLEANFILES += plugin_test_11.err plugin_test_thin.a
2cfbf2fe
CC
2289PLUGIN_TEST_11_SYMS = two_file_test_1.o.syms two_file_test_1b.o.syms two_file_test_2.o.syms
2290plugin_test_11: two_file_test_main.o plugin_test_thin.a gcctestdir/ld plugin_test.so $(PLUGIN_TEST_11_SYMS)
2291 $(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle,--plugin,"./plugin_test.so",--plugin-opt,"_Z4f13iv" two_file_test_main.o plugin_test_thin.a 2>plugin_test_11.err
2292plugin_test_11.err: plugin_test_11
2293 @touch plugin_test_11.err
2294plugin_test_thin.a: two_file_test_1.o two_file_test_1b.o two_file_test_2.o
2295 rm -f $@
2296 $(TEST_AR) crT $@ $^
c0c71592 2297
ca464aac
TJ
2298check_PROGRAMS += plugin_test_12
2299check_SCRIPTS += plugin_test_12.sh
2300check_DATA += plugin_test_12.err
2301MOSTLYCLEANFILES += plugin_test_12.err
2302export_dynamic_plugin.o.syms: export_dynamic_plugin.o
2303 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2304export_dynamic_plugin.o: export_dynamic_plugin.cc
2305 $(COMPILE) -c -o $@ $<
2306plugin_test_12: export_dynamic_plugin.o gcctestdir/ld plugin_test.so export_dynamic_plugin.o.syms
2307 $(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle,--plugin,"./plugin_test.so",--plugin-opt,"_Z3foov" -Wl,--export-dynamic-symbol,"_Z3foov" export_dynamic_plugin.o.syms 2>plugin_test_12.err
2308plugin_test_12.err: plugin_test_12
2309 @touch plugin_test_12.err
95ecdfbf
ES
2310
2311check_PROGRAMS += plugin_test_start_lib
2312check_SCRIPTS += plugin_test_start_lib.sh
2313check_DATA += plugin_test_start_lib.err
2314MOSTLYCLEANFILES += plugin_test_start_lib.err
2315plugin_test_start_lib: unused.o plugin_start_lib_test.o plugin_start_lib_test_2.syms gcctestdir/ld plugin_test.so
2316 $(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle,--plugin,"./plugin_test.so" plugin_start_lib_test.o \
2317 -Wl,--start-lib plugin_start_lib_test_2.syms -Wl,--end-lib 2>plugin_test_start_lib.err
2318plugin_test_start_lib.err: plugin_test_start_lib
2319 @touch plugin_test_start_lib.err
2320
2321
2322plugin_start_lib_test_2.syms: plugin_start_lib_test_2.o
2323 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2324
2325
78d9f182 2326plugin_test.so: plugin_test.o gcctestdir/ld
89fc3421
CC
2327 $(LINK) -Bgcctestdir/ -shared plugin_test.o
2328plugin_test.o: plugin_test.c
2329 $(COMPILE) -O0 -c -fpic -o $@ $<
2330
2cfbf2fe 2331two_file_test_main.o.syms: two_file_test_main.o
89fc3421 2332 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2cfbf2fe 2333two_file_test_1.o.syms: two_file_test_1.o
89fc3421 2334 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2cfbf2fe 2335two_file_test_1b.o.syms: two_file_test_1b.o
89fc3421 2336 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2cfbf2fe 2337two_file_test_2.o.syms: two_file_test_2.o
89fc3421 2338 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2cfbf2fe 2339plugin_common_test_1.o.syms: plugin_common_test_1.o
be234d88 2340 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2cfbf2fe 2341plugin_common_test_2.o.syms: plugin_common_test_2.o
be234d88 2342 $(TEST_READELF) -sW $< >$@ 2>/dev/null
24998053 2343
2cfbf2fe 2344empty.o.syms:
24998053
CC
2345 @echo "" >$@
2346 @echo "Symbol table" >>$@
2347
32364e50
CC
2348if TLS
2349
2350check_PROGRAMS += plugin_test_tls
2351check_SCRIPTS += plugin_test_tls.sh
2352check_DATA += plugin_test_tls.err
2353MOSTLYCLEANFILES += plugin_test_tls.err
2cfbf2fe
CC
2354plugin_test_tls: two_file_test_tls.o two_file_test_1.o.syms two_file_test_1b.o.syms two_file_test_2_tls.o.syms gcctestdir/ld plugin_test.so
2355 $(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle,--plugin,"./plugin_test.so",--plugin-opt,"_Z4f13iv" two_file_test_tls.o two_file_test_1.o.syms two_file_test_1b.o.syms two_file_test_2_tls.o.syms 2>plugin_test_tls.err
32364e50
CC
2356plugin_test_tls.err: plugin_test_tls
2357 @touch plugin_test_tls.err
2358
2cfbf2fe 2359two_file_test_2_tls.o.syms: two_file_test_2_tls.o
32364e50
CC
2360 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2361
2362endif TLS
2363
24998053 2364MOSTLYCLEANFILES += unused.c
2cfbf2fe 2365unused.o.syms: unused.o
24998053
CC
2366 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2367 @echo " 1: 00000000 4 FUNC GLOBAL DEFAULT 1 UNUSED" >>$@
2368unused.o: unused.c
2369 $(COMPILE) -c -o $@ $<
2370unused.c:
2371 @cp /dev/null $@
89fc3421 2372
f0558624 2373check_SCRIPTS += plugin_final_layout.sh
16164a6b 2374check_DATA += plugin_final_layout.stdout plugin_final_layout_readelf.stdout
0ec6429b 2375MOSTLYCLEANFILES += plugin_final_layout
f0558624
ST
2376plugin_final_layout.o: plugin_final_layout.cc
2377 $(CXXCOMPILE) -O0 -c -ffunction-sections -fdata-sections -g -o $@ $<
2378plugin_final_layout: plugin_final_layout.o plugin_section_order.so gcctestdir/ld
2379 $(CXXLINK) -Bgcctestdir/ -Wl,--plugin,"./plugin_section_order.so" plugin_final_layout.o
2380plugin_final_layout.stdout: plugin_final_layout
864a1b56 2381 $(TEST_NM) -n --synthetic plugin_final_layout > plugin_final_layout.stdout
16164a6b
ST
2382plugin_final_layout_readelf.stdout: plugin_final_layout
2383 $(TEST_READELF) -Wl plugin_final_layout > plugin_final_layout_readelf.stdout
f0558624 2384
78d9f182 2385plugin_section_order.so: plugin_section_order.o gcctestdir/ld
f0558624
ST
2386 $(LINK) -Bgcctestdir/ -shared plugin_section_order.o
2387plugin_section_order.o: plugin_section_order.c
2388 $(COMPILE) -O0 -c -fpic -o $@ $<
2389
82838bd6
CC
2390check_SCRIPTS += plugin_layout_with_alignment.sh
2391check_DATA += plugin_layout_with_alignment.stdout
2392MOSTLYCLEANFILES += plugin_layout_with_alignment
fd91f002
L
2393plugin_layout_with_alignment.o: plugin_layout_with_alignment.c
2394 $(COMPILE) -O0 -c -ffunction-sections -fdata-sections -g -o $@ $<
82838bd6 2395plugin_layout_with_alignment: plugin_layout_with_alignment.o plugin_section_alignment.so gcctestdir/ld
fd91f002 2396 $(LINK) -Bgcctestdir/ -Wl,--plugin,"./plugin_section_alignment.so" plugin_layout_with_alignment.o
82838bd6
CC
2397plugin_layout_with_alignment.stdout: plugin_layout_with_alignment
2398 $(TEST_NM) -n --synthetic plugin_layout_with_alignment > plugin_layout_with_alignment.stdout
2399
78d9f182 2400plugin_section_alignment.so: plugin_section_alignment.o gcctestdir/ld
82838bd6
CC
2401 $(CXXLINK) -Bgcctestdir/ -shared plugin_section_alignment.o
2402plugin_section_alignment.o: plugin_section_alignment.cc
2403 $(CXXCOMPILE) -O0 -c -fpic -o $@ $<
2404
89fc3421
CC
2405endif PLUGINS
2406
65514900
CC
2407check_PROGRAMS += exclude_libs_test
2408check_SCRIPTS += exclude_libs_test.sh
2409check_DATA += exclude_libs_test.syms
2410MOSTLYCLEANFILES += exclude_libs_test.syms libexclude_libs_test_1.a \
2fdd743f 2411 libexclude_libs_test_2.a alt/libexclude_libs_test_3.a
65514900
CC
2412exclude_libs_test_SOURCES = exclude_libs_test.c
2413exclude_libs_test_DEPENDENCIES = gcctestdir/ld libexclude_libs_test_1.a \
2fdd743f
DK
2414 libexclude_libs_test_2.a alt/libexclude_libs_test_3.a
2415exclude_libs_test_LDFLAGS = -Bgcctestdir/ -L. -Lalt \
2416 -Wl,--exclude-libs,dummy:libexclude_libs_test_1 \
2417 -Wl,--exclude-libs,libexclude_libs_test_3
2418exclude_libs_test_LDADD = -lexclude_libs_test_1 -lexclude_libs_test_2 \
2419 alt/libexclude_libs_test_3.a
65514900
CC
2420exclude_libs_test.syms: exclude_libs_test
2421 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2422libexclude_libs_test_1.a: exclude_libs_test_1.o
2423 $(TEST_AR) rc $@ $^
2424libexclude_libs_test_2.a: exclude_libs_test_2.o
2425 $(TEST_AR) rc $@ $^
2fdd743f
DK
2426alt/libexclude_libs_test_3.a: exclude_libs_test_3.o
2427 test -d alt || mkdir -p alt
2428 $(TEST_AR) rc $@ $^
65514900 2429
805bb01c
DK
2430check_PROGRAMS += local_labels_test
2431local_labels_test.o: ver_test_6.c
2432 $(COMPILE) -g -c -Wa,-L -o $@ $<
78d9f182 2433local_labels_test: local_labels_test.o gcctestdir/ld
805bb01c
DK
2434 $(LINK) -Bgcctestdir/ local_labels_test.o
2435
bb04269c
DK
2436check_PROGRAMS += discard_locals_test
2437check_SCRIPTS += discard_locals_test.sh
d3bbad62
ILT
2438check_DATA += discard_locals_test.syms \
2439 discard_locals_relocatable_test1.syms \
2440 discard_locals_relocatable_test2.syms
2441MOSTLYCLEANFILES += discard_locals_test.syms \
2442 discard_locals_relocatable_test1.syms \
2443 discard_locals_relocatable_test2.syms \
2444 discard_locals_relocatable_test1.out \
2445 discard_locals_relocatable_test2.out
bb04269c
DK
2446discard_locals_test_SOURCES = discard_locals_test.c
2447discard_locals_test_LDFLAGS = -Bgcctestdir/ -Wl,--discard-locals
2448discard_locals_test.syms: discard_locals_test
2449 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2450# '-Wa,-L' is required to preserve the local label used for testing.
2451discard_locals_test.o: discard_locals_test.c
2452 $(COMPILE) -c -Wa,-L -o $@ $<
2453
d3bbad62
ILT
2454discard_locals_relocatable_test1.syms: discard_locals_relocatable_test1.out
2455 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2456discard_locals_relocatable_test.o: discard_locals_relocatable_test.c
2457 $(COMPILE) -c -Wa,-L -fPIC -o $@ $<
2458discard_locals_relocatable_test1.out: discard_locals_relocatable_test.o ../ld-new
2459 ../ld-new --discard-locals -relocatable -o $@ $<
2460
2461discard_locals_relocatable_test2.syms: discard_locals_relocatable_test2.out
2462 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2463discard_locals_relocatable_test2.out: discard_locals_relocatable_test.o ../ld-new
2464 ../ld-new --discard-all -relocatable -o $@ $<
2465
8a5e3e08
ILT
2466if MCMODEL_MEDIUM
2467check_PROGRAMS += large
2468large_SOURCES = large.c
2469large_CFLAGS = -mcmodel=medium
2470large_DEPENDENCIES = gcctestdir/ld
2471large_LDFLAGS = -Bgcctestdir/
1abce4a6 2472large_LDADD =
8a5e3e08
ILT
2473endif MCMODEL_MEDIUM
2474
645afe0c
CC
2475# Test that hidden and internal symbols in the main program cannot be
2476# referenced by a shared library.
2477check_SCRIPTS += hidden_test.sh
2478check_DATA += hidden_test.err
c20ceeb2 2479MOSTLYCLEANFILES += hidden_test hidden_test.err hidden_test.syms
645afe0c
CC
2480libhidden.so: hidden_test_1.c gcctestdir/ld
2481 $(COMPILE) -Bgcctestdir/ -g -shared -fPIC -w -o $@ $(srcdir)/hidden_test_1.c
2482hidden_test: hidden_test_main.o libhidden.so gcctestdir/ld
2483 $(LINK) -Bgcctestdir/ -Wl,-R,. hidden_test_main.o libhidden.so 2>hidden_test.err
c20ceeb2
YW
2484hidden_test.syms: hidden_test
2485 $(TEST_NM) -D hidden_test > $@
645afe0c
CC
2486hidden_test.err: hidden_test
2487 @touch hidden_test.err
2488
8c604651
CS
2489# Test -retain-symbols-file.
2490check_SCRIPTS += retain_symbols_file_test.sh
2491check_DATA += retain_symbols_file_test.stdout
2492MOSTLYCLEANFILES += retain_symbols_file_test retain_symbols_file_test.in \
2493 retain_symbols_file_test.stdout
2494retain_symbols_file_test.so: basic_pic_test.o gcctestdir/ld
2495 echo 'main' > retain_symbols_file_test.in
2496 echo 't1' >> retain_symbols_file_test.in
8c604651
CS
2497 echo '_ZNK4t20a3getEv' >> retain_symbols_file_test.in
2498 echo '_Z3t18v' >> retain_symbols_file_test.in
2b64b551 2499 echo '__tcf_0' >> retain_symbols_file_test.in
8c604651
CS
2500 $(CXXLINK) -Bgcctestdir/ -shared -Wl,-retain-symbols-file,retain_symbols_file_test.in basic_pic_test.o
2501retain_symbols_file_test.stdout: retain_symbols_file_test.so
2502 $(TEST_NM) -C retain_symbols_file_test.so > $@
2503
2504
6a89f575
CC
2505# Test that if the output file already exists and is empty,
2506# it will get execute permission.
2507check_PROGRAMS += permission_test
2508permission_test: basic_test.o gcctestdir/ld
2509 umask 022; \
2510 rm -f $@; \
2511 touch $@; \
2512 chmod 600 $@; \
2513 $(CXXLINK) -Bgcctestdir/ basic_test.o
2514
ae3b5189
CD
2515# Check -l:foo.a
2516check_PROGRAMS += searched_file_test
2517MOSTLYCLEANFILES += searched_file_test searched_file_test_lib.o \
2518 alt/searched_file_test_lib.a
2519searched_file_test_SOURCES = searched_file_test.cc
78d9f182 2520searched_file_test_DEPENDENCIES = gcctestdir/ld alt/searched_file_test_lib.a
ae3b5189
CD
2521searched_file_test_LDFLAGS = -Bgcctestdir/ -Lalt
2522searched_file_test_LDADD = -l:searched_file_test_lib.a
2523searched_file_test_lib.o: searched_file_test_lib.cc
2524 $(CXXCOMPILE) -c -o $@ $<
2525alt/searched_file_test_lib.a: searched_file_test_lib.o
2526 test -d alt || mkdir -p alt
2527 $(TEST_AR) rc $@ $^
2528
2b64b551 2529# Test that no .gnu.version sections are created when
c5617f2f
DK
2530# symbol versioning is not used.
2531check_SCRIPTS += no_version_test.sh
2532check_DATA += no_version_test.stdout
2533MOSTLYCLEANFILES += libno_version_test.so no_version_test.stdout
2534# We invoke the linker directly since gcc may include additional objects that
2535# uses symbol versioning.
2536libno_version_test.so: no_version_test.o gcctestdir/ld
2537 gcctestdir/ld -shared -o $@ no_version_test.o
2538no_version_test.o: no_version_test.c
2539 $(COMPILE) -o $@ -c -fPIC $<
2540no_version_test.stdout: libno_version_test.so
2541 $(TEST_OBJDUMP) -h $< > $@
2542
7223e9ca
ILT
2543# Test STT_GNU_IFUNC symbols.
2544if IFUNC
2545
2546ifuncmod1.o: ifuncmod1.c
661d7a80 2547 $(COMPILE) -c -fPIC -o $@ $<
7223e9ca
ILT
2548ifuncmod1.so: ifuncmod1.o gcctestdir/ld
2549 $(LINK) -Bgcctestdir/ -shared ifuncmod1.o
2550
2551ifuncdep1.o: ifuncmod1.c
2552 $(COMPILE) -c -o $@ $<
2553
2554ifuncmain1pic.o: ifuncmain1.c
661d7a80 2555 $(COMPILE) -c -fPIC -o $@ $<
7223e9ca 2556ifuncmain1pie.o: ifuncmain1.c
661d7a80 2557 $(COMPILE) -c -fPIE -o $@ $<
7223e9ca 2558
328c7c2f 2559if HAVE_STATIC
ebb300b2 2560if IFUNC_STATIC
7223e9ca
ILT
2561check_PROGRAMS += ifuncmain1static
2562ifuncmain1static_SOURCES = ifuncmain1.c
2563ifuncmain1static_DEPENDENCIES = gcctestdir/ld ifuncdep1.o
2564ifuncmain1static_LDFLAGS = -Bgcctestdir/ -static
2565ifuncmain1static_LDADD = ifuncdep1.o
2566
2567check_PROGRAMS += ifuncmain1picstatic
2568ifuncmain1picstatic: ifuncmain1pic.o ifuncmod1.o gcctestdir/ld
2569 $(LINK) -Bgcctestdir/ -static ifuncmain1pic.o ifuncmod1.o
c4d5a762
CC
2570
2571check_SCRIPTS += ifuncmod1.sh
2572check_DATA += ifuncmod1.so.stderr
2573ifuncmod1.so.stderr: ifuncmod1.so
2574 $(TEST_READELF) -s $< > /dev/null 2> $@
328c7c2f 2575endif
ebb300b2 2576endif
7223e9ca
ILT
2577
2578check_PROGRAMS += ifuncmain1
2579ifuncmain1_SOURCES = ifuncmain1.c
2580ifuncmain1_DEPENDENCIES = gcctestdir/ld ifuncmod1.so
2581ifuncmain1_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
2582ifuncmain1_LDADD = ifuncmod1.so
2583
2584check_PROGRAMS += ifuncmain1pic
2585ifuncmain1pic: ifuncmain1pic.o ifuncmod1.so gcctestdir/ld
2586 $(LINK) -Bgcctestdir/ ifuncmain1pic.o ifuncmod1.so -Wl,-R,.
2587
2588check_PROGRAMS += ifuncmain1vis
2589ifuncmain1vis_SOURCES = ifuncmain1vis.c
2590ifuncmain1vis_DEPENDENCIES = gcctestdir/ld ifuncmod1.so
2591ifuncmain1vis_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
2592ifuncmain1vis_LDADD = ifuncmod1.so
2593
2594check_PROGRAMS += ifuncmain1vispic
2595ifuncmain1vispic.o: ifuncmain1vis.c
661d7a80 2596 $(COMPILE) -c -fPIC -o $@ $<
7223e9ca
ILT
2597ifuncmain1vispic: ifuncmain1vispic.o ifuncmod1.so gcctestdir/ld
2598 $(LINK) -Bgcctestdir/ ifuncmain1pic.o ifuncmod1.so -Wl,-R,.
2599
2600check_PROGRAMS += ifuncmain1staticpic
2601ifuncmain1staticpic: ifuncmain1pic.o ifuncmod1.o gcctestdir/ld
2602 $(LINK) -Bgcctestdir/ ifuncmain1pic.o ifuncmod1.o
2603
2604check_PROGRAMS += ifuncmain1pie
2605ifuncmain1pie: ifuncmain1pie.o ifuncmod1.so gcctestdir/ld
2606 $(LINK) -Bgcctestdir/ -pie ifuncmain1pie.o ifuncmod1.so -Wl,-R,.
2607
2608check_PROGRAMS += ifuncmain1vispie
2609ifuncmain1vispie.o: ifuncmain1vis.c
661d7a80 2610 $(COMPILE) -c -fPIE -o $@ $<
7223e9ca
ILT
2611ifuncmain1vispie: ifuncmain1vispie.o ifuncmod1.so gcctestdir/ld
2612 $(LINK) -Bgcctestdir/ -pie ifuncmain1vispie.o ifuncmod1.so -Wl,-R,.
2613
2614check_PROGRAMS += ifuncmain1staticpie
2615ifuncmain1staticpie: ifuncmain1pie.o ifuncmod1.o gcctestdir/ld
2616 $(LINK) -Bgcctestdir/ -pie ifuncmain1pie.o ifuncmod1.o
2617
2618ifuncmain2pic.o: ifuncmain2.c
661d7a80 2619 $(COMPILE) -c -fPIC -o $@ $<
7223e9ca
ILT
2620
2621ifuncdep2pic.o: ifuncdep2.c
661d7a80 2622 $(COMPILE) -c -fPIC -o $@ $<
7223e9ca 2623
328c7c2f 2624if HAVE_STATIC
ebb300b2 2625if IFUNC_STATIC
7223e9ca
ILT
2626check_PROGRAMS += ifuncmain2static
2627ifuncmain2static_SOURCES = ifuncmain2.c ifuncdep2.c
2628ifuncmain2static_DEPENDENCIES = gcctestdir/ld
2629ifuncmain2static_LDFLAGS = -Bgcctestdir/ -static
f8e9a930 2630ifuncmain2static_LDADD =
7223e9ca
ILT
2631
2632check_PROGRAMS += ifuncmain2picstatic
2633ifuncmain2picstatic: ifuncmain2pic.o ifuncdep2pic.o gcctestdir/ld
2634 $(LINK) -Bgcctestdir/ -static ifuncmain2pic.o ifuncdep2pic.o
328c7c2f 2635endif
ebb300b2 2636endif
7223e9ca
ILT
2637
2638check_PROGRAMS += ifuncmain2
2639ifuncmain2_SOURCES = ifuncmain2.c ifuncdep2.c
2640ifuncmain2_DEPENDENCIES = gcctestdir/ld
2641ifuncmain2_LDFLAGS = -Bgcctestdir/
f8e9a930 2642ifuncmain2_LDADD =
7223e9ca
ILT
2643
2644check_PROGRAMS += ifuncmain2pic
2645ifuncmain2pic: ifuncmain2pic.o ifuncdep2pic.o gcctestdir/ld
2646 $(LINK) -Bgcctestdir/ ifuncmain2pic.o ifuncdep2pic.o
2647
2648ifuncmod3.o: ifuncmod3.c
661d7a80 2649 $(COMPILE) -c -fPIC -o $@ $<
7223e9ca
ILT
2650ifuncmod3.so: ifuncmod3.o gcctestdir/ld
2651 $(LINK) -Bgcctestdir/ -shared ifuncmod3.o
2652
2653check_PROGRAMS += ifuncmain3
2654ifuncmain3_SOURCES = ifuncmain3.c
2655ifuncmain3_DEPENDENCIES = gcctestdir/ld ifuncmod3.so
2656ifuncmain3_LDFLAGS = -Bgcctestdir/ -Wl,--export-dynamic -Wl,-R,.
2657ifuncmain3_LDADD = -ldl
2658
2659ifuncmain4pic.o: ifuncmain4.c
661d7a80 2660 $(COMPILE) -c -fPIC -o $@ $<
7223e9ca 2661
328c7c2f 2662if HAVE_STATIC
ebb300b2 2663if IFUNC_STATIC
7223e9ca
ILT
2664check_PROGRAMS += ifuncmain4static
2665ifuncmain4static_SOURCES = ifuncmain4.c
2666ifuncmain4static_DEPENDENCIES = gcctestdir/ld
2667ifuncmain4static_LDFLAGS = -Bgcctestdir/ -static
f8e9a930 2668ifuncmain4static_LDADD =
7223e9ca
ILT
2669
2670check_PROGRAMS += ifuncmain4picstatic
2671ifuncmain4picstatic: ifuncmain4pic.o gcctestdir/ld
2672 $(LINK) -Bgcctestdir/ -static ifuncmain4pic.o
328c7c2f 2673endif
ebb300b2 2674endif
7223e9ca
ILT
2675
2676check_PROGRAMS += ifuncmain4
2677ifuncmain4_SOURCES = ifuncmain4.c
2678ifuncmain4_DEPENDENCIES = gcctestdir/ld
2679ifuncmain4_LDFLAGS = -Bgcctestdir/
f8e9a930 2680ifuncmain4_LDADD =
7223e9ca
ILT
2681
2682ifuncmain5pic.o: ifuncmain5.c
661d7a80 2683 $(COMPILE) -c -fPIC -o $@ $<
7223e9ca
ILT
2684
2685ifuncmain5pie.o: ifuncmain5.c
661d7a80 2686 $(COMPILE) -c -fPIE -o $@ $<
7223e9ca
ILT
2687
2688ifuncmod5.o: ifuncmod5.c
661d7a80 2689 $(COMPILE) -c -fPIC -o $@ $<
7223e9ca
ILT
2690ifuncmod5.so: ifuncmod5.o gcctestdir/ld
2691 $(LINK) -Bgcctestdir/ -shared ifuncmod5.o
2692
2693ifuncdep5.o: ifuncmod5.c
2694 $(COMPILE) -c -o $@ $<
2695
328c7c2f 2696if HAVE_STATIC
ebb300b2 2697if IFUNC_STATIC
7223e9ca
ILT
2698check_PROGRAMS += ifuncmain5static
2699ifuncmain5static_SOURCES = ifuncmain5.c
2700ifuncmain5static_DEPENDENCIES = gcctestdir/ld ifuncdep5.o
2701ifuncmain5static_LDFLAGS = -Bgcctestdir/ -static
2702ifuncmain5static_LDADD = ifuncdep5.o
2703
2704check_PROGRAMS += ifuncmain5picstatic
2705ifuncmain5picstatic: ifuncmain5pic.o ifuncmod5.o gcctestdir/ld
2706 $(LINK) -Bgcctestdir/ -static ifuncmain5pic.o ifuncmod5.o
328c7c2f 2707endif
ebb300b2 2708endif
7223e9ca
ILT
2709
2710check_PROGRAMS += ifuncmain5
2711ifuncmain5_SOURCES = ifuncmain5.c
2712ifuncmain5_DEPENDENCIES = gcctestdir/ld ifuncmod5.so
2713ifuncmain5_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
2714ifuncmain5_LDADD = ifuncmod5.so
2715
2716check_PROGRAMS += ifuncmain5pic
2717ifuncmain5pic: ifuncmain5pic.o ifuncmod5.so gcctestdir/ld
2718 $(LINK) -Bgcctestdir/ ifuncmain5pic.o ifuncmod5.so -Wl,-R,.
2719
2720check_PROGRAMS += ifuncmain5staticpic
2721ifuncmain5staticpic: ifuncmain5pic.o ifuncmod5.o gcctestdir/ld
2722 $(LINK) -Bgcctestdir/ ifuncmain5pic.o ifuncmod5.o
2723
2724check_PROGRAMS += ifuncmain5pie
2725ifuncmain5pie: ifuncmain5pie.o ifuncmod5.so gcctestdir/ld
2726 $(LINK) -Bgcctestdir/ -pie ifuncmain5pie.o ifuncmod5.so -Wl,-R,.
2727
2728ifuncmain6pie.o: ifuncmain6pie.c
661d7a80 2729 $(COMPILE) -c -fPIE -o $@ $<
7223e9ca
ILT
2730
2731ifuncmod6.o: ifuncmod6.c
661d7a80 2732 $(COMPILE) -c -fPIC -o $@ $<
7223e9ca
ILT
2733ifuncmod6.so: ifuncmod6.o gcctestdir/ld
2734 $(LINK) -Bgcctestdir/ -shared ifuncmod6.o
2735
2736check_PROGRAMS += ifuncmain6pie
2737ifuncmain6pie: ifuncmain6pie.o ifuncmod6.so gcctestdir/ld
2738 $(LINK) -Bgcctestdir/ -pie ifuncmain6pie.o ifuncmod6.so -Wl,-R,.
2739
2740ifuncmain7pic.o: ifuncmain7.c
661d7a80 2741 $(COMPILE) -c -fPIC -o $@ $<
7223e9ca
ILT
2742
2743ifuncmain7pie.o: ifuncmain7.c
661d7a80 2744 $(COMPILE) -c -fPIE -o $@ $<
7223e9ca 2745
328c7c2f 2746if HAVE_STATIC
ebb300b2 2747if IFUNC_STATIC
7223e9ca
ILT
2748check_PROGRAMS += ifuncmain7static
2749ifuncmain7static_SOURCES = ifuncmain7.c
2750ifuncmain7static_DEPENDENCIES = gcctestdir/ld
2751ifuncmain7static_LDFLAGS = -Bgcctestdir/ -static
f8e9a930 2752ifuncmain7static_LDADD =
7223e9ca
ILT
2753
2754check_PROGRAMS += ifuncmain7picstatic
2755ifuncmain7picstatic: ifuncmain7pic.o gcctestdir/ld
2756 $(LINK) -Bgcctestdir/ -static ifuncmain7pic.o
328c7c2f 2757endif
ebb300b2 2758endif
7223e9ca
ILT
2759
2760check_PROGRAMS += ifuncmain7
2761ifuncmain7_SOURCES = ifuncmain7.c
2762ifuncmain7_DEPENDENCIES = gcctestdir/ld
2763ifuncmain7_LDFLAGS = -Bgcctestdir/
f8e9a930 2764ifuncmain7_LDADD =
7223e9ca
ILT
2765
2766check_PROGRAMS += ifuncmain7pic
2767ifuncmain7pic: ifuncmain7pic.o gcctestdir/ld
2768 $(LINK) -Bgcctestdir/ ifuncmain7pic.o
2769
2770check_PROGRAMS += ifuncmain7pie
2771ifuncmain7pie: ifuncmain7pie.o gcctestdir/ld
2772 $(LINK) -Bgcctestdir/ -pie ifuncmain7pie.o
2773
67181c72
ILT
2774check_PROGRAMS += ifuncvar
2775ifuncvar1_pic.o: ifuncvar1.c
661d7a80 2776 $(COMPILE) -c -fPIC -o $@ $<
2b64b551 2777ifuncvar2_pic.o: ifuncvar2.c
661d7a80 2778 $(COMPILE) -c -fPIC -o $@ $<
67181c72
ILT
2779ifuncvar.so: ifuncvar1_pic.o ifuncvar2_pic.o gcctestdir/ld
2780 $(LINK) -Bgcctestdir/ -shared ifuncvar1_pic.o ifuncvar2_pic.o
2781ifuncvar_SOURCES = ifuncvar3.c
2782ifuncvar_DEPENDENCIES = gcctestdir/ld ifuncvar.so
2783ifuncvar_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
2784ifuncvar_LDADD = ifuncvar.so
2785
7223e9ca
ILT
2786endif IFUNC
2787
74f67560
DK
2788# Test that strong reference to a weak symbol in a DSO remains strong.
2789check_SCRIPTS += strong_ref_weak_def.sh
2790check_DATA += strong_ref_weak_def.stdout
2791MOSTLYCLEANFILES += strong_ref_weak_def_1.so strong_ref_weak_def_2.so \
2792 strong_ref_weak_def.stdout
2793strong_ref_weak_def_2.o: strong_ref_weak_def_2.c
2794 $(COMPILE) -o $@ -c -fPIC $<
2795strong_ref_weak_def_2.so: strong_ref_weak_def_2.o gcctestdir/ld
2796 gcctestdir/ld -shared -o $@ strong_ref_weak_def_2.o
2797strong_ref_weak_def_1.o: strong_ref_weak_def_1.c
2798 $(COMPILE) -o $@ -c -fPIC $<
2799strong_ref_weak_def_1.so: strong_ref_weak_def_1.o strong_ref_weak_def_2.so \
2800 gcctestdir/ld
2801 gcctestdir/ld -shared -o $@ strong_ref_weak_def_1.o \
2802 strong_ref_weak_def_2.so
2803strong_ref_weak_def.stdout: strong_ref_weak_def_1.so
2804 $(TEST_READELF) -sWD $< > $@
2805
a4649286
DK
2806# Test that a strong weak reference remains strong if there is another
2807# weak reference in a DSO.
2808check_SCRIPTS += dyn_weak_ref.sh
2809check_DATA += dyn_weak_ref.stdout
2810MOSTLYCLEANFILES += dyn_weak_ref_1.so dyn_weak_ref_2.so \
2811 dyn_weak_ref.stdout
2812dyn_weak_ref_2.o: dyn_weak_ref_2.c
2813 $(COMPILE) -o $@ -c -fPIC $<
2814dyn_weak_ref_2.so: dyn_weak_ref_2.o gcctestdir/ld
2815 gcctestdir/ld -shared -o $@ dyn_weak_ref_2.o
2816dyn_weak_ref_1.o: dyn_weak_ref_1.c
2817 $(COMPILE) -o $@ -c -fPIC $<
2818# We intentionally put dyn_weak_ref_2.so in front of dyn_weak_ref_1.o
2819# so that the weak ref there goes to gold's symbol table first.
2820dyn_weak_ref_1.so: dyn_weak_ref_1.o dyn_weak_ref_2.so gcctestdir/ld
2821 gcctestdir/ld -shared -o $@ dyn_weak_ref_2.so dyn_weak_ref_1.o
2822dyn_weak_ref.stdout: dyn_weak_ref_1.so
2823 $(TEST_READELF) -sWD $< > $@
2824
2825
97b4be1c
CC
2826# Test that --start-lib and --end-lib function correctly.
2827check_PROGRAMS += start_lib_test
0ec6429b 2828MOSTLYCLEANFILES += libstart_lib_test.a
97b4be1c
CC
2829start_lib_test: start_lib_test_main.o libstart_lib_test.a start_lib_test_2.o start_lib_test_3.o \
2830 gcctestdir/ld
2831 $(LINK) -Bgcctestdir/ -o $@ start_lib_test_main.o -L. -lstart_lib_test \
2832 -Wl,--start-lib start_lib_test_2.o start_lib_test_3.o -Wl,--end-lib
2833libstart_lib_test.a: start_lib_test_1.o
2834 $(TEST_AR) rc $@ $^
2835
7f8cd844
NC
2836# Test that MEMORY region support works.
2837check_SCRIPTS += memory_test.sh
2838check_DATA += memory_test.stdout
2839MOSTLYCLEANFILES += memory_test.stdout memory_test memory_test.o
d4d91489
ILT
2840memory_test.o: memory_test.s
2841 $(COMPILE) -o $@ -c $<
2842memory_test: memory_test.o gcctestdir/ld $(srcdir)/memory_test.t
068e05ba 2843 $(LINK) -Bgcctestdir/ -nostartfiles -nostdlib -Wl,-z,max-page-size=0x1000 -Wl,-z,common-page-size=0x1000 -Wl,-T,$(srcdir)/memory_test.t -o $@ memory_test.o
7f8cd844 2844memory_test.stdout: memory_test
41a8542a 2845 $(TEST_READELF) -lWS $< > $@
7f8cd844 2846
410da591
CC
2847# Test INCLUDE directives in linker scripts.
2848# The binary isn't runnable, so we just check that we can build it without errors.
2849check_DATA += memory_test_2
0863441e 2850MOSTLYCLEANFILES += memory_test_inc_1.t memory_test_inc_2.t memory_test_inc_3.t memory_test_2
410da591
CC
2851memory_test_inc_1.t: $(srcdir)/memory_test_inc_1.t.src
2852 cp $< $@
2853memory_test_inc_2.t: $(srcdir)/memory_test_inc_2.t.src
2854 cp $< $@
2855memory_test_inc_3.t: $(srcdir)/memory_test_inc_3.t.src
2856 cp $< $@
2857memory_test_2: memory_test.o gcctestdir/ld $(srcdir)/memory_test.t memory_test_inc_1.t memory_test_inc_2.t memory_test_inc_3.t
068e05ba 2858 $(LINK) -Bgcctestdir/ -nostartfiles -nostdlib -Wl,-z,max-page-size=0x1000 -Wl,-z,common-page-size=0x1000 -Wl,-T,$(srcdir)/memory_test.t -o $@ memory_test.o
410da591 2859
f1415016
CC
2860if HAVE_PUBNAMES
2861
2862# Test that --gdb-index functions correctly without gcc-generated pubnames.
c1027032
CC
2863check_SCRIPTS += gdb_index_test_1.sh
2864check_DATA += gdb_index_test_1.stdout
2865MOSTLYCLEANFILES += gdb_index_test_1.stdout gdb_index_test_1
2866gdb_index_test.o: gdb_index_test.cc
f1415016 2867 $(CXXCOMPILE) -O0 -g -gno-pubnames -c -o $@ $<
c1027032
CC
2868gdb_index_test_1: gdb_index_test.o gcctestdir/ld
2869 $(CXXLINK) -Bgcctestdir/ -Wl,--gdb-index $<
2870gdb_index_test_1.stdout: gdb_index_test_1
2871 $(TEST_READELF) --debug-dump=gdb_index $< > $@
2872
f1415016 2873# Test that --gdb-index functions correctly with compressed debug sections.
c1027032
CC
2874check_SCRIPTS += gdb_index_test_2.sh
2875check_DATA += gdb_index_test_2.stdout
0863441e 2876MOSTLYCLEANFILES += gdb_index_test_2.stdout gdb_index_test_2 gdb_index_test_2_gabi
c1027032
CC
2877gdb_index_test_cdebug.o: gdb_index_test.cc
2878 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -Wa,--compress-debug-sections -c -o $@ $<
2879gdb_index_test_2: gdb_index_test_cdebug.o gcctestdir/ld
2880 $(CXXLINK) -Bgcctestdir/ -Wl,--gdb-index $<
2881gdb_index_test_2.stdout: gdb_index_test_2
2882 $(TEST_READELF) --debug-dump=gdb_index $< > $@
48058663
L
2883check_SCRIPTS += gdb_index_test_2_gabi.sh
2884check_DATA += gdb_index_test_2_gabi.stdout
2885MOSTLYCLEANFILES += gdb_index_test_2.stdout gdb_index_test_2
2886gdb_index_test_cdebug_gabi.o: gdb_index_test.cc
2887 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -Wa,--compress-debug-sections=zlib-gabi -c -o $@ $<
2888gdb_index_test_2_gabi: gdb_index_test_cdebug_gabi.o gcctestdir/ld
2889 $(CXXLINK) -Bgcctestdir/ -Wl,--gdb-index $<
2890gdb_index_test_2_gabi.stdout: gdb_index_test_2_gabi
2891 $(TEST_READELF) --debug-dump=gdb_index $< > $@
c1027032 2892
f1415016 2893# Another simple C test (DW_AT_high_pc encoding) for --gdb-index.
57923f48
MW
2894check_SCRIPTS += gdb_index_test_3.sh
2895check_DATA += gdb_index_test_3.stdout
2896MOSTLYCLEANFILES += gdb_index_test_3.stdout gdb_index_test_3
2897gdb_index_test_3.o: gdb_index_test_3.c
2898 $(COMPILE) -O0 -g -c -o $@ $<
2899gdb_index_test_3: gdb_index_test_3.o gcctestdir/ld
2900 $(LINK) -Bgcctestdir/ -Wl,--gdb-index,--fatal-warnings $<
2901gdb_index_test_3.stdout: gdb_index_test_3
2902 $(TEST_READELF) --debug-dump=gdb_index $< > $@
2903
f1415016
CC
2904# Test that --gdb-index functions correctly with gcc-generated pubnames.
2905check_SCRIPTS += gdb_index_test_4.sh
2906check_DATA += gdb_index_test_4.stdout
2907MOSTLYCLEANFILES += gdb_index_test_4.stdout gdb_index_test_4
2908gdb_index_test_pub.o: gdb_index_test.cc
2909 $(CXXCOMPILE) -O0 -g -gpubnames -c -o $@ $<
2910gdb_index_test_4: gdb_index_test_pub.o gcctestdir/ld
2911 $(CXXLINK) -Bgcctestdir/ -Wl,--gdb-index $<
2912gdb_index_test_4.stdout: gdb_index_test_4
2913 $(TEST_READELF) --debug-dump=gdb_index $< > $@
2914
2915endif HAVE_PUBNAMES
57923f48 2916
d1bddd3c
CC
2917# Test that __ehdr_start is defined correctly.
2918check_PROGRAMS += ehdr_start_test_1
2919ehdr_start_test_1_SOURCES = ehdr_start_test.cc
2920ehdr_start_test_1_DEPENDENCIES = gcctestdir/ld
2921ehdr_start_test_1_CXXFLAGS =
2922ehdr_start_test_1_LDFLAGS = -Bgcctestdir/
2923ehdr_start_test_1_LDADD =
2924
2925# Test that __ehdr_start is defined correctly with a weak reference.
2926check_PROGRAMS += ehdr_start_test_2
2927ehdr_start_test_2_SOURCES = ehdr_start_test.cc
2928ehdr_start_test_2_DEPENDENCIES = gcctestdir/ld
2929ehdr_start_test_2_CXXFLAGS = -DEHDR_START_WEAK
2930ehdr_start_test_2_LDFLAGS = -Bgcctestdir/
2931ehdr_start_test_2_LDADD =
2932
2933# Test that __ehdr_start is defined correctly when used with a linker script.
2934check_PROGRAMS += ehdr_start_test_3
2935ehdr_start_test_3_SOURCES = ehdr_start_test.cc
2936ehdr_start_test_3_DEPENDENCIES = gcctestdir/ld $(srcdir)/ehdr_start_test.t
2937ehdr_start_test_3_CXXFLAGS = -DEHDR_START_WEAK
2938ehdr_start_test_3_LDFLAGS = -Bgcctestdir/ -Wl,-T,$(srcdir)/ehdr_start_test.t
2939ehdr_start_test_3_LDADD =
2940
2941# Test that __ehdr_start is left undefined when the text segment is not
2942# appropriately aligned.
2943check_SCRIPTS += ehdr_start_test_4.sh
2944check_DATA += ehdr_start_test_4.syms
2945MOSTLYCLEANFILES += ehdr_start_test_4
2946ehdr_start_test_4.syms: ehdr_start_test_4
2947 $(TEST_NM) ehdr_start_test_4 > $@
2948ehdr_start_test_4: ehdr_start_test_4.o gcctestdir/ld
f6fb8322 2949 $(CXXLINK) -Bgcctestdir/ -Wl,-Ttext=0x100100 $<
d1bddd3c
CC
2950ehdr_start_test_4.o: ehdr_start_test.cc
2951 $(CXXCOMPILE) -c -DEHDR_START_WEAK -o $@ $<
2952
2953# Test that __ehdr_start is not overridden when supplied by the user.
2954check_PROGRAMS += ehdr_start_test_5
2955ehdr_start_test_5_SOURCES = ehdr_start_test.cc ehdr_start_def.cc
2956ehdr_start_test_5_DEPENDENCIES = gcctestdir/ld
2957ehdr_start_test_5_CXXFLAGS = -DEHDR_START_USER_DEF
2958ehdr_start_test_5_LDFLAGS = -Bgcctestdir/
2959ehdr_start_test_5_LDADD =
2960
e051745c
CC
2961# Test that the --defsym option copies the symbol type and visibility.
2962check_SCRIPTS += defsym_test.sh
2963check_DATA += defsym_test.syms
dddcc5b9 2964MOSTLYCLEANFILES += defsym_test defsym_test.syms
e051745c
CC
2965defsym_test.syms: defsym_test
2966 $(TEST_READELF) -sW $< > $@
2967defsym_test: defsym_test.o gcctestdir/ld
2968 $(LINK) -Bgcctestdir/ -Wl,--defsym=bar=foo defsym_test.o
2969defsym_test.o: defsym_test.c
2970 $(COMPILE) -c -o $@ $<
2971
89ede9f5
CC
2972# Test that the -d option (force common allocation) works correctly.
2973check_PROGRAMS += pr20976
2974pr20976: pr20976-d.o gcctestdir/ld
2975 $(LINK) -Bgcctestdir/ pr20976-d.o
2976pr20976-d.o: pr20976.o gcctestdir/ld
2977 gcctestdir/ld -r -d -o $@ pr20976.o
2978
2eedd706
CC
2979# End-to-end incremental linking tests.
2980# Incremental linking is currently supported only on the x86_64 target.
2981
2982if DEFAULT_TARGET_X86_64
2983
33c15b45
CC
2984two_file_test_1_v1_ndebug.o: two_file_test_1_v1.cc
2985 $(CXXCOMPILE) -O0 -g0 -c -o $@ $<
2986two_file_test_1_ndebug.o: two_file_test_1.cc
2987 $(CXXCOMPILE) -O0 -g0 -c -o $@ $<
2988two_file_test_1b_ndebug.o: two_file_test_1b.cc
2989 $(CXXCOMPILE) -O0 -g0 -c -o $@ $<
2990two_file_test_2_ndebug.o: two_file_test_2.cc
2991 $(CXXCOMPILE) -O0 -g0 -c -o $@ $<
2992two_file_test_main_ndebug.o: two_file_test_main.cc
2993 $(CXXCOMPILE) -O0 -g0 -c -o $@ $<
2994
2eedd706 2995check_PROGRAMS += incremental_test_2
c49875be 2996MOSTLYCLEANFILES += two_file_test_tmp_2.o
33c15b45
CC
2997incremental_test_2: two_file_test_1_v1_ndebug.o two_file_test_1_ndebug.o two_file_test_1b_ndebug.o \
2998 two_file_test_2_ndebug.o two_file_test_main_ndebug.o gcctestdir/ld
2999 cp -f two_file_test_1_v1_ndebug.o two_file_test_tmp_2.o
943c8b43 3000 $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Wl,-z,norelro -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 3001 @sleep 1
33c15b45 3002 cp -f two_file_test_1_ndebug.o two_file_test_tmp_2.o
943c8b43 3003 $(CXXLINK) -Wl,--incremental-update -Wl,-z,norelro -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
3004
3005check_PROGRAMS += incremental_test_3
c49875be 3006MOSTLYCLEANFILES += two_file_test_tmp_3.o
2eedd706
CC
3007incremental_test_3: two_file_test_1.o two_file_test_1b_v1.o two_file_test_1b.o \
3008 two_file_test_2.o two_file_test_main.o gcctestdir/ld
c49875be 3009 cp -f two_file_test_1b_v1.o two_file_test_tmp_3.o
943c8b43 3010 $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Wl,-z,norelro -Bgcctestdir/ two_file_test_1.o two_file_test_tmp_3.o two_file_test_2.o two_file_test_main.o
2eedd706 3011 @sleep 1
c49875be 3012 cp -f two_file_test_1b.o two_file_test_tmp_3.o
943c8b43 3013 $(CXXLINK) -Wl,--incremental-update -Wl,-z,norelro -Bgcctestdir/ two_file_test_1.o two_file_test_tmp_3.o two_file_test_2.o two_file_test_main.o
2eedd706
CC
3014
3015check_PROGRAMS += incremental_test_4
c49875be 3016MOSTLYCLEANFILES += incremental_test_4.base two_file_test_tmp_4.o
2eedd706
CC
3017incremental_test_4: two_file_test_1.o two_file_test_1b.o two_file_test_2_v1.o \
3018 two_file_test_2.o two_file_test_main.o gcctestdir/ld
c49875be 3019 cp -f two_file_test_2_v1.o two_file_test_tmp_4.o
943c8b43 3020 $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Wl,-z,norelro -Bgcctestdir/ two_file_test_1.o two_file_test_1b.o two_file_test_tmp_4.o two_file_test_main.o
aa92d6ed 3021 mv -f incremental_test_4 incremental_test_4.base
2eedd706 3022 @sleep 1
c49875be 3023 cp -f two_file_test_2.o two_file_test_tmp_4.o
943c8b43 3024 $(CXXLINK) -Wl,--incremental-update,--incremental-base=incremental_test_4.base -Wl,-z,norelro -Bgcctestdir/ two_file_test_1.o two_file_test_1b.o two_file_test_tmp_4.o two_file_test_main.o
2eedd706 3025
e24719f6
CC
3026check_PROGRAMS += incremental_test_5
3027MOSTLYCLEANFILES += two_file_test_5.a
3028incremental_test_5: two_file_test_1.o two_file_test_1b_v1.o two_file_test_1b.o \
3029 two_file_test_2.o two_file_test_main.o gcctestdir/ld
3030 cp -f two_file_test_1b_v1.o two_file_test_tmp_5.o
3031 $(TEST_AR) rc two_file_test_5.a two_file_test_1.o two_file_test_tmp_5.o two_file_test_2.o
943c8b43 3032 $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Wl,-z,norelro -Bgcctestdir/ two_file_test_main.o two_file_test_5.a
e24719f6
CC
3033 @sleep 1
3034 cp -f two_file_test_1b.o two_file_test_tmp_5.o
3035 $(TEST_AR) rc two_file_test_5.a two_file_test_1.o two_file_test_tmp_5.o two_file_test_2.o
943c8b43 3036 $(CXXLINK) -Wl,--incremental-update -Wl,-z,norelro -Bgcctestdir/ two_file_test_main.o two_file_test_5.a
e24719f6
CC
3037
3038# Test the --incremental-unchanged flag with an archive library.
3039# The second link should not update the library.
3040check_PROGRAMS += incremental_test_6
3041MOSTLYCLEANFILES += two_file_test_6.a
3042incremental_test_6: two_file_test_1.o two_file_test_1b_v1.o two_file_test_1b.o \
3043 two_file_test_2.o two_file_test_main.o gcctestdir/ld
3044 cp -f two_file_test_1b.o two_file_test_tmp_6.o
3045 $(TEST_AR) rc two_file_test_6.a two_file_test_1.o two_file_test_tmp_6.o two_file_test_2.o
943c8b43 3046 $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Wl,-z,norelro -Bgcctestdir/ two_file_test_main.o two_file_test_6.a
e24719f6
CC
3047 @sleep 1
3048 cp -f two_file_test_1b_v1.o two_file_test_tmp_6.o
3049 $(TEST_AR) rc two_file_test_6.a two_file_test_1.o two_file_test_tmp_6.o two_file_test_2.o
943c8b43 3050 $(CXXLINK) -Wl,--incremental-update -Wl,-z,norelro -Bgcctestdir/ two_file_test_main.o -Wl,--incremental-unchanged two_file_test_6.a -Wl,--incremental-unknown
e24719f6 3051
a5ee4d5d
CC
3052check_PROGRAMS += incremental_copy_test
3053incremental_copy_test: copy_test_v1.o copy_test.o copy_test_1.so copy_test_2.so
3054 cp -f copy_test_v1.o copy_test_tmp.o
943c8b43 3055 $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Wl,-z,norelro -Bgcctestdir/ -Wl,-R,. -Wl,--no-as-needed copy_test_tmp.o copy_test_1.so copy_test_2.so
a5ee4d5d
CC
3056 @sleep 1
3057 cp -f copy_test.o copy_test_tmp.o
943c8b43 3058 $(CXXLINK) -Wl,--incremental-update -Wl,-z,norelro -Bgcctestdir/ -Wl,-R,. -Wl,--no-as-needed copy_test_tmp.o copy_test_1.so copy_test_2.so
a5ee4d5d
CC
3059
3060check_PROGRAMS += incremental_common_test_1
3061incremental_common_test_1: common_test_1_v1.o common_test_1_v2.o gcctestdir/ld
3062 cp -f common_test_1_v1.o common_test_1_tmp.o
943c8b43 3063 $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Wl,-z,norelro -Bgcctestdir/ common_test_1_tmp.o
a5ee4d5d
CC
3064 @sleep 1
3065 cp -f common_test_1_v2.o common_test_1_tmp.o
943c8b43 3066 $(CXXLINK) -Wl,--incremental-update -Wl,-z,norelro -Bgcctestdir/ common_test_1_tmp.o
a5ee4d5d 3067
1206d0d5
CC
3068check_PROGRAMS += incremental_comdat_test_1
3069incremental_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
3070 cp -f incr_comdat_test_2_v1.o incr_comdat_test_1_tmp.o
943c8b43 3071 $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Wl,-z,norelro -Bgcctestdir/ incr_comdat_test_1.o incr_comdat_test_1_tmp.o
1206d0d5
CC
3072 @sleep 1
3073 cp -f incr_comdat_test_2_v2.o incr_comdat_test_1_tmp.o
943c8b43 3074 $(CXXLINK) -Wl,--incremental-update -Wl,-z,norelro -Bgcctestdir/ incr_comdat_test_1.o incr_comdat_test_1_tmp.o
1206d0d5
CC
3075 @sleep 1
3076 cp -f incr_comdat_test_2_v3.o incr_comdat_test_1_tmp.o
943c8b43 3077 $(CXXLINK) -Wl,--incremental-update -Wl,-z,norelro -Bgcctestdir/ incr_comdat_test_1.o incr_comdat_test_1_tmp.o
1206d0d5 3078
2eedd706
CC
3079endif DEFAULT_TARGET_X86_64
3080
f49fe902
L
3081if DEFAULT_TARGET_X86_64
3082check_PROGRAMS += exception_x86_64_bnd_test
3083exception_x86_64_bnd_test_SOURCES = exception_test_main.cc
635aa30e 3084exception_x86_64_bnd_test_DEPENDENCIES = gcctestdir/ld exception_x86_64_bnd_1.o exception_x86_64_bnd_2.o
7a0c0a14 3085exception_x86_64_bnd_test_LDFLAGS = $(exception_test_LDFLAGS) -Wl,-z,bndplt
635aa30e 3086exception_x86_64_bnd_test_LDADD = exception_x86_64_bnd_1.o exception_x86_64_bnd_2.o
0c075858 3087exception_x86_64_bnd_1.o: exception_test_1.cc gcctestdir/as
f49fe902 3088 $(CXXCOMPILE) -c -fpic -Bgcctestdir/ -Wa,-madd-bnd-prefix -o $@ $<
0c075858 3089exception_x86_64_bnd_2.o: exception_test_2.cc gcctestdir/as
f49fe902
L
3090 $(CXXCOMPILE) -c -Bgcctestdir/ -Wa,-madd-bnd-prefix -o $@ $<
3091endif DEFAULT_TARGET_X86_64
3092
351a8000
ILT
3093endif GCC
3094endif NATIVE_LINKER
364c7fa5 3095
eb373049
ILT
3096# These tests work with native and cross linkers.
3097
3098if NATIVE_OR_CROSS_LINKER
3099
3100# Test script section order.
3101check_SCRIPTS += script_test_10.sh
3102check_DATA += script_test_10.stdout
0ec6429b 3103MOSTLYCLEANFILES += script_test_10
eb373049
ILT
3104script_test_10.o: script_test_10.s
3105 $(TEST_AS) -o $@ $<
3106script_test_10: $(srcdir)/script_test_10.t script_test_10.o gcctestdir/ld
52dc3f9c 3107 gcctestdir/ld -o $@ script_test_10.o -T $(srcdir)/script_test_10.t
eb373049
ILT
3108script_test_10.stdout: script_test_10
3109 $(TEST_READELF) -SW script_test_10 > $@
3110
3111# These tests work with cross linkers only.
364c7fa5
ILT
3112
3113if DEFAULT_TARGET_I386
3114
3115check_SCRIPTS += split_i386.sh
3116check_DATA += split_i386_1.stdout split_i386_2.stdout \
3117 split_i386_3.stdout split_i386_4.stdout split_i386_r.stdout
3118SPLIT_DEFSYMS = --defsym __morestack=0x100 --defsym __morestack_non_split=0x200
3119split_i386_1.o: split_i386_1.s
3120 $(TEST_AS) -o $@ $<
3121split_i386_2.o: split_i386_2.s
3122 $(TEST_AS) -o $@ $<
3123split_i386_3.o: split_i386_3.s
3124 $(TEST_AS) -o $@ $<
3125split_i386_4.o: split_i386_4.s
3126 $(TEST_AS) -o $@ $<
3127split_i386_n.o: split_i386_n.s
3128 $(TEST_AS) -o $@ $<
3129split_i386_1: split_i386_1.o split_i386_n.o ../ld-new
3130 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_i386_1.o split_i386_n.o
3131split_i386_1.stdout: split_i386_1
3132 $(TEST_OBJDUMP) -d $< > $@
3133split_i386_2: split_i386_2.o split_i386_n.o ../ld-new
3134 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_i386_2.o split_i386_n.o
3135split_i386_2.stdout: split_i386_2
3136 $(TEST_OBJDUMP) -d $< > $@
3137split_i386_3.stdout: split_i386_3.o split_i386_n.o ../ld-new
3138 ../ld-new $(SPLIT_DEFSYMS) -o split_i386_3 split_i386_3.o split_i386_n.o > $@ 2>&1 || exit 0
3139split_i386_4: split_i386_4.o split_i386_n.o ../ld-new
3140 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_i386_4.o split_i386_n.o
3141split_i386_4.stdout: split_i386_4
3142 $(TEST_OBJDUMP) -d $< > $@
3143split_i386_r.stdout: split_i386_1.o split_i386_n.o ../ld-new
3144 ../ld-new -r split_i386_1.o split_i386_n.o -o split_i386_r > $@ 2>&1 || exit 0
3145MOSTLYCLEANFILES += split_i386_1 split_i386_2 split_i386_3 \
3146 split_i386_4 split_i386_r
3147
3148endif DEFAULT_TARGET_I386
3149
3150if DEFAULT_TARGET_X86_64
3151
3152check_SCRIPTS += split_x86_64.sh
3153check_DATA += split_x86_64_1.stdout split_x86_64_2.stdout \
3154 split_x86_64_3.stdout split_x86_64_4.stdout split_x86_64_r.stdout
3155SPLIT_DEFSYMS = --defsym __morestack=0x100 --defsym __morestack_non_split=0x200
3156split_x86_64_1.o: split_x86_64_1.s
3157 $(TEST_AS) -o $@ $<
3158split_x86_64_2.o: split_x86_64_2.s
3159 $(TEST_AS) -o $@ $<
3160split_x86_64_3.o: split_x86_64_3.s
3161 $(TEST_AS) -o $@ $<
3162split_x86_64_4.o: split_x86_64_4.s
3163 $(TEST_AS) -o $@ $<
3164split_x86_64_n.o: split_x86_64_n.s
3165 $(TEST_AS) -o $@ $<
3166split_x86_64_1: split_x86_64_1.o split_x86_64_n.o ../ld-new
3167 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x86_64_1.o split_x86_64_n.o
3168split_x86_64_1.stdout: split_x86_64_1
3169 $(TEST_OBJDUMP) -d $< > $@
3170split_x86_64_2: split_x86_64_2.o split_x86_64_n.o ../ld-new
3171 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x86_64_2.o split_x86_64_n.o
3172split_x86_64_2.stdout: split_x86_64_2
3173 $(TEST_OBJDUMP) -d $< > $@
3174split_x86_64_3.stdout: split_x86_64_3.o split_x86_64_n.o ../ld-new
3175 ../ld-new $(SPLIT_DEFSYMS) -o split_x86_64_3 split_x86_64_3.o split_x86_64_n.o > $@ 2>&1 || exit 0
3176split_x86_64_4: split_x86_64_4.o split_x86_64_n.o ../ld-new
3177 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x86_64_4.o split_x86_64_n.o
3178split_x86_64_4.stdout: split_x86_64_4
3179 $(TEST_OBJDUMP) -d $< > $@
3180split_x86_64_r.stdout: split_x86_64_1.o split_x86_64_n.o ../ld-new
3181 ../ld-new -r split_x86_64_1.o split_x86_64_n.o -o split_x86_64_r > $@ 2>&1 || exit 0
3182MOSTLYCLEANFILES += split_x86_64_1 split_x86_64_2 split_x86_64_3 \
3183 split_x86_64_4 split_x86_64_r
3184
7a0c0a14
CC
3185check_SCRIPTS += bnd_plt_1.sh
3186check_DATA += bnd_plt_1.stdout
3187bnd_plt_1.o: bnd_plt_1.s
3188 $(TEST_AS) --64 -o $@ $<
3189bnd_plt_1.so: bnd_plt_1.o ../ld-new
3190 ../ld-new -shared -z bndplt bnd_plt_1.o -o $@
3191bnd_plt_1.stdout: bnd_plt_1.so
3192 $(TEST_OBJDUMP) -dw $< > $@
3193
3194check_SCRIPTS += bnd_ifunc_1.sh
3195check_DATA += bnd_ifunc_1.stdout
3196bnd_ifunc_1.o: bnd_ifunc_1.s
3197 $(TEST_AS) --64 -madd-bnd-prefix -o $@ $<
3198bnd_ifunc_1.so: bnd_ifunc_1.o ../ld-new
3199 ../ld-new -shared -z bndplt bnd_ifunc_1.o -o $@
3200bnd_ifunc_1.stdout: bnd_ifunc_1.so
3201 $(TEST_OBJDUMP) -dw $< > $@
3202
3203check_SCRIPTS += bnd_ifunc_2.sh
3204check_DATA += bnd_ifunc_2.stdout
3205bnd_ifunc_2.o: bnd_ifunc_2.s
3206 $(TEST_AS) --64 -madd-bnd-prefix -o $@ $<
3207bnd_ifunc_2.so: bnd_ifunc_2.o ../ld-new
3208 ../ld-new -shared -z bndplt bnd_ifunc_2.o -o $@
3209bnd_ifunc_2.stdout: bnd_ifunc_2.so
3210 $(TEST_OBJDUMP) -dw $< > $@
3211
364c7fa5 3212endif DEFAULT_TARGET_X86_64
e4782e83 3213
4fc1b9d4
L
3214if DEFAULT_TARGET_X32
3215
3216check_SCRIPTS += split_x32.sh
3217check_DATA += split_x32_1.stdout split_x32_2.stdout \
3218 split_x32_3.stdout split_x32_4.stdout split_x32_r.stdout
3219SPLIT_DEFSYMS = --defsym __morestack=0x100 --defsym __morestack_non_split=0x200
3220split_x32_1.o: split_x32_1.s
3221 $(TEST_AS) -o $@ $<
3222split_x32_2.o: split_x32_2.s
3223 $(TEST_AS) -o $@ $<
3224split_x32_3.o: split_x32_3.s
3225 $(TEST_AS) -o $@ $<
3226split_x32_4.o: split_x32_4.s
3227 $(TEST_AS) -o $@ $<
3228split_x32_n.o: split_x32_n.s
3229 $(TEST_AS) -o $@ $<
3230split_x32_1: split_x32_1.o split_x32_n.o ../ld-new
3231 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x32_1.o split_x32_n.o
3232split_x32_1.stdout: split_x32_1
3233 $(TEST_OBJDUMP) -d $< > $@
3234split_x32_2: split_x32_2.o split_x32_n.o ../ld-new
3235 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x32_2.o split_x32_n.o
3236split_x32_2.stdout: split_x32_2
3237 $(TEST_OBJDUMP) -d $< > $@
3238split_x32_3.stdout: split_x32_3.o split_x32_n.o ../ld-new
3239 ../ld-new $(SPLIT_DEFSYMS) -o split_x32_3 split_x32_3.o split_x32_n.o > $@ 2>&1 || exit 0
3240split_x32_4: split_x32_4.o split_x32_n.o ../ld-new
3241 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x32_4.o split_x32_n.o
3242split_x32_4.stdout: split_x32_4
3243 $(TEST_OBJDUMP) -d $< > $@
3244split_x32_r.stdout: split_x32_1.o split_x32_n.o ../ld-new
3245 ../ld-new -r split_x32_1.o split_x32_n.o -o split_x32_r > $@ 2>&1 || exit 0
3246MOSTLYCLEANFILES += split_x32_1 split_x32_2 split_x32_3 \
3247 split_x32_4 split_x32_r
3248
3249endif DEFAULT_TARGET_X32
3250
e4782e83
DK
3251if DEFAULT_TARGET_ARM
3252
3253check_SCRIPTS += arm_abs_global.sh
3254check_DATA += arm_abs_global.stdout
3255arm_abs_lib.o: arm_abs_lib.s
3256 $(TEST_AS) -march=armv7-a -o $@ $<
d3bbad62 3257libarm_abs.so: arm_abs_lib.o ../ld-new
e4782e83
DK
3258 ../ld-new -shared -o $@ arm_abs_lib.o
3259arm_abs_global.o: arm_abs_global.s
3260 $(TEST_AS) -march=armv7-a -o $@ $<
d3bbad62 3261arm_abs_global: arm_abs_global.o libarm_abs.so ../ld-new
e4782e83
DK
3262 ../ld-new -o $@ arm_abs_global.o -L. -larm_abs
3263arm_abs_global.stdout: arm_abs_global
3264 $(TEST_READELF) -r $< > $@
3265
3266MOSTLYCLEANFILES += arm_abs_global
3267
aa98ff75 3268check_SCRIPTS += arm_branch_in_range.sh arm_branch_out_of_range.sh
2a2b6d42
DK
3269check_DATA += arm_bl_in_range.stdout arm_bl_out_of_range.stdout \
3270 thumb_bl_in_range.stdout thumb_bl_out_of_range.stdout \
a2c7281b
DK
3271 thumb2_bl_in_range.stdout thumb2_bl_out_of_range.stdout \
3272 thumb_blx_in_range.stdout thumb_blx_out_of_range.stdout \
aa98ff75 3273 thumb2_blx_in_range.stdout thumb2_blx_out_of_range.stdout \
57eb9b50
DK
3274 thumb_bl_out_of_range_local.stdout arm_thm_jump11.stdout \
3275 arm_thm_jump8.stdout
2a2b6d42
DK
3276
3277arm_bl_in_range.stdout: arm_bl_in_range
3278 $(TEST_OBJDUMP) -D $< > $@
3279
d3bbad62 3280arm_bl_in_range: arm_bl_in_range.o ../ld-new
52dc3f9c 3281 ../ld-new -T $(srcdir)/arm_branch_range.t -o $@ $<
2a2b6d42
DK
3282
3283arm_bl_in_range.o: arm_bl_in_range.s
3284 $(TEST_AS) -o $@ $<
3285
3286arm_bl_out_of_range.stdout: arm_bl_out_of_range
3287 $(TEST_OBJDUMP) -S $< > $@
3288
d3bbad62 3289arm_bl_out_of_range: arm_bl_out_of_range.o ../ld-new
52dc3f9c 3290 ../ld-new -T $(srcdir)/arm_branch_range.t -o $@ $<
2a2b6d42
DK
3291
3292arm_bl_out_of_range.o: arm_bl_out_of_range.s
3293 $(TEST_AS) -o $@ $<
3294
3295thumb_bl_in_range.stdout: thumb_bl_in_range
3296 $(TEST_OBJDUMP) -D $< > $@
3297
d3bbad62 3298thumb_bl_in_range: thumb_bl_in_range.o ../ld-new
52dc3f9c 3299 ../ld-new --no-fix-arm1176 -T $(srcdir)/thumb_branch_range.t -o $@ $<
2a2b6d42
DK
3300
3301thumb_bl_in_range.o: thumb_bl_in_range.s
3302 $(TEST_AS) -o $@ -march=armv5te $<
3303
3304thumb_bl_out_of_range.stdout: thumb_bl_out_of_range
3305 $(TEST_OBJDUMP) -D $< > $@
3306
a2c7281b 3307thumb_bl_out_of_range: thumb_bl_out_of_range.o ../ld-new
52dc3f9c 3308 ../ld-new --no-fix-arm1176 -T $(srcdir)/thumb_branch_range.t -o $@ $<
2a2b6d42 3309
a2c7281b 3310thumb_bl_out_of_range.o: thumb_bl_out_of_range.s
2a2b6d42
DK
3311 $(TEST_AS) -o $@ -march=armv5te $<
3312
3313thumb2_bl_in_range.stdout: thumb2_bl_in_range
3314 $(TEST_OBJDUMP) -D $< > $@
3315
d3bbad62 3316thumb2_bl_in_range: thumb2_bl_in_range.o ../ld-new
52dc3f9c 3317 ../ld-new -T $(srcdir)/thumb2_branch_range.t -o $@ $<
2a2b6d42
DK
3318
3319thumb2_bl_in_range.o: thumb_bl_in_range.s
3320 $(TEST_AS) -o $@ -march=armv7-a $<
3321
3322thumb2_bl_out_of_range.stdout: thumb2_bl_out_of_range
3323 $(TEST_OBJDUMP) -D $< > $@
3324
a2c7281b 3325thumb2_bl_out_of_range: thumb2_bl_out_of_range.o ../ld-new
52dc3f9c 3326 ../ld-new -T $(srcdir)/thumb2_branch_range.t -o $@ $<
2a2b6d42 3327
a2c7281b
DK
3328thumb2_bl_out_of_range.o: thumb_bl_out_of_range.s
3329 $(TEST_AS) -o $@ -march=armv7-a $<
3330
3331thumb_blx_in_range.stdout: thumb_blx_in_range
3332 $(TEST_OBJDUMP) -D $< > $@
3333
3334thumb_blx_in_range: thumb_blx_in_range.o ../ld-new
52dc3f9c 3335 ../ld-new --no-fix-arm1176 -T $(srcdir)/thumb_branch_range.t -o $@ $<
a2c7281b
DK
3336
3337thumb_blx_in_range.o: thumb_blx_in_range.s
3338 $(TEST_AS) -o $@ -march=armv5te $<
3339
3340thumb_blx_out_of_range.stdout: thumb_blx_out_of_range
3341 $(TEST_OBJDUMP) -D $< > $@
3342
3343thumb_blx_out_of_range: thumb_blx_out_of_range.o ../ld-new
52dc3f9c 3344 ../ld-new --no-fix-arm1176 -T $(srcdir)/thumb_branch_range.t -o $@ $<
a2c7281b
DK
3345
3346thumb_blx_out_of_range.o: thumb_blx_out_of_range.s
3347 $(TEST_AS) -o $@ -march=armv5te $<
3348
3349thumb2_blx_in_range.stdout: thumb2_blx_in_range
3350 $(TEST_OBJDUMP) -D $< > $@
3351
3352thumb2_blx_in_range: thumb2_blx_in_range.o ../ld-new
52dc3f9c 3353 ../ld-new -T $(srcdir)/thumb2_branch_range.t -o $@ $<
a2c7281b
DK
3354
3355thumb2_blx_in_range.o: thumb_blx_in_range.s
3356 $(TEST_AS) -o $@ -march=armv7-a $<
3357
3358thumb2_blx_out_of_range.stdout: thumb2_blx_out_of_range
3359 $(TEST_OBJDUMP) -D $< > $@
3360
3361thumb2_blx_out_of_range: thumb2_blx_out_of_range.o ../ld-new
52dc3f9c 3362 ../ld-new -T $(srcdir)/thumb2_branch_range.t -o $@ $<
a2c7281b
DK
3363
3364thumb2_blx_out_of_range.o: thumb_blx_out_of_range.s
2a2b6d42
DK
3365 $(TEST_AS) -o $@ -march=armv7-a $<
3366
aa98ff75
DK
3367thumb_bl_out_of_range_local.stdout: thumb_bl_out_of_range_local
3368 $(TEST_OBJDUMP) -D $< > $@
3369
3370thumb_bl_out_of_range_local: thumb_bl_out_of_range_local.o ../ld-new
52dc3f9c 3371 ../ld-new --no-fix-arm1176 -T $(srcdir)/thumb_branch_range.t -o $@ $<
aa98ff75
DK
3372
3373thumb_bl_out_of_range_local.o: thumb_bl_out_of_range_local.s
3374 $(TEST_AS) -o $@ -march=armv5te $<
3375
57eb9b50
DK
3376arm_thm_jump11.stdout: arm_thm_jump11
3377 $(TEST_OBJDUMP) -D $< > $@
3378
3379arm_thm_jump11: arm_thm_jump11.o ../ld-new
52dc3f9c 3380 ../ld-new -T $(srcdir)/arm_thm_jump11.t -o $@ $<
57eb9b50
DK
3381
3382arm_thm_jump11.o: arm_thm_jump11.s
3383 $(TEST_AS) -o $@ $<
3384
3385arm_thm_jump8.stdout: arm_thm_jump8
3386 $(TEST_OBJDUMP) -D $< > $@
3387
3388arm_thm_jump8: arm_thm_jump8.o ../ld-new
52dc3f9c 3389 ../ld-new -T $(srcdir)/arm_thm_jump8.t -o $@ $<
57eb9b50
DK
3390
3391arm_thm_jump8.o: arm_thm_jump8.s
3392 $(TEST_AS) -o $@ $<
3393
2a2b6d42 3394MOSTLYCLEANFILES += arm_bl_in_range arm_bl_out_of_range thumb_bl_in_range \
a2c7281b
DK
3395 thumb_bl_out_of_range thumb2_bl_in_range thumb2_bl_out_of_range \
3396 thumb_blx_in_range thumb_blx_out_of_range thumb2_blx_in_range \
57eb9b50
DK
3397 thumb2_blx_out_of_range thumb_bl_out_of_range_local arm_thm_jump11 \
3398 arm_thm_jump8
2a2b6d42 3399
2fd9ae7a
DK
3400check_SCRIPTS += arm_fix_v4bx.sh
3401check_DATA += arm_fix_v4bx.stdout arm_fix_v4bx_interworking.stdout \
3402 arm_no_fix_v4bx.stdout
3403
3404arm_fix_v4bx.stdout: arm_fix_v4bx
3405 $(TEST_OBJDUMP) -D -j.text $< > $@
3406
d3bbad62 3407arm_fix_v4bx: arm_fix_v4bx.o ../ld-new
a8e2273b 3408 ../ld-new --no-fix-arm1176 --fix-v4bx -o $@ $<
2fd9ae7a
DK
3409
3410arm_fix_v4bx.o: arm_fix_v4bx.s
3411 $(TEST_AS) -o $@ $<
3412
3413arm_fix_v4bx_interworking.stdout: arm_fix_v4bx_interworking
3414 $(TEST_OBJDUMP) -D -j.text $< > $@
3415
d3bbad62 3416arm_fix_v4bx_interworking: arm_fix_v4bx.o ../ld-new
a8e2273b 3417 ../ld-new --no-fix-arm1176 --fix-v4bx-interworking -o $@ $<
2fd9ae7a
DK
3418
3419arm_no_fix_v4bx.stdout: arm_no_fix_v4bx
3420 $(TEST_OBJDUMP) -D -j.text $< > $@
3421
d3bbad62 3422arm_no_fix_v4bx: arm_fix_v4bx.o ../ld-new
a8e2273b 3423 ../ld-new --no-fix-arm1176 -o $@ $<
2fd9ae7a
DK
3424
3425MOSTLYCLEANFILES += arm_fix_v4bx arm_fix_v4bx_interworking arm_no_fix_v4bx
3426
da59ad79
DK
3427check_SCRIPTS += arm_attr_merge.sh
3428check_DATA += arm_attr_merge_6.stdout arm_attr_merge_6r.stdout \
3429 arm_attr_merge_7.stdout
3430
3431arm_attr_merge_6.stdout: arm_attr_merge_6
3432 $(TEST_READELF) -A $< > $@
3433
78d9f182 3434arm_attr_merge_6: arm_attr_merge_6a.o arm_attr_merge_6b.o ../ld-new
da59ad79
DK
3435 ../ld-new -o $@ arm_attr_merge_6a.o arm_attr_merge_6b.o
3436
3437arm_attr_merge_6a.o: arm_attr_merge_6a.s
3438 $(TEST_AS) -o $@ $<
3439
3440arm_attr_merge_6b.o: arm_attr_merge_6b.s
3441 $(TEST_AS) -o $@ $<
3442
3443arm_attr_merge_6r.stdout: arm_attr_merge_6r
3444 $(TEST_READELF) -A $< > $@
3445
78d9f182 3446arm_attr_merge_6r: arm_attr_merge_6b.o arm_attr_merge_6a.o ../ld-new
da59ad79
DK
3447 ../ld-new -o $@ arm_attr_merge_6b.o arm_attr_merge_6a.o
3448
3449arm_attr_merge_7.stdout: arm_attr_merge_7
3450 $(TEST_READELF) -A $< > $@
3451
78d9f182 3452arm_attr_merge_7: arm_attr_merge_7a.o arm_attr_merge_7b.o ../ld-new
da59ad79
DK
3453 ../ld-new -o $@ arm_attr_merge_7a.o arm_attr_merge_7b.o
3454
3455arm_attr_merge_7a.o: arm_attr_merge_7a.s
3456 $(TEST_AS) -o $@ $<
3457
3458arm_attr_merge_7b.o: arm_attr_merge_7b.s
3459 $(TEST_AS) -o $@ $<
3460
3461MOSTLYCLEANFILES += arm_attr_merge_6 arm_attr_merge_6r arm_attr_merge_7
3462
a8e2273b
ILT
3463# ARM1176 workaround test.
3464check_SCRIPTS += arm_fix_1176.sh
3465check_DATA += arm_fix_1176_default_v6z.stdout arm_fix_1176_on_v6z.stdout \
3466 arm_fix_1176_off_v6z.stdout arm_fix_1176_default_v5te.stdout \
3467 arm_fix_1176_default_v7a.stdout arm_fix_1176_default_1156t2f_s.stdout
3468
3469arm_fix_1176_default_v6z.stdout: arm_fix_1176_default_v6z
3470 $(TEST_OBJDUMP) -D -j.foo $< > $@
3471
3472arm_fix_1176_default_v6z: arm_fix_1176_default_v6z.o ../ld-new
3473 ../ld-new --section-start=.foo=0x2001014 -o $@ $<
3474
3475arm_fix_1176_default_v6z.o: arm_fix_1176.s
3476 $(TEST_AS) -march=armv6z -o $@ $<
3477
3478arm_fix_1176_on_v6z.stdout: arm_fix_1176_on_v6z
3479 $(TEST_OBJDUMP) -D -j.foo $< > $@
3480
3481arm_fix_1176_on_v6z: arm_fix_1176_on_v6z.o ../ld-new
3482 ../ld-new --section-start=.foo=0x2001014 --fix-arm1176 -o $@ $<
3483
3484arm_fix_1176_on_v6z.o: arm_fix_1176.s
3485 $(TEST_AS) -march=armv6z -o $@ $<
3486
3487arm_fix_1176_off_v6z.stdout: arm_fix_1176_off_v6z
3488 $(TEST_OBJDUMP) -D -j.foo $< > $@
3489
3490arm_fix_1176_off_v6z: arm_fix_1176_off_v6z.o ../ld-new
3491 ../ld-new --section-start=.foo=0x2001014 --no-fix-arm1176 -o $@ $<
3492
3493arm_fix_1176_off_v6z.o: arm_fix_1176.s
3494 $(TEST_AS) -march=armv6z -o $@ $<
3495
3496arm_fix_1176_default_v5te.stdout: arm_fix_1176_default_v5te
3497 $(TEST_OBJDUMP) -D -j.foo $< > $@
3498
3499arm_fix_1176_default_v5te: arm_fix_1176_default_v5te.o ../ld-new
3500 ../ld-new --section-start=.foo=0x2001014 -o $@ $<
3501
3502arm_fix_1176_default_v5te.o: arm_fix_1176.s
3503 $(TEST_AS) -march=armv5te -o $@ $<
3504
3505arm_fix_1176_default_v7a.stdout: arm_fix_1176_default_v7a
3506 $(TEST_OBJDUMP) -D -j.foo $< > $@
3507
3508arm_fix_1176_default_v7a: arm_fix_1176_default_v7a.o ../ld-new
3509 ../ld-new --section-start=.foo=0x2001014 -o $@ $<
3510
3511arm_fix_1176_default_v7a.o: arm_fix_1176.s
3512 $(TEST_AS) -march=armv7-a -o $@ $<
3513
3514arm_fix_1176_default_1156t2f_s.stdout: arm_fix_1176_default_1156t2f_s
3515 $(TEST_OBJDUMP) -D -j.foo $< > $@
3516
3517arm_fix_1176_default_1156t2f_s: arm_fix_1176_default_1156t2f_s.o ../ld-new
3518 ../ld-new --section-start=.foo=0x2001014 -o $@ $<
3519
3520arm_fix_1176_default_1156t2f_s.o: arm_fix_1176.s
3521 $(TEST_AS) -mcpu=arm1156t2f-s -o $@ $<
3522
3523MOSTLYCLEANFILES += arm_fix_1176_default_v6z arm_fix_1176_on_v6z arm_fix_1176_off_v6z \
3524 arm_fix_1176_default_v5te arm_fix_1176_default_v7a arm_fix_1176_default_1156t2f_s
3525
aa98ff75
DK
3526# Cortex-A8 workaround test.
3527
3528check_SCRIPTS += arm_cortex_a8.sh
3529check_DATA += arm_cortex_a8_b_cond.stdout arm_cortex_a8_b.stdout \
3530 arm_cortex_a8_bl.stdout arm_cortex_a8_blx.stdout \
3531 arm_cortex_a8_local.stdout arm_cortex_a8_local_reloc.stdout
3532
3533arm_cortex_a8_b_cond.stdout: arm_cortex_a8_b_cond
3534 $(TEST_OBJDUMP) -D -j.text $< > $@
3535
3536arm_cortex_a8_b_cond: arm_cortex_a8_b_cond.o ../ld-new
3537 ../ld-new -o $@ $<
3538
3539arm_cortex_a8_b_cond.o: arm_cortex_a8_b_cond.s
3540 $(TEST_AS) -o $@ $<
3541
3542arm_cortex_a8_b.stdout: arm_cortex_a8_b
3543 $(TEST_OBJDUMP) -D -j.text $< > $@
3544
3545arm_cortex_a8_b: arm_cortex_a8_b.o ../ld-new
3546 ../ld-new --fix-cortex-a8 -o $@ $<
3547
3548arm_cortex_a8_b.o: arm_cortex_a8_b.s
3549 $(TEST_AS) -o $@ $<
3550
3551arm_cortex_a8_bl.stdout: arm_cortex_a8_bl
3552 $(TEST_OBJDUMP) -D -j.text $< > $@
3553
3554arm_cortex_a8_bl: arm_cortex_a8_bl.o ../ld-new
3555 ../ld-new -o $@ $<
3556
3557arm_cortex_a8_bl.o: arm_cortex_a8_bl.s
3558 $(TEST_AS) -o $@ $<
3559
3560arm_cortex_a8_blx.stdout: arm_cortex_a8_blx
3561 $(TEST_OBJDUMP) -D -j.text $< > $@
3562
3563arm_cortex_a8_blx: arm_cortex_a8_blx.o ../ld-new
3564 ../ld-new -o $@ $<
3565
3566arm_cortex_a8_blx.o: arm_cortex_a8_blx.s
3567 $(TEST_AS) -o $@ $<
3568
3569arm_cortex_a8_local.stdout: arm_cortex_a8_local
3570 $(TEST_OBJDUMP) -D -j.text $< > $@
3571
3572arm_cortex_a8_local: arm_cortex_a8_local.o ../ld-new
3573 ../ld-new -o $@ $<
3574
3575arm_cortex_a8_local.o: arm_cortex_a8_local.s
3576 $(TEST_AS) -o $@ $<
3577
3578arm_cortex_a8_local_reloc.stdout: arm_cortex_a8_local_reloc
3579 $(TEST_OBJDUMP) -D -j.text $< > $@
3580
3581arm_cortex_a8_local_reloc: arm_cortex_a8_local_reloc.o ../ld-new
3582 ../ld-new -o $@ $<
3583
3584arm_cortex_a8_local_reloc.o: arm_cortex_a8_local_reloc.s
3585 $(TEST_AS) -o $@ $<
3586
3587MOSTLYCLEANFILES += arm_cortex_a8_b_cond arm_cortex_a8_b arm_cortex_a8_bl \
3588 arm_cortex_a8_blx arm_cortex_a8_local arm_cortex_a8_local_reloc
3589
c87e4302
DK
3590check_SCRIPTS += arm_exidx_test.sh
3591check_DATA += arm_exidx_test.stdout
3592
3593arm_exidx_test.stdout: arm_exidx_test.so
647f1574 3594 $(TEST_READELF) -Sr $< > $@
c87e4302
DK
3595
3596arm_exidx_test.so: arm_exidx_test.o ../ld-new
3597 ../ld-new -shared -o $@ $<
3598
3599arm_exidx_test.o: arm_exidx_test.s
3600 $(TEST_AS) -o $@ $<
3601
f62a3ca7
DK
3602check_SCRIPTS += pr12826.sh
3603check_DATA += pr12826.stdout
3604
3605pr12826.stdout: pr12826.so
3606 $(TEST_READELF) -A $< > $@
3607
3608pr12826.so: pr12826_1.o pr12826_2.o ../ld-new
3609 ../ld-new -shared -o $@ $<
3610
3611pr12826_1.o: pr12826_1.s
3612 $(TEST_AS) -o $@ $<
3613
3614pr12826_2.o: pr12826_2.s
3615 $(TEST_AS) -o $@ $<
c87e4302 3616
f6cccc2c 3617check_SCRIPTS += arm_unaligned_reloc.sh
2c339f71 3618check_DATA += arm_unaligned_reloc.stdout arm_unaligned_reloc_r.stdout
f6cccc2c
DK
3619
3620arm_unaligned_reloc.stdout: arm_unaligned_reloc
3621 $(TEST_OBJDUMP) -D $< > $@
3622
2c339f71
DK
3623arm_unaligned_reloc_r.stdout: arm_unaligned_reloc_r
3624 $(TEST_OBJDUMP) -Dr $< > $@
3625
f6cccc2c
DK
3626arm_unaligned_reloc: arm_unaligned_reloc.o ../ld-new
3627 ../ld-new -o $@ $<
3628
2c339f71
DK
3629arm_unaligned_reloc_r: arm_unaligned_reloc.o ../ld-new
3630 ../ld-new -r -o $@ $<
3631
f6cccc2c
DK
3632arm_unaligned_reloc.o: arm_unaligned_reloc.s
3633 $(TEST_AS) -o $@ $<
3634
2c339f71 3635MOSTLYCLEANFILES += arm_unaligned_reloc arm_unaligned_reloc_r
f6cccc2c 3636
cd6eab1c
ILT
3637# Check ARM to ARM farcall veneers
3638
3639check_SCRIPTS += arm_farcall_arm_arm.sh
3640check_DATA += arm_farcall_arm_arm.stdout
3641
3642arm_farcall_arm_arm.stdout: arm_farcall_arm_arm
3643 $(TEST_OBJDUMP) -d $< > $@
3644
3645arm_farcall_arm_arm: arm_farcall_arm_arm.o ../ld-new
a8e2273b 3646 ../ld-new --no-fix-arm1176 --section-start .text=0x1000 --section-start .foo=0x2001020 -o $@ $<
cd6eab1c
ILT
3647
3648arm_farcall_arm_arm.o: arm_farcall_arm_arm.s
3649 $(TEST_AS) -o $@ $<
3650
3651MOSTLYCLEANFILES += arm_farcall_arm_arm
3652
3653# Check ARM to Thumb farcall veneers
3654
3655check_SCRIPTS += arm_farcall_arm_thumb.sh
3656check_DATA += arm_farcall_arm_thumb.stdout arm_farcall_arm_thumb_5t.stdout
3657
3658arm_farcall_arm_thumb.stdout: arm_farcall_arm_thumb
3659 $(TEST_OBJDUMP) -D $< > $@
3660
3661arm_farcall_arm_thumb: arm_farcall_arm_thumb.o ../ld-new
3662 ../ld-new --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
3663
3664arm_farcall_arm_thumb.o: arm_farcall_arm_thumb.s
3665 $(TEST_AS) -o $@ $<
3666
3667arm_farcall_arm_thumb_5t.stdout: arm_farcall_arm_thumb_5t
3668 $(TEST_OBJDUMP) -D $< > $@
3669
3670arm_farcall_arm_thumb_5t: arm_farcall_arm_thumb_5t.o ../ld-new
a8e2273b 3671 ../ld-new --no-fix-arm1176 --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
cd6eab1c
ILT
3672
3673arm_farcall_arm_thumb_5t.o: arm_farcall_arm_thumb.s
3674 $(TEST_AS) -march=armv5t -o $@ $<
3675
3676MOSTLYCLEANFILES += arm_farcall_arm_thumb arm_farcall_arm_thumb_5t
3677
3678# Check Thumb to Thumb farcall veneers
3679
3680check_SCRIPTS += arm_farcall_thumb_thumb.sh
3681check_DATA += arm_farcall_thumb_thumb.stdout \
3682 arm_farcall_thumb_thumb_5t.stdout \
3683 arm_farcall_thumb_thumb_7m.stdout \
3684 arm_farcall_thumb_thumb_6m.stdout
3685
3686arm_farcall_thumb_thumb.stdout: arm_farcall_thumb_thumb
3687 $(TEST_OBJDUMP) -D $< > $@
3688
3689arm_farcall_thumb_thumb: arm_farcall_thumb_thumb.o ../ld-new
3690 ../ld-new --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
3691
3692arm_farcall_thumb_thumb.o: arm_farcall_thumb_thumb.s
3693 $(TEST_AS) -march=armv4t -o $@ $<
3694
3695arm_farcall_thumb_thumb_5t.stdout: arm_farcall_thumb_thumb_5t
3696 $(TEST_OBJDUMP) -D $< > $@
3697
3698arm_farcall_thumb_thumb_5t: arm_farcall_thumb_thumb_5t.o ../ld-new
a8e2273b 3699 ../ld-new --no-fix-arm1176 --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
cd6eab1c
ILT
3700
3701arm_farcall_thumb_thumb_5t.o: arm_farcall_thumb_thumb.s
3702 $(TEST_AS) -march=armv5t -o $@ $<
3703
3704arm_farcall_thumb_thumb_7m.stdout: arm_farcall_thumb_thumb_7m
3705 $(TEST_OBJDUMP) -D $< > $@
3706
3707arm_farcall_thumb_thumb_7m: arm_farcall_thumb_thumb_7m.o ../ld-new
3708 ../ld-new --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
3709
3710arm_farcall_thumb_thumb_7m.o: arm_farcall_thumb_thumb.s
3711 $(TEST_AS) -march=armv7-m -o $@ $<
3712
3713arm_farcall_thumb_thumb_6m.stdout: arm_farcall_thumb_thumb_6m
3714 $(TEST_OBJDUMP) -D $< > $@
3715
3716arm_farcall_thumb_thumb_6m: arm_farcall_thumb_thumb_6m.o ../ld-new
3717 ../ld-new --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
3718
3719arm_farcall_thumb_thumb_6m.o: arm_farcall_thumb_thumb.s
3720 $(TEST_AS) -march=armv6-m -o $@ $<
3721
3722MOSTLYCLEANFILES += arm_farcall_thumb_thumb arm_farcall_thumb_thumb_5t \
3723 arm_farcall_thumb_thumb_7m arm_farcall_thumb_thumb_6m
3724
3725# Check Thumb to ARM farcall veneers
3726
3727check_SCRIPTS += arm_farcall_thumb_arm.sh
3728check_DATA += arm_farcall_thumb_arm.stdout \
3729 arm_farcall_thumb_arm_5t.stdout
3730
3731arm_farcall_thumb_arm.stdout: arm_farcall_thumb_arm
3732 $(TEST_OBJDUMP) -D $< > $@
3733
3734arm_farcall_thumb_arm: arm_farcall_thumb_arm.o ../ld-new
3735 ../ld-new --section-start .text=0x1c01010 --section-start .foo=0x2001014 -o $@ $<
3736
3737arm_farcall_thumb_arm.o: arm_farcall_thumb_arm.s
3738 $(TEST_AS) -o $@ $<
3739
3740arm_farcall_thumb_arm_5t.stdout: arm_farcall_thumb_arm_5t
3741 $(TEST_OBJDUMP) -D $< > $@
3742
3743arm_farcall_thumb_arm_5t: arm_farcall_thumb_arm_5t.o ../ld-new
a8e2273b 3744 ../ld-new --no-fix-arm1176 --section-start .text=0x1c01010 --section-start .foo=0x2001014 -o $@ $<
cd6eab1c
ILT
3745
3746arm_farcall_thumb_arm_5t.o: arm_farcall_thumb_arm.s
3747 $(TEST_AS) -march=armv5t -o $@ $<
3748
3749MOSTLYCLEANFILES += arm_farcall_thumb_arm arm_farcall_thumb_arm_5t
3750
bc99685c
DK
3751# Check handling of --target1-abs, --target1-rel and --target2 options
3752
3753check_SCRIPTS += arm_target1_abs.sh arm_target1_rel.sh \
3754 arm_target2_rel.sh arm_target2_abs.sh arm_target2_got_rel.sh
3755check_DATA += arm_target1_abs.stdout arm_target1_rel.stdout \
3756 arm_target2_rel.stdout arm_target2_abs.stdout arm_target2_got_rel.stdout
3757
3758arm_target1_abs.stdout: arm_target1_abs
3759 $(TEST_OBJDUMP) -s $< > $@
3760
3761arm_target1_abs: arm_target1.o ../ld-new
3762 ../ld-new --target1-abs --section-start .text=0x8000 -o $@ $<
3763
3764arm_target1_rel.stdout: arm_target1_rel
3765 $(TEST_OBJDUMP) -s $< > $@
3766
3767arm_target1_rel: arm_target1.o ../ld-new
3768 ../ld-new --target1-rel --section-start .text=0x8000 -o $@ $<
3769
3770arm_target1.o: arm_target1.s
3771 $(TEST_AS) -o $@ $<
3772
3773arm_target2_rel.stdout: arm_target2_rel
3774 $(TEST_OBJDUMP) -s $< > $@
3775
3776arm_target2_rel: arm_target2.o ../ld-new
3777 ../ld-new --target2=rel --section-start .text=0x8000 -o $@ $<
3778
3779arm_target2_abs.stdout: arm_target2_abs
3780 $(TEST_OBJDUMP) -s $< > $@
3781
3782arm_target2_abs: arm_target2.o ../ld-new
3783 ../ld-new --target2=abs --section-start .text=0x8000 -o $@ $<
3784
3785arm_target2_got_rel.stdout: arm_target2_got_rel
3786 $(TEST_OBJDUMP) -s $< > $@
3787
3788arm_target2_got_rel: arm_target2.o ../ld-new
3789 ../ld-new --target2=got-rel --section-start .text=0x8000 --section-start .got=0x9000 -o $@ $<
3790
3791arm_target2.o: arm_target2.s
3792 $(TEST_AS) -o $@ $<
3793
3794MOSTLYCLEANFILES += arm_target1_abs arm_target1_rel \
3795 arm_target2_rel arm_target2_abs arm_target2_got_rel
3796
ee7ef219
IK
3797# The test demonstrates why the constructor of a target object should not access options.
3798check_DATA += arm_target_lazy_init
3799MOSTLYCLEANFILES += arm_target_lazy_init
3800arm_target_lazy_init: arm_target_lazy_init.o arm_target_lazy_init.t ../ld-new
3801 ../ld-new -T $(srcdir)/arm_target_lazy_init.t -o $@ $<
3802arm_target_lazy_init.o: arm_target_lazy_init.s
3803 $(TEST_AS) -EL -o $@ $<
3804
e4782e83 3805endif DEFAULT_TARGET_ARM
eb373049 3806
5627d875
IK
3807if DEFAULT_TARGET_AARCH64
3808
3809check_SCRIPTS += aarch64_reloc_none.sh
3810check_DATA += aarch64_reloc_none.stdout
3811aarch64_reloc_none.o: aarch64_reloc_none.s
3812 $(TEST_AS) -o $@ $<
3813aarch64_reloc_none: aarch64_reloc_none.o ../ld-new
3814 ../ld-new -o $@ aarch64_reloc_none.o --gc-sections
3815aarch64_reloc_none.stdout: aarch64_reloc_none
3816 $(TEST_NM) $< > $@
3817
3818MOSTLYCLEANFILES += aarch64_reloc_none
3819
8769bc4b
HS
3820check_SCRIPTS += aarch64_relocs.sh
3821check_DATA += aarch64_relocs.stdout
3822aarch64_globals.o: aarch64_globals.s
3823 $(TEST_AS) -o $@ $<
3824aarch64_relocs.o: aarch64_relocs.s
3825 $(TEST_AS) -o $@ $<
3826aarch64_relocs: aarch64_relocs.o aarch64_globals.o ../ld-new
3827 ../ld-new -o $@ aarch64_relocs.o aarch64_globals.o -e0 --emit-relocs
3828aarch64_relocs.stdout: aarch64_relocs
3829 $(TEST_OBJDUMP) -dr $< > $@
3830
3831MOSTLYCLEANFILES += aarch64_relocs
3832
6bf56e74
IK
3833check_SCRIPTS += pr21430.sh
3834check_DATA += pr21430.stdout
3835pr21430.o: pr21430.s
3836 $(TEST_AS) -o $@ $<
3837pr21430: pr21430.o ../ld-new
3838 ../ld-new -o $@ $<
3839pr21430.stdout: pr21430
3840 $(TEST_NM) -S $< > $@
3841
3842MOSTLYCLEANFILES += pr21430
3843
cefdd1cd
IK
3844check_SCRIPTS += aarch64_tlsdesc.sh
3845check_DATA += aarch64_tlsdesc.stdout
3846aarch64_tlsdesc.o: aarch64_tlsdesc.s
3847 $(TEST_AS) -o $@ $<
3848aarch64_tlsdesc: aarch64_tlsdesc.o $(srcdir)/aarch64_tlsdesc.t ../ld-new
3849 ../ld-new $< -shared -T $(srcdir)/aarch64_tlsdesc.t -o $@
3850aarch64_tlsdesc.stdout: aarch64_tlsdesc
3851 $(TEST_OBJDUMP) -dR -j.text -j.got.plt $< > $@
3852
3853MOSTLYCLEANFILES += aarch64_tlsdesc
3854
5627d875
IK
3855endif DEFAULT_TARGET_AARCH64
3856
2b63aca3
MK
3857if DEFAULT_TARGET_S390
3858
3859check_SCRIPTS += split_s390.sh
3860check_DATA += split_s390_z1.stdout split_s390_z2.stdout split_s390_z3.stdout \
3861 split_s390_z4.stdout split_s390_n1.stdout split_s390_n2.stdout \
3862 split_s390_a1.stdout split_s390_a2.stdout split_s390_z1_ns.stdout \
3863 split_s390_z2_ns.stdout split_s390_z3_ns.stdout split_s390_z4_ns.stdout \
3864 split_s390_n1_ns.stdout split_s390_n2_ns.stdout split_s390_r.stdout \
3865 split_s390x_z1.stdout split_s390x_z2.stdout split_s390x_z3.stdout \
3866 split_s390x_z4.stdout split_s390x_n1.stdout split_s390x_n2.stdout \
3867 split_s390x_a1.stdout split_s390x_a2.stdout split_s390x_z1_ns.stdout \
3868 split_s390x_z2_ns.stdout split_s390x_z3_ns.stdout \
3869 split_s390x_z4_ns.stdout split_s390x_n1_ns.stdout \
3870 split_s390x_n2_ns.stdout split_s390x_r.stdout
3871SPLIT_DEFSYMS = --defsym __morestack=0x100 --defsym __morestack_non_split=0x200
3872split_s390_1_z1.o: split_s390_1_z1.s
3873 $(TEST_AS) -m31 -o $@ $<
3874split_s390_1_z2.o: split_s390_1_z2.s
3875 $(TEST_AS) -m31 -o $@ $<
3876split_s390_1_z3.o: split_s390_1_z3.s
3877 $(TEST_AS) -m31 -o $@ $<
3878split_s390_1_z4.o: split_s390_1_z4.s
3879 $(TEST_AS) -m31 -o $@ $<
3880split_s390_1_n1.o: split_s390_1_n1.s
3881 $(TEST_AS) -m31 -o $@ $<
3882split_s390_1_n2.o: split_s390_1_n2.s
3883 $(TEST_AS) -m31 -o $@ $<
3884split_s390_1_a1.o: split_s390_1_a1.s
3885 $(TEST_AS) -m31 -o $@ $<
3886split_s390_1_a2.o: split_s390_1_a2.s
3887 $(TEST_AS) -m31 -o $@ $<
3888split_s390_2_s.o: split_s390_2_s.s
3889 $(TEST_AS) -m31 -o $@ $<
3890split_s390_2_ns.o: split_s390_2_ns.s
3891 $(TEST_AS) -m31 -o $@ $<
3892split_s390_z1: split_s390_1_z1.o split_s390_2_s.o ../ld-new
3893 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_z1.o split_s390_2_s.o
3894split_s390_z1.stdout: split_s390_z1
3895 $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
3896split_s390_z2: split_s390_1_z2.o split_s390_2_s.o ../ld-new
3897 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_z2.o split_s390_2_s.o
3898split_s390_z2.stdout: split_s390_z2
3899 $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
3900split_s390_z3: split_s390_1_z3.o split_s390_2_s.o ../ld-new
3901 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_z3.o split_s390_2_s.o
3902split_s390_z3.stdout: split_s390_z3
3903 $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
3904split_s390_z4: split_s390_1_z4.o split_s390_2_s.o ../ld-new
3905 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_z4.o split_s390_2_s.o
3906split_s390_z4.stdout: split_s390_z4
3907 $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
3908split_s390_n1: split_s390_1_n1.o split_s390_2_s.o ../ld-new
3909 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_n1.o split_s390_2_s.o
3910split_s390_n1.stdout: split_s390_n1
3911 $(TEST_OBJDUMP) -d $< > $@
3912split_s390_n2: split_s390_1_n2.o split_s390_2_s.o ../ld-new
3913 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_n2.o split_s390_2_s.o
3914split_s390_n2.stdout: split_s390_n2
3915 $(TEST_OBJDUMP) -d $< > $@
3916split_s390_z1_ns: split_s390_1_z1.o split_s390_2_ns.o ../ld-new
3917 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_z1.o split_s390_2_ns.o
3918split_s390_z1_ns.stdout: split_s390_z1_ns
3919 $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
3920split_s390_z2_ns: split_s390_1_z2.o split_s390_2_ns.o ../ld-new
3921 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_z2.o split_s390_2_ns.o
3922split_s390_z2_ns.stdout: split_s390_z2_ns
3923 $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
3924split_s390_z3_ns: split_s390_1_z3.o split_s390_2_ns.o ../ld-new
3925 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_z3.o split_s390_2_ns.o
3926split_s390_z3_ns.stdout: split_s390_z3_ns
3927 $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
3928split_s390_z4_ns: split_s390_1_z4.o split_s390_2_ns.o ../ld-new
3929 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_z4.o split_s390_2_ns.o
3930split_s390_z4_ns.stdout: split_s390_z4_ns
3931 $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
3932split_s390_n1_ns: split_s390_1_n1.o split_s390_2_ns.o ../ld-new
3933 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_n1.o split_s390_2_ns.o
3934split_s390_n1_ns.stdout: split_s390_n1_ns
3935 $(TEST_OBJDUMP) -d $< > $@
3936split_s390_n2_ns.stdout: split_s390_1_n2.o split_s390_2_ns.o ../ld-new
3937 ../ld-new $(SPLIT_DEFSYMS) -o split_s390_n2 split_s390_1_n2.o split_s390_2_ns.o > $@ 2>&1 || exit 0
3938split_s390_a1.stdout: split_s390_1_a1.o split_s390_2_ns.o ../ld-new
3939 ../ld-new $(SPLIT_DEFSYMS) -o split_s390_a1 split_s390_1_a1.o split_s390_2_ns.o > $@ 2>&1 || exit 0
3940split_s390_a2: split_s390_1_a2.o split_s390_2_ns.o ../ld-new
3941 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_a2.o split_s390_2_ns.o
3942split_s390_a2.stdout: split_s390_a2
3943 $(TEST_OBJDUMP) -d $< > $@
3944split_s390_r.stdout: split_s390_1_z1.o split_s390_2_ns.o ../ld-new
3945 ../ld-new -r split_s390_1_z1.o split_s390_2_ns.o -o split_s390_r > $@ 2>&1 || exit 0
3946split_s390x_1_z1.o: split_s390x_1_z1.s
3947 $(TEST_AS) -m64 -o $@ $<
3948split_s390x_1_z2.o: split_s390x_1_z2.s
3949 $(TEST_AS) -m64 -o $@ $<
3950split_s390x_1_z3.o: split_s390x_1_z3.s
3951 $(TEST_AS) -m64 -o $@ $<
3952split_s390x_1_z4.o: split_s390x_1_z4.s
3953 $(TEST_AS) -m64 -o $@ $<
3954split_s390x_1_n1.o: split_s390x_1_n1.s
3955 $(TEST_AS) -m64 -o $@ $<
3956split_s390x_1_n2.o: split_s390x_1_n2.s
3957 $(TEST_AS) -m64 -o $@ $<
3958split_s390x_1_a1.o: split_s390x_1_a1.s
3959 $(TEST_AS) -m64 -o $@ $<
3960split_s390x_1_a2.o: split_s390x_1_a2.s
3961 $(TEST_AS) -m64 -o $@ $<
3962split_s390x_2_s.o: split_s390x_2_s.s
3963 $(TEST_AS) -m64 -o $@ $<
3964split_s390x_2_ns.o: split_s390x_2_ns.s
3965 $(TEST_AS) -m64 -o $@ $<
3966split_s390x_z1: split_s390x_1_z1.o split_s390x_2_s.o ../ld-new
3967 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_z1.o split_s390x_2_s.o
3968split_s390x_z1.stdout: split_s390x_z1
3969 $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
3970split_s390x_z2: split_s390x_1_z2.o split_s390x_2_s.o ../ld-new
3971 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_z2.o split_s390x_2_s.o
3972split_s390x_z2.stdout: split_s390x_z2
3973 $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
3974split_s390x_z3: split_s390x_1_z3.o split_s390x_2_s.o ../ld-new
3975 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_z3.o split_s390x_2_s.o
3976split_s390x_z3.stdout: split_s390x_z3
3977 $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
3978split_s390x_z4: split_s390x_1_z4.o split_s390x_2_s.o ../ld-new
3979 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_z4.o split_s390x_2_s.o
3980split_s390x_z4.stdout: split_s390x_z4
3981 $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
3982split_s390x_n1: split_s390x_1_n1.o split_s390x_2_s.o ../ld-new
3983 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_n1.o split_s390x_2_s.o
3984split_s390x_n1.stdout: split_s390x_n1
3985 $(TEST_OBJDUMP) -d $< > $@
3986split_s390x_n2: split_s390x_1_n2.o split_s390x_2_s.o ../ld-new
3987 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_n2.o split_s390x_2_s.o
3988split_s390x_n2.stdout: split_s390x_n2
3989 $(TEST_OBJDUMP) -d $< > $@
3990split_s390x_z1_ns: split_s390x_1_z1.o split_s390x_2_ns.o ../ld-new
3991 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_z1.o split_s390x_2_ns.o
3992split_s390x_z1_ns.stdout: split_s390x_z1_ns
3993 $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
3994split_s390x_z2_ns: split_s390x_1_z2.o split_s390x_2_ns.o ../ld-new
3995 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_z2.o split_s390x_2_ns.o
3996split_s390x_z2_ns.stdout: split_s390x_z2_ns
3997 $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
3998split_s390x_z3_ns: split_s390x_1_z3.o split_s390x_2_ns.o ../ld-new
3999 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_z3.o split_s390x_2_ns.o
4000split_s390x_z3_ns.stdout: split_s390x_z3_ns
4001 $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
4002split_s390x_z4_ns: split_s390x_1_z4.o split_s390x_2_ns.o ../ld-new
4003 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_z4.o split_s390x_2_ns.o
4004split_s390x_z4_ns.stdout: split_s390x_z4_ns
4005 $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
4006split_s390x_n1_ns: split_s390x_1_n1.o split_s390x_2_ns.o ../ld-new
4007 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_n1.o split_s390x_2_ns.o
4008split_s390x_n1_ns.stdout: split_s390x_n1_ns
4009 $(TEST_OBJDUMP) -d $< > $@
4010split_s390x_n2_ns.stdout: split_s390x_1_n2.o split_s390x_2_ns.o ../ld-new
4011 ../ld-new $(SPLIT_DEFSYMS) -o split_s390x_n2 split_s390x_1_n2.o split_s390x_2_ns.o > $@ 2>&1 || exit 0
4012split_s390x_a1.stdout: split_s390x_1_a1.o split_s390x_2_ns.o ../ld-new
4013 ../ld-new $(SPLIT_DEFSYMS) -o split_s390x_a1 split_s390x_1_a1.o split_s390x_2_ns.o > $@ 2>&1 || exit 0
4014split_s390x_a2: split_s390x_1_a2.o split_s390x_2_ns.o ../ld-new
4015 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_a2.o split_s390x_2_ns.o
4016split_s390x_a2.stdout: split_s390x_a2
4017 $(TEST_OBJDUMP) -d $< > $@
4018split_s390x_r.stdout: split_s390x_1_z1.o split_s390x_2_ns.o ../ld-new
4019 ../ld-new -r split_s390x_1_z1.o split_s390x_2_ns.o -o split_s390x_r > $@ 2>&1 || exit 0
4020MOSTLYCLEANFILES += split_s390_z1 split_s390_z2 split_s390_z3 \
4021 split_s390_z4 split_s390_n1 split_s390_n2 split_s390_a1 \
4022 split_s390_a2 split_s390_z1_ns split_s390_z2_ns split_s390_z3_ns \
4023 split_s390_z4_ns split_s390_n1_ns split_s390_n2_ns split_s390_r \
4024 split_s390x_z1 split_s390x_z2 split_s390x_z3 split_s390x_z4 \
4025 split_s390x_n1 split_s390x_n2 split_s390x_a1 split_s390x_a2 \
4026 split_s390x_z1_ns split_s390x_z2_ns split_s390x_z3_ns \
4027 split_s390x_z4_ns split_s390x_n1_ns split_s390x_n2_ns split_s390x_r
4028
4029endif DEFAULT_TARGET_S390
4030
eb373049
ILT
4031endif NATIVE_OR_CROSS_LINKER
4032
35c813e2
CC
4033# Tests for the dwp tool.
4034# We don't want to rely yet on GCC support for -gsplit-dwarf,
4035# so we use (for now) test cases in x86 assembly language,
4036# compiled from the dwp_test_*.cc sources.
4037
4038if DEFAULT_TARGET_X86_64
4039
4040dwp_test_main.o: dwp_test_main.s
4041 $(TEST_AS) -o $@ $<
4042dwp_test_1.o: dwp_test_1.s
4043 $(TEST_AS) -o $@ $<
4044dwp_test_1b.o: dwp_test_1b.s
4045 $(TEST_AS) -o $@ $<
4046dwp_test_2.o: dwp_test_2.s
4047 $(TEST_AS) -o $@ $<
4048
4049dwp_test_main.dwo: dwp_test_main.o
4050 $(TEST_OBJCOPY) --extract-dwo $< $@
4051dwp_test_1.dwo: dwp_test_1.o
4052 $(TEST_OBJCOPY) --extract-dwo $< $@
4053dwp_test_1b.dwo: dwp_test_1b.o
4054 $(TEST_OBJCOPY) --extract-dwo $< $@
4055dwp_test_2.dwo: dwp_test_2.o
4056 $(TEST_OBJCOPY) --extract-dwo $< $@
4057
0ec6429b 4058MOSTLYCLEANFILES += *.dwo *.dwp
35c813e2
CC
4059check_SCRIPTS += dwp_test_1.sh
4060check_DATA += dwp_test_1.stdout
4061dwp_test_1.stdout: dwp_test_1.dwp
4062 $(TEST_READELF) -wi $< > $@
4063dwp_test_1.dwp: ../dwp dwp_test_main.dwo dwp_test_1.dwo dwp_test_1b.dwo dwp_test_2.dwo
4064 ../dwp -o $@ dwp_test_main.dwo dwp_test_1.dwo dwp_test_1b.dwo dwp_test_2.dwo
4065
4066check_SCRIPTS += dwp_test_2.sh
4067check_DATA += dwp_test_2.stdout
4068dwp_test_2.stdout: dwp_test_2.dwp
4069 $(TEST_READELF) -wi $< > $@
4070dwp_test_2.dwp: ../dwp dwp_test_2a.dwp dwp_test_2b.dwp
4071 ../dwp -o $@ dwp_test_2a.dwp dwp_test_2b.dwp
4072dwp_test_2a.dwp: ../dwp dwp_test_main.dwo dwp_test_1.dwo
4073 ../dwp -o $@ dwp_test_main.dwo dwp_test_1.dwo
4074dwp_test_2b.dwp: ../dwp dwp_test_1b.dwo dwp_test_2.dwo
4075 ../dwp -o $@ dwp_test_1b.dwo dwp_test_2.dwo
4076
4077endif DEFAULT_TARGET_X86_64
This page took 0.875011 seconds and 4 git commands to generate.