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