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