gold/
[platform/upstream/binutils.git] / gold / testsuite / Makefile.am
1 # Process this file with automake to generate Makefile.in
2
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
7 # Ignore warning about AM_PROG_CC_C_O due to large_CFLAGS
8 AUTOMAKE_OPTIONS = foreign -Wno-portability
9
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.
13 AM_CFLAGS = $(WARN_CFLAGS) $(LFS_CFLAGS) -fmerge-constants
14 AM_CXXFLAGS = $(WARN_CXXFLAGS) $(LFS_CFLAGS) -fmerge-constants
15
16 AM_CPPFLAGS = \
17         -I$(srcdir) -I$(srcdir)/.. -I$(srcdir)/../../include \
18         -I$(srcdir)/../../elfcpp -I.. \
19         -DLOCALEDIR="\"$(datadir)/locale\"" \
20         @INCINTL@
21
22 # COMPILE1, LINK1, CXXCOMPILE1, CXXLINK1 are renamed from COMPILE, LINK,
23 # CXXCOMPILE and CXXLINK generated by automake 1.11.1.  FIXME: they should
24 # be updated if they are different from automake used by gold.
25 COMPILE1 = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
26         $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
27 LINK1 = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
28 CXXCOMPILE1 = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
29         $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
30 CXXLINK1 = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
31         -o $@
32
33 # Strip out -Wp,-D_FORTIFY_SOURCE=, which is rrelevant for the gold
34 # testsuite and incompatible with -O0 used in gold tests, from
35 # COMPILE, LINK, CXXCOMPILE and CXXLINK.
36 COMPILE = `echo $(COMPILE1) | sed -e 's/-Wp,-D_FORTIFY_SOURCE=[0-9[0-9]]*//'`
37 LINK = `echo $(LINK1) | sed -e 's/-Wp,-D_FORTIFY_SOURCE=[0-9][0-9]*//'`
38 CXXCOMPILE = `echo $(CXXCOMPILE1) | sed -e 's/-Wp,-D_FORTIFY_SOURCE=[0-9][0-9]*//'`
39 CXXLINK = `echo $(CXXLINK1) | sed -e 's/-Wp,-D_FORTIFY_SOURCE=[0-9][0-9]*//'`
40
41 TEST_READELF = $(top_builddir)/../binutils/readelf
42 TEST_OBJDUMP = $(top_builddir)/../binutils/objdump
43 TEST_OBJCOPY = $(top_builddir)/../binutils/objcopy
44 TEST_CXXFILT = $(top_builddir)/../binutils/cxxfilt
45 TEST_STRIP = $(top_builddir)/../binutils/strip-new
46 TEST_AR = $(top_builddir)/../binutils/ar
47 TEST_NM = $(top_builddir)/../binutils/nm-new
48 TEST_AS = $(top_builddir)/../gas/as-new
49
50 if PLUGINS
51 LIBDL = -ldl
52 endif
53
54 if THREADS
55 THREADSLIB = -lpthread
56 endif
57
58 if OMP_SUPPORT
59 TLS_TEST_C_CFLAGS = -fopenmp
60 endif
61
62 # 'make clean' is good about deleting some intermediate files (such as
63 # .o's), but not all of them (such as .so's and .err files).  We
64 # improve on that here.  automake-1.9 info docs say "mostlyclean" is
65 # the right choice for files 'make' builds that people rebuild.
66 MOSTLYCLEANFILES = *.so *.syms *.stdout
67
68
69 # We will add to these later, for each individual test.  Note
70 # that we add each test under check_SCRIPTS or check_PROGRAMS;
71 # the TESTS variable is automatically populated from these.
72 check_SCRIPTS =
73 check_DATA =
74 check_PROGRAMS =
75 BUILT_SOURCES =
76
77 TESTS = $(check_SCRIPTS) $(check_PROGRAMS)
78
79 # ---------------------------------------------------------------------
80 # These tests test the internals of gold (unittests).
81
82 # Infrastucture needed for the unittests
83 check_LIBRARIES = libgoldtest.a
84 libgoldtest_a_SOURCES = test.cc testmain.cc testfile.cc
85
86 DEPENDENCIES = \
87         libgoldtest.a ../libgold.a ../../libiberty/libiberty.a $(LIBINTL_DEP)
88 LDADD = libgoldtest.a ../libgold.a ../../libiberty/libiberty.a $(LIBINTL) \
89         $(THREADSLIB) $(LIBDL)
90
91
92 # The unittests themselves
93 if NATIVE_OR_CROSS_LINKER
94 if GCC
95
96 # Infrastucture needed for the unittests: a directory where the linker
97 # is named 'ld'.  This is because the -B flag appends 'ld' to its arg.
98 gcctestdir/ld: ../ld-new
99         test -d gcctestdir || mkdir -p gcctestdir
100         rm -f gcctestdir/ld
101         (cd gcctestdir && $(LN_S) ../../ld-new ld)
102
103 # Some tests require the latest features of an in-tree assembler.
104 gcctestdir/as: $(TEST_AS)
105         test -d gcctestdir || mkdir -p gcctestdir
106         rm -f gcctestdir/as
107         (cd gcctestdir && $(LN_S) $(abs_top_builddir)/../gas/as-new as)
108
109 endif GCC
110
111 check_PROGRAMS += object_unittest
112 object_unittest_SOURCES = object_unittest.cc
113
114 check_PROGRAMS += binary_unittest
115 binary_unittest_SOURCES = binary_unittest.cc
116
117 check_PROGRAMS += leb128_unittest
118 leb128_unittest_SOURCES = leb128_unittest.cc
119
120 endif NATIVE_OR_CROSS_LINKER
121
122 # ---------------------------------------------------------------------
123 # These tests test the output of gold (end-to-end tests).  In
124 # particular, they make sure that gold can link "difficult" object
125 # files, and the resulting object files run correctly.  These can only
126 # run if we've built ld-new for the native architecture (that is,
127 # we're not cross-compiling it), since we run ld-new as part of these
128 # tests.  We use the gcc-specific flag '-B' to use our linker instead
129 # of the default linker, which is why we only run our tests under gcc.
130
131 if NATIVE_LINKER
132 if GCC
133
134 # Each of these .o's is a useful, small complete program.  They're
135 # particularly useful for making sure ld-new's flags do what they're
136 # supposed to (hence their names), but are used for many tests that
137 # don't actually involve analyzing input data.
138 flagstest_debug.o: constructor_test.cc
139         $(CXXCOMPILE) -O0 -g -c -o $@ $<
140 flagstest_ndebug.o: constructor_test.cc
141         $(CXXCOMPILE) -O0 -c -o $@ $<
142
143 check_SCRIPTS += incremental_test.sh
144 check_DATA += incremental_test.stdout
145 MOSTLYCLEANFILES += incremental_test
146 incremental_test_1.o: incremental_test_1.c
147         $(COMPILE) -O0 -c -ffunction-sections -g -o $@ $<
148 incremental_test_2.o: incremental_test_2.c
149         $(COMPILE) -O0 -c -ffunction-sections -g -o $@ $<
150 incremental_test: incremental_test_1.o incremental_test_2.o gcctestdir/ld
151         $(LINK) -Bgcctestdir/ -Wl,--incremental-full incremental_test_1.o incremental_test_2.o -Wl,-debug 2> incremental_test.cmdline
152 incremental_test.stdout: incremental_test ../incremental-dump
153         ../incremental-dump incremental_test > $@
154
155 check_SCRIPTS += gc_comdat_test.sh
156 check_DATA += gc_comdat_test.stdout
157 MOSTLYCLEANFILES += gc_comdat_test
158 gc_comdat_test_1.o: gc_comdat_test_1.cc 
159         $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
160 gc_comdat_test_2.o: gc_comdat_test_2.cc 
161         $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
162 gc_comdat_test: gc_comdat_test_1.o gc_comdat_test_2.o gcctestdir/ld
163         $(CXXLINK) -Bgcctestdir/ -Wl,--gc-sections gc_comdat_test_1.o gc_comdat_test_2.o
164 gc_comdat_test.stdout: gc_comdat_test
165         $(TEST_NM) -C gc_comdat_test > gc_comdat_test.stdout
166
167 check_SCRIPTS += gc_tls_test.sh
168 check_DATA += gc_tls_test.stdout
169 MOSTLYCLEANFILES += gc_tls_test
170 gc_tls_test.o: gc_tls_test.cc
171         $(CXXCOMPILE) -O0 -c -g -o $@ $<
172 gc_tls_test:gc_tls_test.o gcctestdir/ld
173         $(CXXLINK) -Bgcctestdir/ -Wl,--gc-sections gc_tls_test.o
174 gc_tls_test.stdout: gc_tls_test
175         $(TEST_NM) -C gc_tls_test > gc_tls_test.stdout
176
177 check_SCRIPTS += gc_orphan_section_test.sh
178 check_DATA += gc_orphan_section_test.stdout
179 MOSTLYCLEANFILES += gc_orphan_section_test
180 gc_orphan_section_test.o: gc_orphan_section_test.cc
181         $(CXXCOMPILE) -O0 -c -g -o $@ $<
182 gc_orphan_section_test:gc_orphan_section_test.o gcctestdir/ld
183         $(CXXLINK) -Bgcctestdir/ -Wl,--gc-sections gc_orphan_section_test.o
184 gc_orphan_section_test.stdout: gc_orphan_section_test
185         $(TEST_NM) gc_orphan_section_test > gc_orphan_section_test.stdout
186
187 check_SCRIPTS += pr14265.sh
188 check_DATA += pr14265.stdout
189 MOSTLYCLEANFILES += pr14265
190 pr14265.o: pr14265.c
191         $(COMPILE) -O0 -c -o $@ $<
192 pr14265: pr14265.o 
193         $(LINK) -Bgcctestdir/ -Wl,--gc-sections -T $(srcdir)/pr14265.t -o $@ $<
194 pr14265.stdout: pr14265
195         $(TEST_NM) --format=bsd --numeric-sort $< > $@
196
197 check_SCRIPTS += icf_test.sh
198 check_DATA += icf_test.stdout
199 MOSTLYCLEANFILES += icf_test
200 icf_test.o: icf_test.cc 
201         $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
202 icf_test: icf_test.o gcctestdir/ld
203         $(CXXLINK) -Bgcctestdir/ -Wl,--icf=all icf_test.o
204 icf_test.stdout: icf_test
205         $(TEST_NM) -C icf_test > icf_test.stdout
206
207 check_SCRIPTS += icf_keep_unique_test.sh
208 check_DATA += icf_keep_unique_test.stdout
209 MOSTLYCLEANFILES += icf_keep_unique_test
210 icf_keep_unique_test.o: icf_keep_unique_test.cc
211         $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
212 icf_keep_unique_test: icf_keep_unique_test.o gcctestdir/ld
213         $(CXXLINK) -Bgcctestdir/ -Wl,--icf=all -Wl,--keep-unique,_Z11unique_funcv icf_keep_unique_test.o
214 icf_keep_unique_test.stdout: icf_keep_unique_test
215         $(TEST_NM) -C icf_keep_unique_test > icf_keep_unique_test.stdout
216
217 check_SCRIPTS += icf_safe_test.sh
218 check_DATA += icf_safe_test_1.stdout icf_safe_test_2.stdout
219 MOSTLYCLEANFILES += icf_safe_test
220 icf_safe_test.o: icf_safe_test.cc
221         $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
222 icf_safe_test: icf_safe_test.o gcctestdir/ld
223         $(CXXLINK) -Bgcctestdir/ -Wl,--icf=safe icf_safe_test.o
224 icf_safe_test_1.stdout: icf_safe_test
225         $(TEST_NM) icf_safe_test > icf_safe_test_1.stdout
226 icf_safe_test_2.stdout: icf_safe_test
227         $(TEST_READELF) -h icf_safe_test > icf_safe_test_2.stdout
228
229 check_SCRIPTS += icf_safe_so_test.sh
230 check_DATA += icf_safe_so_test_1.stdout icf_safe_so_test_2.stdout
231 MOSTLYCLEANFILES += icf_safe_so_test
232 icf_safe_so_test.o: icf_safe_so_test.cc
233         $(CXXCOMPILE) -O0 -c -ffunction-sections -fPIC -g -o $@ $<
234 icf_safe_so_test: icf_safe_so_test.o gcctestdir/ld
235         $(CXXLINK) -Bgcctestdir/ -Wl,--icf=safe icf_safe_so_test.o -fPIC -shared
236 icf_safe_so_test_1.stdout: icf_safe_so_test
237         $(TEST_NM) icf_safe_so_test > icf_safe_so_test_1.stdout
238 icf_safe_so_test_2.stdout: icf_safe_so_test
239         $(TEST_READELF) -h icf_safe_so_test > icf_safe_so_test_2.stdout
240
241 check_SCRIPTS += final_layout.sh
242 check_DATA += final_layout.stdout
243 MOSTLYCLEANFILES += final_layout final_layout_sequence.txt
244 final_layout.o: final_layout.cc
245         $(CXXCOMPILE) -O0 -c -ffunction-sections  -fdata-sections -g -o $@ $<
246 final_layout_sequence.txt:
247         (echo "*_Z3barv*" && echo ".text._Z3bazv" && echo "*_Z3foov*" && echo "*global_varb*" && echo "*global_vara*" && echo "*global_varc*") > final_layout_sequence.txt
248 final_layout: final_layout.o final_layout_sequence.txt gcctestdir/ld
249         $(CXXLINK) -Bgcctestdir/ -Wl,--section-ordering-file,final_layout_sequence.txt final_layout.o
250 final_layout.stdout: final_layout
251         $(TEST_NM) -n --synthetic final_layout > final_layout.stdout
252
253 check_PROGRAMS += icf_virtual_function_folding_test
254 MOSTLYCLEANFILES += icf_virtual_function_folding_test
255 icf_virtual_function_folding_test.o: icf_virtual_function_folding_test.cc
256         $(CXXCOMPILE) -O0 -c -ffunction-sections -fPIE -g -o $@ $<
257 icf_virtual_function_folding_test: icf_virtual_function_folding_test.o gcctestdir/ld
258         $(CXXLINK) -Bgcctestdir/ -Wl,--icf=all icf_virtual_function_folding_test.o -pie
259
260 check_SCRIPTS += icf_preemptible_functions_test.sh
261 check_DATA += icf_preemptible_functions_test.stdout
262 MOSTLYCLEANFILES += icf_preemptible_functions_test
263 icf_preemptible_functions_test.o: icf_preemptible_functions_test.cc
264         $(CXXCOMPILE) -O0 -c -ffunction-sections -fPIC -g -o $@ $<
265 icf_preemptible_functions_test: icf_preemptible_functions_test.o gcctestdir/ld
266         $(CXXLINK) -Bgcctestdir/ -Wl,--icf=all icf_preemptible_functions_test.o -fPIC -shared
267 icf_preemptible_functions_test.stdout: icf_preemptible_functions_test
268         $(TEST_NM) icf_preemptible_functions_test > icf_preemptible_functions_test.stdout
269
270 check_SCRIPTS += icf_string_merge_test.sh
271 check_DATA += icf_string_merge_test.stdout
272 MOSTLYCLEANFILES += icf_string_merge_test
273 icf_string_merge_test.o: icf_string_merge_test.cc
274         $(CXXCOMPILE) -O0 -c -ffunction-sections -fPIC -g -o $@ $<
275 icf_string_merge_test: icf_string_merge_test.o gcctestdir/ld
276         $(CXXLINK) -Bgcctestdir/ -Wl,--icf=all icf_string_merge_test.o
277 icf_string_merge_test.stdout: icf_string_merge_test
278         $(TEST_NM) icf_string_merge_test > icf_string_merge_test.stdout
279
280 check_SCRIPTS += icf_sht_rel_addend_test.sh
281 check_DATA += icf_sht_rel_addend_test.stdout
282 MOSTLYCLEANFILES += icf_sht_rel_addend_test
283 icf_sht_rel_addend_test_1.o: icf_sht_rel_addend_test_1.cc
284         $(CXXCOMPILE) -O0 -c -ffunction-sections -fPIC -g -o $@ $<
285 icf_sht_rel_addend_test_2.o: icf_sht_rel_addend_test_2.cc
286         $(CXXCOMPILE) -O0 -c -ffunction-sections -fPIC -g -o $@ $<
287 icf_sht_rel_addend_test: icf_sht_rel_addend_test_1.o icf_sht_rel_addend_test_2.o gcctestdir/ld
288         $(CXXLINK) -Bgcctestdir/ -Wl,--icf=all icf_sht_rel_addend_test_1.o icf_sht_rel_addend_test_2.o
289 icf_sht_rel_addend_test.stdout: icf_sht_rel_addend_test
290         $(TEST_NM) icf_sht_rel_addend_test > icf_sht_rel_addend_test.stdout
291
292 check_PROGRAMS += basic_test
293 check_PROGRAMS += basic_pic_test
294 basic_test.o: basic_test.cc
295         $(CXXCOMPILE) -O0 -c -o $@ $<
296 basic_test: basic_test.o gcctestdir/ld
297         $(CXXLINK) -Bgcctestdir/ basic_test.o
298
299 if HAVE_STATIC
300 check_PROGRAMS += basic_static_test
301 basic_static_test: basic_test.o gcctestdir/ld
302         $(CXXLINK) -Bgcctestdir/ -static basic_test.o
303 endif
304
305 basic_pic_test.o: basic_test.cc
306         $(CXXCOMPILE) -O0 -c -fpic -o $@ $<
307 basic_pic_test: basic_pic_test.o gcctestdir/ld
308         $(CXXLINK) -Bgcctestdir/ basic_pic_test.o
309
310 if HAVE_STATIC
311 check_PROGRAMS += basic_static_pic_test
312 basic_static_pic_test: basic_pic_test.o gcctestdir/ld
313         $(CXXLINK) -Bgcctestdir/ -static basic_pic_test.o
314 endif
315
316 check_PROGRAMS += basic_pie_test
317 basic_pie_test.o: basic_test.cc
318         $(CXXCOMPILE) -O0 -c -fpie -o $@ $<
319 basic_pie_test: basic_pie_test.o gcctestdir/ld
320         $(CXXLINK) -Bgcctestdir/ -pie basic_pie_test.o
321
322 check_PROGRAMS += constructor_test
323 constructor_test_SOURCES = constructor_test.cc
324 constructor_test_DEPENDENCIES = gcctestdir/ld
325 constructor_test_LDFLAGS = -Bgcctestdir/
326 constructor_test_LDADD =
327
328 if HAVE_STATIC
329 check_PROGRAMS += constructor_static_test
330 constructor_static_test_SOURCES = $(constructor_test_SOURCES)
331 constructor_static_test_DEPENDENCIES = $(constructor_test_DEPENDENCIES)
332 constructor_static_test_LDFLAGS = $(constructor_test_LDFLAGS) -static
333 constructor_static_test_LDADD = $(constructor_test_LDADD)
334 endif
335
336 check_PROGRAMS += two_file_test
337 check_PROGRAMS += two_file_pic_test
338 two_file_test_SOURCES = \
339         two_file_test_1.cc \
340         two_file_test_1b.cc \
341         two_file_test_2.cc \
342         two_file_test_main.cc \
343         two_file_test.h
344 two_file_test_DEPENDENCIES = gcctestdir/ld
345 two_file_test_LDFLAGS = -Bgcctestdir/
346 two_file_test_LDADD =
347
348 if HAVE_STATIC
349 check_PROGRAMS += two_file_static_test
350 two_file_static_test_SOURCES = $(two_file_test_SOURCES)
351 two_file_static_test_DEPENDENCIES = $(two_file_test_DEPENDENCIES)
352 two_file_static_test_LDFLAGS = $(two_file_test_LDFLAGS) -static
353 two_file_static_test_LDADD = $(two_file_test_LDADD)
354 endif
355
356 two_file_pic_test_SOURCES = two_file_test_main.cc
357 two_file_pic_test_DEPENDENCIES = \
358         gcctestdir/ld two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o
359 two_file_pic_test_LDFLAGS = -Bgcctestdir/
360 two_file_pic_test_LDADD = two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o
361
362
363 check_PROGRAMS += two_file_shared_1_test
364 check_PROGRAMS += two_file_shared_2_test
365 check_PROGRAMS += two_file_shared_1_pic_2_test
366 check_PROGRAMS += two_file_shared_2_pic_1_test
367 check_PROGRAMS += two_file_same_shared_test
368 check_PROGRAMS += two_file_separate_shared_12_test
369 check_PROGRAMS += two_file_separate_shared_21_test
370 two_file_test_1_pic.o: two_file_test_1.cc
371         $(CXXCOMPILE) -c -fpic -o $@ $<
372 two_file_test_1b_pic.o: two_file_test_1b.cc
373         $(CXXCOMPILE) -c -fpic -o $@ $<
374 two_file_test_2_pic.o: two_file_test_2.cc
375         $(CXXCOMPILE) -c -fpic -o $@ $<
376 two_file_shared_1.so: two_file_test_1_pic.o two_file_test_1b_pic.o gcctestdir/ld
377         $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1_pic.o two_file_test_1b_pic.o
378 two_file_shared_2.so: two_file_test_2_pic.o gcctestdir/ld
379         $(CXXLINK) -Bgcctestdir/ -shared two_file_test_2_pic.o
380 two_file_shared.so: two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o gcctestdir/ld
381         $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o
382
383 two_file_shared_1_test_SOURCES = two_file_test_2.cc two_file_test_main.cc
384 two_file_shared_1_test_DEPENDENCIES = gcctestdir/ld two_file_shared_1.so
385 two_file_shared_1_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
386 two_file_shared_1_test_LDADD = two_file_shared_1.so
387
388 two_file_shared_2_test_SOURCES = two_file_test_1.cc two_file_test_1b.cc two_file_test_main.cc
389 two_file_shared_2_test_DEPENDENCIES = gcctestdir/ld two_file_shared_2.so
390 two_file_shared_2_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
391 two_file_shared_2_test_LDADD = two_file_shared_2.so
392
393 two_file_shared_1_pic_2_test_SOURCES = two_file_test_main.cc
394 two_file_shared_1_pic_2_test_DEPENDENCIES = \
395         gcctestdir/ld two_file_shared_2.so two_file_test_1_pic.o two_file_test_1b_pic.o
396 two_file_shared_1_pic_2_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
397 two_file_shared_1_pic_2_test_LDADD = two_file_test_1_pic.o two_file_test_1b_pic.o two_file_shared_2.so
398
399 two_file_shared_2_pic_1_test_SOURCES = two_file_test_main.cc
400 two_file_shared_2_pic_1_test_DEPENDENCIES = \
401         gcctestdir/ld two_file_shared_2.so two_file_test_2_pic.o
402 two_file_shared_2_pic_1_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
403 two_file_shared_2_pic_1_test_LDADD = two_file_test_2_pic.o two_file_shared_1.so
404
405 two_file_same_shared_test_SOURCES = two_file_test_main.cc
406 two_file_same_shared_test_DEPENDENCIES = gcctestdir/ld two_file_shared.so
407 two_file_same_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
408 two_file_same_shared_test_LDADD = two_file_shared.so
409
410 two_file_separate_shared_12_test_SOURCES = two_file_test_main.cc
411 two_file_separate_shared_12_test_DEPENDENCIES = \
412         gcctestdir/ld two_file_shared_1.so two_file_shared_2.so
413 two_file_separate_shared_12_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
414 two_file_separate_shared_12_test_LDADD = \
415         two_file_shared_1.so two_file_shared_2.so
416
417 two_file_separate_shared_21_test_SOURCES = two_file_test_main.cc
418 two_file_separate_shared_21_test_DEPENDENCIES = \
419         gcctestdir/ld two_file_shared_1.so two_file_shared_2.so
420 two_file_separate_shared_21_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
421 two_file_separate_shared_21_test_LDADD = \
422         two_file_shared_2.so two_file_shared_1.so
423
424 check_PROGRAMS += two_file_relocatable_test
425 two_file_relocatable_test_SOURCES = two_file_test_main.cc
426 two_file_relocatable_test_DEPENDENCIES = \
427         gcctestdir/ld two_file_relocatable.o
428 two_file_relocatable_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
429 two_file_relocatable_test_LDADD = two_file_relocatable.o
430 two_file_relocatable.o: gcctestdir/ld two_file_test_1.o two_file_test_1b.o two_file_test_2.o
431         gcctestdir/ld -r -o $@ two_file_test_1.o two_file_test_1b.o two_file_test_2.o
432
433 check_PROGRAMS += two_file_pie_test
434 two_file_test_1_pie.o: two_file_test_1.cc
435         $(CXXCOMPILE) -c -fpie -o $@ $<
436 two_file_test_1b_pie.o: two_file_test_1b.cc
437         $(CXXCOMPILE) -c -fpie -o $@ $<
438 two_file_test_2_pie.o: two_file_test_2.cc
439         $(CXXCOMPILE) -c -fpie -o $@ $<
440 two_file_test_main_pie.o: two_file_test_main.cc
441         $(CXXCOMPILE) -c -fpie -o $@ $<
442 two_file_pie_test: two_file_test_1_pie.o two_file_test_1b_pie.o \
443                 two_file_test_2_pie.o two_file_test_main_pie.o gcctestdir/ld
444         $(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
445
446 check_SCRIPTS += two_file_shared.sh
447 check_DATA += two_file_shared.dbg
448 MOSTLYCLEANFILES += two_file_shared.dbg
449 two_file_shared.dbg: two_file_shared.so
450         $(TEST_READELF) -w $< >$@ 2>/dev/null
451
452 # The nonpic tests will fail on platforms which can not put non-PIC
453 # code into shared libraries, so we just don't run them in that case.
454 if FN_PTRS_IN_SO_WITHOUT_PIC
455
456 check_PROGRAMS += two_file_shared_1_nonpic_test
457 check_PROGRAMS += two_file_shared_2_nonpic_test
458 check_PROGRAMS += two_file_same_shared_nonpic_test
459 check_PROGRAMS += two_file_separate_shared_12_nonpic_test
460 check_PROGRAMS += two_file_separate_shared_21_nonpic_test
461 check_PROGRAMS += two_file_mixed_shared_test
462 check_PROGRAMS += two_file_mixed_2_shared_test
463 two_file_shared_1_nonpic.so: two_file_test_1.o gcctestdir/ld
464         $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1.o two_file_test_1b.o -Wl,-z,notext
465 two_file_shared_2_nonpic.so: two_file_test_2.o gcctestdir/ld
466         $(CXXLINK) -Bgcctestdir/ -shared two_file_test_2.o
467 two_file_shared_nonpic.so: two_file_test_1.o two_file_test_1b.o two_file_test_2.o gcctestdir/ld
468         $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1.o two_file_test_1b.o two_file_test_2.o -Wl,-z,notext
469 two_file_shared_mixed.so: two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2.o gcctestdir/ld
470         $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2.o -Wl,-z,notext
471 two_file_shared_mixed_1.so: two_file_test_1.o two_file_test_1b_pic.o two_file_shared_2.so gcctestdir/ld
472         $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1.o two_file_test_1b_pic.o two_file_shared_2.so -Wl,-z,notext
473
474 two_file_shared_1_nonpic_test_SOURCES = \
475         two_file_test_2.cc two_file_test_main.cc
476 two_file_shared_1_nonpic_test_DEPENDENCIES = \
477         gcctestdir/ld two_file_shared_1_nonpic.so
478 two_file_shared_1_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
479 two_file_shared_1_nonpic_test_LDADD = two_file_shared_1_nonpic.so
480
481 two_file_shared_2_nonpic_test_SOURCES = \
482         two_file_test_1.cc two_file_test_1b.cc two_file_test_main.cc
483 two_file_shared_2_nonpic_test_DEPENDENCIES = \
484         gcctestdir/ld two_file_shared_2_nonpic.so
485 two_file_shared_2_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
486 two_file_shared_2_nonpic_test_LDADD = two_file_shared_2_nonpic.so
487
488 two_file_same_shared_nonpic_test_SOURCES = two_file_test_main.cc
489 two_file_same_shared_nonpic_test_DEPENDENCIES = \
490         gcctestdir/ld two_file_shared_nonpic.so
491 two_file_same_shared_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
492 two_file_same_shared_nonpic_test_LDADD = two_file_shared_nonpic.so
493
494 two_file_separate_shared_12_nonpic_test_SOURCES = two_file_test_main.cc
495 two_file_separate_shared_12_nonpic_test_DEPENDENCIES = \
496         gcctestdir/ld two_file_shared_1_nonpic.so two_file_shared_2_nonpic.so
497 two_file_separate_shared_12_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
498 two_file_separate_shared_12_nonpic_test_LDADD = \
499         two_file_shared_1_nonpic.so two_file_shared_2_nonpic.so
500
501 two_file_separate_shared_21_nonpic_test_SOURCES = two_file_test_main.cc
502 two_file_separate_shared_21_nonpic_test_DEPENDENCIES = \
503         gcctestdir/ld two_file_shared_1_nonpic.so two_file_shared_2_nonpic.so
504 two_file_separate_shared_21_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
505 two_file_separate_shared_21_nonpic_test_LDADD = \
506         two_file_shared_2_nonpic.so two_file_shared_1_nonpic.so
507
508 two_file_mixed_shared_test_SOURCES = two_file_test_main.cc
509 two_file_mixed_shared_test_DEPENDENCIES = gcctestdir/ld two_file_shared_mixed.so
510 two_file_mixed_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
511 two_file_mixed_shared_test_LDADD = two_file_shared_mixed.so
512
513 two_file_mixed_2_shared_test_SOURCES = two_file_test_main.cc
514 two_file_mixed_2_shared_test_DEPENDENCIES = gcctestdir/ld two_file_shared_mixed_1.so two_file_shared_2.so
515 two_file_mixed_2_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
516 two_file_mixed_2_shared_test_LDADD = two_file_shared_mixed_1.so two_file_shared_2.so
517
518 check_PROGRAMS += two_file_mixed_pie_test
519 two_file_mixed_pie_test: two_file_test_1.o two_file_test_1b_pie.o \
520                 two_file_test_main_pie.o two_file_shared_2.so gcctestdir/ld
521         $(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
522
523 endif FN_PTRS_IN_SO_WITHOUT_PIC
524
525 check_PROGRAMS += two_file_strip_test
526 two_file_strip_test: two_file_test
527         $(TEST_STRIP) -o two_file_strip_test two_file_test
528
529 check_PROGRAMS += two_file_same_shared_strip_test
530 two_file_same_shared_strip_test_SOURCES = two_file_test_main.cc
531 two_file_same_shared_strip_test_DEPENDENCIES = \
532         gcctestdir/ld two_file_shared_strip.so
533 two_file_same_shared_strip_test_LDFLAGS = -Bgcctestdir/ -Wl,-R.
534 two_file_same_shared_strip_test_LDADD = two_file_shared_strip.so
535 two_file_shared_strip.so: two_file_shared.so
536         $(TEST_STRIP) -S -o two_file_shared_strip.so two_file_shared.so
537
538 check_PROGRAMS += common_test_1
539 common_test_1_SOURCES = common_test_1.c
540 common_test_1_DEPENDENCIES = gcctestdir/ld
541 common_test_1_LDFLAGS = -Bgcctestdir/
542 common_test_1_LDADD =
543
544 check_PROGRAMS += common_test_2
545 common_test_2_SOURCES = common_test_1.c
546 common_test_2_DEPENDENCIES = common_test_2.so common_test_3.so gcctestdir/ld
547 common_test_2_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
548 common_test_2_LDADD = common_test_2.so common_test_3.so
549 common_test_2_pic.o: common_test_2.c
550         $(COMPILE) -c -fpic -o $@ $<
551 common_test_2.so: common_test_2_pic.o common_test_3.so gcctestdir/ld
552         $(LINK) -Bgcctestdir/ -shared common_test_2_pic.o common_test_3.so
553 common_test_3_pic.o: common_test_3.c
554         $(COMPILE) -c -fpic -o $@ $<
555 common_test_3.so: common_test_3_pic.o ver_test_2.script gcctestdir/ld
556         $(LINK) -Bgcctestdir/ -shared common_test_3_pic.o -Wl,--version-script,$(srcdir)/ver_test_2.script
557
558 check_PROGRAMS += exception_test
559 check_PROGRAMS += exception_shared_1_test
560 check_PROGRAMS += exception_shared_2_test
561 check_PROGRAMS += exception_same_shared_test
562 check_PROGRAMS += exception_separate_shared_12_test
563 check_PROGRAMS += exception_separate_shared_21_test
564 exception_test_1_pic.o: exception_test_1.cc
565         $(CXXCOMPILE) -c -fpic -o $@ $<
566 exception_test_2_pic.o: exception_test_2.cc
567         $(CXXCOMPILE) -c -fpic -o $@ $<
568 exception_shared_1.so: exception_test_1_pic.o gcctestdir/ld
569         $(CXXLINK) -Bgcctestdir/ -shared exception_test_1_pic.o
570 exception_shared_2.so: exception_test_2_pic.o gcctestdir/ld
571         $(CXXLINK) -Bgcctestdir/ -shared exception_test_2_pic.o
572 exception_shared.so: exception_test_1_pic.o exception_test_2_pic.o gcctestdir/ld
573         $(CXXLINK) -Bgcctestdir/ -shared exception_test_1_pic.o exception_test_2_pic.o
574
575 exception_test_SOURCES = \
576         exception_test_main.cc \
577         exception_test_1.cc \
578         exception_test_2.cc \
579         exception_test.h
580 exception_test_DEPENDENCIES = gcctestdir/ld
581 exception_test_LDFLAGS = -Bgcctestdir/
582 exception_test_LDADD =
583
584 if HAVE_STATIC
585 check_PROGRAMS += exception_static_test
586 exception_static_test_SOURCES = $(exception_test_SOURCES)
587 exception_static_test_DEPENDENCIES = $(exception_test_DEPENDENCIES)
588 exception_static_test_LDFLAGS = $(exception_test_LDFLAGS) -static
589 exception_static_test_LDADD = $(exception_test_LDADD)
590 endif
591
592 exception_shared_1_test_SOURCES = exception_test_2.cc exception_test_main.cc
593 exception_shared_1_test_DEPENDENCIES = gcctestdir/ld exception_shared_1.so
594 exception_shared_1_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
595 exception_shared_1_test_LDADD = exception_shared_1.so
596
597 exception_shared_2_test_SOURCES = exception_test_1.cc exception_test_main.cc
598 exception_shared_2_test_DEPENDENCIES = gcctestdir/ld exception_shared_2.so
599 exception_shared_2_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
600 exception_shared_2_test_LDADD = exception_shared_2.so
601
602 exception_same_shared_test_SOURCES = exception_test_main.cc
603 exception_same_shared_test_DEPENDENCIES = gcctestdir/ld exception_shared.so
604 exception_same_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
605 exception_same_shared_test_LDADD = exception_shared.so
606
607 exception_separate_shared_12_test_SOURCES = exception_test_main.cc
608 exception_separate_shared_12_test_DEPENDENCIES = \
609         gcctestdir/ld exception_shared_1.so exception_shared_2.so
610 exception_separate_shared_12_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. \
611         -Wl,--no-as-needed
612 exception_separate_shared_12_test_LDADD = \
613         exception_shared_1.so exception_shared_2.so
614
615 exception_separate_shared_21_test_SOURCES = exception_test_main.cc
616 exception_separate_shared_21_test_DEPENDENCIES = \
617         gcctestdir/ld exception_shared_1.so exception_shared_2.so
618 exception_separate_shared_21_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. \
619         -Wl,--no-as-needed
620 exception_separate_shared_21_test_LDADD = \
621         exception_shared_2.so exception_shared_1.so
622
623
624 check_PROGRAMS += weak_test
625 weak_test_SOURCES = weak_test.cc
626 weak_test_DEPENDENCIES = gcctestdir/ld
627 weak_test_LDFLAGS = -Bgcctestdir/
628 weak_test_LDADD =
629
630 check_PROGRAMS += weak_undef_test
631 MOSTLYCLEANFILES += alt/weak_undef_lib.so
632 weak_undef_test_SOURCES = weak_undef_test.cc
633 weak_undef_test_DEPENDENCIES = gcctestdir/ld weak_undef_lib.so alt/weak_undef_lib.so
634 weak_undef_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,alt
635 weak_undef_test_LDADD = -L . weak_undef_lib.so
636 weak_undef_file1.o: weak_undef_file1.cc
637         $(CXXCOMPILE) -c -fpic -o $@ $<
638 weak_undef_file2.o: weak_undef_file2.cc
639         $(CXXCOMPILE) -c -fpic -o $@ $<
640 weak_undef_lib.so: weak_undef_file1.o
641         $(CXXLINK) -Bgcctestdir/ -shared weak_undef_file1.o
642 alt/weak_undef_lib.so: weak_undef_file2.o
643         test -d alt || mkdir -p alt
644         $(CXXLINK) -Bgcctestdir/ -shared weak_undef_file2.o
645
646 if FN_PTRS_IN_SO_WITHOUT_PIC
647 check_PROGRAMS += weak_undef_nonpic_test
648 MOSTLYCLEANFILES += alt/weak_undef_lib_nonpic.so
649 weak_undef_nonpic_test_SOURCES = weak_undef_test.cc
650 weak_undef_nonpic_test_DEPENDENCIES = gcctestdir/ld weak_undef_lib_nonpic.so alt/weak_undef_lib_nonpic.so
651 weak_undef_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,alt
652 weak_undef_nonpic_test_LDADD = -L . weak_undef_lib_nonpic.so
653 weak_undef_file1_nonpic.o: weak_undef_file1.cc
654         $(CXXCOMPILE) -c -o $@ $<
655 weak_undef_file2_nonpic.o: weak_undef_file2.cc
656         $(CXXCOMPILE) -c -o $@ $<
657 weak_undef_lib_nonpic.so: weak_undef_file1_nonpic.o
658         $(CXXLINK) -Bgcctestdir/ -shared weak_undef_file1_nonpic.o -Wl,-z,notext
659 alt/weak_undef_lib_nonpic.so: weak_undef_file2_nonpic.o
660         test -d alt || mkdir -p alt
661         $(CXXLINK) -Bgcctestdir/ -shared weak_undef_file2_nonpic.o -Wl,-z,notext
662 endif FN_PTRS_IN_SO_WITHOUT_PIC
663
664
665 check_PROGRAMS += weak_alias_test
666 weak_alias_test_SOURCES = weak_alias_test_main.cc
667 weak_alias_test_DEPENDENCIES = \
668         gcctestdir/ld weak_alias_test_1.so weak_alias_test_2.so \
669         weak_alias_test_3.o weak_alias_test_4.so weak_alias_test_5.so
670 weak_alias_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
671 weak_alias_test_LDADD = \
672         weak_alias_test_1.so weak_alias_test_2.so weak_alias_test_3.o \
673         weak_alias_test_4.so weak_alias_test_5.so
674 weak_alias_test_1_pic.o: weak_alias_test_1.cc
675         $(CXXCOMPILE) -c -fpic -o $@ $<
676 weak_alias_test_1.so: weak_alias_test_1_pic.o gcctestdir/ld
677         $(CXXLINK) -Bgcctestdir/ -shared weak_alias_test_1_pic.o
678 weak_alias_test_2_pic.o: weak_alias_test_2.cc
679         $(CXXCOMPILE) -c -fpic -o $@ $<
680 weak_alias_test_2.so: weak_alias_test_2_pic.o gcctestdir/ld
681         $(CXXLINK) -Bgcctestdir/ -shared weak_alias_test_2_pic.o
682 weak_alias_test_3.o: weak_alias_test_3.cc
683         $(CXXCOMPILE) -c -o $@ $<
684 weak_alias_test_4_pic.o: weak_alias_test_4.cc
685         $(CXXCOMPILE) -c -fpic -o $@ $<
686 weak_alias_test_4.so: weak_alias_test_4_pic.o gcctestdir/ld
687         $(CXXLINK) -Bgcctestdir/ -shared weak_alias_test_4_pic.o
688 weak_alias_test_5_pic.o: weak_alias_test_5.cc
689         $(CXXCOMPILE) -c -fpic -o $@ $<
690 weak_alias_test_5.so: weak_alias_test_5_pic.o $(srcdir)/weak_alias_test.script gcctestdir/ld
691         $(CXXLINK) -Bgcctestdir/ -shared weak_alias_test_5_pic.o \
692                 -Wl,--version-script,$(srcdir)/weak_alias_test.script
693
694 check_SCRIPTS += weak_plt.sh
695 check_PROGRAMS += weak_plt
696 check_DATA += weak_plt_shared.so
697 weak_plt_main_pic.o: weak_plt_main.cc
698         $(CXXCOMPILE) -c -fpic -o $@ $<
699 weak_plt: weak_plt_main_pic.o gcctestdir/ld
700         $(CXXLINK) -Bgcctestdir/ weak_plt_main_pic.o
701 weak_plt_shared_pic.o: weak_plt_shared.cc
702         $(CXXCOMPILE) -c -fpic -o $@ $<
703 weak_plt_shared.so: weak_plt_shared_pic.o gcctestdir/ld
704         $(CXXLINK) -Bgcctestdir/ -shared weak_plt_shared_pic.o
705
706 check_PROGRAMS += copy_test
707 copy_test_SOURCES = copy_test.cc
708 copy_test_DEPENDENCIES = gcctestdir/ld copy_test_1.so copy_test_2.so
709 copy_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
710 copy_test_LDADD = copy_test_1.so copy_test_2.so
711 copy_test_1_pic.o: copy_test_1.cc
712         $(CXXCOMPILE) -c -fpic -o $@ $<
713 copy_test_1.so: gcctestdir/ld copy_test_1_pic.o
714         $(CXXLINK) -Bgcctestdir/ -shared copy_test_1_pic.o
715 copy_test_2_pic.o: copy_test_2.cc
716         $(CXXCOMPILE) -c -fpic -o $@ $<
717 copy_test_2.so: gcctestdir/ld copy_test_2_pic.o
718         $(CXXLINK) -Bgcctestdir/ -shared copy_test_2_pic.o
719
720 if TLS
721
722 check_PROGRAMS += tls_test
723 check_PROGRAMS += tls_pic_test
724 check_PROGRAMS += tls_pie_test
725 check_PROGRAMS += tls_pie_pic_test
726 check_PROGRAMS += tls_shared_test
727 check_PROGRAMS += tls_shared_ie_test
728 check_PROGRAMS += tls_shared_gd_to_ie_test
729 tls_test_pic.o: tls_test.cc
730         $(CXXCOMPILE) -c -fpic -o $@ $<
731 tls_test_file2_pic.o: tls_test_file2.cc
732         $(CXXCOMPILE) -c -fpic -o $@ $<
733 tls_test_c_pic.o: tls_test_c.c
734         $(COMPILE) -c -fpic $(TLS_TEST_C_CFLAGS) -o $@ $<
735 tls_test_shared.so: tls_test_pic.o tls_test_file2_pic.o tls_test_c_pic.o gcctestdir/ld
736         $(CXXLINK) -Bgcctestdir/ -shared tls_test_pic.o tls_test_file2_pic.o tls_test_c_pic.o -Wl,-z,defs
737 tls_test_shared2.so: tls_test_file2_pic.o gcctestdir/ld
738         $(CXXLINK) -Bgcctestdir/ -shared tls_test_file2_pic.o
739
740 tls_test_pic_ie.o: tls_test.cc
741         $(CXXCOMPILE) -c -fpic -ftls-model=initial-exec -o $@ $<
742 tls_test_file2_pic_ie.o: tls_test_file2.cc
743         $(CXXCOMPILE) -c -fpic -ftls-model=initial-exec -o $@ $<
744 tls_test_c_pic_ie.o: tls_test_c.c
745         $(COMPILE) -c -fpic -ftls-model=initial-exec $(TLS_TEST_C_CFLAGS) -o $@ $<
746 tls_test_ie_shared.so: tls_test_pic_ie.o tls_test_file2_pic_ie.o tls_test_c_pic_ie.o gcctestdir/ld
747         $(CXXLINK) -Bgcctestdir/ -shared tls_test_pic_ie.o tls_test_file2_pic_ie.o tls_test_c_pic_ie.o
748
749 tls_test_SOURCES = tls_test.cc tls_test_file2.cc tls_test_main.cc tls_test.h
750 tls_test_DEPENDENCIES = gcctestdir/ld tls_test_c.o
751 tls_test_LDFLAGS = -Bgcctestdir/
752 tls_test_LDADD = tls_test_c.o -lpthread
753 tls_test_c.o: tls_test_c.c
754         $(COMPILE) -c $(TLS_TEST_C_CFLAGS) -o $@ $<
755
756 tls_pic_test_SOURCES = tls_test_main.cc
757 tls_pic_test_DEPENDENCIES = gcctestdir/ld tls_test_pic.o tls_test_file2_pic.o \
758         tls_test_c_pic.o
759 tls_pic_test_LDFLAGS = -Bgcctestdir/
760 tls_pic_test_LDADD = tls_test_pic.o tls_test_file2_pic.o tls_test_c_pic.o \
761         -lpthread
762
763 tls_test_main_pie.o: tls_test_main.cc tls_test.h
764         $(CXXCOMPILE) -c -fpie -o $@ $<
765 tls_test_pie.o: tls_test.cc tls_test.h
766         $(CXXCOMPILE) -c -fpie -o $@ $<
767 tls_test_file2_pie.o: tls_test_file2.cc tls_test.h
768         $(CXXCOMPILE) -c -fpie -o $@ $<
769 tls_test_c_pie.o: tls_test_c.c
770         $(COMPILE) -c -fpic $(TLS_TEST_C_CFLAGS) -o $@ $<
771 tls_pie_test: tls_test_main_pie.o tls_test_pie.o tls_test_file2_pie.o \
772                 tls_test_c_pie.o gcctestdir/ld
773         $(CXXLINK) -Bgcctestdir/ -pie tls_test_main_pie.o tls_test_pie.o tls_test_file2_pie.o tls_test_c_pie.o -lpthread
774
775 tls_pie_pic_test: tls_test_main_pie.o tls_test_pic.o tls_test_file2_pic.o \
776                 tls_test_c_pic.o gcctestdir/ld
777         $(CXXLINK) -Bgcctestdir/ -pie tls_test_main_pie.o tls_test_pic.o tls_test_file2_pic.o tls_test_c_pic.o -lpthread
778
779 tls_shared_test_SOURCES = tls_test_main.cc
780 tls_shared_test_DEPENDENCIES = gcctestdir/ld tls_test_shared.so
781 tls_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
782 tls_shared_test_LDADD = tls_test_shared.so -lpthread
783
784 tls_shared_ie_test_SOURCES = tls_test_main.cc
785 tls_shared_ie_test_DEPENDENCIES = gcctestdir/ld tls_test_ie_shared.so
786 tls_shared_ie_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
787 tls_shared_ie_test_LDADD = tls_test_ie_shared.so -lpthread
788
789 tls_shared_gd_to_ie_test_SOURCES = tls_test_main.cc
790 tls_shared_gd_to_ie_test_DEPENDENCIES = gcctestdir/ld tls_test_pic.o \
791         tls_test_c_pic.o tls_test_shared2.so
792 tls_shared_gd_to_ie_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
793 tls_shared_gd_to_ie_test_LDADD = tls_test_pic.o tls_test_c_pic.o \
794         tls_test_shared2.so -lpthread
795
796 if TLS_GNU2_DIALECT
797
798 check_PROGRAMS += tls_shared_gnu2_gd_to_ie_test
799
800 tls_test_gnu2.o: tls_test.cc
801         $(CXXCOMPILE) -c -fpic -mtls-dialect=gnu2 -o $@ $<
802 tls_test_file2_gnu2.o: tls_test_file2.cc
803         $(CXXCOMPILE) -c -fpic -mtls-dialect=gnu2 -o $@ $<
804 tls_test_c_gnu2.o: tls_test_c.c
805         $(COMPILE) -c -fpic -mtls-dialect=gnu2 $(TLS_TEST_C_CFLAGS) -o $@ $<
806 tls_test_gnu2_shared2.so: tls_test_file2_gnu2.o gcctestdir/ld
807         $(CXXLINK) -Bgcctestdir/ -shared tls_test_file2_gnu2.o
808
809 tls_shared_gnu2_gd_to_ie_test_SOURCES = tls_test_main.cc
810 tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES = gcctestdir/ld tls_test_gnu2.o \
811         tls_test_c_gnu2.o tls_test_gnu2_shared2.so
812 tls_shared_gnu2_gd_to_ie_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
813 tls_shared_gnu2_gd_to_ie_test_LDADD = tls_test_gnu2.o tls_test_c_gnu2.o \
814         tls_test_gnu2_shared2.so -lpthread
815
816 if TLS_DESCRIPTORS
817
818 check_PROGRAMS += tls_shared_gnu2_test
819
820 tls_test_gnu2_shared.so: tls_test_gnu2.o tls_test_file2_gnu2.o tls_test_c_gnu2.o gcctestdir/ld
821         $(CXXLINK) -Bgcctestdir/ -shared tls_test_gnu2.o tls_test_file2_gnu2.o tls_test_c_gnu2.o
822
823 tls_shared_gnu2_test_SOURCES = tls_test_main.cc
824 tls_shared_gnu2_test_DEPENDENCIES = gcctestdir/ld tls_test_gnu2_shared.so
825 tls_shared_gnu2_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
826 tls_shared_gnu2_test_LDADD = tls_test_gnu2_shared.so -lpthread
827
828 endif TLS_DESCRIPTORS
829
830 endif TLS_GNU2_DIALECT
831
832 if HAVE_STATIC
833 if STATIC_TLS
834 check_PROGRAMS += tls_static_test
835 check_PROGRAMS += tls_static_pic_test
836
837 tls_static_test_SOURCES = $(tls_test_SOURCES)
838 tls_static_test_DEPENDENCIES = $(tls_test_DEPENDENCIES)
839 tls_static_test_LDFLAGS = $(tls_test_LDFLAGS) -static
840 tls_static_test_LDADD = $(tls_test_LDADD)
841
842 tls_static_pic_test_SOURCES = $(tls_pic_test_SOURCES)
843 tls_static_pic_test_DEPENDENCIES = $(tls_pic_test_DEPENDENCIES)
844 tls_static_pic_test_LDFLAGS = $(tls_pic_test_LDFLAGS) -static
845 tls_static_pic_test_LDADD = $(tls_pic_test_LDADD)
846 endif
847 endif
848
849 if FN_PTRS_IN_SO_WITHOUT_PIC
850 check_PROGRAMS += tls_shared_nonpic_test
851 tls_test_shared_nonpic.so: tls_test.o tls_test_file2.o tls_test_c.o gcctestdir/ld
852         $(CXXLINK) -Bgcctestdir/ -shared tls_test.o tls_test_file2.o tls_test_c.o -Wl,-z,notext
853
854 tls_shared_nonpic_test_SOURCES = tls_test_main.cc
855 tls_shared_nonpic_test_DEPENDENCIES = gcctestdir/ld tls_test_shared_nonpic.so
856 tls_shared_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
857 tls_shared_nonpic_test_LDADD = tls_test_shared_nonpic.so -lpthread
858 endif FN_PTRS_IN_SO_WITHOUT_PIC
859
860 endif TLS
861
862 check_PROGRAMS += many_sections_test
863 many_sections_test_SOURCES = many_sections_test.cc
864 many_sections_test_DEPENDENCIES = gcctestdir/ld
865 many_sections_test_LDFLAGS = -Bgcctestdir/ -rdynamic
866 many_sections_test_LDADD =
867
868 BUILT_SOURCES += many_sections_define.h
869 MOSTLYCLEANFILES += many_sections_define.h
870 many_sections_define.h:
871         (for i in `seq 1 70000`; do \
872            echo "int var_$$i __attribute__((section(\"section_$$i\"))) = $$i;"; \
873          done) > $@.tmp
874         mv -f $@.tmp $@
875
876 BUILT_SOURCES += many_sections_check.h
877 MOSTLYCLEANFILES += many_sections_check.h
878 many_sections_check.h:
879         (for i in `seq 1 1000 70000`; do \
880            echo "assert(var_$$i == $$i);"; \
881          done) > $@.tmp
882         mv -f $@.tmp $@
883
884 check_PROGRAMS += many_sections_r_test
885 many_sections_r_test.o: many_sections_test.o gcctestdir/ld
886         gcctestdir/ld -r -o $@ many_sections_test.o
887 many_sections_r_test: many_sections_r_test.o gcctestdir/ld
888         $(CXXLINK) -Bgcctestdir/ many_sections_r_test.o $(LIBS)
889
890 check_PROGRAMS += initpri1
891 initpri1_SOURCES = initpri1.c
892 initpri1_DEPENDENCIES = gcctestdir/ld
893 initpri1_LDFLAGS = -Bgcctestdir/
894 initpri1_LDADD =
895
896 check_PROGRAMS += initpri2
897 initpri2_SOURCES = initpri2.c
898 initpri2_DEPENDENCIES = gcctestdir/ld
899 initpri2_LDFLAGS = -Bgcctestdir/ -Wl,--ctors-in-init-array
900 initpri2_LDADD =
901
902 check_PROGRAMS += initpri3a
903 initpri3a_SOURCES = initpri3.c
904 initpri3a_DEPENDENCIES = gcctestdir/ld
905 initpri3a_LDFLAGS = -Bgcctestdir/
906 initpri3a_LDADD =
907
908 # This test fails on targets not using .ctors and .dtors sections (e.g. ARM
909 # EABI). Given that gcc is moving towards using .init_array in all cases,
910 # this test is commented out.  A better fix would be checking whether gcc
911 # uses .ctors or .init_array sections in configure.
912
913 # check_PROGRAMS += initpri3b
914 # initpri3b_SOURCES = initpri3.c
915 # initpri3b_DEPENDENCIES = gcctestdir/ld
916 # initpri3b_LDFLAGS = -Bgcctestdir/ -Wl,--no-ctors-in-init-array
917 # initpri3b_LDADD =
918
919 # Test --detect-odr-violations
920 check_SCRIPTS += debug_msg.sh
921
922 # Create the data files that debug_msg.sh analyzes.
923 check_DATA += debug_msg.err
924 MOSTLYCLEANFILES += debug_msg.err
925 debug_msg.o: debug_msg.cc
926         $(CXXCOMPILE) -O0 -g -c -w -o $@ $(srcdir)/debug_msg.cc
927 odr_violation1.o: odr_violation1.cc
928         $(CXXCOMPILE) -O0 -g -c -w -o $@ $(srcdir)/odr_violation1.cc
929 # Compile with different optimization flags to check that rearranged
930 # instructions don't cause a false positive.
931 odr_violation2.o: odr_violation2.cc
932         $(CXXCOMPILE) -O2 -g -c -w -o $@ $(srcdir)/odr_violation2.cc
933 debug_msg.err: debug_msg.o odr_violation1.o odr_violation2.o gcctestdir/ld
934         @echo $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg debug_msg.o odr_violation1.o odr_violation2.o "2>$@"
935         @if $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg debug_msg.o odr_violation1.o odr_violation2.o 2>$@; \
936         then \
937           echo 1>&2 "Link of debug_msg should have failed"; \
938           rm -f $@; \
939           exit 1; \
940         fi
941
942
943 if HAVE_ZLIB
944
945 # Check that --detect-odr-violations works with compressed debug sections.
946 check_DATA += debug_msg_cdebug.err
947 MOSTLYCLEANFILES += debug_msg_cdebug.err
948 debug_msg_cdebug.o: debug_msg.cc gcctestdir/as
949         $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -Wa,--compress-debug-sections -c -w -o $@ $(srcdir)/debug_msg.cc
950 odr_violation1_cdebug.o: odr_violation1.cc gcctestdir/as
951         $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -Wa,--compress-debug-sections -c -w -o $@ $(srcdir)/odr_violation1.cc
952 odr_violation2_cdebug.o: odr_violation2.cc gcctestdir/as
953         $(CXXCOMPILE) -Bgcctestdir/ -O2 -g -Wa,--compress-debug-sections -c -w -o $@ $(srcdir)/odr_violation2.cc
954 debug_msg_cdebug.err: debug_msg_cdebug.o odr_violation1_cdebug.o odr_violation2_cdebug.o gcctestdir/ld
955         @echo $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_cdebug debug_msg_cdebug.o odr_violation1_cdebug.o odr_violation2_cdebug.o "2>$@"
956         @if $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_cdebug debug_msg_cdebug.o odr_violation1_cdebug.o odr_violation2_cdebug.o 2>$@; \
957         then \
958           echo 1>&2 "Link of debug_msg_cdebug should have failed"; \
959           rm -f $@; \
960           exit 1; \
961         fi
962
963 endif HAVE_ZLIB
964
965 # See if we can also detect problems when we're linking .so's, not .o's.
966 check_DATA += debug_msg_so.err
967 MOSTLYCLEANFILES += debug_msg_so.err
968 debug_msg.so: debug_msg.cc gcctestdir/ld
969         $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -shared -fPIC -w -o $@ $(srcdir)/debug_msg.cc
970 odr_violation1.so: odr_violation1.cc gcctestdir/ld
971         $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -shared -fPIC -w -o $@ $(srcdir)/odr_violation1.cc
972 odr_violation2.so: odr_violation2.cc gcctestdir/ld
973         $(CXXCOMPILE) -Bgcctestdir/ -O2 -g -shared -fPIC -w -o $@ $(srcdir)/odr_violation2.cc
974 debug_msg_so.err: debug_msg.so odr_violation1.so odr_violation2.so gcctestdir/ld
975         @echo $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_so debug_msg.so odr_violation1.so odr_violation2.so "2>$@"
976         @if $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_so debug_msg.so odr_violation1.so odr_violation2.so 2>$@; \
977         then \
978           echo 1>&2 "Link of debug_msg_so should have failed"; \
979           rm -f $@; \
980           exit 1; \
981         fi
982
983 # We also want to make sure we do something reasonable when there's no
984 # debug info available.  For the best test, we use .so's.
985 check_DATA += debug_msg_ndebug.err
986 MOSTLYCLEANFILES += debug_msg_ndebug.err
987 debug_msg_ndebug.so: debug_msg.cc gcctestdir/ld
988         $(CXXCOMPILE) -Bgcctestdir/ -O0 -g0 -shared -fPIC -w -o $@ $(srcdir)/debug_msg.cc
989 odr_violation1_ndebug.so: odr_violation1.cc gcctestdir/ld
990         $(CXXCOMPILE) -Bgcctestdir/ -O0 -g0 -shared -fPIC -w -o $@ $(srcdir)/odr_violation1.cc
991 odr_violation2_ndebug.so: odr_violation2.cc gcctestdir/ld
992         $(CXXCOMPILE) -Bgcctestdir/ -O2 -g0 -shared -fPIC -w -o $@ $(srcdir)/odr_violation2.cc
993 debug_msg_ndebug.err: debug_msg_ndebug.so odr_violation1_ndebug.so odr_violation2_ndebug.so gcctestdir/ld
994         @echo $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_ndebug debug_msg_ndebug.so odr_violation1_ndebug.so odr_violation2_ndebug.so "2>$@"
995         @if $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_ndebug debug_msg_ndebug.so odr_violation1_ndebug.so odr_violation2_ndebug.so 2>$@; \
996         then \
997           echo 1>&2 "Link of debug_msg_ndebug should have failed"; \
998           rm -f $@; \
999           exit 1; \
1000         fi
1001
1002
1003 # Similar to --detect-odr-violations: check for undefined symbols in .so's
1004 check_SCRIPTS += undef_symbol.sh
1005 check_DATA += undef_symbol.err
1006 MOSTLYCLEANFILES += undef_symbol.err
1007 undef_symbol.o: undef_symbol.cc
1008         $(CXXCOMPILE) -O0 -g -c -fPIC $<
1009 undef_symbol.so: undef_symbol.o gcctestdir/ld
1010         $(CXXLINK) -Bgcctestdir/ -shared undef_symbol.o
1011 undef_symbol.err: undef_symbol_main.o undef_symbol.so gcctestdir/ld
1012         @echo $(CXXLINK) -Bgcctestdir/ -o undef_symbol_test undef_symbol_main.o undef_symbol.so "2>$@"
1013         @if $(CXXLINK) -Bgcctestdir/ -o undef_symbol_test undef_symbol_main.o undef_symbol.so 2>$@; \
1014         then \
1015           echo 1>&2 "Link of undef_symbol_test should have failed"; \
1016           rm -f $@; \
1017           exit 1; \
1018         fi
1019
1020
1021 # Test -o when emitting to a special file (such as something in /dev).
1022 check_PROGRAMS += flagstest_o_specialfile
1023 flagstest_o_specialfile: flagstest_debug.o gcctestdir/ld
1024         $(CXXLINK) -Bgcctestdir/ -o /dev/stdout $< 2>&1 | cat > $@
1025         chmod a+x $@
1026         test -s $@
1027
1028 if HAVE_ZLIB
1029
1030 # Test --compress-debug-sections.  FIXME: check we actually compress.
1031 check_PROGRAMS += flagstest_compress_debug_sections
1032 flagstest_compress_debug_sections: flagstest_debug.o gcctestdir/ld
1033         $(CXXLINK) -Bgcctestdir/ -o $@ $< -Wl,--compress-debug-sections=zlib
1034         test -s $@
1035
1036
1037 # The specialfile output has a tricky case when we also compress debug
1038 # sections, because it requires output-file resizing.
1039 check_PROGRAMS += flagstest_o_specialfile_and_compress_debug_sections
1040 flagstest_o_specialfile_and_compress_debug_sections: flagstest_debug.o \
1041                 gcctestdir/ld
1042         $(CXXLINK) -Bgcctestdir/ -o /dev/stdout $< -Wl,--compress-debug-sections=zlib 2>&1 | cat > $@
1043         chmod a+x $@
1044         test -s $@
1045
1046 endif HAVE_ZLIB
1047
1048 # Test -TText and -Tdata.
1049 check_PROGRAMS += flagstest_o_ttext_1
1050 flagstest_o_ttext_1: flagstest_debug.o gcctestdir/ld
1051         $(CXXLINK) -Bgcctestdir/ -o $@ $< -Wl,-Ttext,0x400000 -Wl,-Tdata,0x800000
1052
1053 # This version won't be runnable, because there is no way to put the
1054 # PT_PHDR segment at file offset 0.  We just make sure that we can
1055 # build it without error.
1056 check_DATA += flagstest_o_ttext_2
1057 flagstest_o_ttext_2: flagstest_debug.o gcctestdir/ld
1058         $(CXXLINK) -Bgcctestdir/ -o $@ $< -Wl,-Ttext,0x400010 -Wl,-Tdata,0x800010
1059
1060 # Test symbol versioning.
1061 check_PROGRAMS += ver_test
1062 ver_test_SOURCES = ver_test_main.cc
1063 ver_test_DEPENDENCIES = gcctestdir/ld ver_test_1.so ver_test_2.so ver_test_4.so
1064 ver_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1065 ver_test_LDADD = ver_test_1.so ver_test_2.so ver_test_4.so
1066 ver_test_1.so: ver_test_1.o ver_test_2.so ver_test_3.o ver_test_4.so gcctestdir/ld
1067         $(CXXLINK) -Bgcctestdir/ -shared ver_test_1.o ver_test_2.so ver_test_3.o ver_test_4.so
1068 ver_test_2.so: ver_test_2.o $(srcdir)/ver_test_2.script ver_test_4.so gcctestdir/ld
1069         $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_2.script -Wl,-R,. ver_test_2.o ver_test_4.so
1070 ver_test_4.so: ver_test_4.o $(srcdir)/ver_test_4.script gcctestdir/ld
1071         $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_4.script ver_test_4.o
1072 ver_test_1.o: ver_test_1.cc
1073         $(CXXCOMPILE) -c -fpic -o $@ $<
1074 ver_test_2.o: ver_test_2.cc
1075         $(CXXCOMPILE) -c -fpic -o $@ $<
1076 ver_test_3.o: ver_test_3.cc
1077         $(CXXCOMPILE) -c -fpic -o $@ $<
1078 ver_test_4.o: ver_test_4.cc
1079         $(CXXCOMPILE) -c -fpic -o $@ $<
1080
1081 check_SCRIPTS += ver_test_1.sh
1082 check_DATA += ver_test_1.syms
1083 ver_test_1.syms: ver_test_1.so
1084         $(TEST_READELF) -s $< >$@ 2>/dev/null
1085
1086 check_PROGRAMS += ver_test_2
1087 ver_test_2_SOURCES = ver_test_main_2.cc
1088 ver_test_2_DEPENDENCIES = gcctestdir/ld ver_test_4.so ver_test_2.so
1089 ver_test_2_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1090 ver_test_2_LDADD = ver_test_4.so ver_test_2.so
1091
1092 check_SCRIPTS += ver_test_2.sh
1093 check_DATA += ver_test_2.syms
1094 ver_test_2.syms: ver_test_2
1095         $(TEST_READELF) -s $< >$@ 2>/dev/null
1096
1097 check_SCRIPTS += ver_test_4.sh
1098 check_DATA += ver_test_4.syms
1099 ver_test_4.syms: ver_test_4.so
1100         $(TEST_READELF) -s $< >$@ 2>/dev/null
1101
1102 ver_test_5.so: ver_test_5.o $(srcdir)/ver_test_5.script ver_test_4.so gcctestdir/ld
1103         $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_5.script ver_test_5.o ver_test_4.so
1104 ver_test_5.o: ver_test_5.cc
1105         $(CXXCOMPILE) -c -fpic -o $@ $<
1106 check_SCRIPTS += ver_test_5.sh
1107 check_DATA += ver_test_5.syms
1108 ver_test_5.syms: ver_test_5.so
1109         $(TEST_READELF) -s $< >$@ 2>/dev/null
1110
1111 check_PROGRAMS += ver_test_6
1112 ver_test_6_SOURCES = ver_test_6.c
1113 ver_test_6_DEPENDENCIES = gcctestdir/ld ver_test_2.so
1114 ver_test_6_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1115 ver_test_6_LDADD = ver_test_2.so
1116
1117 ver_test_7.so: ver_test_4.o $(srcdir)/ver_test_4.script ver_test_7.o gcctestdir/ld
1118         $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_4.script ver_test_4.o ver_test_7.o
1119 ver_test_7.o: ver_test_7.cc
1120         $(CXXCOMPILE) -c -fpic -o $@ $<
1121 check_SCRIPTS += ver_test_7.sh
1122 check_DATA += ver_test_7.syms
1123 ver_test_7.syms: ver_test_7.so
1124         $(TEST_READELF) -s $< >$@ 2>/dev/null
1125
1126 check_PROGRAMS += ver_test_8
1127 ver_test_8_SOURCES = two_file_test_main.cc
1128 ver_test_8_DEPENDENCIES = gcctestdir/ld ver_test_8_1.so ver_test_8_2.so
1129 ver_test_8_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1130 ver_test_8_LDADD = ver_test_8_1.so ver_test_8_2.so
1131 ver_test_8_1.so: two_file_test_1_pic.o two_file_test_1b_pic.o ver_test_8_2.so gcctestdir/ld
1132         $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1_pic.o two_file_test_1b_pic.o ver_test_8_2.so
1133 ver_test_8_2.so: two_file_test_2_pic.o $(srcdir)/ver_test_8.script gcctestdir/ld
1134         $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_8.script two_file_test_2_pic.o
1135
1136 check_PROGRAMS += ver_test_9
1137 ver_test_9_SOURCES = ver_test_main.cc
1138 ver_test_9_DEPENDENCIES = gcctestdir/ld ver_test_9.so
1139 ver_test_9_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1140 ver_test_9_LDADD = ver_test_9.so
1141 ver_test_9.so: ver_test_9.o ver_test_4.so ver_test_5.so gcctestdir/ld
1142         $(CXXLINK) -Bgcctestdir/ -shared -Wl,-R,. ver_test_9.o ver_test_5.so ver_test_4.so
1143 ver_test_9.o: ver_test_9.cc
1144         $(CXXCOMPILE) -c -fpic -o $@ $<
1145
1146 check_SCRIPTS += ver_test_10.sh
1147 check_DATA += ver_test_10.syms
1148 ver_test_10.syms: ver_test_10.so
1149         $(TEST_READELF) -s $< >$@ 2>/dev/null
1150 ver_test_10.so: gcctestdir/ld ver_test_2.o ver_test_10.script
1151         $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_10.script ver_test_2.o
1152
1153 check_PROGRAMS += ver_test_11
1154 MOSTLYCLEANFILES += ver_test_11.a
1155 ver_test_11_SOURCES = ver_test_main_2.cc
1156 ver_test_11_DEPENDENCIES = gcctestdir/ld ver_test_11.a
1157 ver_test_11_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1158 ver_test_11_LDADD = ver_test_11.a
1159 ver_test_11.a: ver_test_1.o ver_test_2.o ver_test_4.o
1160         $(TEST_AR) rc $@ $^
1161
1162 check_PROGRAMS += ver_test_12
1163 ver_test_12_SOURCES = ver_test_main_2.cc
1164 ver_test_12_DEPENDENCIES = gcctestdir/ld ver_test_12.o
1165 ver_test_12_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1166 ver_test_12_LDADD = ver_test_12.o
1167 ver_test_12.o: gcctestdir/ld ver_test_1.o ver_test_2.o ver_test_4.o
1168         gcctestdir/ld -r -o $@ ver_test_1.o ver_test_2.o ver_test_4.o
1169
1170 check_PROGRAMS += protected_1
1171 protected_1_SOURCES = \
1172         protected_main_1.cc protected_main_2.cc protected_main_3.cc
1173 protected_1_DEPENDENCIES = gcctestdir/ld protected_1.so
1174 protected_1_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1175 protected_1_LDADD = protected_1.so
1176
1177 protected_1.so: gcctestdir/ld protected_1_pic.o protected_2_pic.o protected_3_pic.o
1178         $(CXXLINK) -Bgcctestdir/ -shared protected_1_pic.o protected_2_pic.o protected_3_pic.o
1179 protected_1_pic.o: protected_1.cc
1180         $(CXXCOMPILE) -c -fpic -o $@ $<
1181 protected_2_pic.o: protected_2.cc
1182         $(CXXCOMPILE) -c -fpic -o $@ $<
1183 protected_3_pic.o: protected_3.cc
1184         $(CXXCOMPILE) -c -fpic -o $@ $<
1185
1186 check_PROGRAMS += protected_2
1187 protected_2_SOURCES = protected_main_1.cc protected_3.cc
1188 protected_2_DEPENDENCIES = gcctestdir/ld protected_1.so
1189 protected_2_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1190 protected_2_LDADD = protected_1.so
1191
1192 check_DATA += protected_3.err
1193 MOSTLYCLEANFILES += protected_3.err
1194 protected_4_pic.o: protected_4.cc
1195         $(CXXCOMPILE) -c -fpic -o $@ $<
1196 protected_3.err: protected_4_pic.o gcctestdir/ld
1197         @echo $(CXXLINK) -Bgcctestdir/ -shared -o protected_4.so protected_4_pic.o "2>$@"
1198         @if $(CXXLINK) -Bgcctestdir/ -shared -o protected_4.so protected_4_pic.o 2>$@; then \
1199           echo 1>&2 "Link of protected_4.so should have failed"; \
1200           rm -f $@; \
1201           exit 1; \
1202         fi
1203
1204 check_PROGRAMS += relro_test
1205 check_SCRIPTS += relro_test.sh
1206 check_DATA += relro_test.stdout
1207 relro_test_SOURCES = relro_test_main.cc
1208 relro_test_DEPENDENCIES = gcctestdir/ld relro_test.so
1209 relro_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1210 relro_test_LDADD = relro_test.so
1211 relro_test.so: gcctestdir/ld relro_test_pic.o
1212         $(CXXLINK) -Bgcctestdir/ -shared -Wl,-z,relro relro_test_pic.o
1213 relro_test_pic.o: relro_test.cc
1214         $(CXXCOMPILE) -c -fpic -o $@ $<
1215 relro_test.stdout: relro_test.so
1216         $(TEST_READELF) -SlW relro_test.so > relro_test.stdout
1217
1218 check_PROGRAMS += relro_now_test
1219 relro_now_test_SOURCES = relro_test_main.cc
1220 relro_now_test_DEPENDENCIES = gcctestdir/ld relro_now_test.so
1221 relro_now_test_LDFLAGS = -Bgcctestdir -Wl,-R,. -Wl,-z,relro -Wl,-z,now
1222 relro_now_test_LDADD = relro_now_test.so
1223 relro_now_test.so: gcctestdir/ld relro_test_pic.o
1224         $(CXXLINK) -Bgcctestdir/ -shared -Wl,-z,relro -Wl,-z,now relro_test_pic.o
1225
1226 check_PROGRAMS += relro_strip_test
1227 relro_strip_test_SOURCES = relro_test_main.cc
1228 relro_strip_test_DEPENDENCIES = gcctestdir/ld relro_strip_test.so
1229 relro_strip_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1230 relro_strip_test_LDADD = relro_strip_test.so
1231 relro_strip_test.so: relro_test.so
1232         $(TEST_STRIP) -o $@ $<
1233
1234 check_PROGRAMS += relro_script_test
1235 relro_script_test_SOURCES = relro_test_main.cc
1236 relro_script_test_DEPENDENCIES = gcctestdir/ld relro_script_test.so
1237 relro_script_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1238 relro_script_test_LDADD = relro_script_test.so
1239 relro_script_test.so: gcctestdir/ld relro_script_test.t relro_test_pic.o
1240         $(CXXLINK) -Bgcctestdir/ -shared -Wl,-z,relro -T $(srcdir)/relro_script_test.t relro_test_pic.o
1241
1242 check_PROGRAMS += script_test_1
1243 script_test_1_SOURCES = script_test_1.cc
1244 script_test_1_DEPENDENCIES = gcctestdir/ld script_test_1.t
1245 script_test_1_LDFLAGS = -Bgcctestdir/ -Wl,-R,. -T $(srcdir)/script_test_1.t
1246 script_test_1_LDADD =
1247
1248 check_PROGRAMS += script_test_2
1249 script_test_2_SOURCES = script_test_2.cc script_test_2a.cc script_test_2b.cc
1250 script_test_2_DEPENDENCIES = gcctestdir/ld script_test_2.t
1251 script_test_2_LDFLAGS = -Bgcctestdir/ -Wl,-R,. -T $(srcdir)/script_test_2.t
1252 script_test_2_LDADD =
1253
1254 check_PROGRAMS += justsyms
1255 justsyms_SOURCES = justsyms_1.cc
1256 justsyms_DEPENDENCIES = gcctestdir/ld justsyms_2r.o
1257 justsyms_LDFLAGS = -Bgcctestdir/ -Wl,-R,justsyms_2r.o
1258 justsyms_LDADD =
1259 justsyms_2.o: justsyms_2.cc
1260         $(CXXCOMPILE) -c -o $@ $<
1261 justsyms_2r.o: justsyms_2.o gcctestdir/ld $(srcdir)/justsyms.t
1262         gcctestdir/ld -o $@ -r -T $(srcdir)/justsyms.t justsyms_2.o
1263
1264 check_PROGRAMS += justsyms_exec
1265 justsyms_exec_SOURCES = justsyms_exec.c
1266 justsyms_exec_DEPENDENCIES = gcctestdir/ld justsyms_lib
1267 justsyms_exec_LDFLAGS = -Bgcctestdir/ -Wl,-R,justsyms_lib
1268 justsyms_exec_LDADD =
1269 justsyms_lib.o: justsyms_lib.c
1270         $(COMPILE) -c -o $@ $<
1271 justsyms_lib: justsyms_lib.o gcctestdir/ld
1272         gcctestdir/ld -o $@ -Ttext=0x1000200 -Tdata=0x2000000 -e exported_func justsyms_lib.o
1273
1274 check_PROGRAMS += binary_test
1275 MOSTLYCLEANFILES += binary.txt
1276 binary_test_SOURCES = binary_test.cc
1277 binary_test_DEPENDENCIES = gcctestdir/ld binary.txt
1278 binary_test_LDFLAGS = -Bgcctestdir/ -Wl,--format,binary,binary.txt,--format,elf
1279 binary_test_LDADD =
1280 # Copy the file to the build directory to avoid worrying about the
1281 # full pathname in the generated symbols.
1282 binary.txt: $(srcdir)/binary.in
1283         rm -f $@
1284         $(LN_S) $< $@
1285
1286 check_SCRIPTS += ver_matching_test.sh
1287 check_DATA += ver_matching_test.stdout
1288 MOSTLYCLEANFILES += ver_matching_test.stdout
1289 ver_matching_def.so: ver_matching_def_pic.o $(srcdir)/version_script.map gcctestdir/ld
1290         $(CXXLINK) -O0 -Bgcctestdir/ -shared ver_matching_def_pic.o -Wl,--version-script=$(srcdir)/version_script.map
1291 ver_matching_def_pic.o: ver_matching_def.cc
1292         $(CXXCOMPILE) -O0 -c -fpic -o $@ $<
1293 ver_matching_test.stdout: ver_matching_def.so
1294         $(TEST_OBJDUMP) -T ver_matching_def.so | $(TEST_CXXFILT) > ver_matching_test.stdout
1295
1296 check_PROGRAMS += script_test_3
1297 check_SCRIPTS += script_test_3.sh
1298 check_DATA += script_test_3.stdout
1299 MOSTLYCLEANFILES += script_test_3.stdout
1300 script_test_3: basic_test.o gcctestdir/ld script_test_3.t
1301         $(CXXLINK) -Bgcctestdir/ basic_test.o -T $(srcdir)/script_test_3.t
1302 script_test_3.stdout: script_test_3
1303         $(TEST_READELF) -SlW script_test_3 > script_test_3.stdout
1304
1305 check_PROGRAMS += tls_phdrs_script_test
1306 tls_phdrs_script_test_SOURCES = $(tls_test_SOURCES)
1307 tls_phdrs_script_test_DEPENDENCIES = $(tls_test_DEPENDENCIES) $(srcdir)/script_test_3.t
1308 tls_phdrs_script_test_LDFLAGS = $(tls_test_LDFLAGS) -T $(srcdir)/script_test_3.t
1309 tls_phdrs_script_test_LDADD = $(tls_test_LDADD)
1310
1311 check_SCRIPTS += script_test_4.sh
1312 check_DATA += script_test_4.stdout
1313 MOSTLYCLEANFILES += script_test_4
1314 script_test_4: basic_test.o gcctestdir/ld $(srcdir)/script_test_4.t
1315         $(CXXLINK) -Bgcctestdir/ basic_test.o -T $(srcdir)/script_test_4.t
1316 script_test_4.stdout: script_test_4
1317         $(TEST_READELF) -SlW script_test_4 > script_test_4.stdout
1318
1319 check_PROGRAMS += tls_script_test
1320 tls_script_test_SOURCES = $(tls_test_SOURCES)
1321 tls_script_test_DEPENDENCIES = $(tls_test_DEPENDENCIES) $(srcdir)/script_test_4.t
1322 tls_script_test_LDFLAGS = $(tls_test_LDFLAGS) -T $(srcdir)/script_test_4.t
1323 tls_script_test_LDADD = $(tls_test_LDADD)
1324
1325 check_SCRIPTS += script_test_5.sh
1326 check_DATA += script_test_5.stdout
1327 MOSTLYCLEANFILES += script_test_5
1328 script_test_5: script_test_5.o gcctestdir/ld $(srcdir)/script_test_5.t
1329         $(CXXLINK) -Bgcctestdir/ script_test_5.o -T $(srcdir)/script_test_5.t
1330 script_test_5.stdout: script_test_5
1331         $(TEST_READELF) -SW script_test_5 > script_test_5.stdout
1332
1333 check_SCRIPTS += script_test_6.sh
1334 check_DATA += script_test_6.stdout
1335 MOSTLYCLEANFILES += script_test_6
1336 script_test_6: basic_test.o gcctestdir/ld $(srcdir)/script_test_6.t
1337         $(CXXLINK) -Bgcctestdir/ basic_test.o -T $(srcdir)/script_test_6.t \
1338         -Wl,-Ttext=0x10001000 -Wl,-Tdata=0x10200000 -Wl,-Tbss=0x10400000
1339 script_test_6.stdout: script_test_6
1340         $(TEST_READELF) -SlW script_test_6 > script_test_6.stdout
1341
1342 check_SCRIPTS += script_test_7.sh
1343 check_DATA += script_test_7.stdout
1344 MOSTLYCLEANFILES += script_test_7
1345 script_test_7: basic_test.o gcctestdir/ld $(srcdir)/script_test_7.t
1346         $(CXXLINK) -Bgcctestdir/ basic_test.o -T $(srcdir)/script_test_7.t
1347 script_test_7.stdout: script_test_7
1348         $(TEST_READELF) -SlW script_test_7 > script_test_7.stdout
1349
1350 check_SCRIPTS += script_test_8.sh
1351 check_DATA += script_test_8.stdout
1352 MOSTLYCLEANFILES += script_test_8
1353 script_test_8: basic_test.o gcctestdir/ld $(srcdir)/script_test_7.t
1354         $(CXXLINK) -Bgcctestdir/ basic_test.o -T $(srcdir)/script_test_7.t \
1355         -Wl,-Ttext=0x20001000 -Wl,-Tdata=0x20200000 -Wl,-Tbss=0x20400000
1356 script_test_8.stdout: script_test_8
1357         $(TEST_READELF) -SlW script_test_8 > script_test_8.stdout
1358
1359
1360 check_SCRIPTS += script_test_9.sh
1361 check_DATA += script_test_9.stdout
1362 script_test_9.o: script_test_9.cc
1363         $(CXXCOMPILE) -O0 -c -o $@ $<
1364 script_test_9: gcctestdir/ld $(srcdir)/script_test_9.t script_test_9.o
1365         $(CXXLINK) -Bgcctestdir/ script_test_9.o -T $(srcdir)/script_test_9.t
1366 script_test_9.stdout: script_test_9
1367         $(TEST_READELF) -lW script_test_9 > script_test_9.stdout
1368
1369
1370 # Test --dynamic-list, --dynamic-list-data, --dynamic-list-cpp-new,
1371 # and --dynamic-list-cpp-typeinfo
1372
1373 check_SCRIPTS += dynamic_list.sh
1374 check_DATA += dynamic_list.stdout
1375 MOSTLYCLEANFILES += dynamic_list dynamic_list.stdout
1376 dynamic_list: basic_test.o gcctestdir/ld $(srcdir)/dynamic_list.t
1377         $(CXXLINK) -Bgcctestdir/ basic_test.o \
1378           -Wl,--dynamic-list $(srcdir)/dynamic_list.t \
1379           -Wl,--dynamic-list-data \
1380           -Wl,--dynamic-list-cpp-new \
1381           -Wl,--dynamic-list-cpp-typeinfo
1382 dynamic_list.stdout: dynamic_list
1383         $(TEST_READELF) -W --dyn-syms dynamic_list > dynamic_list.stdout
1384
1385 check_PROGRAMS += thin_archive_test_1
1386 MOSTLYCLEANFILES += libthin1.a libthin3.a libthinall.a \
1387         alt/thin_archive_test_2.o alt/thin_archive_test_4.o \
1388         alt/libthin2.a alt/libthin4.a
1389 thin_archive_test_1_SOURCES = thin_archive_main.cc
1390 thin_archive_test_1_DEPENDENCIES = gcctestdir/ld libthin1.a alt/libthin2.a
1391 thin_archive_test_1_LDFLAGS = -Bgcctestdir/ -Lalt
1392 thin_archive_test_1_LDADD = libthin1.a -lthin2
1393
1394 check_PROGRAMS += thin_archive_test_2
1395 thin_archive_test_2_SOURCES = thin_archive_main.cc
1396 thin_archive_test_2_DEPENDENCIES = gcctestdir/ld libthinall.a
1397 thin_archive_test_2_LDFLAGS = -Bgcctestdir/ -L.
1398 thin_archive_test_2_LDADD = -lthinall
1399
1400 libthin1.a: thin_archive_test_1.o alt/thin_archive_test_2.o
1401         rm -f $@
1402         $(TEST_AR) crT $@ $^
1403 alt/libthin2.a: thin_archive_test_3.o alt/thin_archive_test_4.o
1404         rm -f $@
1405         $(TEST_AR) crT $@ $^
1406 libthin3.a: thin_archive_test_1.o alt/thin_archive_test_4.o
1407         rm -f $@
1408         $(TEST_AR) crT $@ $^
1409 alt/libthin4.a: alt/thin_archive_test_2.o thin_archive_test_3.o
1410         rm -f $@
1411         $(TEST_AR) crT $@ $^
1412 libthinall.a: libthin3.a alt/libthin4.a
1413         rm -f $@
1414         $(TEST_AR) crT $@ $^
1415 alt/thin_archive_test_2.o: thin_archive_test_2.cc
1416         test -d alt || mkdir -p alt
1417         $(CXXCOMPILE) -c -o $@ $<
1418 alt/thin_archive_test_4.o: thin_archive_test_4.cc
1419         test -d alt || mkdir -p alt
1420         $(CXXCOMPILE) -c -o $@ $<
1421
1422 if PLUGINS
1423
1424 check_PROGRAMS += plugin_test_1
1425 check_SCRIPTS += plugin_test_1.sh
1426 check_DATA += plugin_test_1.err
1427 MOSTLYCLEANFILES += plugin_test_1.err
1428 plugin_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
1429         $(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
1430 plugin_test_1.err: plugin_test_1
1431         @touch plugin_test_1.err
1432
1433 check_PROGRAMS += plugin_test_2
1434 check_SCRIPTS += plugin_test_2.sh
1435 check_DATA += plugin_test_2.err
1436 MOSTLYCLEANFILES += plugin_test_2.err
1437 plugin_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
1438         $(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
1439 plugin_test_2.err: plugin_test_2
1440         @touch plugin_test_2.err
1441
1442 check_PROGRAMS += plugin_test_3
1443 check_SCRIPTS += plugin_test_3.sh
1444 check_DATA += plugin_test_3.err
1445 MOSTLYCLEANFILES += plugin_test_3.err
1446 plugin_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
1447         $(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
1448 plugin_test_3.err: plugin_test_3
1449         @touch plugin_test_3.err
1450
1451 check_PROGRAMS += plugin_test_4
1452 check_SCRIPTS += plugin_test_4.sh
1453 check_DATA += plugin_test_4.err
1454 MOSTLYCLEANFILES += plugin_test_4.a plugin_test_4.err
1455 plugin_test_4: two_file_test_main.o plugin_test_4.a gcctestdir/ld plugin_test.so
1456         $(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
1457 plugin_test_4.err: plugin_test_4
1458         @touch plugin_test_4.err
1459
1460 plugin_test_4.a: two_file_test_1.syms two_file_test_1b.syms two_file_test_2.syms
1461         $(TEST_AR) cr $@ $^
1462
1463 check_PROGRAMS += plugin_test_5
1464 plugin_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
1465         $(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
1466
1467 check_PROGRAMS += plugin_test_6
1468 check_SCRIPTS += plugin_test_6.sh
1469 check_DATA += plugin_test_6.err
1470 MOSTLYCLEANFILES += plugin_test_6.err
1471 plugin_test_6: plugin_common_test_1.syms plugin_common_test_2.syms gcctestdir/ld plugin_test.so
1472         $(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle,--plugin,"./plugin_test.so" plugin_common_test_1.syms plugin_common_test_2.syms 2>plugin_test_6.err
1473 plugin_test_6.err: plugin_test_6
1474         @touch plugin_test_6.err
1475
1476 check_PROGRAMS += plugin_test_7
1477 check_SCRIPTS += plugin_test_7.sh
1478 check_DATA += plugin_test_7.err plugin_test_7.syms
1479 MOSTLYCLEANFILES += plugin_test_7.err
1480 plugin_test_7: plugin_test_7_1.o plugin_test_7_1.syms plugin_test_7_2.o gcctestdir/ld plugin_test.so
1481         $(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
1482 plugin_test_7.syms: plugin_test_7
1483         $(TEST_READELF) -sW $< >$@ 2>/dev/null
1484 plugin_test_7_1.o: plugin_test_7_1.c
1485         $(COMPILE) -DLTO -O0 -c -ffunction-sections -fdata-sections -o $@ $<
1486 plugin_test_7_1_orig.o: plugin_test_7_1.c
1487         $(COMPILE) -O0 -c -ffunction-sections -fdata-sections -o $@ $<
1488 plugin_test_7_1.syms: plugin_test_7_1_orig.o
1489         $(TEST_READELF) -sW $< >$@ 2>/dev/null
1490 plugin_test_7_2.o: plugin_test_7_2.c
1491         $(COMPILE) -O0 -c -ffunction-sections -fdata-sections -o $@ $<
1492 plugin_test_7.err: plugin_test_7
1493
1494 # Test plugins with -r.
1495 check_PROGRAMS += plugin_test_8
1496 plugin_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
1497         ../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
1498 plugin_test_8: plugin_test_8.o gcctestdir/ld
1499         $(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle plugin_test_8.o
1500
1501 # Test that symbols known in the IR file but not in the replacement file
1502 # produce an unresolved symbol error.
1503 check_DATA += plugin_test_9.err
1504 MOSTLYCLEANFILES += plugin_test_9.err
1505 plugin_test_9.err: two_file_test_main.o two_file_test_1c.syms two_file_test_2.syms gcctestdir/ld plugin_test.so
1506         @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>$@"
1507         @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 \
1508           echo 1>&2 "Link of plugin_test_9 should have failed"; \
1509           rm -f $@; \
1510           exit 1; \
1511         fi
1512 # Make a .syms file that claims to define the symbol _Z4t16av.
1513 two_file_test_1c.syms: two_file_test_1.syms two_file_test_1c.o
1514         cp two_file_test_1.syms $@.tmp
1515         grep "_Z4t16av" two_file_test_1b.syms >> $@.tmp
1516         mv -f $@.tmp $@
1517 # Make a copy of two_file_test_1.o, which does not define the symbol _Z4t16av.
1518 MOSTLYCLEANFILES += two_file_test_1c.o
1519 two_file_test_1c.o: two_file_test_1.o
1520         cp two_file_test_1.o $@
1521
1522 plugin_test.so: plugin_test.o
1523         $(LINK) -Bgcctestdir/ -shared plugin_test.o
1524 plugin_test.o: plugin_test.c
1525         $(COMPILE) -O0 -c -fpic -o $@ $<
1526
1527 two_file_test_main.syms: two_file_test_main.o
1528         $(TEST_READELF) -sW $< >$@ 2>/dev/null
1529 two_file_test_1.syms: two_file_test_1.o
1530         $(TEST_READELF) -sW $< >$@ 2>/dev/null
1531 two_file_test_1b.syms: two_file_test_1b.o
1532         $(TEST_READELF) -sW $< >$@ 2>/dev/null
1533 two_file_test_2.syms: two_file_test_2.o
1534         $(TEST_READELF) -sW $< >$@ 2>/dev/null
1535 plugin_common_test_1.syms: plugin_common_test_1.o
1536         $(TEST_READELF) -sW $< >$@ 2>/dev/null
1537 plugin_common_test_2.syms: plugin_common_test_2.o
1538         $(TEST_READELF) -sW $< >$@ 2>/dev/null
1539
1540 empty.syms:
1541         @echo "" >$@
1542         @echo "Symbol table" >>$@
1543
1544 MOSTLYCLEANFILES += unused.c
1545 unused.syms: unused.o
1546         $(TEST_READELF) -sW $< >$@ 2>/dev/null
1547         @echo "     1: 00000000     4 FUNC    GLOBAL DEFAULT    1 UNUSED" >>$@
1548 unused.o: unused.c
1549         $(COMPILE) -c -o $@ $<
1550 unused.c:
1551         @cp /dev/null $@
1552
1553 check_SCRIPTS += plugin_final_layout.sh
1554 check_DATA += plugin_final_layout.stdout plugin_final_layout_readelf.stdout
1555 plugin_final_layout.o: plugin_final_layout.cc
1556         $(CXXCOMPILE) -O0 -c -ffunction-sections  -fdata-sections -g -o $@ $<
1557 plugin_final_layout: plugin_final_layout.o plugin_section_order.so gcctestdir/ld
1558         $(CXXLINK) -Bgcctestdir/ -Wl,--plugin,"./plugin_section_order.so" plugin_final_layout.o
1559 plugin_final_layout.stdout: plugin_final_layout
1560         $(TEST_NM) -n --synthetic plugin_final_layout > plugin_final_layout.stdout
1561 plugin_final_layout_readelf.stdout: plugin_final_layout
1562         $(TEST_READELF) -Wl plugin_final_layout > plugin_final_layout_readelf.stdout
1563
1564 plugin_section_order.so: plugin_section_order.o
1565         $(LINK) -Bgcctestdir/ -shared plugin_section_order.o
1566 plugin_section_order.o: plugin_section_order.c
1567         $(COMPILE) -O0 -c -fpic -o $@ $<
1568
1569 endif PLUGINS
1570
1571 check_PROGRAMS += exclude_libs_test
1572 check_SCRIPTS += exclude_libs_test.sh
1573 check_DATA += exclude_libs_test.syms
1574 MOSTLYCLEANFILES += exclude_libs_test.syms libexclude_libs_test_1.a \
1575         libexclude_libs_test_2.a alt/libexclude_libs_test_3.a
1576 exclude_libs_test_SOURCES = exclude_libs_test.c
1577 exclude_libs_test_DEPENDENCIES = gcctestdir/ld libexclude_libs_test_1.a \
1578         libexclude_libs_test_2.a alt/libexclude_libs_test_3.a
1579 exclude_libs_test_LDFLAGS = -Bgcctestdir/ -L. -Lalt \
1580         -Wl,--exclude-libs,dummy:libexclude_libs_test_1 \
1581         -Wl,--exclude-libs,libexclude_libs_test_3
1582 exclude_libs_test_LDADD = -lexclude_libs_test_1 -lexclude_libs_test_2 \
1583         alt/libexclude_libs_test_3.a
1584 exclude_libs_test.syms: exclude_libs_test
1585         $(TEST_READELF) -sW $< >$@ 2>/dev/null
1586 libexclude_libs_test_1.a: exclude_libs_test_1.o
1587         $(TEST_AR) rc $@ $^
1588 libexclude_libs_test_2.a: exclude_libs_test_2.o
1589         $(TEST_AR) rc $@ $^
1590 alt/libexclude_libs_test_3.a: exclude_libs_test_3.o
1591         test -d alt || mkdir -p alt
1592         $(TEST_AR) rc $@ $^
1593
1594 check_PROGRAMS += local_labels_test
1595 local_labels_test.o: ver_test_6.c
1596         $(COMPILE) -g -c -Wa,-L -o $@ $<
1597 local_labels_test: local_labels_test.o
1598         $(LINK) -Bgcctestdir/ local_labels_test.o
1599
1600 check_PROGRAMS += discard_locals_test
1601 check_SCRIPTS += discard_locals_test.sh
1602 check_DATA += discard_locals_test.syms \
1603         discard_locals_relocatable_test1.syms \
1604         discard_locals_relocatable_test2.syms
1605 MOSTLYCLEANFILES += discard_locals_test.syms \
1606         discard_locals_relocatable_test1.syms \
1607         discard_locals_relocatable_test2.syms \
1608         discard_locals_relocatable_test1.out \
1609         discard_locals_relocatable_test2.out
1610 discard_locals_test_SOURCES = discard_locals_test.c
1611 discard_locals_test_LDFLAGS = -Bgcctestdir/ -Wl,--discard-locals
1612 discard_locals_test.syms: discard_locals_test
1613         $(TEST_READELF) -sW $< >$@ 2>/dev/null
1614 # '-Wa,-L' is required to preserve the local label used for testing.
1615 discard_locals_test.o: discard_locals_test.c
1616         $(COMPILE) -c -Wa,-L -o $@ $<
1617
1618 discard_locals_relocatable_test1.syms: discard_locals_relocatable_test1.out
1619         $(TEST_READELF) -sW $< >$@ 2>/dev/null
1620 discard_locals_relocatable_test.o: discard_locals_relocatable_test.c
1621         $(COMPILE) -c -Wa,-L -fPIC -o $@ $<
1622 discard_locals_relocatable_test1.out: discard_locals_relocatable_test.o ../ld-new
1623         ../ld-new --discard-locals -relocatable -o $@ $<
1624
1625 discard_locals_relocatable_test2.syms: discard_locals_relocatable_test2.out
1626         $(TEST_READELF) -sW $< >$@ 2>/dev/null
1627 discard_locals_relocatable_test2.out: discard_locals_relocatable_test.o ../ld-new
1628         ../ld-new --discard-all -relocatable -o $@ $<
1629
1630 if MCMODEL_MEDIUM
1631 check_PROGRAMS += large
1632 large_SOURCES = large.c
1633 large_CFLAGS = -mcmodel=medium
1634 large_DEPENDENCIES = gcctestdir/ld
1635 large_LDFLAGS = -Bgcctestdir/
1636 large_LDADD =
1637 endif MCMODEL_MEDIUM
1638
1639 # Test that hidden and internal symbols in the main program cannot be
1640 # referenced by a shared library.
1641 check_SCRIPTS += hidden_test.sh
1642 check_DATA += hidden_test.err
1643 MOSTLYCLEANFILES += hidden_test hidden_test.err
1644 libhidden.so: hidden_test_1.c gcctestdir/ld
1645         $(COMPILE) -Bgcctestdir/ -g -shared -fPIC -w -o $@ $(srcdir)/hidden_test_1.c
1646 hidden_test: hidden_test_main.o libhidden.so gcctestdir/ld
1647         $(LINK) -Bgcctestdir/ -Wl,-R,. hidden_test_main.o libhidden.so 2>hidden_test.err
1648 hidden_test.err: hidden_test
1649         @touch hidden_test.err
1650
1651 # Test -retain-symbols-file.
1652 check_SCRIPTS += retain_symbols_file_test.sh
1653 check_DATA += retain_symbols_file_test.stdout
1654 MOSTLYCLEANFILES += retain_symbols_file_test retain_symbols_file_test.in \
1655                     retain_symbols_file_test.stdout
1656 retain_symbols_file_test.so: basic_pic_test.o gcctestdir/ld
1657         echo 'main' > retain_symbols_file_test.in
1658         echo 't1' >> retain_symbols_file_test.in
1659         echo '_ZN4t16bC1Ev' >> retain_symbols_file_test.in
1660         echo '_ZNK4t20a3getEv' >> retain_symbols_file_test.in
1661         echo '_Z3t18v' >> retain_symbols_file_test.in
1662         echo '__tcf_0' >> retain_symbols_file_test.in   
1663         $(CXXLINK) -Bgcctestdir/ -shared -Wl,-retain-symbols-file,retain_symbols_file_test.in basic_pic_test.o
1664 retain_symbols_file_test.stdout: retain_symbols_file_test.so
1665         $(TEST_NM) -C retain_symbols_file_test.so > $@
1666
1667
1668 # Test that if the output file already exists and is empty,
1669 # it will get execute permission.
1670 check_PROGRAMS += permission_test
1671 permission_test: basic_test.o gcctestdir/ld
1672         umask 022; \
1673         rm -f $@; \
1674         touch $@; \
1675         chmod 600 $@; \
1676         $(CXXLINK) -Bgcctestdir/ basic_test.o
1677
1678 # Check -l:foo.a
1679 check_PROGRAMS += searched_file_test
1680 MOSTLYCLEANFILES += searched_file_test searched_file_test_lib.o \
1681                     alt/searched_file_test_lib.a
1682 searched_file_test_SOURCES = searched_file_test.cc
1683 searched_file_test_DEPENDENCIES = alt/searched_file_test_lib.a
1684 searched_file_test_LDFLAGS = -Bgcctestdir/ -Lalt
1685 searched_file_test_LDADD = -l:searched_file_test_lib.a
1686 searched_file_test_lib.o: searched_file_test_lib.cc
1687         $(CXXCOMPILE) -c -o $@ $<
1688 alt/searched_file_test_lib.a: searched_file_test_lib.o
1689         test -d alt || mkdir -p alt
1690         $(TEST_AR) rc $@ $^
1691
1692 # Test that no .gnu.version sections are created when 
1693 # symbol versioning is not used.
1694 check_SCRIPTS += no_version_test.sh
1695 check_DATA += no_version_test.stdout
1696 MOSTLYCLEANFILES += libno_version_test.so no_version_test.stdout
1697 # We invoke the linker directly since gcc may include additional objects that
1698 # uses symbol versioning.
1699 libno_version_test.so: no_version_test.o gcctestdir/ld
1700         gcctestdir/ld -shared -o $@ no_version_test.o
1701 no_version_test.o: no_version_test.c
1702         $(COMPILE) -o $@ -c -fPIC $<
1703 no_version_test.stdout: libno_version_test.so
1704         $(TEST_OBJDUMP) -h $< > $@
1705
1706 # Test STT_GNU_IFUNC symbols.
1707 if IFUNC
1708
1709 ifuncmod1.o: ifuncmod1.c
1710         $(COMPILE) -c -fPIC -o $@ $<
1711 ifuncmod1.so: ifuncmod1.o gcctestdir/ld
1712         $(LINK) -Bgcctestdir/ -shared ifuncmod1.o
1713
1714 ifuncdep1.o: ifuncmod1.c
1715         $(COMPILE) -c -o $@ $<
1716
1717 ifuncmain1pic.o: ifuncmain1.c
1718         $(COMPILE) -c -fPIC -o $@ $<
1719 ifuncmain1pie.o: ifuncmain1.c
1720         $(COMPILE) -c -fPIE -o $@ $<
1721
1722 if HAVE_STATIC
1723 if IFUNC_STATIC
1724 check_PROGRAMS += ifuncmain1static
1725 ifuncmain1static_SOURCES = ifuncmain1.c
1726 ifuncmain1static_DEPENDENCIES = gcctestdir/ld ifuncdep1.o
1727 ifuncmain1static_LDFLAGS = -Bgcctestdir/ -static
1728 ifuncmain1static_LDADD = ifuncdep1.o
1729
1730 check_PROGRAMS += ifuncmain1picstatic
1731 ifuncmain1picstatic: ifuncmain1pic.o ifuncmod1.o gcctestdir/ld
1732         $(LINK) -Bgcctestdir/ -static ifuncmain1pic.o ifuncmod1.o
1733 endif
1734 endif
1735
1736 check_PROGRAMS += ifuncmain1
1737 ifuncmain1_SOURCES = ifuncmain1.c
1738 ifuncmain1_DEPENDENCIES = gcctestdir/ld ifuncmod1.so
1739 ifuncmain1_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1740 ifuncmain1_LDADD = ifuncmod1.so
1741
1742 check_PROGRAMS += ifuncmain1pic
1743 ifuncmain1pic: ifuncmain1pic.o ifuncmod1.so gcctestdir/ld
1744         $(LINK) -Bgcctestdir/ ifuncmain1pic.o ifuncmod1.so -Wl,-R,.
1745
1746 check_PROGRAMS += ifuncmain1vis
1747 ifuncmain1vis_SOURCES = ifuncmain1vis.c
1748 ifuncmain1vis_DEPENDENCIES = gcctestdir/ld ifuncmod1.so
1749 ifuncmain1vis_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1750 ifuncmain1vis_LDADD = ifuncmod1.so
1751
1752 check_PROGRAMS += ifuncmain1vispic
1753 ifuncmain1vispic.o: ifuncmain1vis.c
1754         $(COMPILE) -c -fPIC -o $@ $<
1755 ifuncmain1vispic: ifuncmain1vispic.o ifuncmod1.so gcctestdir/ld
1756         $(LINK) -Bgcctestdir/ ifuncmain1pic.o ifuncmod1.so -Wl,-R,.
1757
1758 check_PROGRAMS += ifuncmain1staticpic
1759 ifuncmain1staticpic: ifuncmain1pic.o ifuncmod1.o gcctestdir/ld
1760         $(LINK) -Bgcctestdir/ ifuncmain1pic.o ifuncmod1.o
1761
1762 check_PROGRAMS += ifuncmain1pie
1763 ifuncmain1pie: ifuncmain1pie.o ifuncmod1.so gcctestdir/ld
1764         $(LINK) -Bgcctestdir/ -pie ifuncmain1pie.o ifuncmod1.so -Wl,-R,.
1765
1766 check_PROGRAMS += ifuncmain1vispie
1767 ifuncmain1vispie.o: ifuncmain1vis.c
1768         $(COMPILE) -c -fPIE -o $@ $<
1769 ifuncmain1vispie: ifuncmain1vispie.o ifuncmod1.so gcctestdir/ld
1770         $(LINK) -Bgcctestdir/ -pie ifuncmain1vispie.o ifuncmod1.so -Wl,-R,.
1771
1772 check_PROGRAMS += ifuncmain1staticpie
1773 ifuncmain1staticpie: ifuncmain1pie.o ifuncmod1.o gcctestdir/ld
1774         $(LINK) -Bgcctestdir/ -pie ifuncmain1pie.o ifuncmod1.o
1775
1776 ifuncmain2pic.o: ifuncmain2.c
1777         $(COMPILE) -c -fPIC -o $@ $<
1778
1779 ifuncdep2pic.o: ifuncdep2.c
1780         $(COMPILE) -c -fPIC -o $@ $<
1781
1782 if HAVE_STATIC
1783 if IFUNC_STATIC
1784 check_PROGRAMS += ifuncmain2static
1785 ifuncmain2static_SOURCES = ifuncmain2.c ifuncdep2.c
1786 ifuncmain2static_DEPENDENCIES = gcctestdir/ld
1787 ifuncmain2static_LDFLAGS = -Bgcctestdir/ -static
1788 ifuncmain2static_LDADD =
1789
1790 check_PROGRAMS += ifuncmain2picstatic
1791 ifuncmain2picstatic: ifuncmain2pic.o ifuncdep2pic.o gcctestdir/ld
1792         $(LINK) -Bgcctestdir/ -static ifuncmain2pic.o ifuncdep2pic.o
1793 endif
1794 endif
1795
1796 check_PROGRAMS += ifuncmain2
1797 ifuncmain2_SOURCES = ifuncmain2.c ifuncdep2.c
1798 ifuncmain2_DEPENDENCIES = gcctestdir/ld
1799 ifuncmain2_LDFLAGS = -Bgcctestdir/
1800 ifuncmain2_LDADD =
1801
1802 check_PROGRAMS += ifuncmain2pic
1803 ifuncmain2pic: ifuncmain2pic.o ifuncdep2pic.o gcctestdir/ld
1804         $(LINK) -Bgcctestdir/ ifuncmain2pic.o ifuncdep2pic.o
1805
1806 ifuncmod3.o: ifuncmod3.c
1807         $(COMPILE) -c -fPIC -o $@ $<
1808 ifuncmod3.so: ifuncmod3.o gcctestdir/ld
1809         $(LINK) -Bgcctestdir/ -shared ifuncmod3.o
1810
1811 check_PROGRAMS += ifuncmain3
1812 ifuncmain3_SOURCES = ifuncmain3.c
1813 ifuncmain3_DEPENDENCIES = gcctestdir/ld ifuncmod3.so
1814 ifuncmain3_LDFLAGS = -Bgcctestdir/ -Wl,--export-dynamic -Wl,-R,.
1815 ifuncmain3_LDADD = -ldl
1816
1817 ifuncmain4pic.o: ifuncmain4.c
1818         $(COMPILE) -c -fPIC -o $@ $<
1819
1820 if HAVE_STATIC
1821 if IFUNC_STATIC
1822 check_PROGRAMS += ifuncmain4static
1823 ifuncmain4static_SOURCES = ifuncmain4.c
1824 ifuncmain4static_DEPENDENCIES = gcctestdir/ld
1825 ifuncmain4static_LDFLAGS = -Bgcctestdir/ -static
1826 ifuncmain4static_LDADD =
1827
1828 check_PROGRAMS += ifuncmain4picstatic
1829 ifuncmain4picstatic: ifuncmain4pic.o gcctestdir/ld
1830         $(LINK) -Bgcctestdir/ -static ifuncmain4pic.o
1831 endif
1832 endif
1833
1834 check_PROGRAMS += ifuncmain4
1835 ifuncmain4_SOURCES = ifuncmain4.c
1836 ifuncmain4_DEPENDENCIES = gcctestdir/ld
1837 ifuncmain4_LDFLAGS = -Bgcctestdir/
1838 ifuncmain4_LDADD =
1839
1840 ifuncmain5pic.o: ifuncmain5.c
1841         $(COMPILE) -c -fPIC -o $@ $<
1842
1843 ifuncmain5pie.o: ifuncmain5.c
1844         $(COMPILE) -c -fPIE -o $@ $<
1845
1846 ifuncmod5.o: ifuncmod5.c
1847         $(COMPILE) -c -fPIC -o $@ $<
1848 ifuncmod5.so: ifuncmod5.o gcctestdir/ld
1849         $(LINK) -Bgcctestdir/ -shared ifuncmod5.o
1850
1851 ifuncdep5.o: ifuncmod5.c
1852         $(COMPILE) -c -o $@ $<
1853
1854 if HAVE_STATIC
1855 if IFUNC_STATIC
1856 check_PROGRAMS += ifuncmain5static
1857 ifuncmain5static_SOURCES = ifuncmain5.c
1858 ifuncmain5static_DEPENDENCIES = gcctestdir/ld ifuncdep5.o
1859 ifuncmain5static_LDFLAGS = -Bgcctestdir/ -static
1860 ifuncmain5static_LDADD = ifuncdep5.o
1861
1862 check_PROGRAMS += ifuncmain5picstatic
1863 ifuncmain5picstatic: ifuncmain5pic.o ifuncmod5.o gcctestdir/ld
1864         $(LINK) -Bgcctestdir/ -static ifuncmain5pic.o ifuncmod5.o
1865 endif
1866 endif
1867
1868 check_PROGRAMS += ifuncmain5
1869 ifuncmain5_SOURCES = ifuncmain5.c
1870 ifuncmain5_DEPENDENCIES = gcctestdir/ld ifuncmod5.so
1871 ifuncmain5_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1872 ifuncmain5_LDADD = ifuncmod5.so
1873
1874 check_PROGRAMS += ifuncmain5pic
1875 ifuncmain5pic: ifuncmain5pic.o ifuncmod5.so gcctestdir/ld
1876         $(LINK) -Bgcctestdir/ ifuncmain5pic.o ifuncmod5.so -Wl,-R,.
1877
1878 check_PROGRAMS += ifuncmain5staticpic
1879 ifuncmain5staticpic: ifuncmain5pic.o ifuncmod5.o gcctestdir/ld
1880         $(LINK) -Bgcctestdir/ ifuncmain5pic.o ifuncmod5.o
1881
1882 check_PROGRAMS += ifuncmain5pie
1883 ifuncmain5pie: ifuncmain5pie.o ifuncmod5.so gcctestdir/ld
1884         $(LINK) -Bgcctestdir/ -pie ifuncmain5pie.o ifuncmod5.so -Wl,-R,.
1885
1886 ifuncmain6pie.o: ifuncmain6pie.c
1887         $(COMPILE) -c -fPIE -o $@ $<
1888
1889 ifuncmod6.o: ifuncmod6.c
1890         $(COMPILE) -c -fPIC -o $@ $<
1891 ifuncmod6.so: ifuncmod6.o gcctestdir/ld
1892         $(LINK) -Bgcctestdir/ -shared ifuncmod6.o
1893
1894 check_PROGRAMS += ifuncmain6pie
1895 ifuncmain6pie: ifuncmain6pie.o ifuncmod6.so gcctestdir/ld
1896         $(LINK) -Bgcctestdir/ -pie ifuncmain6pie.o ifuncmod6.so -Wl,-R,.
1897
1898 ifuncmain7pic.o: ifuncmain7.c
1899         $(COMPILE) -c -fPIC -o $@ $<
1900
1901 ifuncmain7pie.o: ifuncmain7.c
1902         $(COMPILE) -c -fPIE -o $@ $<
1903
1904 if HAVE_STATIC
1905 if IFUNC_STATIC
1906 check_PROGRAMS += ifuncmain7static
1907 ifuncmain7static_SOURCES = ifuncmain7.c
1908 ifuncmain7static_DEPENDENCIES = gcctestdir/ld
1909 ifuncmain7static_LDFLAGS = -Bgcctestdir/ -static
1910 ifuncmain7static_LDADD =
1911
1912 check_PROGRAMS += ifuncmain7picstatic
1913 ifuncmain7picstatic: ifuncmain7pic.o gcctestdir/ld
1914         $(LINK) -Bgcctestdir/ -static ifuncmain7pic.o
1915 endif
1916 endif
1917
1918 check_PROGRAMS += ifuncmain7
1919 ifuncmain7_SOURCES = ifuncmain7.c
1920 ifuncmain7_DEPENDENCIES = gcctestdir/ld
1921 ifuncmain7_LDFLAGS = -Bgcctestdir/
1922 ifuncmain7_LDADD =
1923
1924 check_PROGRAMS += ifuncmain7pic
1925 ifuncmain7pic: ifuncmain7pic.o gcctestdir/ld
1926         $(LINK) -Bgcctestdir/ ifuncmain7pic.o
1927
1928 check_PROGRAMS += ifuncmain7pie
1929 ifuncmain7pie: ifuncmain7pie.o gcctestdir/ld
1930         $(LINK) -Bgcctestdir/ -pie ifuncmain7pie.o
1931
1932 check_PROGRAMS += ifuncvar
1933 ifuncvar1_pic.o: ifuncvar1.c
1934         $(COMPILE) -c -fPIC -o $@ $<
1935 ifuncvar2_pic.o: ifuncvar2.c    
1936         $(COMPILE) -c -fPIC -o $@ $<
1937 ifuncvar.so: ifuncvar1_pic.o ifuncvar2_pic.o gcctestdir/ld
1938         $(LINK) -Bgcctestdir/ -shared ifuncvar1_pic.o ifuncvar2_pic.o
1939 ifuncvar_SOURCES = ifuncvar3.c
1940 ifuncvar_DEPENDENCIES = gcctestdir/ld ifuncvar.so
1941 ifuncvar_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1942 ifuncvar_LDADD = ifuncvar.so
1943
1944 endif IFUNC
1945
1946 # Test that strong reference to a weak symbol in a DSO remains strong.
1947 check_SCRIPTS += strong_ref_weak_def.sh
1948 check_DATA += strong_ref_weak_def.stdout
1949 MOSTLYCLEANFILES += strong_ref_weak_def_1.so strong_ref_weak_def_2.so \
1950         strong_ref_weak_def.stdout
1951 strong_ref_weak_def_2.o: strong_ref_weak_def_2.c
1952         $(COMPILE) -o $@ -c -fPIC $<
1953 strong_ref_weak_def_2.so: strong_ref_weak_def_2.o gcctestdir/ld
1954         gcctestdir/ld -shared -o $@ strong_ref_weak_def_2.o
1955 strong_ref_weak_def_1.o: strong_ref_weak_def_1.c
1956         $(COMPILE) -o $@ -c -fPIC $<
1957 strong_ref_weak_def_1.so: strong_ref_weak_def_1.o strong_ref_weak_def_2.so \
1958         gcctestdir/ld
1959         gcctestdir/ld -shared -o $@ strong_ref_weak_def_1.o \
1960                 strong_ref_weak_def_2.so
1961 strong_ref_weak_def.stdout: strong_ref_weak_def_1.so
1962         $(TEST_READELF) -sWD $< > $@
1963
1964 # Test that a strong weak reference remains strong if there is another
1965 # weak reference in a DSO.
1966 check_SCRIPTS += dyn_weak_ref.sh
1967 check_DATA += dyn_weak_ref.stdout
1968 MOSTLYCLEANFILES += dyn_weak_ref_1.so dyn_weak_ref_2.so \
1969         dyn_weak_ref.stdout
1970 dyn_weak_ref_2.o: dyn_weak_ref_2.c
1971         $(COMPILE) -o $@ -c -fPIC $<
1972 dyn_weak_ref_2.so: dyn_weak_ref_2.o gcctestdir/ld
1973         gcctestdir/ld -shared -o $@ dyn_weak_ref_2.o
1974 dyn_weak_ref_1.o: dyn_weak_ref_1.c
1975         $(COMPILE) -o $@ -c -fPIC $<
1976 # We intentionally put dyn_weak_ref_2.so in front of dyn_weak_ref_1.o
1977 # so that the weak ref there goes to gold's symbol table first.
1978 dyn_weak_ref_1.so: dyn_weak_ref_1.o dyn_weak_ref_2.so gcctestdir/ld
1979         gcctestdir/ld -shared -o $@ dyn_weak_ref_2.so dyn_weak_ref_1.o
1980 dyn_weak_ref.stdout: dyn_weak_ref_1.so
1981         $(TEST_READELF) -sWD $< > $@
1982
1983
1984 # Test that --start-lib and --end-lib function correctly.
1985 check_PROGRAMS += start_lib_test
1986 start_lib_test: start_lib_test_main.o libstart_lib_test.a start_lib_test_2.o start_lib_test_3.o \
1987         gcctestdir/ld
1988         $(LINK) -Bgcctestdir/ -o $@ start_lib_test_main.o -L. -lstart_lib_test \
1989                 -Wl,--start-lib start_lib_test_2.o start_lib_test_3.o -Wl,--end-lib
1990 libstart_lib_test.a: start_lib_test_1.o
1991         $(TEST_AR) rc $@ $^
1992
1993 # Test that MEMORY region support works.
1994 check_SCRIPTS += memory_test.sh
1995 check_DATA += memory_test.stdout
1996 MOSTLYCLEANFILES += memory_test.stdout memory_test memory_test.o
1997 memory_test.o: memory_test.s
1998         $(COMPILE) -o $@ -c $<
1999 memory_test: memory_test.o gcctestdir/ld $(srcdir)/memory_test.t
2000         $(LINK) -Bgcctestdir/ -nostartfiles -nostdlib -z max-page-size=0x1000 -z common-page-size=0x1000 -T $(srcdir)/memory_test.t -o $@ memory_test.o
2001 memory_test.stdout: memory_test
2002         $(TEST_READELF) -lWS  $< > $@
2003
2004 if HAVE_PUBNAMES
2005
2006 # Test that --gdb-index functions correctly without gcc-generated pubnames.
2007 check_SCRIPTS += gdb_index_test_1.sh
2008 check_DATA += gdb_index_test_1.stdout
2009 MOSTLYCLEANFILES += gdb_index_test_1.stdout gdb_index_test_1
2010 gdb_index_test.o: gdb_index_test.cc
2011         $(CXXCOMPILE) -O0 -g -gno-pubnames -c -o $@ $<
2012 gdb_index_test_1: gdb_index_test.o gcctestdir/ld
2013         $(CXXLINK) -Bgcctestdir/ -Wl,--gdb-index $<
2014 gdb_index_test_1.stdout: gdb_index_test_1
2015         $(TEST_READELF) --debug-dump=gdb_index $< > $@
2016
2017 if HAVE_ZLIB
2018
2019 # Test that --gdb-index functions correctly with compressed debug sections.
2020 check_SCRIPTS += gdb_index_test_2.sh
2021 check_DATA += gdb_index_test_2.stdout
2022 MOSTLYCLEANFILES += gdb_index_test_2.stdout gdb_index_test_2
2023 gdb_index_test_cdebug.o: gdb_index_test.cc
2024         $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -Wa,--compress-debug-sections -c -o $@ $<
2025 gdb_index_test_2: gdb_index_test_cdebug.o gcctestdir/ld
2026         $(CXXLINK) -Bgcctestdir/ -Wl,--gdb-index $<
2027 gdb_index_test_2.stdout: gdb_index_test_2
2028         $(TEST_READELF) --debug-dump=gdb_index $< > $@
2029
2030 endif HAVE_ZLIB
2031
2032 # Another simple C test (DW_AT_high_pc encoding) for --gdb-index.
2033 check_SCRIPTS += gdb_index_test_3.sh
2034 check_DATA += gdb_index_test_3.stdout
2035 MOSTLYCLEANFILES += gdb_index_test_3.stdout gdb_index_test_3
2036 gdb_index_test_3.o: gdb_index_test_3.c
2037         $(COMPILE) -O0 -g -c -o $@ $<
2038 gdb_index_test_3: gdb_index_test_3.o gcctestdir/ld
2039         $(LINK) -Bgcctestdir/ -Wl,--gdb-index,--fatal-warnings $<
2040 gdb_index_test_3.stdout: gdb_index_test_3
2041         $(TEST_READELF) --debug-dump=gdb_index $< > $@
2042
2043 # Test that --gdb-index functions correctly with gcc-generated pubnames.
2044 check_SCRIPTS += gdb_index_test_4.sh
2045 check_DATA += gdb_index_test_4.stdout
2046 MOSTLYCLEANFILES += gdb_index_test_4.stdout gdb_index_test_4
2047 gdb_index_test_pub.o: gdb_index_test.cc
2048         $(CXXCOMPILE) -O0 -g -gpubnames -c -o $@ $<
2049 gdb_index_test_4: gdb_index_test_pub.o gcctestdir/ld
2050         $(CXXLINK) -Bgcctestdir/ -Wl,--gdb-index $<
2051 gdb_index_test_4.stdout: gdb_index_test_4
2052         $(TEST_READELF) --debug-dump=gdb_index $< > $@
2053
2054 endif HAVE_PUBNAMES
2055
2056 # End-to-end incremental linking tests.
2057 # Incremental linking is currently supported only on the x86_64 target.
2058
2059 if DEFAULT_TARGET_X86_64
2060
2061 two_file_test_1_v1_ndebug.o: two_file_test_1_v1.cc
2062         $(CXXCOMPILE) -O0 -g0 -c -o $@ $<
2063 two_file_test_1_ndebug.o: two_file_test_1.cc
2064         $(CXXCOMPILE) -O0 -g0 -c -o $@ $<
2065 two_file_test_1b_ndebug.o: two_file_test_1b.cc
2066         $(CXXCOMPILE) -O0 -g0 -c -o $@ $<
2067 two_file_test_2_ndebug.o: two_file_test_2.cc
2068         $(CXXCOMPILE) -O0 -g0 -c -o $@ $<
2069 two_file_test_main_ndebug.o: two_file_test_main.cc
2070         $(CXXCOMPILE) -O0 -g0 -c -o $@ $<
2071
2072 check_PROGRAMS += incremental_test_2
2073 MOSTLYCLEANFILES += two_file_test_tmp_2.o
2074 incremental_test_2: two_file_test_1_v1_ndebug.o two_file_test_1_ndebug.o two_file_test_1b_ndebug.o \
2075                     two_file_test_2_ndebug.o two_file_test_main_ndebug.o gcctestdir/ld
2076         cp -f two_file_test_1_v1_ndebug.o two_file_test_tmp_2.o
2077         $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -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
2078         @sleep 1
2079         cp -f two_file_test_1_ndebug.o two_file_test_tmp_2.o
2080         $(CXXLINK) -Wl,--incremental-update -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
2081
2082 check_PROGRAMS += incremental_test_3
2083 MOSTLYCLEANFILES += two_file_test_tmp_3.o
2084 incremental_test_3: two_file_test_1.o two_file_test_1b_v1.o two_file_test_1b.o \
2085                     two_file_test_2.o two_file_test_main.o gcctestdir/ld
2086         cp -f two_file_test_1b_v1.o two_file_test_tmp_3.o
2087         $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Bgcctestdir/ two_file_test_1.o two_file_test_tmp_3.o two_file_test_2.o two_file_test_main.o
2088         @sleep 1
2089         cp -f two_file_test_1b.o two_file_test_tmp_3.o
2090         $(CXXLINK) -Wl,--incremental-update -Bgcctestdir/ two_file_test_1.o two_file_test_tmp_3.o two_file_test_2.o two_file_test_main.o
2091
2092 check_PROGRAMS += incremental_test_4
2093 MOSTLYCLEANFILES += incremental_test_4.base two_file_test_tmp_4.o
2094 incremental_test_4: two_file_test_1.o two_file_test_1b.o two_file_test_2_v1.o \
2095                     two_file_test_2.o two_file_test_main.o gcctestdir/ld
2096         cp -f two_file_test_2_v1.o two_file_test_tmp_4.o
2097         $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Bgcctestdir/ two_file_test_1.o two_file_test_1b.o two_file_test_tmp_4.o two_file_test_main.o
2098         mv -f incremental_test_4 incremental_test_4.base
2099         @sleep 1
2100         cp -f two_file_test_2.o two_file_test_tmp_4.o
2101         $(CXXLINK) -Wl,--incremental-update,--incremental-base=incremental_test_4.base -Bgcctestdir/ two_file_test_1.o two_file_test_1b.o two_file_test_tmp_4.o two_file_test_main.o
2102
2103 check_PROGRAMS += incremental_test_5
2104 MOSTLYCLEANFILES += two_file_test_5.a
2105 incremental_test_5: two_file_test_1.o two_file_test_1b_v1.o two_file_test_1b.o \
2106                     two_file_test_2.o two_file_test_main.o gcctestdir/ld
2107         cp -f two_file_test_1b_v1.o two_file_test_tmp_5.o
2108         $(TEST_AR) rc two_file_test_5.a two_file_test_1.o two_file_test_tmp_5.o two_file_test_2.o
2109         $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Bgcctestdir/ two_file_test_main.o two_file_test_5.a
2110         @sleep 1
2111         cp -f two_file_test_1b.o two_file_test_tmp_5.o
2112         $(TEST_AR) rc two_file_test_5.a two_file_test_1.o two_file_test_tmp_5.o two_file_test_2.o
2113         $(CXXLINK) -Wl,--incremental-update -Bgcctestdir/ two_file_test_main.o two_file_test_5.a
2114
2115 # Test the --incremental-unchanged flag with an archive library.
2116 # The second link should not update the library.
2117 check_PROGRAMS += incremental_test_6
2118 MOSTLYCLEANFILES += two_file_test_6.a
2119 incremental_test_6: two_file_test_1.o two_file_test_1b_v1.o two_file_test_1b.o \
2120                     two_file_test_2.o two_file_test_main.o gcctestdir/ld
2121         cp -f two_file_test_1b.o two_file_test_tmp_6.o
2122         $(TEST_AR) rc two_file_test_6.a two_file_test_1.o two_file_test_tmp_6.o two_file_test_2.o
2123         $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Bgcctestdir/ two_file_test_main.o two_file_test_6.a
2124         @sleep 1
2125         cp -f two_file_test_1b_v1.o two_file_test_tmp_6.o
2126         $(TEST_AR) rc two_file_test_6.a two_file_test_1.o two_file_test_tmp_6.o two_file_test_2.o
2127         $(CXXLINK) -Wl,--incremental-update -Bgcctestdir/ two_file_test_main.o -Wl,--incremental-unchanged two_file_test_6.a -Wl,--incremental-unknown
2128
2129 check_PROGRAMS += incremental_copy_test
2130 incremental_copy_test: copy_test_v1.o copy_test.o copy_test_1.so copy_test_2.so
2131         cp -f copy_test_v1.o copy_test_tmp.o
2132         $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Bgcctestdir/ -Wl,-R,. -Wl,--no-as-needed copy_test_tmp.o copy_test_1.so copy_test_2.so
2133         @sleep 1
2134         cp -f copy_test.o copy_test_tmp.o
2135         $(CXXLINK) -Wl,--incremental-update -Bgcctestdir/ -Wl,-R,. -Wl,--no-as-needed copy_test_tmp.o copy_test_1.so copy_test_2.so
2136
2137 check_PROGRAMS += incremental_common_test_1
2138 incremental_common_test_1: common_test_1_v1.o common_test_1_v2.o gcctestdir/ld
2139         cp -f common_test_1_v1.o common_test_1_tmp.o
2140         $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Bgcctestdir/ common_test_1_tmp.o
2141         @sleep 1
2142         cp -f common_test_1_v2.o common_test_1_tmp.o
2143         $(CXXLINK) -Wl,--incremental-update -Bgcctestdir/ common_test_1_tmp.o
2144
2145 check_PROGRAMS += incremental_comdat_test_1
2146 incremental_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
2147         cp -f incr_comdat_test_2_v1.o incr_comdat_test_1_tmp.o
2148         $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Bgcctestdir/ incr_comdat_test_1.o incr_comdat_test_1_tmp.o
2149         @sleep 1
2150         cp -f incr_comdat_test_2_v2.o incr_comdat_test_1_tmp.o
2151         $(CXXLINK) -Wl,--incremental-update -Bgcctestdir/ incr_comdat_test_1.o incr_comdat_test_1_tmp.o
2152         @sleep 1
2153         cp -f incr_comdat_test_2_v3.o incr_comdat_test_1_tmp.o
2154         $(CXXLINK) -Wl,--incremental-update -Bgcctestdir/ incr_comdat_test_1.o incr_comdat_test_1_tmp.o
2155
2156 endif DEFAULT_TARGET_X86_64
2157
2158 endif GCC
2159 endif NATIVE_LINKER
2160
2161 # These tests work with native and cross linkers.
2162
2163 if NATIVE_OR_CROSS_LINKER
2164
2165 # Test script section order.
2166 check_SCRIPTS += script_test_10.sh
2167 check_DATA += script_test_10.stdout
2168 script_test_10.o: script_test_10.s
2169         $(TEST_AS) -o $@ $<
2170 script_test_10: $(srcdir)/script_test_10.t script_test_10.o gcctestdir/ld
2171         gcctestdir/ld -o $@ script_test_10.o -T $(srcdir)/script_test_10.t
2172 script_test_10.stdout: script_test_10
2173         $(TEST_READELF) -SW script_test_10 > $@
2174
2175 # These tests work with cross linkers only.
2176
2177 if DEFAULT_TARGET_I386
2178
2179 check_SCRIPTS += split_i386.sh
2180 check_DATA += split_i386_1.stdout split_i386_2.stdout \
2181         split_i386_3.stdout split_i386_4.stdout split_i386_r.stdout
2182 SPLIT_DEFSYMS = --defsym __morestack=0x100 --defsym __morestack_non_split=0x200
2183 split_i386_1.o: split_i386_1.s
2184         $(TEST_AS) -o $@ $<
2185 split_i386_2.o: split_i386_2.s
2186         $(TEST_AS) -o $@ $<
2187 split_i386_3.o: split_i386_3.s
2188         $(TEST_AS) -o $@ $<
2189 split_i386_4.o: split_i386_4.s
2190         $(TEST_AS) -o $@ $<
2191 split_i386_n.o: split_i386_n.s
2192         $(TEST_AS) -o $@ $<
2193 split_i386_1: split_i386_1.o split_i386_n.o ../ld-new
2194         ../ld-new $(SPLIT_DEFSYMS) -o $@ split_i386_1.o split_i386_n.o
2195 split_i386_1.stdout: split_i386_1
2196         $(TEST_OBJDUMP) -d $< > $@
2197 split_i386_2: split_i386_2.o split_i386_n.o ../ld-new
2198         ../ld-new $(SPLIT_DEFSYMS) -o $@ split_i386_2.o split_i386_n.o
2199 split_i386_2.stdout: split_i386_2
2200         $(TEST_OBJDUMP) -d $< > $@
2201 split_i386_3.stdout: split_i386_3.o split_i386_n.o ../ld-new
2202         ../ld-new $(SPLIT_DEFSYMS) -o split_i386_3 split_i386_3.o split_i386_n.o > $@ 2>&1 || exit 0
2203 split_i386_4: split_i386_4.o split_i386_n.o ../ld-new
2204         ../ld-new $(SPLIT_DEFSYMS) -o $@ split_i386_4.o split_i386_n.o
2205 split_i386_4.stdout: split_i386_4
2206         $(TEST_OBJDUMP) -d $< > $@
2207 split_i386_r.stdout: split_i386_1.o split_i386_n.o ../ld-new
2208         ../ld-new -r split_i386_1.o split_i386_n.o -o split_i386_r > $@ 2>&1 || exit 0
2209 MOSTLYCLEANFILES += split_i386_1 split_i386_2 split_i386_3 \
2210         split_i386_4 split_i386_r
2211
2212 endif DEFAULT_TARGET_I386
2213
2214 if DEFAULT_TARGET_X86_64
2215
2216 check_SCRIPTS += split_x86_64.sh
2217 check_DATA += split_x86_64_1.stdout split_x86_64_2.stdout \
2218         split_x86_64_3.stdout split_x86_64_4.stdout split_x86_64_r.stdout
2219 SPLIT_DEFSYMS = --defsym __morestack=0x100 --defsym __morestack_non_split=0x200
2220 split_x86_64_1.o: split_x86_64_1.s
2221         $(TEST_AS) -o $@ $<
2222 split_x86_64_2.o: split_x86_64_2.s
2223         $(TEST_AS) -o $@ $<
2224 split_x86_64_3.o: split_x86_64_3.s
2225         $(TEST_AS) -o $@ $<
2226 split_x86_64_4.o: split_x86_64_4.s
2227         $(TEST_AS) -o $@ $<
2228 split_x86_64_n.o: split_x86_64_n.s
2229         $(TEST_AS) -o $@ $<
2230 split_x86_64_1: split_x86_64_1.o split_x86_64_n.o ../ld-new
2231         ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x86_64_1.o split_x86_64_n.o
2232 split_x86_64_1.stdout: split_x86_64_1
2233         $(TEST_OBJDUMP) -d $< > $@
2234 split_x86_64_2: split_x86_64_2.o split_x86_64_n.o ../ld-new
2235         ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x86_64_2.o split_x86_64_n.o
2236 split_x86_64_2.stdout: split_x86_64_2
2237         $(TEST_OBJDUMP) -d $< > $@
2238 split_x86_64_3.stdout: split_x86_64_3.o split_x86_64_n.o ../ld-new
2239         ../ld-new $(SPLIT_DEFSYMS) -o split_x86_64_3 split_x86_64_3.o split_x86_64_n.o > $@ 2>&1 || exit 0
2240 split_x86_64_4: split_x86_64_4.o split_x86_64_n.o ../ld-new
2241         ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x86_64_4.o split_x86_64_n.o
2242 split_x86_64_4.stdout: split_x86_64_4
2243         $(TEST_OBJDUMP) -d $< > $@
2244 split_x86_64_r.stdout: split_x86_64_1.o split_x86_64_n.o ../ld-new
2245         ../ld-new -r split_x86_64_1.o split_x86_64_n.o -o split_x86_64_r > $@ 2>&1 || exit 0
2246 MOSTLYCLEANFILES += split_x86_64_1 split_x86_64_2 split_x86_64_3 \
2247         split_x86_64_4 split_x86_64_r
2248
2249 endif DEFAULT_TARGET_X86_64
2250
2251 if DEFAULT_TARGET_ARM
2252
2253 check_SCRIPTS += arm_abs_global.sh
2254 check_DATA += arm_abs_global.stdout
2255 arm_abs_lib.o: arm_abs_lib.s
2256         $(TEST_AS) -march=armv7-a -o $@ $<
2257 libarm_abs.so: arm_abs_lib.o ../ld-new
2258         ../ld-new -shared -o $@ arm_abs_lib.o
2259 arm_abs_global.o: arm_abs_global.s
2260         $(TEST_AS) -march=armv7-a -o $@ $<
2261 arm_abs_global: arm_abs_global.o libarm_abs.so ../ld-new
2262         ../ld-new -o $@ arm_abs_global.o -L. -larm_abs
2263 arm_abs_global.stdout: arm_abs_global
2264         $(TEST_READELF) -r $< > $@
2265
2266 MOSTLYCLEANFILES += arm_abs_global
2267
2268 check_SCRIPTS += arm_branch_in_range.sh arm_branch_out_of_range.sh
2269 check_DATA += arm_bl_in_range.stdout arm_bl_out_of_range.stdout \
2270         thumb_bl_in_range.stdout thumb_bl_out_of_range.stdout \
2271         thumb2_bl_in_range.stdout thumb2_bl_out_of_range.stdout \
2272         thumb_blx_in_range.stdout thumb_blx_out_of_range.stdout \
2273         thumb2_blx_in_range.stdout thumb2_blx_out_of_range.stdout \
2274         thumb_bl_out_of_range_local.stdout arm_thm_jump11.stdout \
2275         arm_thm_jump8.stdout
2276
2277 arm_bl_in_range.stdout: arm_bl_in_range
2278         $(TEST_OBJDUMP) -D $< > $@
2279
2280 arm_bl_in_range: arm_bl_in_range.o ../ld-new
2281         ../ld-new -T $(srcdir)/arm_branch_range.t -o $@ $<
2282
2283 arm_bl_in_range.o: arm_bl_in_range.s
2284         $(TEST_AS) -o $@ $<
2285
2286 arm_bl_out_of_range.stdout: arm_bl_out_of_range
2287         $(TEST_OBJDUMP) -S $< > $@
2288
2289 arm_bl_out_of_range: arm_bl_out_of_range.o ../ld-new
2290         ../ld-new -T $(srcdir)/arm_branch_range.t -o $@ $<
2291
2292 arm_bl_out_of_range.o: arm_bl_out_of_range.s
2293         $(TEST_AS) -o $@ $<
2294
2295 thumb_bl_in_range.stdout: thumb_bl_in_range
2296         $(TEST_OBJDUMP) -D $< > $@
2297
2298 thumb_bl_in_range: thumb_bl_in_range.o ../ld-new
2299         ../ld-new --no-fix-arm1176 -T $(srcdir)/thumb_branch_range.t -o $@ $<
2300
2301 thumb_bl_in_range.o: thumb_bl_in_range.s
2302         $(TEST_AS) -o $@ -march=armv5te $<
2303
2304 thumb_bl_out_of_range.stdout: thumb_bl_out_of_range
2305         $(TEST_OBJDUMP) -D $< > $@
2306
2307 thumb_bl_out_of_range: thumb_bl_out_of_range.o ../ld-new
2308         ../ld-new --no-fix-arm1176 -T $(srcdir)/thumb_branch_range.t -o $@ $<
2309
2310 thumb_bl_out_of_range.o: thumb_bl_out_of_range.s
2311         $(TEST_AS) -o $@ -march=armv5te $<
2312
2313 thumb2_bl_in_range.stdout: thumb2_bl_in_range
2314         $(TEST_OBJDUMP) -D $< > $@
2315
2316 thumb2_bl_in_range: thumb2_bl_in_range.o ../ld-new
2317         ../ld-new -T $(srcdir)/thumb2_branch_range.t -o $@ $<
2318
2319 thumb2_bl_in_range.o: thumb_bl_in_range.s
2320         $(TEST_AS) -o $@ -march=armv7-a $<
2321
2322 thumb2_bl_out_of_range.stdout: thumb2_bl_out_of_range
2323         $(TEST_OBJDUMP) -D $< > $@
2324
2325 thumb2_bl_out_of_range: thumb2_bl_out_of_range.o ../ld-new
2326         ../ld-new -T $(srcdir)/thumb2_branch_range.t -o $@ $<
2327
2328 thumb2_bl_out_of_range.o: thumb_bl_out_of_range.s
2329         $(TEST_AS) -o $@ -march=armv7-a $<
2330
2331 thumb_blx_in_range.stdout: thumb_blx_in_range
2332         $(TEST_OBJDUMP) -D $< > $@
2333
2334 thumb_blx_in_range: thumb_blx_in_range.o ../ld-new
2335         ../ld-new --no-fix-arm1176 -T $(srcdir)/thumb_branch_range.t -o $@ $<
2336
2337 thumb_blx_in_range.o: thumb_blx_in_range.s
2338         $(TEST_AS) -o $@ -march=armv5te $<
2339
2340 thumb_blx_out_of_range.stdout: thumb_blx_out_of_range
2341         $(TEST_OBJDUMP) -D $< > $@
2342
2343 thumb_blx_out_of_range: thumb_blx_out_of_range.o ../ld-new
2344         ../ld-new --no-fix-arm1176 -T $(srcdir)/thumb_branch_range.t -o $@ $<
2345
2346 thumb_blx_out_of_range.o: thumb_blx_out_of_range.s
2347         $(TEST_AS) -o $@ -march=armv5te $<
2348
2349 thumb2_blx_in_range.stdout: thumb2_blx_in_range
2350         $(TEST_OBJDUMP) -D $< > $@
2351
2352 thumb2_blx_in_range: thumb2_blx_in_range.o ../ld-new
2353         ../ld-new -T $(srcdir)/thumb2_branch_range.t -o $@ $<
2354
2355 thumb2_blx_in_range.o: thumb_blx_in_range.s
2356         $(TEST_AS) -o $@ -march=armv7-a $<
2357
2358 thumb2_blx_out_of_range.stdout: thumb2_blx_out_of_range
2359         $(TEST_OBJDUMP) -D $< > $@
2360
2361 thumb2_blx_out_of_range: thumb2_blx_out_of_range.o ../ld-new
2362         ../ld-new -T $(srcdir)/thumb2_branch_range.t -o $@ $<
2363
2364 thumb2_blx_out_of_range.o: thumb_blx_out_of_range.s
2365         $(TEST_AS) -o $@ -march=armv7-a $<
2366
2367 thumb_bl_out_of_range_local.stdout: thumb_bl_out_of_range_local
2368         $(TEST_OBJDUMP) -D $< > $@
2369
2370 thumb_bl_out_of_range_local: thumb_bl_out_of_range_local.o ../ld-new
2371         ../ld-new --no-fix-arm1176 -T $(srcdir)/thumb_branch_range.t -o $@ $<
2372
2373 thumb_bl_out_of_range_local.o: thumb_bl_out_of_range_local.s
2374         $(TEST_AS) -o $@ -march=armv5te $<
2375
2376 arm_thm_jump11.stdout: arm_thm_jump11
2377         $(TEST_OBJDUMP) -D $< > $@
2378
2379 arm_thm_jump11: arm_thm_jump11.o ../ld-new
2380         ../ld-new -T $(srcdir)/arm_thm_jump11.t -o $@ $<
2381
2382 arm_thm_jump11.o: arm_thm_jump11.s
2383         $(TEST_AS) -o $@ $<
2384
2385 arm_thm_jump8.stdout: arm_thm_jump8
2386         $(TEST_OBJDUMP) -D $< > $@
2387
2388 arm_thm_jump8: arm_thm_jump8.o ../ld-new
2389         ../ld-new -T $(srcdir)/arm_thm_jump8.t -o $@ $<
2390
2391 arm_thm_jump8.o: arm_thm_jump8.s
2392         $(TEST_AS) -o $@ $<
2393
2394 MOSTLYCLEANFILES += arm_bl_in_range arm_bl_out_of_range thumb_bl_in_range \
2395         thumb_bl_out_of_range thumb2_bl_in_range thumb2_bl_out_of_range \
2396         thumb_blx_in_range thumb_blx_out_of_range thumb2_blx_in_range \
2397         thumb2_blx_out_of_range thumb_bl_out_of_range_local arm_thm_jump11 \
2398         arm_thm_jump8
2399
2400 check_SCRIPTS += arm_fix_v4bx.sh
2401 check_DATA += arm_fix_v4bx.stdout arm_fix_v4bx_interworking.stdout \
2402         arm_no_fix_v4bx.stdout
2403
2404 arm_fix_v4bx.stdout: arm_fix_v4bx
2405         $(TEST_OBJDUMP) -D -j.text $< > $@
2406
2407 arm_fix_v4bx: arm_fix_v4bx.o ../ld-new
2408         ../ld-new --no-fix-arm1176 --fix-v4bx -o $@ $<
2409
2410 arm_fix_v4bx.o: arm_fix_v4bx.s
2411         $(TEST_AS) -o $@ $<
2412
2413 arm_fix_v4bx_interworking.stdout: arm_fix_v4bx_interworking
2414         $(TEST_OBJDUMP) -D -j.text $< > $@
2415
2416 arm_fix_v4bx_interworking: arm_fix_v4bx.o ../ld-new
2417         ../ld-new --no-fix-arm1176 --fix-v4bx-interworking -o $@ $<
2418
2419 arm_no_fix_v4bx.stdout: arm_no_fix_v4bx
2420         $(TEST_OBJDUMP) -D -j.text $< > $@
2421
2422 arm_no_fix_v4bx: arm_fix_v4bx.o ../ld-new
2423         ../ld-new --no-fix-arm1176 -o $@ $<
2424
2425 MOSTLYCLEANFILES += arm_fix_v4bx arm_fix_v4bx_interworking arm_no_fix_v4bx
2426
2427 check_SCRIPTS += arm_attr_merge.sh
2428 check_DATA += arm_attr_merge_6.stdout arm_attr_merge_6r.stdout \
2429         arm_attr_merge_7.stdout
2430
2431 arm_attr_merge_6.stdout: arm_attr_merge_6
2432         $(TEST_READELF) -A $< > $@
2433
2434 arm_attr_merge_6: arm_attr_merge_6a.o arm_attr_merge_6b.o
2435         ../ld-new -o $@ arm_attr_merge_6a.o arm_attr_merge_6b.o
2436
2437 arm_attr_merge_6a.o: arm_attr_merge_6a.s
2438         $(TEST_AS) -o $@ $<
2439
2440 arm_attr_merge_6b.o: arm_attr_merge_6b.s
2441         $(TEST_AS) -o $@ $<
2442
2443 arm_attr_merge_6r.stdout: arm_attr_merge_6r
2444         $(TEST_READELF) -A $< > $@
2445
2446 arm_attr_merge_6r: arm_attr_merge_6b.o arm_attr_merge_6a.o
2447         ../ld-new -o $@ arm_attr_merge_6b.o arm_attr_merge_6a.o
2448
2449 arm_attr_merge_7.stdout: arm_attr_merge_7
2450         $(TEST_READELF) -A $< > $@
2451
2452 arm_attr_merge_7: arm_attr_merge_7a.o arm_attr_merge_7b.o
2453         ../ld-new -o $@ arm_attr_merge_7a.o arm_attr_merge_7b.o
2454
2455 arm_attr_merge_7a.o: arm_attr_merge_7a.s
2456         $(TEST_AS) -o $@ $<
2457
2458 arm_attr_merge_7b.o: arm_attr_merge_7b.s
2459         $(TEST_AS) -o $@ $<
2460
2461 MOSTLYCLEANFILES += arm_attr_merge_6 arm_attr_merge_6r arm_attr_merge_7
2462
2463 # ARM1176 workaround test.
2464 check_SCRIPTS += arm_fix_1176.sh
2465 check_DATA += arm_fix_1176_default_v6z.stdout arm_fix_1176_on_v6z.stdout \
2466         arm_fix_1176_off_v6z.stdout arm_fix_1176_default_v5te.stdout \
2467         arm_fix_1176_default_v7a.stdout arm_fix_1176_default_1156t2f_s.stdout
2468
2469 arm_fix_1176_default_v6z.stdout: arm_fix_1176_default_v6z
2470         $(TEST_OBJDUMP) -D -j.foo $< > $@
2471
2472 arm_fix_1176_default_v6z: arm_fix_1176_default_v6z.o ../ld-new
2473         ../ld-new --section-start=.foo=0x2001014 -o $@ $<
2474
2475 arm_fix_1176_default_v6z.o: arm_fix_1176.s
2476         $(TEST_AS) -march=armv6z -o $@ $<
2477
2478 arm_fix_1176_on_v6z.stdout: arm_fix_1176_on_v6z
2479         $(TEST_OBJDUMP) -D -j.foo $< > $@
2480
2481 arm_fix_1176_on_v6z: arm_fix_1176_on_v6z.o ../ld-new
2482         ../ld-new --section-start=.foo=0x2001014 --fix-arm1176 -o $@ $<
2483
2484 arm_fix_1176_on_v6z.o: arm_fix_1176.s
2485         $(TEST_AS) -march=armv6z -o $@ $<
2486
2487 arm_fix_1176_off_v6z.stdout: arm_fix_1176_off_v6z
2488         $(TEST_OBJDUMP) -D -j.foo $< > $@
2489
2490 arm_fix_1176_off_v6z: arm_fix_1176_off_v6z.o ../ld-new
2491         ../ld-new --section-start=.foo=0x2001014 --no-fix-arm1176 -o $@ $<
2492
2493 arm_fix_1176_off_v6z.o: arm_fix_1176.s
2494         $(TEST_AS) -march=armv6z -o $@ $<
2495
2496 arm_fix_1176_default_v5te.stdout: arm_fix_1176_default_v5te
2497         $(TEST_OBJDUMP) -D -j.foo $< > $@
2498
2499 arm_fix_1176_default_v5te: arm_fix_1176_default_v5te.o ../ld-new
2500         ../ld-new --section-start=.foo=0x2001014 -o $@ $<
2501
2502 arm_fix_1176_default_v5te.o: arm_fix_1176.s
2503         $(TEST_AS) -march=armv5te -o $@ $<
2504
2505 arm_fix_1176_default_v7a.stdout: arm_fix_1176_default_v7a
2506         $(TEST_OBJDUMP) -D -j.foo $< > $@
2507
2508 arm_fix_1176_default_v7a: arm_fix_1176_default_v7a.o ../ld-new
2509         ../ld-new --section-start=.foo=0x2001014 -o $@ $<
2510
2511 arm_fix_1176_default_v7a.o: arm_fix_1176.s
2512         $(TEST_AS) -march=armv7-a -o $@ $<
2513
2514 arm_fix_1176_default_1156t2f_s.stdout: arm_fix_1176_default_1156t2f_s
2515         $(TEST_OBJDUMP) -D -j.foo $< > $@
2516
2517 arm_fix_1176_default_1156t2f_s: arm_fix_1176_default_1156t2f_s.o ../ld-new
2518         ../ld-new --section-start=.foo=0x2001014 -o $@ $<
2519
2520 arm_fix_1176_default_1156t2f_s.o: arm_fix_1176.s
2521         $(TEST_AS) -mcpu=arm1156t2f-s -o $@ $<
2522
2523 MOSTLYCLEANFILES += arm_fix_1176_default_v6z arm_fix_1176_on_v6z arm_fix_1176_off_v6z \
2524         arm_fix_1176_default_v5te arm_fix_1176_default_v7a arm_fix_1176_default_1156t2f_s
2525
2526 # Cortex-A8 workaround test.
2527
2528 check_SCRIPTS += arm_cortex_a8.sh
2529 check_DATA += arm_cortex_a8_b_cond.stdout arm_cortex_a8_b.stdout \
2530         arm_cortex_a8_bl.stdout arm_cortex_a8_blx.stdout \
2531         arm_cortex_a8_local.stdout arm_cortex_a8_local_reloc.stdout
2532
2533 arm_cortex_a8_b_cond.stdout: arm_cortex_a8_b_cond
2534         $(TEST_OBJDUMP) -D -j.text $< > $@
2535
2536 arm_cortex_a8_b_cond: arm_cortex_a8_b_cond.o ../ld-new
2537         ../ld-new -o $@ $<
2538
2539 arm_cortex_a8_b_cond.o: arm_cortex_a8_b_cond.s
2540         $(TEST_AS) -o $@ $<
2541
2542 arm_cortex_a8_b.stdout: arm_cortex_a8_b
2543         $(TEST_OBJDUMP) -D -j.text $< > $@
2544
2545 arm_cortex_a8_b: arm_cortex_a8_b.o ../ld-new
2546         ../ld-new --fix-cortex-a8 -o $@ $<
2547
2548 arm_cortex_a8_b.o: arm_cortex_a8_b.s
2549         $(TEST_AS) -o $@ $<
2550
2551 arm_cortex_a8_bl.stdout: arm_cortex_a8_bl
2552         $(TEST_OBJDUMP) -D -j.text $< > $@
2553
2554 arm_cortex_a8_bl: arm_cortex_a8_bl.o ../ld-new
2555         ../ld-new -o $@ $<
2556
2557 arm_cortex_a8_bl.o: arm_cortex_a8_bl.s
2558         $(TEST_AS) -o $@ $<
2559
2560 arm_cortex_a8_blx.stdout: arm_cortex_a8_blx
2561         $(TEST_OBJDUMP) -D -j.text $< > $@
2562
2563 arm_cortex_a8_blx: arm_cortex_a8_blx.o ../ld-new
2564         ../ld-new -o $@ $<
2565
2566 arm_cortex_a8_blx.o: arm_cortex_a8_blx.s
2567         $(TEST_AS) -o $@ $<
2568
2569 arm_cortex_a8_local.stdout: arm_cortex_a8_local
2570         $(TEST_OBJDUMP) -D -j.text $< > $@
2571
2572 arm_cortex_a8_local: arm_cortex_a8_local.o ../ld-new
2573         ../ld-new -o $@ $<
2574
2575 arm_cortex_a8_local.o: arm_cortex_a8_local.s
2576         $(TEST_AS) -o $@ $<
2577
2578 arm_cortex_a8_local_reloc.stdout: arm_cortex_a8_local_reloc
2579         $(TEST_OBJDUMP) -D -j.text $< > $@
2580
2581 arm_cortex_a8_local_reloc: arm_cortex_a8_local_reloc.o ../ld-new
2582         ../ld-new -o $@ $<
2583
2584 arm_cortex_a8_local_reloc.o: arm_cortex_a8_local_reloc.s
2585         $(TEST_AS) -o $@ $<
2586
2587 MOSTLYCLEANFILES += arm_cortex_a8_b_cond arm_cortex_a8_b arm_cortex_a8_bl \
2588         arm_cortex_a8_blx arm_cortex_a8_local arm_cortex_a8_local_reloc
2589
2590 check_SCRIPTS += arm_exidx_test.sh
2591 check_DATA += arm_exidx_test.stdout
2592
2593 arm_exidx_test.stdout: arm_exidx_test.so
2594         $(TEST_READELF) -Sr $< > $@
2595
2596 arm_exidx_test.so: arm_exidx_test.o ../ld-new
2597         ../ld-new -shared -o $@ $<
2598
2599 arm_exidx_test.o: arm_exidx_test.s
2600         $(TEST_AS) -o $@ $<
2601
2602 check_SCRIPTS += pr12826.sh
2603 check_DATA += pr12826.stdout
2604
2605 pr12826.stdout: pr12826.so
2606         $(TEST_READELF) -A $< > $@
2607
2608 pr12826.so: pr12826_1.o pr12826_2.o ../ld-new
2609         ../ld-new -shared -o $@ $<
2610
2611 pr12826_1.o: pr12826_1.s
2612         $(TEST_AS) -o $@ $<
2613
2614 pr12826_2.o: pr12826_2.s
2615         $(TEST_AS) -o $@ $<
2616
2617 check_SCRIPTS += arm_unaligned_reloc.sh
2618 check_DATA += arm_unaligned_reloc.stdout arm_unaligned_reloc_r.stdout
2619
2620 arm_unaligned_reloc.stdout: arm_unaligned_reloc
2621         $(TEST_OBJDUMP) -D $< > $@
2622
2623 arm_unaligned_reloc_r.stdout: arm_unaligned_reloc_r
2624         $(TEST_OBJDUMP) -Dr $< > $@
2625
2626 arm_unaligned_reloc: arm_unaligned_reloc.o ../ld-new
2627         ../ld-new -o $@ $<
2628
2629 arm_unaligned_reloc_r: arm_unaligned_reloc.o ../ld-new
2630         ../ld-new -r -o $@ $<
2631
2632 arm_unaligned_reloc.o: arm_unaligned_reloc.s
2633         $(TEST_AS) -o $@ $<
2634
2635 MOSTLYCLEANFILES += arm_unaligned_reloc arm_unaligned_reloc_r
2636
2637 # Check ARM to ARM farcall veneers
2638
2639 check_SCRIPTS += arm_farcall_arm_arm.sh
2640 check_DATA += arm_farcall_arm_arm.stdout
2641
2642 arm_farcall_arm_arm.stdout: arm_farcall_arm_arm
2643         $(TEST_OBJDUMP) -d $< > $@
2644
2645 arm_farcall_arm_arm: arm_farcall_arm_arm.o ../ld-new
2646         ../ld-new --no-fix-arm1176 --section-start .text=0x1000 --section-start .foo=0x2001020 -o $@ $<
2647
2648 arm_farcall_arm_arm.o: arm_farcall_arm_arm.s
2649         $(TEST_AS) -o $@ $<
2650
2651 MOSTLYCLEANFILES += arm_farcall_arm_arm
2652
2653 # Check ARM to Thumb farcall veneers
2654
2655 check_SCRIPTS += arm_farcall_arm_thumb.sh
2656 check_DATA += arm_farcall_arm_thumb.stdout arm_farcall_arm_thumb_5t.stdout
2657
2658 arm_farcall_arm_thumb.stdout: arm_farcall_arm_thumb
2659         $(TEST_OBJDUMP) -D $< > $@
2660
2661 arm_farcall_arm_thumb: arm_farcall_arm_thumb.o ../ld-new
2662         ../ld-new --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
2663
2664 arm_farcall_arm_thumb.o: arm_farcall_arm_thumb.s
2665         $(TEST_AS) -o $@ $<
2666
2667 arm_farcall_arm_thumb_5t.stdout: arm_farcall_arm_thumb_5t
2668         $(TEST_OBJDUMP) -D $< > $@
2669
2670 arm_farcall_arm_thumb_5t: arm_farcall_arm_thumb_5t.o ../ld-new
2671         ../ld-new --no-fix-arm1176 --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
2672
2673 arm_farcall_arm_thumb_5t.o: arm_farcall_arm_thumb.s
2674         $(TEST_AS) -march=armv5t -o $@ $<
2675
2676 MOSTLYCLEANFILES += arm_farcall_arm_thumb arm_farcall_arm_thumb_5t
2677
2678 # Check Thumb to Thumb farcall veneers
2679
2680 check_SCRIPTS += arm_farcall_thumb_thumb.sh
2681 check_DATA += arm_farcall_thumb_thumb.stdout \
2682               arm_farcall_thumb_thumb_5t.stdout \
2683               arm_farcall_thumb_thumb_7m.stdout \
2684               arm_farcall_thumb_thumb_6m.stdout
2685
2686 arm_farcall_thumb_thumb.stdout: arm_farcall_thumb_thumb
2687         $(TEST_OBJDUMP) -D $< > $@
2688
2689 arm_farcall_thumb_thumb: arm_farcall_thumb_thumb.o ../ld-new
2690         ../ld-new --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
2691
2692 arm_farcall_thumb_thumb.o: arm_farcall_thumb_thumb.s
2693         $(TEST_AS) -march=armv4t -o $@ $<
2694
2695 arm_farcall_thumb_thumb_5t.stdout: arm_farcall_thumb_thumb_5t
2696         $(TEST_OBJDUMP) -D $< > $@
2697
2698 arm_farcall_thumb_thumb_5t: arm_farcall_thumb_thumb_5t.o ../ld-new
2699         ../ld-new --no-fix-arm1176 --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
2700
2701 arm_farcall_thumb_thumb_5t.o: arm_farcall_thumb_thumb.s
2702         $(TEST_AS) -march=armv5t -o $@ $<
2703
2704 arm_farcall_thumb_thumb_7m.stdout: arm_farcall_thumb_thumb_7m
2705         $(TEST_OBJDUMP) -D $< > $@
2706
2707 arm_farcall_thumb_thumb_7m: arm_farcall_thumb_thumb_7m.o ../ld-new
2708         ../ld-new --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
2709
2710 arm_farcall_thumb_thumb_7m.o: arm_farcall_thumb_thumb.s
2711         $(TEST_AS) -march=armv7-m -o $@ $<
2712
2713 arm_farcall_thumb_thumb_6m.stdout: arm_farcall_thumb_thumb_6m
2714         $(TEST_OBJDUMP) -D $< > $@
2715
2716 arm_farcall_thumb_thumb_6m: arm_farcall_thumb_thumb_6m.o ../ld-new
2717         ../ld-new --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
2718
2719 arm_farcall_thumb_thumb_6m.o: arm_farcall_thumb_thumb.s
2720         $(TEST_AS) -march=armv6-m -o $@ $<
2721
2722 MOSTLYCLEANFILES += arm_farcall_thumb_thumb arm_farcall_thumb_thumb_5t \
2723                     arm_farcall_thumb_thumb_7m arm_farcall_thumb_thumb_6m
2724
2725 # Check Thumb to ARM farcall veneers
2726
2727 check_SCRIPTS += arm_farcall_thumb_arm.sh
2728 check_DATA += arm_farcall_thumb_arm.stdout \
2729               arm_farcall_thumb_arm_5t.stdout
2730
2731 arm_farcall_thumb_arm.stdout: arm_farcall_thumb_arm
2732         $(TEST_OBJDUMP) -D $< > $@
2733
2734 arm_farcall_thumb_arm: arm_farcall_thumb_arm.o ../ld-new
2735         ../ld-new --section-start .text=0x1c01010 --section-start .foo=0x2001014 -o $@ $<
2736
2737 arm_farcall_thumb_arm.o: arm_farcall_thumb_arm.s
2738         $(TEST_AS) -o $@ $<
2739
2740 arm_farcall_thumb_arm_5t.stdout: arm_farcall_thumb_arm_5t
2741         $(TEST_OBJDUMP) -D $< > $@
2742
2743 arm_farcall_thumb_arm_5t: arm_farcall_thumb_arm_5t.o ../ld-new
2744         ../ld-new --no-fix-arm1176 --section-start .text=0x1c01010 --section-start .foo=0x2001014 -o $@ $<
2745
2746 arm_farcall_thumb_arm_5t.o: arm_farcall_thumb_arm.s
2747         $(TEST_AS) -march=armv5t -o $@ $<
2748
2749 MOSTLYCLEANFILES += arm_farcall_thumb_arm arm_farcall_thumb_arm_5t
2750
2751 endif DEFAULT_TARGET_ARM
2752
2753 endif NATIVE_OR_CROSS_LINKER
2754
2755 # Tests for the dwp tool.
2756 # We don't want to rely yet on GCC support for -gsplit-dwarf,
2757 # so we use (for now) test cases in x86 assembly language,
2758 # compiled from the dwp_test_*.cc sources.
2759
2760 if DEFAULT_TARGET_X86_64
2761
2762 dwp_test_main.o: dwp_test_main.s
2763         $(TEST_AS) -o $@ $<
2764 dwp_test_1.o: dwp_test_1.s
2765         $(TEST_AS) -o $@ $<
2766 dwp_test_1b.o: dwp_test_1b.s
2767         $(TEST_AS) -o $@ $<
2768 dwp_test_2.o: dwp_test_2.s
2769         $(TEST_AS) -o $@ $<
2770
2771 dwp_test_main.dwo: dwp_test_main.o
2772         $(TEST_OBJCOPY) --extract-dwo $< $@
2773 dwp_test_1.dwo: dwp_test_1.o
2774         $(TEST_OBJCOPY) --extract-dwo $< $@
2775 dwp_test_1b.dwo: dwp_test_1b.o
2776         $(TEST_OBJCOPY) --extract-dwo $< $@
2777 dwp_test_2.dwo: dwp_test_2.o
2778         $(TEST_OBJCOPY) --extract-dwo $< $@
2779
2780 check_SCRIPTS += dwp_test_1.sh
2781 check_DATA += dwp_test_1.stdout
2782 dwp_test_1.stdout: dwp_test_1.dwp
2783         $(TEST_READELF) -wi $< > $@
2784 dwp_test_1.dwp: ../dwp dwp_test_main.dwo dwp_test_1.dwo dwp_test_1b.dwo dwp_test_2.dwo
2785         ../dwp -o $@ dwp_test_main.dwo dwp_test_1.dwo dwp_test_1b.dwo dwp_test_2.dwo
2786
2787 check_SCRIPTS += dwp_test_2.sh
2788 check_DATA += dwp_test_2.stdout
2789 dwp_test_2.stdout: dwp_test_2.dwp
2790         $(TEST_READELF) -wi $< > $@
2791 dwp_test_2.dwp: ../dwp dwp_test_2a.dwp dwp_test_2b.dwp
2792         ../dwp -o $@ dwp_test_2a.dwp dwp_test_2b.dwp
2793 dwp_test_2a.dwp: ../dwp dwp_test_main.dwo dwp_test_1.dwo
2794         ../dwp -o $@ dwp_test_main.dwo dwp_test_1.dwo
2795 dwp_test_2b.dwp: ../dwp dwp_test_1b.dwo dwp_test_2.dwo
2796         ../dwp -o $@ dwp_test_1b.dwo dwp_test_2.dwo
2797
2798 endif DEFAULT_TARGET_X86_64