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