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