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