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