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