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