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