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