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