* testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
[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
f958d5fc
ILT
10# The two_file_test tests -fmerge-constants, so we simply always turn
11# it on. This may need to be controlled by a configure option
12# eventually.
89fc3421 13AM_CFLAGS = $(WARN_CFLAGS) $(LFS_CFLAGS) -fmerge-constants
494e05f4 14AM_CXXFLAGS = $(WARN_CXXFLAGS) $(LFS_CFLAGS) -fmerge-constants
5a6f7e2d 15
14ec8efd 16AM_CPPFLAGS = \
5a6f7e2d 17 -I$(srcdir) -I$(srcdir)/.. -I$(srcdir)/../../include \
155a0dd7 18 -I$(srcdir)/../../elfcpp -I.. \
5a6f7e2d
ILT
19 -DLOCALEDIR="\"$(datadir)/locale\"" \
20 @INCINTL@
21
6835af53
ILT
22TEST_READELF = $(top_builddir)/../binutils/readelf
23TEST_OBJDUMP = $(top_builddir)/../binutils/objdump
24TEST_CXXFILT = $(top_builddir)/../binutils/cxxfilt
25TEST_STRIP = $(top_builddir)/../binutils/strip-new
fbd8a257 26TEST_AR = $(top_builddir)/../binutils/ar
531813ad 27TEST_NM = $(top_builddir)/../binutils/nm-new
364c7fa5 28TEST_AS = $(top_builddir)/../gas/as-new
6835af53 29
89fc3421
CC
30if PLUGINS
31LIBDL = -ldl
32endif
33
fe9a4c12
ILT
34if THREADS
35THREADSLIB = -lpthread
36endif
37
155a0dd7
ILT
38if OMP_SUPPORT
39TLS_TEST_C_CFLAGS = -fopenmp
40endif
41
351a8000
ILT
42# 'make clean' is good about deleting some intermediate files (such as
43# .o's), but not all of them (such as .so's and .err files). We
44# improve on that here. automake-1.9 info docs say "mostlyclean" is
45# the right choice for files 'make' builds that people rebuild.
72fef11a 46MOSTLYCLEANFILES = *.so *.syms *.stdout
6eee141f 47
6eee141f 48
351a8000
ILT
49# We will add to these later, for each individual test. Note
50# that we add each test under check_SCRIPTS or check_PROGRAMS;
51# the TESTS variable is automatically populated from these.
52check_SCRIPTS =
53check_DATA =
54check_PROGRAMS =
d491d34e
ILT
55BUILT_SOURCES =
56
351a8000 57TESTS = $(check_SCRIPTS) $(check_PROGRAMS)
22dc1b09 58
351a8000
ILT
59# ---------------------------------------------------------------------
60# These tests test the internals of gold (unittests).
5a6f7e2d 61
351a8000 62# Infrastucture needed for the unittests
5a6f7e2d
ILT
63check_LIBRARIES = libgoldtest.a
64libgoldtest_a_SOURCES = test.cc testmain.cc testfile.cc
65
ad2d6943
ILT
66DEPENDENCIES = \
67 libgoldtest.a ../libgold.a ../../libiberty/libiberty.a $(LIBINTL_DEP)
fe9a4c12 68LDADD = libgoldtest.a ../libgold.a ../../libiberty/libiberty.a $(LIBINTL) \
89fc3421 69 $(THREADSLIB) $(LIBDL)
5a6f7e2d 70
5a6f7e2d 71
351a8000
ILT
72# The unittests themselves
73check_PROGRAMS += object_unittest
5a6f7e2d 74object_unittest_SOURCES = object_unittest.cc
22dc1b09 75
bc644c6c
ILT
76check_PROGRAMS += binary_unittest
77binary_unittest_SOURCES = binary_unittest.cc
78
351a8000
ILT
79
80# ---------------------------------------------------------------------
81# These tests test the output of gold (end-to-end tests). In
82# particular, they make sure that gold can link "difficult" object
83# files, and the resulting object files run correctly. These can only
84# run if we've built ld-new for the native architecture (that is,
85# we're not cross-compiling it), since we run ld-new as part of these
86# tests. We use the gcc-specific flag '-B' to use our linker instead
87# of the default linker, which is why we only run our tests under gcc.
a360aedd 88
e2827e5f 89if NATIVE_LINKER
351a8000 90if GCC
e2827e5f 91
351a8000
ILT
92# Infrastucture needed for the unittests: a directory where the linker
93# is named 'ld'. This is because the -B flag appends 'ld' to its arg.
e2827e5f
ILT
94gcctestdir/ld: ../ld-new
95 test -d gcctestdir || mkdir -p gcctestdir
96 rm -f gcctestdir/ld
97 (cd gcctestdir && $(LN_S) ../../ld-new ld)
98
351a8000
ILT
99# Each of these .o's is a useful, small complete program. They're
100# particularly useful for making sure ld-new's flags do what they're
101# supposed to (hence their names), but are used for many tests that
102# don't actually involve analyzing input data.
43771f76
ILT
103flagstest_debug.o: constructor_test.cc
104 $(CXXCOMPILE) -O0 -g -c -o $@ $<
105flagstest_ndebug.o: constructor_test.cc
106 $(CXXCOMPILE) -O0 -c -o $@ $<
107
325e6408
RÁE
108check_SCRIPTS += incremental_test.sh
109check_DATA += incremental_test.stdout
110MOSTLYCLEANFILES += incremental_test
111incremental_test_1.o: incremental_test_1.c
112 $(COMPILE) -O0 -c -ffunction-sections -g -o $@ $<
113incremental_test_2.o: incremental_test_2.c
114 $(COMPILE) -O0 -c -ffunction-sections -g -o $@ $<
115incremental_test: incremental_test_1.o incremental_test_2.o gcctestdir/ld
116 $(LINK) -Bgcctestdir/ -Wl,-incremental incremental_test_1.o incremental_test_2.o -Wl,-debug 2> incremental_test.cmdline
117incremental_test.stdout: incremental_test ../incremental-dump
118 ../incremental-dump incremental_test > $@
43771f76 119
531813ad
ST
120check_SCRIPTS += gc_comdat_test.sh
121check_DATA += gc_comdat_test.stdout
72fef11a 122MOSTLYCLEANFILES += gc_comdat_test
531813ad 123gc_comdat_test_1.o: gc_comdat_test_1.cc
4daadc0d 124 $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
531813ad 125gc_comdat_test_2.o: gc_comdat_test_2.cc
4daadc0d 126 $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
531813ad 127gc_comdat_test: gc_comdat_test_1.o gc_comdat_test_2.o gcctestdir/ld
4daadc0d 128 $(CXXLINK) -Bgcctestdir/ -Wl,--gc-sections gc_comdat_test_1.o gc_comdat_test_2.o
531813ad
ST
129gc_comdat_test.stdout: gc_comdat_test
130 $(TEST_NM) -C gc_comdat_test > gc_comdat_test.stdout
131
27721062
ST
132check_SCRIPTS += gc_tls_test.sh
133check_DATA += gc_tls_test.stdout
72fef11a 134MOSTLYCLEANFILES += gc_tls_test
27721062
ST
135gc_tls_test.o: gc_tls_test.cc
136 $(CXXCOMPILE) -O0 -c -g -o $@ $<
137gc_tls_test:gc_tls_test.o gcctestdir/ld
138 $(CXXLINK) -Bgcctestdir/ -Wl,--gc-sections gc_tls_test.o
139gc_tls_test.stdout: gc_tls_test
140 $(TEST_NM) -C gc_tls_test > gc_tls_test.stdout
141
f1ec9ded
ST
142check_SCRIPTS += gc_orphan_section_test.sh
143check_DATA += gc_orphan_section_test.stdout
144MOSTLYCLEANFILES += gc_orphan_section_test
145gc_orphan_section_test.o: gc_orphan_section_test.cc
146 $(CXXCOMPILE) -O0 -c -g -o $@ $<
147gc_orphan_section_test:gc_orphan_section_test.o gcctestdir/ld
148 $(CXXLINK) -Bgcctestdir/ -Wl,--gc-sections gc_orphan_section_test.o
149gc_orphan_section_test.stdout: gc_orphan_section_test
150 $(TEST_NM) gc_orphan_section_test > gc_orphan_section_test.stdout
151
ef15dade
ST
152check_SCRIPTS += icf_test.sh
153check_DATA += icf_test.stdout
72fef11a 154MOSTLYCLEANFILES += icf_test
ef15dade
ST
155icf_test.o: icf_test.cc
156 $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
157icf_test: icf_test.o gcctestdir/ld
032ce4e9 158 $(CXXLINK) -Bgcctestdir/ -Wl,--icf=all icf_test.o
ef15dade
ST
159icf_test.stdout: icf_test
160 $(TEST_NM) -C icf_test > icf_test.stdout
161
48c187ce
ST
162check_SCRIPTS += icf_keep_unique_test.sh
163check_DATA += icf_keep_unique_test.stdout
72fef11a 164MOSTLYCLEANFILES += icf_keep_unique_test
48c187ce
ST
165icf_keep_unique_test.o: icf_keep_unique_test.cc
166 $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
167icf_keep_unique_test: icf_keep_unique_test.o gcctestdir/ld
032ce4e9 168 $(CXXLINK) -Bgcctestdir/ -Wl,--icf=all -Wl,--keep-unique,_Z11unique_funcv icf_keep_unique_test.o
48c187ce
ST
169icf_keep_unique_test.stdout: icf_keep_unique_test
170 $(TEST_NM) -C icf_keep_unique_test > icf_keep_unique_test.stdout
531813ad 171
032ce4e9 172check_SCRIPTS += icf_safe_test.sh
21bb3914 173check_DATA += icf_safe_test_1.stdout icf_safe_test_2.stdout
032ce4e9 174MOSTLYCLEANFILES += icf_safe_test
21bb3914 175icf_safe_test.o: icf_safe_test.cc
032ce4e9
ST
176 $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
177icf_safe_test: icf_safe_test.o gcctestdir/ld
178 $(CXXLINK) -Bgcctestdir/ -Wl,--icf=safe icf_safe_test.o
21bb3914
ST
179icf_safe_test_1.stdout: icf_safe_test
180 $(TEST_NM) icf_safe_test > icf_safe_test_1.stdout
181icf_safe_test_2.stdout: icf_safe_test
182 $(TEST_READELF) -h icf_safe_test > icf_safe_test_2.stdout
183
184check_SCRIPTS += icf_safe_so_test.sh
185check_DATA += icf_safe_so_test_1.stdout icf_safe_so_test_2.stdout
186MOSTLYCLEANFILES += icf_safe_so_test
187icf_safe_so_test.o: icf_safe_so_test.cc
188 $(CXXCOMPILE) -O0 -c -ffunction-sections -fPIC -g -o $@ $<
189icf_safe_so_test: icf_safe_so_test.o gcctestdir/ld
190 $(CXXLINK) -Bgcctestdir/ -Wl,--icf=safe icf_safe_so_test.o -fPIC -shared
191icf_safe_so_test_1.stdout: icf_safe_so_test
192 $(TEST_NM) icf_safe_so_test > icf_safe_so_test_1.stdout
193icf_safe_so_test_2.stdout: icf_safe_so_test
194 $(TEST_READELF) -h icf_safe_so_test > icf_safe_so_test_2.stdout
032ce4e9 195
6e9ba2ca
ST
196check_SCRIPTS += final_layout.sh
197check_DATA += final_layout.stdout
198MOSTLYCLEANFILES += final_layout
199final_layout.o: final_layout.cc
200 $(CXXCOMPILE) -O0 -c -ffunction-sections -fdata-sections -g -o $@ $<
201final_layout_sequence.txt:
202 (echo "*_Z3barv*" && echo ".text._Z3bazv" && echo "*_Z3foov*" && echo "*global_varb*" && echo "*global_vara*" && echo "*global_varc*") > final_layout_sequence.txt
203final_layout: final_layout.o final_layout_sequence.txt gcctestdir/ld
204 $(CXXLINK) -Bgcctestdir/ -Wl,--section-ordering-file,final_layout_sequence.txt final_layout.o
205final_layout.stdout: final_layout
206 $(TEST_NM) final_layout > final_layout.stdout
207
2253bfba 208check_PROGRAMS += icf_virtual_function_folding_test
ce97fa81
ST
209MOSTLYCLEANFILES += icf_virtual_function_folding_test
210icf_virtual_function_folding_test.o: icf_virtual_function_folding_test.cc
211 $(CXXCOMPILE) -O0 -c -ffunction-sections -fPIE -g -o $@ $<
212icf_virtual_function_folding_test: icf_virtual_function_folding_test.o gcctestdir/ld
213 $(CXXLINK) -Bgcctestdir/ -Wl,--icf=all icf_virtual_function_folding_test.o -pie
214
215check_SCRIPTS += icf_preemptible_functions_test.sh
216check_DATA += icf_preemptible_functions_test.stdout
217MOSTLYCLEANFILES += icf_preemptible_functions_test
218icf_preemptible_functions_test.o: icf_preemptible_functions_test.cc
219 $(CXXCOMPILE) -O0 -c -ffunction-sections -fPIC -g -o $@ $<
220icf_preemptible_functions_test: icf_preemptible_functions_test.o gcctestdir/ld
221 $(CXXLINK) -Bgcctestdir/ -Wl,--icf=all icf_preemptible_functions_test.o -fPIC -shared
222icf_preemptible_functions_test.stdout: icf_preemptible_functions_test
223 $(TEST_NM) icf_preemptible_functions_test > icf_preemptible_functions_test.stdout
224
225check_SCRIPTS += icf_string_merge_test.sh
226check_DATA += icf_string_merge_test.stdout
227MOSTLYCLEANFILES += icf_string_merge_test
228icf_string_merge_test.o: icf_string_merge_test.cc
229 $(CXXCOMPILE) -O0 -c -ffunction-sections -fPIC -g -o $@ $<
230icf_string_merge_test: icf_string_merge_test.o gcctestdir/ld
231 $(CXXLINK) -Bgcctestdir/ -Wl,--icf=all icf_string_merge_test.o
232icf_string_merge_test.stdout: icf_string_merge_test
233 $(TEST_NM) icf_string_merge_test > icf_string_merge_test.stdout
234
351a8000
ILT
235check_PROGRAMS += basic_test
236check_PROGRAMS += basic_static_test
237check_PROGRAMS += basic_pic_test
238check_PROGRAMS += basic_static_pic_test
56ba9a23 239basic_test.o: basic_test.cc
22dc1b09 240 $(CXXCOMPILE) -O0 -c -o $@ $<
56ba9a23
ILT
241basic_test: basic_test.o gcctestdir/ld
242 $(CXXLINK) -Bgcctestdir/ basic_test.o
243basic_static_test: basic_test.o gcctestdir/ld
244 $(CXXLINK) -Bgcctestdir/ -static basic_test.o
22dc1b09 245
56ba9a23 246basic_pic_test.o: basic_test.cc
22dc1b09 247 $(CXXCOMPILE) -O0 -c -fpic -o $@ $<
56ba9a23
ILT
248basic_pic_test: basic_pic_test.o gcctestdir/ld
249 $(CXXLINK) -Bgcctestdir/ basic_pic_test.o
250basic_static_pic_test: basic_pic_test.o gcctestdir/ld
251 $(CXXLINK) -Bgcctestdir/ -static basic_pic_test.o
22dc1b09 252
374ad285
ILT
253check_PROGRAMS += basic_pie_test
254basic_pie_test.o: basic_test.cc
255 $(CXXCOMPILE) -O0 -c -fpie -o $@ $<
256basic_pie_test: basic_pie_test.o gcctestdir/ld
257 $(CXXLINK) -Bgcctestdir/ -pie basic_pie_test.o
351a8000
ILT
258
259check_PROGRAMS += constructor_test
260check_PROGRAMS += constructor_static_test
d5026652
ILT
261constructor_test_SOURCES = constructor_test.cc
262constructor_test_DEPENDENCIES = gcctestdir/ld
263constructor_test_LDFLAGS = -Bgcctestdir/
1abce4a6 264constructor_test_LDADD =
d5026652 265
351a8000
ILT
266constructor_static_test_SOURCES = $(constructor_test_SOURCES)
267constructor_static_test_DEPENDENCIES = $(constructor_test_DEPENDENCIES)
268constructor_static_test_LDFLAGS = $(constructor_test_LDFLAGS) -static
1abce4a6 269constructor_static_test_LDADD = $(constructor_test_LDADD)
cb615bc1 270
351a8000
ILT
271
272check_PROGRAMS += two_file_test
273check_PROGRAMS += two_file_static_test
274check_PROGRAMS += two_file_pic_test
3bd52c28
ILT
275two_file_test_SOURCES = \
276 two_file_test_1.cc \
03e8f2b2 277 two_file_test_1b.cc \
3bd52c28
ILT
278 two_file_test_2.cc \
279 two_file_test_main.cc \
280 two_file_test.h
281two_file_test_DEPENDENCIES = gcctestdir/ld
282two_file_test_LDFLAGS = -Bgcctestdir/
1abce4a6 283two_file_test_LDADD =
3bd52c28 284
351a8000
ILT
285two_file_static_test_SOURCES = $(two_file_test_SOURCES)
286two_file_static_test_DEPENDENCIES = $(two_file_test_DEPENDENCIES)
287two_file_static_test_LDFLAGS = $(two_file_test_LDFLAGS) -static
1abce4a6 288two_file_static_test_LDADD = $(two_file_test_LDADD)
f958d5fc
ILT
289
290two_file_pic_test_SOURCES = two_file_test_main.cc
291two_file_pic_test_DEPENDENCIES = \
03e8f2b2 292 gcctestdir/ld two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o
f958d5fc 293two_file_pic_test_LDFLAGS = -Bgcctestdir/
03e8f2b2 294two_file_pic_test_LDADD = two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o
f958d5fc 295
351a8000
ILT
296
297check_PROGRAMS += two_file_shared_1_test
298check_PROGRAMS += two_file_shared_2_test
299check_PROGRAMS += two_file_shared_1_pic_2_test
300check_PROGRAMS += two_file_shared_2_pic_1_test
301check_PROGRAMS += two_file_same_shared_test
302check_PROGRAMS += two_file_separate_shared_12_test
303check_PROGRAMS += two_file_separate_shared_21_test
304two_file_test_1_pic.o: two_file_test_1.cc
305 $(CXXCOMPILE) -c -fpic -o $@ $<
03e8f2b2
ILT
306two_file_test_1b_pic.o: two_file_test_1b.cc
307 $(CXXCOMPILE) -c -fpic -o $@ $<
351a8000
ILT
308two_file_test_2_pic.o: two_file_test_2.cc
309 $(CXXCOMPILE) -c -fpic -o $@ $<
03e8f2b2
ILT
310two_file_shared_1.so: two_file_test_1_pic.o two_file_test_1b_pic.o gcctestdir/ld
311 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1_pic.o two_file_test_1b_pic.o
351a8000
ILT
312two_file_shared_2.so: two_file_test_2_pic.o gcctestdir/ld
313 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_2_pic.o
03e8f2b2
ILT
314two_file_shared.so: two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o gcctestdir/ld
315 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o
351a8000 316
3bd52c28
ILT
317two_file_shared_1_test_SOURCES = two_file_test_2.cc two_file_test_main.cc
318two_file_shared_1_test_DEPENDENCIES = gcctestdir/ld two_file_shared_1.so
319two_file_shared_1_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
320two_file_shared_1_test_LDADD = two_file_shared_1.so
321
03e8f2b2 322two_file_shared_2_test_SOURCES = two_file_test_1.cc two_file_test_1b.cc two_file_test_main.cc
3bd52c28
ILT
323two_file_shared_2_test_DEPENDENCIES = gcctestdir/ld two_file_shared_2.so
324two_file_shared_2_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
325two_file_shared_2_test_LDADD = two_file_shared_2.so
326
386c048c
ILT
327two_file_shared_1_pic_2_test_SOURCES = two_file_test_main.cc
328two_file_shared_1_pic_2_test_DEPENDENCIES = \
2f2de248 329 gcctestdir/ld two_file_shared_2.so two_file_test_1_pic.o two_file_test_1b_pic.o
386c048c 330two_file_shared_1_pic_2_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
03e8f2b2 331two_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
332
333two_file_shared_2_pic_1_test_SOURCES = two_file_test_main.cc
334two_file_shared_2_pic_1_test_DEPENDENCIES = \
335 gcctestdir/ld two_file_shared_2.so two_file_test_2_pic.o
336two_file_shared_2_pic_1_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
337two_file_shared_2_pic_1_test_LDADD = two_file_test_2_pic.o two_file_shared_1.so
338
3bd52c28
ILT
339two_file_same_shared_test_SOURCES = two_file_test_main.cc
340two_file_same_shared_test_DEPENDENCIES = gcctestdir/ld two_file_shared.so
341two_file_same_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
342two_file_same_shared_test_LDADD = two_file_shared.so
343
344two_file_separate_shared_12_test_SOURCES = two_file_test_main.cc
345two_file_separate_shared_12_test_DEPENDENCIES = \
346 gcctestdir/ld two_file_shared_1.so two_file_shared_2.so
347two_file_separate_shared_12_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
348two_file_separate_shared_12_test_LDADD = \
349 two_file_shared_1.so two_file_shared_2.so
350
351two_file_separate_shared_21_test_SOURCES = two_file_test_main.cc
352two_file_separate_shared_21_test_DEPENDENCIES = \
353 gcctestdir/ld two_file_shared_1.so two_file_shared_2.so
354two_file_separate_shared_21_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
355two_file_separate_shared_21_test_LDADD = \
356 two_file_shared_2.so two_file_shared_1.so
357
6a74a719
ILT
358check_PROGRAMS += two_file_relocatable_test
359two_file_relocatable_test_SOURCES = two_file_test_main.cc
360two_file_relocatable_test_DEPENDENCIES = \
361 gcctestdir/ld two_file_relocatable.o
362two_file_relocatable_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
363two_file_relocatable_test_LDADD = two_file_relocatable.o
364two_file_relocatable.o: gcctestdir/ld two_file_test_1.o two_file_test_1b.o two_file_test_2.o
365 gcctestdir/ld -r -o $@ two_file_test_1.o two_file_test_1b.o two_file_test_2.o
366
374ad285
ILT
367check_PROGRAMS += two_file_pie_test
368two_file_test_1_pie.o: two_file_test_1.cc
369 $(CXXCOMPILE) -c -fpie -o $@ $<
370two_file_test_1b_pie.o: two_file_test_1b.cc
371 $(CXXCOMPILE) -c -fpie -o $@ $<
372two_file_test_2_pie.o: two_file_test_2.cc
373 $(CXXCOMPILE) -c -fpie -o $@ $<
374two_file_test_main_pie.o: two_file_test_main.cc
375 $(CXXCOMPILE) -c -fpie -o $@ $<
376two_file_pie_test: two_file_test_1_pie.o two_file_test_1b_pie.o \
377 two_file_test_2_pie.o two_file_test_main_pie.o gcctestdir/ld
378 $(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
379
031cdbed
ILT
380check_SCRIPTS += two_file_shared.sh
381check_DATA += two_file_shared.dbg
72fef11a 382MOSTLYCLEANFILES += two_file_shared.dbg
031cdbed
ILT
383two_file_shared.dbg: two_file_shared.so
384 $(TEST_READELF) -w $< >$@ 2>/dev/null
385
63402fe4
ILT
386# The nonpic tests will fail on platforms which can not put non-PIC
387# code into shared libraries, so we just don't run them in that case.
63402fe4 388if FN_PTRS_IN_SO_WITHOUT_PIC
3bd52c28 389
351a8000
ILT
390check_PROGRAMS += two_file_shared_1_nonpic_test
391check_PROGRAMS += two_file_shared_2_nonpic_test
392check_PROGRAMS += two_file_same_shared_nonpic_test
393check_PROGRAMS += two_file_separate_shared_12_nonpic_test
394check_PROGRAMS += two_file_separate_shared_21_nonpic_test
03e8f2b2
ILT
395check_PROGRAMS += two_file_mixed_shared_test
396check_PROGRAMS += two_file_mixed_2_shared_test
351a8000 397two_file_shared_1_nonpic.so: two_file_test_1.o gcctestdir/ld
03e8f2b2 398 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1.o two_file_test_1b.o
351a8000
ILT
399two_file_shared_2_nonpic.so: two_file_test_2.o gcctestdir/ld
400 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_2.o
03e8f2b2
ILT
401two_file_shared_nonpic.so: two_file_test_1.o two_file_test_1b.o two_file_test_2.o gcctestdir/ld
402 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1.o two_file_test_1b.o two_file_test_2.o
403two_file_shared_mixed.so: two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2.o gcctestdir/ld
404 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2.o
405two_file_shared_mixed_1.so: two_file_test_1.o two_file_test_1b_pic.o two_file_shared_2.so gcctestdir/ld
406 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1.o two_file_test_1b_pic.o two_file_shared_2.so
351a8000 407
3bd52c28
ILT
408two_file_shared_1_nonpic_test_SOURCES = \
409 two_file_test_2.cc two_file_test_main.cc
410two_file_shared_1_nonpic_test_DEPENDENCIES = \
411 gcctestdir/ld two_file_shared_1_nonpic.so
412two_file_shared_1_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
413two_file_shared_1_nonpic_test_LDADD = two_file_shared_1_nonpic.so
414
415two_file_shared_2_nonpic_test_SOURCES = \
03e8f2b2 416 two_file_test_1.cc two_file_test_1b.cc two_file_test_main.cc
3bd52c28
ILT
417two_file_shared_2_nonpic_test_DEPENDENCIES = \
418 gcctestdir/ld two_file_shared_2_nonpic.so
419two_file_shared_2_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
420two_file_shared_2_nonpic_test_LDADD = two_file_shared_2_nonpic.so
421
422two_file_same_shared_nonpic_test_SOURCES = two_file_test_main.cc
423two_file_same_shared_nonpic_test_DEPENDENCIES = \
424 gcctestdir/ld two_file_shared_nonpic.so
425two_file_same_shared_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
426two_file_same_shared_nonpic_test_LDADD = two_file_shared_nonpic.so
427
428two_file_separate_shared_12_nonpic_test_SOURCES = two_file_test_main.cc
429two_file_separate_shared_12_nonpic_test_DEPENDENCIES = \
430 gcctestdir/ld two_file_shared_1_nonpic.so two_file_shared_2_nonpic.so
431two_file_separate_shared_12_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
432two_file_separate_shared_12_nonpic_test_LDADD = \
433 two_file_shared_1_nonpic.so two_file_shared_2_nonpic.so
434
435two_file_separate_shared_21_nonpic_test_SOURCES = two_file_test_main.cc
436two_file_separate_shared_21_nonpic_test_DEPENDENCIES = \
437 gcctestdir/ld two_file_shared_1_nonpic.so two_file_shared_2_nonpic.so
438two_file_separate_shared_21_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
439two_file_separate_shared_21_nonpic_test_LDADD = \
440 two_file_shared_2_nonpic.so two_file_shared_1_nonpic.so
441
03e8f2b2
ILT
442two_file_mixed_shared_test_SOURCES = two_file_test_main.cc
443two_file_mixed_shared_test_DEPENDENCIES = gcctestdir/ld two_file_shared_mixed.so
444two_file_mixed_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
445two_file_mixed_shared_test_LDADD = two_file_shared_mixed.so
446
447two_file_mixed_2_shared_test_SOURCES = two_file_test_main.cc
448two_file_mixed_2_shared_test_DEPENDENCIES = gcctestdir/ld two_file_shared_mixed_1.so two_file_shared_2.so
449two_file_mixed_2_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
450two_file_mixed_2_shared_test_LDADD = two_file_shared_mixed_1.so two_file_shared_2.so
451
351a8000 452endif FN_PTRS_IN_SO_WITHOUT_PIC
3bd52c28 453
6835af53
ILT
454check_PROGRAMS += two_file_strip_test
455two_file_strip_test: two_file_test
456 $(TEST_STRIP) -o two_file_strip_test two_file_test
457
458check_PROGRAMS += two_file_same_shared_strip_test
459two_file_same_shared_strip_test_SOURCES = two_file_test_main.cc
460two_file_same_shared_strip_test_DEPENDENCIES = \
461 gcctestdir/ld two_file_shared_strip.so
462two_file_same_shared_strip_test_LDFLAGS = -Bgcctestdir/ -Wl,-R.
463two_file_same_shared_strip_test_LDADD = two_file_shared_strip.so
464two_file_shared_strip.so: two_file_shared.so
465 $(TEST_STRIP) -S -o two_file_shared_strip.so two_file_shared.so
466
49bdd526
ILT
467check_PROGRAMS += common_test_1
468common_test_1_SOURCES = common_test_1.c
469common_test_1_DEPENDENCIES = gcctestdir/ld
470common_test_1_LDFLAGS = -Bgcctestdir/
1abce4a6 471common_test_1_LDADD =
351a8000 472
eda294df
ILT
473check_PROGRAMS += common_test_2
474common_test_2_SOURCES = common_test_1.c
475common_test_2_DEPENDENCIES = common_test_2.so common_test_3.so gcctestdir/ld
476common_test_2_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
477common_test_2_LDADD = common_test_2.so common_test_3.so
478common_test_2_pic.o: common_test_2.c
479 $(COMPILE) -c -fpic -o $@ $<
480common_test_2.so: common_test_2_pic.o common_test_3.so gcctestdir/ld
481 $(LINK) -Bgcctestdir/ -shared common_test_2_pic.o common_test_3.so
482common_test_3_pic.o: common_test_3.c
483 $(COMPILE) -c -fpic -o $@ $<
484common_test_3.so: common_test_3_pic.o ver_test_2.script gcctestdir/ld
485 $(LINK) -Bgcctestdir/ -shared common_test_3_pic.o -Wl,--version-script,$(srcdir)/ver_test_2.script
486
351a8000
ILT
487check_PROGRAMS += exception_test
488check_PROGRAMS += exception_static_test
489check_PROGRAMS += exception_shared_1_test
490check_PROGRAMS += exception_shared_2_test
491check_PROGRAMS += exception_same_shared_test
492check_PROGRAMS += exception_separate_shared_12_test
493check_PROGRAMS += exception_separate_shared_21_test
494exception_test_1_pic.o: exception_test_1.cc
495 $(CXXCOMPILE) -c -fpic -o $@ $<
496exception_test_2_pic.o: exception_test_2.cc
497 $(CXXCOMPILE) -c -fpic -o $@ $<
498exception_shared_1.so: exception_test_1_pic.o gcctestdir/ld
499 $(CXXLINK) -Bgcctestdir/ -shared exception_test_1_pic.o
500exception_shared_2.so: exception_test_2_pic.o gcctestdir/ld
501 $(CXXLINK) -Bgcctestdir/ -shared exception_test_2_pic.o
502exception_shared.so: exception_test_1_pic.o exception_test_2_pic.o gcctestdir/ld
503 $(CXXLINK) -Bgcctestdir/ -shared exception_test_1_pic.o exception_test_2_pic.o
63402fe4 504
3151305a
ILT
505exception_test_SOURCES = \
506 exception_test_main.cc \
507 exception_test_1.cc \
508 exception_test_2.cc \
509 exception_test.h
510exception_test_DEPENDENCIES = gcctestdir/ld
511exception_test_LDFLAGS = -Bgcctestdir/
1abce4a6 512exception_test_LDADD =
3151305a 513
351a8000
ILT
514exception_static_test_SOURCES = $(exception_test_SOURCES)
515exception_static_test_DEPENDENCIES = $(exception_test_DEPENDENCIES)
516exception_static_test_LDFLAGS = $(exception_test_LDFLAGS) -static
1abce4a6 517exception_static_test_LDADD = $(exception_test_LDADD)
3151305a
ILT
518
519exception_shared_1_test_SOURCES = exception_test_2.cc exception_test_main.cc
520exception_shared_1_test_DEPENDENCIES = gcctestdir/ld exception_shared_1.so
521exception_shared_1_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
522exception_shared_1_test_LDADD = exception_shared_1.so
523
524exception_shared_2_test_SOURCES = exception_test_1.cc exception_test_main.cc
525exception_shared_2_test_DEPENDENCIES = gcctestdir/ld exception_shared_2.so
526exception_shared_2_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
527exception_shared_2_test_LDADD = exception_shared_2.so
528
529exception_same_shared_test_SOURCES = exception_test_main.cc
530exception_same_shared_test_DEPENDENCIES = gcctestdir/ld exception_shared.so
531exception_same_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
532exception_same_shared_test_LDADD = exception_shared.so
533
534exception_separate_shared_12_test_SOURCES = exception_test_main.cc
535exception_separate_shared_12_test_DEPENDENCIES = \
536 gcctestdir/ld exception_shared_1.so exception_shared_2.so
537exception_separate_shared_12_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
538exception_separate_shared_12_test_LDADD = \
539 exception_shared_1.so exception_shared_2.so
540
541exception_separate_shared_21_test_SOURCES = exception_test_main.cc
542exception_separate_shared_21_test_DEPENDENCIES = \
543 gcctestdir/ld exception_shared_1.so exception_shared_2.so
544exception_separate_shared_21_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
545exception_separate_shared_21_test_LDADD = \
546 exception_shared_2.so exception_shared_1.so
547
3151305a 548
351a8000 549check_PROGRAMS += weak_test
a360aedd 550weak_test_SOURCES = weak_test.cc
0e470e5c 551weak_test_DEPENDENCIES = gcctestdir/ld
a360aedd 552weak_test_LDFLAGS = -Bgcctestdir/
1abce4a6 553weak_test_LDADD =
a360aedd 554
86925eef 555check_PROGRAMS += weak_undef_test
72fef11a 556MOSTLYCLEANFILES += alt/weak_undef_lib.so
86925eef
CC
557weak_undef_test_SOURCES = weak_undef_test.cc
558weak_undef_test_DEPENDENCIES = gcctestdir/ld weak_undef_lib.so alt/weak_undef_lib.so
559weak_undef_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,alt
560weak_undef_test_LDADD = -L . weak_undef_lib.so
561weak_undef_file1.o: weak_undef_file1.cc
562 $(CXXCOMPILE) -c -fpic -o $@ $<
563weak_undef_file2.o: weak_undef_file2.cc
564 $(CXXCOMPILE) -c -fpic -o $@ $<
565weak_undef_lib.so: weak_undef_file1.o
566 $(CXXLINK) -Bgcctestdir/ -shared weak_undef_file1.o
567alt/weak_undef_lib.so: weak_undef_file2.o
568 test -d alt || mkdir -p alt
569 $(CXXLINK) -Bgcctestdir/ -shared weak_undef_file2.o
351a8000 570
f3c69fca
CC
571if FN_PTRS_IN_SO_WITHOUT_PIC
572check_PROGRAMS += weak_undef_nonpic_test
72fef11a 573MOSTLYCLEANFILES += alt/weak_undef_lib_nonpic.so
f3c69fca
CC
574weak_undef_nonpic_test_SOURCES = weak_undef_test.cc
575weak_undef_nonpic_test_DEPENDENCIES = gcctestdir/ld weak_undef_lib_nonpic.so alt/weak_undef_lib_nonpic.so
576weak_undef_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,alt
577weak_undef_nonpic_test_LDADD = -L . weak_undef_lib_nonpic.so
578weak_undef_file1_nonpic.o: weak_undef_file1.cc
579 $(CXXCOMPILE) -c -o $@ $<
580weak_undef_file2_nonpic.o: weak_undef_file2.cc
581 $(CXXCOMPILE) -c -o $@ $<
582weak_undef_lib_nonpic.so: weak_undef_file1_nonpic.o
583 $(CXXLINK) -Bgcctestdir/ -shared weak_undef_file1_nonpic.o
584alt/weak_undef_lib_nonpic.so: weak_undef_file2_nonpic.o
585 test -d alt || mkdir -p alt
586 $(CXXLINK) -Bgcctestdir/ -shared weak_undef_file2_nonpic.o
587endif FN_PTRS_IN_SO_WITHOUT_PIC
588
589
99a37bfd
ILT
590check_PROGRAMS += weak_alias_test
591weak_alias_test_SOURCES = weak_alias_test_main.cc
592weak_alias_test_DEPENDENCIES = \
593 gcctestdir/ld weak_alias_test_1.so weak_alias_test_2.so \
594 weak_alias_test_3.o weak_alias_test_4.so
595weak_alias_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
596weak_alias_test_LDADD = \
597 weak_alias_test_1.so weak_alias_test_2.so weak_alias_test_3.o \
598 weak_alias_test_4.so
599weak_alias_test_1_pic.o: weak_alias_test_1.cc
600 $(CXXCOMPILE) -c -fpic -o $@ $<
de4c45bd 601weak_alias_test_1.so: weak_alias_test_1_pic.o gcctestdir/ld
99a37bfd
ILT
602 $(CXXLINK) -Bgcctestdir/ -shared weak_alias_test_1_pic.o
603weak_alias_test_2_pic.o: weak_alias_test_2.cc
604 $(CXXCOMPILE) -c -fpic -o $@ $<
de4c45bd 605weak_alias_test_2.so: weak_alias_test_2_pic.o gcctestdir/ld
99a37bfd
ILT
606 $(CXXLINK) -Bgcctestdir/ -shared weak_alias_test_2_pic.o
607weak_alias_test_3.o: weak_alias_test_3.cc
608 $(CXXCOMPILE) -c -o $@ $<
609weak_alias_test_4_pic.o: weak_alias_test_4.cc
610 $(CXXCOMPILE) -c -fpic -o $@ $<
de4c45bd 611weak_alias_test_4.so: weak_alias_test_4_pic.o gcctestdir/ld
99a37bfd
ILT
612 $(CXXLINK) -Bgcctestdir/ -shared weak_alias_test_4_pic.o
613
de4c45bd
ILT
614check_SCRIPTS += weak_plt.sh
615check_PROGRAMS += weak_plt
616check_DATA += weak_plt_shared.so
617weak_plt_main_pic.o: weak_plt_main.cc
618 $(CXXCOMPILE) -c -fpic -o $@ $<
619weak_plt: weak_plt_main_pic.o gcctestdir/ld
620 $(CXXLINK) -Bgcctestdir/ weak_plt_main_pic.o
621weak_plt_shared_pic.o: weak_plt_shared.cc
622 $(CXXCOMPILE) -c -fpic -o $@ $<
623weak_plt_shared.so: weak_plt_shared_pic.o gcctestdir/ld
624 $(CXXLINK) -Bgcctestdir/ -shared weak_plt_shared_pic.o
625
f34787f8
ILT
626check_PROGRAMS += copy_test
627copy_test_SOURCES = copy_test.cc
628copy_test_DEPENDENCIES = gcctestdir/ld copy_test_1.so copy_test_2.so
629copy_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
630copy_test_LDADD = copy_test_1.so copy_test_2.so
631copy_test_1_pic.o: copy_test_1.cc
632 $(CXXCOMPILE) -c -fpic -o $@ $<
633copy_test_1.so: gcctestdir/ld copy_test_1_pic.o
634 $(CXXLINK) -Bgcctestdir/ -shared copy_test_1_pic.o
635copy_test_2_pic.o: copy_test_2.cc
636 $(CXXCOMPILE) -c -fpic -o $@ $<
637copy_test_2.so: gcctestdir/ld copy_test_2_pic.o
638 $(CXXLINK) -Bgcctestdir/ -shared copy_test_2_pic.o
639
6eee141f
ILT
640if TLS
641
351a8000
ILT
642check_PROGRAMS += tls_test
643check_PROGRAMS += tls_pic_test
c7177d31 644check_PROGRAMS += tls_pie_test
b3705d2a 645check_PROGRAMS += tls_pie_pic_test
351a8000 646check_PROGRAMS += tls_shared_test
c03c7692 647check_PROGRAMS += tls_shared_ie_test
c2b45e22 648check_PROGRAMS += tls_shared_gd_to_ie_test
351a8000
ILT
649tls_test_pic.o: tls_test.cc
650 $(CXXCOMPILE) -c -fpic -o $@ $<
651tls_test_file2_pic.o: tls_test_file2.cc
652 $(CXXCOMPILE) -c -fpic -o $@ $<
155a0dd7
ILT
653tls_test_c_pic.o: tls_test_c.c
654 $(COMPILE) -c -fpic $(TLS_TEST_C_CFLAGS) -o $@ $<
655tls_test_shared.so: tls_test_pic.o tls_test_file2_pic.o tls_test_c_pic.o gcctestdir/ld
9c2d0ef9 656 $(CXXLINK) -Bgcctestdir/ -shared tls_test_pic.o tls_test_file2_pic.o tls_test_c_pic.o -Wl,-z,defs
c2b45e22
CC
657tls_test_shared2.so: tls_test_file2_pic.o gcctestdir/ld
658 $(CXXLINK) -Bgcctestdir/ -shared tls_test_file2_pic.o
351a8000 659
c03c7692
ILT
660tls_test_pic_ie.o: tls_test.cc
661 $(CXXCOMPILE) -c -fpic -ftls-model=initial-exec -o $@ $<
662tls_test_file2_pic_ie.o: tls_test_file2.cc
663 $(CXXCOMPILE) -c -fpic -ftls-model=initial-exec -o $@ $<
155a0dd7
ILT
664tls_test_c_pic_ie.o: tls_test_c.c
665 $(COMPILE) -c -fpic -ftls-model=initial-exec $(TLS_TEST_C_CFLAGS) -o $@ $<
666tls_test_ie_shared.so: tls_test_pic_ie.o tls_test_file2_pic_ie.o tls_test_c_pic_ie.o gcctestdir/ld
667 $(CXXLINK) -Bgcctestdir/ -shared tls_test_pic_ie.o tls_test_file2_pic_ie.o tls_test_c_pic_ie.o
c03c7692 668
e0374858 669tls_test_SOURCES = tls_test.cc tls_test_file2.cc tls_test_main.cc tls_test.h
155a0dd7 670tls_test_DEPENDENCIES = gcctestdir/ld tls_test_c.o
6eee141f 671tls_test_LDFLAGS = -Bgcctestdir/
155a0dd7
ILT
672tls_test_LDADD = tls_test_c.o -lpthread
673tls_test_c.o: tls_test_c.c
674 $(COMPILE) -c $(TLS_TEST_C_CFLAGS) -o $@ $<
6eee141f
ILT
675
676tls_pic_test_SOURCES = tls_test_main.cc
155a0dd7
ILT
677tls_pic_test_DEPENDENCIES = gcctestdir/ld tls_test_pic.o tls_test_file2_pic.o \
678 tls_test_c_pic.o
6eee141f 679tls_pic_test_LDFLAGS = -Bgcctestdir/
155a0dd7
ILT
680tls_pic_test_LDADD = tls_test_pic.o tls_test_file2_pic.o tls_test_c_pic.o \
681 -lpthread
6eee141f 682
c7177d31
ILT
683tls_test_main_pie.o: tls_test_main.cc tls_test.h
684 $(CXXCOMPILE) -c -fpie -o $@ $<
685tls_test_pie.o: tls_test.cc tls_test.h
686 $(CXXCOMPILE) -c -fpie -o $@ $<
687tls_test_file2_pie.o: tls_test_file2.cc tls_test.h
688 $(CXXCOMPILE) -c -fpie -o $@ $<
689tls_test_c_pie.o: tls_test_c.c
690 $(COMPILE) -c -fpic $(TLS_TEST_C_CFLAGS) -o $@ $<
691tls_pie_test: tls_test_main_pie.o tls_test_pie.o tls_test_file2_pie.o \
692 tls_test_c_pie.o gcctestdir/ld
693 $(CXXLINK) -Bgcctestdir/ -pie tls_test_main_pie.o tls_test_pie.o tls_test_file2_pie.o tls_test_c_pie.o -lpthread
694
b3705d2a
ILT
695tls_pie_pic_test: tls_test_main_pie.o tls_test_pic.o tls_test_file2_pic.o \
696 tls_test_c_pic.o gcctestdir/ld
697 $(CXXLINK) -Bgcctestdir/ -pie tls_test_main_pie.o tls_test_pic.o tls_test_file2_pic.o tls_test_c_pic.o -lpthread
698
6eee141f
ILT
699tls_shared_test_SOURCES = tls_test_main.cc
700tls_shared_test_DEPENDENCIES = gcctestdir/ld tls_test_shared.so
701tls_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
702tls_shared_test_LDADD = tls_test_shared.so -lpthread
703
c03c7692
ILT
704tls_shared_ie_test_SOURCES = tls_test_main.cc
705tls_shared_ie_test_DEPENDENCIES = gcctestdir/ld tls_test_ie_shared.so
706tls_shared_ie_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
707tls_shared_ie_test_LDADD = tls_test_ie_shared.so -lpthread
708
c2b45e22 709tls_shared_gd_to_ie_test_SOURCES = tls_test_main.cc
155a0dd7
ILT
710tls_shared_gd_to_ie_test_DEPENDENCIES = gcctestdir/ld tls_test_pic.o \
711 tls_test_c_pic.o tls_test_shared2.so
c2b45e22 712tls_shared_gd_to_ie_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
155a0dd7
ILT
713tls_shared_gd_to_ie_test_LDADD = tls_test_pic.o tls_test_c_pic.o \
714 tls_test_shared2.so -lpthread
c2b45e22
CC
715
716if TLS_GNU2_DIALECT
717
718check_PROGRAMS += tls_shared_gnu2_gd_to_ie_test
719
720tls_test_gnu2.o: tls_test.cc
721 $(CXXCOMPILE) -c -fpic -mtls-dialect=gnu2 -o $@ $<
722tls_test_file2_gnu2.o: tls_test_file2.cc
723 $(CXXCOMPILE) -c -fpic -mtls-dialect=gnu2 -o $@ $<
155a0dd7
ILT
724tls_test_c_gnu2.o: tls_test_c.c
725 $(COMPILE) -c -fpic -mtls-dialect=gnu2 $(TLS_TEST_C_CFLAGS) -o $@ $<
c2b45e22
CC
726tls_test_gnu2_shared2.so: tls_test_file2_gnu2.o gcctestdir/ld
727 $(CXXLINK) -Bgcctestdir/ -shared tls_test_file2_gnu2.o
728
729tls_shared_gnu2_gd_to_ie_test_SOURCES = tls_test_main.cc
155a0dd7
ILT
730tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES = gcctestdir/ld tls_test_gnu2.o \
731 tls_test_c_gnu2.o tls_test_gnu2_shared2.so
c2b45e22 732tls_shared_gnu2_gd_to_ie_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
155a0dd7
ILT
733tls_shared_gnu2_gd_to_ie_test_LDADD = tls_test_gnu2.o tls_test_c_gnu2.o \
734 tls_test_gnu2_shared2.so -lpthread
c2b45e22
CC
735
736if TLS_DESCRIPTORS
737
738check_PROGRAMS += tls_shared_gnu2_test
739
155a0dd7
ILT
740tls_test_gnu2_shared.so: tls_test_gnu2.o tls_test_file2_gnu2.o tls_test_c_gnu2.o gcctestdir/ld
741 $(CXXLINK) -Bgcctestdir/ -shared tls_test_gnu2.o tls_test_file2_gnu2.o tls_test_c_gnu2.o
c2b45e22
CC
742
743tls_shared_gnu2_test_SOURCES = tls_test_main.cc
744tls_shared_gnu2_test_DEPENDENCIES = gcctestdir/ld tls_test_gnu2_shared.so
745tls_shared_gnu2_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
746tls_shared_gnu2_test_LDADD = tls_test_gnu2_shared.so -lpthread
747
748endif TLS_DESCRIPTORS
749
750endif TLS_GNU2_DIALECT
751
351a8000
ILT
752if STATIC_TLS
753check_PROGRAMS += tls_static_test
754check_PROGRAMS += tls_static_pic_test
755
756tls_static_test_SOURCES = $(tls_test_SOURCES)
757tls_static_test_DEPENDENCIES = $(tls_test_DEPENDENCIES)
758tls_static_test_LDFLAGS = $(tls_test_LDFLAGS) -static
759tls_static_test_LDADD = $(tls_test_LDADD)
760
761tls_static_pic_test_SOURCES = $(tls_pic_test_SOURCES)
762tls_static_pic_test_DEPENDENCIES = $(tls_pic_test_DEPENDENCIES)
763tls_static_pic_test_LDFLAGS = $(tls_pic_test_LDFLAGS) -static
764tls_static_pic_test_LDADD = $(tls_pic_test_LDADD)
765endif
6eee141f
ILT
766
767if FN_PTRS_IN_SO_WITHOUT_PIC
351a8000 768check_PROGRAMS += tls_shared_nonpic_test
155a0dd7
ILT
769tls_test_shared_nonpic.so: tls_test.o tls_test_file2.o tls_test_c.o gcctestdir/ld
770 $(CXXLINK) -Bgcctestdir/ -shared tls_test.o tls_test_file2.o tls_test_c.o
6eee141f
ILT
771
772tls_shared_nonpic_test_SOURCES = tls_test_main.cc
773tls_shared_nonpic_test_DEPENDENCIES = gcctestdir/ld tls_test_shared_nonpic.so
774tls_shared_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
775tls_shared_nonpic_test_LDADD = tls_test_shared_nonpic.so -lpthread
351a8000 776endif FN_PTRS_IN_SO_WITHOUT_PIC
6eee141f 777
351a8000 778endif TLS
6eee141f 779
d491d34e
ILT
780check_PROGRAMS += many_sections_test
781many_sections_test_SOURCES = many_sections_test.cc
782many_sections_test_DEPENDENCIES = gcctestdir/ld
783many_sections_test_LDFLAGS = -Bgcctestdir/ -rdynamic
1abce4a6 784many_sections_test_LDADD =
d491d34e
ILT
785
786BUILT_SOURCES += many_sections_define.h
72fef11a 787MOSTLYCLEANFILES += many_sections_define.h
d491d34e
ILT
788many_sections_define.h:
789 (for i in `seq 1 70000`; do \
790 echo "int var_$$i __attribute__((section(\"section_$$i\"))) = $$i;"; \
791 done) > $@.tmp
792 mv -f $@.tmp $@
793
794BUILT_SOURCES += many_sections_check.h
72fef11a 795MOSTLYCLEANFILES += many_sections_check.h
d491d34e 796many_sections_check.h:
4c94d6ae 797 (for i in `seq 1 1000 70000`; do \
d491d34e
ILT
798 echo "assert(var_$$i == $$i);"; \
799 done) > $@.tmp
800 mv -f $@.tmp $@
801
802check_PROGRAMS += many_sections_r_test
d491d34e
ILT
803many_sections_r_test.o: many_sections_test.o gcctestdir/ld
804 gcctestdir/ld -r -o $@ many_sections_test.o
7bc3e21a
ILT
805many_sections_r_test: many_sections_r_test.o gcctestdir/ld
806 $(CXXLINK) -Bgcctestdir/ many_sections_r_test.o $(LIBS)
6eee141f 807
2fd32231
ILT
808if CONSTRUCTOR_PRIORITY
809
810check_PROGRAMS += initpri1
811initpri1_SOURCES = initpri1.c
812initpri1_DEPENDENCIES = gcctestdir/ld
813initpri1_LDFLAGS = -Bgcctestdir/
1abce4a6 814initpri1_LDADD =
2fd32231
ILT
815
816endif
817
818
351a8000
ILT
819# Test --detect-odr-violations
820check_SCRIPTS += debug_msg.sh
6eee141f 821
351a8000
ILT
822# Create the data files that debug_msg.sh analyzes.
823check_DATA += debug_msg.err
824MOSTLYCLEANFILES += debug_msg.err
825debug_msg.o: debug_msg.cc
826 $(CXXCOMPILE) -O0 -g -c -w -o $@ $(srcdir)/debug_msg.cc
827odr_violation1.o: odr_violation1.cc
828 $(CXXCOMPILE) -O0 -g -c -w -o $@ $(srcdir)/odr_violation1.cc
829odr_violation2.o: odr_violation2.cc
830 $(CXXCOMPILE) -O0 -g -c -w -o $@ $(srcdir)/odr_violation2.cc
831debug_msg.err: debug_msg.o odr_violation1.o odr_violation2.o gcctestdir/ld
832 @echo $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg debug_msg.o odr_violation1.o odr_violation2.o "2>$@"
833 @if $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg debug_msg.o odr_violation1.o odr_violation2.o 2>$@; \
834 then \
835 echo 1>&2 "Link of debug_msg should have failed"; \
836 rm -f $@; \
837 exit 1; \
838 fi
839
840# See if we can also detect problems when we're linking .so's, not .o's.
841check_DATA += debug_msg_so.err
842MOSTLYCLEANFILES += debug_msg_so.err
843debug_msg.so: debug_msg.cc gcctestdir/ld
844 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -shared -fPIC -w -o $@ $(srcdir)/debug_msg.cc
845odr_violation1.so: odr_violation1.cc gcctestdir/ld
846 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -shared -fPIC -w -o $@ $(srcdir)/odr_violation1.cc
847odr_violation2.so: odr_violation2.cc gcctestdir/ld
848 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -shared -fPIC -w -o $@ $(srcdir)/odr_violation2.cc
849debug_msg_so.err: debug_msg.so odr_violation1.so odr_violation2.so gcctestdir/ld
850 @echo $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_so debug_msg.so odr_violation1.so odr_violation2.so "2>$@"
851 @if $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_so debug_msg.so odr_violation1.so odr_violation2.so 2>$@; \
852 then \
853 echo 1>&2 "Link of debug_msg_so should have failed"; \
854 rm -f $@; \
855 exit 1; \
856 fi
857
858# We also want to make sure we do something reasonable when there's no
859# debug info available. For the best test, we use .so's.
860check_DATA += debug_msg_ndebug.err
861MOSTLYCLEANFILES += debug_msg_ndebug.err
862debug_msg_ndebug.so: debug_msg.cc gcctestdir/ld
863 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g0 -shared -fPIC -w -o $@ $(srcdir)/debug_msg.cc
864odr_violation1_ndebug.so: odr_violation1.cc gcctestdir/ld
865 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g0 -shared -fPIC -w -o $@ $(srcdir)/odr_violation1.cc
866odr_violation2_ndebug.so: odr_violation2.cc gcctestdir/ld
867 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g0 -shared -fPIC -w -o $@ $(srcdir)/odr_violation2.cc
868debug_msg_ndebug.err: debug_msg_ndebug.so odr_violation1_ndebug.so odr_violation2_ndebug.so gcctestdir/ld
869 @echo $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_ndebug debug_msg_ndebug.so odr_violation1_ndebug.so odr_violation2_ndebug.so "2>$@"
870 @if $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_ndebug debug_msg_ndebug.so odr_violation1_ndebug.so odr_violation2_ndebug.so 2>$@; \
871 then \
872 echo 1>&2 "Link of debug_msg_ndebug should have failed"; \
873 rm -f $@; \
874 exit 1; \
875 fi
876
877
878# Similar to --detect-odr-violations: check for undefined symbols in .so's
879check_SCRIPTS += undef_symbol.sh
880check_DATA += undef_symbol.err
881MOSTLYCLEANFILES += undef_symbol.err
882undef_symbol.o: undef_symbol.cc
883 $(CXXCOMPILE) -O0 -g -c -fPIC $<
884undef_symbol.so: undef_symbol.o gcctestdir/ld
885 $(CXXLINK) -Bgcctestdir/ -shared undef_symbol.o
886undef_symbol.err: undef_symbol_main.o undef_symbol.so gcctestdir/ld
887 @echo $(CXXLINK) -Bgcctestdir/ -o undef_symbol_test undef_symbol_main.o undef_symbol.so "2>$@"
888 @if $(CXXLINK) -Bgcctestdir/ -o undef_symbol_test undef_symbol_main.o undef_symbol.so 2>$@; \
889 then \
890 echo 1>&2 "Link of undef_symbol_test should have failed"; \
891 rm -f $@; \
892 exit 1; \
893 fi
894
895
351a8000
ILT
896# Test -o when emitting to a special file (such as something in /dev).
897check_PROGRAMS += flagstest_o_specialfile
0e470e5c 898flagstest_o_specialfile: flagstest_debug.o gcctestdir/ld
351a8000
ILT
899 $(CXXLINK) -Bgcctestdir/ -o /dev/stdout $< 2>&1 | cat > $@
900 chmod a+x $@
901 test -s $@
902
7fcd0256
ILT
903if HAVE_ZLIB
904
905# Test --compress-debug-sections. FIXME: check we actually compress.
906check_PROGRAMS += flagstest_compress_debug_sections
907flagstest_compress_debug_sections: flagstest_debug.o gcctestdir/ld
908 $(CXXLINK) -Bgcctestdir/ -o $@ $< -Wl,--compress-debug-sections=zlib
909 test -s $@
910
911
351a8000
ILT
912# The specialfile output has a tricky case when we also compress debug
913# sections, because it requires output-file resizing.
914check_PROGRAMS += flagstest_o_specialfile_and_compress_debug_sections
0e470e5c
ILT
915flagstest_o_specialfile_and_compress_debug_sections: flagstest_debug.o \
916 gcctestdir/ld
126f3ece 917 $(CXXLINK) -Bgcctestdir/ -o /dev/stdout $< -Wl,--compress-debug-sections=zlib 2>&1 | cat > $@
351a8000
ILT
918 chmod a+x $@
919 test -s $@
920
7fcd0256
ILT
921endif HAVE_ZLIB
922
99f8faca
ILT
923# Test symbol versioning.
924check_PROGRAMS += ver_test
925ver_test_SOURCES = ver_test_main.cc
926ver_test_DEPENDENCIES = gcctestdir/ld ver_test_1.so ver_test_2.so ver_test_4.so
927ver_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
928ver_test_LDADD = ver_test_1.so ver_test_2.so ver_test_4.so
929ver_test_1.so: ver_test_1.o ver_test_2.so ver_test_3.o ver_test_4.so gcctestdir/ld
930 $(CXXLINK) -Bgcctestdir/ -shared ver_test_1.o ver_test_2.so ver_test_3.o ver_test_4.so
09124467
ILT
931ver_test_2.so: ver_test_2.o $(srcdir)/ver_test_2.script ver_test_4.so gcctestdir/ld
932 $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_2.script ver_test_2.o ver_test_4.so
933ver_test_4.so: ver_test_4.o $(srcdir)/ver_test_4.script gcctestdir/ld
934 $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_4.script ver_test_4.o
99f8faca
ILT
935ver_test_1.o: ver_test_1.cc
936 $(CXXCOMPILE) -c -fpic -o $@ $<
937ver_test_2.o: ver_test_2.cc
938 $(CXXCOMPILE) -c -fpic -o $@ $<
939ver_test_3.o: ver_test_3.cc
940 $(CXXCOMPILE) -c -fpic -o $@ $<
941ver_test_4.o: ver_test_4.cc
942 $(CXXCOMPILE) -c -fpic -o $@ $<
351a8000 943
0602e05a
ILT
944check_SCRIPTS += ver_test_1.sh
945check_DATA += ver_test_1.syms
946ver_test_1.syms: ver_test_1.so
947 $(TEST_READELF) -s $< >$@ 2>/dev/null
948
be3e6201
ILT
949check_PROGRAMS += ver_test_2
950ver_test_2_SOURCES = ver_test_main_2.cc
951ver_test_2_DEPENDENCIES = gcctestdir/ld ver_test_4.so ver_test_2.so
952ver_test_2_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
953ver_test_2_LDADD = ver_test_4.so ver_test_2.so
954
be3e6201
ILT
955check_SCRIPTS += ver_test_2.sh
956check_DATA += ver_test_2.syms
957ver_test_2.syms: ver_test_2
6835af53 958 $(TEST_READELF) -s $< >$@ 2>/dev/null
be3e6201 959
686c8caf
ILT
960check_SCRIPTS += ver_test_4.sh
961check_DATA += ver_test_4.syms
962ver_test_4.syms: ver_test_4.so
6835af53 963 $(TEST_READELF) -s $< >$@ 2>/dev/null
5871526f
ILT
964
965ver_test_5.so: ver_test_5.o $(srcdir)/ver_test_5.script ver_test_4.so gcctestdir/ld
966 $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_5.script ver_test_5.o ver_test_4.so
967ver_test_5.o: ver_test_5.cc
968 $(CXXCOMPILE) -c -fpic -o $@ $<
969check_SCRIPTS += ver_test_5.sh
970check_DATA += ver_test_5.syms
971ver_test_5.syms: ver_test_5.so
6835af53 972 $(TEST_READELF) -s $< >$@ 2>/dev/null
5871526f 973
18e6b24e
ILT
974check_PROGRAMS += ver_test_6
975ver_test_6_SOURCES = ver_test_6.c
976ver_test_6_DEPENDENCIES = gcctestdir/ld ver_test_2.so
977ver_test_6_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
978ver_test_6_LDADD = ver_test_2.so
979
479f6503
ILT
980ver_test_7.so: ver_test_4.o $(srcdir)/ver_test_4.script ver_test_7.o gcctestdir/ld
981 $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_4.script ver_test_4.o ver_test_7.o
982ver_test_7.o: ver_test_7.cc
983 $(CXXCOMPILE) -c -fpic -o $@ $<
984check_SCRIPTS += ver_test_7.sh
985check_DATA += ver_test_7.syms
986ver_test_7.syms: ver_test_7.so
6835af53 987 $(TEST_READELF) -s $< >$@ 2>/dev/null
479f6503 988
75517b77
ILT
989check_PROGRAMS += ver_test_8
990ver_test_8_SOURCES = two_file_test_main.cc
991ver_test_8_DEPENDENCIES = gcctestdir/ld ver_test_8_1.so ver_test_8_2.so
992ver_test_8_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
993ver_test_8_LDADD = ver_test_8_1.so ver_test_8_2.so
994ver_test_8_1.so: two_file_test_1_pic.o two_file_test_1b_pic.o ver_test_8_2.so gcctestdir/ld
995 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1_pic.o two_file_test_1b_pic.o ver_test_8_2.so
996ver_test_8_2.so: two_file_test_2_pic.o $(srcdir)/ver_test_8.script gcctestdir/ld
997 $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_8.script two_file_test_2_pic.o
998
95d14cd3
ILT
999check_PROGRAMS += ver_test_9
1000ver_test_9_SOURCES = ver_test_main.cc
1001ver_test_9_DEPENDENCIES = gcctestdir/ld ver_test_9.so
1002ver_test_9_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1003ver_test_9_LDADD = ver_test_9.so
1004ver_test_9.so: ver_test_9.o ver_test_4.so ver_test_5.so gcctestdir/ld
1005 $(CXXLINK) -Bgcctestdir/ -shared ver_test_9.o ver_test_5.so ver_test_4.so
1006ver_test_9.o: ver_test_9.cc
1007 $(CXXCOMPILE) -c -fpic -o $@ $<
1008
057ead22
ILT
1009check_SCRIPTS += ver_test_10.sh
1010check_DATA += ver_test_10.syms
1011ver_test_10.syms: ver_test_10.so
1012 $(TEST_READELF) -s $< >$@ 2>/dev/null
1013ver_test_10.so: gcctestdir/ld ver_test_2.o ver_test_10.script
1014 $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_10.script ver_test_2.o
1015
9c5b8369 1016check_PROGRAMS += ver_test_11
72fef11a 1017MOSTLYCLEANFILES += ver_test_11.a
9c5b8369
ILT
1018ver_test_11_SOURCES = ver_test_main_2.cc
1019ver_test_11_DEPENDENCIES = gcctestdir/ld ver_test_11.a
1020ver_test_11_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1021ver_test_11_LDADD = ver_test_11.a
1022ver_test_11.a: ver_test_1.o ver_test_2.o ver_test_4.o
1023 $(TEST_AR) rc $@ $^
1024
8bdcdf2c
ILT
1025check_PROGRAMS += protected_1
1026protected_1_SOURCES = \
1027 protected_main_1.cc protected_main_2.cc protected_main_3.cc
1028protected_1_DEPENDENCIES = gcctestdir/ld protected_1.so
1029protected_1_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1030protected_1_LDADD = protected_1.so
1031
1032protected_1.so: gcctestdir/ld protected_1_pic.o protected_2_pic.o protected_3_pic.o
1033 $(CXXLINK) -Bgcctestdir/ -shared protected_1_pic.o protected_2_pic.o protected_3_pic.o
1034protected_1_pic.o: protected_1.cc
1035 $(CXXCOMPILE) -c -fpic -o $@ $<
1036protected_2_pic.o: protected_2.cc
1037 $(CXXCOMPILE) -c -fpic -o $@ $<
1038protected_3_pic.o: protected_3.cc
1039 $(CXXCOMPILE) -c -fpic -o $@ $<
1040
1041check_PROGRAMS += protected_2
1042protected_2_SOURCES = protected_main_1.cc protected_3.cc
1043protected_2_DEPENDENCIES = gcctestdir/ld protected_1.so
1044protected_2_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1045protected_2_LDADD = protected_1.so
1046
837504c4
ILT
1047check_DATA += protected_3.err
1048MOSTLYCLEANFILES += protected_3.err
1049protected_4_pic.o: protected_4.cc
1050 $(CXXCOMPILE) -c -fpic -o $@ $<
1051protected_3.err: protected_4_pic.o gcctestdir/ld
1052 @echo $(CXXLINK) -Bgcctestdir/ -shared -o protected_4.so protected_4_pic.o "2>$@"
1053 @if $(CXXLINK) -Bgcctestdir/ -shared -o protected_4.so protected_4_pic.o 2>$@; then \
1054 echo 1>&2 "Link of protected_4.so should have failed"; \
1055 rm -f $@; \
1056 exit 1; \
1057 fi
1058
9f1d377b
ILT
1059check_PROGRAMS += relro_test
1060relro_test_SOURCES = relro_test_main.cc
1061relro_test_DEPENDENCIES = gcctestdir/ld relro_test.so
1062relro_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1063relro_test_LDADD = relro_test.so
1064relro_test.so: gcctestdir/ld relro_test_pic.o
1065 $(CXXLINK) -Bgcctestdir/ -shared -Wl,-z,relro relro_test_pic.o
1066relro_test_pic.o: relro_test.cc
1067 $(CXXCOMPILE) -c -fpic -o $@ $<
1068
2d924fd9
ILT
1069check_PROGRAMS += relro_script_test
1070relro_script_test_SOURCES = relro_test_main.cc
1071relro_script_test_DEPENDENCIES = gcctestdir/ld relro_script_test.so
1072relro_script_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1073relro_script_test_LDADD = relro_script_test.so
1074relro_script_test.so: gcctestdir/ld relro_script_test.t relro_test_pic.o
1075 $(CXXLINK) -Bgcctestdir/ -shared -Wl,-z,relro -T $(srcdir)/relro_script_test.t relro_test_pic.o
1076
e5756efb
ILT
1077check_PROGRAMS += script_test_1
1078script_test_1_SOURCES = script_test_1.cc
1079script_test_1_DEPENDENCIES = gcctestdir/ld script_test_1.t
1080script_test_1_LDFLAGS = -Bgcctestdir/ -Wl,-R,. -T $(srcdir)/script_test_1.t
1abce4a6 1081script_test_1_LDADD =
e5756efb 1082
a445fddf
ILT
1083check_PROGRAMS += script_test_2
1084script_test_2_SOURCES = script_test_2.cc script_test_2a.cc script_test_2b.cc
1085script_test_2_DEPENDENCIES = gcctestdir/ld script_test_2.t
1086script_test_2_LDFLAGS = -Bgcctestdir/ -Wl,-R,. -T $(srcdir)/script_test_2.t
1abce4a6 1087script_test_2_LDADD =
a445fddf 1088
88dd47ac
ILT
1089check_PROGRAMS += justsyms
1090justsyms_SOURCES = justsyms_1.cc
1091justsyms_DEPENDENCIES = gcctestdir/ld justsyms_2r.o
1092justsyms_LDFLAGS = -Bgcctestdir/ -Wl,-R,justsyms_2r.o
1abce4a6 1093justsyms_LDADD =
88dd47ac
ILT
1094justsyms_2.o: justsyms_2.cc
1095 $(CXXCOMPILE) -c -o $@ $<
83bfb6b7 1096justsyms_2r.o: justsyms_2.o gcctestdir/ld $(srcdir)/justsyms.t
88dd47ac
ILT
1097 gcctestdir/ld -o $@ -r -T $(srcdir)/justsyms.t justsyms_2.o
1098
bc644c6c 1099check_PROGRAMS += binary_test
72fef11a 1100MOSTLYCLEANFILES += binary.txt
bc644c6c
ILT
1101binary_test_SOURCES = binary_test.cc
1102binary_test_DEPENDENCIES = gcctestdir/ld binary.txt
1103binary_test_LDFLAGS = -Bgcctestdir/ -Wl,--format,binary,binary.txt,--format,elf
1abce4a6 1104binary_test_LDADD =
bc644c6c
ILT
1105# Copy the file to the build directory to avoid worrying about the
1106# full pathname in the generated symbols.
1107binary.txt: $(srcdir)/binary.in
1108 rm -f $@
1109 $(LN_S) $< $@
1110
09124467
ILT
1111check_SCRIPTS += ver_matching_test.sh
1112check_DATA += ver_matching_test.stdout
1113MOSTLYCLEANFILES += ver_matching_test.stdout
6affe781 1114ver_matching_def.so: ver_matching_def.cc $(srcdir)/version_script.map gcctestdir/ld
09124467
ILT
1115 $(CXXLINK) -O0 -Bgcctestdir/ -shared $(srcdir)/ver_matching_def.cc -Wl,--version-script=$(srcdir)/version_script.map
1116ver_matching_test.stdout: ver_matching_def.so
6835af53 1117 $(TEST_OBJDUMP) -T ver_matching_def.so | $(TEST_CXXFILT) > ver_matching_test.stdout
1c4f3631
ILT
1118
1119check_PROGRAMS += script_test_3
1120check_SCRIPTS += script_test_3.sh
1121check_DATA += script_test_3.stdout
1122MOSTLYCLEANFILES += script_test_3.stdout
1123script_test_3: basic_test.o gcctestdir/ld script_test_3.t
1124 $(CXXLINK) -Bgcctestdir/ basic_test.o -T $(srcdir)/script_test_3.t
1125script_test_3.stdout: script_test_3
2cefc357 1126 $(TEST_READELF) -SlW script_test_3 > script_test_3.stdout
09124467 1127
4ebf39db
ILT
1128check_PROGRAMS += tls_phdrs_script_test
1129tls_phdrs_script_test_SOURCES = $(tls_test_SOURCES)
1130tls_phdrs_script_test_DEPENDENCIES = $(tls_test_DEPENDENCIES) $(srcdir)/script_test_3.t
1131tls_phdrs_script_test_LDFLAGS = $(tls_test_LDFLAGS) -T $(srcdir)/script_test_3.t
1132tls_phdrs_script_test_LDADD = $(tls_test_LDADD)
1133
e6188289
ILT
1134check_SCRIPTS += script_test_4.sh
1135check_DATA += script_test_4.stdout
72fef11a 1136MOSTLYCLEANFILES += script_test_4
e6188289
ILT
1137script_test_4: basic_test.o gcctestdir/ld $(srcdir)/script_test_4.t
1138 $(CXXLINK) -Bgcctestdir/ basic_test.o -T $(srcdir)/script_test_4.t
1139script_test_4.stdout: script_test_4
1140 $(TEST_READELF) -SlW script_test_4 > script_test_4.stdout
1141
6c93b22c
ILT
1142check_PROGRAMS += tls_script_test
1143tls_script_test_SOURCES = $(tls_test_SOURCES)
1144tls_script_test_DEPENDENCIES = $(tls_test_DEPENDENCIES) $(srcdir)/script_test_4.t
1145tls_script_test_LDFLAGS = $(tls_test_LDFLAGS) -T $(srcdir)/script_test_4.t
1146tls_script_test_LDADD = $(tls_test_LDADD)
1147
401a9a73
CC
1148check_SCRIPTS += script_test_5.sh
1149check_DATA += script_test_5.stdout
72fef11a 1150MOSTLYCLEANFILES += script_test_5
401a9a73
CC
1151script_test_5: script_test_5.o gcctestdir/ld $(srcdir)/script_test_5.t
1152 $(CXXLINK) -Bgcctestdir/ script_test_5.o -T $(srcdir)/script_test_5.t
1153script_test_5.stdout: script_test_5
1154 $(TEST_READELF) -SW script_test_5 > script_test_5.stdout
1155
3c12dcdb
DK
1156check_SCRIPTS += script_test_6.sh
1157check_DATA += script_test_6.stdout
1158MOSTLYCLEANFILES += script_test_6
1159script_test_6: basic_test.o gcctestdir/ld $(srcdir)/script_test_6.t
1160 $(CXXLINK) -Bgcctestdir/ basic_test.o -T $(srcdir)/script_test_6.t \
1161 -Wl,-Ttext=0x10001000 -Wl,-Tdata=0x10200000 -Wl,-Tbss=0x10400000
1162script_test_6.stdout: script_test_6
1163 $(TEST_READELF) -SlW script_test_6 > script_test_6.stdout
1164
1165check_SCRIPTS += script_test_7.sh
1166check_DATA += script_test_7.stdout
1167MOSTLYCLEANFILES += script_test_7
1168script_test_7: basic_test.o gcctestdir/ld $(srcdir)/script_test_7.t
1169 $(CXXLINK) -Bgcctestdir/ basic_test.o -T $(srcdir)/script_test_7.t
1170script_test_7.stdout: script_test_7
1171 $(TEST_READELF) -SlW script_test_7 > script_test_7.stdout
1172
1173check_SCRIPTS += script_test_8.sh
1174check_DATA += script_test_8.stdout
1175MOSTLYCLEANFILES += script_test_8
1176script_test_8: basic_test.o gcctestdir/ld $(srcdir)/script_test_7.t
1177 $(CXXLINK) -Bgcctestdir/ basic_test.o -T $(srcdir)/script_test_7.t \
1178 -Wl,-Ttext=0x20001000 -Wl,-Tdata=0x20200000 -Wl,-Tbss=0x20400000
1179script_test_8.stdout: script_test_8
1180 $(TEST_READELF) -SlW script_test_8 > script_test_8.stdout
1181
d103a984
RÁE
1182
1183check_SCRIPTS += script_test_9.sh
1184check_DATA += script_test_9.stdout
1185script_test_9.o: script_test_9.cc
1186 $(CXXCOMPILE) -O0 -c -o $@ $<
1187script_test_9: gcctestdir/ld $(srcdir)/script_test_9.t script_test_9.o
1188 $(CXXLINK) -Bgcctestdir/ script_test_9.o -T $(srcdir)/script_test_9.t
1189script_test_9.stdout: script_test_9
1190 $(TEST_READELF) -lW script_test_9 > script_test_9.stdout
1191
1192
c82fbeee
CS
1193# Test --dynamic-list, --dynamic-list-data, --dynamic-list-cpp-new,
1194# and --dynamic-list-cpp-typeinfo
1195
1196check_SCRIPTS += dynamic_list.sh
1197check_DATA += dynamic_list.stdout
72fef11a 1198MOSTLYCLEANFILES += dynamic_list dynamic_list.stdout
c82fbeee
CS
1199dynamic_list: basic_test.o gcctestdir/ld $(srcdir)/dynamic_list.t
1200 $(CXXLINK) -Bgcctestdir/ basic_test.o \
1201 -Wl,--dynamic-list $(srcdir)/dynamic_list.t \
1202 -Wl,--dynamic-list-data \
1203 -Wl,--dynamic-list-cpp-new \
1204 -Wl,--dynamic-list-cpp-typeinfo
1205dynamic_list.stdout: dynamic_list
94e6ee91 1206 $(TEST_READELF) -W --dyn-syms dynamic_list > dynamic_list.stdout
c82fbeee 1207
fbd8a257 1208check_PROGRAMS += thin_archive_test_1
72fef11a
CC
1209MOSTLYCLEANFILES += libthin1.a libthin3.a libthinall.a \
1210 alt/thin_archive_test_2.o alt/thin_archive_test_4.o \
1211 alt/libthin2.a alt/libthin4.a
fbd8a257
CC
1212thin_archive_test_1_SOURCES = thin_archive_main.cc
1213thin_archive_test_1_DEPENDENCIES = gcctestdir/ld libthin1.a alt/libthin2.a
1214thin_archive_test_1_LDFLAGS = -Bgcctestdir/ -Lalt
1215thin_archive_test_1_LDADD = libthin1.a -lthin2
1216
1217check_PROGRAMS += thin_archive_test_2
1218thin_archive_test_2_SOURCES = thin_archive_main.cc
1219thin_archive_test_2_DEPENDENCIES = gcctestdir/ld libthinall.a
1220thin_archive_test_2_LDFLAGS = -Bgcctestdir/ -L.
1221thin_archive_test_2_LDADD = -lthinall
1222
1223libthin1.a: thin_archive_test_1.o alt/thin_archive_test_2.o
1224 rm -f $@
1225 $(TEST_AR) crT $@ $^
1226alt/libthin2.a: thin_archive_test_3.o alt/thin_archive_test_4.o
1227 rm -f $@
1228 $(TEST_AR) crT $@ $^
1229libthin3.a: thin_archive_test_1.o alt/thin_archive_test_4.o
1230 rm -f $@
1231 $(TEST_AR) crT $@ $^
1232alt/libthin4.a: alt/thin_archive_test_2.o thin_archive_test_3.o
1233 rm -f $@
1234 $(TEST_AR) crT $@ $^
1235libthinall.a: libthin3.a alt/libthin4.a
1236 rm -f $@
1237 $(TEST_AR) crT $@ $^
1238alt/thin_archive_test_2.o: thin_archive_test_2.cc
1239 test -d alt || mkdir -p alt
1240 $(CXXCOMPILE) -c -o $@ $<
1241alt/thin_archive_test_4.o: thin_archive_test_4.cc
1242 test -d alt || mkdir -p alt
1243 $(CXXCOMPILE) -c -o $@ $<
1244
89fc3421
CC
1245if PLUGINS
1246
1247check_PROGRAMS += plugin_test_1
1248check_SCRIPTS += plugin_test_1.sh
1249check_DATA += plugin_test_1.err
1250MOSTLYCLEANFILES += plugin_test_1.err
abc8dcba
CC
1251plugin_test_1: two_file_test_main.o two_file_test_1.syms two_file_test_1b.syms two_file_test_2.syms empty.syms gcctestdir/ld plugin_test.so
1252 $(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle,--plugin,"./plugin_test.so",--plugin-opt,"_Z4f13iv" two_file_test_main.o two_file_test_1.syms two_file_test_1b.syms two_file_test_2.syms empty.syms 2>plugin_test_1.err
89fc3421
CC
1253plugin_test_1.err: plugin_test_1
1254 @touch plugin_test_1.err
1255
1256check_PROGRAMS += plugin_test_2
1257check_SCRIPTS += plugin_test_2.sh
1258check_DATA += plugin_test_2.err
1259MOSTLYCLEANFILES += plugin_test_2.err
1260plugin_test_2: two_file_test_main.o two_file_test_1.syms two_file_test_1b.syms two_file_shared_2.so gcctestdir/ld plugin_test.so
1261 $(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle,-R,.,--plugin,"./plugin_test.so" two_file_test_main.o two_file_test_1.syms two_file_test_1b.syms two_file_shared_2.so 2>plugin_test_2.err
1262plugin_test_2.err: plugin_test_2
1263 @touch plugin_test_2.err
1264
d66a9eb3
CC
1265check_PROGRAMS += plugin_test_3
1266check_SCRIPTS += plugin_test_3.sh
1267check_DATA += plugin_test_3.err
1268MOSTLYCLEANFILES += plugin_test_3.err
1269plugin_test_3: two_file_test_main.o two_file_test_1.syms two_file_test_1b.syms two_file_test_2.syms empty.syms gcctestdir/ld plugin_test.so
1270 $(CXXLINK) -Bgcctestdir/ -Wl,--export-dynamic -Wl,--no-demangle,--plugin,"./plugin_test.so",--plugin-opt,"_Z4f13iv" two_file_test_main.o two_file_test_1.syms two_file_test_1b.syms two_file_test_2.syms empty.syms 2>plugin_test_3.err
1271plugin_test_3.err: plugin_test_3
1272 @touch plugin_test_3.err
1273
0f7c0701
CC
1274check_PROGRAMS += plugin_test_4
1275check_SCRIPTS += plugin_test_4.sh
1276check_DATA += plugin_test_4.err
72fef11a 1277MOSTLYCLEANFILES += plugin_test_4.a plugin_test_4.err
0f7c0701
CC
1278plugin_test_4: two_file_test_main.o plugin_test_4.a gcctestdir/ld plugin_test.so
1279 $(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
1280plugin_test_4.err: plugin_test_4
1281 @touch plugin_test_4.err
1282
1283plugin_test_4.a: two_file_test_1.syms two_file_test_1b.syms two_file_test_2.syms
1284 $(TEST_AR) cr $@ $^
1285
24998053
CC
1286check_PROGRAMS += plugin_test_5
1287plugin_test_5: two_file_test_main.o two_file_test_1.syms two_file_test_1b.syms two_file_test_2.syms unused.syms gcctestdir/ld plugin_test.so
1288 $(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle,--plugin,"./plugin_test.so",--plugin-opt,"_Z4f13iv",--gc-sections two_file_test_main.o two_file_test_1.syms two_file_test_1b.syms two_file_test_2.syms unused.syms
1289
be234d88
CC
1290check_PROGRAMS += plugin_test_6
1291check_SCRIPTS += plugin_test_6.sh
1292check_DATA += plugin_test_6.err
1293MOSTLYCLEANFILES += plugin_test_6.err
1294plugin_test_6: plugin_common_test_1.syms plugin_common_test_2.syms gcctestdir/ld plugin_test.so
1295 $(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle,--plugin,"./plugin_test.so" plugin_common_test_1.syms plugin_common_test_2.syms 2>plugin_test_6.err
1296plugin_test_6.err: plugin_test_6
1297 @touch plugin_test_6.err
1298
5e0f337e
RÁE
1299check_PROGRAMS += plugin_test_7
1300check_SCRIPTS += plugin_test_7.sh
1301check_DATA += plugin_test_7.err plugin_test_7.syms
1302MOSTLYCLEANFILES += plugin_test_7.err
1303plugin_test_7: plugin_test_7_1.o plugin_test_7_1.syms plugin_test_7_2.o gcctestdir/ld plugin_test.so
1304 $(LINK) -Bgcctestdir/ -Wl,--no-demangle,--plugin,"./plugin_test.so",--gc-sections,--print-gc-sections plugin_test_7_1.syms plugin_test_7_2.o 2>plugin_test_7.err
1305plugin_test_7.syms: plugin_test_7
1306 $(TEST_READELF) -sW $< >$@ 2>/dev/null
1307plugin_test_7_1.o: plugin_test_7_1.c
1308 $(COMPILE) -DLTO -O0 -c -ffunction-sections -fdata-sections -o $@ $<
1309plugin_test_7_1_orig.o: plugin_test_7_1.c
1310 $(COMPILE) -O0 -c -ffunction-sections -fdata-sections -o $@ $<
1311plugin_test_7_1.syms: plugin_test_7_1_orig.o
1312 $(TEST_READELF) -sW $< >$@ 2>/dev/null
1313plugin_test_7_2.o: plugin_test_7_2.c
1314 $(COMPILE) -O0 -c -ffunction-sections -fdata-sections -o $@ $<
1315plugin_test_7.err: plugin_test_7
1316
f3a2388f
CC
1317# Test plugins with -r.
1318check_PROGRAMS += plugin_test_8
1319plugin_test_8.o: two_file_test_main.o two_file_test_1.syms two_file_test_1b.syms two_file_test_2.o ../ld-new plugin_test.so
1320 ../ld-new -r -o $@ --no-demangle --plugin "./plugin_test.so" two_file_test_main.o two_file_test_1.syms two_file_test_1b.syms two_file_test_2.o
1321plugin_test_8: plugin_test_8.o gcctestdir/ld
1322 $(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle plugin_test_8.o
1323
1324# Test that symbols known in the IR file but not in the replacement file
1325# produce an unresolved symbol error.
1326check_DATA += plugin_test_9.err
1327MOSTLYCLEANFILES += plugin_test_9.err
1328plugin_test_9.err: two_file_test_main.o two_file_test_1c.syms two_file_test_2.syms gcctestdir/ld plugin_test.so
1329 @echo $(CXXLINK) -Bgcctestdir/ -o plugin_test_9 -Wl,--no-demangle,--plugin,"./plugin_test.so" two_file_test_main.o two_file_test_1c.syms two_file_test_2.syms "2>$@"
1330 @if $(CXXLINK) -Bgcctestdir/ -o plugin_test_9 -Wl,--no-demangle,--plugin,"./plugin_test.so" two_file_test_main.o two_file_test_1c.syms two_file_test_2.syms 2>$@; then \
1331 echo 1>&2 "Link of plugin_test_9 should have failed"; \
1332 rm -f $@; \
1333 exit 1; \
1334 fi
1335# Make a .syms file that claims to define the symbol _Z4t16av.
1336two_file_test_1c.syms: two_file_test_1.syms two_file_test_1c.o
1337 cp two_file_test_1.syms $@.tmp
1338 grep "_Z4t16av" two_file_test_1b.syms >> $@.tmp
1339 mv -f $@.tmp $@
1340# Make a copy of two_file_test_1.o, which does not define the symbol _Z4t16av.
1341MOSTLYCLEANFILES += two_file_test_1c.o
1342two_file_test_1c.o: two_file_test_1.o
1343 cp two_file_test_1.o $@
1344
89fc3421
CC
1345plugin_test.so: plugin_test.o
1346 $(LINK) -Bgcctestdir/ -shared plugin_test.o
1347plugin_test.o: plugin_test.c
1348 $(COMPILE) -O0 -c -fpic -o $@ $<
1349
1350two_file_test_main.syms: two_file_test_main.o
1351 $(TEST_READELF) -sW $< >$@ 2>/dev/null
1352two_file_test_1.syms: two_file_test_1.o
1353 $(TEST_READELF) -sW $< >$@ 2>/dev/null
1354two_file_test_1b.syms: two_file_test_1b.o
1355 $(TEST_READELF) -sW $< >$@ 2>/dev/null
1356two_file_test_2.syms: two_file_test_2.o
1357 $(TEST_READELF) -sW $< >$@ 2>/dev/null
be234d88
CC
1358plugin_common_test_1.syms: plugin_common_test_1.o
1359 $(TEST_READELF) -sW $< >$@ 2>/dev/null
1360plugin_common_test_2.syms: plugin_common_test_2.o
1361 $(TEST_READELF) -sW $< >$@ 2>/dev/null
24998053 1362
abc8dcba 1363empty.syms:
24998053
CC
1364 @echo "" >$@
1365 @echo "Symbol table" >>$@
1366
1367MOSTLYCLEANFILES += unused.c
1368unused.syms: unused.o
1369 $(TEST_READELF) -sW $< >$@ 2>/dev/null
1370 @echo " 1: 00000000 4 FUNC GLOBAL DEFAULT 1 UNUSED" >>$@
1371unused.o: unused.c
1372 $(COMPILE) -c -o $@ $<
1373unused.c:
1374 @cp /dev/null $@
89fc3421
CC
1375
1376endif PLUGINS
1377
65514900
CC
1378check_PROGRAMS += exclude_libs_test
1379check_SCRIPTS += exclude_libs_test.sh
1380check_DATA += exclude_libs_test.syms
1381MOSTLYCLEANFILES += exclude_libs_test.syms libexclude_libs_test_1.a \
2fdd743f 1382 libexclude_libs_test_2.a alt/libexclude_libs_test_3.a
65514900
CC
1383exclude_libs_test_SOURCES = exclude_libs_test.c
1384exclude_libs_test_DEPENDENCIES = gcctestdir/ld libexclude_libs_test_1.a \
2fdd743f
DK
1385 libexclude_libs_test_2.a alt/libexclude_libs_test_3.a
1386exclude_libs_test_LDFLAGS = -Bgcctestdir/ -L. -Lalt \
1387 -Wl,--exclude-libs,dummy:libexclude_libs_test_1 \
1388 -Wl,--exclude-libs,libexclude_libs_test_3
1389exclude_libs_test_LDADD = -lexclude_libs_test_1 -lexclude_libs_test_2 \
1390 alt/libexclude_libs_test_3.a
65514900
CC
1391exclude_libs_test.syms: exclude_libs_test
1392 $(TEST_READELF) -sW $< >$@ 2>/dev/null
1393libexclude_libs_test_1.a: exclude_libs_test_1.o
1394 $(TEST_AR) rc $@ $^
1395libexclude_libs_test_2.a: exclude_libs_test_2.o
1396 $(TEST_AR) rc $@ $^
2fdd743f
DK
1397alt/libexclude_libs_test_3.a: exclude_libs_test_3.o
1398 test -d alt || mkdir -p alt
1399 $(TEST_AR) rc $@ $^
65514900 1400
805bb01c
DK
1401check_PROGRAMS += local_labels_test
1402local_labels_test.o: ver_test_6.c
1403 $(COMPILE) -g -c -Wa,-L -o $@ $<
1404local_labels_test: local_labels_test.o
1405 $(LINK) -Bgcctestdir/ local_labels_test.o
1406
bb04269c
DK
1407check_PROGRAMS += discard_locals_test
1408check_SCRIPTS += discard_locals_test.sh
d3bbad62
ILT
1409check_DATA += discard_locals_test.syms \
1410 discard_locals_relocatable_test1.syms \
1411 discard_locals_relocatable_test2.syms
1412MOSTLYCLEANFILES += discard_locals_test.syms \
1413 discard_locals_relocatable_test1.syms \
1414 discard_locals_relocatable_test2.syms \
1415 discard_locals_relocatable_test1.out \
1416 discard_locals_relocatable_test2.out
bb04269c
DK
1417discard_locals_test_SOURCES = discard_locals_test.c
1418discard_locals_test_LDFLAGS = -Bgcctestdir/ -Wl,--discard-locals
1419discard_locals_test.syms: discard_locals_test
1420 $(TEST_READELF) -sW $< >$@ 2>/dev/null
1421# '-Wa,-L' is required to preserve the local label used for testing.
1422discard_locals_test.o: discard_locals_test.c
1423 $(COMPILE) -c -Wa,-L -o $@ $<
1424
d3bbad62
ILT
1425discard_locals_relocatable_test1.syms: discard_locals_relocatable_test1.out
1426 $(TEST_READELF) -sW $< >$@ 2>/dev/null
1427discard_locals_relocatable_test.o: discard_locals_relocatable_test.c
1428 $(COMPILE) -c -Wa,-L -fPIC -o $@ $<
1429discard_locals_relocatable_test1.out: discard_locals_relocatable_test.o ../ld-new
1430 ../ld-new --discard-locals -relocatable -o $@ $<
1431
1432discard_locals_relocatable_test2.syms: discard_locals_relocatable_test2.out
1433 $(TEST_READELF) -sW $< >$@ 2>/dev/null
1434discard_locals_relocatable_test2.out: discard_locals_relocatable_test.o ../ld-new
1435 ../ld-new --discard-all -relocatable -o $@ $<
1436
8a5e3e08
ILT
1437if MCMODEL_MEDIUM
1438check_PROGRAMS += large
1439large_SOURCES = large.c
1440large_CFLAGS = -mcmodel=medium
1441large_DEPENDENCIES = gcctestdir/ld
1442large_LDFLAGS = -Bgcctestdir/
1abce4a6 1443large_LDADD =
8a5e3e08
ILT
1444endif MCMODEL_MEDIUM
1445
645afe0c
CC
1446# Test that hidden and internal symbols in the main program cannot be
1447# referenced by a shared library.
1448check_SCRIPTS += hidden_test.sh
1449check_DATA += hidden_test.err
1450MOSTLYCLEANFILES += hidden_test hidden_test.err
1451libhidden.so: hidden_test_1.c gcctestdir/ld
1452 $(COMPILE) -Bgcctestdir/ -g -shared -fPIC -w -o $@ $(srcdir)/hidden_test_1.c
1453hidden_test: hidden_test_main.o libhidden.so gcctestdir/ld
1454 $(LINK) -Bgcctestdir/ -Wl,-R,. hidden_test_main.o libhidden.so 2>hidden_test.err
1455hidden_test.err: hidden_test
1456 @touch hidden_test.err
1457
8c604651
CS
1458# Test -retain-symbols-file.
1459check_SCRIPTS += retain_symbols_file_test.sh
1460check_DATA += retain_symbols_file_test.stdout
1461MOSTLYCLEANFILES += retain_symbols_file_test retain_symbols_file_test.in \
1462 retain_symbols_file_test.stdout
1463retain_symbols_file_test.so: basic_pic_test.o gcctestdir/ld
1464 echo 'main' > retain_symbols_file_test.in
1465 echo 't1' >> retain_symbols_file_test.in
1466 echo '_ZN4t16bC1Ev' >> retain_symbols_file_test.in
1467 echo '_ZNK4t20a3getEv' >> retain_symbols_file_test.in
1468 echo '_Z3t18v' >> retain_symbols_file_test.in
1469 echo '__tcf_0' >> retain_symbols_file_test.in
1470 $(CXXLINK) -Bgcctestdir/ -shared -Wl,-retain-symbols-file,retain_symbols_file_test.in basic_pic_test.o
1471retain_symbols_file_test.stdout: retain_symbols_file_test.so
1472 $(TEST_NM) -C retain_symbols_file_test.so > $@
1473
1474
6a89f575
CC
1475# Test that if the output file already exists and is empty,
1476# it will get execute permission.
1477check_PROGRAMS += permission_test
1478permission_test: basic_test.o gcctestdir/ld
1479 umask 022; \
1480 rm -f $@; \
1481 touch $@; \
1482 chmod 600 $@; \
1483 $(CXXLINK) -Bgcctestdir/ basic_test.o
1484
ae3b5189
CD
1485# Check -l:foo.a
1486check_PROGRAMS += searched_file_test
1487MOSTLYCLEANFILES += searched_file_test searched_file_test_lib.o \
1488 alt/searched_file_test_lib.a
1489searched_file_test_SOURCES = searched_file_test.cc
1490searched_file_test_DEPENDENCIES = alt/searched_file_test_lib.a
1491searched_file_test_LDFLAGS = -Bgcctestdir/ -Lalt
1492searched_file_test_LDADD = -l:searched_file_test_lib.a
1493searched_file_test_lib.o: searched_file_test_lib.cc
1494 $(CXXCOMPILE) -c -o $@ $<
1495alt/searched_file_test_lib.a: searched_file_test_lib.o
1496 test -d alt || mkdir -p alt
1497 $(TEST_AR) rc $@ $^
1498
c5617f2f
DK
1499# Test that no .gnu.version sections are created when
1500# symbol versioning is not used.
1501check_SCRIPTS += no_version_test.sh
1502check_DATA += no_version_test.stdout
1503MOSTLYCLEANFILES += libno_version_test.so no_version_test.stdout
1504# We invoke the linker directly since gcc may include additional objects that
1505# uses symbol versioning.
1506libno_version_test.so: no_version_test.o gcctestdir/ld
1507 gcctestdir/ld -shared -o $@ no_version_test.o
1508no_version_test.o: no_version_test.c
1509 $(COMPILE) -o $@ -c -fPIC $<
1510no_version_test.stdout: libno_version_test.so
1511 $(TEST_OBJDUMP) -h $< > $@
1512
351a8000
ILT
1513endif GCC
1514endif NATIVE_LINKER
364c7fa5
ILT
1515
1516# These tests work with cross linkers.
1517
1518if DEFAULT_TARGET_I386
1519
1520check_SCRIPTS += split_i386.sh
1521check_DATA += split_i386_1.stdout split_i386_2.stdout \
1522 split_i386_3.stdout split_i386_4.stdout split_i386_r.stdout
1523SPLIT_DEFSYMS = --defsym __morestack=0x100 --defsym __morestack_non_split=0x200
1524split_i386_1.o: split_i386_1.s
1525 $(TEST_AS) -o $@ $<
1526split_i386_2.o: split_i386_2.s
1527 $(TEST_AS) -o $@ $<
1528split_i386_3.o: split_i386_3.s
1529 $(TEST_AS) -o $@ $<
1530split_i386_4.o: split_i386_4.s
1531 $(TEST_AS) -o $@ $<
1532split_i386_n.o: split_i386_n.s
1533 $(TEST_AS) -o $@ $<
1534split_i386_1: split_i386_1.o split_i386_n.o ../ld-new
1535 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_i386_1.o split_i386_n.o
1536split_i386_1.stdout: split_i386_1
1537 $(TEST_OBJDUMP) -d $< > $@
1538split_i386_2: split_i386_2.o split_i386_n.o ../ld-new
1539 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_i386_2.o split_i386_n.o
1540split_i386_2.stdout: split_i386_2
1541 $(TEST_OBJDUMP) -d $< > $@
1542split_i386_3.stdout: split_i386_3.o split_i386_n.o ../ld-new
1543 ../ld-new $(SPLIT_DEFSYMS) -o split_i386_3 split_i386_3.o split_i386_n.o > $@ 2>&1 || exit 0
1544split_i386_4: split_i386_4.o split_i386_n.o ../ld-new
1545 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_i386_4.o split_i386_n.o
1546split_i386_4.stdout: split_i386_4
1547 $(TEST_OBJDUMP) -d $< > $@
1548split_i386_r.stdout: split_i386_1.o split_i386_n.o ../ld-new
1549 ../ld-new -r split_i386_1.o split_i386_n.o -o split_i386_r > $@ 2>&1 || exit 0
1550MOSTLYCLEANFILES += split_i386_1 split_i386_2 split_i386_3 \
1551 split_i386_4 split_i386_r
1552
1553endif DEFAULT_TARGET_I386
1554
1555if DEFAULT_TARGET_X86_64
1556
1557check_SCRIPTS += split_x86_64.sh
1558check_DATA += split_x86_64_1.stdout split_x86_64_2.stdout \
1559 split_x86_64_3.stdout split_x86_64_4.stdout split_x86_64_r.stdout
1560SPLIT_DEFSYMS = --defsym __morestack=0x100 --defsym __morestack_non_split=0x200
1561split_x86_64_1.o: split_x86_64_1.s
1562 $(TEST_AS) -o $@ $<
1563split_x86_64_2.o: split_x86_64_2.s
1564 $(TEST_AS) -o $@ $<
1565split_x86_64_3.o: split_x86_64_3.s
1566 $(TEST_AS) -o $@ $<
1567split_x86_64_4.o: split_x86_64_4.s
1568 $(TEST_AS) -o $@ $<
1569split_x86_64_n.o: split_x86_64_n.s
1570 $(TEST_AS) -o $@ $<
1571split_x86_64_1: split_x86_64_1.o split_x86_64_n.o ../ld-new
1572 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x86_64_1.o split_x86_64_n.o
1573split_x86_64_1.stdout: split_x86_64_1
1574 $(TEST_OBJDUMP) -d $< > $@
1575split_x86_64_2: split_x86_64_2.o split_x86_64_n.o ../ld-new
1576 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x86_64_2.o split_x86_64_n.o
1577split_x86_64_2.stdout: split_x86_64_2
1578 $(TEST_OBJDUMP) -d $< > $@
1579split_x86_64_3.stdout: split_x86_64_3.o split_x86_64_n.o ../ld-new
1580 ../ld-new $(SPLIT_DEFSYMS) -o split_x86_64_3 split_x86_64_3.o split_x86_64_n.o > $@ 2>&1 || exit 0
1581split_x86_64_4: split_x86_64_4.o split_x86_64_n.o ../ld-new
1582 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x86_64_4.o split_x86_64_n.o
1583split_x86_64_4.stdout: split_x86_64_4
1584 $(TEST_OBJDUMP) -d $< > $@
1585split_x86_64_r.stdout: split_x86_64_1.o split_x86_64_n.o ../ld-new
1586 ../ld-new -r split_x86_64_1.o split_x86_64_n.o -o split_x86_64_r > $@ 2>&1 || exit 0
1587MOSTLYCLEANFILES += split_x86_64_1 split_x86_64_2 split_x86_64_3 \
1588 split_x86_64_4 split_x86_64_r
1589
1590endif DEFAULT_TARGET_X86_64
e4782e83
DK
1591
1592if DEFAULT_TARGET_ARM
1593
1594check_SCRIPTS += arm_abs_global.sh
1595check_DATA += arm_abs_global.stdout
1596arm_abs_lib.o: arm_abs_lib.s
1597 $(TEST_AS) -march=armv7-a -o $@ $<
d3bbad62 1598libarm_abs.so: arm_abs_lib.o ../ld-new
e4782e83
DK
1599 ../ld-new -shared -o $@ arm_abs_lib.o
1600arm_abs_global.o: arm_abs_global.s
1601 $(TEST_AS) -march=armv7-a -o $@ $<
d3bbad62 1602arm_abs_global: arm_abs_global.o libarm_abs.so ../ld-new
e4782e83
DK
1603 ../ld-new -o $@ arm_abs_global.o -L. -larm_abs
1604arm_abs_global.stdout: arm_abs_global
1605 $(TEST_READELF) -r $< > $@
1606
1607MOSTLYCLEANFILES += arm_abs_global
1608
2a2b6d42
DK
1609check_SCRIPTS += arm_branch_in_range.sh
1610check_DATA += arm_bl_in_range.stdout arm_bl_out_of_range.stdout \
1611 thumb_bl_in_range.stdout thumb_bl_out_of_range.stdout \
a2c7281b
DK
1612 thumb2_bl_in_range.stdout thumb2_bl_out_of_range.stdout \
1613 thumb_blx_in_range.stdout thumb_blx_out_of_range.stdout \
1614 thumb2_blx_in_range.stdout thumb2_blx_out_of_range.stdout
2a2b6d42
DK
1615
1616arm_bl_in_range.stdout: arm_bl_in_range
1617 $(TEST_OBJDUMP) -D $< > $@
1618
d3bbad62 1619arm_bl_in_range: arm_bl_in_range.o ../ld-new
2a2b6d42
DK
1620 ../ld-new -T $(srcdir)/arm_branch_range.t -o $@ $<
1621
1622arm_bl_in_range.o: arm_bl_in_range.s
1623 $(TEST_AS) -o $@ $<
1624
1625arm_bl_out_of_range.stdout: arm_bl_out_of_range
1626 $(TEST_OBJDUMP) -S $< > $@
1627
d3bbad62 1628arm_bl_out_of_range: arm_bl_out_of_range.o ../ld-new
2a2b6d42
DK
1629 ../ld-new -T $(srcdir)/arm_branch_range.t -o $@ $<
1630
1631arm_bl_out_of_range.o: arm_bl_out_of_range.s
1632 $(TEST_AS) -o $@ $<
1633
1634thumb_bl_in_range.stdout: thumb_bl_in_range
1635 $(TEST_OBJDUMP) -D $< > $@
1636
d3bbad62 1637thumb_bl_in_range: thumb_bl_in_range.o ../ld-new
2a2b6d42
DK
1638 ../ld-new -T $(srcdir)/thumb_branch_range.t -o $@ $<
1639
1640thumb_bl_in_range.o: thumb_bl_in_range.s
1641 $(TEST_AS) -o $@ -march=armv5te $<
1642
1643thumb_bl_out_of_range.stdout: thumb_bl_out_of_range
1644 $(TEST_OBJDUMP) -D $< > $@
1645
a2c7281b 1646thumb_bl_out_of_range: thumb_bl_out_of_range.o ../ld-new
2a2b6d42
DK
1647 ../ld-new -T $(srcdir)/thumb_branch_range.t -o $@ $<
1648
a2c7281b 1649thumb_bl_out_of_range.o: thumb_bl_out_of_range.s
2a2b6d42
DK
1650 $(TEST_AS) -o $@ -march=armv5te $<
1651
1652thumb2_bl_in_range.stdout: thumb2_bl_in_range
1653 $(TEST_OBJDUMP) -D $< > $@
1654
d3bbad62 1655thumb2_bl_in_range: thumb2_bl_in_range.o ../ld-new
2a2b6d42
DK
1656 ../ld-new -T $(srcdir)/thumb2_branch_range.t -o $@ $<
1657
1658thumb2_bl_in_range.o: thumb_bl_in_range.s
1659 $(TEST_AS) -o $@ -march=armv7-a $<
1660
1661thumb2_bl_out_of_range.stdout: thumb2_bl_out_of_range
1662 $(TEST_OBJDUMP) -D $< > $@
1663
a2c7281b 1664thumb2_bl_out_of_range: thumb2_bl_out_of_range.o ../ld-new
2a2b6d42
DK
1665 ../ld-new -T $(srcdir)/thumb2_branch_range.t -o $@ $<
1666
a2c7281b
DK
1667thumb2_bl_out_of_range.o: thumb_bl_out_of_range.s
1668 $(TEST_AS) -o $@ -march=armv7-a $<
1669
1670thumb_blx_in_range.stdout: thumb_blx_in_range
1671 $(TEST_OBJDUMP) -D $< > $@
1672
1673thumb_blx_in_range: thumb_blx_in_range.o ../ld-new
1674 ../ld-new -T $(srcdir)/thumb_branch_range.t -o $@ $<
1675
1676thumb_blx_in_range.o: thumb_blx_in_range.s
1677 $(TEST_AS) -o $@ -march=armv5te $<
1678
1679thumb_blx_out_of_range.stdout: thumb_blx_out_of_range
1680 $(TEST_OBJDUMP) -D $< > $@
1681
1682thumb_blx_out_of_range: thumb_blx_out_of_range.o ../ld-new
1683 ../ld-new -T $(srcdir)/thumb_branch_range.t -o $@ $<
1684
1685thumb_blx_out_of_range.o: thumb_blx_out_of_range.s
1686 $(TEST_AS) -o $@ -march=armv5te $<
1687
1688thumb2_blx_in_range.stdout: thumb2_blx_in_range
1689 $(TEST_OBJDUMP) -D $< > $@
1690
1691thumb2_blx_in_range: thumb2_blx_in_range.o ../ld-new
1692 ../ld-new -T $(srcdir)/thumb2_branch_range.t -o $@ $<
1693
1694thumb2_blx_in_range.o: thumb_blx_in_range.s
1695 $(TEST_AS) -o $@ -march=armv7-a $<
1696
1697thumb2_blx_out_of_range.stdout: thumb2_blx_out_of_range
1698 $(TEST_OBJDUMP) -D $< > $@
1699
1700thumb2_blx_out_of_range: thumb2_blx_out_of_range.o ../ld-new
1701 ../ld-new -T $(srcdir)/thumb2_branch_range.t -o $@ $<
1702
1703thumb2_blx_out_of_range.o: thumb_blx_out_of_range.s
2a2b6d42
DK
1704 $(TEST_AS) -o $@ -march=armv7-a $<
1705
1706MOSTLYCLEANFILES += arm_bl_in_range arm_bl_out_of_range thumb_bl_in_range \
a2c7281b
DK
1707 thumb_bl_out_of_range thumb2_bl_in_range thumb2_bl_out_of_range \
1708 thumb_blx_in_range thumb_blx_out_of_range thumb2_blx_in_range \
1709 thumb2_blx_out_of_range
2a2b6d42 1710
2fd9ae7a
DK
1711check_SCRIPTS += arm_fix_v4bx.sh
1712check_DATA += arm_fix_v4bx.stdout arm_fix_v4bx_interworking.stdout \
1713 arm_no_fix_v4bx.stdout
1714
1715arm_fix_v4bx.stdout: arm_fix_v4bx
1716 $(TEST_OBJDUMP) -D -j.text $< > $@
1717
d3bbad62 1718arm_fix_v4bx: arm_fix_v4bx.o ../ld-new
2fd9ae7a
DK
1719 ../ld-new --fix-v4bx -o $@ $<
1720
1721arm_fix_v4bx.o: arm_fix_v4bx.s
1722 $(TEST_AS) -o $@ $<
1723
1724arm_fix_v4bx_interworking.stdout: arm_fix_v4bx_interworking
1725 $(TEST_OBJDUMP) -D -j.text $< > $@
1726
d3bbad62 1727arm_fix_v4bx_interworking: arm_fix_v4bx.o ../ld-new
2fd9ae7a
DK
1728 ../ld-new --fix-v4bx-interworking -o $@ $<
1729
1730arm_no_fix_v4bx.stdout: arm_no_fix_v4bx
1731 $(TEST_OBJDUMP) -D -j.text $< > $@
1732
d3bbad62 1733arm_no_fix_v4bx: arm_fix_v4bx.o ../ld-new
2fd9ae7a
DK
1734 ../ld-new -o $@ $<
1735
1736MOSTLYCLEANFILES += arm_fix_v4bx arm_fix_v4bx_interworking arm_no_fix_v4bx
1737
da59ad79
DK
1738check_SCRIPTS += arm_attr_merge.sh
1739check_DATA += arm_attr_merge_6.stdout arm_attr_merge_6r.stdout \
1740 arm_attr_merge_7.stdout
1741
1742arm_attr_merge_6.stdout: arm_attr_merge_6
1743 $(TEST_READELF) -A $< > $@
1744
1745arm_attr_merge_6: arm_attr_merge_6a.o arm_attr_merge_6b.o
1746 ../ld-new -o $@ arm_attr_merge_6a.o arm_attr_merge_6b.o
1747
1748arm_attr_merge_6a.o: arm_attr_merge_6a.s
1749 $(TEST_AS) -o $@ $<
1750
1751arm_attr_merge_6b.o: arm_attr_merge_6b.s
1752 $(TEST_AS) -o $@ $<
1753
1754arm_attr_merge_6r.stdout: arm_attr_merge_6r
1755 $(TEST_READELF) -A $< > $@
1756
1757arm_attr_merge_6r: arm_attr_merge_6b.o arm_attr_merge_6a.o
1758 ../ld-new -o $@ arm_attr_merge_6b.o arm_attr_merge_6a.o
1759
1760arm_attr_merge_7.stdout: arm_attr_merge_7
1761 $(TEST_READELF) -A $< > $@
1762
1763arm_attr_merge_7: arm_attr_merge_7a.o arm_attr_merge_7b.o
1764 ../ld-new -o $@ arm_attr_merge_7a.o arm_attr_merge_7b.o
1765
1766arm_attr_merge_7a.o: arm_attr_merge_7a.s
1767 $(TEST_AS) -o $@ $<
1768
1769arm_attr_merge_7b.o: arm_attr_merge_7b.s
1770 $(TEST_AS) -o $@ $<
1771
1772MOSTLYCLEANFILES += arm_attr_merge_6 arm_attr_merge_6r arm_attr_merge_7
1773
e4782e83 1774endif DEFAULT_TARGET_ARM
This page took 0.248965 seconds and 4 git commands to generate.