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