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