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