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