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