2010-05-26 Rafael Espindola <espindola@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
1171 check_SCRIPTS += script_test_9.sh
1172 check_DATA += script_test_9.stdout
1173 script_test_9.o: script_test_9.cc
1174         $(CXXCOMPILE) -O0 -c -o $@ $<
1175 script_test_9: gcctestdir/ld $(srcdir)/script_test_9.t script_test_9.o
1176         $(CXXLINK) -Bgcctestdir/ script_test_9.o -T $(srcdir)/script_test_9.t
1177 script_test_9.stdout: script_test_9
1178         $(TEST_READELF) -lW script_test_9 > script_test_9.stdout
1179
1180
1181 # Test --dynamic-list, --dynamic-list-data, --dynamic-list-cpp-new,
1182 # and --dynamic-list-cpp-typeinfo
1183
1184 check_SCRIPTS += dynamic_list.sh
1185 check_DATA += dynamic_list.stdout
1186 MOSTLYCLEANFILES += dynamic_list dynamic_list.stdout
1187 dynamic_list: basic_test.o gcctestdir/ld $(srcdir)/dynamic_list.t
1188         $(CXXLINK) -Bgcctestdir/ basic_test.o \
1189           -Wl,--dynamic-list $(srcdir)/dynamic_list.t \
1190           -Wl,--dynamic-list-data \
1191           -Wl,--dynamic-list-cpp-new \
1192           -Wl,--dynamic-list-cpp-typeinfo
1193 dynamic_list.stdout: dynamic_list
1194         $(TEST_READELF) -W --dyn-syms dynamic_list > dynamic_list.stdout
1195
1196 check_PROGRAMS += thin_archive_test_1
1197 MOSTLYCLEANFILES += libthin1.a libthin3.a libthinall.a \
1198         alt/thin_archive_test_2.o alt/thin_archive_test_4.o \
1199         alt/libthin2.a alt/libthin4.a
1200 thin_archive_test_1_SOURCES = thin_archive_main.cc
1201 thin_archive_test_1_DEPENDENCIES = gcctestdir/ld libthin1.a alt/libthin2.a
1202 thin_archive_test_1_LDFLAGS = -Bgcctestdir/ -Lalt
1203 thin_archive_test_1_LDADD = libthin1.a -lthin2
1204
1205 check_PROGRAMS += thin_archive_test_2
1206 thin_archive_test_2_SOURCES = thin_archive_main.cc
1207 thin_archive_test_2_DEPENDENCIES = gcctestdir/ld libthinall.a
1208 thin_archive_test_2_LDFLAGS = -Bgcctestdir/ -L.
1209 thin_archive_test_2_LDADD = -lthinall
1210
1211 libthin1.a: thin_archive_test_1.o alt/thin_archive_test_2.o
1212         rm -f $@
1213         $(TEST_AR) crT $@ $^
1214 alt/libthin2.a: thin_archive_test_3.o alt/thin_archive_test_4.o
1215         rm -f $@
1216         $(TEST_AR) crT $@ $^
1217 libthin3.a: thin_archive_test_1.o alt/thin_archive_test_4.o
1218         rm -f $@
1219         $(TEST_AR) crT $@ $^
1220 alt/libthin4.a: alt/thin_archive_test_2.o thin_archive_test_3.o
1221         rm -f $@
1222         $(TEST_AR) crT $@ $^
1223 libthinall.a: libthin3.a alt/libthin4.a
1224         rm -f $@
1225         $(TEST_AR) crT $@ $^
1226 alt/thin_archive_test_2.o: thin_archive_test_2.cc
1227         test -d alt || mkdir -p alt
1228         $(CXXCOMPILE) -c -o $@ $<
1229 alt/thin_archive_test_4.o: thin_archive_test_4.cc
1230         test -d alt || mkdir -p alt
1231         $(CXXCOMPILE) -c -o $@ $<
1232
1233 if PLUGINS
1234
1235 check_PROGRAMS += plugin_test_1
1236 check_SCRIPTS += plugin_test_1.sh
1237 check_DATA += plugin_test_1.err
1238 MOSTLYCLEANFILES += plugin_test_1.err
1239 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
1240         $(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
1241 plugin_test_1.err: plugin_test_1
1242         @touch plugin_test_1.err
1243
1244 check_PROGRAMS += plugin_test_2
1245 check_SCRIPTS += plugin_test_2.sh
1246 check_DATA += plugin_test_2.err
1247 MOSTLYCLEANFILES += plugin_test_2.err
1248 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
1249         $(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
1250 plugin_test_2.err: plugin_test_2
1251         @touch plugin_test_2.err
1252
1253 check_PROGRAMS += plugin_test_3
1254 check_SCRIPTS += plugin_test_3.sh
1255 check_DATA += plugin_test_3.err
1256 MOSTLYCLEANFILES += plugin_test_3.err
1257 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
1258         $(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
1259 plugin_test_3.err: plugin_test_3
1260         @touch plugin_test_3.err
1261
1262 check_PROGRAMS += plugin_test_4
1263 check_SCRIPTS += plugin_test_4.sh
1264 check_DATA += plugin_test_4.err
1265 MOSTLYCLEANFILES += plugin_test_4.a plugin_test_4.err
1266 plugin_test_4: two_file_test_main.o plugin_test_4.a gcctestdir/ld plugin_test.so
1267         $(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
1268 plugin_test_4.err: plugin_test_4
1269         @touch plugin_test_4.err
1270
1271 plugin_test_4.a: two_file_test_1.syms two_file_test_1b.syms two_file_test_2.syms
1272         $(TEST_AR) cr $@ $^
1273
1274 check_PROGRAMS += plugin_test_5
1275 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
1276         $(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
1277
1278 check_PROGRAMS += plugin_test_6
1279 check_SCRIPTS += plugin_test_6.sh
1280 check_DATA += plugin_test_6.err
1281 MOSTLYCLEANFILES += plugin_test_6.err
1282 plugin_test_6: plugin_common_test_1.syms plugin_common_test_2.syms gcctestdir/ld plugin_test.so
1283         $(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle,--plugin,"./plugin_test.so" plugin_common_test_1.syms plugin_common_test_2.syms 2>plugin_test_6.err
1284 plugin_test_6.err: plugin_test_6
1285         @touch plugin_test_6.err
1286
1287 check_PROGRAMS += plugin_test_7
1288 check_SCRIPTS += plugin_test_7.sh
1289 check_DATA += plugin_test_7.err plugin_test_7.syms
1290 MOSTLYCLEANFILES += plugin_test_7.err
1291 plugin_test_7: plugin_test_7_1.o plugin_test_7_1.syms plugin_test_7_2.o gcctestdir/ld plugin_test.so
1292         $(LINK) -Bgcctestdir/ -Wl,--no-demangle,--plugin,"./plugin_test.so",--gc-sections,--print-gc-sections plugin_test_7_1.syms plugin_test_7_2.o 2>plugin_test_7.err
1293 plugin_test_7.syms: plugin_test_7
1294         $(TEST_READELF) -sW $< >$@ 2>/dev/null
1295 plugin_test_7_1.o: plugin_test_7_1.c
1296         $(COMPILE) -DLTO -O0 -c -ffunction-sections -fdata-sections -o $@ $<
1297 plugin_test_7_1_orig.o: plugin_test_7_1.c
1298         $(COMPILE) -O0 -c -ffunction-sections -fdata-sections -o $@ $<
1299 plugin_test_7_1.syms: plugin_test_7_1_orig.o
1300         $(TEST_READELF) -sW $< >$@ 2>/dev/null
1301 plugin_test_7_2.o: plugin_test_7_2.c
1302         $(COMPILE) -O0 -c -ffunction-sections -fdata-sections -o $@ $<
1303 plugin_test_7.err: plugin_test_7
1304
1305 plugin_test.so: plugin_test.o
1306         $(LINK) -Bgcctestdir/ -shared plugin_test.o
1307 plugin_test.o: plugin_test.c
1308         $(COMPILE) -O0 -c -fpic -o $@ $<
1309
1310 two_file_test_main.syms: two_file_test_main.o
1311         $(TEST_READELF) -sW $< >$@ 2>/dev/null
1312 two_file_test_1.syms: two_file_test_1.o
1313         $(TEST_READELF) -sW $< >$@ 2>/dev/null
1314 two_file_test_1b.syms: two_file_test_1b.o
1315         $(TEST_READELF) -sW $< >$@ 2>/dev/null
1316 two_file_test_2.syms: two_file_test_2.o
1317         $(TEST_READELF) -sW $< >$@ 2>/dev/null
1318 plugin_common_test_1.syms: plugin_common_test_1.o
1319         $(TEST_READELF) -sW $< >$@ 2>/dev/null
1320 plugin_common_test_2.syms: plugin_common_test_2.o
1321         $(TEST_READELF) -sW $< >$@ 2>/dev/null
1322
1323 empty.syms:
1324         @echo "" >$@
1325         @echo "Symbol table" >>$@
1326
1327 MOSTLYCLEANFILES += unused.c
1328 unused.syms: unused.o
1329         $(TEST_READELF) -sW $< >$@ 2>/dev/null
1330         @echo "     1: 00000000     4 FUNC    GLOBAL DEFAULT    1 UNUSED" >>$@
1331 unused.o: unused.c
1332         $(COMPILE) -c -o $@ $<
1333 unused.c:
1334         @cp /dev/null $@
1335
1336 endif PLUGINS
1337
1338 check_PROGRAMS += exclude_libs_test
1339 check_SCRIPTS += exclude_libs_test.sh
1340 check_DATA += exclude_libs_test.syms
1341 MOSTLYCLEANFILES += exclude_libs_test.syms libexclude_libs_test_1.a \
1342         libexclude_libs_test_2.a alt/libexclude_libs_test_3.a
1343 exclude_libs_test_SOURCES = exclude_libs_test.c
1344 exclude_libs_test_DEPENDENCIES = gcctestdir/ld libexclude_libs_test_1.a \
1345         libexclude_libs_test_2.a alt/libexclude_libs_test_3.a
1346 exclude_libs_test_LDFLAGS = -Bgcctestdir/ -L. -Lalt \
1347         -Wl,--exclude-libs,dummy:libexclude_libs_test_1 \
1348         -Wl,--exclude-libs,libexclude_libs_test_3
1349 exclude_libs_test_LDADD = -lexclude_libs_test_1 -lexclude_libs_test_2 \
1350         alt/libexclude_libs_test_3.a
1351 exclude_libs_test.syms: exclude_libs_test
1352         $(TEST_READELF) -sW $< >$@ 2>/dev/null
1353 libexclude_libs_test_1.a: exclude_libs_test_1.o
1354         $(TEST_AR) rc $@ $^
1355 libexclude_libs_test_2.a: exclude_libs_test_2.o
1356         $(TEST_AR) rc $@ $^
1357 alt/libexclude_libs_test_3.a: exclude_libs_test_3.o
1358         test -d alt || mkdir -p alt
1359         $(TEST_AR) rc $@ $^
1360
1361 check_PROGRAMS += local_labels_test
1362 local_labels_test.o: ver_test_6.c
1363         $(COMPILE) -g -c -Wa,-L -o $@ $<
1364 local_labels_test: local_labels_test.o
1365         $(LINK) -Bgcctestdir/ local_labels_test.o
1366
1367 check_PROGRAMS += discard_locals_test
1368 check_SCRIPTS += discard_locals_test.sh
1369 check_DATA += discard_locals_test.syms \
1370         discard_locals_relocatable_test1.syms \
1371         discard_locals_relocatable_test2.syms
1372 MOSTLYCLEANFILES += discard_locals_test.syms \
1373         discard_locals_relocatable_test1.syms \
1374         discard_locals_relocatable_test2.syms \
1375         discard_locals_relocatable_test1.out \
1376         discard_locals_relocatable_test2.out
1377 discard_locals_test_SOURCES = discard_locals_test.c
1378 discard_locals_test_LDFLAGS = -Bgcctestdir/ -Wl,--discard-locals
1379 discard_locals_test.syms: discard_locals_test
1380         $(TEST_READELF) -sW $< >$@ 2>/dev/null
1381 # '-Wa,-L' is required to preserve the local label used for testing.
1382 discard_locals_test.o: discard_locals_test.c
1383         $(COMPILE) -c -Wa,-L -o $@ $<
1384
1385 discard_locals_relocatable_test1.syms: discard_locals_relocatable_test1.out
1386         $(TEST_READELF) -sW $< >$@ 2>/dev/null
1387 discard_locals_relocatable_test.o: discard_locals_relocatable_test.c
1388         $(COMPILE) -c -Wa,-L -fPIC -o $@ $<
1389 discard_locals_relocatable_test1.out: discard_locals_relocatable_test.o ../ld-new
1390         ../ld-new --discard-locals -relocatable -o $@ $<
1391
1392 discard_locals_relocatable_test2.syms: discard_locals_relocatable_test2.out
1393         $(TEST_READELF) -sW $< >$@ 2>/dev/null
1394 discard_locals_relocatable_test2.out: discard_locals_relocatable_test.o ../ld-new
1395         ../ld-new --discard-all -relocatable -o $@ $<
1396
1397 if MCMODEL_MEDIUM
1398 check_PROGRAMS += large
1399 large_SOURCES = large.c
1400 large_CFLAGS = -mcmodel=medium
1401 large_DEPENDENCIES = gcctestdir/ld
1402 large_LDFLAGS = -Bgcctestdir/
1403 large_LDADD =
1404 endif MCMODEL_MEDIUM
1405
1406 # Test that hidden and internal symbols in the main program cannot be
1407 # referenced by a shared library.
1408 check_SCRIPTS += hidden_test.sh
1409 check_DATA += hidden_test.err
1410 MOSTLYCLEANFILES += hidden_test hidden_test.err
1411 libhidden.so: hidden_test_1.c gcctestdir/ld
1412         $(COMPILE) -Bgcctestdir/ -g -shared -fPIC -w -o $@ $(srcdir)/hidden_test_1.c
1413 hidden_test: hidden_test_main.o libhidden.so gcctestdir/ld
1414         $(LINK) -Bgcctestdir/ -Wl,-R,. hidden_test_main.o libhidden.so 2>hidden_test.err
1415 hidden_test.err: hidden_test
1416         @touch hidden_test.err
1417
1418 # Test -retain-symbols-file.
1419 check_SCRIPTS += retain_symbols_file_test.sh
1420 check_DATA += retain_symbols_file_test.stdout
1421 MOSTLYCLEANFILES += retain_symbols_file_test retain_symbols_file_test.in \
1422                     retain_symbols_file_test.stdout
1423 retain_symbols_file_test.so: basic_pic_test.o gcctestdir/ld
1424         echo 'main' > retain_symbols_file_test.in
1425         echo 't1' >> retain_symbols_file_test.in
1426         echo '_ZN4t16bC1Ev' >> retain_symbols_file_test.in
1427         echo '_ZNK4t20a3getEv' >> retain_symbols_file_test.in
1428         echo '_Z3t18v' >> retain_symbols_file_test.in
1429         echo '__tcf_0' >> retain_symbols_file_test.in   
1430         $(CXXLINK) -Bgcctestdir/ -shared -Wl,-retain-symbols-file,retain_symbols_file_test.in basic_pic_test.o
1431 retain_symbols_file_test.stdout: retain_symbols_file_test.so
1432         $(TEST_NM) -C retain_symbols_file_test.so > $@
1433
1434
1435 # Test that if the output file already exists and is empty,
1436 # it will get execute permission.
1437 check_PROGRAMS += permission_test
1438 permission_test: basic_test.o gcctestdir/ld
1439         umask 022; \
1440         rm -f $@; \
1441         touch $@; \
1442         chmod 600 $@; \
1443         $(CXXLINK) -Bgcctestdir/ basic_test.o
1444
1445 # Check -l:foo.a
1446 check_PROGRAMS += searched_file_test
1447 MOSTLYCLEANFILES += searched_file_test searched_file_test_lib.o \
1448                     alt/searched_file_test_lib.a
1449 searched_file_test_SOURCES = searched_file_test.cc
1450 searched_file_test_DEPENDENCIES = alt/searched_file_test_lib.a
1451 searched_file_test_LDFLAGS = -Bgcctestdir/ -Lalt
1452 searched_file_test_LDADD = -l:searched_file_test_lib.a
1453 searched_file_test_lib.o: searched_file_test_lib.cc
1454         $(CXXCOMPILE) -c -o $@ $<
1455 alt/searched_file_test_lib.a: searched_file_test_lib.o
1456         test -d alt || mkdir -p alt
1457         $(TEST_AR) rc $@ $^
1458
1459 # Test that no .gnu.version sections are created when 
1460 # symbol versioning is not used.
1461 check_SCRIPTS += no_version_test.sh
1462 check_DATA += no_version_test.stdout
1463 MOSTLYCLEANFILES += libno_version_test.so no_version_test.stdout
1464 # We invoke the linker directly since gcc may include additional objects that
1465 # uses symbol versioning.
1466 libno_version_test.so: no_version_test.o gcctestdir/ld
1467         gcctestdir/ld -shared -o $@ no_version_test.o
1468 no_version_test.o: no_version_test.c
1469         $(COMPILE) -o $@ -c -fPIC $<
1470 no_version_test.stdout: libno_version_test.so
1471         $(TEST_OBJDUMP) -h $< > $@
1472
1473 endif GCC
1474 endif NATIVE_LINKER
1475
1476 # These tests work with cross linkers.
1477
1478 if DEFAULT_TARGET_I386
1479
1480 check_SCRIPTS += split_i386.sh
1481 check_DATA += split_i386_1.stdout split_i386_2.stdout \
1482         split_i386_3.stdout split_i386_4.stdout split_i386_r.stdout
1483 SPLIT_DEFSYMS = --defsym __morestack=0x100 --defsym __morestack_non_split=0x200
1484 split_i386_1.o: split_i386_1.s
1485         $(TEST_AS) -o $@ $<
1486 split_i386_2.o: split_i386_2.s
1487         $(TEST_AS) -o $@ $<
1488 split_i386_3.o: split_i386_3.s
1489         $(TEST_AS) -o $@ $<
1490 split_i386_4.o: split_i386_4.s
1491         $(TEST_AS) -o $@ $<
1492 split_i386_n.o: split_i386_n.s
1493         $(TEST_AS) -o $@ $<
1494 split_i386_1: split_i386_1.o split_i386_n.o ../ld-new
1495         ../ld-new $(SPLIT_DEFSYMS) -o $@ split_i386_1.o split_i386_n.o
1496 split_i386_1.stdout: split_i386_1
1497         $(TEST_OBJDUMP) -d $< > $@
1498 split_i386_2: split_i386_2.o split_i386_n.o ../ld-new
1499         ../ld-new $(SPLIT_DEFSYMS) -o $@ split_i386_2.o split_i386_n.o
1500 split_i386_2.stdout: split_i386_2
1501         $(TEST_OBJDUMP) -d $< > $@
1502 split_i386_3.stdout: split_i386_3.o split_i386_n.o ../ld-new
1503         ../ld-new $(SPLIT_DEFSYMS) -o split_i386_3 split_i386_3.o split_i386_n.o > $@ 2>&1 || exit 0
1504 split_i386_4: split_i386_4.o split_i386_n.o ../ld-new
1505         ../ld-new $(SPLIT_DEFSYMS) -o $@ split_i386_4.o split_i386_n.o
1506 split_i386_4.stdout: split_i386_4
1507         $(TEST_OBJDUMP) -d $< > $@
1508 split_i386_r.stdout: split_i386_1.o split_i386_n.o ../ld-new
1509         ../ld-new -r split_i386_1.o split_i386_n.o -o split_i386_r > $@ 2>&1 || exit 0
1510 MOSTLYCLEANFILES += split_i386_1 split_i386_2 split_i386_3 \
1511         split_i386_4 split_i386_r
1512
1513 endif DEFAULT_TARGET_I386
1514
1515 if DEFAULT_TARGET_X86_64
1516
1517 check_SCRIPTS += split_x86_64.sh
1518 check_DATA += split_x86_64_1.stdout split_x86_64_2.stdout \
1519         split_x86_64_3.stdout split_x86_64_4.stdout split_x86_64_r.stdout
1520 SPLIT_DEFSYMS = --defsym __morestack=0x100 --defsym __morestack_non_split=0x200
1521 split_x86_64_1.o: split_x86_64_1.s
1522         $(TEST_AS) -o $@ $<
1523 split_x86_64_2.o: split_x86_64_2.s
1524         $(TEST_AS) -o $@ $<
1525 split_x86_64_3.o: split_x86_64_3.s
1526         $(TEST_AS) -o $@ $<
1527 split_x86_64_4.o: split_x86_64_4.s
1528         $(TEST_AS) -o $@ $<
1529 split_x86_64_n.o: split_x86_64_n.s
1530         $(TEST_AS) -o $@ $<
1531 split_x86_64_1: split_x86_64_1.o split_x86_64_n.o ../ld-new
1532         ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x86_64_1.o split_x86_64_n.o
1533 split_x86_64_1.stdout: split_x86_64_1
1534         $(TEST_OBJDUMP) -d $< > $@
1535 split_x86_64_2: split_x86_64_2.o split_x86_64_n.o ../ld-new
1536         ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x86_64_2.o split_x86_64_n.o
1537 split_x86_64_2.stdout: split_x86_64_2
1538         $(TEST_OBJDUMP) -d $< > $@
1539 split_x86_64_3.stdout: split_x86_64_3.o split_x86_64_n.o ../ld-new
1540         ../ld-new $(SPLIT_DEFSYMS) -o split_x86_64_3 split_x86_64_3.o split_x86_64_n.o > $@ 2>&1 || exit 0
1541 split_x86_64_4: split_x86_64_4.o split_x86_64_n.o ../ld-new
1542         ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x86_64_4.o split_x86_64_n.o
1543 split_x86_64_4.stdout: split_x86_64_4
1544         $(TEST_OBJDUMP) -d $< > $@
1545 split_x86_64_r.stdout: split_x86_64_1.o split_x86_64_n.o ../ld-new
1546         ../ld-new -r split_x86_64_1.o split_x86_64_n.o -o split_x86_64_r > $@ 2>&1 || exit 0
1547 MOSTLYCLEANFILES += split_x86_64_1 split_x86_64_2 split_x86_64_3 \
1548         split_x86_64_4 split_x86_64_r
1549
1550 endif DEFAULT_TARGET_X86_64
1551
1552 if DEFAULT_TARGET_ARM
1553
1554 check_SCRIPTS += arm_abs_global.sh
1555 check_DATA += arm_abs_global.stdout
1556 arm_abs_lib.o: arm_abs_lib.s
1557         $(TEST_AS) -march=armv7-a -o $@ $<
1558 libarm_abs.so: arm_abs_lib.o ../ld-new
1559         ../ld-new -shared -o $@ arm_abs_lib.o
1560 arm_abs_global.o: arm_abs_global.s
1561         $(TEST_AS) -march=armv7-a -o $@ $<
1562 arm_abs_global: arm_abs_global.o libarm_abs.so ../ld-new
1563         ../ld-new -o $@ arm_abs_global.o -L. -larm_abs
1564 arm_abs_global.stdout: arm_abs_global
1565         $(TEST_READELF) -r $< > $@
1566
1567 MOSTLYCLEANFILES += arm_abs_global
1568
1569 check_SCRIPTS += arm_branch_in_range.sh
1570 check_DATA += arm_bl_in_range.stdout arm_bl_out_of_range.stdout \
1571         thumb_bl_in_range.stdout thumb_bl_out_of_range.stdout \
1572         thumb2_bl_in_range.stdout thumb2_bl_out_of_range.stdout \
1573         thumb_blx_in_range.stdout thumb_blx_out_of_range.stdout \
1574         thumb2_blx_in_range.stdout thumb2_blx_out_of_range.stdout
1575
1576 arm_bl_in_range.stdout: arm_bl_in_range
1577         $(TEST_OBJDUMP) -D $< > $@
1578
1579 arm_bl_in_range: arm_bl_in_range.o ../ld-new
1580         ../ld-new -T $(srcdir)/arm_branch_range.t -o $@ $<
1581
1582 arm_bl_in_range.o: arm_bl_in_range.s
1583         $(TEST_AS) -o $@ $<
1584
1585 arm_bl_out_of_range.stdout: arm_bl_out_of_range
1586         $(TEST_OBJDUMP) -S $< > $@
1587
1588 arm_bl_out_of_range: arm_bl_out_of_range.o ../ld-new
1589         ../ld-new -T $(srcdir)/arm_branch_range.t -o $@ $<
1590
1591 arm_bl_out_of_range.o: arm_bl_out_of_range.s
1592         $(TEST_AS) -o $@ $<
1593
1594 thumb_bl_in_range.stdout: thumb_bl_in_range
1595         $(TEST_OBJDUMP) -D $< > $@
1596
1597 thumb_bl_in_range: thumb_bl_in_range.o ../ld-new
1598         ../ld-new -T $(srcdir)/thumb_branch_range.t -o $@ $<
1599
1600 thumb_bl_in_range.o: thumb_bl_in_range.s
1601         $(TEST_AS) -o $@ -march=armv5te $<
1602
1603 thumb_bl_out_of_range.stdout: thumb_bl_out_of_range
1604         $(TEST_OBJDUMP) -D $< > $@
1605
1606 thumb_bl_out_of_range: thumb_bl_out_of_range.o ../ld-new
1607         ../ld-new -T $(srcdir)/thumb_branch_range.t -o $@ $<
1608
1609 thumb_bl_out_of_range.o: thumb_bl_out_of_range.s
1610         $(TEST_AS) -o $@ -march=armv5te $<
1611
1612 thumb2_bl_in_range.stdout: thumb2_bl_in_range
1613         $(TEST_OBJDUMP) -D $< > $@
1614
1615 thumb2_bl_in_range: thumb2_bl_in_range.o ../ld-new
1616         ../ld-new -T $(srcdir)/thumb2_branch_range.t -o $@ $<
1617
1618 thumb2_bl_in_range.o: thumb_bl_in_range.s
1619         $(TEST_AS) -o $@ -march=armv7-a $<
1620
1621 thumb2_bl_out_of_range.stdout: thumb2_bl_out_of_range
1622         $(TEST_OBJDUMP) -D $< > $@
1623
1624 thumb2_bl_out_of_range: thumb2_bl_out_of_range.o ../ld-new
1625         ../ld-new -T $(srcdir)/thumb2_branch_range.t -o $@ $<
1626
1627 thumb2_bl_out_of_range.o: thumb_bl_out_of_range.s
1628         $(TEST_AS) -o $@ -march=armv7-a $<
1629
1630 thumb_blx_in_range.stdout: thumb_blx_in_range
1631         $(TEST_OBJDUMP) -D $< > $@
1632
1633 thumb_blx_in_range: thumb_blx_in_range.o ../ld-new
1634         ../ld-new -T $(srcdir)/thumb_branch_range.t -o $@ $<
1635
1636 thumb_blx_in_range.o: thumb_blx_in_range.s
1637         $(TEST_AS) -o $@ -march=armv5te $<
1638
1639 thumb_blx_out_of_range.stdout: thumb_blx_out_of_range
1640         $(TEST_OBJDUMP) -D $< > $@
1641
1642 thumb_blx_out_of_range: thumb_blx_out_of_range.o ../ld-new
1643         ../ld-new -T $(srcdir)/thumb_branch_range.t -o $@ $<
1644
1645 thumb_blx_out_of_range.o: thumb_blx_out_of_range.s
1646         $(TEST_AS) -o $@ -march=armv5te $<
1647
1648 thumb2_blx_in_range.stdout: thumb2_blx_in_range
1649         $(TEST_OBJDUMP) -D $< > $@
1650
1651 thumb2_blx_in_range: thumb2_blx_in_range.o ../ld-new
1652         ../ld-new -T $(srcdir)/thumb2_branch_range.t -o $@ $<
1653
1654 thumb2_blx_in_range.o: thumb_blx_in_range.s
1655         $(TEST_AS) -o $@ -march=armv7-a $<
1656
1657 thumb2_blx_out_of_range.stdout: thumb2_blx_out_of_range
1658         $(TEST_OBJDUMP) -D $< > $@
1659
1660 thumb2_blx_out_of_range: thumb2_blx_out_of_range.o ../ld-new
1661         ../ld-new -T $(srcdir)/thumb2_branch_range.t -o $@ $<
1662
1663 thumb2_blx_out_of_range.o: thumb_blx_out_of_range.s
1664         $(TEST_AS) -o $@ -march=armv7-a $<
1665
1666 MOSTLYCLEANFILES += arm_bl_in_range arm_bl_out_of_range thumb_bl_in_range \
1667         thumb_bl_out_of_range thumb2_bl_in_range thumb2_bl_out_of_range \
1668         thumb_blx_in_range thumb_blx_out_of_range thumb2_blx_in_range \
1669         thumb2_blx_out_of_range
1670
1671 check_SCRIPTS += arm_fix_v4bx.sh
1672 check_DATA += arm_fix_v4bx.stdout arm_fix_v4bx_interworking.stdout \
1673         arm_no_fix_v4bx.stdout
1674
1675 arm_fix_v4bx.stdout: arm_fix_v4bx
1676         $(TEST_OBJDUMP) -D -j.text $< > $@
1677
1678 arm_fix_v4bx: arm_fix_v4bx.o ../ld-new
1679         ../ld-new --fix-v4bx -o $@ $<
1680
1681 arm_fix_v4bx.o: arm_fix_v4bx.s
1682         $(TEST_AS) -o $@ $<
1683
1684 arm_fix_v4bx_interworking.stdout: arm_fix_v4bx_interworking
1685         $(TEST_OBJDUMP) -D -j.text $< > $@
1686
1687 arm_fix_v4bx_interworking: arm_fix_v4bx.o ../ld-new
1688         ../ld-new --fix-v4bx-interworking -o $@ $<
1689
1690 arm_no_fix_v4bx.stdout: arm_no_fix_v4bx
1691         $(TEST_OBJDUMP) -D -j.text $< > $@
1692
1693 arm_no_fix_v4bx: arm_fix_v4bx.o ../ld-new
1694         ../ld-new -o $@ $<
1695
1696 MOSTLYCLEANFILES += arm_fix_v4bx arm_fix_v4bx_interworking arm_no_fix_v4bx
1697
1698 check_SCRIPTS += arm_attr_merge.sh
1699 check_DATA += arm_attr_merge_6.stdout arm_attr_merge_6r.stdout \
1700         arm_attr_merge_7.stdout
1701
1702 arm_attr_merge_6.stdout: arm_attr_merge_6
1703         $(TEST_READELF) -A $< > $@
1704
1705 arm_attr_merge_6: arm_attr_merge_6a.o arm_attr_merge_6b.o
1706         ../ld-new -o $@ arm_attr_merge_6a.o arm_attr_merge_6b.o
1707
1708 arm_attr_merge_6a.o: arm_attr_merge_6a.s
1709         $(TEST_AS) -o $@ $<
1710
1711 arm_attr_merge_6b.o: arm_attr_merge_6b.s
1712         $(TEST_AS) -o $@ $<
1713
1714 arm_attr_merge_6r.stdout: arm_attr_merge_6r
1715         $(TEST_READELF) -A $< > $@
1716
1717 arm_attr_merge_6r: arm_attr_merge_6b.o arm_attr_merge_6a.o
1718         ../ld-new -o $@ arm_attr_merge_6b.o arm_attr_merge_6a.o
1719
1720 arm_attr_merge_7.stdout: arm_attr_merge_7
1721         $(TEST_READELF) -A $< > $@
1722
1723 arm_attr_merge_7: arm_attr_merge_7a.o arm_attr_merge_7b.o
1724         ../ld-new -o $@ arm_attr_merge_7a.o arm_attr_merge_7b.o
1725
1726 arm_attr_merge_7a.o: arm_attr_merge_7a.s
1727         $(TEST_AS) -o $@ $<
1728
1729 arm_attr_merge_7b.o: arm_attr_merge_7b.s
1730         $(TEST_AS) -o $@ $<
1731
1732 MOSTLYCLEANFILES += arm_attr_merge_6 arm_attr_merge_6r arm_attr_merge_7
1733
1734 endif DEFAULT_TARGET_ARM