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