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