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