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