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