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