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