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