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