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