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