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