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