Apply:
[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
918357b9
L
10# This is where we get zlib from. zlib is in ../../zlib unless we were
11# configured with --with-system-zlib, in which case ../../zlib either
12# doesn't exist or not configured.
13ZLIB = -L../../zlib -lz
14
f958d5fc 15# The two_file_test tests -fmerge-constants, so we simply always turn
2b64b551
RM
16# it on. For compilers that do not support the command-line option,
17# we assume they just always emit SHF_MERGE sections unconditionally.
18AM_CFLAGS = $(WARN_CFLAGS) $(LFS_CFLAGS) $(MERGE_CONSTANTS_FLAG)
19AM_CXXFLAGS = $(WARN_CXXFLAGS) $(LFS_CFLAGS) $(MERGE_CONSTANTS_FLAG)
5a6f7e2d 20
14ec8efd 21AM_CPPFLAGS = \
5a6f7e2d 22 -I$(srcdir) -I$(srcdir)/.. -I$(srcdir)/../../include \
155a0dd7 23 -I$(srcdir)/../../elfcpp -I.. \
5a6f7e2d
ILT
24 -DLOCALEDIR="\"$(datadir)/locale\"" \
25 @INCINTL@
26
ae447ddd
CC
27# Some versions of GCC now automatically enable linker plugins,
28# but we want to run our tests without GCC's plugins.
29if HAVE_NO_USE_LINKER_PLUGIN
30OPT_NO_PLUGINS = -fno-use-linker-plugin
31endif
32
aa543512
L
33# COMPILE1, LINK1, CXXCOMPILE1, CXXLINK1 are renamed from COMPILE, LINK,
34# CXXCOMPILE and CXXLINK generated by automake 1.11.1. FIXME: they should
35# be updated if they are different from automake used by gold.
36COMPILE1 = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
37 $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
ae447ddd
CC
38LINK1 = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(OPT_NO_PLUGINS) \
39 $(AM_LDFLAGS) $(LDFLAGS) -o $@
aa543512
L
40CXXCOMPILE1 = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
41 $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
ae447ddd
CC
42CXXLINK1 = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(OPT_NO_PLUGINS) \
43 $(AM_LDFLAGS) $(LDFLAGS) -o $@
aa543512 44
ae447ddd 45# Strip out -Wp,-D_FORTIFY_SOURCE=, which is irrelevant for the gold
aa543512
L
46# testsuite and incompatible with -O0 used in gold tests, from
47# COMPILE, LINK, CXXCOMPILE and CXXLINK.
48COMPILE = `echo $(COMPILE1) | sed -e 's/-Wp,-D_FORTIFY_SOURCE=[0-9[0-9]]*//'`
49LINK = `echo $(LINK1) | sed -e 's/-Wp,-D_FORTIFY_SOURCE=[0-9][0-9]*//'`
50CXXCOMPILE = `echo $(CXXCOMPILE1) | sed -e 's/-Wp,-D_FORTIFY_SOURCE=[0-9][0-9]*//'`
51CXXLINK = `echo $(CXXLINK1) | sed -e 's/-Wp,-D_FORTIFY_SOURCE=[0-9][0-9]*//'`
52
3d587466
CC
53# Strip out -static-libgcc and -static-libstdc++ options, for tests
54# that must have these libraries linked dynamically. The -shared-libgcc
55# option does not work correctly, and there is no -shared-libstdc++ option.
56# (See GCC PR 55781 and PR 55782.)
57CXXLINK_S = `echo $(CXXLINK1) | sed -e 's/-static-lib\\(gcc\\|stdc++\\)//g'`
58
6835af53
ILT
59TEST_READELF = $(top_builddir)/../binutils/readelf
60TEST_OBJDUMP = $(top_builddir)/../binutils/objdump
35c813e2 61TEST_OBJCOPY = $(top_builddir)/../binutils/objcopy
6835af53
ILT
62TEST_CXXFILT = $(top_builddir)/../binutils/cxxfilt
63TEST_STRIP = $(top_builddir)/../binutils/strip-new
fbd8a257 64TEST_AR = $(top_builddir)/../binutils/ar
531813ad 65TEST_NM = $(top_builddir)/../binutils/nm-new
364c7fa5 66TEST_AS = $(top_builddir)/../gas/as-new
6835af53 67
89fc3421
CC
68if PLUGINS
69LIBDL = -ldl
70endif
71
fe9a4c12
ILT
72if THREADS
73THREADSLIB = -lpthread
74endif
75
155a0dd7
ILT
76if OMP_SUPPORT
77TLS_TEST_C_CFLAGS = -fopenmp
78endif
79
351a8000
ILT
80# 'make clean' is good about deleting some intermediate files (such as
81# .o's), but not all of them (such as .so's and .err files). We
82# improve on that here. automake-1.9 info docs say "mostlyclean" is
83# the right choice for files 'make' builds that people rebuild.
72fef11a 84MOSTLYCLEANFILES = *.so *.syms *.stdout
6eee141f 85
9df9de2c
CC
86# Export make variables to the shell scripts so that they can see
87# (for example) DEFAULT_TARGET.
88.EXPORT_ALL_VARIABLES:
2b64b551 89
351a8000
ILT
90# We will add to these later, for each individual test. Note
91# that we add each test under check_SCRIPTS or check_PROGRAMS;
92# the TESTS variable is automatically populated from these.
93check_SCRIPTS =
94check_DATA =
95check_PROGRAMS =
d491d34e
ILT
96BUILT_SOURCES =
97
351a8000 98TESTS = $(check_SCRIPTS) $(check_PROGRAMS)
22dc1b09 99
351a8000
ILT
100# ---------------------------------------------------------------------
101# These tests test the internals of gold (unittests).
5a6f7e2d 102
351a8000 103# Infrastucture needed for the unittests
5a6f7e2d
ILT
104check_LIBRARIES = libgoldtest.a
105libgoldtest_a_SOURCES = test.cc testmain.cc testfile.cc
106
ad2d6943
ILT
107DEPENDENCIES = \
108 libgoldtest.a ../libgold.a ../../libiberty/libiberty.a $(LIBINTL_DEP)
fe9a4c12 109LDADD = libgoldtest.a ../libgold.a ../../libiberty/libiberty.a $(LIBINTL) \
918357b9 110 $(THREADSLIB) $(LIBDL) $(ZLIB)
5a6f7e2d 111
5a6f7e2d 112
351a8000 113# The unittests themselves
eb373049 114if NATIVE_OR_CROSS_LINKER
90e24de5
ILT
115if GCC
116
117# Infrastucture needed for the unittests: a directory where the linker
118# is named 'ld'. This is because the -B flag appends 'ld' to its arg.
119gcctestdir/ld: ../ld-new
120 test -d gcctestdir || mkdir -p gcctestdir
121 rm -f gcctestdir/ld
122 (cd gcctestdir && $(LN_S) ../../ld-new ld)
123
472076e4
CC
124# Some tests require the latest features of an in-tree assembler.
125gcctestdir/as: $(TEST_AS)
126 test -d gcctestdir || mkdir -p gcctestdir
127 rm -f gcctestdir/as
128 (cd gcctestdir && $(LN_S) $(abs_top_builddir)/../gas/as-new as)
129
90e24de5
ILT
130endif GCC
131
351a8000 132check_PROGRAMS += object_unittest
5a6f7e2d 133object_unittest_SOURCES = object_unittest.cc
22dc1b09 134
bc644c6c
ILT
135check_PROGRAMS += binary_unittest
136binary_unittest_SOURCES = binary_unittest.cc
137
c2c7840a
CC
138check_PROGRAMS += leb128_unittest
139leb128_unittest_SOURCES = leb128_unittest.cc
140
44803b5d
CC
141check_PROGRAMS += overflow_unittest
142overflow_unittest_SOURCES = overflow_unittest.cc
143overflow_unittest.o: overflow_unittest.cc
144 $(CXXCOMPILE) -O3 -c -o $@ $<
145
eb373049 146endif NATIVE_OR_CROSS_LINKER
351a8000
ILT
147
148# ---------------------------------------------------------------------
149# These tests test the output of gold (end-to-end tests). In
150# particular, they make sure that gold can link "difficult" object
151# files, and the resulting object files run correctly. These can only
152# run if we've built ld-new for the native architecture (that is,
153# we're not cross-compiling it), since we run ld-new as part of these
154# tests. We use the gcc-specific flag '-B' to use our linker instead
155# of the default linker, which is why we only run our tests under gcc.
a360aedd 156
e2827e5f 157if NATIVE_LINKER
351a8000 158if GCC
e2827e5f 159
351a8000
ILT
160# Each of these .o's is a useful, small complete program. They're
161# particularly useful for making sure ld-new's flags do what they're
162# supposed to (hence their names), but are used for many tests that
163# don't actually involve analyzing input data.
43771f76
ILT
164flagstest_debug.o: constructor_test.cc
165 $(CXXCOMPILE) -O0 -g -c -o $@ $<
166flagstest_ndebug.o: constructor_test.cc
167 $(CXXCOMPILE) -O0 -c -o $@ $<
168
325e6408
RÁE
169check_SCRIPTS += incremental_test.sh
170check_DATA += incremental_test.stdout
0ec6429b 171MOSTLYCLEANFILES += incremental_test incremental_test.cmdline
325e6408
RÁE
172incremental_test_1.o: incremental_test_1.c
173 $(COMPILE) -O0 -c -ffunction-sections -g -o $@ $<
174incremental_test_2.o: incremental_test_2.c
175 $(COMPILE) -O0 -c -ffunction-sections -g -o $@ $<
176incremental_test: incremental_test_1.o incremental_test_2.o gcctestdir/ld
943c8b43 177 $(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
178incremental_test.stdout: incremental_test ../incremental-dump
179 ../incremental-dump incremental_test > $@
43771f76 180
531813ad
ST
181check_SCRIPTS += gc_comdat_test.sh
182check_DATA += gc_comdat_test.stdout
72fef11a 183MOSTLYCLEANFILES += gc_comdat_test
2b64b551 184gc_comdat_test_1.o: gc_comdat_test_1.cc
4daadc0d 185 $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
2b64b551 186gc_comdat_test_2.o: gc_comdat_test_2.cc
4daadc0d 187 $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
531813ad 188gc_comdat_test: gc_comdat_test_1.o gc_comdat_test_2.o gcctestdir/ld
4daadc0d 189 $(CXXLINK) -Bgcctestdir/ -Wl,--gc-sections gc_comdat_test_1.o gc_comdat_test_2.o
531813ad
ST
190gc_comdat_test.stdout: gc_comdat_test
191 $(TEST_NM) -C gc_comdat_test > gc_comdat_test.stdout
192
27721062
ST
193check_SCRIPTS += gc_tls_test.sh
194check_DATA += gc_tls_test.stdout
72fef11a 195MOSTLYCLEANFILES += gc_tls_test
27721062
ST
196gc_tls_test.o: gc_tls_test.cc
197 $(CXXCOMPILE) -O0 -c -g -o $@ $<
198gc_tls_test:gc_tls_test.o gcctestdir/ld
199 $(CXXLINK) -Bgcctestdir/ -Wl,--gc-sections gc_tls_test.o
200gc_tls_test.stdout: gc_tls_test
201 $(TEST_NM) -C gc_tls_test > gc_tls_test.stdout
202
f1ec9ded
ST
203check_SCRIPTS += gc_orphan_section_test.sh
204check_DATA += gc_orphan_section_test.stdout
205MOSTLYCLEANFILES += gc_orphan_section_test
206gc_orphan_section_test.o: gc_orphan_section_test.cc
207 $(CXXCOMPILE) -O0 -c -g -o $@ $<
208gc_orphan_section_test:gc_orphan_section_test.o gcctestdir/ld
209 $(CXXLINK) -Bgcctestdir/ -Wl,--gc-sections gc_orphan_section_test.o
210gc_orphan_section_test.stdout: gc_orphan_section_test
211 $(TEST_NM) gc_orphan_section_test > gc_orphan_section_test.stdout
212
b9b2ae8b
NC
213check_SCRIPTS += pr14265.sh
214check_DATA += pr14265.stdout
215MOSTLYCLEANFILES += pr14265
216pr14265.o: pr14265.c
217 $(COMPILE) -O0 -c -o $@ $<
78d9f182 218pr14265: pr14265.o gcctestdir/ld $(srcdir)/pr14265.t
1496b446 219 $(LINK) -Bgcctestdir/ -Wl,--gc-sections -Wl,-T,$(srcdir)/pr14265.t -o $@ $<
b9b2ae8b
NC
220pr14265.stdout: pr14265
221 $(TEST_NM) --format=bsd --numeric-sort $< > $@
222
cc90de49
IK
223check_SCRIPTS += pr20717.sh
224check_DATA += pr20717.stdout
225MOSTLYCLEANFILES += pr20717
226pr20717.o: pr20717.c
227 $(COMPILE) -O0 -ffunction-sections -c -o $@ $<
228pr20717: pr20717.o gcctestdir/ld $(srcdir)/pr20717.t
229 $(LINK) -Bgcctestdir/ -Wl,--gc-sections -Wl,-T,$(srcdir)/pr20717.t -o $@ $<
230pr20717.stdout: pr20717
231 $(TEST_NM) $< > $@
232
fd834e57
CC
233check_SCRIPTS += gc_dynamic_list_test.sh
234check_DATA += gc_dynamic_list_test.stdout
235MOSTLYCLEANFILES += gc_dynamic_list_test
236gc_dynamic_list_test.o: gc_dynamic_list_test.c
237 $(COMPILE) -c -ffunction-sections -o $@ $<
238gc_dynamic_list_test: gc_dynamic_list_test.o gcctestdir/ld $(srcdir)/gc_dynamic_list_test.t
239 $(LINK) -Bgcctestdir/ -Wl,--gc-sections -Wl,--dynamic-list,$(srcdir)/gc_dynamic_list_test.t gc_dynamic_list_test.o
240gc_dynamic_list_test.stdout: gc_dynamic_list_test
241 $(TEST_NM) gc_dynamic_list_test > $@
242
ef15dade 243check_SCRIPTS += icf_test.sh
4d9aa155
AM
244check_DATA += icf_test.map
245MOSTLYCLEANFILES += icf_test icf_test.map
2b64b551 246icf_test.o: icf_test.cc
ef15dade 247 $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
54de2ea6 248icf_test: icf_test.o gcctestdir/ld
4d9aa155 249 $(CXXLINK) -o icf_test -Bgcctestdir/ -Wl,--icf=all,-Map,icf_test.map icf_test.o
54de2ea6
CC
250icf_test.map: icf_test
251 @touch icf_test.map
ef15dade 252
48c187ce
ST
253check_SCRIPTS += icf_keep_unique_test.sh
254check_DATA += icf_keep_unique_test.stdout
72fef11a 255MOSTLYCLEANFILES += icf_keep_unique_test
48c187ce
ST
256icf_keep_unique_test.o: icf_keep_unique_test.cc
257 $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
258icf_keep_unique_test: icf_keep_unique_test.o gcctestdir/ld
032ce4e9 259 $(CXXLINK) -Bgcctestdir/ -Wl,--icf=all -Wl,--keep-unique,_Z11unique_funcv icf_keep_unique_test.o
48c187ce 260icf_keep_unique_test.stdout: icf_keep_unique_test
4d9aa155 261 $(TEST_NM) -C $< > $@
531813ad 262
032ce4e9 263check_SCRIPTS += icf_safe_test.sh
4d9aa155
AM
264check_DATA += icf_safe_test_1.stdout icf_safe_test_2.stdout icf_safe_test.map
265MOSTLYCLEANFILES += icf_safe_test icf_safe_test.map
21bb3914 266icf_safe_test.o: icf_safe_test.cc
032ce4e9 267 $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
54de2ea6 268icf_safe_test: icf_safe_test.o gcctestdir/ld
4d9aa155 269 $(CXXLINK) -o icf_safe_test -Bgcctestdir/ -Wl,--icf=safe,-Map,icf_safe_test.map icf_safe_test.o
54de2ea6
CC
270icf_safe_test.map: icf_safe_test
271 @touch icf_safe_test.map
21bb3914 272icf_safe_test_1.stdout: icf_safe_test
4d9aa155 273 $(TEST_NM) $< > $@
21bb3914 274icf_safe_test_2.stdout: icf_safe_test
4d9aa155 275 $(TEST_READELF) -h $< > $@
21bb3914 276
4aebb631
RC
277check_SCRIPTS += icf_safe_pie_test.sh
278check_DATA += icf_safe_pie_test_1.stdout icf_safe_pie_test_2.stdout icf_safe_pie_test.map
279MOSTLYCLEANFILES += icf_safe_pie_test icf_safe_pie_test.map
280icf_safe_pie_test.o: icf_safe_test.cc
281 $(CXXCOMPILE) -O0 -c -ffunction-sections -fPIE -g -o $@ $<
282icf_safe_pie_test: icf_safe_pie_test.o gcctestdir/ld
283 $(CXXLINK) -o icf_safe_pie_test -Bgcctestdir/ -Wl,--icf=safe,-Map,icf_safe_pie_test.map icf_safe_pie_test.o -pie
284icf_safe_pie_test.map: icf_safe_pie_test
285 @touch icf_safe_pie_test.map
286icf_safe_pie_test_1.stdout: icf_safe_pie_test
287 $(TEST_NM) $< > $@
288icf_safe_pie_test_2.stdout: icf_safe_pie_test
289 $(TEST_READELF) -h $< > $@
290
21bb3914 291check_SCRIPTS += icf_safe_so_test.sh
4d9aa155
AM
292check_DATA += icf_safe_so_test_1.stdout icf_safe_so_test_2.stdout icf_safe_so_test.map
293MOSTLYCLEANFILES += icf_safe_so_test icf_safe_so_test.map
21bb3914
ST
294icf_safe_so_test.o: icf_safe_so_test.cc
295 $(CXXCOMPILE) -O0 -c -ffunction-sections -fPIC -g -o $@ $<
54de2ea6 296icf_safe_so_test: icf_safe_so_test.o gcctestdir/ld
4d9aa155 297 $(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
298icf_safe_so_test.map:
299 @touch icf_safe_so_test.map
21bb3914 300icf_safe_so_test_1.stdout: icf_safe_so_test
4d9aa155 301 $(TEST_NM) $< > $@
21bb3914 302icf_safe_so_test_2.stdout: icf_safe_so_test
4d9aa155 303 $(TEST_READELF) -h $< > $@
032ce4e9 304
6e9ba2ca
ST
305check_SCRIPTS += final_layout.sh
306check_DATA += final_layout.stdout
9e9143bc 307MOSTLYCLEANFILES += final_layout final_layout_sequence.txt final_layout_script.lds
6e9ba2ca
ST
308final_layout.o: final_layout.cc
309 $(CXXCOMPILE) -O0 -c -ffunction-sections -fdata-sections -g -o $@ $<
310final_layout_sequence.txt:
311 (echo "*_Z3barv*" && echo ".text._Z3bazv" && echo "*_Z3foov*" && echo "*global_varb*" && echo "*global_vara*" && echo "*global_varc*") > final_layout_sequence.txt
9e9143bc 312final_layout_script.lds:
a39e4af6 313 (echo "SECTIONS { .text : { *(.text*) } .got : { *(.got .toc) } .sbss : { *(.sbss*) } .bss : { *(.bss*) } }") > final_layout_script.lds
9e9143bc
ST
314final_layout: final_layout.o final_layout_sequence.txt final_layout_script.lds gcctestdir/ld
315 $(CXXLINK) -Bgcctestdir/ -Wl,--section-ordering-file,final_layout_sequence.txt -Wl,-T,final_layout_script.lds final_layout.o
6e9ba2ca 316final_layout.stdout: final_layout
864a1b56 317 $(TEST_NM) -n --synthetic final_layout > final_layout.stdout
6e9ba2ca 318
28f2a4ac 319check_SCRIPTS += text_section_grouping.sh
c6ac678d
ST
320check_DATA += text_section_grouping.stdout text_section_no_grouping.stdout
321MOSTLYCLEANFILES += text_section_grouping text_section_no_grouping
28f2a4ac
ST
322text_section_grouping.o: text_section_grouping.cc
323 $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
324text_section_grouping: text_section_grouping.o gcctestdir/ld
325 $(CXXLINK) -Bgcctestdir/ text_section_grouping.o
c6ac678d
ST
326text_section_no_grouping: text_section_grouping.o gcctestdir/ld
327 $(CXXLINK) -Bgcctestdir/ -Wl,--no-text-reorder text_section_grouping.o
28f2a4ac 328text_section_grouping.stdout: text_section_grouping
c6ac678d
ST
329 $(TEST_NM) -n --synthetic text_section_grouping > text_section_grouping.stdout
330text_section_no_grouping.stdout: text_section_no_grouping
2b64b551 331 $(TEST_NM) -n --synthetic text_section_no_grouping > text_section_no_grouping.stdout
28f2a4ac 332
6934001a
CC
333check_SCRIPTS += section_sorting_name.sh
334check_DATA += section_sorting_name.stdout
335MOSTLYCLEANFILES += section_sorting_name
336section_sorting_name.o: section_sorting_name.cc
337 $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
338section_sorting_name: section_sorting_name.o gcctestdir/ld
339 $(CXXLINK) -Bgcctestdir/ -Wl,--sort-section=name section_sorting_name.o
340section_sorting_name.stdout: section_sorting_name
341 $(TEST_NM) -n --synthetic section_sorting_name > section_sorting_name.stdout
342
3b4190cc
ST
343check_SCRIPTS += text_unlikely_segment.sh
344check_DATA += text_unlikely_segment_readelf.stdout
345MOSTLYCLEANFILES += text_unlikely_segment
346text_unlikely_segment.o: text_unlikely_segment.cc
347 $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
348text_unlikely_segment: text_unlikely_segment.o gcctestdir/ld
349 $(CXXLINK) -Bgcctestdir/ -Wl,-z,text-unlikely-segment text_unlikely_segment.o
350text_unlikely_segment_readelf.stdout: text_unlikely_segment
351 $(TEST_READELF) -Wl $< >$@
352
2253bfba 353check_PROGRAMS += icf_virtual_function_folding_test
0ec6429b 354MOSTLYCLEANFILES += icf_virtual_function_folding_test icf_virtual_function_folding_test.map
ce97fa81
ST
355icf_virtual_function_folding_test.o: icf_virtual_function_folding_test.cc
356 $(CXXCOMPILE) -O0 -c -ffunction-sections -fPIE -g -o $@ $<
357icf_virtual_function_folding_test: icf_virtual_function_folding_test.o gcctestdir/ld
358 $(CXXLINK) -Bgcctestdir/ -Wl,--icf=all icf_virtual_function_folding_test.o -pie
359
360check_SCRIPTS += icf_preemptible_functions_test.sh
361check_DATA += icf_preemptible_functions_test.stdout
362MOSTLYCLEANFILES += icf_preemptible_functions_test
363icf_preemptible_functions_test.o: icf_preemptible_functions_test.cc
364 $(CXXCOMPILE) -O0 -c -ffunction-sections -fPIC -g -o $@ $<
365icf_preemptible_functions_test: icf_preemptible_functions_test.o gcctestdir/ld
366 $(CXXLINK) -Bgcctestdir/ -Wl,--icf=all icf_preemptible_functions_test.o -fPIC -shared
367icf_preemptible_functions_test.stdout: icf_preemptible_functions_test
368 $(TEST_NM) icf_preemptible_functions_test > icf_preemptible_functions_test.stdout
369
370check_SCRIPTS += icf_string_merge_test.sh
371check_DATA += icf_string_merge_test.stdout
372MOSTLYCLEANFILES += icf_string_merge_test
373icf_string_merge_test.o: icf_string_merge_test.cc
374 $(CXXCOMPILE) -O0 -c -ffunction-sections -fPIC -g -o $@ $<
375icf_string_merge_test: icf_string_merge_test.o gcctestdir/ld
376 $(CXXLINK) -Bgcctestdir/ -Wl,--icf=all icf_string_merge_test.o
377icf_string_merge_test.stdout: icf_string_merge_test
378 $(TEST_NM) icf_string_merge_test > icf_string_merge_test.stdout
379
41cbeecc
ST
380check_SCRIPTS += icf_sht_rel_addend_test.sh
381check_DATA += icf_sht_rel_addend_test.stdout
382MOSTLYCLEANFILES += icf_sht_rel_addend_test
383icf_sht_rel_addend_test_1.o: icf_sht_rel_addend_test_1.cc
384 $(CXXCOMPILE) -O0 -c -ffunction-sections -fPIC -g -o $@ $<
385icf_sht_rel_addend_test_2.o: icf_sht_rel_addend_test_2.cc
386 $(CXXCOMPILE) -O0 -c -ffunction-sections -fPIC -g -o $@ $<
387icf_sht_rel_addend_test: icf_sht_rel_addend_test_1.o icf_sht_rel_addend_test_2.o gcctestdir/ld
388 $(CXXLINK) -Bgcctestdir/ -Wl,--icf=all icf_sht_rel_addend_test_1.o icf_sht_rel_addend_test_2.o
389icf_sht_rel_addend_test.stdout: icf_sht_rel_addend_test
390 $(TEST_NM) icf_sht_rel_addend_test > icf_sht_rel_addend_test.stdout
391
7fb47cc9
CC
392check_PROGRAMS += large_symbol_alignment
393large_symbol_alignment_SOURCES = large_symbol_alignment.cc
394large_symbol_alignment_DEPENDENCIES = gcctestdir/ld
395large_symbol_alignment_LDFLAGS = -Bgcctestdir/
54de2ea6 396large_symbol_alignment_LDADD =
7fb47cc9 397
e31908b6
CC
398check_SCRIPTS += merge_string_literals.sh
399check_DATA += merge_string_literals.stdout
400MOSTLYCLEANFILES += merge_string_literals
2b64b551 401merge_string_literals_1.o: merge_string_literals_1.cc
e31908b6 402 $(CXXCOMPILE) -O2 -c -fPIC -g -o $@ $<
2b64b551 403merge_string_literals_2.o: merge_string_literals_2.cc
e31908b6
CC
404 $(CXXCOMPILE) -O2 -c -fPIC -g -o $@ $<
405merge_string_literals: merge_string_literals_1.o merge_string_literals_2.o gcctestdir/ld
406 $(CXXLINK) -Bgcctestdir/ merge_string_literals_1.o merge_string_literals_2.o -O2 -shared -nostdlib
407merge_string_literals.stdout: merge_string_literals
408 $(TEST_OBJDUMP) -s -j.rodata merge_string_literals > merge_string_literals.stdout
409
351a8000 410check_PROGRAMS += basic_test
351a8000 411check_PROGRAMS += basic_pic_test
56ba9a23 412basic_test.o: basic_test.cc
22dc1b09 413 $(CXXCOMPILE) -O0 -c -o $@ $<
56ba9a23
ILT
414basic_test: basic_test.o gcctestdir/ld
415 $(CXXLINK) -Bgcctestdir/ basic_test.o
328c7c2f 416
cfbf0e3c
RÁE
417check_PROGRAMS += eh_test
418eh_test_a.o: eh_test_a.cc
419 $(CXXCOMPILE) -O0 -c -o $@ $<
420eh_test_b.o: eh_test_b.cc
421 $(CXXCOMPILE) -O0 -c -o $@ $<
422eh_test: eh_test_a.o eh_test_b.o gcctestdir/ld
423 $(CXXLINK_S) -Bgcctestdir/ eh_test_a.o eh_test_b.o
424
698400bf
CC
425check_SCRIPTS += eh_test_2.sh
426check_DATA += eh_test_2.sects
8db8e694 427MOSTLYCLEANFILES += eh_test_2 eh_test_2.sects
698400bf
CC
428eh_test_r.o: eh_test_a.o eh_test_b.o gcctestdir/ld
429 gcctestdir/ld -r -o $@ eh_test_a.o eh_test_b.o
430eh_test_2: eh_test_r.o gcctestdir/ld
431 $(CXXLINK_S) -Bgcctestdir/ -Wl,--eh-frame-hdr eh_test_r.o
432eh_test_2.sects: eh_test_2
433 $(TEST_READELF) -SW $< >$@ 2>/dev/null
434
328c7c2f
ILT
435if HAVE_STATIC
436check_PROGRAMS += basic_static_test
56ba9a23
ILT
437basic_static_test: basic_test.o gcctestdir/ld
438 $(CXXLINK) -Bgcctestdir/ -static basic_test.o
328c7c2f 439endif
22dc1b09 440
56ba9a23 441basic_pic_test.o: basic_test.cc
22dc1b09 442 $(CXXCOMPILE) -O0 -c -fpic -o $@ $<
56ba9a23
ILT
443basic_pic_test: basic_pic_test.o gcctestdir/ld
444 $(CXXLINK) -Bgcctestdir/ basic_pic_test.o
328c7c2f
ILT
445
446if HAVE_STATIC
447check_PROGRAMS += basic_static_pic_test
56ba9a23
ILT
448basic_static_pic_test: basic_pic_test.o gcctestdir/ld
449 $(CXXLINK) -Bgcctestdir/ -static basic_pic_test.o
328c7c2f 450endif
22dc1b09 451
374ad285
ILT
452check_PROGRAMS += basic_pie_test
453basic_pie_test.o: basic_test.cc
454 $(CXXCOMPILE) -O0 -c -fpie -o $@ $<
455basic_pie_test: basic_pie_test.o gcctestdir/ld
456 $(CXXLINK) -Bgcctestdir/ -pie basic_pie_test.o
351a8000
ILT
457
458check_PROGRAMS += constructor_test
d5026652
ILT
459constructor_test_SOURCES = constructor_test.cc
460constructor_test_DEPENDENCIES = gcctestdir/ld
461constructor_test_LDFLAGS = -Bgcctestdir/
1abce4a6 462constructor_test_LDADD =
d5026652 463
328c7c2f
ILT
464if HAVE_STATIC
465check_PROGRAMS += constructor_static_test
351a8000
ILT
466constructor_static_test_SOURCES = $(constructor_test_SOURCES)
467constructor_static_test_DEPENDENCIES = $(constructor_test_DEPENDENCIES)
468constructor_static_test_LDFLAGS = $(constructor_test_LDFLAGS) -static
1abce4a6 469constructor_static_test_LDADD = $(constructor_test_LDADD)
328c7c2f 470endif
351a8000
ILT
471
472check_PROGRAMS += two_file_test
351a8000 473check_PROGRAMS += two_file_pic_test
3bd52c28
ILT
474two_file_test_SOURCES = \
475 two_file_test_1.cc \
03e8f2b2 476 two_file_test_1b.cc \
3bd52c28
ILT
477 two_file_test_2.cc \
478 two_file_test_main.cc \
479 two_file_test.h
480two_file_test_DEPENDENCIES = gcctestdir/ld
481two_file_test_LDFLAGS = -Bgcctestdir/
1abce4a6 482two_file_test_LDADD =
3bd52c28 483
328c7c2f
ILT
484if HAVE_STATIC
485check_PROGRAMS += two_file_static_test
351a8000
ILT
486two_file_static_test_SOURCES = $(two_file_test_SOURCES)
487two_file_static_test_DEPENDENCIES = $(two_file_test_DEPENDENCIES)
488two_file_static_test_LDFLAGS = $(two_file_test_LDFLAGS) -static
1abce4a6 489two_file_static_test_LDADD = $(two_file_test_LDADD)
328c7c2f 490endif
f958d5fc
ILT
491
492two_file_pic_test_SOURCES = two_file_test_main.cc
493two_file_pic_test_DEPENDENCIES = \
03e8f2b2 494 gcctestdir/ld two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o
f958d5fc 495two_file_pic_test_LDFLAGS = -Bgcctestdir/
03e8f2b2 496two_file_pic_test_LDADD = two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o
f958d5fc 497
351a8000
ILT
498
499check_PROGRAMS += two_file_shared_1_test
500check_PROGRAMS += two_file_shared_2_test
501check_PROGRAMS += two_file_shared_1_pic_2_test
502check_PROGRAMS += two_file_shared_2_pic_1_test
503check_PROGRAMS += two_file_same_shared_test
504check_PROGRAMS += two_file_separate_shared_12_test
505check_PROGRAMS += two_file_separate_shared_21_test
506two_file_test_1_pic.o: two_file_test_1.cc
507 $(CXXCOMPILE) -c -fpic -o $@ $<
03e8f2b2
ILT
508two_file_test_1b_pic.o: two_file_test_1b.cc
509 $(CXXCOMPILE) -c -fpic -o $@ $<
351a8000
ILT
510two_file_test_2_pic.o: two_file_test_2.cc
511 $(CXXCOMPILE) -c -fpic -o $@ $<
03e8f2b2
ILT
512two_file_shared_1.so: two_file_test_1_pic.o two_file_test_1b_pic.o gcctestdir/ld
513 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1_pic.o two_file_test_1b_pic.o
351a8000
ILT
514two_file_shared_2.so: two_file_test_2_pic.o gcctestdir/ld
515 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_2_pic.o
03e8f2b2
ILT
516two_file_shared.so: two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o gcctestdir/ld
517 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o
351a8000 518
3bd52c28
ILT
519two_file_shared_1_test_SOURCES = two_file_test_2.cc two_file_test_main.cc
520two_file_shared_1_test_DEPENDENCIES = gcctestdir/ld two_file_shared_1.so
521two_file_shared_1_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
522two_file_shared_1_test_LDADD = two_file_shared_1.so
523
03e8f2b2 524two_file_shared_2_test_SOURCES = two_file_test_1.cc two_file_test_1b.cc two_file_test_main.cc
3bd52c28
ILT
525two_file_shared_2_test_DEPENDENCIES = gcctestdir/ld two_file_shared_2.so
526two_file_shared_2_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
527two_file_shared_2_test_LDADD = two_file_shared_2.so
528
386c048c
ILT
529two_file_shared_1_pic_2_test_SOURCES = two_file_test_main.cc
530two_file_shared_1_pic_2_test_DEPENDENCIES = \
2f2de248 531 gcctestdir/ld two_file_shared_2.so two_file_test_1_pic.o two_file_test_1b_pic.o
386c048c 532two_file_shared_1_pic_2_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
03e8f2b2 533two_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
534
535two_file_shared_2_pic_1_test_SOURCES = two_file_test_main.cc
536two_file_shared_2_pic_1_test_DEPENDENCIES = \
e051a5b5 537 gcctestdir/ld two_file_shared_1.so two_file_test_2_pic.o
386c048c
ILT
538two_file_shared_2_pic_1_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
539two_file_shared_2_pic_1_test_LDADD = two_file_test_2_pic.o two_file_shared_1.so
540
3bd52c28
ILT
541two_file_same_shared_test_SOURCES = two_file_test_main.cc
542two_file_same_shared_test_DEPENDENCIES = gcctestdir/ld two_file_shared.so
543two_file_same_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
544two_file_same_shared_test_LDADD = two_file_shared.so
545
546two_file_separate_shared_12_test_SOURCES = two_file_test_main.cc
547two_file_separate_shared_12_test_DEPENDENCIES = \
548 gcctestdir/ld two_file_shared_1.so two_file_shared_2.so
549two_file_separate_shared_12_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
550two_file_separate_shared_12_test_LDADD = \
551 two_file_shared_1.so two_file_shared_2.so
552
553two_file_separate_shared_21_test_SOURCES = two_file_test_main.cc
554two_file_separate_shared_21_test_DEPENDENCIES = \
555 gcctestdir/ld two_file_shared_1.so two_file_shared_2.so
556two_file_separate_shared_21_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
557two_file_separate_shared_21_test_LDADD = \
558 two_file_shared_2.so two_file_shared_1.so
559
6a74a719
ILT
560check_PROGRAMS += two_file_relocatable_test
561two_file_relocatable_test_SOURCES = two_file_test_main.cc
562two_file_relocatable_test_DEPENDENCIES = \
563 gcctestdir/ld two_file_relocatable.o
564two_file_relocatable_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
565two_file_relocatable_test_LDADD = two_file_relocatable.o
566two_file_relocatable.o: gcctestdir/ld two_file_test_1.o two_file_test_1b.o two_file_test_2.o
567 gcctestdir/ld -r -o $@ two_file_test_1.o two_file_test_1b.o two_file_test_2.o
568
374ad285
ILT
569check_PROGRAMS += two_file_pie_test
570two_file_test_1_pie.o: two_file_test_1.cc
571 $(CXXCOMPILE) -c -fpie -o $@ $<
572two_file_test_1b_pie.o: two_file_test_1b.cc
573 $(CXXCOMPILE) -c -fpie -o $@ $<
574two_file_test_2_pie.o: two_file_test_2.cc
575 $(CXXCOMPILE) -c -fpie -o $@ $<
576two_file_test_main_pie.o: two_file_test_main.cc
577 $(CXXCOMPILE) -c -fpie -o $@ $<
578two_file_pie_test: two_file_test_1_pie.o two_file_test_1b_pie.o \
579 two_file_test_2_pie.o two_file_test_main_pie.o gcctestdir/ld
580 $(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
581
a82bef93
ST
582check_PROGRAMS += pie_copyrelocs_test
583pie_copyrelocs_test_SOURCES = pie_copyrelocs_test.cc
584pie_copyrelocs_test_DEPENDENCIES = gcctestdir/ld pie_copyrelocs_shared_test.so
4759c34e 585pie_copyrelocs_test_CXXFLAGS = -fno-exceptions -fno-asynchronous-unwind-tables
a82bef93
ST
586pie_copyrelocs_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. -pie
587pie_copyrelocs_test_LDADD = pie_copyrelocs_shared_test.so
588pie_copyrelocs_shared_test.o: pie_copyrelocs_shared_test.cc
589 $(CXXCOMPILE) -O2 -fpic -c -o $@ $<
590pie_copyrelocs_shared_test.so: pie_copyrelocs_shared_test.o gcctestdir/ld
591 $(CXXLINK) -Bgcctestdir/ -shared pie_copyrelocs_shared_test.o
592
a100d66f
ST
593check_PROGRAMS += weak_unresolved_symbols_test
594weak_unresolved_symbols_test_SOURCES = weak_unresolved_symbols_test.cc
595weak_unresolved_symbols_test_CXXFLAGS = -fPIE
596weak_unresolved_symbols_test_LDFLAGS = -Bgcctestdir/ -pie -Wl,--weak-unresolved-symbols
597
031cdbed
ILT
598check_SCRIPTS += two_file_shared.sh
599check_DATA += two_file_shared.dbg
72fef11a 600MOSTLYCLEANFILES += two_file_shared.dbg
031cdbed
ILT
601two_file_shared.dbg: two_file_shared.so
602 $(TEST_READELF) -w $< >$@ 2>/dev/null
603
63402fe4
ILT
604# The nonpic tests will fail on platforms which can not put non-PIC
605# code into shared libraries, so we just don't run them in that case.
63402fe4 606if FN_PTRS_IN_SO_WITHOUT_PIC
3bd52c28 607
351a8000
ILT
608check_PROGRAMS += two_file_shared_1_nonpic_test
609check_PROGRAMS += two_file_shared_2_nonpic_test
610check_PROGRAMS += two_file_same_shared_nonpic_test
611check_PROGRAMS += two_file_separate_shared_12_nonpic_test
612check_PROGRAMS += two_file_separate_shared_21_nonpic_test
03e8f2b2
ILT
613check_PROGRAMS += two_file_mixed_shared_test
614check_PROGRAMS += two_file_mixed_2_shared_test
351a8000 615two_file_shared_1_nonpic.so: two_file_test_1.o gcctestdir/ld
611062c0 616 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1.o two_file_test_1b.o -Wl,-z,notext
351a8000
ILT
617two_file_shared_2_nonpic.so: two_file_test_2.o gcctestdir/ld
618 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_2.o
03e8f2b2 619two_file_shared_nonpic.so: two_file_test_1.o two_file_test_1b.o two_file_test_2.o gcctestdir/ld
611062c0 620 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1.o two_file_test_1b.o two_file_test_2.o -Wl,-z,notext
03e8f2b2 621two_file_shared_mixed.so: two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2.o gcctestdir/ld
611062c0 622 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2.o -Wl,-z,notext
03e8f2b2 623two_file_shared_mixed_1.so: two_file_test_1.o two_file_test_1b_pic.o two_file_shared_2.so gcctestdir/ld
611062c0 624 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1.o two_file_test_1b_pic.o two_file_shared_2.so -Wl,-z,notext
351a8000 625
3bd52c28
ILT
626two_file_shared_1_nonpic_test_SOURCES = \
627 two_file_test_2.cc two_file_test_main.cc
628two_file_shared_1_nonpic_test_DEPENDENCIES = \
629 gcctestdir/ld two_file_shared_1_nonpic.so
630two_file_shared_1_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
631two_file_shared_1_nonpic_test_LDADD = two_file_shared_1_nonpic.so
632
633two_file_shared_2_nonpic_test_SOURCES = \
03e8f2b2 634 two_file_test_1.cc two_file_test_1b.cc two_file_test_main.cc
3bd52c28
ILT
635two_file_shared_2_nonpic_test_DEPENDENCIES = \
636 gcctestdir/ld two_file_shared_2_nonpic.so
637two_file_shared_2_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
638two_file_shared_2_nonpic_test_LDADD = two_file_shared_2_nonpic.so
639
640two_file_same_shared_nonpic_test_SOURCES = two_file_test_main.cc
641two_file_same_shared_nonpic_test_DEPENDENCIES = \
642 gcctestdir/ld two_file_shared_nonpic.so
643two_file_same_shared_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
644two_file_same_shared_nonpic_test_LDADD = two_file_shared_nonpic.so
645
646two_file_separate_shared_12_nonpic_test_SOURCES = two_file_test_main.cc
647two_file_separate_shared_12_nonpic_test_DEPENDENCIES = \
648 gcctestdir/ld two_file_shared_1_nonpic.so two_file_shared_2_nonpic.so
649two_file_separate_shared_12_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
650two_file_separate_shared_12_nonpic_test_LDADD = \
651 two_file_shared_1_nonpic.so two_file_shared_2_nonpic.so
652
653two_file_separate_shared_21_nonpic_test_SOURCES = two_file_test_main.cc
654two_file_separate_shared_21_nonpic_test_DEPENDENCIES = \
655 gcctestdir/ld two_file_shared_1_nonpic.so two_file_shared_2_nonpic.so
656two_file_separate_shared_21_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
657two_file_separate_shared_21_nonpic_test_LDADD = \
658 two_file_shared_2_nonpic.so two_file_shared_1_nonpic.so
659
03e8f2b2
ILT
660two_file_mixed_shared_test_SOURCES = two_file_test_main.cc
661two_file_mixed_shared_test_DEPENDENCIES = gcctestdir/ld two_file_shared_mixed.so
662two_file_mixed_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
663two_file_mixed_shared_test_LDADD = two_file_shared_mixed.so
664
665two_file_mixed_2_shared_test_SOURCES = two_file_test_main.cc
666two_file_mixed_2_shared_test_DEPENDENCIES = gcctestdir/ld two_file_shared_mixed_1.so two_file_shared_2.so
667two_file_mixed_2_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
668two_file_mixed_2_shared_test_LDADD = two_file_shared_mixed_1.so two_file_shared_2.so
669
d89051bd
CC
670check_PROGRAMS += two_file_mixed_pie_test
671two_file_mixed_pie_test: two_file_test_1.o two_file_test_1b_pie.o \
672 two_file_test_main_pie.o two_file_shared_2.so gcctestdir/ld
673 $(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
674
351a8000 675endif FN_PTRS_IN_SO_WITHOUT_PIC
3bd52c28 676
6835af53
ILT
677check_PROGRAMS += two_file_strip_test
678two_file_strip_test: two_file_test
679 $(TEST_STRIP) -o two_file_strip_test two_file_test
680
681check_PROGRAMS += two_file_same_shared_strip_test
682two_file_same_shared_strip_test_SOURCES = two_file_test_main.cc
683two_file_same_shared_strip_test_DEPENDENCIES = \
684 gcctestdir/ld two_file_shared_strip.so
685two_file_same_shared_strip_test_LDFLAGS = -Bgcctestdir/ -Wl,-R.
686two_file_same_shared_strip_test_LDADD = two_file_shared_strip.so
687two_file_shared_strip.so: two_file_shared.so
688 $(TEST_STRIP) -S -o two_file_shared_strip.so two_file_shared.so
689
49bdd526
ILT
690check_PROGRAMS += common_test_1
691common_test_1_SOURCES = common_test_1.c
692common_test_1_DEPENDENCIES = gcctestdir/ld
693common_test_1_LDFLAGS = -Bgcctestdir/
1abce4a6 694common_test_1_LDADD =
351a8000 695
eda294df
ILT
696check_PROGRAMS += common_test_2
697common_test_2_SOURCES = common_test_1.c
698common_test_2_DEPENDENCIES = common_test_2.so common_test_3.so gcctestdir/ld
699common_test_2_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
700common_test_2_LDADD = common_test_2.so common_test_3.so
701common_test_2_pic.o: common_test_2.c
702 $(COMPILE) -c -fpic -o $@ $<
703common_test_2.so: common_test_2_pic.o common_test_3.so gcctestdir/ld
704 $(LINK) -Bgcctestdir/ -shared common_test_2_pic.o common_test_3.so
705common_test_3_pic.o: common_test_3.c
706 $(COMPILE) -c -fpic -o $@ $<
707common_test_3.so: common_test_3_pic.o ver_test_2.script gcctestdir/ld
708 $(LINK) -Bgcctestdir/ -shared common_test_3_pic.o -Wl,--version-script,$(srcdir)/ver_test_2.script
709
351a8000 710check_PROGRAMS += exception_test
351a8000
ILT
711check_PROGRAMS += exception_shared_1_test
712check_PROGRAMS += exception_shared_2_test
713check_PROGRAMS += exception_same_shared_test
714check_PROGRAMS += exception_separate_shared_12_test
715check_PROGRAMS += exception_separate_shared_21_test
716exception_test_1_pic.o: exception_test_1.cc
717 $(CXXCOMPILE) -c -fpic -o $@ $<
718exception_test_2_pic.o: exception_test_2.cc
719 $(CXXCOMPILE) -c -fpic -o $@ $<
720exception_shared_1.so: exception_test_1_pic.o gcctestdir/ld
721 $(CXXLINK) -Bgcctestdir/ -shared exception_test_1_pic.o
722exception_shared_2.so: exception_test_2_pic.o gcctestdir/ld
723 $(CXXLINK) -Bgcctestdir/ -shared exception_test_2_pic.o
724exception_shared.so: exception_test_1_pic.o exception_test_2_pic.o gcctestdir/ld
725 $(CXXLINK) -Bgcctestdir/ -shared exception_test_1_pic.o exception_test_2_pic.o
63402fe4 726
3151305a
ILT
727exception_test_SOURCES = \
728 exception_test_main.cc \
729 exception_test_1.cc \
730 exception_test_2.cc \
731 exception_test.h
732exception_test_DEPENDENCIES = gcctestdir/ld
733exception_test_LDFLAGS = -Bgcctestdir/
1abce4a6 734exception_test_LDADD =
3151305a 735
328c7c2f
ILT
736if HAVE_STATIC
737check_PROGRAMS += exception_static_test
351a8000
ILT
738exception_static_test_SOURCES = $(exception_test_SOURCES)
739exception_static_test_DEPENDENCIES = $(exception_test_DEPENDENCIES)
740exception_static_test_LDFLAGS = $(exception_test_LDFLAGS) -static
1abce4a6 741exception_static_test_LDADD = $(exception_test_LDADD)
328c7c2f 742endif
3151305a
ILT
743
744exception_shared_1_test_SOURCES = exception_test_2.cc exception_test_main.cc
745exception_shared_1_test_DEPENDENCIES = gcctestdir/ld exception_shared_1.so
746exception_shared_1_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
747exception_shared_1_test_LDADD = exception_shared_1.so
748
749exception_shared_2_test_SOURCES = exception_test_1.cc exception_test_main.cc
750exception_shared_2_test_DEPENDENCIES = gcctestdir/ld exception_shared_2.so
751exception_shared_2_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
752exception_shared_2_test_LDADD = exception_shared_2.so
753
754exception_same_shared_test_SOURCES = exception_test_main.cc
755exception_same_shared_test_DEPENDENCIES = gcctestdir/ld exception_shared.so
756exception_same_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
757exception_same_shared_test_LDADD = exception_shared.so
758
759exception_separate_shared_12_test_SOURCES = exception_test_main.cc
760exception_separate_shared_12_test_DEPENDENCIES = \
761 gcctestdir/ld exception_shared_1.so exception_shared_2.so
59965708
CC
762exception_separate_shared_12_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. \
763 -Wl,--no-as-needed
3151305a
ILT
764exception_separate_shared_12_test_LDADD = \
765 exception_shared_1.so exception_shared_2.so
766
767exception_separate_shared_21_test_SOURCES = exception_test_main.cc
768exception_separate_shared_21_test_DEPENDENCIES = \
769 gcctestdir/ld exception_shared_1.so exception_shared_2.so
59965708
CC
770exception_separate_shared_21_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. \
771 -Wl,--no-as-needed
3151305a
ILT
772exception_separate_shared_21_test_LDADD = \
773 exception_shared_2.so exception_shared_1.so
774
3151305a 775
351a8000 776check_PROGRAMS += weak_test
a360aedd 777weak_test_SOURCES = weak_test.cc
0e470e5c 778weak_test_DEPENDENCIES = gcctestdir/ld
a360aedd 779weak_test_LDFLAGS = -Bgcctestdir/
1abce4a6 780weak_test_LDADD =
a360aedd 781
86925eef 782check_PROGRAMS += weak_undef_test
72fef11a 783MOSTLYCLEANFILES += alt/weak_undef_lib.so
86925eef
CC
784weak_undef_test_SOURCES = weak_undef_test.cc
785weak_undef_test_DEPENDENCIES = gcctestdir/ld weak_undef_lib.so alt/weak_undef_lib.so
786weak_undef_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,alt
787weak_undef_test_LDADD = -L . weak_undef_lib.so
788weak_undef_file1.o: weak_undef_file1.cc
789 $(CXXCOMPILE) -c -fpic -o $@ $<
790weak_undef_file2.o: weak_undef_file2.cc
791 $(CXXCOMPILE) -c -fpic -o $@ $<
78d9f182 792weak_undef_lib.so: weak_undef_file1.o gcctestdir/ld
86925eef 793 $(CXXLINK) -Bgcctestdir/ -shared weak_undef_file1.o
78d9f182 794alt/weak_undef_lib.so: weak_undef_file2.o gcctestdir/ld
86925eef
CC
795 test -d alt || mkdir -p alt
796 $(CXXLINK) -Bgcctestdir/ -shared weak_undef_file2.o
351a8000 797
1f25b93b
CC
798check_PROGRAMS += weak_undef_test_2
799weak_undef_test_2_SOURCES = weak_undef_test_2.cc
800weak_undef_test_2_DEPENDENCIES = gcctestdir/ld libweak_undef_2.a
801weak_undef_test_2_LDFLAGS = -Bgcctestdir/ -u weak_undef_2
802weak_undef_test_2_LDADD = -L . -lweak_undef_2
dddcc5b9 803MOSTLYCLEANFILES += libweak_undef_2.a
1f25b93b
CC
804libweak_undef_2.a: weak_undef_file3.o weak_undef_file4.o
805 $(TEST_AR) rc $@ $^
806weak_undef_file3.o: weak_undef_file3.cc
807 $(CXXCOMPILE) -c -o $@ $<
808weak_undef_file4.o: weak_undef_file4.cc
809 $(CXXCOMPILE) -c -o $@ $<
810
f3c69fca
CC
811if FN_PTRS_IN_SO_WITHOUT_PIC
812check_PROGRAMS += weak_undef_nonpic_test
72fef11a 813MOSTLYCLEANFILES += alt/weak_undef_lib_nonpic.so
f3c69fca
CC
814weak_undef_nonpic_test_SOURCES = weak_undef_test.cc
815weak_undef_nonpic_test_DEPENDENCIES = gcctestdir/ld weak_undef_lib_nonpic.so alt/weak_undef_lib_nonpic.so
816weak_undef_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,alt
817weak_undef_nonpic_test_LDADD = -L . weak_undef_lib_nonpic.so
818weak_undef_file1_nonpic.o: weak_undef_file1.cc
819 $(CXXCOMPILE) -c -o $@ $<
820weak_undef_file2_nonpic.o: weak_undef_file2.cc
821 $(CXXCOMPILE) -c -o $@ $<
822weak_undef_lib_nonpic.so: weak_undef_file1_nonpic.o
611062c0 823 $(CXXLINK) -Bgcctestdir/ -shared weak_undef_file1_nonpic.o -Wl,-z,notext
f3c69fca
CC
824alt/weak_undef_lib_nonpic.so: weak_undef_file2_nonpic.o
825 test -d alt || mkdir -p alt
611062c0 826 $(CXXLINK) -Bgcctestdir/ -shared weak_undef_file2_nonpic.o -Wl,-z,notext
f3c69fca
CC
827endif FN_PTRS_IN_SO_WITHOUT_PIC
828
829
99a37bfd
ILT
830check_PROGRAMS += weak_alias_test
831weak_alias_test_SOURCES = weak_alias_test_main.cc
832weak_alias_test_DEPENDENCIES = \
833 gcctestdir/ld weak_alias_test_1.so weak_alias_test_2.so \
21131061 834 weak_alias_test_3.o weak_alias_test_4.so weak_alias_test_5.so
99a37bfd
ILT
835weak_alias_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
836weak_alias_test_LDADD = \
837 weak_alias_test_1.so weak_alias_test_2.so weak_alias_test_3.o \
21131061 838 weak_alias_test_4.so weak_alias_test_5.so
99a37bfd
ILT
839weak_alias_test_1_pic.o: weak_alias_test_1.cc
840 $(CXXCOMPILE) -c -fpic -o $@ $<
de4c45bd 841weak_alias_test_1.so: weak_alias_test_1_pic.o gcctestdir/ld
99a37bfd
ILT
842 $(CXXLINK) -Bgcctestdir/ -shared weak_alias_test_1_pic.o
843weak_alias_test_2_pic.o: weak_alias_test_2.cc
844 $(CXXCOMPILE) -c -fpic -o $@ $<
de4c45bd 845weak_alias_test_2.so: weak_alias_test_2_pic.o gcctestdir/ld
99a37bfd
ILT
846 $(CXXLINK) -Bgcctestdir/ -shared weak_alias_test_2_pic.o
847weak_alias_test_3.o: weak_alias_test_3.cc
848 $(CXXCOMPILE) -c -o $@ $<
849weak_alias_test_4_pic.o: weak_alias_test_4.cc
850 $(CXXCOMPILE) -c -fpic -o $@ $<
de4c45bd 851weak_alias_test_4.so: weak_alias_test_4_pic.o gcctestdir/ld
99a37bfd 852 $(CXXLINK) -Bgcctestdir/ -shared weak_alias_test_4_pic.o
21131061
ILT
853weak_alias_test_5_pic.o: weak_alias_test_5.cc
854 $(CXXCOMPILE) -c -fpic -o $@ $<
855weak_alias_test_5.so: weak_alias_test_5_pic.o $(srcdir)/weak_alias_test.script gcctestdir/ld
856 $(CXXLINK) -Bgcctestdir/ -shared weak_alias_test_5_pic.o \
857 -Wl,--version-script,$(srcdir)/weak_alias_test.script
99a37bfd 858
de4c45bd
ILT
859check_SCRIPTS += weak_plt.sh
860check_PROGRAMS += weak_plt
861check_DATA += weak_plt_shared.so
862weak_plt_main_pic.o: weak_plt_main.cc
863 $(CXXCOMPILE) -c -fpic -o $@ $<
864weak_plt: weak_plt_main_pic.o gcctestdir/ld
865 $(CXXLINK) -Bgcctestdir/ weak_plt_main_pic.o
866weak_plt_shared_pic.o: weak_plt_shared.cc
867 $(CXXCOMPILE) -c -fpic -o $@ $<
868weak_plt_shared.so: weak_plt_shared_pic.o gcctestdir/ld
869 $(CXXLINK) -Bgcctestdir/ -shared weak_plt_shared_pic.o
870
f34787f8
ILT
871check_PROGRAMS += copy_test
872copy_test_SOURCES = copy_test.cc
873copy_test_DEPENDENCIES = gcctestdir/ld copy_test_1.so copy_test_2.so
874copy_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
875copy_test_LDADD = copy_test_1.so copy_test_2.so
876copy_test_1_pic.o: copy_test_1.cc
877 $(CXXCOMPILE) -c -fpic -o $@ $<
878copy_test_1.so: gcctestdir/ld copy_test_1_pic.o
879 $(CXXLINK) -Bgcctestdir/ -shared copy_test_1_pic.o
880copy_test_2_pic.o: copy_test_2.cc
881 $(CXXCOMPILE) -c -fpic -o $@ $<
882copy_test_2.so: gcctestdir/ld copy_test_2_pic.o
883 $(CXXLINK) -Bgcctestdir/ -shared copy_test_2_pic.o
884
b733bcb7
CC
885check_PROGRAMS += copy_test_relro
886copy_test_relro_SOURCES = copy_test_relro.cc
887copy_test_relro_DEPENDENCIES = gcctestdir/ld copy_test_relro_1.so
888copy_test_relro_LDFLAGS = -Bgcctestdir/ -Wl,-R,. -Wl,-z,relro
889copy_test_relro_LDADD = copy_test_relro_1.so
890copy_test_relro_1_pic.o: copy_test_relro_1.cc
891 $(CXXCOMPILE) -c -fpic -o $@ $<
892copy_test_relro_1.so: gcctestdir/ld copy_test_relro_1_pic.o
893 $(CXXLINK) -Bgcctestdir/ -shared -Wl,-z,relro copy_test_relro_1_pic.o
894
38ac44ac 895if !DEFAULT_TARGET_POWERPC
6eeb0170
CC
896check_SCRIPTS += copy_test_protected.sh
897check_DATA += copy_test_protected.err
898MOSTLYCLEANFILES += copy_test_protected.err
899copy_test_protected.err: copy_test_protected.o copy_test_2.so gcctestdir/ld
900 @echo $(CXXLINK) -Bgcctestdir/ -o copy_test_protected copy_test_protected.o copy_test_2.so -Wl,-R,. "2>$@"
901 @if $(CXXLINK) -Bgcctestdir/ -o copy_test_protected copy_test_protected.o copy_test_2.so -Wl,-R,. 2>$@; \
902 then \
903 echo 1>&2 "Link of copy_test_protected should have failed"; \
904 rm -f $@; \
905 exit 1; \
906 fi
38ac44ac 907endif
6eeb0170 908
6eee141f
ILT
909if TLS
910
351a8000
ILT
911check_PROGRAMS += tls_test
912check_PROGRAMS += tls_pic_test
c7177d31 913check_PROGRAMS += tls_pie_test
b3705d2a 914check_PROGRAMS += tls_pie_pic_test
351a8000 915check_PROGRAMS += tls_shared_test
c03c7692 916check_PROGRAMS += tls_shared_ie_test
c2b45e22 917check_PROGRAMS += tls_shared_gd_to_ie_test
351a8000
ILT
918tls_test_pic.o: tls_test.cc
919 $(CXXCOMPILE) -c -fpic -o $@ $<
920tls_test_file2_pic.o: tls_test_file2.cc
921 $(CXXCOMPILE) -c -fpic -o $@ $<
155a0dd7
ILT
922tls_test_c_pic.o: tls_test_c.c
923 $(COMPILE) -c -fpic $(TLS_TEST_C_CFLAGS) -o $@ $<
924tls_test_shared.so: tls_test_pic.o tls_test_file2_pic.o tls_test_c_pic.o gcctestdir/ld
9c2d0ef9 925 $(CXXLINK) -Bgcctestdir/ -shared tls_test_pic.o tls_test_file2_pic.o tls_test_c_pic.o -Wl,-z,defs
c2b45e22
CC
926tls_test_shared2.so: tls_test_file2_pic.o gcctestdir/ld
927 $(CXXLINK) -Bgcctestdir/ -shared tls_test_file2_pic.o
351a8000 928
c03c7692
ILT
929tls_test_pic_ie.o: tls_test.cc
930 $(CXXCOMPILE) -c -fpic -ftls-model=initial-exec -o $@ $<
931tls_test_file2_pic_ie.o: tls_test_file2.cc
932 $(CXXCOMPILE) -c -fpic -ftls-model=initial-exec -o $@ $<
155a0dd7
ILT
933tls_test_c_pic_ie.o: tls_test_c.c
934 $(COMPILE) -c -fpic -ftls-model=initial-exec $(TLS_TEST_C_CFLAGS) -o $@ $<
935tls_test_ie_shared.so: tls_test_pic_ie.o tls_test_file2_pic_ie.o tls_test_c_pic_ie.o gcctestdir/ld
936 $(CXXLINK) -Bgcctestdir/ -shared tls_test_pic_ie.o tls_test_file2_pic_ie.o tls_test_c_pic_ie.o
c03c7692 937
e0374858 938tls_test_SOURCES = tls_test.cc tls_test_file2.cc tls_test_main.cc tls_test.h
155a0dd7 939tls_test_DEPENDENCIES = gcctestdir/ld tls_test_c.o
6eee141f 940tls_test_LDFLAGS = -Bgcctestdir/
155a0dd7
ILT
941tls_test_LDADD = tls_test_c.o -lpthread
942tls_test_c.o: tls_test_c.c
943 $(COMPILE) -c $(TLS_TEST_C_CFLAGS) -o $@ $<
6eee141f
ILT
944
945tls_pic_test_SOURCES = tls_test_main.cc
155a0dd7
ILT
946tls_pic_test_DEPENDENCIES = gcctestdir/ld tls_test_pic.o tls_test_file2_pic.o \
947 tls_test_c_pic.o
6eee141f 948tls_pic_test_LDFLAGS = -Bgcctestdir/
155a0dd7
ILT
949tls_pic_test_LDADD = tls_test_pic.o tls_test_file2_pic.o tls_test_c_pic.o \
950 -lpthread
6eee141f 951
c7177d31
ILT
952tls_test_main_pie.o: tls_test_main.cc tls_test.h
953 $(CXXCOMPILE) -c -fpie -o $@ $<
954tls_test_pie.o: tls_test.cc tls_test.h
955 $(CXXCOMPILE) -c -fpie -o $@ $<
956tls_test_file2_pie.o: tls_test_file2.cc tls_test.h
957 $(CXXCOMPILE) -c -fpie -o $@ $<
958tls_test_c_pie.o: tls_test_c.c
959 $(COMPILE) -c -fpic $(TLS_TEST_C_CFLAGS) -o $@ $<
960tls_pie_test: tls_test_main_pie.o tls_test_pie.o tls_test_file2_pie.o \
961 tls_test_c_pie.o gcctestdir/ld
962 $(CXXLINK) -Bgcctestdir/ -pie tls_test_main_pie.o tls_test_pie.o tls_test_file2_pie.o tls_test_c_pie.o -lpthread
963
a6a17750
CC
964check_SCRIPTS += tls_pie_test.sh
965check_DATA += tls_pie_test.stdout
966tls_pie_test.stdout: tls_pie_test
967 $(TEST_READELF) -rW $< > $@ 2>/dev/null
968
b3705d2a
ILT
969tls_pie_pic_test: tls_test_main_pie.o tls_test_pic.o tls_test_file2_pic.o \
970 tls_test_c_pic.o gcctestdir/ld
971 $(CXXLINK) -Bgcctestdir/ -pie tls_test_main_pie.o tls_test_pic.o tls_test_file2_pic.o tls_test_c_pic.o -lpthread
972
6eee141f
ILT
973tls_shared_test_SOURCES = tls_test_main.cc
974tls_shared_test_DEPENDENCIES = gcctestdir/ld tls_test_shared.so
975tls_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
976tls_shared_test_LDADD = tls_test_shared.so -lpthread
977
c03c7692
ILT
978tls_shared_ie_test_SOURCES = tls_test_main.cc
979tls_shared_ie_test_DEPENDENCIES = gcctestdir/ld tls_test_ie_shared.so
980tls_shared_ie_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
981tls_shared_ie_test_LDADD = tls_test_ie_shared.so -lpthread
982
c2b45e22 983tls_shared_gd_to_ie_test_SOURCES = tls_test_main.cc
155a0dd7
ILT
984tls_shared_gd_to_ie_test_DEPENDENCIES = gcctestdir/ld tls_test_pic.o \
985 tls_test_c_pic.o tls_test_shared2.so
c2b45e22 986tls_shared_gd_to_ie_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
155a0dd7
ILT
987tls_shared_gd_to_ie_test_LDADD = tls_test_pic.o tls_test_c_pic.o \
988 tls_test_shared2.so -lpthread
c2b45e22
CC
989
990if TLS_GNU2_DIALECT
991
992check_PROGRAMS += tls_shared_gnu2_gd_to_ie_test
993
994tls_test_gnu2.o: tls_test.cc
995 $(CXXCOMPILE) -c -fpic -mtls-dialect=gnu2 -o $@ $<
996tls_test_file2_gnu2.o: tls_test_file2.cc
997 $(CXXCOMPILE) -c -fpic -mtls-dialect=gnu2 -o $@ $<
155a0dd7
ILT
998tls_test_c_gnu2.o: tls_test_c.c
999 $(COMPILE) -c -fpic -mtls-dialect=gnu2 $(TLS_TEST_C_CFLAGS) -o $@ $<
c2b45e22
CC
1000tls_test_gnu2_shared2.so: tls_test_file2_gnu2.o gcctestdir/ld
1001 $(CXXLINK) -Bgcctestdir/ -shared tls_test_file2_gnu2.o
1002
1003tls_shared_gnu2_gd_to_ie_test_SOURCES = tls_test_main.cc
155a0dd7
ILT
1004tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES = gcctestdir/ld tls_test_gnu2.o \
1005 tls_test_c_gnu2.o tls_test_gnu2_shared2.so
c2b45e22 1006tls_shared_gnu2_gd_to_ie_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
155a0dd7
ILT
1007tls_shared_gnu2_gd_to_ie_test_LDADD = tls_test_gnu2.o tls_test_c_gnu2.o \
1008 tls_test_gnu2_shared2.so -lpthread
c2b45e22
CC
1009
1010if TLS_DESCRIPTORS
1011
1012check_PROGRAMS += tls_shared_gnu2_test
1013
155a0dd7
ILT
1014tls_test_gnu2_shared.so: tls_test_gnu2.o tls_test_file2_gnu2.o tls_test_c_gnu2.o gcctestdir/ld
1015 $(CXXLINK) -Bgcctestdir/ -shared tls_test_gnu2.o tls_test_file2_gnu2.o tls_test_c_gnu2.o
c2b45e22
CC
1016
1017tls_shared_gnu2_test_SOURCES = tls_test_main.cc
1018tls_shared_gnu2_test_DEPENDENCIES = gcctestdir/ld tls_test_gnu2_shared.so
1019tls_shared_gnu2_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1020tls_shared_gnu2_test_LDADD = tls_test_gnu2_shared.so -lpthread
1021
1022endif TLS_DESCRIPTORS
1023
1024endif TLS_GNU2_DIALECT
1025
328c7c2f 1026if HAVE_STATIC
351a8000
ILT
1027if STATIC_TLS
1028check_PROGRAMS += tls_static_test
1029check_PROGRAMS += tls_static_pic_test
1030
1031tls_static_test_SOURCES = $(tls_test_SOURCES)
1032tls_static_test_DEPENDENCIES = $(tls_test_DEPENDENCIES)
1033tls_static_test_LDFLAGS = $(tls_test_LDFLAGS) -static
1034tls_static_test_LDADD = $(tls_test_LDADD)
1035
1036tls_static_pic_test_SOURCES = $(tls_pic_test_SOURCES)
1037tls_static_pic_test_DEPENDENCIES = $(tls_pic_test_DEPENDENCIES)
1038tls_static_pic_test_LDFLAGS = $(tls_pic_test_LDFLAGS) -static
1039tls_static_pic_test_LDADD = $(tls_pic_test_LDADD)
1040endif
328c7c2f 1041endif
6eee141f
ILT
1042
1043if FN_PTRS_IN_SO_WITHOUT_PIC
351a8000 1044check_PROGRAMS += tls_shared_nonpic_test
155a0dd7 1045tls_test_shared_nonpic.so: tls_test.o tls_test_file2.o tls_test_c.o gcctestdir/ld
611062c0 1046 $(CXXLINK) -Bgcctestdir/ -shared tls_test.o tls_test_file2.o tls_test_c.o -Wl,-z,notext
6eee141f
ILT
1047
1048tls_shared_nonpic_test_SOURCES = tls_test_main.cc
1049tls_shared_nonpic_test_DEPENDENCIES = gcctestdir/ld tls_test_shared_nonpic.so
1050tls_shared_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1051tls_shared_nonpic_test_LDADD = tls_test_shared_nonpic.so -lpthread
351a8000 1052endif FN_PTRS_IN_SO_WITHOUT_PIC
6eee141f 1053
351a8000 1054endif TLS
6eee141f 1055
1fa29f10
IT
1056if DEFAULT_TARGET_X86_64
1057
1058check_SCRIPTS += x86_64_mov_to_lea.sh
1059check_DATA += x86_64_mov_to_lea1.stdout x86_64_mov_to_lea2.stdout \
1060 x86_64_mov_to_lea3.stdout x86_64_mov_to_lea4.stdout \
1061 x86_64_mov_to_lea5.stdout x86_64_mov_to_lea6.stdout \
1062 x86_64_mov_to_lea7.stdout x86_64_mov_to_lea8.stdout \
1063 x86_64_mov_to_lea9.stdout x86_64_mov_to_lea10.stdout \
1064 x86_64_mov_to_lea11.stdout x86_64_mov_to_lea12.stdout \
1065 x86_64_mov_to_lea13.stdout x86_64_mov_to_lea14.stdout
1066MOSTLYCLEANFILES += x86_64_mov_to_lea1 x86_64_mov_to_lea2 \
1067 x86_64_mov_to_lea3 x86_64_mov_to_lea4 x86_64_mov_to_lea5 \
1068 x86_64_mov_to_lea6 x86_64_mov_to_lea7 x86_64_mov_to_lea8 \
1069 x86_64_mov_to_lea9 x86_64_mov_to_lea10 x86_64_mov_to_lea11 \
1070 x86_64_mov_to_lea12 x86_64_mov_to_lea13 x86_64_mov_to_lea14
1071
1072x86_64_mov_to_lea1.o: x86_64_mov_to_lea1.s
1073 $(TEST_AS) --64 -o $@ $<
1074x86_64_mov_to_lea2.o: x86_64_mov_to_lea1.s
1075 $(TEST_AS) --x32 -o $@ $<
1076x86_64_mov_to_lea3.o: x86_64_mov_to_lea2.s
1077 $(TEST_AS) --x32 -o $@ $<
1078x86_64_mov_to_lea4.o: x86_64_mov_to_lea2.s
1079 $(TEST_AS) --64 -o $@ $<
1080x86_64_mov_to_lea5.o: x86_64_mov_to_lea3.s
1cd17042 1081 $(TEST_AS) --x32 -mrelax-relocations=yes -o $@ $<
1fa29f10 1082x86_64_mov_to_lea6.o: x86_64_mov_to_lea3.s
1cd17042 1083 $(TEST_AS) --64 -mrelax-relocations=yes -o $@ $<
1fa29f10
IT
1084x86_64_mov_to_lea7.o: x86_64_mov_to_lea4.s
1085 $(TEST_AS) --x32 -o $@ $<
1086x86_64_mov_to_lea8.o: x86_64_mov_to_lea4.s
1087 $(TEST_AS) --64 -o $@ $<
78d9f182 1088x86_64_mov_to_lea1: x86_64_mov_to_lea1.o ../ld-new
1fa29f10 1089 ../ld-new -Bsymbolic -shared -melf_x86_64 -o $@ $<
78d9f182 1090x86_64_mov_to_lea2: x86_64_mov_to_lea1.o ../ld-new
1fa29f10 1091 ../ld-new -pie -melf_x86_64 -o $@ $<
78d9f182 1092x86_64_mov_to_lea3: x86_64_mov_to_lea1.o ../ld-new
1fa29f10 1093 ../ld-new -melf_x86_64 -o $@ $<
78d9f182 1094x86_64_mov_to_lea4: x86_64_mov_to_lea2.o ../ld-new
1fa29f10 1095 ../ld-new -Bsymbolic -shared -melf32_x86_64 -o $@ $<
78d9f182 1096x86_64_mov_to_lea5: x86_64_mov_to_lea2.o ../ld-new
1fa29f10 1097 ../ld-new -pie -melf32_x86_64 -o $@ $<
78d9f182 1098x86_64_mov_to_lea6: x86_64_mov_to_lea2.o ../ld-new
1fa29f10 1099 ../ld-new -melf32_x86_64 -o $@ $<
78d9f182 1100x86_64_mov_to_lea7: x86_64_mov_to_lea3.o ../ld-new
1fa29f10 1101 ../ld-new -melf32_x86_64 -pie -o $@ $<
78d9f182 1102x86_64_mov_to_lea8: x86_64_mov_to_lea4.o ../ld-new
1fa29f10 1103 ../ld-new -melf_x86_64 -pie -o $@ $<
78d9f182 1104x86_64_mov_to_lea9: x86_64_mov_to_lea5.o ../ld-new
1fa29f10 1105 ../ld-new -melf32_x86_64 -o $@ $<
78d9f182 1106x86_64_mov_to_lea10: x86_64_mov_to_lea6.o ../ld-new
1fa29f10 1107 ../ld-new -melf_x86_64 -o $@ $<
78d9f182 1108x86_64_mov_to_lea11: x86_64_mov_to_lea2.o ../ld-new
1fa29f10 1109 ../ld-new -melf32_x86_64 -shared -o $@ $<
78d9f182 1110x86_64_mov_to_lea12: x86_64_mov_to_lea1.o ../ld-new
1fa29f10 1111 ../ld-new -melf_x86_64 -shared -o $@ $<
78d9f182 1112x86_64_mov_to_lea13: x86_64_mov_to_lea7.o ../ld-new
1fa29f10 1113 ../ld-new -melf32_x86_64 -shared -o $@ $<
78d9f182 1114x86_64_mov_to_lea14: x86_64_mov_to_lea8.o ../ld-new
1fa29f10
IT
1115 ../ld-new -melf_x86_64 -shared -o $@ $<
1116x86_64_mov_to_lea1.stdout: x86_64_mov_to_lea1
1117 $(TEST_OBJDUMP) -dw $< > $@
1118x86_64_mov_to_lea2.stdout: x86_64_mov_to_lea2
1119 $(TEST_OBJDUMP) -dw $< > $@
1120x86_64_mov_to_lea3.stdout: x86_64_mov_to_lea3
1121 $(TEST_OBJDUMP) -dw $< > $@
1122x86_64_mov_to_lea4.stdout: x86_64_mov_to_lea4
1123 $(TEST_OBJDUMP) -dw $< > $@
1124x86_64_mov_to_lea5.stdout: x86_64_mov_to_lea5
1125 $(TEST_OBJDUMP) -dw $< > $@
1126x86_64_mov_to_lea6.stdout: x86_64_mov_to_lea6
1127 $(TEST_OBJDUMP) -dw $< > $@
1128x86_64_mov_to_lea7.stdout: x86_64_mov_to_lea7
1129 $(TEST_OBJDUMP) -dw $< > $@
1130x86_64_mov_to_lea8.stdout: x86_64_mov_to_lea8
1131 $(TEST_OBJDUMP) -dw $< > $@
1132x86_64_mov_to_lea9.stdout: x86_64_mov_to_lea9
1133 $(TEST_OBJDUMP) -dw $< > $@
1134x86_64_mov_to_lea10.stdout: x86_64_mov_to_lea10
1135 $(TEST_OBJDUMP) -dw $< > $@
1136x86_64_mov_to_lea11.stdout: x86_64_mov_to_lea11
1137 $(TEST_OBJDUMP) -dw $< > $@
1138x86_64_mov_to_lea12.stdout: x86_64_mov_to_lea12
1139 $(TEST_OBJDUMP) -dw $< > $@
1140x86_64_mov_to_lea13.stdout: x86_64_mov_to_lea13
1141 $(TEST_OBJDUMP) -dw $< > $@
1142x86_64_mov_to_lea14.stdout: x86_64_mov_to_lea14
1143 $(TEST_OBJDUMP) -dw $< > $@
1144
3a4f096e
ST
1145check_SCRIPTS += x86_64_indirect_call_to_direct.sh
1146check_DATA += x86_64_indirect_call_to_direct1.stdout \
1147 x86_64_indirect_jump_to_direct1.stdout
1148MOSTLYCLEANFILES += x86_64_indirect_call_to_direct1 \
1149 x86_64_indirect_jump_to_direct1
1150
1151x86_64_indirect_call_to_direct1.o: x86_64_indirect_call_to_direct1.s
1152 $(TEST_AS) --64 -mrelax-relocations=yes -o $@ $<
1153x86_64_indirect_call_to_direct1: x86_64_indirect_call_to_direct1.o gcctestdir/ld
1154 gcctestdir/ld -o $@ $<
1155x86_64_indirect_call_to_direct1.stdout: x86_64_indirect_call_to_direct1
1156 $(TEST_OBJDUMP) -dw $< > $@
1157x86_64_indirect_jump_to_direct1.o: x86_64_indirect_jump_to_direct1.s
1158 $(TEST_AS) --64 -mrelax-relocations=yes -o $@ $<
1159x86_64_indirect_jump_to_direct1: x86_64_indirect_jump_to_direct1.o gcctestdir/ld
1160 gcctestdir/ld -o $@ $<
1161x86_64_indirect_jump_to_direct1.stdout: x86_64_indirect_jump_to_direct1
1162 $(TEST_OBJDUMP) -dw $< > $@
1163
c34c98ed
CC
1164check_SCRIPTS += x86_64_overflow_pc32.sh
1165check_DATA += x86_64_overflow_pc32.err
1166MOSTLYCLEANFILES += x86_64_overflow_pc32.err
1167x86_64_overflow_pc32.o: x86_64_overflow_pc32.s
1168 $(TEST_AS) -o $@ $<
1169x86_64_overflow_pc32.err: x86_64_overflow_pc32.o gcctestdir/ld
19ef3f4d
CC
1170 @echo gcctestdir/ld -e bar -Tdata=0x81000000 -o x86_64_overflow_pc32 x86_64_overflow_pc32.o "2>$@"
1171 @if gcctestdir/ld -e bar -Tdata=0x81000000 -o x86_64_overflow_pc32 x86_64_overflow_pc32.o 2>$@; \
c34c98ed
CC
1172 then \
1173 echo 1>&2 "Link of x86_64_overflow_pc32 should have failed"; \
1174 rm -f $@; \
1175 exit 1; \
1176 fi
1177
ac423761
GN
1178check_PROGRAMS += pr17704a_test
1179pr17704a_test.o: pr17704a_test.s
1180 $(TEST_AS) --64 -o $@ $<
1181pr17704a_test: pr17704a_test.o gcctestdir/ld
1182 gcctestdir/ld --icf=all -o $@ $<
1183
19ef3f4d
CC
1184check_SCRIPTS += x32_overflow_pc32.sh
1185check_DATA += x32_overflow_pc32.err
1186MOSTLYCLEANFILES += x32_overflow_pc32.err
19ef3f4d
CC
1187x32_overflow_pc32.o: x86_64_overflow_pc32.s
1188 $(TEST_AS) --x32 -o $@ $<
1189x32_overflow_pc32.err: x32_overflow_pc32.o gcctestdir/ld
1190 @echo gcctestdir/ld -e bar -Tdata=0x81000000 -o x32_overflow_pc32 x32_overflow_pc32.o "2>$@"
1191 @if gcctestdir/ld -e bar -Tdata=0x81000000 -o x32_overflow_pc32 x32_overflow_pc32.o 2>$@; \
1192 then \
1193 echo 1>&2 "Link of x32_overflow_pc32 should have failed"; \
1194 rm -f $@; \
1195 exit 1; \
1196 fi
1197
1fa29f10
IT
1198endif DEFAULT_TARGET_X86_64
1199
ad961eab
L
1200if DEFAULT_TARGET_X86_64_OR_X32
1201
1202check_PROGRAMS += pr20216a_test
1203pr20216a_test_SOURCES = pr20216_main.c pr20216_def.c
1204pr20216a_test_DEPENDENCIES = pr20216_gd.o pr20216_ld.o gcctestdir/ld gcctestdir/as
1205pr20216a_test_CFLAGS = -Bgcctestdir/ -fPIE
1206pr20216a_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1207pr20216a_test_LDADD = pr20216_gd.o pr20216_ld.o
1208
1209check_PROGRAMS += pr20216b_test
1210pr20216b_test_SOURCES = pr20216_main.c pr20216_def.c
1211pr20216b_test_DEPENDENCIES = pr20216_gd.o pr20216_ld.o gcctestdir/ld gcctestdir/as
1212pr20216b_test_CFLAGS = -Bgcctestdir/ -fPIE
1213pr20216b_test_LDFLAGS = -pie -Bgcctestdir/ -Wl,-R,.
1214pr20216b_test_LDADD = pr20216_gd.o pr20216_ld.o
1215
1216check_PROGRAMS += pr20216c_test
1217pr20216c_test_SOURCES = pr20216_main.c pr20216_def.c
1218pr20216c_test_DEPENDENCIES = pr20216_gd.o pr20216_ld.o gcctestdir/ld gcctestdir/as
1219pr20216c_test_CFLAGS = -Bgcctestdir/ -fPIE
1220pr20216c_test_LDFLAGS = -static -Bgcctestdir/ -Wl,-R,.
1221pr20216c_test_LDADD = pr20216_gd.o pr20216_ld.o
1222
1223check_PROGRAMS += pr20216d_test
1224pr20216d_test_SOURCES = pr20216_main.c pr20216_def.c
1225pr20216d_test_DEPENDENCIES = pr20216a.so gcctestdir/ld gcctestdir/as
1226pr20216d_test_CFLAGS = -Bgcctestdir/ -fPIE
1227pr20216d_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1228pr20216d_test_LDADD = pr20216a.so
1229
1230check_PROGRAMS += pr20216e_test
1231pr20216e_test_SOURCES = pr20216_main.c
1232pr20216e_test_DEPENDENCIES = pr20216_gd.o pr20216_ld.o pr20216b.so gcctestdir/ld gcctestdir/as
1233pr20216e_test_CFLAGS = -Bgcctestdir/ -fPIE
1234pr20216e_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1235pr20216e_test_LDADD = pr20216_gd.o pr20216_ld.o pr20216b.so
1236
1237MOSTLYCLEANFILES += pr20216a.so pr20216b.so
1238
1239pr20216a.so: pr20216_gd.o pr20216_ld.o gcctestdir/ld
1240 $(LINK) -Bgcctestdir/ -shared pr20216_gd.o pr20216_ld.o
1241
1242pr20216b.so: pr20216_def.o gcctestdir/ld
1243 $(LINK) -Bgcctestdir/ -shared pr20216_def.o
1244
a4aa1f5f 1245pr20216_gd.o: pr20216_gd.S gcctestdir/as
f5713901 1246 $(COMPILE) -Bgcctestdir/ -c -o $@ $<
ad961eab 1247
a4aa1f5f 1248pr20216_ld.o: pr20216_ld.S gcctestdir/as
f5713901 1249 $(COMPILE) -Bgcctestdir/ -c -o $@ $<
ad961eab
L
1250
1251endif DEFAULT_TARGET_X86_64_OR_X32
1252
c4fc4724
IT
1253if DEFAULT_TARGET_I386
1254
1255check_SCRIPTS += i386_mov_to_lea.sh
1256check_DATA += i386_mov_to_lea1.stdout i386_mov_to_lea2.stdout \
1257 i386_mov_to_lea3.stdout i386_mov_to_lea4.stdout \
1258 i386_mov_to_lea5.stdout i386_mov_to_lea6.stdout \
1259 i386_mov_to_lea7.stdout i386_mov_to_lea8.stdout
1260MOSTLYCLEANFILES += i386_mov_to_lea1 i386_mov_to_lea2 i386_mov_to_lea3 \
1261 i386_mov_to_lea4 i386_mov_to_lea5 i386_mov_to_lea6 \
1262 i386_mov_to_lea7 i386_mov_to_lea8
1263
1264i386_mov_to_lea1.o: i386_mov_to_lea1.s
1265 $(TEST_AS) --32 -o $@ $<
1266i386_mov_to_lea2.o: i386_mov_to_lea2.s
1267 $(TEST_AS) --32 -o $@ $<
1268i386_mov_to_lea3.o: i386_mov_to_lea3.s
1269 $(TEST_AS) --32 -o $@ $<
1270i386_mov_to_lea4.o: i386_mov_to_lea4.s
1271 $(TEST_AS) --32 -o $@ $<
1272i386_mov_to_lea5.o: i386_mov_to_lea5.s
1273 $(TEST_AS) --32 -o $@ $<
78d9f182 1274i386_mov_to_lea1: i386_mov_to_lea1.o ../ld-new
c4fc4724 1275 ../ld-new -Bsymbolic -shared -melf_i386 -o $@ $<
78d9f182 1276i386_mov_to_lea2: i386_mov_to_lea1.o ../ld-new
c4fc4724 1277 ../ld-new -pie -melf_i386 -o $@ $<
78d9f182 1278i386_mov_to_lea3: i386_mov_to_lea1.o ../ld-new
c4fc4724 1279 ../ld-new -melf_i386 -o $@ $<
78d9f182 1280i386_mov_to_lea4: i386_mov_to_lea1.o ../ld-new
c4fc4724 1281 ../ld-new -melf_i386 -shared -o $@ $<
78d9f182 1282i386_mov_to_lea5: i386_mov_to_lea2.o ../ld-new
c4fc4724 1283 ../ld-new -melf_i386 -shared -o $@ $<
78d9f182 1284i386_mov_to_lea6: i386_mov_to_lea3.o ../ld-new
c4fc4724 1285 ../ld-new -melf_i386 -shared -o $@ $<
78d9f182 1286i386_mov_to_lea7: i386_mov_to_lea4.o ../ld-new
c4fc4724 1287 ../ld-new -melf_i386 -shared -o $@ $<
78d9f182 1288i386_mov_to_lea8: i386_mov_to_lea5.o ../ld-new
c4fc4724
IT
1289 ../ld-new -melf_i386 -shared -o $@ $<
1290i386_mov_to_lea1.stdout: i386_mov_to_lea1
1291 $(TEST_OBJDUMP) -dw $< > $@
1292i386_mov_to_lea2.stdout: i386_mov_to_lea2
1293 $(TEST_OBJDUMP) -dw $< > $@
1294i386_mov_to_lea3.stdout: i386_mov_to_lea3
1295 $(TEST_OBJDUMP) -dw $< > $@
1296i386_mov_to_lea4.stdout: i386_mov_to_lea4
1297 $(TEST_OBJDUMP) -dw $< > $@
1298i386_mov_to_lea5.stdout: i386_mov_to_lea5
1299 $(TEST_OBJDUMP) -dw $< > $@
1300i386_mov_to_lea6.stdout: i386_mov_to_lea6
1301 $(TEST_OBJDUMP) -dw $< > $@
1302i386_mov_to_lea7.stdout: i386_mov_to_lea7
1303 $(TEST_OBJDUMP) -dw $< > $@
1304i386_mov_to_lea8.stdout: i386_mov_to_lea8
1305 $(TEST_OBJDUMP) -dw $< > $@
1306
b287eca3
L
1307check_PROGRAMS += pr20308a_test
1308pr20308a_test_SOURCES = pr20308_main.c pr20308_def.c
1309pr20308a_test_DEPENDENCIES = pr20308_gd.o pr20308_ld.o gcctestdir/ld gcctestdir/as
1310pr20308a_test_CFLAGS = -Bgcctestdir/ -fPIE
1311pr20308a_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1312pr20308a_test_LDADD = pr20308_gd.o pr20308_ld.o
1313
1314check_PROGRAMS += pr20308b_test
1315pr20308b_test_SOURCES = pr20308_main.c pr20308_def.c
1316pr20308b_test_DEPENDENCIES = pr20308_gd.o pr20308_ld.o gcctestdir/ld gcctestdir/as
1317pr20308b_test_CFLAGS = -Bgcctestdir/ -fPIE
1318pr20308b_test_LDFLAGS = -pie -Bgcctestdir/ -Wl,-R,.
1319pr20308b_test_LDADD = pr20308_gd.o pr20308_ld.o
1320
1321check_PROGRAMS += pr20308c_test
1322pr20308c_test_SOURCES = pr20308_main.c pr20308_def.c
1323pr20308c_test_DEPENDENCIES = pr20308_gd.o pr20308_ld.o gcctestdir/ld gcctestdir/as
1324pr20308c_test_CFLAGS = -Bgcctestdir/ -fPIE
1325pr20308c_test_LDFLAGS = -static -Bgcctestdir/ -Wl,-R,.
1326pr20308c_test_LDADD = pr20308_gd.o pr20308_ld.o
1327
1328check_PROGRAMS += pr20308d_test
1329pr20308d_test_SOURCES = pr20308_main.c pr20308_def.c
1330pr20308d_test_DEPENDENCIES = pr20308a.so gcctestdir/ld gcctestdir/as
1331pr20308d_test_CFLAGS = -Bgcctestdir/ -fPIE
1332pr20308d_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1333pr20308d_test_LDADD = pr20308a.so
1334
1335check_PROGRAMS += pr20308e_test
1336pr20308e_test_SOURCES = pr20308_main.c
1337pr20308e_test_DEPENDENCIES = pr20308_gd.o pr20308_ld.o pr20308b.so gcctestdir/ld gcctestdir/as
1338pr20308e_test_CFLAGS = -Bgcctestdir/ -fPIE
1339pr20308e_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1340pr20308e_test_LDADD = pr20308_gd.o pr20308_ld.o pr20308b.so
1341
1342MOSTLYCLEANFILES += pr20308a.so pr20308b.so
1343
1344pr20308a.so: pr20308_gd.o pr20308_ld.o gcctestdir/ld
1345 $(LINK) -Bgcctestdir/ -shared pr20308_gd.o pr20308_ld.o
1346
1347pr20308b.so: pr20308_def.o gcctestdir/ld
1348 $(LINK) -Bgcctestdir/ -shared pr20308_def.o
1349
a4aa1f5f
CC
1350pr20308_gd.o: pr20308_gd.S gcctestdir/as
1351 $(COMPILE) -Bgcctestdir/ -c -o $@ $<
b287eca3 1352
a4aa1f5f
CC
1353pr20308_ld.o: pr20308_ld.S gcctestdir/as
1354 $(COMPILE) -Bgcctestdir/ -c -o $@ $<
b287eca3 1355
c4fc4724
IT
1356endif DEFAULT_TARGET_I386
1357
d491d34e
ILT
1358check_PROGRAMS += many_sections_test
1359many_sections_test_SOURCES = many_sections_test.cc
1360many_sections_test_DEPENDENCIES = gcctestdir/ld
1361many_sections_test_LDFLAGS = -Bgcctestdir/ -rdynamic
1abce4a6 1362many_sections_test_LDADD =
d491d34e
ILT
1363
1364BUILT_SOURCES += many_sections_define.h
72fef11a 1365MOSTLYCLEANFILES += many_sections_define.h
d491d34e
ILT
1366many_sections_define.h:
1367 (for i in `seq 1 70000`; do \
1368 echo "int var_$$i __attribute__((section(\"section_$$i\"))) = $$i;"; \
1369 done) > $@.tmp
1370 mv -f $@.tmp $@
1371
1372BUILT_SOURCES += many_sections_check.h
72fef11a 1373MOSTLYCLEANFILES += many_sections_check.h
d491d34e 1374many_sections_check.h:
4c94d6ae 1375 (for i in `seq 1 1000 70000`; do \
d491d34e
ILT
1376 echo "assert(var_$$i == $$i);"; \
1377 done) > $@.tmp
1378 mv -f $@.tmp $@
1379
1380check_PROGRAMS += many_sections_r_test
d491d34e
ILT
1381many_sections_r_test.o: many_sections_test.o gcctestdir/ld
1382 gcctestdir/ld -r -o $@ many_sections_test.o
7bc3e21a
ILT
1383many_sections_r_test: many_sections_r_test.o gcctestdir/ld
1384 $(CXXLINK) -Bgcctestdir/ many_sections_r_test.o $(LIBS)
6eee141f 1385
82d93790
CC
1386check_SCRIPTS += file_in_many_sections_test.sh
1387check_DATA += file_in_many_sections.stdout
1388MOSTLYCLEANFILES += file_in_many_sections
1389file_in_many_sections.o: file_in_many_sections.c many_sections_define.h
1390 $(COMPILE) -c -fdata-sections -o $@ $(srcdir)/file_in_many_sections.c
1391file_in_many_sections: file_in_many_sections.o gcctestdir/ld
1392 $(LINK) -Bgcctestdir/ file_in_many_sections.o -Wl,--gc-sections
1393file_in_many_sections.stdout: file_in_many_sections
1394 $(TEST_READELF) -s $< > $@
1395
2fd32231
ILT
1396check_PROGRAMS += initpri1
1397initpri1_SOURCES = initpri1.c
1398initpri1_DEPENDENCIES = gcctestdir/ld
1399initpri1_LDFLAGS = -Bgcctestdir/
1abce4a6 1400initpri1_LDADD =
2fd32231 1401
5393d741
ILT
1402check_PROGRAMS += initpri2
1403initpri2_SOURCES = initpri2.c
1404initpri2_DEPENDENCIES = gcctestdir/ld
7b5de7ee 1405initpri2_LDFLAGS = -Bgcctestdir/ -Wl,--ctors-in-init-array
5393d741 1406initpri2_LDADD =
2fd32231 1407
487b39df
ILT
1408check_PROGRAMS += initpri3a
1409initpri3a_SOURCES = initpri3.c
1410initpri3a_DEPENDENCIES = gcctestdir/ld
1411initpri3a_LDFLAGS = -Bgcctestdir/
1412initpri3a_LDADD =
1413
7c6109da
DK
1414# This test fails on targets not using .ctors and .dtors sections (e.g. ARM
1415# EABI). Given that gcc is moving towards using .init_array in all cases,
1416# this test is commented out. A better fix would be checking whether gcc
1417# uses .ctors or .init_array sections in configure.
1418
1419# check_PROGRAMS += initpri3b
1420# initpri3b_SOURCES = initpri3.c
1421# initpri3b_DEPENDENCIES = gcctestdir/ld
1422# initpri3b_LDFLAGS = -Bgcctestdir/ -Wl,--no-ctors-in-init-array
1423# initpri3b_LDADD =
487b39df 1424
351a8000
ILT
1425# Test --detect-odr-violations
1426check_SCRIPTS += debug_msg.sh
6eee141f 1427
351a8000
ILT
1428# Create the data files that debug_msg.sh analyzes.
1429check_DATA += debug_msg.err
1430MOSTLYCLEANFILES += debug_msg.err
1431debug_msg.o: debug_msg.cc
1432 $(CXXCOMPILE) -O0 -g -c -w -o $@ $(srcdir)/debug_msg.cc
1433odr_violation1.o: odr_violation1.cc
1434 $(CXXCOMPILE) -O0 -g -c -w -o $@ $(srcdir)/odr_violation1.cc
71ff8986
ILT
1435# Compile with different optimization flags to check that rearranged
1436# instructions don't cause a false positive.
351a8000 1437odr_violation2.o: odr_violation2.cc
71ff8986 1438 $(CXXCOMPILE) -O2 -g -c -w -o $@ $(srcdir)/odr_violation2.cc
351a8000
ILT
1439debug_msg.err: debug_msg.o odr_violation1.o odr_violation2.o gcctestdir/ld
1440 @echo $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg debug_msg.o odr_violation1.o odr_violation2.o "2>$@"
1441 @if $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg debug_msg.o odr_violation1.o odr_violation2.o 2>$@; \
1442 then \
1443 echo 1>&2 "Link of debug_msg should have failed"; \
1444 rm -f $@; \
1445 exit 1; \
1446 fi
1447
93acabad
CC
1448# Test error message when a vtable is undefined.
1449check_SCRIPTS += missing_key_func.sh
1450check_DATA += missing_key_func.err
1451MOSTLYCLEANFILES += missing_key_func.err
1452missing_key_func.o: missing_key_func.cc
1453 $(CXXCOMPILE) -O0 -g -c -o $@ $(srcdir)/missing_key_func.cc
1454missing_key_func.err: missing_key_func.o gcctestdir/ld
1455 @echo $(CXXLINK) -Bgcctestdir/ -o missing_key_func missing_key_func.o "2>$@"
1456 @if $(CXXLINK) -Bgcctestdir/ -o missing_key_func missing_key_func.o 2>$@; \
1457 then \
1458 echo 1>&2 "Link of missing_key_func should have failed"; \
1459 rm -f $@; \
1460 exit 1; \
1461 fi
472076e4 1462
472076e4
CC
1463# Check that --detect-odr-violations works with compressed debug sections.
1464check_DATA += debug_msg_cdebug.err
1465MOSTLYCLEANFILES += debug_msg_cdebug.err
1466debug_msg_cdebug.o: debug_msg.cc gcctestdir/as
1467 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -Wa,--compress-debug-sections -c -w -o $@ $(srcdir)/debug_msg.cc
1468odr_violation1_cdebug.o: odr_violation1.cc gcctestdir/as
1469 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -Wa,--compress-debug-sections -c -w -o $@ $(srcdir)/odr_violation1.cc
1470odr_violation2_cdebug.o: odr_violation2.cc gcctestdir/as
1471 $(CXXCOMPILE) -Bgcctestdir/ -O2 -g -Wa,--compress-debug-sections -c -w -o $@ $(srcdir)/odr_violation2.cc
1472debug_msg_cdebug.err: debug_msg_cdebug.o odr_violation1_cdebug.o odr_violation2_cdebug.o gcctestdir/ld
1473 @echo $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_cdebug debug_msg_cdebug.o odr_violation1_cdebug.o odr_violation2_cdebug.o "2>$@"
1474 @if $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_cdebug debug_msg_cdebug.o odr_violation1_cdebug.o odr_violation2_cdebug.o 2>$@; \
1475 then \
1476 echo 1>&2 "Link of debug_msg_cdebug should have failed"; \
1477 rm -f $@; \
1478 exit 1; \
1479 fi
48058663
L
1480check_DATA += debug_msg_cdebug_gabi.err
1481MOSTLYCLEANFILES += debug_msg_cdebug_gabi.err
1482debug_msg_cdebug_gabi.o: debug_msg.cc gcctestdir/as
1483 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -Wa,--compress-debug-sections=zlib-gabi -c -w -o $@ $(srcdir)/debug_msg.cc
1484odr_violation1_cdebug_gabi.o: odr_violation1.cc gcctestdir/as
1485 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -Wa,--compress-debug-sections=zlib-gabi -c -w -o $@ $(srcdir)/odr_violation1.cc
1486odr_violation2_cdebug_gabi.o: odr_violation2.cc gcctestdir/as
1487 $(CXXCOMPILE) -Bgcctestdir/ -O2 -g -Wa,--compress-debug-sections=zlib-gabi -c -w -o $@ $(srcdir)/odr_violation2.cc
1488debug_msg_cdebug_gabi.err: debug_msg_cdebug_gabi.o odr_violation1_cdebug_gabi.o odr_violation2_cdebug_gabi.o gcctestdir/ld
1489 @echo $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_cdebug debug_msg_cdebug_gabi.o odr_violation1_cdebug_gabi.o odr_violation2_cdebug_gabi.o "2>$@"
1490 @if $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_cdebug_gabi debug_msg_cdebug_gabi.o odr_violation1_cdebug_gabi.o odr_violation2_cdebug_gabi.o 2>$@; \
1491 then \
1492 echo 1>&2 "Link of debug_msg_cdebug_gabi should have failed"; \
1493 rm -f $@; \
1494 exit 1; \
1495 fi
472076e4 1496
351a8000
ILT
1497# See if we can also detect problems when we're linking .so's, not .o's.
1498check_DATA += debug_msg_so.err
1499MOSTLYCLEANFILES += debug_msg_so.err
1500debug_msg.so: debug_msg.cc gcctestdir/ld
1501 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -shared -fPIC -w -o $@ $(srcdir)/debug_msg.cc
1502odr_violation1.so: odr_violation1.cc gcctestdir/ld
1503 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -shared -fPIC -w -o $@ $(srcdir)/odr_violation1.cc
1504odr_violation2.so: odr_violation2.cc gcctestdir/ld
71ff8986 1505 $(CXXCOMPILE) -Bgcctestdir/ -O2 -g -shared -fPIC -w -o $@ $(srcdir)/odr_violation2.cc
351a8000 1506debug_msg_so.err: debug_msg.so odr_violation1.so odr_violation2.so gcctestdir/ld
3d587466
CC
1507 @echo $(CXXLINK_S) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_so debug_msg.so odr_violation1.so odr_violation2.so "2>$@"
1508 @if $(CXXLINK_S) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_so debug_msg.so odr_violation1.so odr_violation2.so 2>$@; \
351a8000
ILT
1509 then \
1510 echo 1>&2 "Link of debug_msg_so should have failed"; \
1511 rm -f $@; \
1512 exit 1; \
1513 fi
1514
1515# We also want to make sure we do something reasonable when there's no
1516# debug info available. For the best test, we use .so's.
1517check_DATA += debug_msg_ndebug.err
1518MOSTLYCLEANFILES += debug_msg_ndebug.err
1519debug_msg_ndebug.so: debug_msg.cc gcctestdir/ld
1520 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g0 -shared -fPIC -w -o $@ $(srcdir)/debug_msg.cc
1521odr_violation1_ndebug.so: odr_violation1.cc gcctestdir/ld
1522 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g0 -shared -fPIC -w -o $@ $(srcdir)/odr_violation1.cc
1523odr_violation2_ndebug.so: odr_violation2.cc gcctestdir/ld
71ff8986 1524 $(CXXCOMPILE) -Bgcctestdir/ -O2 -g0 -shared -fPIC -w -o $@ $(srcdir)/odr_violation2.cc
351a8000 1525debug_msg_ndebug.err: debug_msg_ndebug.so odr_violation1_ndebug.so odr_violation2_ndebug.so gcctestdir/ld
3d587466
CC
1526 @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>$@"
1527 @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
1528 then \
1529 echo 1>&2 "Link of debug_msg_ndebug should have failed"; \
1530 rm -f $@; \
1531 exit 1; \
1532 fi
1533
1534
1535# Similar to --detect-odr-violations: check for undefined symbols in .so's
1536check_SCRIPTS += undef_symbol.sh
1537check_DATA += undef_symbol.err
1538MOSTLYCLEANFILES += undef_symbol.err
1539undef_symbol.o: undef_symbol.cc
1540 $(CXXCOMPILE) -O0 -g -c -fPIC $<
1541undef_symbol.so: undef_symbol.o gcctestdir/ld
1542 $(CXXLINK) -Bgcctestdir/ -shared undef_symbol.o
1543undef_symbol.err: undef_symbol_main.o undef_symbol.so gcctestdir/ld
1544 @echo $(CXXLINK) -Bgcctestdir/ -o undef_symbol_test undef_symbol_main.o undef_symbol.so "2>$@"
1545 @if $(CXXLINK) -Bgcctestdir/ -o undef_symbol_test undef_symbol_main.o undef_symbol.so 2>$@; \
1546 then \
1547 echo 1>&2 "Link of undef_symbol_test should have failed"; \
1548 rm -f $@; \
1549 exit 1; \
1550 fi
1551
1552
351a8000
ILT
1553# Test -o when emitting to a special file (such as something in /dev).
1554check_PROGRAMS += flagstest_o_specialfile
0e470e5c 1555flagstest_o_specialfile: flagstest_debug.o gcctestdir/ld
351a8000
ILT
1556 $(CXXLINK) -Bgcctestdir/ -o /dev/stdout $< 2>&1 | cat > $@
1557 chmod a+x $@
1558 test -s $@
1559
fb8b9dbc
L
1560# Test --compress-debug-sections.
1561check_PROGRAMS += flagstest_compress_debug_sections_none
1562check_DATA += flagstest_compress_debug_sections_none.stdout
1563flagstest_compress_debug_sections_none: flagstest_debug.o gcctestdir/ld
1564 $(CXXLINK) -Bgcctestdir/ -o $@ $< -Wl,--compress-debug-sections=none
1565 test -s $@
1566
1567# Dump DWARF debug sections.
1568flagstest_compress_debug_sections_none.stdout: flagstest_compress_debug_sections_none
1569 $(TEST_READELF) -w $< > $@.tmp
1570 mv -f $@.tmp $@
1571
7fcd0256 1572check_PROGRAMS += flagstest_compress_debug_sections
fb8b9dbc
L
1573check_DATA += flagstest_compress_debug_sections.stdout \
1574 flagstest_compress_debug_sections.cmp \
1575 flagstest_compress_debug_sections.check
0863441e
CC
1576MOSTLYCLEANFILES += flagstest_compress_debug_sections.check \
1577 flagstest_compress_debug_sections.cmp
7fcd0256
ILT
1578flagstest_compress_debug_sections: flagstest_debug.o gcctestdir/ld
1579 $(CXXLINK) -Bgcctestdir/ -o $@ $< -Wl,--compress-debug-sections=zlib
1580 test -s $@
1581
9c7fe3c5
CC
1582# Test --compress-debug-sections with --build-id=tree.
1583check_PROGRAMS += flagstest_compress_debug_sections_and_build_id_tree
1584flagstest_compress_debug_sections_and_build_id_tree: flagstest_debug.o gcctestdir/ld
1585 $(CXXLINK) -Bgcctestdir/ -o $@ $< -Wl,--compress-debug-sections=zlib \
1586 -Wl,--build-id=tree \
1587 -Wl,--build-id-chunk-size-for-treehash=4096 \
1588 -Wl,--build-id-min-file-size-for-treehash=0
1589 test -s $@
7fcd0256 1590
fb8b9dbc
L
1591# Dump compressed DWARF debug sections.
1592flagstest_compress_debug_sections.stdout: flagstest_compress_debug_sections
1593 $(TEST_READELF) -w $< | sed -e "s/.zdebug_/.debug_/" > $@.tmp
1594 mv -f $@.tmp $@
1595
19a7fe52 1596# Check there are compressed DWARF .debug_* sections.
fb8b9dbc 1597flagstest_compress_debug_sections.check: flagstest_compress_debug_sections
19a7fe52 1598 $(TEST_READELF) -SW $< | egrep ".debug_.* C *" > $@.tmp
fb8b9dbc
L
1599 mv -f $@.tmp $@
1600
1601# Compare DWARF debug info.
1602flagstest_compress_debug_sections.cmp: flagstest_compress_debug_sections.stdout \
1603 flagstest_compress_debug_sections_none.stdout
1604 cmp flagstest_compress_debug_sections.stdout \
1605 flagstest_compress_debug_sections_none.stdout > $@.tmp
1606 mv -f $@.tmp $@
1607
1608check_PROGRAMS += flagstest_compress_debug_sections_gnu
1609check_DATA += flagstest_compress_debug_sections_gnu.stdout \
1610 flagstest_compress_debug_sections_gnu.cmp \
1611 flagstest_compress_debug_sections_gnu.check
0863441e
CC
1612MOSTLYCLEANFILES += flagstest_compress_debug_sections_gnu.check \
1613 flagstest_compress_debug_sections_gnu.cmp
fb8b9dbc
L
1614flagstest_compress_debug_sections_gnu: flagstest_debug.o gcctestdir/ld
1615 $(CXXLINK) -Bgcctestdir/ -o $@ $< -Wl,--compress-debug-sections=zlib-gnu
1616 test -s $@
1617
1618# Dump compressed DWARF debug sections.
1619flagstest_compress_debug_sections_gnu.stdout: flagstest_compress_debug_sections_gnu
1620 $(TEST_READELF) -w $< | sed -e "s/.zdebug_/.debug_/" > $@.tmp
1621 mv -f $@.tmp $@
1622
1623# Check there are compressed DWARF .zdebug_* sections.
1624flagstest_compress_debug_sections_gnu.check: flagstest_compress_debug_sections_gnu
1625 $(TEST_READELF) -SW $< | grep ".zdebug_" > $@.tmp
1626 mv -f $@.tmp $@
1627
1628# Compare DWARF debug info.
1629flagstest_compress_debug_sections_gnu.cmp: flagstest_compress_debug_sections_gnu.stdout \
1630 flagstest_compress_debug_sections_none.stdout
1631 cmp flagstest_compress_debug_sections_gnu.stdout \
1632 flagstest_compress_debug_sections_none.stdout > $@.tmp
1633 mv -f $@.tmp $@
1634
1635check_PROGRAMS += flagstest_compress_debug_sections_gabi
1636check_DATA += flagstest_compress_debug_sections_gabi.stdout \
1637 flagstest_compress_debug_sections_gabi.cmp \
1638 flagstest_compress_debug_sections_gabi.check
0863441e
CC
1639MOSTLYCLEANFILES += flagstest_compress_debug_sections_gabi.cmp \
1640 flagstest_compress_debug_sections_gabi.check
fb8b9dbc
L
1641flagstest_compress_debug_sections_gabi: flagstest_debug.o gcctestdir/ld
1642 $(CXXLINK) -Bgcctestdir/ -o $@ $< -Wl,--compress-debug-sections=zlib-gabi
1643 test -s $@
1644
1645# Dump compressed DWARF debug sections.
1646flagstest_compress_debug_sections_gabi.stdout: flagstest_compress_debug_sections_gabi
1647 $(TEST_READELF) -w $< > $@.tmp
1648 mv -f $@.tmp $@
1649
1650# Check there are compressed DWARF .debug_* sections.
1651flagstest_compress_debug_sections_gabi.check: flagstest_compress_debug_sections_gabi
1652 $(TEST_READELF) -tW $< | grep "COMPRESSED" > $@.tmp
1653 mv -f $@.tmp $@
1654
1655# Compare DWARF debug info.
1656flagstest_compress_debug_sections_gabi.cmp: flagstest_compress_debug_sections_gabi.stdout \
1657 flagstest_compress_debug_sections_none.stdout
1658 cmp flagstest_compress_debug_sections_gabi.stdout \
1659 flagstest_compress_debug_sections_none.stdout > $@.tmp
1660 mv -f $@.tmp $@
1661
351a8000
ILT
1662# The specialfile output has a tricky case when we also compress debug
1663# sections, because it requires output-file resizing.
1664check_PROGRAMS += flagstest_o_specialfile_and_compress_debug_sections
0e470e5c
ILT
1665flagstest_o_specialfile_and_compress_debug_sections: flagstest_debug.o \
1666 gcctestdir/ld
126f3ece 1667 $(CXXLINK) -Bgcctestdir/ -o /dev/stdout $< -Wl,--compress-debug-sections=zlib 2>&1 | cat > $@
351a8000
ILT
1668 chmod a+x $@
1669 test -s $@
1670
f54f5e31
L
1671check_SCRIPTS += pr18689.sh
1672check_DATA += pr18689.stdout
1673MOSTLYCLEANFILES += pr18689a.o pr18689b.o
1674
1675pr18689.stdout: pr18689b.o
1676 $(TEST_READELF) -SW $< > $@
1677
1678pr18689a.o: pr18689.o ../ld-new
1679 ../ld-new -r -o $@ $<
1680
1681pr18689b.o: pr18689a.o ../ld-new
1682 ../ld-new -r -o $@ $<
1683
1684pr18689.o: pr18689.c gcctestdir/as
1685 $(COMPILE) -Bgcctestdir/ -ggdb3 -g -Wa,--compress-debug-sections=zlib-gabi -c -w -o $@ $(srcdir)/pr18689.c
1686
d12a5ea8
ILT
1687# Test -TText and -Tdata.
1688check_PROGRAMS += flagstest_o_ttext_1
1689flagstest_o_ttext_1: flagstest_debug.o gcctestdir/ld
1690 $(CXXLINK) -Bgcctestdir/ -o $@ $< -Wl,-Ttext,0x400000 -Wl,-Tdata,0x800000
1691
1692# This version won't be runnable, because there is no way to put the
1693# PT_PHDR segment at file offset 0. We just make sure that we can
1694# build it without error.
1695check_DATA += flagstest_o_ttext_2
0ec6429b 1696MOSTLYCLEANFILES += flagstest_o_ttext_2
d12a5ea8
ILT
1697flagstest_o_ttext_2: flagstest_debug.o gcctestdir/ld
1698 $(CXXLINK) -Bgcctestdir/ -o $@ $< -Wl,-Ttext,0x400010 -Wl,-Tdata,0x800010
1699
99f8faca
ILT
1700# Test symbol versioning.
1701check_PROGRAMS += ver_test
1702ver_test_SOURCES = ver_test_main.cc
1703ver_test_DEPENDENCIES = gcctestdir/ld ver_test_1.so ver_test_2.so ver_test_4.so
1704ver_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1705ver_test_LDADD = ver_test_1.so ver_test_2.so ver_test_4.so
1706ver_test_1.so: ver_test_1.o ver_test_2.so ver_test_3.o ver_test_4.so gcctestdir/ld
1707 $(CXXLINK) -Bgcctestdir/ -shared ver_test_1.o ver_test_2.so ver_test_3.o ver_test_4.so
09124467 1708ver_test_2.so: ver_test_2.o $(srcdir)/ver_test_2.script ver_test_4.so gcctestdir/ld
41d0ab5f 1709 $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_2.script -Wl,-R,. ver_test_2.o ver_test_4.so
09124467
ILT
1710ver_test_4.so: ver_test_4.o $(srcdir)/ver_test_4.script gcctestdir/ld
1711 $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_4.script ver_test_4.o
99f8faca
ILT
1712ver_test_1.o: ver_test_1.cc
1713 $(CXXCOMPILE) -c -fpic -o $@ $<
1714ver_test_2.o: ver_test_2.cc
1715 $(CXXCOMPILE) -c -fpic -o $@ $<
1716ver_test_3.o: ver_test_3.cc
1717 $(CXXCOMPILE) -c -fpic -o $@ $<
1718ver_test_4.o: ver_test_4.cc
1719 $(CXXCOMPILE) -c -fpic -o $@ $<
351a8000 1720
0602e05a
ILT
1721check_SCRIPTS += ver_test_1.sh
1722check_DATA += ver_test_1.syms
1723ver_test_1.syms: ver_test_1.so
1724 $(TEST_READELF) -s $< >$@ 2>/dev/null
1725
be3e6201
ILT
1726check_PROGRAMS += ver_test_2
1727ver_test_2_SOURCES = ver_test_main_2.cc
1728ver_test_2_DEPENDENCIES = gcctestdir/ld ver_test_4.so ver_test_2.so
1729ver_test_2_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1730ver_test_2_LDADD = ver_test_4.so ver_test_2.so
1731
be3e6201
ILT
1732check_SCRIPTS += ver_test_2.sh
1733check_DATA += ver_test_2.syms
1734ver_test_2.syms: ver_test_2
6835af53 1735 $(TEST_READELF) -s $< >$@ 2>/dev/null
be3e6201 1736
686c8caf
ILT
1737check_SCRIPTS += ver_test_4.sh
1738check_DATA += ver_test_4.syms
1739ver_test_4.syms: ver_test_4.so
6835af53 1740 $(TEST_READELF) -s $< >$@ 2>/dev/null
5871526f
ILT
1741
1742ver_test_5.so: ver_test_5.o $(srcdir)/ver_test_5.script ver_test_4.so gcctestdir/ld
1743 $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_5.script ver_test_5.o ver_test_4.so
1744ver_test_5.o: ver_test_5.cc
1745 $(CXXCOMPILE) -c -fpic -o $@ $<
1746check_SCRIPTS += ver_test_5.sh
1747check_DATA += ver_test_5.syms
1748ver_test_5.syms: ver_test_5.so
6835af53 1749 $(TEST_READELF) -s $< >$@ 2>/dev/null
5871526f 1750
18e6b24e
ILT
1751check_PROGRAMS += ver_test_6
1752ver_test_6_SOURCES = ver_test_6.c
1753ver_test_6_DEPENDENCIES = gcctestdir/ld ver_test_2.so
1754ver_test_6_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1755ver_test_6_LDADD = ver_test_2.so
1756
479f6503
ILT
1757ver_test_7.so: ver_test_4.o $(srcdir)/ver_test_4.script ver_test_7.o gcctestdir/ld
1758 $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_4.script ver_test_4.o ver_test_7.o
1759ver_test_7.o: ver_test_7.cc
1760 $(CXXCOMPILE) -c -fpic -o $@ $<
1761check_SCRIPTS += ver_test_7.sh
1762check_DATA += ver_test_7.syms
1763ver_test_7.syms: ver_test_7.so
6835af53 1764 $(TEST_READELF) -s $< >$@ 2>/dev/null
479f6503 1765
75517b77
ILT
1766check_PROGRAMS += ver_test_8
1767ver_test_8_SOURCES = two_file_test_main.cc
1768ver_test_8_DEPENDENCIES = gcctestdir/ld ver_test_8_1.so ver_test_8_2.so
1769ver_test_8_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1770ver_test_8_LDADD = ver_test_8_1.so ver_test_8_2.so
1771ver_test_8_1.so: two_file_test_1_pic.o two_file_test_1b_pic.o ver_test_8_2.so gcctestdir/ld
1772 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1_pic.o two_file_test_1b_pic.o ver_test_8_2.so
1773ver_test_8_2.so: two_file_test_2_pic.o $(srcdir)/ver_test_8.script gcctestdir/ld
1774 $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_8.script two_file_test_2_pic.o
1775
40d7d93f
CC
1776check_SCRIPTS += ver_test_8.sh
1777check_DATA += ver_test_8_2.so.syms
1778ver_test_8_2.so.syms: ver_test_8_2.so
1779 $(TEST_READELF) -s $< >$@ 2>/dev/null
1780
95d14cd3
ILT
1781check_PROGRAMS += ver_test_9
1782ver_test_9_SOURCES = ver_test_main.cc
1783ver_test_9_DEPENDENCIES = gcctestdir/ld ver_test_9.so
1784ver_test_9_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1785ver_test_9_LDADD = ver_test_9.so
1786ver_test_9.so: ver_test_9.o ver_test_4.so ver_test_5.so gcctestdir/ld
41d0ab5f 1787 $(CXXLINK) -Bgcctestdir/ -shared -Wl,-R,. ver_test_9.o ver_test_5.so ver_test_4.so
95d14cd3
ILT
1788ver_test_9.o: ver_test_9.cc
1789 $(CXXCOMPILE) -c -fpic -o $@ $<
1790
057ead22
ILT
1791check_SCRIPTS += ver_test_10.sh
1792check_DATA += ver_test_10.syms
1793ver_test_10.syms: ver_test_10.so
1794 $(TEST_READELF) -s $< >$@ 2>/dev/null
1795ver_test_10.so: gcctestdir/ld ver_test_2.o ver_test_10.script
1796 $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_10.script ver_test_2.o
1797
9c5b8369 1798check_PROGRAMS += ver_test_11
72fef11a 1799MOSTLYCLEANFILES += ver_test_11.a
9c5b8369
ILT
1800ver_test_11_SOURCES = ver_test_main_2.cc
1801ver_test_11_DEPENDENCIES = gcctestdir/ld ver_test_11.a
1802ver_test_11_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1803ver_test_11_LDADD = ver_test_11.a
1804ver_test_11.a: ver_test_1.o ver_test_2.o ver_test_4.o
1805 $(TEST_AR) rc $@ $^
1806
6d1c4efb
ILT
1807check_PROGRAMS += ver_test_12
1808ver_test_12_SOURCES = ver_test_main_2.cc
1809ver_test_12_DEPENDENCIES = gcctestdir/ld ver_test_12.o
1810ver_test_12_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1811ver_test_12_LDADD = ver_test_12.o
1812ver_test_12.o: gcctestdir/ld ver_test_1.o ver_test_2.o ver_test_4.o
1813 gcctestdir/ld -r -o $@ ver_test_1.o ver_test_2.o ver_test_4.o
1814
b45e00b3
CC
1815check_SCRIPTS += ver_test_13.sh
1816check_DATA += ver_test_13.syms
1817ver_test_13.syms: ver_test_13.so
1818 $(TEST_READELF) -s $< >$@ 2>/dev/null
1819ver_test_13.so: gcctestdir/ld ver_test_13.o ver_test_13.script
1820 $(LINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_13.script ver_test_13.o
1821ver_test_13.o: ver_test_13.c
1822 $(COMPILE) -c -fpic -o $@ $<
1823
8bdcdf2c
ILT
1824check_PROGRAMS += protected_1
1825protected_1_SOURCES = \
1826 protected_main_1.cc protected_main_2.cc protected_main_3.cc
1827protected_1_DEPENDENCIES = gcctestdir/ld protected_1.so
1828protected_1_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1829protected_1_LDADD = protected_1.so
1830
1831protected_1.so: gcctestdir/ld protected_1_pic.o protected_2_pic.o protected_3_pic.o
1832 $(CXXLINK) -Bgcctestdir/ -shared protected_1_pic.o protected_2_pic.o protected_3_pic.o
1833protected_1_pic.o: protected_1.cc
1834 $(CXXCOMPILE) -c -fpic -o $@ $<
1835protected_2_pic.o: protected_2.cc
1836 $(CXXCOMPILE) -c -fpic -o $@ $<
1837protected_3_pic.o: protected_3.cc
1838 $(CXXCOMPILE) -c -fpic -o $@ $<
1839
1840check_PROGRAMS += protected_2
1841protected_2_SOURCES = protected_main_1.cc protected_3.cc
1842protected_2_DEPENDENCIES = gcctestdir/ld protected_1.so
1843protected_2_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1844protected_2_LDADD = protected_1.so
1845
837504c4
ILT
1846check_DATA += protected_3.err
1847MOSTLYCLEANFILES += protected_3.err
1848protected_4_pic.o: protected_4.cc
1849 $(CXXCOMPILE) -c -fpic -o $@ $<
1850protected_3.err: protected_4_pic.o gcctestdir/ld
1851 @echo $(CXXLINK) -Bgcctestdir/ -shared -o protected_4.so protected_4_pic.o "2>$@"
1852 @if $(CXXLINK) -Bgcctestdir/ -shared -o protected_4.so protected_4_pic.o 2>$@; then \
1853 echo 1>&2 "Link of protected_4.so should have failed"; \
1854 rm -f $@; \
1855 exit 1; \
1856 fi
1857
9f1d377b 1858check_PROGRAMS += relro_test
fc497986
CC
1859check_SCRIPTS += relro_test.sh
1860check_DATA += relro_test.stdout
9f1d377b
ILT
1861relro_test_SOURCES = relro_test_main.cc
1862relro_test_DEPENDENCIES = gcctestdir/ld relro_test.so
1863relro_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1864relro_test_LDADD = relro_test.so
1865relro_test.so: gcctestdir/ld relro_test_pic.o
1866 $(CXXLINK) -Bgcctestdir/ -shared -Wl,-z,relro relro_test_pic.o
1867relro_test_pic.o: relro_test.cc
1868 $(CXXCOMPILE) -c -fpic -o $@ $<
fc497986
CC
1869relro_test.stdout: relro_test.so
1870 $(TEST_READELF) -SlW relro_test.so > relro_test.stdout
9f1d377b 1871
9446efde
ILT
1872check_PROGRAMS += relro_now_test
1873relro_now_test_SOURCES = relro_test_main.cc
1874relro_now_test_DEPENDENCIES = gcctestdir/ld relro_now_test.so
1875relro_now_test_LDFLAGS = -Bgcctestdir -Wl,-R,. -Wl,-z,relro -Wl,-z,now
1876relro_now_test_LDADD = relro_now_test.so
1877relro_now_test.so: gcctestdir/ld relro_test_pic.o
1878 $(CXXLINK) -Bgcctestdir/ -shared -Wl,-z,relro -Wl,-z,now relro_test_pic.o
1879
5f1ab67a
ILT
1880check_PROGRAMS += relro_strip_test
1881relro_strip_test_SOURCES = relro_test_main.cc
1882relro_strip_test_DEPENDENCIES = gcctestdir/ld relro_strip_test.so
1883relro_strip_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1884relro_strip_test_LDADD = relro_strip_test.so
1885relro_strip_test.so: relro_test.so
1886 $(TEST_STRIP) -o $@ $<
1887
2d924fd9
ILT
1888check_PROGRAMS += relro_script_test
1889relro_script_test_SOURCES = relro_test_main.cc
1890relro_script_test_DEPENDENCIES = gcctestdir/ld relro_script_test.so
1891relro_script_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1892relro_script_test_LDADD = relro_script_test.so
1893relro_script_test.so: gcctestdir/ld relro_script_test.t relro_test_pic.o
1496b446 1894 $(CXXLINK) -Bgcctestdir/ -shared -Wl,-z,relro -Wl,-T,$(srcdir)/relro_script_test.t relro_test_pic.o
2d924fd9 1895
e5756efb 1896check_PROGRAMS += script_test_1
5b2af7dd 1897script_test_1_SOURCES = script_test_1a.cc script_test_1b.cc
e5756efb 1898script_test_1_DEPENDENCIES = gcctestdir/ld script_test_1.t
1496b446 1899script_test_1_LDFLAGS = -Bgcctestdir/ -Wl,-R,. -Wl,-T,$(srcdir)/script_test_1.t
1abce4a6 1900script_test_1_LDADD =
e5756efb 1901
a445fddf
ILT
1902check_PROGRAMS += script_test_2
1903script_test_2_SOURCES = script_test_2.cc script_test_2a.cc script_test_2b.cc
1904script_test_2_DEPENDENCIES = gcctestdir/ld script_test_2.t
1496b446 1905script_test_2_LDFLAGS = -Bgcctestdir/ -Wl,-R,. -Wl,-T,$(srcdir)/script_test_2.t
1abce4a6 1906script_test_2_LDADD =
a445fddf 1907
88dd47ac
ILT
1908check_PROGRAMS += justsyms
1909justsyms_SOURCES = justsyms_1.cc
1910justsyms_DEPENDENCIES = gcctestdir/ld justsyms_2r.o
1911justsyms_LDFLAGS = -Bgcctestdir/ -Wl,-R,justsyms_2r.o
1abce4a6 1912justsyms_LDADD =
88dd47ac
ILT
1913justsyms_2.o: justsyms_2.cc
1914 $(CXXCOMPILE) -c -o $@ $<
83bfb6b7 1915justsyms_2r.o: justsyms_2.o gcctestdir/ld $(srcdir)/justsyms.t
52dc3f9c 1916 gcctestdir/ld -o $@ -r -T $(srcdir)/justsyms.t justsyms_2.o
88dd47ac 1917
c3f7b0e5
CC
1918check_PROGRAMS += justsyms_exec
1919justsyms_exec_SOURCES = justsyms_exec.c
1920justsyms_exec_DEPENDENCIES = gcctestdir/ld justsyms_lib
1921justsyms_exec_LDFLAGS = -Bgcctestdir/ -Wl,-R,justsyms_lib
1922justsyms_exec_LDADD =
0ec6429b 1923MOSTLYCLEANFILES += justsyms_lib
c3f7b0e5
CC
1924justsyms_lib.o: justsyms_lib.c
1925 $(COMPILE) -c -o $@ $<
1926justsyms_lib: justsyms_lib.o gcctestdir/ld
1927 gcctestdir/ld -o $@ -Ttext=0x1000200 -Tdata=0x2000000 -e exported_func justsyms_lib.o
1928
bc644c6c 1929check_PROGRAMS += binary_test
72fef11a 1930MOSTLYCLEANFILES += binary.txt
bc644c6c
ILT
1931binary_test_SOURCES = binary_test.cc
1932binary_test_DEPENDENCIES = gcctestdir/ld binary.txt
1933binary_test_LDFLAGS = -Bgcctestdir/ -Wl,--format,binary,binary.txt,--format,elf
1abce4a6 1934binary_test_LDADD =
bc644c6c
ILT
1935# Copy the file to the build directory to avoid worrying about the
1936# full pathname in the generated symbols.
1937binary.txt: $(srcdir)/binary.in
1938 rm -f $@
1939 $(LN_S) $< $@
1940
09124467
ILT
1941check_SCRIPTS += ver_matching_test.sh
1942check_DATA += ver_matching_test.stdout
1943MOSTLYCLEANFILES += ver_matching_test.stdout
2fbb4320
ILT
1944ver_matching_def.so: ver_matching_def_pic.o $(srcdir)/version_script.map gcctestdir/ld
1945 $(CXXLINK) -O0 -Bgcctestdir/ -shared ver_matching_def_pic.o -Wl,--version-script=$(srcdir)/version_script.map
1946ver_matching_def_pic.o: ver_matching_def.cc
1947 $(CXXCOMPILE) -O0 -c -fpic -o $@ $<
09124467 1948ver_matching_test.stdout: ver_matching_def.so
52dc3f9c 1949 $(TEST_OBJDUMP) -T ver_matching_def.so | $(TEST_CXXFILT) > ver_matching_test.stdout
1c4f3631
ILT
1950
1951check_PROGRAMS += script_test_3
1952check_SCRIPTS += script_test_3.sh
1953check_DATA += script_test_3.stdout
1954MOSTLYCLEANFILES += script_test_3.stdout
1955script_test_3: basic_test.o gcctestdir/ld script_test_3.t
1496b446 1956 $(CXXLINK) -Bgcctestdir/ basic_test.o -Wl,-T,$(srcdir)/script_test_3.t
1c4f3631 1957script_test_3.stdout: script_test_3
2cefc357 1958 $(TEST_READELF) -SlW script_test_3 > script_test_3.stdout
09124467 1959
4ebf39db
ILT
1960check_PROGRAMS += tls_phdrs_script_test
1961tls_phdrs_script_test_SOURCES = $(tls_test_SOURCES)
1962tls_phdrs_script_test_DEPENDENCIES = $(tls_test_DEPENDENCIES) $(srcdir)/script_test_3.t
1496b446 1963tls_phdrs_script_test_LDFLAGS = $(tls_test_LDFLAGS) -Wl,-T,$(srcdir)/script_test_3.t
4ebf39db
ILT
1964tls_phdrs_script_test_LDADD = $(tls_test_LDADD)
1965
e6188289
ILT
1966check_SCRIPTS += script_test_4.sh
1967check_DATA += script_test_4.stdout
72fef11a 1968MOSTLYCLEANFILES += script_test_4
e6188289 1969script_test_4: basic_test.o gcctestdir/ld $(srcdir)/script_test_4.t
1496b446 1970 $(CXXLINK) -Bgcctestdir/ basic_test.o -Wl,-T,$(srcdir)/script_test_4.t
e6188289
ILT
1971script_test_4.stdout: script_test_4
1972 $(TEST_READELF) -SlW script_test_4 > script_test_4.stdout
1973
6c93b22c
ILT
1974check_PROGRAMS += tls_script_test
1975tls_script_test_SOURCES = $(tls_test_SOURCES)
1976tls_script_test_DEPENDENCIES = $(tls_test_DEPENDENCIES) $(srcdir)/script_test_4.t
1496b446 1977tls_script_test_LDFLAGS = $(tls_test_LDFLAGS) -Wl,-T,$(srcdir)/script_test_4.t
6c93b22c
ILT
1978tls_script_test_LDADD = $(tls_test_LDADD)
1979
401a9a73
CC
1980check_SCRIPTS += script_test_5.sh
1981check_DATA += script_test_5.stdout
72fef11a 1982MOSTLYCLEANFILES += script_test_5
401a9a73 1983script_test_5: script_test_5.o gcctestdir/ld $(srcdir)/script_test_5.t
1496b446 1984 $(CXXLINK) -Bgcctestdir/ script_test_5.o -Wl,-T,$(srcdir)/script_test_5.t
401a9a73
CC
1985script_test_5.stdout: script_test_5
1986 $(TEST_READELF) -SW script_test_5 > script_test_5.stdout
1987
3c12dcdb
DK
1988check_SCRIPTS += script_test_6.sh
1989check_DATA += script_test_6.stdout
1990MOSTLYCLEANFILES += script_test_6
1991script_test_6: basic_test.o gcctestdir/ld $(srcdir)/script_test_6.t
1496b446 1992 $(CXXLINK) -Bgcctestdir/ basic_test.o -Wl,-T,$(srcdir)/script_test_6.t \
3c12dcdb
DK
1993 -Wl,-Ttext=0x10001000 -Wl,-Tdata=0x10200000 -Wl,-Tbss=0x10400000
1994script_test_6.stdout: script_test_6
1995 $(TEST_READELF) -SlW script_test_6 > script_test_6.stdout
1996
1997check_SCRIPTS += script_test_7.sh
1998check_DATA += script_test_7.stdout
1999MOSTLYCLEANFILES += script_test_7
2000script_test_7: basic_test.o gcctestdir/ld $(srcdir)/script_test_7.t
1496b446 2001 $(CXXLINK) -Bgcctestdir/ basic_test.o -Wl,-T,$(srcdir)/script_test_7.t
3c12dcdb
DK
2002script_test_7.stdout: script_test_7
2003 $(TEST_READELF) -SlW script_test_7 > script_test_7.stdout
2004
2005check_SCRIPTS += script_test_8.sh
2006check_DATA += script_test_8.stdout
2007MOSTLYCLEANFILES += script_test_8
2008script_test_8: basic_test.o gcctestdir/ld $(srcdir)/script_test_7.t
1496b446 2009 $(CXXLINK) -Bgcctestdir/ basic_test.o -Wl,-T,$(srcdir)/script_test_7.t \
3c12dcdb
DK
2010 -Wl,-Ttext=0x20001000 -Wl,-Tdata=0x20200000 -Wl,-Tbss=0x20400000
2011script_test_8.stdout: script_test_8
2012 $(TEST_READELF) -SlW script_test_8 > script_test_8.stdout
2013
d103a984
RÁE
2014check_SCRIPTS += script_test_9.sh
2015check_DATA += script_test_9.stdout
0ec6429b 2016MOSTLYCLEANFILES += script_test_9
d103a984
RÁE
2017script_test_9.o: script_test_9.cc
2018 $(CXXCOMPILE) -O0 -c -o $@ $<
2019script_test_9: gcctestdir/ld $(srcdir)/script_test_9.t script_test_9.o
1496b446 2020 $(CXXLINK) -Bgcctestdir/ script_test_9.o -Wl,-T,$(srcdir)/script_test_9.t
d103a984
RÁE
2021script_test_9.stdout: script_test_9
2022 $(TEST_READELF) -lW script_test_9 > script_test_9.stdout
2023
502e8a84
CC
2024# Test scripts with a relocatable link.
2025# The -g option is necessary to trigger a bug where a section
2026# declared in a script file is assigned a non-zero starting address.
2027check_PROGRAMS += script_test_11
2028script_test_11: gcctestdir/ld script_test_11_r.o
2029 $(LINK) -Bgcctestdir/ script_test_11_r.o
5b2af7dd
L
2030script_test_11_r.o: gcctestdir/ld $(srcdir)/script_test_11.t script_test_11a.o script_test_11b.o
2031 gcctestdir/ld -r -o $@ -T $(srcdir)/script_test_11.t script_test_11a.o script_test_11b.o
2032script_test_11a.o: script_test_11a.c
2033 $(COMPILE) -c -g -o $@ $<
2034script_test_11b.o: script_test_11b.c
502e8a84 2035 $(COMPILE) -c -g -o $@ $<
d103a984 2036
374082df
CC
2037# Test difference between "*(a b)" and "*(a) *(b)" in input section spec.
2038check_PROGRAMS += script_test_12
2039script_test_12: gcctestdir/ld $(srcdir)/script_test_12.t script_test_12a.o script_test_12b.o
2040 $(LINK) -Bgcctestdir/ -Wl,-T,$(srcdir)/script_test_12.t script_test_12a.o script_test_12b.o
2041
2042check_PROGRAMS += script_test_12i
2043script_test_12i: gcctestdir/ld $(srcdir)/script_test_12i.t script_test_12a.o script_test_12b.o
2044 $(LINK) -Bgcctestdir/ -Wl,-T,$(srcdir)/script_test_12i.t script_test_12a.o script_test_12b.o
a3a0c391
JY
2045script_test_12a.o: script_test_12a.c
2046 $(COMPILE) -O0 -c -o $@ $<
2047script_test_12b.o: script_test_12b.c
2048 $(COMPILE) -O0 -c -o $@ $<
374082df 2049
bfbf34de
CC
2050# Test for ordering internally created sections with a linker script.
2051check_SCRIPTS += script_test_13.sh
2052check_DATA += script_test_13.stdout
2053MOSTLYCLEANFILES += script_test_13
2054script_test_13.o: script_test_13.c
2055 $(COMPILE) -O0 -c -fPIC -o $@ $<
2056script_test_13: $(srcdir)/script_test_13.t script_test_13.o gcctestdir/ld
2057 gcctestdir/ld -shared -o $@ script_test_13.o -T $(srcdir)/script_test_13.t
2058script_test_13.stdout: script_test_13
2059 $(TEST_READELF) -SW script_test_13 > $@
2060
f224a3c5
IK
2061# Test for SORT_BY_INIT_PRIORITY.
2062check_SCRIPTS += script_test_14.sh
2063check_DATA += script_test_14.stdout
2064MOSTLYCLEANFILES += script_test_14
2065script_test_14.o: script_test_14.s
2066 $(TEST_AS) -o $@ $<
2067script_test_14: $(srcdir)/script_test_14.t script_test_14.o gcctestdir/ld
2068 gcctestdir/ld -o $@ script_test_14.o -T $(srcdir)/script_test_14.t
2069script_test_14.stdout: script_test_14
2070 $(TEST_OBJDUMP) -s script_test_14 > $@
2071
5d9f66cb
CC
2072# Test BSS section placement at end of segment.
2073check_SCRIPTS += script_test_15a.sh
2074check_DATA += script_test_15a.stdout
2075MOSTLYCLEANFILES += script_test_15a
2076script_test_15a: $(srcdir)/script_test_15a.t script_test_15.o gcctestdir/ld
2077 gcctestdir/ld -o $@ script_test_15.o -T $(srcdir)/script_test_15a.t
2078script_test_15a.stdout: script_test_15a
2079 $(TEST_READELF) -lSW script_test_15a > $@
2080
2081# Test BSS section placement in middle of segment.
2082check_SCRIPTS += script_test_15b.sh
2083check_DATA += script_test_15b.stdout
2084MOSTLYCLEANFILES += script_test_15b
2085script_test_15b: $(srcdir)/script_test_15b.t script_test_15.o gcctestdir/ld
2086 gcctestdir/ld -o $@ script_test_15.o -T $(srcdir)/script_test_15b.t
2087script_test_15b.stdout: script_test_15b
2088 $(TEST_READELF) -lSW script_test_15b > $@
2089
2090# Test orphan BSS section placement.
2091check_SCRIPTS += script_test_15c.sh
2092check_DATA += script_test_15c.stdout
2093MOSTLYCLEANFILES += script_test_15c
2094script_test_15c: $(srcdir)/script_test_15c.t script_test_15.o gcctestdir/ld
2095 gcctestdir/ld -o $@ script_test_15.o -T $(srcdir)/script_test_15c.t
2096script_test_15c.stdout: script_test_15c
2097 $(TEST_READELF) -lSW script_test_15c > $@
2098
c82fbeee
CS
2099# Test --dynamic-list, --dynamic-list-data, --dynamic-list-cpp-new,
2100# and --dynamic-list-cpp-typeinfo
2101
2102check_SCRIPTS += dynamic_list.sh
2103check_DATA += dynamic_list.stdout
72fef11a 2104MOSTLYCLEANFILES += dynamic_list dynamic_list.stdout
c82fbeee
CS
2105dynamic_list: basic_test.o gcctestdir/ld $(srcdir)/dynamic_list.t
2106 $(CXXLINK) -Bgcctestdir/ basic_test.o \
2107 -Wl,--dynamic-list $(srcdir)/dynamic_list.t \
2108 -Wl,--dynamic-list-data \
2109 -Wl,--dynamic-list-cpp-new \
2110 -Wl,--dynamic-list-cpp-typeinfo
2111dynamic_list.stdout: dynamic_list
94e6ee91 2112 $(TEST_READELF) -W --dyn-syms dynamic_list > dynamic_list.stdout
c82fbeee 2113
fd834e57
CC
2114check_PROGRAMS += dynamic_list_2
2115dynamic_list_2_SOURCES = dynamic_list_2.cc
2116dynamic_list_2_DEPENDENCIES = gcctestdir/ld dynamic_list_lib1.so dynamic_list_lib2.so
2117dynamic_list_2_LDFLAGS = -Bgcctestdir/ -L. -Wl,-R,. -Wl,--no-as-needed
2118dynamic_list_2_LDADD = dynamic_list_lib1.so dynamic_list_lib2.so
2119
2120dynamic_list_lib1.so: gcctestdir/ld dynamic_list_lib1.o
2121 $(CXXLINK) -Bgcctestdir/ -shared dynamic_list_lib1.o
2122dynamic_list_lib1.o: dynamic_list_lib1.cc
2123 $(CXXCOMPILE) -c -fpic -o $@ $<
2124
2125dynamic_list_lib2.so: gcctestdir/ld dynamic_list_lib2.o $(srcdir)/dynamic_list_2.t
e9c1bdad 2126 $(CXXLINK) -Bgcctestdir/ -shared -Wl,-Bsymbolic-functions -Wl,--dynamic-list,$(srcdir)/dynamic_list_2.t dynamic_list_lib2.o
fd834e57
CC
2127dynamic_list_lib2.o: dynamic_list_lib2.cc
2128 $(CXXCOMPILE) -c -fpic -o $@ $<
2129
fbd8a257 2130check_PROGRAMS += thin_archive_test_1
72fef11a
CC
2131MOSTLYCLEANFILES += libthin1.a libthin3.a libthinall.a \
2132 alt/thin_archive_test_2.o alt/thin_archive_test_4.o \
2133 alt/libthin2.a alt/libthin4.a
fbd8a257
CC
2134thin_archive_test_1_SOURCES = thin_archive_main.cc
2135thin_archive_test_1_DEPENDENCIES = gcctestdir/ld libthin1.a alt/libthin2.a
2136thin_archive_test_1_LDFLAGS = -Bgcctestdir/ -Lalt
2137thin_archive_test_1_LDADD = libthin1.a -lthin2
2138
2139check_PROGRAMS += thin_archive_test_2
2140thin_archive_test_2_SOURCES = thin_archive_main.cc
2141thin_archive_test_2_DEPENDENCIES = gcctestdir/ld libthinall.a
2142thin_archive_test_2_LDFLAGS = -Bgcctestdir/ -L.
2143thin_archive_test_2_LDADD = -lthinall
2144
2145libthin1.a: thin_archive_test_1.o alt/thin_archive_test_2.o
2146 rm -f $@
2147 $(TEST_AR) crT $@ $^
2148alt/libthin2.a: thin_archive_test_3.o alt/thin_archive_test_4.o
2149 rm -f $@
2150 $(TEST_AR) crT $@ $^
2151libthin3.a: thin_archive_test_1.o alt/thin_archive_test_4.o
2152 rm -f $@
2153 $(TEST_AR) crT $@ $^
2154alt/libthin4.a: alt/thin_archive_test_2.o thin_archive_test_3.o
2155 rm -f $@
2156 $(TEST_AR) crT $@ $^
2157libthinall.a: libthin3.a alt/libthin4.a
2158 rm -f $@
2159 $(TEST_AR) crT $@ $^
2160alt/thin_archive_test_2.o: thin_archive_test_2.cc
2161 test -d alt || mkdir -p alt
2162 $(CXXCOMPILE) -c -o $@ $<
2163alt/thin_archive_test_4.o: thin_archive_test_4.cc
2164 test -d alt || mkdir -p alt
2165 $(CXXCOMPILE) -c -o $@ $<
2166
89fc3421
CC
2167if PLUGINS
2168
2169check_PROGRAMS += plugin_test_1
2170check_SCRIPTS += plugin_test_1.sh
2171check_DATA += plugin_test_1.err
2172MOSTLYCLEANFILES += plugin_test_1.err
2cfbf2fe
CC
2173plugin_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
2174 $(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
2175plugin_test_1.err: plugin_test_1
2176 @touch plugin_test_1.err
2177
2178check_PROGRAMS += plugin_test_2
2179check_SCRIPTS += plugin_test_2.sh
2180check_DATA += plugin_test_2.err
2181MOSTLYCLEANFILES += plugin_test_2.err
2cfbf2fe
CC
2182plugin_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
2183 $(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
2184plugin_test_2.err: plugin_test_2
2185 @touch plugin_test_2.err
2186
d66a9eb3
CC
2187check_PROGRAMS += plugin_test_3
2188check_SCRIPTS += plugin_test_3.sh
2189check_DATA += plugin_test_3.err
2190MOSTLYCLEANFILES += plugin_test_3.err
2cfbf2fe
CC
2191plugin_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
2192 $(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
2193plugin_test_3.err: plugin_test_3
2194 @touch plugin_test_3.err
2195
0f7c0701
CC
2196check_PROGRAMS += plugin_test_4
2197check_SCRIPTS += plugin_test_4.sh
2198check_DATA += plugin_test_4.err
72fef11a 2199MOSTLYCLEANFILES += plugin_test_4.a plugin_test_4.err
0f7c0701
CC
2200plugin_test_4: two_file_test_main.o plugin_test_4.a gcctestdir/ld plugin_test.so
2201 $(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
2202plugin_test_4.err: plugin_test_4
2203 @touch plugin_test_4.err
2204
2cfbf2fe 2205plugin_test_4.a: two_file_test_1.o.syms two_file_test_1b.o.syms two_file_test_2.o.syms
0f7c0701
CC
2206 $(TEST_AR) cr $@ $^
2207
24998053 2208check_PROGRAMS += plugin_test_5
2cfbf2fe
CC
2209plugin_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
2210 $(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 2211
be234d88
CC
2212check_PROGRAMS += plugin_test_6
2213check_SCRIPTS += plugin_test_6.sh
2214check_DATA += plugin_test_6.err
2215MOSTLYCLEANFILES += plugin_test_6.err
2cfbf2fe
CC
2216plugin_test_6: plugin_common_test_1.o.syms plugin_common_test_2.o.syms gcctestdir/ld plugin_test.so
2217 $(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
2218plugin_test_6.err: plugin_test_6
2219 @touch plugin_test_6.err
2220
5e0f337e
RÁE
2221check_PROGRAMS += plugin_test_7
2222check_SCRIPTS += plugin_test_7.sh
2cfbf2fe 2223check_DATA += plugin_test_7.err plugin_test_7.o.syms
5e0f337e 2224MOSTLYCLEANFILES += plugin_test_7.err
2cfbf2fe
CC
2225plugin_test_7: plugin_test_7_1.o plugin_test_7_1.o.syms plugin_test_7_2.o gcctestdir/ld plugin_test.so
2226 $(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
2227plugin_test_7.o.syms: plugin_test_7
5e0f337e
RÁE
2228 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2229plugin_test_7_1.o: plugin_test_7_1.c
2230 $(COMPILE) -DLTO -O0 -c -ffunction-sections -fdata-sections -o $@ $<
2231plugin_test_7_1_orig.o: plugin_test_7_1.c
2232 $(COMPILE) -O0 -c -ffunction-sections -fdata-sections -o $@ $<
2cfbf2fe 2233plugin_test_7_1.o.syms: plugin_test_7_1_orig.o
5e0f337e
RÁE
2234 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2235plugin_test_7_2.o: plugin_test_7_2.c
2236 $(COMPILE) -O0 -c -ffunction-sections -fdata-sections -o $@ $<
2237plugin_test_7.err: plugin_test_7
2238
f3a2388f
CC
2239# Test plugins with -r.
2240check_PROGRAMS += plugin_test_8
2cfbf2fe
CC
2241plugin_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
2242 ../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
2243plugin_test_8: plugin_test_8.o gcctestdir/ld
2244 $(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle plugin_test_8.o
2245
2246# Test that symbols known in the IR file but not in the replacement file
2247# produce an unresolved symbol error.
2248check_DATA += plugin_test_9.err
2249MOSTLYCLEANFILES += plugin_test_9.err
2cfbf2fe
CC
2250plugin_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
2251 @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>$@"
2252 @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
2253 echo 1>&2 "Link of plugin_test_9 should have failed"; \
2254 rm -f $@; \
2255 exit 1; \
2256 fi
2257# Make a .syms file that claims to define the symbol _Z4t16av.
2cfbf2fe
CC
2258two_file_test_1c.o.syms: two_file_test_1.o.syms two_file_test_1c.o
2259 cp two_file_test_1.o.syms $@.tmp
2260 grep "_Z4t16av" two_file_test_1b.o.syms >> $@.tmp
f3a2388f
CC
2261 mv -f $@.tmp $@
2262# Make a copy of two_file_test_1.o, which does not define the symbol _Z4t16av.
2263MOSTLYCLEANFILES += two_file_test_1c.o
2264two_file_test_1c.o: two_file_test_1.o
2265 cp two_file_test_1.o $@
2266
648c5cbb
CC
2267# As above, but check COMDAT case, where a non-IR file contains a duplicate
2268# of a COMDAT group in an IR file.
2269check_DATA += plugin_test_9b.err
2270MOSTLYCLEANFILES += plugin_test_9b.err
2271plugin_test_9b.err: plugin_test_9b_ir.o.syms plugin_test_9b_ir.o plugin_test_9b_elf.o gcctestdir/ld plugin_test.so
2272 @echo $(CXXLINK) -Bgcctestdir/ -o plugin_test_9b -Wl,--no-demangle,--plugin,"./plugin_test.so",--plugin-opt,"_ZN1A5printEv" plugin_test_9b_ir.o plugin_test_9b_elf.o "2>$@"
2273 @if $(CXXLINK) -Bgcctestdir/ -o plugin_test_9b -Wl,--no-demangle,--plugin,"./plugin_test.so",--plugin-opt,"_ZN1A5printEv" plugin_test_9b_ir.o plugin_test_9b_elf.o 2>$@; then \
2274 echo 1>&2 "Link of plugin_test_9b should have failed"; \
2275 rm -f $@; \
2276 exit 1; \
2277 fi
2278# Make a .syms file that claims to define a method in class A in a COMDAT group.
2279# The real plugin_test_9b_ir.o will be compiled without the -D, and will not
2280# define any methods in class A.
2281plugin_test_9b_ir.o.syms: plugin_test_9b_ir_witha.o
2282 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2283plugin_test_9b_ir_witha.o: plugin_test_9b_ir.cc
2284 $(CXXCOMPILE) -c -DUSE_CLASS_A -o $@ $<
2285
c0c71592
RÁE
2286check_PROGRAMS += plugin_test_10
2287check_SCRIPTS += plugin_test_10.sh
2288check_DATA += plugin_test_10.sections
2289MOSTLYCLEANFILES += plugin_test_10.sections
2cfbf2fe
CC
2290plugin_test_10: plugin_common_test_1.o.syms plugin_common_test_2.o gcctestdir/ld plugin_test.so
2291 $(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle,--plugin,"./plugin_test.so" plugin_common_test_1.o.syms plugin_common_test_2.o
c0c71592
RÁE
2292plugin_test_10.sections: plugin_test_10
2293 $(TEST_READELF) -SW $< >$@ 2>/dev/null
2294
2cfbf2fe
CC
2295check_PROGRAMS += plugin_test_11
2296check_SCRIPTS += plugin_test_11.sh
2297check_DATA += plugin_test_11.err
dddcc5b9 2298MOSTLYCLEANFILES += plugin_test_11.err plugin_test_thin.a
2cfbf2fe
CC
2299PLUGIN_TEST_11_SYMS = two_file_test_1.o.syms two_file_test_1b.o.syms two_file_test_2.o.syms
2300plugin_test_11: two_file_test_main.o plugin_test_thin.a gcctestdir/ld plugin_test.so $(PLUGIN_TEST_11_SYMS)
2301 $(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
2302plugin_test_11.err: plugin_test_11
2303 @touch plugin_test_11.err
2304plugin_test_thin.a: two_file_test_1.o two_file_test_1b.o two_file_test_2.o
2305 rm -f $@
2306 $(TEST_AR) crT $@ $^
c0c71592 2307
ca464aac
TJ
2308check_PROGRAMS += plugin_test_12
2309check_SCRIPTS += plugin_test_12.sh
2310check_DATA += plugin_test_12.err
2311MOSTLYCLEANFILES += plugin_test_12.err
2312export_dynamic_plugin.o.syms: export_dynamic_plugin.o
2313 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2314export_dynamic_plugin.o: export_dynamic_plugin.cc
2315 $(COMPILE) -c -o $@ $<
2316plugin_test_12: export_dynamic_plugin.o gcctestdir/ld plugin_test.so export_dynamic_plugin.o.syms
2317 $(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle,--plugin,"./plugin_test.so",--plugin-opt,"_Z3foov" -Wl,--export-dynamic-symbol,"_Z3foov" export_dynamic_plugin.o.syms 2>plugin_test_12.err
2318plugin_test_12.err: plugin_test_12
2319 @touch plugin_test_12.err
95ecdfbf
ES
2320
2321check_PROGRAMS += plugin_test_start_lib
2322check_SCRIPTS += plugin_test_start_lib.sh
2323check_DATA += plugin_test_start_lib.err
2324MOSTLYCLEANFILES += plugin_test_start_lib.err
2325plugin_test_start_lib: unused.o plugin_start_lib_test.o plugin_start_lib_test_2.syms gcctestdir/ld plugin_test.so
2326 $(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle,--plugin,"./plugin_test.so" plugin_start_lib_test.o \
2327 -Wl,--start-lib plugin_start_lib_test_2.syms -Wl,--end-lib 2>plugin_test_start_lib.err
2328plugin_test_start_lib.err: plugin_test_start_lib
2329 @touch plugin_test_start_lib.err
2330
2331
2332plugin_start_lib_test_2.syms: plugin_start_lib_test_2.o
2333 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2334
2335
78d9f182 2336plugin_test.so: plugin_test.o gcctestdir/ld
89fc3421
CC
2337 $(LINK) -Bgcctestdir/ -shared plugin_test.o
2338plugin_test.o: plugin_test.c
2339 $(COMPILE) -O0 -c -fpic -o $@ $<
2340
2cfbf2fe 2341two_file_test_main.o.syms: two_file_test_main.o
89fc3421 2342 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2cfbf2fe 2343two_file_test_1.o.syms: two_file_test_1.o
89fc3421 2344 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2cfbf2fe 2345two_file_test_1b.o.syms: two_file_test_1b.o
89fc3421 2346 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2cfbf2fe 2347two_file_test_2.o.syms: two_file_test_2.o
89fc3421 2348 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2cfbf2fe 2349plugin_common_test_1.o.syms: plugin_common_test_1.o
be234d88 2350 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2cfbf2fe 2351plugin_common_test_2.o.syms: plugin_common_test_2.o
be234d88 2352 $(TEST_READELF) -sW $< >$@ 2>/dev/null
24998053 2353
2cfbf2fe 2354empty.o.syms:
24998053
CC
2355 @echo "" >$@
2356 @echo "Symbol table" >>$@
2357
32364e50
CC
2358if TLS
2359
2360check_PROGRAMS += plugin_test_tls
2361check_SCRIPTS += plugin_test_tls.sh
2362check_DATA += plugin_test_tls.err
2363MOSTLYCLEANFILES += plugin_test_tls.err
2cfbf2fe
CC
2364plugin_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
2365 $(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
2366plugin_test_tls.err: plugin_test_tls
2367 @touch plugin_test_tls.err
2368
2cfbf2fe 2369two_file_test_2_tls.o.syms: two_file_test_2_tls.o
32364e50
CC
2370 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2371
2372endif TLS
2373
24998053 2374MOSTLYCLEANFILES += unused.c
2cfbf2fe 2375unused.o.syms: unused.o
24998053
CC
2376 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2377 @echo " 1: 00000000 4 FUNC GLOBAL DEFAULT 1 UNUSED" >>$@
2378unused.o: unused.c
2379 $(COMPILE) -c -o $@ $<
2380unused.c:
2381 @cp /dev/null $@
89fc3421 2382
f0558624 2383check_SCRIPTS += plugin_final_layout.sh
16164a6b 2384check_DATA += plugin_final_layout.stdout plugin_final_layout_readelf.stdout
0ec6429b 2385MOSTLYCLEANFILES += plugin_final_layout
f0558624
ST
2386plugin_final_layout.o: plugin_final_layout.cc
2387 $(CXXCOMPILE) -O0 -c -ffunction-sections -fdata-sections -g -o $@ $<
2388plugin_final_layout: plugin_final_layout.o plugin_section_order.so gcctestdir/ld
2389 $(CXXLINK) -Bgcctestdir/ -Wl,--plugin,"./plugin_section_order.so" plugin_final_layout.o
2390plugin_final_layout.stdout: plugin_final_layout
864a1b56 2391 $(TEST_NM) -n --synthetic plugin_final_layout > plugin_final_layout.stdout
16164a6b
ST
2392plugin_final_layout_readelf.stdout: plugin_final_layout
2393 $(TEST_READELF) -Wl plugin_final_layout > plugin_final_layout_readelf.stdout
f0558624 2394
78d9f182 2395plugin_section_order.so: plugin_section_order.o gcctestdir/ld
f0558624
ST
2396 $(LINK) -Bgcctestdir/ -shared plugin_section_order.o
2397plugin_section_order.o: plugin_section_order.c
2398 $(COMPILE) -O0 -c -fpic -o $@ $<
2399
82838bd6
CC
2400check_SCRIPTS += plugin_layout_with_alignment.sh
2401check_DATA += plugin_layout_with_alignment.stdout
2402MOSTLYCLEANFILES += plugin_layout_with_alignment
fd91f002
L
2403plugin_layout_with_alignment.o: plugin_layout_with_alignment.c
2404 $(COMPILE) -O0 -c -ffunction-sections -fdata-sections -g -o $@ $<
82838bd6 2405plugin_layout_with_alignment: plugin_layout_with_alignment.o plugin_section_alignment.so gcctestdir/ld
fd91f002 2406 $(LINK) -Bgcctestdir/ -Wl,--plugin,"./plugin_section_alignment.so" plugin_layout_with_alignment.o
82838bd6
CC
2407plugin_layout_with_alignment.stdout: plugin_layout_with_alignment
2408 $(TEST_NM) -n --synthetic plugin_layout_with_alignment > plugin_layout_with_alignment.stdout
2409
78d9f182 2410plugin_section_alignment.so: plugin_section_alignment.o gcctestdir/ld
82838bd6
CC
2411 $(CXXLINK) -Bgcctestdir/ -shared plugin_section_alignment.o
2412plugin_section_alignment.o: plugin_section_alignment.cc
2413 $(CXXCOMPILE) -O0 -c -fpic -o $@ $<
2414
89fc3421
CC
2415endif PLUGINS
2416
65514900
CC
2417check_PROGRAMS += exclude_libs_test
2418check_SCRIPTS += exclude_libs_test.sh
2419check_DATA += exclude_libs_test.syms
2420MOSTLYCLEANFILES += exclude_libs_test.syms libexclude_libs_test_1.a \
2fdd743f 2421 libexclude_libs_test_2.a alt/libexclude_libs_test_3.a
65514900
CC
2422exclude_libs_test_SOURCES = exclude_libs_test.c
2423exclude_libs_test_DEPENDENCIES = gcctestdir/ld libexclude_libs_test_1.a \
2fdd743f
DK
2424 libexclude_libs_test_2.a alt/libexclude_libs_test_3.a
2425exclude_libs_test_LDFLAGS = -Bgcctestdir/ -L. -Lalt \
2426 -Wl,--exclude-libs,dummy:libexclude_libs_test_1 \
2427 -Wl,--exclude-libs,libexclude_libs_test_3
2428exclude_libs_test_LDADD = -lexclude_libs_test_1 -lexclude_libs_test_2 \
2429 alt/libexclude_libs_test_3.a
65514900
CC
2430exclude_libs_test.syms: exclude_libs_test
2431 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2432libexclude_libs_test_1.a: exclude_libs_test_1.o
2433 $(TEST_AR) rc $@ $^
2434libexclude_libs_test_2.a: exclude_libs_test_2.o
2435 $(TEST_AR) rc $@ $^
2fdd743f
DK
2436alt/libexclude_libs_test_3.a: exclude_libs_test_3.o
2437 test -d alt || mkdir -p alt
2438 $(TEST_AR) rc $@ $^
65514900 2439
805bb01c
DK
2440check_PROGRAMS += local_labels_test
2441local_labels_test.o: ver_test_6.c
2442 $(COMPILE) -g -c -Wa,-L -o $@ $<
78d9f182 2443local_labels_test: local_labels_test.o gcctestdir/ld
805bb01c
DK
2444 $(LINK) -Bgcctestdir/ local_labels_test.o
2445
bb04269c
DK
2446check_PROGRAMS += discard_locals_test
2447check_SCRIPTS += discard_locals_test.sh
d3bbad62
ILT
2448check_DATA += discard_locals_test.syms \
2449 discard_locals_relocatable_test1.syms \
2450 discard_locals_relocatable_test2.syms
2451MOSTLYCLEANFILES += discard_locals_test.syms \
2452 discard_locals_relocatable_test1.syms \
2453 discard_locals_relocatable_test2.syms \
2454 discard_locals_relocatable_test1.out \
2455 discard_locals_relocatable_test2.out
bb04269c
DK
2456discard_locals_test_SOURCES = discard_locals_test.c
2457discard_locals_test_LDFLAGS = -Bgcctestdir/ -Wl,--discard-locals
2458discard_locals_test.syms: discard_locals_test
2459 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2460# '-Wa,-L' is required to preserve the local label used for testing.
2461discard_locals_test.o: discard_locals_test.c
2462 $(COMPILE) -c -Wa,-L -o $@ $<
2463
d3bbad62
ILT
2464discard_locals_relocatable_test1.syms: discard_locals_relocatable_test1.out
2465 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2466discard_locals_relocatable_test.o: discard_locals_relocatable_test.c
2467 $(COMPILE) -c -Wa,-L -fPIC -o $@ $<
2468discard_locals_relocatable_test1.out: discard_locals_relocatable_test.o ../ld-new
2469 ../ld-new --discard-locals -relocatable -o $@ $<
2470
2471discard_locals_relocatable_test2.syms: discard_locals_relocatable_test2.out
2472 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2473discard_locals_relocatable_test2.out: discard_locals_relocatable_test.o ../ld-new
2474 ../ld-new --discard-all -relocatable -o $@ $<
2475
8a5e3e08
ILT
2476if MCMODEL_MEDIUM
2477check_PROGRAMS += large
2478large_SOURCES = large.c
2479large_CFLAGS = -mcmodel=medium
2480large_DEPENDENCIES = gcctestdir/ld
2481large_LDFLAGS = -Bgcctestdir/
1abce4a6 2482large_LDADD =
8a5e3e08
ILT
2483endif MCMODEL_MEDIUM
2484
645afe0c
CC
2485# Test that hidden and internal symbols in the main program cannot be
2486# referenced by a shared library.
2487check_SCRIPTS += hidden_test.sh
2488check_DATA += hidden_test.err
c20ceeb2 2489MOSTLYCLEANFILES += hidden_test hidden_test.err hidden_test.syms
645afe0c
CC
2490libhidden.so: hidden_test_1.c gcctestdir/ld
2491 $(COMPILE) -Bgcctestdir/ -g -shared -fPIC -w -o $@ $(srcdir)/hidden_test_1.c
2492hidden_test: hidden_test_main.o libhidden.so gcctestdir/ld
2493 $(LINK) -Bgcctestdir/ -Wl,-R,. hidden_test_main.o libhidden.so 2>hidden_test.err
c20ceeb2
YW
2494hidden_test.syms: hidden_test
2495 $(TEST_NM) -D hidden_test > $@
645afe0c
CC
2496hidden_test.err: hidden_test
2497 @touch hidden_test.err
2498
8c604651
CS
2499# Test -retain-symbols-file.
2500check_SCRIPTS += retain_symbols_file_test.sh
2501check_DATA += retain_symbols_file_test.stdout
2502MOSTLYCLEANFILES += retain_symbols_file_test retain_symbols_file_test.in \
2503 retain_symbols_file_test.stdout
2504retain_symbols_file_test.so: basic_pic_test.o gcctestdir/ld
2505 echo 'main' > retain_symbols_file_test.in
2506 echo 't1' >> retain_symbols_file_test.in
8c604651
CS
2507 echo '_ZNK4t20a3getEv' >> retain_symbols_file_test.in
2508 echo '_Z3t18v' >> retain_symbols_file_test.in
2b64b551 2509 echo '__tcf_0' >> retain_symbols_file_test.in
8c604651
CS
2510 $(CXXLINK) -Bgcctestdir/ -shared -Wl,-retain-symbols-file,retain_symbols_file_test.in basic_pic_test.o
2511retain_symbols_file_test.stdout: retain_symbols_file_test.so
2512 $(TEST_NM) -C retain_symbols_file_test.so > $@
2513
2514
6a89f575
CC
2515# Test that if the output file already exists and is empty,
2516# it will get execute permission.
2517check_PROGRAMS += permission_test
2518permission_test: basic_test.o gcctestdir/ld
2519 umask 022; \
2520 rm -f $@; \
2521 touch $@; \
2522 chmod 600 $@; \
2523 $(CXXLINK) -Bgcctestdir/ basic_test.o
2524
ae3b5189
CD
2525# Check -l:foo.a
2526check_PROGRAMS += searched_file_test
2527MOSTLYCLEANFILES += searched_file_test searched_file_test_lib.o \
2528 alt/searched_file_test_lib.a
2529searched_file_test_SOURCES = searched_file_test.cc
78d9f182 2530searched_file_test_DEPENDENCIES = gcctestdir/ld alt/searched_file_test_lib.a
ae3b5189
CD
2531searched_file_test_LDFLAGS = -Bgcctestdir/ -Lalt
2532searched_file_test_LDADD = -l:searched_file_test_lib.a
2533searched_file_test_lib.o: searched_file_test_lib.cc
2534 $(CXXCOMPILE) -c -o $@ $<
2535alt/searched_file_test_lib.a: searched_file_test_lib.o
2536 test -d alt || mkdir -p alt
2537 $(TEST_AR) rc $@ $^
2538
2b64b551 2539# Test that no .gnu.version sections are created when
c5617f2f
DK
2540# symbol versioning is not used.
2541check_SCRIPTS += no_version_test.sh
2542check_DATA += no_version_test.stdout
2543MOSTLYCLEANFILES += libno_version_test.so no_version_test.stdout
2544# We invoke the linker directly since gcc may include additional objects that
2545# uses symbol versioning.
2546libno_version_test.so: no_version_test.o gcctestdir/ld
2547 gcctestdir/ld -shared -o $@ no_version_test.o
2548no_version_test.o: no_version_test.c
2549 $(COMPILE) -o $@ -c -fPIC $<
2550no_version_test.stdout: libno_version_test.so
2551 $(TEST_OBJDUMP) -h $< > $@
2552
7223e9ca
ILT
2553# Test STT_GNU_IFUNC symbols.
2554if IFUNC
2555
2556ifuncmod1.o: ifuncmod1.c
661d7a80 2557 $(COMPILE) -c -fPIC -o $@ $<
7223e9ca
ILT
2558ifuncmod1.so: ifuncmod1.o gcctestdir/ld
2559 $(LINK) -Bgcctestdir/ -shared ifuncmod1.o
2560
2561ifuncdep1.o: ifuncmod1.c
2562 $(COMPILE) -c -o $@ $<
2563
2564ifuncmain1pic.o: ifuncmain1.c
661d7a80 2565 $(COMPILE) -c -fPIC -o $@ $<
7223e9ca 2566ifuncmain1pie.o: ifuncmain1.c
661d7a80 2567 $(COMPILE) -c -fPIE -o $@ $<
7223e9ca 2568
328c7c2f 2569if HAVE_STATIC
ebb300b2 2570if IFUNC_STATIC
7223e9ca
ILT
2571check_PROGRAMS += ifuncmain1static
2572ifuncmain1static_SOURCES = ifuncmain1.c
2573ifuncmain1static_DEPENDENCIES = gcctestdir/ld ifuncdep1.o
2574ifuncmain1static_LDFLAGS = -Bgcctestdir/ -static
2575ifuncmain1static_LDADD = ifuncdep1.o
2576
2577check_PROGRAMS += ifuncmain1picstatic
2578ifuncmain1picstatic: ifuncmain1pic.o ifuncmod1.o gcctestdir/ld
2579 $(LINK) -Bgcctestdir/ -static ifuncmain1pic.o ifuncmod1.o
c4d5a762
CC
2580
2581check_SCRIPTS += ifuncmod1.sh
2582check_DATA += ifuncmod1.so.stderr
2583ifuncmod1.so.stderr: ifuncmod1.so
2584 $(TEST_READELF) -s $< > /dev/null 2> $@
328c7c2f 2585endif
ebb300b2 2586endif
7223e9ca
ILT
2587
2588check_PROGRAMS += ifuncmain1
2589ifuncmain1_SOURCES = ifuncmain1.c
2590ifuncmain1_DEPENDENCIES = gcctestdir/ld ifuncmod1.so
2591ifuncmain1_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
2592ifuncmain1_LDADD = ifuncmod1.so
2593
2594check_PROGRAMS += ifuncmain1pic
2595ifuncmain1pic: ifuncmain1pic.o ifuncmod1.so gcctestdir/ld
2596 $(LINK) -Bgcctestdir/ ifuncmain1pic.o ifuncmod1.so -Wl,-R,.
2597
2598check_PROGRAMS += ifuncmain1vis
2599ifuncmain1vis_SOURCES = ifuncmain1vis.c
2600ifuncmain1vis_DEPENDENCIES = gcctestdir/ld ifuncmod1.so
2601ifuncmain1vis_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
2602ifuncmain1vis_LDADD = ifuncmod1.so
2603
2604check_PROGRAMS += ifuncmain1vispic
2605ifuncmain1vispic.o: ifuncmain1vis.c
661d7a80 2606 $(COMPILE) -c -fPIC -o $@ $<
7223e9ca
ILT
2607ifuncmain1vispic: ifuncmain1vispic.o ifuncmod1.so gcctestdir/ld
2608 $(LINK) -Bgcctestdir/ ifuncmain1pic.o ifuncmod1.so -Wl,-R,.
2609
2610check_PROGRAMS += ifuncmain1staticpic
2611ifuncmain1staticpic: ifuncmain1pic.o ifuncmod1.o gcctestdir/ld
2612 $(LINK) -Bgcctestdir/ ifuncmain1pic.o ifuncmod1.o
2613
2614check_PROGRAMS += ifuncmain1pie
2615ifuncmain1pie: ifuncmain1pie.o ifuncmod1.so gcctestdir/ld
2616 $(LINK) -Bgcctestdir/ -pie ifuncmain1pie.o ifuncmod1.so -Wl,-R,.
2617
2618check_PROGRAMS += ifuncmain1vispie
2619ifuncmain1vispie.o: ifuncmain1vis.c
661d7a80 2620 $(COMPILE) -c -fPIE -o $@ $<
7223e9ca
ILT
2621ifuncmain1vispie: ifuncmain1vispie.o ifuncmod1.so gcctestdir/ld
2622 $(LINK) -Bgcctestdir/ -pie ifuncmain1vispie.o ifuncmod1.so -Wl,-R,.
2623
2624check_PROGRAMS += ifuncmain1staticpie
2625ifuncmain1staticpie: ifuncmain1pie.o ifuncmod1.o gcctestdir/ld
2626 $(LINK) -Bgcctestdir/ -pie ifuncmain1pie.o ifuncmod1.o
2627
2628ifuncmain2pic.o: ifuncmain2.c
661d7a80 2629 $(COMPILE) -c -fPIC -o $@ $<
7223e9ca
ILT
2630
2631ifuncdep2pic.o: ifuncdep2.c
661d7a80 2632 $(COMPILE) -c -fPIC -o $@ $<
7223e9ca 2633
328c7c2f 2634if HAVE_STATIC
ebb300b2 2635if IFUNC_STATIC
7223e9ca
ILT
2636check_PROGRAMS += ifuncmain2static
2637ifuncmain2static_SOURCES = ifuncmain2.c ifuncdep2.c
2638ifuncmain2static_DEPENDENCIES = gcctestdir/ld
2639ifuncmain2static_LDFLAGS = -Bgcctestdir/ -static
f8e9a930 2640ifuncmain2static_LDADD =
7223e9ca
ILT
2641
2642check_PROGRAMS += ifuncmain2picstatic
2643ifuncmain2picstatic: ifuncmain2pic.o ifuncdep2pic.o gcctestdir/ld
2644 $(LINK) -Bgcctestdir/ -static ifuncmain2pic.o ifuncdep2pic.o
328c7c2f 2645endif
ebb300b2 2646endif
7223e9ca
ILT
2647
2648check_PROGRAMS += ifuncmain2
2649ifuncmain2_SOURCES = ifuncmain2.c ifuncdep2.c
2650ifuncmain2_DEPENDENCIES = gcctestdir/ld
2651ifuncmain2_LDFLAGS = -Bgcctestdir/
f8e9a930 2652ifuncmain2_LDADD =
7223e9ca
ILT
2653
2654check_PROGRAMS += ifuncmain2pic
2655ifuncmain2pic: ifuncmain2pic.o ifuncdep2pic.o gcctestdir/ld
2656 $(LINK) -Bgcctestdir/ ifuncmain2pic.o ifuncdep2pic.o
2657
2658ifuncmod3.o: ifuncmod3.c
661d7a80 2659 $(COMPILE) -c -fPIC -o $@ $<
7223e9ca
ILT
2660ifuncmod3.so: ifuncmod3.o gcctestdir/ld
2661 $(LINK) -Bgcctestdir/ -shared ifuncmod3.o
2662
2663check_PROGRAMS += ifuncmain3
2664ifuncmain3_SOURCES = ifuncmain3.c
2665ifuncmain3_DEPENDENCIES = gcctestdir/ld ifuncmod3.so
2666ifuncmain3_LDFLAGS = -Bgcctestdir/ -Wl,--export-dynamic -Wl,-R,.
2667ifuncmain3_LDADD = -ldl
2668
2669ifuncmain4pic.o: ifuncmain4.c
661d7a80 2670 $(COMPILE) -c -fPIC -o $@ $<
7223e9ca 2671
328c7c2f 2672if HAVE_STATIC
ebb300b2 2673if IFUNC_STATIC
7223e9ca
ILT
2674check_PROGRAMS += ifuncmain4static
2675ifuncmain4static_SOURCES = ifuncmain4.c
2676ifuncmain4static_DEPENDENCIES = gcctestdir/ld
2677ifuncmain4static_LDFLAGS = -Bgcctestdir/ -static
f8e9a930 2678ifuncmain4static_LDADD =
7223e9ca
ILT
2679
2680check_PROGRAMS += ifuncmain4picstatic
2681ifuncmain4picstatic: ifuncmain4pic.o gcctestdir/ld
2682 $(LINK) -Bgcctestdir/ -static ifuncmain4pic.o
328c7c2f 2683endif
ebb300b2 2684endif
7223e9ca
ILT
2685
2686check_PROGRAMS += ifuncmain4
2687ifuncmain4_SOURCES = ifuncmain4.c
2688ifuncmain4_DEPENDENCIES = gcctestdir/ld
2689ifuncmain4_LDFLAGS = -Bgcctestdir/
f8e9a930 2690ifuncmain4_LDADD =
7223e9ca
ILT
2691
2692ifuncmain5pic.o: ifuncmain5.c
661d7a80 2693 $(COMPILE) -c -fPIC -o $@ $<
7223e9ca
ILT
2694
2695ifuncmain5pie.o: ifuncmain5.c
661d7a80 2696 $(COMPILE) -c -fPIE -o $@ $<
7223e9ca
ILT
2697
2698ifuncmod5.o: ifuncmod5.c
661d7a80 2699 $(COMPILE) -c -fPIC -o $@ $<
7223e9ca
ILT
2700ifuncmod5.so: ifuncmod5.o gcctestdir/ld
2701 $(LINK) -Bgcctestdir/ -shared ifuncmod5.o
2702
2703ifuncdep5.o: ifuncmod5.c
2704 $(COMPILE) -c -o $@ $<
2705
328c7c2f 2706if HAVE_STATIC
ebb300b2 2707if IFUNC_STATIC
7223e9ca
ILT
2708check_PROGRAMS += ifuncmain5static
2709ifuncmain5static_SOURCES = ifuncmain5.c
2710ifuncmain5static_DEPENDENCIES = gcctestdir/ld ifuncdep5.o
2711ifuncmain5static_LDFLAGS = -Bgcctestdir/ -static
2712ifuncmain5static_LDADD = ifuncdep5.o
2713
2714check_PROGRAMS += ifuncmain5picstatic
2715ifuncmain5picstatic: ifuncmain5pic.o ifuncmod5.o gcctestdir/ld
2716 $(LINK) -Bgcctestdir/ -static ifuncmain5pic.o ifuncmod5.o
328c7c2f 2717endif
ebb300b2 2718endif
7223e9ca
ILT
2719
2720check_PROGRAMS += ifuncmain5
2721ifuncmain5_SOURCES = ifuncmain5.c
2722ifuncmain5_DEPENDENCIES = gcctestdir/ld ifuncmod5.so
2723ifuncmain5_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
2724ifuncmain5_LDADD = ifuncmod5.so
2725
2726check_PROGRAMS += ifuncmain5pic
2727ifuncmain5pic: ifuncmain5pic.o ifuncmod5.so gcctestdir/ld
2728 $(LINK) -Bgcctestdir/ ifuncmain5pic.o ifuncmod5.so -Wl,-R,.
2729
2730check_PROGRAMS += ifuncmain5staticpic
2731ifuncmain5staticpic: ifuncmain5pic.o ifuncmod5.o gcctestdir/ld
2732 $(LINK) -Bgcctestdir/ ifuncmain5pic.o ifuncmod5.o
2733
2734check_PROGRAMS += ifuncmain5pie
2735ifuncmain5pie: ifuncmain5pie.o ifuncmod5.so gcctestdir/ld
2736 $(LINK) -Bgcctestdir/ -pie ifuncmain5pie.o ifuncmod5.so -Wl,-R,.
2737
2738ifuncmain6pie.o: ifuncmain6pie.c
661d7a80 2739 $(COMPILE) -c -fPIE -o $@ $<
7223e9ca
ILT
2740
2741ifuncmod6.o: ifuncmod6.c
661d7a80 2742 $(COMPILE) -c -fPIC -o $@ $<
7223e9ca
ILT
2743ifuncmod6.so: ifuncmod6.o gcctestdir/ld
2744 $(LINK) -Bgcctestdir/ -shared ifuncmod6.o
2745
2746check_PROGRAMS += ifuncmain6pie
2747ifuncmain6pie: ifuncmain6pie.o ifuncmod6.so gcctestdir/ld
2748 $(LINK) -Bgcctestdir/ -pie ifuncmain6pie.o ifuncmod6.so -Wl,-R,.
2749
2750ifuncmain7pic.o: ifuncmain7.c
661d7a80 2751 $(COMPILE) -c -fPIC -o $@ $<
7223e9ca
ILT
2752
2753ifuncmain7pie.o: ifuncmain7.c
661d7a80 2754 $(COMPILE) -c -fPIE -o $@ $<
7223e9ca 2755
328c7c2f 2756if HAVE_STATIC
ebb300b2 2757if IFUNC_STATIC
7223e9ca
ILT
2758check_PROGRAMS += ifuncmain7static
2759ifuncmain7static_SOURCES = ifuncmain7.c
2760ifuncmain7static_DEPENDENCIES = gcctestdir/ld
2761ifuncmain7static_LDFLAGS = -Bgcctestdir/ -static
f8e9a930 2762ifuncmain7static_LDADD =
7223e9ca
ILT
2763
2764check_PROGRAMS += ifuncmain7picstatic
2765ifuncmain7picstatic: ifuncmain7pic.o gcctestdir/ld
2766 $(LINK) -Bgcctestdir/ -static ifuncmain7pic.o
328c7c2f 2767endif
ebb300b2 2768endif
7223e9ca
ILT
2769
2770check_PROGRAMS += ifuncmain7
2771ifuncmain7_SOURCES = ifuncmain7.c
2772ifuncmain7_DEPENDENCIES = gcctestdir/ld
2773ifuncmain7_LDFLAGS = -Bgcctestdir/
f8e9a930 2774ifuncmain7_LDADD =
7223e9ca
ILT
2775
2776check_PROGRAMS += ifuncmain7pic
2777ifuncmain7pic: ifuncmain7pic.o gcctestdir/ld
2778 $(LINK) -Bgcctestdir/ ifuncmain7pic.o
2779
2780check_PROGRAMS += ifuncmain7pie
2781ifuncmain7pie: ifuncmain7pie.o gcctestdir/ld
2782 $(LINK) -Bgcctestdir/ -pie ifuncmain7pie.o
2783
67181c72
ILT
2784check_PROGRAMS += ifuncvar
2785ifuncvar1_pic.o: ifuncvar1.c
661d7a80 2786 $(COMPILE) -c -fPIC -o $@ $<
2b64b551 2787ifuncvar2_pic.o: ifuncvar2.c
661d7a80 2788 $(COMPILE) -c -fPIC -o $@ $<
67181c72
ILT
2789ifuncvar.so: ifuncvar1_pic.o ifuncvar2_pic.o gcctestdir/ld
2790 $(LINK) -Bgcctestdir/ -shared ifuncvar1_pic.o ifuncvar2_pic.o
2791ifuncvar_SOURCES = ifuncvar3.c
2792ifuncvar_DEPENDENCIES = gcctestdir/ld ifuncvar.so
2793ifuncvar_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
2794ifuncvar_LDADD = ifuncvar.so
2795
7223e9ca
ILT
2796endif IFUNC
2797
74f67560
DK
2798# Test that strong reference to a weak symbol in a DSO remains strong.
2799check_SCRIPTS += strong_ref_weak_def.sh
2800check_DATA += strong_ref_weak_def.stdout
2801MOSTLYCLEANFILES += strong_ref_weak_def_1.so strong_ref_weak_def_2.so \
2802 strong_ref_weak_def.stdout
2803strong_ref_weak_def_2.o: strong_ref_weak_def_2.c
2804 $(COMPILE) -o $@ -c -fPIC $<
2805strong_ref_weak_def_2.so: strong_ref_weak_def_2.o gcctestdir/ld
2806 gcctestdir/ld -shared -o $@ strong_ref_weak_def_2.o
2807strong_ref_weak_def_1.o: strong_ref_weak_def_1.c
2808 $(COMPILE) -o $@ -c -fPIC $<
2809strong_ref_weak_def_1.so: strong_ref_weak_def_1.o strong_ref_weak_def_2.so \
2810 gcctestdir/ld
2811 gcctestdir/ld -shared -o $@ strong_ref_weak_def_1.o \
2812 strong_ref_weak_def_2.so
2813strong_ref_weak_def.stdout: strong_ref_weak_def_1.so
2814 $(TEST_READELF) -sWD $< > $@
2815
a4649286
DK
2816# Test that a strong weak reference remains strong if there is another
2817# weak reference in a DSO.
2818check_SCRIPTS += dyn_weak_ref.sh
2819check_DATA += dyn_weak_ref.stdout
2820MOSTLYCLEANFILES += dyn_weak_ref_1.so dyn_weak_ref_2.so \
2821 dyn_weak_ref.stdout
2822dyn_weak_ref_2.o: dyn_weak_ref_2.c
2823 $(COMPILE) -o $@ -c -fPIC $<
2824dyn_weak_ref_2.so: dyn_weak_ref_2.o gcctestdir/ld
2825 gcctestdir/ld -shared -o $@ dyn_weak_ref_2.o
2826dyn_weak_ref_1.o: dyn_weak_ref_1.c
2827 $(COMPILE) -o $@ -c -fPIC $<
2828# We intentionally put dyn_weak_ref_2.so in front of dyn_weak_ref_1.o
2829# so that the weak ref there goes to gold's symbol table first.
2830dyn_weak_ref_1.so: dyn_weak_ref_1.o dyn_weak_ref_2.so gcctestdir/ld
2831 gcctestdir/ld -shared -o $@ dyn_weak_ref_2.so dyn_weak_ref_1.o
2832dyn_weak_ref.stdout: dyn_weak_ref_1.so
2833 $(TEST_READELF) -sWD $< > $@
2834
2835
97b4be1c
CC
2836# Test that --start-lib and --end-lib function correctly.
2837check_PROGRAMS += start_lib_test
0ec6429b 2838MOSTLYCLEANFILES += libstart_lib_test.a
97b4be1c
CC
2839start_lib_test: start_lib_test_main.o libstart_lib_test.a start_lib_test_2.o start_lib_test_3.o \
2840 gcctestdir/ld
2841 $(LINK) -Bgcctestdir/ -o $@ start_lib_test_main.o -L. -lstart_lib_test \
2842 -Wl,--start-lib start_lib_test_2.o start_lib_test_3.o -Wl,--end-lib
2843libstart_lib_test.a: start_lib_test_1.o
2844 $(TEST_AR) rc $@ $^
2845
7f8cd844
NC
2846# Test that MEMORY region support works.
2847check_SCRIPTS += memory_test.sh
2848check_DATA += memory_test.stdout
2849MOSTLYCLEANFILES += memory_test.stdout memory_test memory_test.o
d4d91489
ILT
2850memory_test.o: memory_test.s
2851 $(COMPILE) -o $@ -c $<
2852memory_test: memory_test.o gcctestdir/ld $(srcdir)/memory_test.t
068e05ba 2853 $(LINK) -Bgcctestdir/ -nostartfiles -nostdlib -Wl,-z,max-page-size=0x1000 -Wl,-z,common-page-size=0x1000 -Wl,-T,$(srcdir)/memory_test.t -o $@ memory_test.o
7f8cd844 2854memory_test.stdout: memory_test
41a8542a 2855 $(TEST_READELF) -lWS $< > $@
7f8cd844 2856
410da591
CC
2857# Test INCLUDE directives in linker scripts.
2858# The binary isn't runnable, so we just check that we can build it without errors.
2859check_DATA += memory_test_2
0863441e 2860MOSTLYCLEANFILES += memory_test_inc_1.t memory_test_inc_2.t memory_test_inc_3.t memory_test_2
410da591
CC
2861memory_test_inc_1.t: $(srcdir)/memory_test_inc_1.t.src
2862 cp $< $@
2863memory_test_inc_2.t: $(srcdir)/memory_test_inc_2.t.src
2864 cp $< $@
2865memory_test_inc_3.t: $(srcdir)/memory_test_inc_3.t.src
2866 cp $< $@
2867memory_test_2: memory_test.o gcctestdir/ld $(srcdir)/memory_test.t memory_test_inc_1.t memory_test_inc_2.t memory_test_inc_3.t
068e05ba 2868 $(LINK) -Bgcctestdir/ -nostartfiles -nostdlib -Wl,-z,max-page-size=0x1000 -Wl,-z,common-page-size=0x1000 -Wl,-T,$(srcdir)/memory_test.t -o $@ memory_test.o
410da591 2869
f1415016
CC
2870if HAVE_PUBNAMES
2871
2872# Test that --gdb-index functions correctly without gcc-generated pubnames.
c1027032
CC
2873check_SCRIPTS += gdb_index_test_1.sh
2874check_DATA += gdb_index_test_1.stdout
2875MOSTLYCLEANFILES += gdb_index_test_1.stdout gdb_index_test_1
2876gdb_index_test.o: gdb_index_test.cc
f1415016 2877 $(CXXCOMPILE) -O0 -g -gno-pubnames -c -o $@ $<
c1027032
CC
2878gdb_index_test_1: gdb_index_test.o gcctestdir/ld
2879 $(CXXLINK) -Bgcctestdir/ -Wl,--gdb-index $<
2880gdb_index_test_1.stdout: gdb_index_test_1
2881 $(TEST_READELF) --debug-dump=gdb_index $< > $@
2882
f1415016 2883# Test that --gdb-index functions correctly with compressed debug sections.
c1027032
CC
2884check_SCRIPTS += gdb_index_test_2.sh
2885check_DATA += gdb_index_test_2.stdout
0863441e 2886MOSTLYCLEANFILES += gdb_index_test_2.stdout gdb_index_test_2 gdb_index_test_2_gabi
c1027032
CC
2887gdb_index_test_cdebug.o: gdb_index_test.cc
2888 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -Wa,--compress-debug-sections -c -o $@ $<
2889gdb_index_test_2: gdb_index_test_cdebug.o gcctestdir/ld
2890 $(CXXLINK) -Bgcctestdir/ -Wl,--gdb-index $<
2891gdb_index_test_2.stdout: gdb_index_test_2
2892 $(TEST_READELF) --debug-dump=gdb_index $< > $@
48058663
L
2893check_SCRIPTS += gdb_index_test_2_gabi.sh
2894check_DATA += gdb_index_test_2_gabi.stdout
2895MOSTLYCLEANFILES += gdb_index_test_2.stdout gdb_index_test_2
2896gdb_index_test_cdebug_gabi.o: gdb_index_test.cc
2897 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -Wa,--compress-debug-sections=zlib-gabi -c -o $@ $<
2898gdb_index_test_2_gabi: gdb_index_test_cdebug_gabi.o gcctestdir/ld
2899 $(CXXLINK) -Bgcctestdir/ -Wl,--gdb-index $<
2900gdb_index_test_2_gabi.stdout: gdb_index_test_2_gabi
2901 $(TEST_READELF) --debug-dump=gdb_index $< > $@
c1027032 2902
f1415016 2903# Another simple C test (DW_AT_high_pc encoding) for --gdb-index.
57923f48
MW
2904check_SCRIPTS += gdb_index_test_3.sh
2905check_DATA += gdb_index_test_3.stdout
2906MOSTLYCLEANFILES += gdb_index_test_3.stdout gdb_index_test_3
2907gdb_index_test_3.o: gdb_index_test_3.c
2908 $(COMPILE) -O0 -g -c -o $@ $<
2909gdb_index_test_3: gdb_index_test_3.o gcctestdir/ld
2910 $(LINK) -Bgcctestdir/ -Wl,--gdb-index,--fatal-warnings $<
2911gdb_index_test_3.stdout: gdb_index_test_3
2912 $(TEST_READELF) --debug-dump=gdb_index $< > $@
2913
f1415016
CC
2914# Test that --gdb-index functions correctly with gcc-generated pubnames.
2915check_SCRIPTS += gdb_index_test_4.sh
2916check_DATA += gdb_index_test_4.stdout
2917MOSTLYCLEANFILES += gdb_index_test_4.stdout gdb_index_test_4
2918gdb_index_test_pub.o: gdb_index_test.cc
2919 $(CXXCOMPILE) -O0 -g -gpubnames -c -o $@ $<
2920gdb_index_test_4: gdb_index_test_pub.o gcctestdir/ld
2921 $(CXXLINK) -Bgcctestdir/ -Wl,--gdb-index $<
2922gdb_index_test_4.stdout: gdb_index_test_4
2923 $(TEST_READELF) --debug-dump=gdb_index $< > $@
2924
2925endif HAVE_PUBNAMES
57923f48 2926
d1bddd3c
CC
2927# Test that __ehdr_start is defined correctly.
2928check_PROGRAMS += ehdr_start_test_1
2929ehdr_start_test_1_SOURCES = ehdr_start_test.cc
2930ehdr_start_test_1_DEPENDENCIES = gcctestdir/ld
2931ehdr_start_test_1_CXXFLAGS =
2932ehdr_start_test_1_LDFLAGS = -Bgcctestdir/
2933ehdr_start_test_1_LDADD =
2934
2935# Test that __ehdr_start is defined correctly with a weak reference.
2936check_PROGRAMS += ehdr_start_test_2
2937ehdr_start_test_2_SOURCES = ehdr_start_test.cc
2938ehdr_start_test_2_DEPENDENCIES = gcctestdir/ld
2939ehdr_start_test_2_CXXFLAGS = -DEHDR_START_WEAK
2940ehdr_start_test_2_LDFLAGS = -Bgcctestdir/
2941ehdr_start_test_2_LDADD =
2942
2943# Test that __ehdr_start is defined correctly when used with a linker script.
2944check_PROGRAMS += ehdr_start_test_3
2945ehdr_start_test_3_SOURCES = ehdr_start_test.cc
2946ehdr_start_test_3_DEPENDENCIES = gcctestdir/ld $(srcdir)/ehdr_start_test.t
2947ehdr_start_test_3_CXXFLAGS = -DEHDR_START_WEAK
2948ehdr_start_test_3_LDFLAGS = -Bgcctestdir/ -Wl,-T,$(srcdir)/ehdr_start_test.t
2949ehdr_start_test_3_LDADD =
2950
2951# Test that __ehdr_start is left undefined when the text segment is not
2952# appropriately aligned.
2953check_SCRIPTS += ehdr_start_test_4.sh
2954check_DATA += ehdr_start_test_4.syms
2955MOSTLYCLEANFILES += ehdr_start_test_4
2956ehdr_start_test_4.syms: ehdr_start_test_4
2957 $(TEST_NM) ehdr_start_test_4 > $@
2958ehdr_start_test_4: ehdr_start_test_4.o gcctestdir/ld
f6fb8322 2959 $(CXXLINK) -Bgcctestdir/ -Wl,-Ttext=0x100100 $<
d1bddd3c
CC
2960ehdr_start_test_4.o: ehdr_start_test.cc
2961 $(CXXCOMPILE) -c -DEHDR_START_WEAK -o $@ $<
2962
2963# Test that __ehdr_start is not overridden when supplied by the user.
2964check_PROGRAMS += ehdr_start_test_5
2965ehdr_start_test_5_SOURCES = ehdr_start_test.cc ehdr_start_def.cc
2966ehdr_start_test_5_DEPENDENCIES = gcctestdir/ld
2967ehdr_start_test_5_CXXFLAGS = -DEHDR_START_USER_DEF
2968ehdr_start_test_5_LDFLAGS = -Bgcctestdir/
2969ehdr_start_test_5_LDADD =
2970
e051745c
CC
2971# Test that the --defsym option copies the symbol type and visibility.
2972check_SCRIPTS += defsym_test.sh
2973check_DATA += defsym_test.syms
dddcc5b9 2974MOSTLYCLEANFILES += defsym_test defsym_test.syms
e051745c
CC
2975defsym_test.syms: defsym_test
2976 $(TEST_READELF) -sW $< > $@
2977defsym_test: defsym_test.o gcctestdir/ld
2978 $(LINK) -Bgcctestdir/ -Wl,--defsym=bar=foo defsym_test.o
2979defsym_test.o: defsym_test.c
2980 $(COMPILE) -c -o $@ $<
2981
89ede9f5
CC
2982# Test that the -d option (force common allocation) works correctly.
2983check_PROGRAMS += pr20976
2984pr20976: pr20976-d.o gcctestdir/ld
2985 $(LINK) -Bgcctestdir/ pr20976-d.o
2986pr20976-d.o: pr20976.o gcctestdir/ld
2987 gcctestdir/ld -r -d -o $@ pr20976.o
2988
2eedd706
CC
2989# End-to-end incremental linking tests.
2990# Incremental linking is currently supported only on the x86_64 target.
2991
2992if DEFAULT_TARGET_X86_64
2993
33c15b45
CC
2994two_file_test_1_v1_ndebug.o: two_file_test_1_v1.cc
2995 $(CXXCOMPILE) -O0 -g0 -c -o $@ $<
2996two_file_test_1_ndebug.o: two_file_test_1.cc
2997 $(CXXCOMPILE) -O0 -g0 -c -o $@ $<
2998two_file_test_1b_ndebug.o: two_file_test_1b.cc
2999 $(CXXCOMPILE) -O0 -g0 -c -o $@ $<
3000two_file_test_2_ndebug.o: two_file_test_2.cc
3001 $(CXXCOMPILE) -O0 -g0 -c -o $@ $<
3002two_file_test_main_ndebug.o: two_file_test_main.cc
3003 $(CXXCOMPILE) -O0 -g0 -c -o $@ $<
3004
2eedd706 3005check_PROGRAMS += incremental_test_2
c49875be 3006MOSTLYCLEANFILES += two_file_test_tmp_2.o
33c15b45
CC
3007incremental_test_2: two_file_test_1_v1_ndebug.o two_file_test_1_ndebug.o two_file_test_1b_ndebug.o \
3008 two_file_test_2_ndebug.o two_file_test_main_ndebug.o gcctestdir/ld
3009 cp -f two_file_test_1_v1_ndebug.o two_file_test_tmp_2.o
943c8b43 3010 $(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 3011 @sleep 1
33c15b45 3012 cp -f two_file_test_1_ndebug.o two_file_test_tmp_2.o
943c8b43 3013 $(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
3014
3015check_PROGRAMS += incremental_test_3
c49875be 3016MOSTLYCLEANFILES += two_file_test_tmp_3.o
2eedd706
CC
3017incremental_test_3: two_file_test_1.o two_file_test_1b_v1.o two_file_test_1b.o \
3018 two_file_test_2.o two_file_test_main.o gcctestdir/ld
c49875be 3019 cp -f two_file_test_1b_v1.o two_file_test_tmp_3.o
943c8b43 3020 $(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 3021 @sleep 1
c49875be 3022 cp -f two_file_test_1b.o two_file_test_tmp_3.o
943c8b43 3023 $(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
3024
3025check_PROGRAMS += incremental_test_4
c49875be 3026MOSTLYCLEANFILES += incremental_test_4.base two_file_test_tmp_4.o
2eedd706
CC
3027incremental_test_4: two_file_test_1.o two_file_test_1b.o two_file_test_2_v1.o \
3028 two_file_test_2.o two_file_test_main.o gcctestdir/ld
c49875be 3029 cp -f two_file_test_2_v1.o two_file_test_tmp_4.o
943c8b43 3030 $(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 3031 mv -f incremental_test_4 incremental_test_4.base
2eedd706 3032 @sleep 1
c49875be 3033 cp -f two_file_test_2.o two_file_test_tmp_4.o
943c8b43 3034 $(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 3035
e24719f6
CC
3036check_PROGRAMS += incremental_test_5
3037MOSTLYCLEANFILES += two_file_test_5.a
3038incremental_test_5: two_file_test_1.o two_file_test_1b_v1.o two_file_test_1b.o \
3039 two_file_test_2.o two_file_test_main.o gcctestdir/ld
3040 cp -f two_file_test_1b_v1.o two_file_test_tmp_5.o
3041 $(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 3042 $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Wl,-z,norelro -Bgcctestdir/ two_file_test_main.o two_file_test_5.a
e24719f6
CC
3043 @sleep 1
3044 cp -f two_file_test_1b.o two_file_test_tmp_5.o
3045 $(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 3046 $(CXXLINK) -Wl,--incremental-update -Wl,-z,norelro -Bgcctestdir/ two_file_test_main.o two_file_test_5.a
e24719f6
CC
3047
3048# Test the --incremental-unchanged flag with an archive library.
3049# The second link should not update the library.
3050check_PROGRAMS += incremental_test_6
3051MOSTLYCLEANFILES += two_file_test_6.a
3052incremental_test_6: two_file_test_1.o two_file_test_1b_v1.o two_file_test_1b.o \
3053 two_file_test_2.o two_file_test_main.o gcctestdir/ld
3054 cp -f two_file_test_1b.o two_file_test_tmp_6.o
3055 $(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 3056 $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Wl,-z,norelro -Bgcctestdir/ two_file_test_main.o two_file_test_6.a
e24719f6
CC
3057 @sleep 1
3058 cp -f two_file_test_1b_v1.o two_file_test_tmp_6.o
3059 $(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 3060 $(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 3061
a5ee4d5d
CC
3062check_PROGRAMS += incremental_copy_test
3063incremental_copy_test: copy_test_v1.o copy_test.o copy_test_1.so copy_test_2.so
3064 cp -f copy_test_v1.o copy_test_tmp.o
943c8b43 3065 $(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
3066 @sleep 1
3067 cp -f copy_test.o copy_test_tmp.o
943c8b43 3068 $(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
3069
3070check_PROGRAMS += incremental_common_test_1
3071incremental_common_test_1: common_test_1_v1.o common_test_1_v2.o gcctestdir/ld
3072 cp -f common_test_1_v1.o common_test_1_tmp.o
943c8b43 3073 $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Wl,-z,norelro -Bgcctestdir/ common_test_1_tmp.o
a5ee4d5d
CC
3074 @sleep 1
3075 cp -f common_test_1_v2.o common_test_1_tmp.o
943c8b43 3076 $(CXXLINK) -Wl,--incremental-update -Wl,-z,norelro -Bgcctestdir/ common_test_1_tmp.o
a5ee4d5d 3077
1206d0d5
CC
3078check_PROGRAMS += incremental_comdat_test_1
3079incremental_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
3080 cp -f incr_comdat_test_2_v1.o incr_comdat_test_1_tmp.o
943c8b43 3081 $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Wl,-z,norelro -Bgcctestdir/ incr_comdat_test_1.o incr_comdat_test_1_tmp.o
1206d0d5
CC
3082 @sleep 1
3083 cp -f incr_comdat_test_2_v2.o incr_comdat_test_1_tmp.o
943c8b43 3084 $(CXXLINK) -Wl,--incremental-update -Wl,-z,norelro -Bgcctestdir/ incr_comdat_test_1.o incr_comdat_test_1_tmp.o
1206d0d5
CC
3085 @sleep 1
3086 cp -f incr_comdat_test_2_v3.o incr_comdat_test_1_tmp.o
943c8b43 3087 $(CXXLINK) -Wl,--incremental-update -Wl,-z,norelro -Bgcctestdir/ incr_comdat_test_1.o incr_comdat_test_1_tmp.o
1206d0d5 3088
2eedd706
CC
3089endif DEFAULT_TARGET_X86_64
3090
f49fe902
L
3091if DEFAULT_TARGET_X86_64
3092check_PROGRAMS += exception_x86_64_bnd_test
3093exception_x86_64_bnd_test_SOURCES = exception_test_main.cc
635aa30e 3094exception_x86_64_bnd_test_DEPENDENCIES = gcctestdir/ld exception_x86_64_bnd_1.o exception_x86_64_bnd_2.o
7a0c0a14 3095exception_x86_64_bnd_test_LDFLAGS = $(exception_test_LDFLAGS) -Wl,-z,bndplt
635aa30e 3096exception_x86_64_bnd_test_LDADD = exception_x86_64_bnd_1.o exception_x86_64_bnd_2.o
0c075858 3097exception_x86_64_bnd_1.o: exception_test_1.cc gcctestdir/as
f49fe902 3098 $(CXXCOMPILE) -c -fpic -Bgcctestdir/ -Wa,-madd-bnd-prefix -o $@ $<
0c075858 3099exception_x86_64_bnd_2.o: exception_test_2.cc gcctestdir/as
f49fe902
L
3100 $(CXXCOMPILE) -c -Bgcctestdir/ -Wa,-madd-bnd-prefix -o $@ $<
3101endif DEFAULT_TARGET_X86_64
3102
351a8000
ILT
3103endif GCC
3104endif NATIVE_LINKER
364c7fa5 3105
eb373049
ILT
3106# These tests work with native and cross linkers.
3107
3108if NATIVE_OR_CROSS_LINKER
3109
3110# Test script section order.
3111check_SCRIPTS += script_test_10.sh
3112check_DATA += script_test_10.stdout
0ec6429b 3113MOSTLYCLEANFILES += script_test_10
eb373049
ILT
3114script_test_10.o: script_test_10.s
3115 $(TEST_AS) -o $@ $<
3116script_test_10: $(srcdir)/script_test_10.t script_test_10.o gcctestdir/ld
52dc3f9c 3117 gcctestdir/ld -o $@ script_test_10.o -T $(srcdir)/script_test_10.t
eb373049
ILT
3118script_test_10.stdout: script_test_10
3119 $(TEST_READELF) -SW script_test_10 > $@
3120
3121# These tests work with cross linkers only.
364c7fa5
ILT
3122
3123if DEFAULT_TARGET_I386
3124
3125check_SCRIPTS += split_i386.sh
3126check_DATA += split_i386_1.stdout split_i386_2.stdout \
3127 split_i386_3.stdout split_i386_4.stdout split_i386_r.stdout
3128SPLIT_DEFSYMS = --defsym __morestack=0x100 --defsym __morestack_non_split=0x200
3129split_i386_1.o: split_i386_1.s
3130 $(TEST_AS) -o $@ $<
3131split_i386_2.o: split_i386_2.s
3132 $(TEST_AS) -o $@ $<
3133split_i386_3.o: split_i386_3.s
3134 $(TEST_AS) -o $@ $<
3135split_i386_4.o: split_i386_4.s
3136 $(TEST_AS) -o $@ $<
3137split_i386_n.o: split_i386_n.s
3138 $(TEST_AS) -o $@ $<
3139split_i386_1: split_i386_1.o split_i386_n.o ../ld-new
3140 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_i386_1.o split_i386_n.o
3141split_i386_1.stdout: split_i386_1
3142 $(TEST_OBJDUMP) -d $< > $@
3143split_i386_2: split_i386_2.o split_i386_n.o ../ld-new
3144 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_i386_2.o split_i386_n.o
3145split_i386_2.stdout: split_i386_2
3146 $(TEST_OBJDUMP) -d $< > $@
3147split_i386_3.stdout: split_i386_3.o split_i386_n.o ../ld-new
3148 ../ld-new $(SPLIT_DEFSYMS) -o split_i386_3 split_i386_3.o split_i386_n.o > $@ 2>&1 || exit 0
3149split_i386_4: split_i386_4.o split_i386_n.o ../ld-new
3150 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_i386_4.o split_i386_n.o
3151split_i386_4.stdout: split_i386_4
3152 $(TEST_OBJDUMP) -d $< > $@
3153split_i386_r.stdout: split_i386_1.o split_i386_n.o ../ld-new
3154 ../ld-new -r split_i386_1.o split_i386_n.o -o split_i386_r > $@ 2>&1 || exit 0
3155MOSTLYCLEANFILES += split_i386_1 split_i386_2 split_i386_3 \
3156 split_i386_4 split_i386_r
3157
3158endif DEFAULT_TARGET_I386
3159
3160if DEFAULT_TARGET_X86_64
3161
3162check_SCRIPTS += split_x86_64.sh
3163check_DATA += split_x86_64_1.stdout split_x86_64_2.stdout \
3164 split_x86_64_3.stdout split_x86_64_4.stdout split_x86_64_r.stdout
3165SPLIT_DEFSYMS = --defsym __morestack=0x100 --defsym __morestack_non_split=0x200
3166split_x86_64_1.o: split_x86_64_1.s
3167 $(TEST_AS) -o $@ $<
3168split_x86_64_2.o: split_x86_64_2.s
3169 $(TEST_AS) -o $@ $<
3170split_x86_64_3.o: split_x86_64_3.s
3171 $(TEST_AS) -o $@ $<
3172split_x86_64_4.o: split_x86_64_4.s
3173 $(TEST_AS) -o $@ $<
3174split_x86_64_n.o: split_x86_64_n.s
3175 $(TEST_AS) -o $@ $<
3176split_x86_64_1: split_x86_64_1.o split_x86_64_n.o ../ld-new
3177 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x86_64_1.o split_x86_64_n.o
3178split_x86_64_1.stdout: split_x86_64_1
3179 $(TEST_OBJDUMP) -d $< > $@
3180split_x86_64_2: split_x86_64_2.o split_x86_64_n.o ../ld-new
3181 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x86_64_2.o split_x86_64_n.o
3182split_x86_64_2.stdout: split_x86_64_2
3183 $(TEST_OBJDUMP) -d $< > $@
3184split_x86_64_3.stdout: split_x86_64_3.o split_x86_64_n.o ../ld-new
3185 ../ld-new $(SPLIT_DEFSYMS) -o split_x86_64_3 split_x86_64_3.o split_x86_64_n.o > $@ 2>&1 || exit 0
3186split_x86_64_4: split_x86_64_4.o split_x86_64_n.o ../ld-new
3187 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x86_64_4.o split_x86_64_n.o
3188split_x86_64_4.stdout: split_x86_64_4
3189 $(TEST_OBJDUMP) -d $< > $@
3190split_x86_64_r.stdout: split_x86_64_1.o split_x86_64_n.o ../ld-new
3191 ../ld-new -r split_x86_64_1.o split_x86_64_n.o -o split_x86_64_r > $@ 2>&1 || exit 0
3192MOSTLYCLEANFILES += split_x86_64_1 split_x86_64_2 split_x86_64_3 \
3193 split_x86_64_4 split_x86_64_r
3194
7a0c0a14
CC
3195check_SCRIPTS += bnd_plt_1.sh
3196check_DATA += bnd_plt_1.stdout
3197bnd_plt_1.o: bnd_plt_1.s
3198 $(TEST_AS) --64 -o $@ $<
3199bnd_plt_1.so: bnd_plt_1.o ../ld-new
3200 ../ld-new -shared -z bndplt bnd_plt_1.o -o $@
3201bnd_plt_1.stdout: bnd_plt_1.so
3202 $(TEST_OBJDUMP) -dw $< > $@
3203
3204check_SCRIPTS += bnd_ifunc_1.sh
3205check_DATA += bnd_ifunc_1.stdout
3206bnd_ifunc_1.o: bnd_ifunc_1.s
3207 $(TEST_AS) --64 -madd-bnd-prefix -o $@ $<
3208bnd_ifunc_1.so: bnd_ifunc_1.o ../ld-new
3209 ../ld-new -shared -z bndplt bnd_ifunc_1.o -o $@
3210bnd_ifunc_1.stdout: bnd_ifunc_1.so
3211 $(TEST_OBJDUMP) -dw $< > $@
3212
3213check_SCRIPTS += bnd_ifunc_2.sh
3214check_DATA += bnd_ifunc_2.stdout
3215bnd_ifunc_2.o: bnd_ifunc_2.s
3216 $(TEST_AS) --64 -madd-bnd-prefix -o $@ $<
3217bnd_ifunc_2.so: bnd_ifunc_2.o ../ld-new
3218 ../ld-new -shared -z bndplt bnd_ifunc_2.o -o $@
3219bnd_ifunc_2.stdout: bnd_ifunc_2.so
3220 $(TEST_OBJDUMP) -dw $< > $@
3221
364c7fa5 3222endif DEFAULT_TARGET_X86_64
e4782e83 3223
4fc1b9d4
L
3224if DEFAULT_TARGET_X32
3225
3226check_SCRIPTS += split_x32.sh
3227check_DATA += split_x32_1.stdout split_x32_2.stdout \
3228 split_x32_3.stdout split_x32_4.stdout split_x32_r.stdout
3229SPLIT_DEFSYMS = --defsym __morestack=0x100 --defsym __morestack_non_split=0x200
3230split_x32_1.o: split_x32_1.s
3231 $(TEST_AS) -o $@ $<
3232split_x32_2.o: split_x32_2.s
3233 $(TEST_AS) -o $@ $<
3234split_x32_3.o: split_x32_3.s
3235 $(TEST_AS) -o $@ $<
3236split_x32_4.o: split_x32_4.s
3237 $(TEST_AS) -o $@ $<
3238split_x32_n.o: split_x32_n.s
3239 $(TEST_AS) -o $@ $<
3240split_x32_1: split_x32_1.o split_x32_n.o ../ld-new
3241 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x32_1.o split_x32_n.o
3242split_x32_1.stdout: split_x32_1
3243 $(TEST_OBJDUMP) -d $< > $@
3244split_x32_2: split_x32_2.o split_x32_n.o ../ld-new
3245 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x32_2.o split_x32_n.o
3246split_x32_2.stdout: split_x32_2
3247 $(TEST_OBJDUMP) -d $< > $@
3248split_x32_3.stdout: split_x32_3.o split_x32_n.o ../ld-new
3249 ../ld-new $(SPLIT_DEFSYMS) -o split_x32_3 split_x32_3.o split_x32_n.o > $@ 2>&1 || exit 0
3250split_x32_4: split_x32_4.o split_x32_n.o ../ld-new
3251 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x32_4.o split_x32_n.o
3252split_x32_4.stdout: split_x32_4
3253 $(TEST_OBJDUMP) -d $< > $@
3254split_x32_r.stdout: split_x32_1.o split_x32_n.o ../ld-new
3255 ../ld-new -r split_x32_1.o split_x32_n.o -o split_x32_r > $@ 2>&1 || exit 0
3256MOSTLYCLEANFILES += split_x32_1 split_x32_2 split_x32_3 \
3257 split_x32_4 split_x32_r
3258
3259endif DEFAULT_TARGET_X32
3260
e4782e83
DK
3261if DEFAULT_TARGET_ARM
3262
3263check_SCRIPTS += arm_abs_global.sh
3264check_DATA += arm_abs_global.stdout
3265arm_abs_lib.o: arm_abs_lib.s
3266 $(TEST_AS) -march=armv7-a -o $@ $<
d3bbad62 3267libarm_abs.so: arm_abs_lib.o ../ld-new
e4782e83
DK
3268 ../ld-new -shared -o $@ arm_abs_lib.o
3269arm_abs_global.o: arm_abs_global.s
3270 $(TEST_AS) -march=armv7-a -o $@ $<
d3bbad62 3271arm_abs_global: arm_abs_global.o libarm_abs.so ../ld-new
e4782e83
DK
3272 ../ld-new -o $@ arm_abs_global.o -L. -larm_abs
3273arm_abs_global.stdout: arm_abs_global
3274 $(TEST_READELF) -r $< > $@
3275
3276MOSTLYCLEANFILES += arm_abs_global
3277
aa98ff75 3278check_SCRIPTS += arm_branch_in_range.sh arm_branch_out_of_range.sh
2a2b6d42
DK
3279check_DATA += arm_bl_in_range.stdout arm_bl_out_of_range.stdout \
3280 thumb_bl_in_range.stdout thumb_bl_out_of_range.stdout \
a2c7281b
DK
3281 thumb2_bl_in_range.stdout thumb2_bl_out_of_range.stdout \
3282 thumb_blx_in_range.stdout thumb_blx_out_of_range.stdout \
aa98ff75 3283 thumb2_blx_in_range.stdout thumb2_blx_out_of_range.stdout \
57eb9b50
DK
3284 thumb_bl_out_of_range_local.stdout arm_thm_jump11.stdout \
3285 arm_thm_jump8.stdout
2a2b6d42
DK
3286
3287arm_bl_in_range.stdout: arm_bl_in_range
3288 $(TEST_OBJDUMP) -D $< > $@
3289
d3bbad62 3290arm_bl_in_range: arm_bl_in_range.o ../ld-new
52dc3f9c 3291 ../ld-new -T $(srcdir)/arm_branch_range.t -o $@ $<
2a2b6d42
DK
3292
3293arm_bl_in_range.o: arm_bl_in_range.s
3294 $(TEST_AS) -o $@ $<
3295
3296arm_bl_out_of_range.stdout: arm_bl_out_of_range
3297 $(TEST_OBJDUMP) -S $< > $@
3298
d3bbad62 3299arm_bl_out_of_range: arm_bl_out_of_range.o ../ld-new
52dc3f9c 3300 ../ld-new -T $(srcdir)/arm_branch_range.t -o $@ $<
2a2b6d42
DK
3301
3302arm_bl_out_of_range.o: arm_bl_out_of_range.s
3303 $(TEST_AS) -o $@ $<
3304
3305thumb_bl_in_range.stdout: thumb_bl_in_range
3306 $(TEST_OBJDUMP) -D $< > $@
3307
d3bbad62 3308thumb_bl_in_range: thumb_bl_in_range.o ../ld-new
52dc3f9c 3309 ../ld-new --no-fix-arm1176 -T $(srcdir)/thumb_branch_range.t -o $@ $<
2a2b6d42
DK
3310
3311thumb_bl_in_range.o: thumb_bl_in_range.s
3312 $(TEST_AS) -o $@ -march=armv5te $<
3313
3314thumb_bl_out_of_range.stdout: thumb_bl_out_of_range
3315 $(TEST_OBJDUMP) -D $< > $@
3316
a2c7281b 3317thumb_bl_out_of_range: thumb_bl_out_of_range.o ../ld-new
52dc3f9c 3318 ../ld-new --no-fix-arm1176 -T $(srcdir)/thumb_branch_range.t -o $@ $<
2a2b6d42 3319
a2c7281b 3320thumb_bl_out_of_range.o: thumb_bl_out_of_range.s
2a2b6d42
DK
3321 $(TEST_AS) -o $@ -march=armv5te $<
3322
3323thumb2_bl_in_range.stdout: thumb2_bl_in_range
3324 $(TEST_OBJDUMP) -D $< > $@
3325
d3bbad62 3326thumb2_bl_in_range: thumb2_bl_in_range.o ../ld-new
52dc3f9c 3327 ../ld-new -T $(srcdir)/thumb2_branch_range.t -o $@ $<
2a2b6d42
DK
3328
3329thumb2_bl_in_range.o: thumb_bl_in_range.s
3330 $(TEST_AS) -o $@ -march=armv7-a $<
3331
3332thumb2_bl_out_of_range.stdout: thumb2_bl_out_of_range
3333 $(TEST_OBJDUMP) -D $< > $@
3334
a2c7281b 3335thumb2_bl_out_of_range: thumb2_bl_out_of_range.o ../ld-new
52dc3f9c 3336 ../ld-new -T $(srcdir)/thumb2_branch_range.t -o $@ $<
2a2b6d42 3337
a2c7281b
DK
3338thumb2_bl_out_of_range.o: thumb_bl_out_of_range.s
3339 $(TEST_AS) -o $@ -march=armv7-a $<
3340
3341thumb_blx_in_range.stdout: thumb_blx_in_range
3342 $(TEST_OBJDUMP) -D $< > $@
3343
3344thumb_blx_in_range: thumb_blx_in_range.o ../ld-new
52dc3f9c 3345 ../ld-new --no-fix-arm1176 -T $(srcdir)/thumb_branch_range.t -o $@ $<
a2c7281b
DK
3346
3347thumb_blx_in_range.o: thumb_blx_in_range.s
3348 $(TEST_AS) -o $@ -march=armv5te $<
3349
3350thumb_blx_out_of_range.stdout: thumb_blx_out_of_range
3351 $(TEST_OBJDUMP) -D $< > $@
3352
3353thumb_blx_out_of_range: thumb_blx_out_of_range.o ../ld-new
52dc3f9c 3354 ../ld-new --no-fix-arm1176 -T $(srcdir)/thumb_branch_range.t -o $@ $<
a2c7281b
DK
3355
3356thumb_blx_out_of_range.o: thumb_blx_out_of_range.s
3357 $(TEST_AS) -o $@ -march=armv5te $<
3358
3359thumb2_blx_in_range.stdout: thumb2_blx_in_range
3360 $(TEST_OBJDUMP) -D $< > $@
3361
3362thumb2_blx_in_range: thumb2_blx_in_range.o ../ld-new
52dc3f9c 3363 ../ld-new -T $(srcdir)/thumb2_branch_range.t -o $@ $<
a2c7281b
DK
3364
3365thumb2_blx_in_range.o: thumb_blx_in_range.s
3366 $(TEST_AS) -o $@ -march=armv7-a $<
3367
3368thumb2_blx_out_of_range.stdout: thumb2_blx_out_of_range
3369 $(TEST_OBJDUMP) -D $< > $@
3370
3371thumb2_blx_out_of_range: thumb2_blx_out_of_range.o ../ld-new
52dc3f9c 3372 ../ld-new -T $(srcdir)/thumb2_branch_range.t -o $@ $<
a2c7281b
DK
3373
3374thumb2_blx_out_of_range.o: thumb_blx_out_of_range.s
2a2b6d42
DK
3375 $(TEST_AS) -o $@ -march=armv7-a $<
3376
aa98ff75
DK
3377thumb_bl_out_of_range_local.stdout: thumb_bl_out_of_range_local
3378 $(TEST_OBJDUMP) -D $< > $@
3379
3380thumb_bl_out_of_range_local: thumb_bl_out_of_range_local.o ../ld-new
52dc3f9c 3381 ../ld-new --no-fix-arm1176 -T $(srcdir)/thumb_branch_range.t -o $@ $<
aa98ff75
DK
3382
3383thumb_bl_out_of_range_local.o: thumb_bl_out_of_range_local.s
3384 $(TEST_AS) -o $@ -march=armv5te $<
3385
57eb9b50
DK
3386arm_thm_jump11.stdout: arm_thm_jump11
3387 $(TEST_OBJDUMP) -D $< > $@
3388
3389arm_thm_jump11: arm_thm_jump11.o ../ld-new
52dc3f9c 3390 ../ld-new -T $(srcdir)/arm_thm_jump11.t -o $@ $<
57eb9b50
DK
3391
3392arm_thm_jump11.o: arm_thm_jump11.s
3393 $(TEST_AS) -o $@ $<
3394
3395arm_thm_jump8.stdout: arm_thm_jump8
3396 $(TEST_OBJDUMP) -D $< > $@
3397
3398arm_thm_jump8: arm_thm_jump8.o ../ld-new
52dc3f9c 3399 ../ld-new -T $(srcdir)/arm_thm_jump8.t -o $@ $<
57eb9b50
DK
3400
3401arm_thm_jump8.o: arm_thm_jump8.s
3402 $(TEST_AS) -o $@ $<
3403
2a2b6d42 3404MOSTLYCLEANFILES += arm_bl_in_range arm_bl_out_of_range thumb_bl_in_range \
a2c7281b
DK
3405 thumb_bl_out_of_range thumb2_bl_in_range thumb2_bl_out_of_range \
3406 thumb_blx_in_range thumb_blx_out_of_range thumb2_blx_in_range \
57eb9b50
DK
3407 thumb2_blx_out_of_range thumb_bl_out_of_range_local arm_thm_jump11 \
3408 arm_thm_jump8
2a2b6d42 3409
2fd9ae7a
DK
3410check_SCRIPTS += arm_fix_v4bx.sh
3411check_DATA += arm_fix_v4bx.stdout arm_fix_v4bx_interworking.stdout \
3412 arm_no_fix_v4bx.stdout
3413
3414arm_fix_v4bx.stdout: arm_fix_v4bx
3415 $(TEST_OBJDUMP) -D -j.text $< > $@
3416
d3bbad62 3417arm_fix_v4bx: arm_fix_v4bx.o ../ld-new
a8e2273b 3418 ../ld-new --no-fix-arm1176 --fix-v4bx -o $@ $<
2fd9ae7a
DK
3419
3420arm_fix_v4bx.o: arm_fix_v4bx.s
3421 $(TEST_AS) -o $@ $<
3422
3423arm_fix_v4bx_interworking.stdout: arm_fix_v4bx_interworking
3424 $(TEST_OBJDUMP) -D -j.text $< > $@
3425
d3bbad62 3426arm_fix_v4bx_interworking: arm_fix_v4bx.o ../ld-new
a8e2273b 3427 ../ld-new --no-fix-arm1176 --fix-v4bx-interworking -o $@ $<
2fd9ae7a
DK
3428
3429arm_no_fix_v4bx.stdout: arm_no_fix_v4bx
3430 $(TEST_OBJDUMP) -D -j.text $< > $@
3431
d3bbad62 3432arm_no_fix_v4bx: arm_fix_v4bx.o ../ld-new
a8e2273b 3433 ../ld-new --no-fix-arm1176 -o $@ $<
2fd9ae7a
DK
3434
3435MOSTLYCLEANFILES += arm_fix_v4bx arm_fix_v4bx_interworking arm_no_fix_v4bx
3436
da59ad79
DK
3437check_SCRIPTS += arm_attr_merge.sh
3438check_DATA += arm_attr_merge_6.stdout arm_attr_merge_6r.stdout \
3439 arm_attr_merge_7.stdout
3440
3441arm_attr_merge_6.stdout: arm_attr_merge_6
3442 $(TEST_READELF) -A $< > $@
3443
78d9f182 3444arm_attr_merge_6: arm_attr_merge_6a.o arm_attr_merge_6b.o ../ld-new
da59ad79
DK
3445 ../ld-new -o $@ arm_attr_merge_6a.o arm_attr_merge_6b.o
3446
3447arm_attr_merge_6a.o: arm_attr_merge_6a.s
3448 $(TEST_AS) -o $@ $<
3449
3450arm_attr_merge_6b.o: arm_attr_merge_6b.s
3451 $(TEST_AS) -o $@ $<
3452
3453arm_attr_merge_6r.stdout: arm_attr_merge_6r
3454 $(TEST_READELF) -A $< > $@
3455
78d9f182 3456arm_attr_merge_6r: arm_attr_merge_6b.o arm_attr_merge_6a.o ../ld-new
da59ad79
DK
3457 ../ld-new -o $@ arm_attr_merge_6b.o arm_attr_merge_6a.o
3458
3459arm_attr_merge_7.stdout: arm_attr_merge_7
3460 $(TEST_READELF) -A $< > $@
3461
78d9f182 3462arm_attr_merge_7: arm_attr_merge_7a.o arm_attr_merge_7b.o ../ld-new
da59ad79
DK
3463 ../ld-new -o $@ arm_attr_merge_7a.o arm_attr_merge_7b.o
3464
3465arm_attr_merge_7a.o: arm_attr_merge_7a.s
3466 $(TEST_AS) -o $@ $<
3467
3468arm_attr_merge_7b.o: arm_attr_merge_7b.s
3469 $(TEST_AS) -o $@ $<
3470
3471MOSTLYCLEANFILES += arm_attr_merge_6 arm_attr_merge_6r arm_attr_merge_7
3472
a8e2273b
ILT
3473# ARM1176 workaround test.
3474check_SCRIPTS += arm_fix_1176.sh
3475check_DATA += arm_fix_1176_default_v6z.stdout arm_fix_1176_on_v6z.stdout \
3476 arm_fix_1176_off_v6z.stdout arm_fix_1176_default_v5te.stdout \
3477 arm_fix_1176_default_v7a.stdout arm_fix_1176_default_1156t2f_s.stdout
3478
3479arm_fix_1176_default_v6z.stdout: arm_fix_1176_default_v6z
3480 $(TEST_OBJDUMP) -D -j.foo $< > $@
3481
3482arm_fix_1176_default_v6z: arm_fix_1176_default_v6z.o ../ld-new
3483 ../ld-new --section-start=.foo=0x2001014 -o $@ $<
3484
3485arm_fix_1176_default_v6z.o: arm_fix_1176.s
3486 $(TEST_AS) -march=armv6z -o $@ $<
3487
3488arm_fix_1176_on_v6z.stdout: arm_fix_1176_on_v6z
3489 $(TEST_OBJDUMP) -D -j.foo $< > $@
3490
3491arm_fix_1176_on_v6z: arm_fix_1176_on_v6z.o ../ld-new
3492 ../ld-new --section-start=.foo=0x2001014 --fix-arm1176 -o $@ $<
3493
3494arm_fix_1176_on_v6z.o: arm_fix_1176.s
3495 $(TEST_AS) -march=armv6z -o $@ $<
3496
3497arm_fix_1176_off_v6z.stdout: arm_fix_1176_off_v6z
3498 $(TEST_OBJDUMP) -D -j.foo $< > $@
3499
3500arm_fix_1176_off_v6z: arm_fix_1176_off_v6z.o ../ld-new
3501 ../ld-new --section-start=.foo=0x2001014 --no-fix-arm1176 -o $@ $<
3502
3503arm_fix_1176_off_v6z.o: arm_fix_1176.s
3504 $(TEST_AS) -march=armv6z -o $@ $<
3505
3506arm_fix_1176_default_v5te.stdout: arm_fix_1176_default_v5te
3507 $(TEST_OBJDUMP) -D -j.foo $< > $@
3508
3509arm_fix_1176_default_v5te: arm_fix_1176_default_v5te.o ../ld-new
3510 ../ld-new --section-start=.foo=0x2001014 -o $@ $<
3511
3512arm_fix_1176_default_v5te.o: arm_fix_1176.s
3513 $(TEST_AS) -march=armv5te -o $@ $<
3514
3515arm_fix_1176_default_v7a.stdout: arm_fix_1176_default_v7a
3516 $(TEST_OBJDUMP) -D -j.foo $< > $@
3517
3518arm_fix_1176_default_v7a: arm_fix_1176_default_v7a.o ../ld-new
3519 ../ld-new --section-start=.foo=0x2001014 -o $@ $<
3520
3521arm_fix_1176_default_v7a.o: arm_fix_1176.s
3522 $(TEST_AS) -march=armv7-a -o $@ $<
3523
3524arm_fix_1176_default_1156t2f_s.stdout: arm_fix_1176_default_1156t2f_s
3525 $(TEST_OBJDUMP) -D -j.foo $< > $@
3526
3527arm_fix_1176_default_1156t2f_s: arm_fix_1176_default_1156t2f_s.o ../ld-new
3528 ../ld-new --section-start=.foo=0x2001014 -o $@ $<
3529
3530arm_fix_1176_default_1156t2f_s.o: arm_fix_1176.s
3531 $(TEST_AS) -mcpu=arm1156t2f-s -o $@ $<
3532
3533MOSTLYCLEANFILES += arm_fix_1176_default_v6z arm_fix_1176_on_v6z arm_fix_1176_off_v6z \
3534 arm_fix_1176_default_v5te arm_fix_1176_default_v7a arm_fix_1176_default_1156t2f_s
3535
aa98ff75
DK
3536# Cortex-A8 workaround test.
3537
3538check_SCRIPTS += arm_cortex_a8.sh
3539check_DATA += arm_cortex_a8_b_cond.stdout arm_cortex_a8_b.stdout \
3540 arm_cortex_a8_bl.stdout arm_cortex_a8_blx.stdout \
3541 arm_cortex_a8_local.stdout arm_cortex_a8_local_reloc.stdout
3542
3543arm_cortex_a8_b_cond.stdout: arm_cortex_a8_b_cond
3544 $(TEST_OBJDUMP) -D -j.text $< > $@
3545
3546arm_cortex_a8_b_cond: arm_cortex_a8_b_cond.o ../ld-new
3547 ../ld-new -o $@ $<
3548
3549arm_cortex_a8_b_cond.o: arm_cortex_a8_b_cond.s
3550 $(TEST_AS) -o $@ $<
3551
3552arm_cortex_a8_b.stdout: arm_cortex_a8_b
3553 $(TEST_OBJDUMP) -D -j.text $< > $@
3554
3555arm_cortex_a8_b: arm_cortex_a8_b.o ../ld-new
3556 ../ld-new --fix-cortex-a8 -o $@ $<
3557
3558arm_cortex_a8_b.o: arm_cortex_a8_b.s
3559 $(TEST_AS) -o $@ $<
3560
3561arm_cortex_a8_bl.stdout: arm_cortex_a8_bl
3562 $(TEST_OBJDUMP) -D -j.text $< > $@
3563
3564arm_cortex_a8_bl: arm_cortex_a8_bl.o ../ld-new
3565 ../ld-new -o $@ $<
3566
3567arm_cortex_a8_bl.o: arm_cortex_a8_bl.s
3568 $(TEST_AS) -o $@ $<
3569
3570arm_cortex_a8_blx.stdout: arm_cortex_a8_blx
3571 $(TEST_OBJDUMP) -D -j.text $< > $@
3572
3573arm_cortex_a8_blx: arm_cortex_a8_blx.o ../ld-new
3574 ../ld-new -o $@ $<
3575
3576arm_cortex_a8_blx.o: arm_cortex_a8_blx.s
3577 $(TEST_AS) -o $@ $<
3578
3579arm_cortex_a8_local.stdout: arm_cortex_a8_local
3580 $(TEST_OBJDUMP) -D -j.text $< > $@
3581
3582arm_cortex_a8_local: arm_cortex_a8_local.o ../ld-new
3583 ../ld-new -o $@ $<
3584
3585arm_cortex_a8_local.o: arm_cortex_a8_local.s
3586 $(TEST_AS) -o $@ $<
3587
3588arm_cortex_a8_local_reloc.stdout: arm_cortex_a8_local_reloc
3589 $(TEST_OBJDUMP) -D -j.text $< > $@
3590
3591arm_cortex_a8_local_reloc: arm_cortex_a8_local_reloc.o ../ld-new
3592 ../ld-new -o $@ $<
3593
3594arm_cortex_a8_local_reloc.o: arm_cortex_a8_local_reloc.s
3595 $(TEST_AS) -o $@ $<
3596
3597MOSTLYCLEANFILES += arm_cortex_a8_b_cond arm_cortex_a8_b arm_cortex_a8_bl \
3598 arm_cortex_a8_blx arm_cortex_a8_local arm_cortex_a8_local_reloc
3599
c87e4302
DK
3600check_SCRIPTS += arm_exidx_test.sh
3601check_DATA += arm_exidx_test.stdout
3602
3603arm_exidx_test.stdout: arm_exidx_test.so
647f1574 3604 $(TEST_READELF) -Sr $< > $@
c87e4302
DK
3605
3606arm_exidx_test.so: arm_exidx_test.o ../ld-new
3607 ../ld-new -shared -o $@ $<
3608
3609arm_exidx_test.o: arm_exidx_test.s
3610 $(TEST_AS) -o $@ $<
3611
f62a3ca7
DK
3612check_SCRIPTS += pr12826.sh
3613check_DATA += pr12826.stdout
3614
3615pr12826.stdout: pr12826.so
3616 $(TEST_READELF) -A $< > $@
3617
3618pr12826.so: pr12826_1.o pr12826_2.o ../ld-new
3619 ../ld-new -shared -o $@ $<
3620
3621pr12826_1.o: pr12826_1.s
3622 $(TEST_AS) -o $@ $<
3623
3624pr12826_2.o: pr12826_2.s
3625 $(TEST_AS) -o $@ $<
c87e4302 3626
f6cccc2c 3627check_SCRIPTS += arm_unaligned_reloc.sh
2c339f71 3628check_DATA += arm_unaligned_reloc.stdout arm_unaligned_reloc_r.stdout
f6cccc2c
DK
3629
3630arm_unaligned_reloc.stdout: arm_unaligned_reloc
3631 $(TEST_OBJDUMP) -D $< > $@
3632
2c339f71
DK
3633arm_unaligned_reloc_r.stdout: arm_unaligned_reloc_r
3634 $(TEST_OBJDUMP) -Dr $< > $@
3635
f6cccc2c
DK
3636arm_unaligned_reloc: arm_unaligned_reloc.o ../ld-new
3637 ../ld-new -o $@ $<
3638
2c339f71
DK
3639arm_unaligned_reloc_r: arm_unaligned_reloc.o ../ld-new
3640 ../ld-new -r -o $@ $<
3641
f6cccc2c
DK
3642arm_unaligned_reloc.o: arm_unaligned_reloc.s
3643 $(TEST_AS) -o $@ $<
3644
2c339f71 3645MOSTLYCLEANFILES += arm_unaligned_reloc arm_unaligned_reloc_r
f6cccc2c 3646
cd6eab1c
ILT
3647# Check ARM to ARM farcall veneers
3648
3649check_SCRIPTS += arm_farcall_arm_arm.sh
3650check_DATA += arm_farcall_arm_arm.stdout
3651
3652arm_farcall_arm_arm.stdout: arm_farcall_arm_arm
3653 $(TEST_OBJDUMP) -d $< > $@
3654
3655arm_farcall_arm_arm: arm_farcall_arm_arm.o ../ld-new
a8e2273b 3656 ../ld-new --no-fix-arm1176 --section-start .text=0x1000 --section-start .foo=0x2001020 -o $@ $<
cd6eab1c
ILT
3657
3658arm_farcall_arm_arm.o: arm_farcall_arm_arm.s
3659 $(TEST_AS) -o $@ $<
3660
3661MOSTLYCLEANFILES += arm_farcall_arm_arm
3662
3663# Check ARM to Thumb farcall veneers
3664
3665check_SCRIPTS += arm_farcall_arm_thumb.sh
3666check_DATA += arm_farcall_arm_thumb.stdout arm_farcall_arm_thumb_5t.stdout
3667
3668arm_farcall_arm_thumb.stdout: arm_farcall_arm_thumb
3669 $(TEST_OBJDUMP) -D $< > $@
3670
3671arm_farcall_arm_thumb: arm_farcall_arm_thumb.o ../ld-new
3672 ../ld-new --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
3673
3674arm_farcall_arm_thumb.o: arm_farcall_arm_thumb.s
3675 $(TEST_AS) -o $@ $<
3676
3677arm_farcall_arm_thumb_5t.stdout: arm_farcall_arm_thumb_5t
3678 $(TEST_OBJDUMP) -D $< > $@
3679
3680arm_farcall_arm_thumb_5t: arm_farcall_arm_thumb_5t.o ../ld-new
a8e2273b 3681 ../ld-new --no-fix-arm1176 --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
cd6eab1c
ILT
3682
3683arm_farcall_arm_thumb_5t.o: arm_farcall_arm_thumb.s
3684 $(TEST_AS) -march=armv5t -o $@ $<
3685
3686MOSTLYCLEANFILES += arm_farcall_arm_thumb arm_farcall_arm_thumb_5t
3687
3688# Check Thumb to Thumb farcall veneers
3689
3690check_SCRIPTS += arm_farcall_thumb_thumb.sh
3691check_DATA += arm_farcall_thumb_thumb.stdout \
3692 arm_farcall_thumb_thumb_5t.stdout \
3693 arm_farcall_thumb_thumb_7m.stdout \
3694 arm_farcall_thumb_thumb_6m.stdout
3695
3696arm_farcall_thumb_thumb.stdout: arm_farcall_thumb_thumb
3697 $(TEST_OBJDUMP) -D $< > $@
3698
3699arm_farcall_thumb_thumb: arm_farcall_thumb_thumb.o ../ld-new
3700 ../ld-new --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
3701
3702arm_farcall_thumb_thumb.o: arm_farcall_thumb_thumb.s
3703 $(TEST_AS) -march=armv4t -o $@ $<
3704
3705arm_farcall_thumb_thumb_5t.stdout: arm_farcall_thumb_thumb_5t
3706 $(TEST_OBJDUMP) -D $< > $@
3707
3708arm_farcall_thumb_thumb_5t: arm_farcall_thumb_thumb_5t.o ../ld-new
a8e2273b 3709 ../ld-new --no-fix-arm1176 --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
cd6eab1c
ILT
3710
3711arm_farcall_thumb_thumb_5t.o: arm_farcall_thumb_thumb.s
3712 $(TEST_AS) -march=armv5t -o $@ $<
3713
3714arm_farcall_thumb_thumb_7m.stdout: arm_farcall_thumb_thumb_7m
3715 $(TEST_OBJDUMP) -D $< > $@
3716
3717arm_farcall_thumb_thumb_7m: arm_farcall_thumb_thumb_7m.o ../ld-new
3718 ../ld-new --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
3719
3720arm_farcall_thumb_thumb_7m.o: arm_farcall_thumb_thumb.s
3721 $(TEST_AS) -march=armv7-m -o $@ $<
3722
3723arm_farcall_thumb_thumb_6m.stdout: arm_farcall_thumb_thumb_6m
3724 $(TEST_OBJDUMP) -D $< > $@
3725
3726arm_farcall_thumb_thumb_6m: arm_farcall_thumb_thumb_6m.o ../ld-new
3727 ../ld-new --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
3728
3729arm_farcall_thumb_thumb_6m.o: arm_farcall_thumb_thumb.s
3730 $(TEST_AS) -march=armv6-m -o $@ $<
3731
3732MOSTLYCLEANFILES += arm_farcall_thumb_thumb arm_farcall_thumb_thumb_5t \
3733 arm_farcall_thumb_thumb_7m arm_farcall_thumb_thumb_6m
3734
36862fc0
UK
3735#Check ARM to ARM farcall veneers in the be8 mode addressing
3736
3737check_SCRIPTS += arm_farcall_arm_arm_be8.sh
3738check_DATA += arm_farcall_arm_arm_be8.stdout
3739
3740arm_farcall_arm_arm_be8.stdout: arm_farcall_arm_arm_be8
3741 $(TEST_OBJDUMP) -D $< > $@
3742
3743arm_farcall_arm_arm_be8: arm_farcall_arm_arm_be8.o ../ld-new
3744 ../ld-new --no-fix-arm1176 --section-start .text=0x1000 --section-start .foo=0x2001020 -EB --be8 -o $@ $<
3745
3746arm_farcall_arm_arm_be8.o: arm_farcall_arm_arm.s
3747 $(TEST_AS) -EB -o $@ $<
3748
3749MOSTLYCLEANFILES += arm_farcall_arm_arm_be8
3750
3751#Check THUMB to THUMB farcall veneers in the be8 mode addressing
3752
3753check_SCRIPTS += arm_farcall_thumb_thumb_be8.sh
3754check_DATA += arm_farcall_thumb_thumb_be8.stdout
3755
3756arm_farcall_thumb_thumb_be8.stdout: arm_farcall_thumb_thumb_be8
3757 $(TEST_OBJDUMP) -D $< > $@
3758
3759arm_farcall_thumb_thumb_be8: arm_farcall_thumb_thumb_be8.o ../ld-new
3760 ../ld-new --section-start .text=0x1000 --section-start .foo=0x2001014 -EB --be8 -o $@ $<
3761
3762arm_farcall_thumb_thumb_be8.o: arm_farcall_thumb_thumb.s
3763 $(TEST_AS) -march=armv7-m -EB -o $@ $<
3764
3765MOSTLYCLEANFILES += arm_farcall_thumb_thumb_be8
3766
cd6eab1c
ILT
3767# Check Thumb to ARM farcall veneers
3768
3769check_SCRIPTS += arm_farcall_thumb_arm.sh
3770check_DATA += arm_farcall_thumb_arm.stdout \
3771 arm_farcall_thumb_arm_5t.stdout
3772
3773arm_farcall_thumb_arm.stdout: arm_farcall_thumb_arm
3774 $(TEST_OBJDUMP) -D $< > $@
3775
3776arm_farcall_thumb_arm: arm_farcall_thumb_arm.o ../ld-new
3777 ../ld-new --section-start .text=0x1c01010 --section-start .foo=0x2001014 -o $@ $<
3778
3779arm_farcall_thumb_arm.o: arm_farcall_thumb_arm.s
3780 $(TEST_AS) -o $@ $<
3781
3782arm_farcall_thumb_arm_5t.stdout: arm_farcall_thumb_arm_5t
3783 $(TEST_OBJDUMP) -D $< > $@
3784
3785arm_farcall_thumb_arm_5t: arm_farcall_thumb_arm_5t.o ../ld-new
a8e2273b 3786 ../ld-new --no-fix-arm1176 --section-start .text=0x1c01010 --section-start .foo=0x2001014 -o $@ $<
cd6eab1c
ILT
3787
3788arm_farcall_thumb_arm_5t.o: arm_farcall_thumb_arm.s
3789 $(TEST_AS) -march=armv5t -o $@ $<
3790
3791MOSTLYCLEANFILES += arm_farcall_thumb_arm arm_farcall_thumb_arm_5t
3792
bc99685c
DK
3793# Check handling of --target1-abs, --target1-rel and --target2 options
3794
3795check_SCRIPTS += arm_target1_abs.sh arm_target1_rel.sh \
3796 arm_target2_rel.sh arm_target2_abs.sh arm_target2_got_rel.sh
3797check_DATA += arm_target1_abs.stdout arm_target1_rel.stdout \
3798 arm_target2_rel.stdout arm_target2_abs.stdout arm_target2_got_rel.stdout
3799
3800arm_target1_abs.stdout: arm_target1_abs
3801 $(TEST_OBJDUMP) -s $< > $@
3802
3803arm_target1_abs: arm_target1.o ../ld-new
3804 ../ld-new --target1-abs --section-start .text=0x8000 -o $@ $<
3805
3806arm_target1_rel.stdout: arm_target1_rel
3807 $(TEST_OBJDUMP) -s $< > $@
3808
3809arm_target1_rel: arm_target1.o ../ld-new
3810 ../ld-new --target1-rel --section-start .text=0x8000 -o $@ $<
3811
3812arm_target1.o: arm_target1.s
3813 $(TEST_AS) -o $@ $<
3814
3815arm_target2_rel.stdout: arm_target2_rel
3816 $(TEST_OBJDUMP) -s $< > $@
3817
3818arm_target2_rel: arm_target2.o ../ld-new
3819 ../ld-new --target2=rel --section-start .text=0x8000 -o $@ $<
3820
3821arm_target2_abs.stdout: arm_target2_abs
3822 $(TEST_OBJDUMP) -s $< > $@
3823
3824arm_target2_abs: arm_target2.o ../ld-new
3825 ../ld-new --target2=abs --section-start .text=0x8000 -o $@ $<
3826
3827arm_target2_got_rel.stdout: arm_target2_got_rel
3828 $(TEST_OBJDUMP) -s $< > $@
3829
3830arm_target2_got_rel: arm_target2.o ../ld-new
3831 ../ld-new --target2=got-rel --section-start .text=0x8000 --section-start .got=0x9000 -o $@ $<
3832
3833arm_target2.o: arm_target2.s
3834 $(TEST_AS) -o $@ $<
3835
3836MOSTLYCLEANFILES += arm_target1_abs arm_target1_rel \
3837 arm_target2_rel arm_target2_abs arm_target2_got_rel
3838
ee7ef219
IK
3839# The test demonstrates why the constructor of a target object should not access options.
3840check_DATA += arm_target_lazy_init
3841MOSTLYCLEANFILES += arm_target_lazy_init
3842arm_target_lazy_init: arm_target_lazy_init.o arm_target_lazy_init.t ../ld-new
3843 ../ld-new -T $(srcdir)/arm_target_lazy_init.t -o $@ $<
3844arm_target_lazy_init.o: arm_target_lazy_init.s
3845 $(TEST_AS) -EL -o $@ $<
3846
e4782e83 3847endif DEFAULT_TARGET_ARM
eb373049 3848
5627d875
IK
3849if DEFAULT_TARGET_AARCH64
3850
3851check_SCRIPTS += aarch64_reloc_none.sh
3852check_DATA += aarch64_reloc_none.stdout
3853aarch64_reloc_none.o: aarch64_reloc_none.s
3854 $(TEST_AS) -o $@ $<
3855aarch64_reloc_none: aarch64_reloc_none.o ../ld-new
3856 ../ld-new -o $@ aarch64_reloc_none.o --gc-sections
3857aarch64_reloc_none.stdout: aarch64_reloc_none
3858 $(TEST_NM) $< > $@
3859
3860MOSTLYCLEANFILES += aarch64_reloc_none
3861
8769bc4b
HS
3862check_SCRIPTS += aarch64_relocs.sh
3863check_DATA += aarch64_relocs.stdout
3864aarch64_globals.o: aarch64_globals.s
3865 $(TEST_AS) -o $@ $<
3866aarch64_relocs.o: aarch64_relocs.s
3867 $(TEST_AS) -o $@ $<
3868aarch64_relocs: aarch64_relocs.o aarch64_globals.o ../ld-new
3869 ../ld-new -o $@ aarch64_relocs.o aarch64_globals.o -e0 --emit-relocs
3870aarch64_relocs.stdout: aarch64_relocs
3871 $(TEST_OBJDUMP) -dr $< > $@
3872
3873MOSTLYCLEANFILES += aarch64_relocs
3874
6bf56e74
IK
3875check_SCRIPTS += pr21430.sh
3876check_DATA += pr21430.stdout
3877pr21430.o: pr21430.s
3878 $(TEST_AS) -o $@ $<
3879pr21430: pr21430.o ../ld-new
3880 ../ld-new -o $@ $<
3881pr21430.stdout: pr21430
3882 $(TEST_NM) -S $< > $@
3883
3884MOSTLYCLEANFILES += pr21430
3885
cefdd1cd
IK
3886check_SCRIPTS += aarch64_tlsdesc.sh
3887check_DATA += aarch64_tlsdesc.stdout
3888aarch64_tlsdesc.o: aarch64_tlsdesc.s
3889 $(TEST_AS) -o $@ $<
3890aarch64_tlsdesc: aarch64_tlsdesc.o $(srcdir)/aarch64_tlsdesc.t ../ld-new
3891 ../ld-new $< -shared -T $(srcdir)/aarch64_tlsdesc.t -o $@
3892aarch64_tlsdesc.stdout: aarch64_tlsdesc
3893 $(TEST_OBJDUMP) -dR -j.text -j.got.plt $< > $@
3894
3895MOSTLYCLEANFILES += aarch64_tlsdesc
3896
5627d875
IK
3897endif DEFAULT_TARGET_AARCH64
3898
2b63aca3
MK
3899if DEFAULT_TARGET_S390
3900
3901check_SCRIPTS += split_s390.sh
3902check_DATA += split_s390_z1.stdout split_s390_z2.stdout split_s390_z3.stdout \
3903 split_s390_z4.stdout split_s390_n1.stdout split_s390_n2.stdout \
3904 split_s390_a1.stdout split_s390_a2.stdout split_s390_z1_ns.stdout \
3905 split_s390_z2_ns.stdout split_s390_z3_ns.stdout split_s390_z4_ns.stdout \
3906 split_s390_n1_ns.stdout split_s390_n2_ns.stdout split_s390_r.stdout \
3907 split_s390x_z1.stdout split_s390x_z2.stdout split_s390x_z3.stdout \
3908 split_s390x_z4.stdout split_s390x_n1.stdout split_s390x_n2.stdout \
3909 split_s390x_a1.stdout split_s390x_a2.stdout split_s390x_z1_ns.stdout \
3910 split_s390x_z2_ns.stdout split_s390x_z3_ns.stdout \
3911 split_s390x_z4_ns.stdout split_s390x_n1_ns.stdout \
3912 split_s390x_n2_ns.stdout split_s390x_r.stdout
3913SPLIT_DEFSYMS = --defsym __morestack=0x100 --defsym __morestack_non_split=0x200
3914split_s390_1_z1.o: split_s390_1_z1.s
3915 $(TEST_AS) -m31 -o $@ $<
3916split_s390_1_z2.o: split_s390_1_z2.s
3917 $(TEST_AS) -m31 -o $@ $<
3918split_s390_1_z3.o: split_s390_1_z3.s
3919 $(TEST_AS) -m31 -o $@ $<
3920split_s390_1_z4.o: split_s390_1_z4.s
3921 $(TEST_AS) -m31 -o $@ $<
3922split_s390_1_n1.o: split_s390_1_n1.s
3923 $(TEST_AS) -m31 -o $@ $<
3924split_s390_1_n2.o: split_s390_1_n2.s
3925 $(TEST_AS) -m31 -o $@ $<
3926split_s390_1_a1.o: split_s390_1_a1.s
3927 $(TEST_AS) -m31 -o $@ $<
3928split_s390_1_a2.o: split_s390_1_a2.s
3929 $(TEST_AS) -m31 -o $@ $<
3930split_s390_2_s.o: split_s390_2_s.s
3931 $(TEST_AS) -m31 -o $@ $<
3932split_s390_2_ns.o: split_s390_2_ns.s
3933 $(TEST_AS) -m31 -o $@ $<
3934split_s390_z1: split_s390_1_z1.o split_s390_2_s.o ../ld-new
3935 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_z1.o split_s390_2_s.o
3936split_s390_z1.stdout: split_s390_z1
3937 $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
3938split_s390_z2: split_s390_1_z2.o split_s390_2_s.o ../ld-new
3939 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_z2.o split_s390_2_s.o
3940split_s390_z2.stdout: split_s390_z2
3941 $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
3942split_s390_z3: split_s390_1_z3.o split_s390_2_s.o ../ld-new
3943 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_z3.o split_s390_2_s.o
3944split_s390_z3.stdout: split_s390_z3
3945 $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
3946split_s390_z4: split_s390_1_z4.o split_s390_2_s.o ../ld-new
3947 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_z4.o split_s390_2_s.o
3948split_s390_z4.stdout: split_s390_z4
3949 $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
3950split_s390_n1: split_s390_1_n1.o split_s390_2_s.o ../ld-new
3951 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_n1.o split_s390_2_s.o
3952split_s390_n1.stdout: split_s390_n1
3953 $(TEST_OBJDUMP) -d $< > $@
3954split_s390_n2: split_s390_1_n2.o split_s390_2_s.o ../ld-new
3955 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_n2.o split_s390_2_s.o
3956split_s390_n2.stdout: split_s390_n2
3957 $(TEST_OBJDUMP) -d $< > $@
3958split_s390_z1_ns: split_s390_1_z1.o split_s390_2_ns.o ../ld-new
3959 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_z1.o split_s390_2_ns.o
3960split_s390_z1_ns.stdout: split_s390_z1_ns
3961 $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
3962split_s390_z2_ns: split_s390_1_z2.o split_s390_2_ns.o ../ld-new
3963 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_z2.o split_s390_2_ns.o
3964split_s390_z2_ns.stdout: split_s390_z2_ns
3965 $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
3966split_s390_z3_ns: split_s390_1_z3.o split_s390_2_ns.o ../ld-new
3967 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_z3.o split_s390_2_ns.o
3968split_s390_z3_ns.stdout: split_s390_z3_ns
3969 $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
3970split_s390_z4_ns: split_s390_1_z4.o split_s390_2_ns.o ../ld-new
3971 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_z4.o split_s390_2_ns.o
3972split_s390_z4_ns.stdout: split_s390_z4_ns
3973 $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
3974split_s390_n1_ns: split_s390_1_n1.o split_s390_2_ns.o ../ld-new
3975 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_n1.o split_s390_2_ns.o
3976split_s390_n1_ns.stdout: split_s390_n1_ns
3977 $(TEST_OBJDUMP) -d $< > $@
3978split_s390_n2_ns.stdout: split_s390_1_n2.o split_s390_2_ns.o ../ld-new
3979 ../ld-new $(SPLIT_DEFSYMS) -o split_s390_n2 split_s390_1_n2.o split_s390_2_ns.o > $@ 2>&1 || exit 0
3980split_s390_a1.stdout: split_s390_1_a1.o split_s390_2_ns.o ../ld-new
3981 ../ld-new $(SPLIT_DEFSYMS) -o split_s390_a1 split_s390_1_a1.o split_s390_2_ns.o > $@ 2>&1 || exit 0
3982split_s390_a2: split_s390_1_a2.o split_s390_2_ns.o ../ld-new
3983 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_a2.o split_s390_2_ns.o
3984split_s390_a2.stdout: split_s390_a2
3985 $(TEST_OBJDUMP) -d $< > $@
3986split_s390_r.stdout: split_s390_1_z1.o split_s390_2_ns.o ../ld-new
3987 ../ld-new -r split_s390_1_z1.o split_s390_2_ns.o -o split_s390_r > $@ 2>&1 || exit 0
3988split_s390x_1_z1.o: split_s390x_1_z1.s
3989 $(TEST_AS) -m64 -o $@ $<
3990split_s390x_1_z2.o: split_s390x_1_z2.s
3991 $(TEST_AS) -m64 -o $@ $<
3992split_s390x_1_z3.o: split_s390x_1_z3.s
3993 $(TEST_AS) -m64 -o $@ $<
3994split_s390x_1_z4.o: split_s390x_1_z4.s
3995 $(TEST_AS) -m64 -o $@ $<
3996split_s390x_1_n1.o: split_s390x_1_n1.s
3997 $(TEST_AS) -m64 -o $@ $<
3998split_s390x_1_n2.o: split_s390x_1_n2.s
3999 $(TEST_AS) -m64 -o $@ $<
4000split_s390x_1_a1.o: split_s390x_1_a1.s
4001 $(TEST_AS) -m64 -o $@ $<
4002split_s390x_1_a2.o: split_s390x_1_a2.s
4003 $(TEST_AS) -m64 -o $@ $<
4004split_s390x_2_s.o: split_s390x_2_s.s
4005 $(TEST_AS) -m64 -o $@ $<
4006split_s390x_2_ns.o: split_s390x_2_ns.s
4007 $(TEST_AS) -m64 -o $@ $<
4008split_s390x_z1: split_s390x_1_z1.o split_s390x_2_s.o ../ld-new
4009 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_z1.o split_s390x_2_s.o
4010split_s390x_z1.stdout: split_s390x_z1
4011 $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
4012split_s390x_z2: split_s390x_1_z2.o split_s390x_2_s.o ../ld-new
4013 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_z2.o split_s390x_2_s.o
4014split_s390x_z2.stdout: split_s390x_z2
4015 $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
4016split_s390x_z3: split_s390x_1_z3.o split_s390x_2_s.o ../ld-new
4017 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_z3.o split_s390x_2_s.o
4018split_s390x_z3.stdout: split_s390x_z3
4019 $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
4020split_s390x_z4: split_s390x_1_z4.o split_s390x_2_s.o ../ld-new
4021 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_z4.o split_s390x_2_s.o
4022split_s390x_z4.stdout: split_s390x_z4
4023 $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
4024split_s390x_n1: split_s390x_1_n1.o split_s390x_2_s.o ../ld-new
4025 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_n1.o split_s390x_2_s.o
4026split_s390x_n1.stdout: split_s390x_n1
4027 $(TEST_OBJDUMP) -d $< > $@
4028split_s390x_n2: split_s390x_1_n2.o split_s390x_2_s.o ../ld-new
4029 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_n2.o split_s390x_2_s.o
4030split_s390x_n2.stdout: split_s390x_n2
4031 $(TEST_OBJDUMP) -d $< > $@
4032split_s390x_z1_ns: split_s390x_1_z1.o split_s390x_2_ns.o ../ld-new
4033 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_z1.o split_s390x_2_ns.o
4034split_s390x_z1_ns.stdout: split_s390x_z1_ns
4035 $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
4036split_s390x_z2_ns: split_s390x_1_z2.o split_s390x_2_ns.o ../ld-new
4037 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_z2.o split_s390x_2_ns.o
4038split_s390x_z2_ns.stdout: split_s390x_z2_ns
4039 $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
4040split_s390x_z3_ns: split_s390x_1_z3.o split_s390x_2_ns.o ../ld-new
4041 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_z3.o split_s390x_2_ns.o
4042split_s390x_z3_ns.stdout: split_s390x_z3_ns
4043 $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
4044split_s390x_z4_ns: split_s390x_1_z4.o split_s390x_2_ns.o ../ld-new
4045 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_z4.o split_s390x_2_ns.o
4046split_s390x_z4_ns.stdout: split_s390x_z4_ns
4047 $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
4048split_s390x_n1_ns: split_s390x_1_n1.o split_s390x_2_ns.o ../ld-new
4049 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_n1.o split_s390x_2_ns.o
4050split_s390x_n1_ns.stdout: split_s390x_n1_ns
4051 $(TEST_OBJDUMP) -d $< > $@
4052split_s390x_n2_ns.stdout: split_s390x_1_n2.o split_s390x_2_ns.o ../ld-new
4053 ../ld-new $(SPLIT_DEFSYMS) -o split_s390x_n2 split_s390x_1_n2.o split_s390x_2_ns.o > $@ 2>&1 || exit 0
4054split_s390x_a1.stdout: split_s390x_1_a1.o split_s390x_2_ns.o ../ld-new
4055 ../ld-new $(SPLIT_DEFSYMS) -o split_s390x_a1 split_s390x_1_a1.o split_s390x_2_ns.o > $@ 2>&1 || exit 0
4056split_s390x_a2: split_s390x_1_a2.o split_s390x_2_ns.o ../ld-new
4057 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_a2.o split_s390x_2_ns.o
4058split_s390x_a2.stdout: split_s390x_a2
4059 $(TEST_OBJDUMP) -d $< > $@
4060split_s390x_r.stdout: split_s390x_1_z1.o split_s390x_2_ns.o ../ld-new
4061 ../ld-new -r split_s390x_1_z1.o split_s390x_2_ns.o -o split_s390x_r > $@ 2>&1 || exit 0
4062MOSTLYCLEANFILES += split_s390_z1 split_s390_z2 split_s390_z3 \
4063 split_s390_z4 split_s390_n1 split_s390_n2 split_s390_a1 \
4064 split_s390_a2 split_s390_z1_ns split_s390_z2_ns split_s390_z3_ns \
4065 split_s390_z4_ns split_s390_n1_ns split_s390_n2_ns split_s390_r \
4066 split_s390x_z1 split_s390x_z2 split_s390x_z3 split_s390x_z4 \
4067 split_s390x_n1 split_s390x_n2 split_s390x_a1 split_s390x_a2 \
4068 split_s390x_z1_ns split_s390x_z2_ns split_s390x_z3_ns \
4069 split_s390x_z4_ns split_s390x_n1_ns split_s390x_n2_ns split_s390x_r
4070
4071endif DEFAULT_TARGET_S390
4072
eb373049
ILT
4073endif NATIVE_OR_CROSS_LINKER
4074
35c813e2
CC
4075# Tests for the dwp tool.
4076# We don't want to rely yet on GCC support for -gsplit-dwarf,
4077# so we use (for now) test cases in x86 assembly language,
4078# compiled from the dwp_test_*.cc sources.
4079
4080if DEFAULT_TARGET_X86_64
4081
4082dwp_test_main.o: dwp_test_main.s
4083 $(TEST_AS) -o $@ $<
4084dwp_test_1.o: dwp_test_1.s
4085 $(TEST_AS) -o $@ $<
4086dwp_test_1b.o: dwp_test_1b.s
4087 $(TEST_AS) -o $@ $<
4088dwp_test_2.o: dwp_test_2.s
4089 $(TEST_AS) -o $@ $<
4090
4091dwp_test_main.dwo: dwp_test_main.o
4092 $(TEST_OBJCOPY) --extract-dwo $< $@
4093dwp_test_1.dwo: dwp_test_1.o
4094 $(TEST_OBJCOPY) --extract-dwo $< $@
4095dwp_test_1b.dwo: dwp_test_1b.o
4096 $(TEST_OBJCOPY) --extract-dwo $< $@
4097dwp_test_2.dwo: dwp_test_2.o
4098 $(TEST_OBJCOPY) --extract-dwo $< $@
4099
0ec6429b 4100MOSTLYCLEANFILES += *.dwo *.dwp
35c813e2
CC
4101check_SCRIPTS += dwp_test_1.sh
4102check_DATA += dwp_test_1.stdout
4103dwp_test_1.stdout: dwp_test_1.dwp
4104 $(TEST_READELF) -wi $< > $@
4105dwp_test_1.dwp: ../dwp dwp_test_main.dwo dwp_test_1.dwo dwp_test_1b.dwo dwp_test_2.dwo
4106 ../dwp -o $@ dwp_test_main.dwo dwp_test_1.dwo dwp_test_1b.dwo dwp_test_2.dwo
4107
4108check_SCRIPTS += dwp_test_2.sh
4109check_DATA += dwp_test_2.stdout
4110dwp_test_2.stdout: dwp_test_2.dwp
4111 $(TEST_READELF) -wi $< > $@
4112dwp_test_2.dwp: ../dwp dwp_test_2a.dwp dwp_test_2b.dwp
4113 ../dwp -o $@ dwp_test_2a.dwp dwp_test_2b.dwp
4114dwp_test_2a.dwp: ../dwp dwp_test_main.dwo dwp_test_1.dwo
4115 ../dwp -o $@ dwp_test_main.dwo dwp_test_1.dwo
4116dwp_test_2b.dwp: ../dwp dwp_test_1b.dwo dwp_test_2.dwo
4117 ../dwp -o $@ dwp_test_1b.dwo dwp_test_2.dwo
4118
4119endif DEFAULT_TARGET_X86_64
This page took 0.697255 seconds and 4 git commands to generate.