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