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