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