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