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