1 # Process this file with automake to generate Makefile.in
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.
7 # Ignore warning about AM_PROG_CC_C_O due to large_CFLAGS
8 AUTOMAKE_OPTIONS = foreign -Wno-portability
10 # The two_file_test tests -fmerge-constants, so we simply always turn
11 # it on. This may need to be controlled by a configure option
13 AM_CFLAGS = $(WARN_CFLAGS) $(LFS_CFLAGS) -fmerge-constants
14 AM_CXXFLAGS = $(WARN_CXXFLAGS) $(LFS_CFLAGS) -fmerge-constants
17 -I$(srcdir) -I$(srcdir)/.. -I$(srcdir)/../../include \
18 -I$(srcdir)/../../elfcpp -I.. \
19 -DLOCALEDIR="\"$(datadir)/locale\"" \
22 # COMPILE1, LINK1, CXXCOMPILE1, CXXLINK1 are renamed from COMPILE, LINK,
23 # CXXCOMPILE and CXXLINK generated by automake 1.11.1. FIXME: they should
24 # be updated if they are different from automake used by gold.
25 COMPILE1 = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
26 $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
27 LINK1 = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
28 CXXCOMPILE1 = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
29 $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
30 CXXLINK1 = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
33 # Strip out -Wp,-D_FORTIFY_SOURCE=, which is rrelevant for the gold
34 # testsuite and incompatible with -O0 used in gold tests, from
35 # COMPILE, LINK, CXXCOMPILE and CXXLINK.
36 COMPILE = `echo $(COMPILE1) | sed -e 's/-Wp,-D_FORTIFY_SOURCE=[0-9[0-9]]*//'`
37 LINK = `echo $(LINK1) | sed -e 's/-Wp,-D_FORTIFY_SOURCE=[0-9][0-9]*//'`
38 CXXCOMPILE = `echo $(CXXCOMPILE1) | sed -e 's/-Wp,-D_FORTIFY_SOURCE=[0-9][0-9]*//'`
39 CXXLINK = `echo $(CXXLINK1) | sed -e 's/-Wp,-D_FORTIFY_SOURCE=[0-9][0-9]*//'`
41 TEST_READELF = $(top_builddir)/../binutils/readelf
42 TEST_OBJDUMP = $(top_builddir)/../binutils/objdump
43 TEST_OBJCOPY = $(top_builddir)/../binutils/objcopy
44 TEST_CXXFILT = $(top_builddir)/../binutils/cxxfilt
45 TEST_STRIP = $(top_builddir)/../binutils/strip-new
46 TEST_AR = $(top_builddir)/../binutils/ar
47 TEST_NM = $(top_builddir)/../binutils/nm-new
48 TEST_AS = $(top_builddir)/../gas/as-new
55 THREADSLIB = -lpthread
59 TLS_TEST_C_CFLAGS = -fopenmp
62 # 'make clean' is good about deleting some intermediate files (such as
63 # .o's), but not all of them (such as .so's and .err files). We
64 # improve on that here. automake-1.9 info docs say "mostlyclean" is
65 # the right choice for files 'make' builds that people rebuild.
66 MOSTLYCLEANFILES = *.so *.syms *.stdout
69 # We will add to these later, for each individual test. Note
70 # that we add each test under check_SCRIPTS or check_PROGRAMS;
71 # the TESTS variable is automatically populated from these.
77 TESTS = $(check_SCRIPTS) $(check_PROGRAMS)
79 # ---------------------------------------------------------------------
80 # These tests test the internals of gold (unittests).
82 # Infrastucture needed for the unittests
83 check_LIBRARIES = libgoldtest.a
84 libgoldtest_a_SOURCES = test.cc testmain.cc testfile.cc
87 libgoldtest.a ../libgold.a ../../libiberty/libiberty.a $(LIBINTL_DEP)
88 LDADD = libgoldtest.a ../libgold.a ../../libiberty/libiberty.a $(LIBINTL) \
89 $(THREADSLIB) $(LIBDL)
92 # The unittests themselves
93 if NATIVE_OR_CROSS_LINKER
96 # Infrastucture needed for the unittests: a directory where the linker
97 # is named 'ld'. This is because the -B flag appends 'ld' to its arg.
98 gcctestdir/ld: ../ld-new
99 test -d gcctestdir || mkdir -p gcctestdir
101 (cd gcctestdir && $(LN_S) ../../ld-new ld)
103 # Some tests require the latest features of an in-tree assembler.
104 gcctestdir/as: $(TEST_AS)
105 test -d gcctestdir || mkdir -p gcctestdir
107 (cd gcctestdir && $(LN_S) $(abs_top_builddir)/../gas/as-new as)
111 check_PROGRAMS += object_unittest
112 object_unittest_SOURCES = object_unittest.cc
114 check_PROGRAMS += binary_unittest
115 binary_unittest_SOURCES = binary_unittest.cc
117 check_PROGRAMS += leb128_unittest
118 leb128_unittest_SOURCES = leb128_unittest.cc
120 endif NATIVE_OR_CROSS_LINKER
122 # ---------------------------------------------------------------------
123 # These tests test the output of gold (end-to-end tests). In
124 # particular, they make sure that gold can link "difficult" object
125 # files, and the resulting object files run correctly. These can only
126 # run if we've built ld-new for the native architecture (that is,
127 # we're not cross-compiling it), since we run ld-new as part of these
128 # tests. We use the gcc-specific flag '-B' to use our linker instead
129 # of the default linker, which is why we only run our tests under gcc.
134 # Each of these .o's is a useful, small complete program. They're
135 # particularly useful for making sure ld-new's flags do what they're
136 # supposed to (hence their names), but are used for many tests that
137 # don't actually involve analyzing input data.
138 flagstest_debug.o: constructor_test.cc
139 $(CXXCOMPILE) -O0 -g -c -o $@ $<
140 flagstest_ndebug.o: constructor_test.cc
141 $(CXXCOMPILE) -O0 -c -o $@ $<
143 check_SCRIPTS += incremental_test.sh
144 check_DATA += incremental_test.stdout
145 MOSTLYCLEANFILES += incremental_test
146 incremental_test_1.o: incremental_test_1.c
147 $(COMPILE) -O0 -c -ffunction-sections -g -o $@ $<
148 incremental_test_2.o: incremental_test_2.c
149 $(COMPILE) -O0 -c -ffunction-sections -g -o $@ $<
150 incremental_test: incremental_test_1.o incremental_test_2.o gcctestdir/ld
151 $(LINK) -Bgcctestdir/ -Wl,--incremental-full incremental_test_1.o incremental_test_2.o -Wl,-debug 2> incremental_test.cmdline
152 incremental_test.stdout: incremental_test ../incremental-dump
153 ../incremental-dump incremental_test > $@
155 check_SCRIPTS += gc_comdat_test.sh
156 check_DATA += gc_comdat_test.stdout
157 MOSTLYCLEANFILES += gc_comdat_test
158 gc_comdat_test_1.o: gc_comdat_test_1.cc
159 $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
160 gc_comdat_test_2.o: gc_comdat_test_2.cc
161 $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
162 gc_comdat_test: gc_comdat_test_1.o gc_comdat_test_2.o gcctestdir/ld
163 $(CXXLINK) -Bgcctestdir/ -Wl,--gc-sections gc_comdat_test_1.o gc_comdat_test_2.o
164 gc_comdat_test.stdout: gc_comdat_test
165 $(TEST_NM) -C gc_comdat_test > gc_comdat_test.stdout
167 check_SCRIPTS += gc_tls_test.sh
168 check_DATA += gc_tls_test.stdout
169 MOSTLYCLEANFILES += gc_tls_test
170 gc_tls_test.o: gc_tls_test.cc
171 $(CXXCOMPILE) -O0 -c -g -o $@ $<
172 gc_tls_test:gc_tls_test.o gcctestdir/ld
173 $(CXXLINK) -Bgcctestdir/ -Wl,--gc-sections gc_tls_test.o
174 gc_tls_test.stdout: gc_tls_test
175 $(TEST_NM) -C gc_tls_test > gc_tls_test.stdout
177 check_SCRIPTS += gc_orphan_section_test.sh
178 check_DATA += gc_orphan_section_test.stdout
179 MOSTLYCLEANFILES += gc_orphan_section_test
180 gc_orphan_section_test.o: gc_orphan_section_test.cc
181 $(CXXCOMPILE) -O0 -c -g -o $@ $<
182 gc_orphan_section_test:gc_orphan_section_test.o gcctestdir/ld
183 $(CXXLINK) -Bgcctestdir/ -Wl,--gc-sections gc_orphan_section_test.o
184 gc_orphan_section_test.stdout: gc_orphan_section_test
185 $(TEST_NM) gc_orphan_section_test > gc_orphan_section_test.stdout
187 check_SCRIPTS += pr14265.sh
188 check_DATA += pr14265.stdout
189 MOSTLYCLEANFILES += pr14265
191 $(COMPILE) -O0 -c -o $@ $<
193 $(LINK) -Bgcctestdir/ -Wl,--gc-sections -T $(srcdir)/pr14265.t -o $@ $<
194 pr14265.stdout: pr14265
195 $(TEST_NM) --format=bsd --numeric-sort $< > $@
197 check_SCRIPTS += icf_test.sh
198 check_DATA += icf_test.stdout
199 MOSTLYCLEANFILES += icf_test
200 icf_test.o: icf_test.cc
201 $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
202 icf_test: icf_test.o gcctestdir/ld
203 $(CXXLINK) -Bgcctestdir/ -Wl,--icf=all icf_test.o
204 icf_test.stdout: icf_test
205 $(TEST_NM) -C icf_test > icf_test.stdout
207 check_SCRIPTS += icf_keep_unique_test.sh
208 check_DATA += icf_keep_unique_test.stdout
209 MOSTLYCLEANFILES += icf_keep_unique_test
210 icf_keep_unique_test.o: icf_keep_unique_test.cc
211 $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
212 icf_keep_unique_test: icf_keep_unique_test.o gcctestdir/ld
213 $(CXXLINK) -Bgcctestdir/ -Wl,--icf=all -Wl,--keep-unique,_Z11unique_funcv icf_keep_unique_test.o
214 icf_keep_unique_test.stdout: icf_keep_unique_test
215 $(TEST_NM) -C icf_keep_unique_test > icf_keep_unique_test.stdout
217 check_SCRIPTS += icf_safe_test.sh
218 check_DATA += icf_safe_test_1.stdout icf_safe_test_2.stdout
219 MOSTLYCLEANFILES += icf_safe_test
220 icf_safe_test.o: icf_safe_test.cc
221 $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
222 icf_safe_test: icf_safe_test.o gcctestdir/ld
223 $(CXXLINK) -Bgcctestdir/ -Wl,--icf=safe icf_safe_test.o
224 icf_safe_test_1.stdout: icf_safe_test
225 $(TEST_NM) icf_safe_test > icf_safe_test_1.stdout
226 icf_safe_test_2.stdout: icf_safe_test
227 $(TEST_READELF) -h icf_safe_test > icf_safe_test_2.stdout
229 check_SCRIPTS += icf_safe_so_test.sh
230 check_DATA += icf_safe_so_test_1.stdout icf_safe_so_test_2.stdout
231 MOSTLYCLEANFILES += icf_safe_so_test
232 icf_safe_so_test.o: icf_safe_so_test.cc
233 $(CXXCOMPILE) -O0 -c -ffunction-sections -fPIC -g -o $@ $<
234 icf_safe_so_test: icf_safe_so_test.o gcctestdir/ld
235 $(CXXLINK) -Bgcctestdir/ -Wl,--icf=safe icf_safe_so_test.o -fPIC -shared
236 icf_safe_so_test_1.stdout: icf_safe_so_test
237 $(TEST_NM) icf_safe_so_test > icf_safe_so_test_1.stdout
238 icf_safe_so_test_2.stdout: icf_safe_so_test
239 $(TEST_READELF) -h icf_safe_so_test > icf_safe_so_test_2.stdout
241 check_SCRIPTS += final_layout.sh
242 check_DATA += final_layout.stdout
243 MOSTLYCLEANFILES += final_layout final_layout_sequence.txt
244 final_layout.o: final_layout.cc
245 $(CXXCOMPILE) -O0 -c -ffunction-sections -fdata-sections -g -o $@ $<
246 final_layout_sequence.txt:
247 (echo "*_Z3barv*" && echo ".text._Z3bazv" && echo "*_Z3foov*" && echo "*global_varb*" && echo "*global_vara*" && echo "*global_varc*") > final_layout_sequence.txt
248 final_layout: final_layout.o final_layout_sequence.txt gcctestdir/ld
249 $(CXXLINK) -Bgcctestdir/ -Wl,--section-ordering-file,final_layout_sequence.txt final_layout.o
250 final_layout.stdout: final_layout
251 $(TEST_NM) -n --synthetic final_layout > final_layout.stdout
253 check_SCRIPTS += text_section_grouping.sh
254 check_DATA += text_section_grouping.stdout
255 MOSTLYCLEANFILES += text_section_grouping
256 text_section_grouping.o: text_section_grouping.cc
257 $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
258 text_section_grouping: text_section_grouping.o gcctestdir/ld
259 $(CXXLINK) -Bgcctestdir/ text_section_grouping.o
260 text_section_grouping.stdout: text_section_grouping
261 $(TEST_NM) -n --synthetic text_section_grouping > text_section_grouping.stdout
263 check_PROGRAMS += icf_virtual_function_folding_test
264 MOSTLYCLEANFILES += icf_virtual_function_folding_test
265 icf_virtual_function_folding_test.o: icf_virtual_function_folding_test.cc
266 $(CXXCOMPILE) -O0 -c -ffunction-sections -fPIE -g -o $@ $<
267 icf_virtual_function_folding_test: icf_virtual_function_folding_test.o gcctestdir/ld
268 $(CXXLINK) -Bgcctestdir/ -Wl,--icf=all icf_virtual_function_folding_test.o -pie
270 check_SCRIPTS += icf_preemptible_functions_test.sh
271 check_DATA += icf_preemptible_functions_test.stdout
272 MOSTLYCLEANFILES += icf_preemptible_functions_test
273 icf_preemptible_functions_test.o: icf_preemptible_functions_test.cc
274 $(CXXCOMPILE) -O0 -c -ffunction-sections -fPIC -g -o $@ $<
275 icf_preemptible_functions_test: icf_preemptible_functions_test.o gcctestdir/ld
276 $(CXXLINK) -Bgcctestdir/ -Wl,--icf=all icf_preemptible_functions_test.o -fPIC -shared
277 icf_preemptible_functions_test.stdout: icf_preemptible_functions_test
278 $(TEST_NM) icf_preemptible_functions_test > icf_preemptible_functions_test.stdout
280 check_SCRIPTS += icf_string_merge_test.sh
281 check_DATA += icf_string_merge_test.stdout
282 MOSTLYCLEANFILES += icf_string_merge_test
283 icf_string_merge_test.o: icf_string_merge_test.cc
284 $(CXXCOMPILE) -O0 -c -ffunction-sections -fPIC -g -o $@ $<
285 icf_string_merge_test: icf_string_merge_test.o gcctestdir/ld
286 $(CXXLINK) -Bgcctestdir/ -Wl,--icf=all icf_string_merge_test.o
287 icf_string_merge_test.stdout: icf_string_merge_test
288 $(TEST_NM) icf_string_merge_test > icf_string_merge_test.stdout
290 check_SCRIPTS += icf_sht_rel_addend_test.sh
291 check_DATA += icf_sht_rel_addend_test.stdout
292 MOSTLYCLEANFILES += icf_sht_rel_addend_test
293 icf_sht_rel_addend_test_1.o: icf_sht_rel_addend_test_1.cc
294 $(CXXCOMPILE) -O0 -c -ffunction-sections -fPIC -g -o $@ $<
295 icf_sht_rel_addend_test_2.o: icf_sht_rel_addend_test_2.cc
296 $(CXXCOMPILE) -O0 -c -ffunction-sections -fPIC -g -o $@ $<
297 icf_sht_rel_addend_test: icf_sht_rel_addend_test_1.o icf_sht_rel_addend_test_2.o gcctestdir/ld
298 $(CXXLINK) -Bgcctestdir/ -Wl,--icf=all icf_sht_rel_addend_test_1.o icf_sht_rel_addend_test_2.o
299 icf_sht_rel_addend_test.stdout: icf_sht_rel_addend_test
300 $(TEST_NM) icf_sht_rel_addend_test > icf_sht_rel_addend_test.stdout
302 check_PROGRAMS += basic_test
303 check_PROGRAMS += basic_pic_test
304 basic_test.o: basic_test.cc
305 $(CXXCOMPILE) -O0 -c -o $@ $<
306 basic_test: basic_test.o gcctestdir/ld
307 $(CXXLINK) -Bgcctestdir/ basic_test.o
310 check_PROGRAMS += basic_static_test
311 basic_static_test: basic_test.o gcctestdir/ld
312 $(CXXLINK) -Bgcctestdir/ -static basic_test.o
315 basic_pic_test.o: basic_test.cc
316 $(CXXCOMPILE) -O0 -c -fpic -o $@ $<
317 basic_pic_test: basic_pic_test.o gcctestdir/ld
318 $(CXXLINK) -Bgcctestdir/ basic_pic_test.o
321 check_PROGRAMS += basic_static_pic_test
322 basic_static_pic_test: basic_pic_test.o gcctestdir/ld
323 $(CXXLINK) -Bgcctestdir/ -static basic_pic_test.o
326 check_PROGRAMS += basic_pie_test
327 basic_pie_test.o: basic_test.cc
328 $(CXXCOMPILE) -O0 -c -fpie -o $@ $<
329 basic_pie_test: basic_pie_test.o gcctestdir/ld
330 $(CXXLINK) -Bgcctestdir/ -pie basic_pie_test.o
332 check_PROGRAMS += constructor_test
333 constructor_test_SOURCES = constructor_test.cc
334 constructor_test_DEPENDENCIES = gcctestdir/ld
335 constructor_test_LDFLAGS = -Bgcctestdir/
336 constructor_test_LDADD =
339 check_PROGRAMS += constructor_static_test
340 constructor_static_test_SOURCES = $(constructor_test_SOURCES)
341 constructor_static_test_DEPENDENCIES = $(constructor_test_DEPENDENCIES)
342 constructor_static_test_LDFLAGS = $(constructor_test_LDFLAGS) -static
343 constructor_static_test_LDADD = $(constructor_test_LDADD)
346 check_PROGRAMS += two_file_test
347 check_PROGRAMS += two_file_pic_test
348 two_file_test_SOURCES = \
350 two_file_test_1b.cc \
352 two_file_test_main.cc \
354 two_file_test_DEPENDENCIES = gcctestdir/ld
355 two_file_test_LDFLAGS = -Bgcctestdir/
356 two_file_test_LDADD =
359 check_PROGRAMS += two_file_static_test
360 two_file_static_test_SOURCES = $(two_file_test_SOURCES)
361 two_file_static_test_DEPENDENCIES = $(two_file_test_DEPENDENCIES)
362 two_file_static_test_LDFLAGS = $(two_file_test_LDFLAGS) -static
363 two_file_static_test_LDADD = $(two_file_test_LDADD)
366 two_file_pic_test_SOURCES = two_file_test_main.cc
367 two_file_pic_test_DEPENDENCIES = \
368 gcctestdir/ld two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o
369 two_file_pic_test_LDFLAGS = -Bgcctestdir/
370 two_file_pic_test_LDADD = two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o
373 check_PROGRAMS += two_file_shared_1_test
374 check_PROGRAMS += two_file_shared_2_test
375 check_PROGRAMS += two_file_shared_1_pic_2_test
376 check_PROGRAMS += two_file_shared_2_pic_1_test
377 check_PROGRAMS += two_file_same_shared_test
378 check_PROGRAMS += two_file_separate_shared_12_test
379 check_PROGRAMS += two_file_separate_shared_21_test
380 two_file_test_1_pic.o: two_file_test_1.cc
381 $(CXXCOMPILE) -c -fpic -o $@ $<
382 two_file_test_1b_pic.o: two_file_test_1b.cc
383 $(CXXCOMPILE) -c -fpic -o $@ $<
384 two_file_test_2_pic.o: two_file_test_2.cc
385 $(CXXCOMPILE) -c -fpic -o $@ $<
386 two_file_shared_1.so: two_file_test_1_pic.o two_file_test_1b_pic.o gcctestdir/ld
387 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1_pic.o two_file_test_1b_pic.o
388 two_file_shared_2.so: two_file_test_2_pic.o gcctestdir/ld
389 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_2_pic.o
390 two_file_shared.so: two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o gcctestdir/ld
391 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o
393 two_file_shared_1_test_SOURCES = two_file_test_2.cc two_file_test_main.cc
394 two_file_shared_1_test_DEPENDENCIES = gcctestdir/ld two_file_shared_1.so
395 two_file_shared_1_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
396 two_file_shared_1_test_LDADD = two_file_shared_1.so
398 two_file_shared_2_test_SOURCES = two_file_test_1.cc two_file_test_1b.cc two_file_test_main.cc
399 two_file_shared_2_test_DEPENDENCIES = gcctestdir/ld two_file_shared_2.so
400 two_file_shared_2_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
401 two_file_shared_2_test_LDADD = two_file_shared_2.so
403 two_file_shared_1_pic_2_test_SOURCES = two_file_test_main.cc
404 two_file_shared_1_pic_2_test_DEPENDENCIES = \
405 gcctestdir/ld two_file_shared_2.so two_file_test_1_pic.o two_file_test_1b_pic.o
406 two_file_shared_1_pic_2_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
407 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
409 two_file_shared_2_pic_1_test_SOURCES = two_file_test_main.cc
410 two_file_shared_2_pic_1_test_DEPENDENCIES = \
411 gcctestdir/ld two_file_shared_2.so two_file_test_2_pic.o
412 two_file_shared_2_pic_1_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
413 two_file_shared_2_pic_1_test_LDADD = two_file_test_2_pic.o two_file_shared_1.so
415 two_file_same_shared_test_SOURCES = two_file_test_main.cc
416 two_file_same_shared_test_DEPENDENCIES = gcctestdir/ld two_file_shared.so
417 two_file_same_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
418 two_file_same_shared_test_LDADD = two_file_shared.so
420 two_file_separate_shared_12_test_SOURCES = two_file_test_main.cc
421 two_file_separate_shared_12_test_DEPENDENCIES = \
422 gcctestdir/ld two_file_shared_1.so two_file_shared_2.so
423 two_file_separate_shared_12_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
424 two_file_separate_shared_12_test_LDADD = \
425 two_file_shared_1.so two_file_shared_2.so
427 two_file_separate_shared_21_test_SOURCES = two_file_test_main.cc
428 two_file_separate_shared_21_test_DEPENDENCIES = \
429 gcctestdir/ld two_file_shared_1.so two_file_shared_2.so
430 two_file_separate_shared_21_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
431 two_file_separate_shared_21_test_LDADD = \
432 two_file_shared_2.so two_file_shared_1.so
434 check_PROGRAMS += two_file_relocatable_test
435 two_file_relocatable_test_SOURCES = two_file_test_main.cc
436 two_file_relocatable_test_DEPENDENCIES = \
437 gcctestdir/ld two_file_relocatable.o
438 two_file_relocatable_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
439 two_file_relocatable_test_LDADD = two_file_relocatable.o
440 two_file_relocatable.o: gcctestdir/ld two_file_test_1.o two_file_test_1b.o two_file_test_2.o
441 gcctestdir/ld -r -o $@ two_file_test_1.o two_file_test_1b.o two_file_test_2.o
443 check_PROGRAMS += two_file_pie_test
444 two_file_test_1_pie.o: two_file_test_1.cc
445 $(CXXCOMPILE) -c -fpie -o $@ $<
446 two_file_test_1b_pie.o: two_file_test_1b.cc
447 $(CXXCOMPILE) -c -fpie -o $@ $<
448 two_file_test_2_pie.o: two_file_test_2.cc
449 $(CXXCOMPILE) -c -fpie -o $@ $<
450 two_file_test_main_pie.o: two_file_test_main.cc
451 $(CXXCOMPILE) -c -fpie -o $@ $<
452 two_file_pie_test: two_file_test_1_pie.o two_file_test_1b_pie.o \
453 two_file_test_2_pie.o two_file_test_main_pie.o gcctestdir/ld
454 $(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
456 check_SCRIPTS += two_file_shared.sh
457 check_DATA += two_file_shared.dbg
458 MOSTLYCLEANFILES += two_file_shared.dbg
459 two_file_shared.dbg: two_file_shared.so
460 $(TEST_READELF) -w $< >$@ 2>/dev/null
462 # The nonpic tests will fail on platforms which can not put non-PIC
463 # code into shared libraries, so we just don't run them in that case.
464 if FN_PTRS_IN_SO_WITHOUT_PIC
466 check_PROGRAMS += two_file_shared_1_nonpic_test
467 check_PROGRAMS += two_file_shared_2_nonpic_test
468 check_PROGRAMS += two_file_same_shared_nonpic_test
469 check_PROGRAMS += two_file_separate_shared_12_nonpic_test
470 check_PROGRAMS += two_file_separate_shared_21_nonpic_test
471 check_PROGRAMS += two_file_mixed_shared_test
472 check_PROGRAMS += two_file_mixed_2_shared_test
473 two_file_shared_1_nonpic.so: two_file_test_1.o gcctestdir/ld
474 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1.o two_file_test_1b.o -Wl,-z,notext
475 two_file_shared_2_nonpic.so: two_file_test_2.o gcctestdir/ld
476 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_2.o
477 two_file_shared_nonpic.so: two_file_test_1.o two_file_test_1b.o two_file_test_2.o gcctestdir/ld
478 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1.o two_file_test_1b.o two_file_test_2.o -Wl,-z,notext
479 two_file_shared_mixed.so: two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2.o gcctestdir/ld
480 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2.o -Wl,-z,notext
481 two_file_shared_mixed_1.so: two_file_test_1.o two_file_test_1b_pic.o two_file_shared_2.so gcctestdir/ld
482 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1.o two_file_test_1b_pic.o two_file_shared_2.so -Wl,-z,notext
484 two_file_shared_1_nonpic_test_SOURCES = \
485 two_file_test_2.cc two_file_test_main.cc
486 two_file_shared_1_nonpic_test_DEPENDENCIES = \
487 gcctestdir/ld two_file_shared_1_nonpic.so
488 two_file_shared_1_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
489 two_file_shared_1_nonpic_test_LDADD = two_file_shared_1_nonpic.so
491 two_file_shared_2_nonpic_test_SOURCES = \
492 two_file_test_1.cc two_file_test_1b.cc two_file_test_main.cc
493 two_file_shared_2_nonpic_test_DEPENDENCIES = \
494 gcctestdir/ld two_file_shared_2_nonpic.so
495 two_file_shared_2_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
496 two_file_shared_2_nonpic_test_LDADD = two_file_shared_2_nonpic.so
498 two_file_same_shared_nonpic_test_SOURCES = two_file_test_main.cc
499 two_file_same_shared_nonpic_test_DEPENDENCIES = \
500 gcctestdir/ld two_file_shared_nonpic.so
501 two_file_same_shared_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
502 two_file_same_shared_nonpic_test_LDADD = two_file_shared_nonpic.so
504 two_file_separate_shared_12_nonpic_test_SOURCES = two_file_test_main.cc
505 two_file_separate_shared_12_nonpic_test_DEPENDENCIES = \
506 gcctestdir/ld two_file_shared_1_nonpic.so two_file_shared_2_nonpic.so
507 two_file_separate_shared_12_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
508 two_file_separate_shared_12_nonpic_test_LDADD = \
509 two_file_shared_1_nonpic.so two_file_shared_2_nonpic.so
511 two_file_separate_shared_21_nonpic_test_SOURCES = two_file_test_main.cc
512 two_file_separate_shared_21_nonpic_test_DEPENDENCIES = \
513 gcctestdir/ld two_file_shared_1_nonpic.so two_file_shared_2_nonpic.so
514 two_file_separate_shared_21_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
515 two_file_separate_shared_21_nonpic_test_LDADD = \
516 two_file_shared_2_nonpic.so two_file_shared_1_nonpic.so
518 two_file_mixed_shared_test_SOURCES = two_file_test_main.cc
519 two_file_mixed_shared_test_DEPENDENCIES = gcctestdir/ld two_file_shared_mixed.so
520 two_file_mixed_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
521 two_file_mixed_shared_test_LDADD = two_file_shared_mixed.so
523 two_file_mixed_2_shared_test_SOURCES = two_file_test_main.cc
524 two_file_mixed_2_shared_test_DEPENDENCIES = gcctestdir/ld two_file_shared_mixed_1.so two_file_shared_2.so
525 two_file_mixed_2_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
526 two_file_mixed_2_shared_test_LDADD = two_file_shared_mixed_1.so two_file_shared_2.so
528 check_PROGRAMS += two_file_mixed_pie_test
529 two_file_mixed_pie_test: two_file_test_1.o two_file_test_1b_pie.o \
530 two_file_test_main_pie.o two_file_shared_2.so gcctestdir/ld
531 $(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
533 endif FN_PTRS_IN_SO_WITHOUT_PIC
535 check_PROGRAMS += two_file_strip_test
536 two_file_strip_test: two_file_test
537 $(TEST_STRIP) -o two_file_strip_test two_file_test
539 check_PROGRAMS += two_file_same_shared_strip_test
540 two_file_same_shared_strip_test_SOURCES = two_file_test_main.cc
541 two_file_same_shared_strip_test_DEPENDENCIES = \
542 gcctestdir/ld two_file_shared_strip.so
543 two_file_same_shared_strip_test_LDFLAGS = -Bgcctestdir/ -Wl,-R.
544 two_file_same_shared_strip_test_LDADD = two_file_shared_strip.so
545 two_file_shared_strip.so: two_file_shared.so
546 $(TEST_STRIP) -S -o two_file_shared_strip.so two_file_shared.so
548 check_PROGRAMS += common_test_1
549 common_test_1_SOURCES = common_test_1.c
550 common_test_1_DEPENDENCIES = gcctestdir/ld
551 common_test_1_LDFLAGS = -Bgcctestdir/
552 common_test_1_LDADD =
554 check_PROGRAMS += common_test_2
555 common_test_2_SOURCES = common_test_1.c
556 common_test_2_DEPENDENCIES = common_test_2.so common_test_3.so gcctestdir/ld
557 common_test_2_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
558 common_test_2_LDADD = common_test_2.so common_test_3.so
559 common_test_2_pic.o: common_test_2.c
560 $(COMPILE) -c -fpic -o $@ $<
561 common_test_2.so: common_test_2_pic.o common_test_3.so gcctestdir/ld
562 $(LINK) -Bgcctestdir/ -shared common_test_2_pic.o common_test_3.so
563 common_test_3_pic.o: common_test_3.c
564 $(COMPILE) -c -fpic -o $@ $<
565 common_test_3.so: common_test_3_pic.o ver_test_2.script gcctestdir/ld
566 $(LINK) -Bgcctestdir/ -shared common_test_3_pic.o -Wl,--version-script,$(srcdir)/ver_test_2.script
568 check_PROGRAMS += exception_test
569 check_PROGRAMS += exception_shared_1_test
570 check_PROGRAMS += exception_shared_2_test
571 check_PROGRAMS += exception_same_shared_test
572 check_PROGRAMS += exception_separate_shared_12_test
573 check_PROGRAMS += exception_separate_shared_21_test
574 exception_test_1_pic.o: exception_test_1.cc
575 $(CXXCOMPILE) -c -fpic -o $@ $<
576 exception_test_2_pic.o: exception_test_2.cc
577 $(CXXCOMPILE) -c -fpic -o $@ $<
578 exception_shared_1.so: exception_test_1_pic.o gcctestdir/ld
579 $(CXXLINK) -Bgcctestdir/ -shared exception_test_1_pic.o
580 exception_shared_2.so: exception_test_2_pic.o gcctestdir/ld
581 $(CXXLINK) -Bgcctestdir/ -shared exception_test_2_pic.o
582 exception_shared.so: exception_test_1_pic.o exception_test_2_pic.o gcctestdir/ld
583 $(CXXLINK) -Bgcctestdir/ -shared exception_test_1_pic.o exception_test_2_pic.o
585 exception_test_SOURCES = \
586 exception_test_main.cc \
587 exception_test_1.cc \
588 exception_test_2.cc \
590 exception_test_DEPENDENCIES = gcctestdir/ld
591 exception_test_LDFLAGS = -Bgcctestdir/
592 exception_test_LDADD =
595 check_PROGRAMS += exception_static_test
596 exception_static_test_SOURCES = $(exception_test_SOURCES)
597 exception_static_test_DEPENDENCIES = $(exception_test_DEPENDENCIES)
598 exception_static_test_LDFLAGS = $(exception_test_LDFLAGS) -static
599 exception_static_test_LDADD = $(exception_test_LDADD)
602 exception_shared_1_test_SOURCES = exception_test_2.cc exception_test_main.cc
603 exception_shared_1_test_DEPENDENCIES = gcctestdir/ld exception_shared_1.so
604 exception_shared_1_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
605 exception_shared_1_test_LDADD = exception_shared_1.so
607 exception_shared_2_test_SOURCES = exception_test_1.cc exception_test_main.cc
608 exception_shared_2_test_DEPENDENCIES = gcctestdir/ld exception_shared_2.so
609 exception_shared_2_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
610 exception_shared_2_test_LDADD = exception_shared_2.so
612 exception_same_shared_test_SOURCES = exception_test_main.cc
613 exception_same_shared_test_DEPENDENCIES = gcctestdir/ld exception_shared.so
614 exception_same_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
615 exception_same_shared_test_LDADD = exception_shared.so
617 exception_separate_shared_12_test_SOURCES = exception_test_main.cc
618 exception_separate_shared_12_test_DEPENDENCIES = \
619 gcctestdir/ld exception_shared_1.so exception_shared_2.so
620 exception_separate_shared_12_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. \
622 exception_separate_shared_12_test_LDADD = \
623 exception_shared_1.so exception_shared_2.so
625 exception_separate_shared_21_test_SOURCES = exception_test_main.cc
626 exception_separate_shared_21_test_DEPENDENCIES = \
627 gcctestdir/ld exception_shared_1.so exception_shared_2.so
628 exception_separate_shared_21_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. \
630 exception_separate_shared_21_test_LDADD = \
631 exception_shared_2.so exception_shared_1.so
634 check_PROGRAMS += weak_test
635 weak_test_SOURCES = weak_test.cc
636 weak_test_DEPENDENCIES = gcctestdir/ld
637 weak_test_LDFLAGS = -Bgcctestdir/
640 check_PROGRAMS += weak_undef_test
641 MOSTLYCLEANFILES += alt/weak_undef_lib.so
642 weak_undef_test_SOURCES = weak_undef_test.cc
643 weak_undef_test_DEPENDENCIES = gcctestdir/ld weak_undef_lib.so alt/weak_undef_lib.so
644 weak_undef_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,alt
645 weak_undef_test_LDADD = -L . weak_undef_lib.so
646 weak_undef_file1.o: weak_undef_file1.cc
647 $(CXXCOMPILE) -c -fpic -o $@ $<
648 weak_undef_file2.o: weak_undef_file2.cc
649 $(CXXCOMPILE) -c -fpic -o $@ $<
650 weak_undef_lib.so: weak_undef_file1.o
651 $(CXXLINK) -Bgcctestdir/ -shared weak_undef_file1.o
652 alt/weak_undef_lib.so: weak_undef_file2.o
653 test -d alt || mkdir -p alt
654 $(CXXLINK) -Bgcctestdir/ -shared weak_undef_file2.o
656 if FN_PTRS_IN_SO_WITHOUT_PIC
657 check_PROGRAMS += weak_undef_nonpic_test
658 MOSTLYCLEANFILES += alt/weak_undef_lib_nonpic.so
659 weak_undef_nonpic_test_SOURCES = weak_undef_test.cc
660 weak_undef_nonpic_test_DEPENDENCIES = gcctestdir/ld weak_undef_lib_nonpic.so alt/weak_undef_lib_nonpic.so
661 weak_undef_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,alt
662 weak_undef_nonpic_test_LDADD = -L . weak_undef_lib_nonpic.so
663 weak_undef_file1_nonpic.o: weak_undef_file1.cc
664 $(CXXCOMPILE) -c -o $@ $<
665 weak_undef_file2_nonpic.o: weak_undef_file2.cc
666 $(CXXCOMPILE) -c -o $@ $<
667 weak_undef_lib_nonpic.so: weak_undef_file1_nonpic.o
668 $(CXXLINK) -Bgcctestdir/ -shared weak_undef_file1_nonpic.o -Wl,-z,notext
669 alt/weak_undef_lib_nonpic.so: weak_undef_file2_nonpic.o
670 test -d alt || mkdir -p alt
671 $(CXXLINK) -Bgcctestdir/ -shared weak_undef_file2_nonpic.o -Wl,-z,notext
672 endif FN_PTRS_IN_SO_WITHOUT_PIC
675 check_PROGRAMS += weak_alias_test
676 weak_alias_test_SOURCES = weak_alias_test_main.cc
677 weak_alias_test_DEPENDENCIES = \
678 gcctestdir/ld weak_alias_test_1.so weak_alias_test_2.so \
679 weak_alias_test_3.o weak_alias_test_4.so weak_alias_test_5.so
680 weak_alias_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
681 weak_alias_test_LDADD = \
682 weak_alias_test_1.so weak_alias_test_2.so weak_alias_test_3.o \
683 weak_alias_test_4.so weak_alias_test_5.so
684 weak_alias_test_1_pic.o: weak_alias_test_1.cc
685 $(CXXCOMPILE) -c -fpic -o $@ $<
686 weak_alias_test_1.so: weak_alias_test_1_pic.o gcctestdir/ld
687 $(CXXLINK) -Bgcctestdir/ -shared weak_alias_test_1_pic.o
688 weak_alias_test_2_pic.o: weak_alias_test_2.cc
689 $(CXXCOMPILE) -c -fpic -o $@ $<
690 weak_alias_test_2.so: weak_alias_test_2_pic.o gcctestdir/ld
691 $(CXXLINK) -Bgcctestdir/ -shared weak_alias_test_2_pic.o
692 weak_alias_test_3.o: weak_alias_test_3.cc
693 $(CXXCOMPILE) -c -o $@ $<
694 weak_alias_test_4_pic.o: weak_alias_test_4.cc
695 $(CXXCOMPILE) -c -fpic -o $@ $<
696 weak_alias_test_4.so: weak_alias_test_4_pic.o gcctestdir/ld
697 $(CXXLINK) -Bgcctestdir/ -shared weak_alias_test_4_pic.o
698 weak_alias_test_5_pic.o: weak_alias_test_5.cc
699 $(CXXCOMPILE) -c -fpic -o $@ $<
700 weak_alias_test_5.so: weak_alias_test_5_pic.o $(srcdir)/weak_alias_test.script gcctestdir/ld
701 $(CXXLINK) -Bgcctestdir/ -shared weak_alias_test_5_pic.o \
702 -Wl,--version-script,$(srcdir)/weak_alias_test.script
704 check_SCRIPTS += weak_plt.sh
705 check_PROGRAMS += weak_plt
706 check_DATA += weak_plt_shared.so
707 weak_plt_main_pic.o: weak_plt_main.cc
708 $(CXXCOMPILE) -c -fpic -o $@ $<
709 weak_plt: weak_plt_main_pic.o gcctestdir/ld
710 $(CXXLINK) -Bgcctestdir/ weak_plt_main_pic.o
711 weak_plt_shared_pic.o: weak_plt_shared.cc
712 $(CXXCOMPILE) -c -fpic -o $@ $<
713 weak_plt_shared.so: weak_plt_shared_pic.o gcctestdir/ld
714 $(CXXLINK) -Bgcctestdir/ -shared weak_plt_shared_pic.o
716 check_PROGRAMS += copy_test
717 copy_test_SOURCES = copy_test.cc
718 copy_test_DEPENDENCIES = gcctestdir/ld copy_test_1.so copy_test_2.so
719 copy_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
720 copy_test_LDADD = copy_test_1.so copy_test_2.so
721 copy_test_1_pic.o: copy_test_1.cc
722 $(CXXCOMPILE) -c -fpic -o $@ $<
723 copy_test_1.so: gcctestdir/ld copy_test_1_pic.o
724 $(CXXLINK) -Bgcctestdir/ -shared copy_test_1_pic.o
725 copy_test_2_pic.o: copy_test_2.cc
726 $(CXXCOMPILE) -c -fpic -o $@ $<
727 copy_test_2.so: gcctestdir/ld copy_test_2_pic.o
728 $(CXXLINK) -Bgcctestdir/ -shared copy_test_2_pic.o
732 check_PROGRAMS += tls_test
733 check_PROGRAMS += tls_pic_test
734 check_PROGRAMS += tls_pie_test
735 check_PROGRAMS += tls_pie_pic_test
736 check_PROGRAMS += tls_shared_test
737 check_PROGRAMS += tls_shared_ie_test
738 check_PROGRAMS += tls_shared_gd_to_ie_test
739 tls_test_pic.o: tls_test.cc
740 $(CXXCOMPILE) -c -fpic -o $@ $<
741 tls_test_file2_pic.o: tls_test_file2.cc
742 $(CXXCOMPILE) -c -fpic -o $@ $<
743 tls_test_c_pic.o: tls_test_c.c
744 $(COMPILE) -c -fpic $(TLS_TEST_C_CFLAGS) -o $@ $<
745 tls_test_shared.so: tls_test_pic.o tls_test_file2_pic.o tls_test_c_pic.o gcctestdir/ld
746 $(CXXLINK) -Bgcctestdir/ -shared tls_test_pic.o tls_test_file2_pic.o tls_test_c_pic.o -Wl,-z,defs
747 tls_test_shared2.so: tls_test_file2_pic.o gcctestdir/ld
748 $(CXXLINK) -Bgcctestdir/ -shared tls_test_file2_pic.o
750 tls_test_pic_ie.o: tls_test.cc
751 $(CXXCOMPILE) -c -fpic -ftls-model=initial-exec -o $@ $<
752 tls_test_file2_pic_ie.o: tls_test_file2.cc
753 $(CXXCOMPILE) -c -fpic -ftls-model=initial-exec -o $@ $<
754 tls_test_c_pic_ie.o: tls_test_c.c
755 $(COMPILE) -c -fpic -ftls-model=initial-exec $(TLS_TEST_C_CFLAGS) -o $@ $<
756 tls_test_ie_shared.so: tls_test_pic_ie.o tls_test_file2_pic_ie.o tls_test_c_pic_ie.o gcctestdir/ld
757 $(CXXLINK) -Bgcctestdir/ -shared tls_test_pic_ie.o tls_test_file2_pic_ie.o tls_test_c_pic_ie.o
759 tls_test_SOURCES = tls_test.cc tls_test_file2.cc tls_test_main.cc tls_test.h
760 tls_test_DEPENDENCIES = gcctestdir/ld tls_test_c.o
761 tls_test_LDFLAGS = -Bgcctestdir/
762 tls_test_LDADD = tls_test_c.o -lpthread
763 tls_test_c.o: tls_test_c.c
764 $(COMPILE) -c $(TLS_TEST_C_CFLAGS) -o $@ $<
766 tls_pic_test_SOURCES = tls_test_main.cc
767 tls_pic_test_DEPENDENCIES = gcctestdir/ld tls_test_pic.o tls_test_file2_pic.o \
769 tls_pic_test_LDFLAGS = -Bgcctestdir/
770 tls_pic_test_LDADD = tls_test_pic.o tls_test_file2_pic.o tls_test_c_pic.o \
773 tls_test_main_pie.o: tls_test_main.cc tls_test.h
774 $(CXXCOMPILE) -c -fpie -o $@ $<
775 tls_test_pie.o: tls_test.cc tls_test.h
776 $(CXXCOMPILE) -c -fpie -o $@ $<
777 tls_test_file2_pie.o: tls_test_file2.cc tls_test.h
778 $(CXXCOMPILE) -c -fpie -o $@ $<
779 tls_test_c_pie.o: tls_test_c.c
780 $(COMPILE) -c -fpic $(TLS_TEST_C_CFLAGS) -o $@ $<
781 tls_pie_test: tls_test_main_pie.o tls_test_pie.o tls_test_file2_pie.o \
782 tls_test_c_pie.o gcctestdir/ld
783 $(CXXLINK) -Bgcctestdir/ -pie tls_test_main_pie.o tls_test_pie.o tls_test_file2_pie.o tls_test_c_pie.o -lpthread
785 tls_pie_pic_test: tls_test_main_pie.o tls_test_pic.o tls_test_file2_pic.o \
786 tls_test_c_pic.o gcctestdir/ld
787 $(CXXLINK) -Bgcctestdir/ -pie tls_test_main_pie.o tls_test_pic.o tls_test_file2_pic.o tls_test_c_pic.o -lpthread
789 tls_shared_test_SOURCES = tls_test_main.cc
790 tls_shared_test_DEPENDENCIES = gcctestdir/ld tls_test_shared.so
791 tls_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
792 tls_shared_test_LDADD = tls_test_shared.so -lpthread
794 tls_shared_ie_test_SOURCES = tls_test_main.cc
795 tls_shared_ie_test_DEPENDENCIES = gcctestdir/ld tls_test_ie_shared.so
796 tls_shared_ie_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
797 tls_shared_ie_test_LDADD = tls_test_ie_shared.so -lpthread
799 tls_shared_gd_to_ie_test_SOURCES = tls_test_main.cc
800 tls_shared_gd_to_ie_test_DEPENDENCIES = gcctestdir/ld tls_test_pic.o \
801 tls_test_c_pic.o tls_test_shared2.so
802 tls_shared_gd_to_ie_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
803 tls_shared_gd_to_ie_test_LDADD = tls_test_pic.o tls_test_c_pic.o \
804 tls_test_shared2.so -lpthread
808 check_PROGRAMS += tls_shared_gnu2_gd_to_ie_test
810 tls_test_gnu2.o: tls_test.cc
811 $(CXXCOMPILE) -c -fpic -mtls-dialect=gnu2 -o $@ $<
812 tls_test_file2_gnu2.o: tls_test_file2.cc
813 $(CXXCOMPILE) -c -fpic -mtls-dialect=gnu2 -o $@ $<
814 tls_test_c_gnu2.o: tls_test_c.c
815 $(COMPILE) -c -fpic -mtls-dialect=gnu2 $(TLS_TEST_C_CFLAGS) -o $@ $<
816 tls_test_gnu2_shared2.so: tls_test_file2_gnu2.o gcctestdir/ld
817 $(CXXLINK) -Bgcctestdir/ -shared tls_test_file2_gnu2.o
819 tls_shared_gnu2_gd_to_ie_test_SOURCES = tls_test_main.cc
820 tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES = gcctestdir/ld tls_test_gnu2.o \
821 tls_test_c_gnu2.o tls_test_gnu2_shared2.so
822 tls_shared_gnu2_gd_to_ie_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
823 tls_shared_gnu2_gd_to_ie_test_LDADD = tls_test_gnu2.o tls_test_c_gnu2.o \
824 tls_test_gnu2_shared2.so -lpthread
828 check_PROGRAMS += tls_shared_gnu2_test
830 tls_test_gnu2_shared.so: tls_test_gnu2.o tls_test_file2_gnu2.o tls_test_c_gnu2.o gcctestdir/ld
831 $(CXXLINK) -Bgcctestdir/ -shared tls_test_gnu2.o tls_test_file2_gnu2.o tls_test_c_gnu2.o
833 tls_shared_gnu2_test_SOURCES = tls_test_main.cc
834 tls_shared_gnu2_test_DEPENDENCIES = gcctestdir/ld tls_test_gnu2_shared.so
835 tls_shared_gnu2_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
836 tls_shared_gnu2_test_LDADD = tls_test_gnu2_shared.so -lpthread
838 endif TLS_DESCRIPTORS
840 endif TLS_GNU2_DIALECT
844 check_PROGRAMS += tls_static_test
845 check_PROGRAMS += tls_static_pic_test
847 tls_static_test_SOURCES = $(tls_test_SOURCES)
848 tls_static_test_DEPENDENCIES = $(tls_test_DEPENDENCIES)
849 tls_static_test_LDFLAGS = $(tls_test_LDFLAGS) -static
850 tls_static_test_LDADD = $(tls_test_LDADD)
852 tls_static_pic_test_SOURCES = $(tls_pic_test_SOURCES)
853 tls_static_pic_test_DEPENDENCIES = $(tls_pic_test_DEPENDENCIES)
854 tls_static_pic_test_LDFLAGS = $(tls_pic_test_LDFLAGS) -static
855 tls_static_pic_test_LDADD = $(tls_pic_test_LDADD)
859 if FN_PTRS_IN_SO_WITHOUT_PIC
860 check_PROGRAMS += tls_shared_nonpic_test
861 tls_test_shared_nonpic.so: tls_test.o tls_test_file2.o tls_test_c.o gcctestdir/ld
862 $(CXXLINK) -Bgcctestdir/ -shared tls_test.o tls_test_file2.o tls_test_c.o -Wl,-z,notext
864 tls_shared_nonpic_test_SOURCES = tls_test_main.cc
865 tls_shared_nonpic_test_DEPENDENCIES = gcctestdir/ld tls_test_shared_nonpic.so
866 tls_shared_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
867 tls_shared_nonpic_test_LDADD = tls_test_shared_nonpic.so -lpthread
868 endif FN_PTRS_IN_SO_WITHOUT_PIC
872 check_PROGRAMS += many_sections_test
873 many_sections_test_SOURCES = many_sections_test.cc
874 many_sections_test_DEPENDENCIES = gcctestdir/ld
875 many_sections_test_LDFLAGS = -Bgcctestdir/ -rdynamic
876 many_sections_test_LDADD =
878 BUILT_SOURCES += many_sections_define.h
879 MOSTLYCLEANFILES += many_sections_define.h
880 many_sections_define.h:
881 (for i in `seq 1 70000`; do \
882 echo "int var_$$i __attribute__((section(\"section_$$i\"))) = $$i;"; \
886 BUILT_SOURCES += many_sections_check.h
887 MOSTLYCLEANFILES += many_sections_check.h
888 many_sections_check.h:
889 (for i in `seq 1 1000 70000`; do \
890 echo "assert(var_$$i == $$i);"; \
894 check_PROGRAMS += many_sections_r_test
895 many_sections_r_test.o: many_sections_test.o gcctestdir/ld
896 gcctestdir/ld -r -o $@ many_sections_test.o
897 many_sections_r_test: many_sections_r_test.o gcctestdir/ld
898 $(CXXLINK) -Bgcctestdir/ many_sections_r_test.o $(LIBS)
900 check_PROGRAMS += initpri1
901 initpri1_SOURCES = initpri1.c
902 initpri1_DEPENDENCIES = gcctestdir/ld
903 initpri1_LDFLAGS = -Bgcctestdir/
906 check_PROGRAMS += initpri2
907 initpri2_SOURCES = initpri2.c
908 initpri2_DEPENDENCIES = gcctestdir/ld
909 initpri2_LDFLAGS = -Bgcctestdir/ -Wl,--ctors-in-init-array
912 check_PROGRAMS += initpri3a
913 initpri3a_SOURCES = initpri3.c
914 initpri3a_DEPENDENCIES = gcctestdir/ld
915 initpri3a_LDFLAGS = -Bgcctestdir/
918 # This test fails on targets not using .ctors and .dtors sections (e.g. ARM
919 # EABI). Given that gcc is moving towards using .init_array in all cases,
920 # this test is commented out. A better fix would be checking whether gcc
921 # uses .ctors or .init_array sections in configure.
923 # check_PROGRAMS += initpri3b
924 # initpri3b_SOURCES = initpri3.c
925 # initpri3b_DEPENDENCIES = gcctestdir/ld
926 # initpri3b_LDFLAGS = -Bgcctestdir/ -Wl,--no-ctors-in-init-array
929 # Test --detect-odr-violations
930 check_SCRIPTS += debug_msg.sh
932 # Create the data files that debug_msg.sh analyzes.
933 check_DATA += debug_msg.err
934 MOSTLYCLEANFILES += debug_msg.err
935 debug_msg.o: debug_msg.cc
936 $(CXXCOMPILE) -O0 -g -c -w -o $@ $(srcdir)/debug_msg.cc
937 odr_violation1.o: odr_violation1.cc
938 $(CXXCOMPILE) -O0 -g -c -w -o $@ $(srcdir)/odr_violation1.cc
939 # Compile with different optimization flags to check that rearranged
940 # instructions don't cause a false positive.
941 odr_violation2.o: odr_violation2.cc
942 $(CXXCOMPILE) -O2 -g -c -w -o $@ $(srcdir)/odr_violation2.cc
943 debug_msg.err: debug_msg.o odr_violation1.o odr_violation2.o gcctestdir/ld
944 @echo $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg debug_msg.o odr_violation1.o odr_violation2.o "2>$@"
945 @if $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg debug_msg.o odr_violation1.o odr_violation2.o 2>$@; \
947 echo 1>&2 "Link of debug_msg should have failed"; \
955 # Check that --detect-odr-violations works with compressed debug sections.
956 check_DATA += debug_msg_cdebug.err
957 MOSTLYCLEANFILES += debug_msg_cdebug.err
958 debug_msg_cdebug.o: debug_msg.cc gcctestdir/as
959 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -Wa,--compress-debug-sections -c -w -o $@ $(srcdir)/debug_msg.cc
960 odr_violation1_cdebug.o: odr_violation1.cc gcctestdir/as
961 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -Wa,--compress-debug-sections -c -w -o $@ $(srcdir)/odr_violation1.cc
962 odr_violation2_cdebug.o: odr_violation2.cc gcctestdir/as
963 $(CXXCOMPILE) -Bgcctestdir/ -O2 -g -Wa,--compress-debug-sections -c -w -o $@ $(srcdir)/odr_violation2.cc
964 debug_msg_cdebug.err: debug_msg_cdebug.o odr_violation1_cdebug.o odr_violation2_cdebug.o gcctestdir/ld
965 @echo $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_cdebug debug_msg_cdebug.o odr_violation1_cdebug.o odr_violation2_cdebug.o "2>$@"
966 @if $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_cdebug debug_msg_cdebug.o odr_violation1_cdebug.o odr_violation2_cdebug.o 2>$@; \
968 echo 1>&2 "Link of debug_msg_cdebug should have failed"; \
975 # See if we can also detect problems when we're linking .so's, not .o's.
976 check_DATA += debug_msg_so.err
977 MOSTLYCLEANFILES += debug_msg_so.err
978 debug_msg.so: debug_msg.cc gcctestdir/ld
979 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -shared -fPIC -w -o $@ $(srcdir)/debug_msg.cc
980 odr_violation1.so: odr_violation1.cc gcctestdir/ld
981 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -shared -fPIC -w -o $@ $(srcdir)/odr_violation1.cc
982 odr_violation2.so: odr_violation2.cc gcctestdir/ld
983 $(CXXCOMPILE) -Bgcctestdir/ -O2 -g -shared -fPIC -w -o $@ $(srcdir)/odr_violation2.cc
984 debug_msg_so.err: debug_msg.so odr_violation1.so odr_violation2.so gcctestdir/ld
985 @echo $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_so debug_msg.so odr_violation1.so odr_violation2.so "2>$@"
986 @if $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_so debug_msg.so odr_violation1.so odr_violation2.so 2>$@; \
988 echo 1>&2 "Link of debug_msg_so should have failed"; \
993 # We also want to make sure we do something reasonable when there's no
994 # debug info available. For the best test, we use .so's.
995 check_DATA += debug_msg_ndebug.err
996 MOSTLYCLEANFILES += debug_msg_ndebug.err
997 debug_msg_ndebug.so: debug_msg.cc gcctestdir/ld
998 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g0 -shared -fPIC -w -o $@ $(srcdir)/debug_msg.cc
999 odr_violation1_ndebug.so: odr_violation1.cc gcctestdir/ld
1000 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g0 -shared -fPIC -w -o $@ $(srcdir)/odr_violation1.cc
1001 odr_violation2_ndebug.so: odr_violation2.cc gcctestdir/ld
1002 $(CXXCOMPILE) -Bgcctestdir/ -O2 -g0 -shared -fPIC -w -o $@ $(srcdir)/odr_violation2.cc
1003 debug_msg_ndebug.err: debug_msg_ndebug.so odr_violation1_ndebug.so odr_violation2_ndebug.so gcctestdir/ld
1004 @echo $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_ndebug debug_msg_ndebug.so odr_violation1_ndebug.so odr_violation2_ndebug.so "2>$@"
1005 @if $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_ndebug debug_msg_ndebug.so odr_violation1_ndebug.so odr_violation2_ndebug.so 2>$@; \
1007 echo 1>&2 "Link of debug_msg_ndebug should have failed"; \
1013 # Similar to --detect-odr-violations: check for undefined symbols in .so's
1014 check_SCRIPTS += undef_symbol.sh
1015 check_DATA += undef_symbol.err
1016 MOSTLYCLEANFILES += undef_symbol.err
1017 undef_symbol.o: undef_symbol.cc
1018 $(CXXCOMPILE) -O0 -g -c -fPIC $<
1019 undef_symbol.so: undef_symbol.o gcctestdir/ld
1020 $(CXXLINK) -Bgcctestdir/ -shared undef_symbol.o
1021 undef_symbol.err: undef_symbol_main.o undef_symbol.so gcctestdir/ld
1022 @echo $(CXXLINK) -Bgcctestdir/ -o undef_symbol_test undef_symbol_main.o undef_symbol.so "2>$@"
1023 @if $(CXXLINK) -Bgcctestdir/ -o undef_symbol_test undef_symbol_main.o undef_symbol.so 2>$@; \
1025 echo 1>&2 "Link of undef_symbol_test should have failed"; \
1031 # Test -o when emitting to a special file (such as something in /dev).
1032 check_PROGRAMS += flagstest_o_specialfile
1033 flagstest_o_specialfile: flagstest_debug.o gcctestdir/ld
1034 $(CXXLINK) -Bgcctestdir/ -o /dev/stdout $< 2>&1 | cat > $@
1040 # Test --compress-debug-sections. FIXME: check we actually compress.
1041 check_PROGRAMS += flagstest_compress_debug_sections
1042 flagstest_compress_debug_sections: flagstest_debug.o gcctestdir/ld
1043 $(CXXLINK) -Bgcctestdir/ -o $@ $< -Wl,--compress-debug-sections=zlib
1047 # The specialfile output has a tricky case when we also compress debug
1048 # sections, because it requires output-file resizing.
1049 check_PROGRAMS += flagstest_o_specialfile_and_compress_debug_sections
1050 flagstest_o_specialfile_and_compress_debug_sections: flagstest_debug.o \
1052 $(CXXLINK) -Bgcctestdir/ -o /dev/stdout $< -Wl,--compress-debug-sections=zlib 2>&1 | cat > $@
1058 # Test -TText and -Tdata.
1059 check_PROGRAMS += flagstest_o_ttext_1
1060 flagstest_o_ttext_1: flagstest_debug.o gcctestdir/ld
1061 $(CXXLINK) -Bgcctestdir/ -o $@ $< -Wl,-Ttext,0x400000 -Wl,-Tdata,0x800000
1063 # This version won't be runnable, because there is no way to put the
1064 # PT_PHDR segment at file offset 0. We just make sure that we can
1065 # build it without error.
1066 check_DATA += flagstest_o_ttext_2
1067 flagstest_o_ttext_2: flagstest_debug.o gcctestdir/ld
1068 $(CXXLINK) -Bgcctestdir/ -o $@ $< -Wl,-Ttext,0x400010 -Wl,-Tdata,0x800010
1070 # Test symbol versioning.
1071 check_PROGRAMS += ver_test
1072 ver_test_SOURCES = ver_test_main.cc
1073 ver_test_DEPENDENCIES = gcctestdir/ld ver_test_1.so ver_test_2.so ver_test_4.so
1074 ver_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1075 ver_test_LDADD = ver_test_1.so ver_test_2.so ver_test_4.so
1076 ver_test_1.so: ver_test_1.o ver_test_2.so ver_test_3.o ver_test_4.so gcctestdir/ld
1077 $(CXXLINK) -Bgcctestdir/ -shared ver_test_1.o ver_test_2.so ver_test_3.o ver_test_4.so
1078 ver_test_2.so: ver_test_2.o $(srcdir)/ver_test_2.script ver_test_4.so gcctestdir/ld
1079 $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_2.script -Wl,-R,. ver_test_2.o ver_test_4.so
1080 ver_test_4.so: ver_test_4.o $(srcdir)/ver_test_4.script gcctestdir/ld
1081 $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_4.script ver_test_4.o
1082 ver_test_1.o: ver_test_1.cc
1083 $(CXXCOMPILE) -c -fpic -o $@ $<
1084 ver_test_2.o: ver_test_2.cc
1085 $(CXXCOMPILE) -c -fpic -o $@ $<
1086 ver_test_3.o: ver_test_3.cc
1087 $(CXXCOMPILE) -c -fpic -o $@ $<
1088 ver_test_4.o: ver_test_4.cc
1089 $(CXXCOMPILE) -c -fpic -o $@ $<
1091 check_SCRIPTS += ver_test_1.sh
1092 check_DATA += ver_test_1.syms
1093 ver_test_1.syms: ver_test_1.so
1094 $(TEST_READELF) -s $< >$@ 2>/dev/null
1096 check_PROGRAMS += ver_test_2
1097 ver_test_2_SOURCES = ver_test_main_2.cc
1098 ver_test_2_DEPENDENCIES = gcctestdir/ld ver_test_4.so ver_test_2.so
1099 ver_test_2_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1100 ver_test_2_LDADD = ver_test_4.so ver_test_2.so
1102 check_SCRIPTS += ver_test_2.sh
1103 check_DATA += ver_test_2.syms
1104 ver_test_2.syms: ver_test_2
1105 $(TEST_READELF) -s $< >$@ 2>/dev/null
1107 check_SCRIPTS += ver_test_4.sh
1108 check_DATA += ver_test_4.syms
1109 ver_test_4.syms: ver_test_4.so
1110 $(TEST_READELF) -s $< >$@ 2>/dev/null
1112 ver_test_5.so: ver_test_5.o $(srcdir)/ver_test_5.script ver_test_4.so gcctestdir/ld
1113 $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_5.script ver_test_5.o ver_test_4.so
1114 ver_test_5.o: ver_test_5.cc
1115 $(CXXCOMPILE) -c -fpic -o $@ $<
1116 check_SCRIPTS += ver_test_5.sh
1117 check_DATA += ver_test_5.syms
1118 ver_test_5.syms: ver_test_5.so
1119 $(TEST_READELF) -s $< >$@ 2>/dev/null
1121 check_PROGRAMS += ver_test_6
1122 ver_test_6_SOURCES = ver_test_6.c
1123 ver_test_6_DEPENDENCIES = gcctestdir/ld ver_test_2.so
1124 ver_test_6_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1125 ver_test_6_LDADD = ver_test_2.so
1127 ver_test_7.so: ver_test_4.o $(srcdir)/ver_test_4.script ver_test_7.o gcctestdir/ld
1128 $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_4.script ver_test_4.o ver_test_7.o
1129 ver_test_7.o: ver_test_7.cc
1130 $(CXXCOMPILE) -c -fpic -o $@ $<
1131 check_SCRIPTS += ver_test_7.sh
1132 check_DATA += ver_test_7.syms
1133 ver_test_7.syms: ver_test_7.so
1134 $(TEST_READELF) -s $< >$@ 2>/dev/null
1136 check_PROGRAMS += ver_test_8
1137 ver_test_8_SOURCES = two_file_test_main.cc
1138 ver_test_8_DEPENDENCIES = gcctestdir/ld ver_test_8_1.so ver_test_8_2.so
1139 ver_test_8_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1140 ver_test_8_LDADD = ver_test_8_1.so ver_test_8_2.so
1141 ver_test_8_1.so: two_file_test_1_pic.o two_file_test_1b_pic.o ver_test_8_2.so gcctestdir/ld
1142 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1_pic.o two_file_test_1b_pic.o ver_test_8_2.so
1143 ver_test_8_2.so: two_file_test_2_pic.o $(srcdir)/ver_test_8.script gcctestdir/ld
1144 $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_8.script two_file_test_2_pic.o
1146 check_PROGRAMS += ver_test_9
1147 ver_test_9_SOURCES = ver_test_main.cc
1148 ver_test_9_DEPENDENCIES = gcctestdir/ld ver_test_9.so
1149 ver_test_9_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1150 ver_test_9_LDADD = ver_test_9.so
1151 ver_test_9.so: ver_test_9.o ver_test_4.so ver_test_5.so gcctestdir/ld
1152 $(CXXLINK) -Bgcctestdir/ -shared -Wl,-R,. ver_test_9.o ver_test_5.so ver_test_4.so
1153 ver_test_9.o: ver_test_9.cc
1154 $(CXXCOMPILE) -c -fpic -o $@ $<
1156 check_SCRIPTS += ver_test_10.sh
1157 check_DATA += ver_test_10.syms
1158 ver_test_10.syms: ver_test_10.so
1159 $(TEST_READELF) -s $< >$@ 2>/dev/null
1160 ver_test_10.so: gcctestdir/ld ver_test_2.o ver_test_10.script
1161 $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_10.script ver_test_2.o
1163 check_PROGRAMS += ver_test_11
1164 MOSTLYCLEANFILES += ver_test_11.a
1165 ver_test_11_SOURCES = ver_test_main_2.cc
1166 ver_test_11_DEPENDENCIES = gcctestdir/ld ver_test_11.a
1167 ver_test_11_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1168 ver_test_11_LDADD = ver_test_11.a
1169 ver_test_11.a: ver_test_1.o ver_test_2.o ver_test_4.o
1172 check_PROGRAMS += ver_test_12
1173 ver_test_12_SOURCES = ver_test_main_2.cc
1174 ver_test_12_DEPENDENCIES = gcctestdir/ld ver_test_12.o
1175 ver_test_12_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1176 ver_test_12_LDADD = ver_test_12.o
1177 ver_test_12.o: gcctestdir/ld ver_test_1.o ver_test_2.o ver_test_4.o
1178 gcctestdir/ld -r -o $@ ver_test_1.o ver_test_2.o ver_test_4.o
1180 check_PROGRAMS += protected_1
1181 protected_1_SOURCES = \
1182 protected_main_1.cc protected_main_2.cc protected_main_3.cc
1183 protected_1_DEPENDENCIES = gcctestdir/ld protected_1.so
1184 protected_1_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1185 protected_1_LDADD = protected_1.so
1187 protected_1.so: gcctestdir/ld protected_1_pic.o protected_2_pic.o protected_3_pic.o
1188 $(CXXLINK) -Bgcctestdir/ -shared protected_1_pic.o protected_2_pic.o protected_3_pic.o
1189 protected_1_pic.o: protected_1.cc
1190 $(CXXCOMPILE) -c -fpic -o $@ $<
1191 protected_2_pic.o: protected_2.cc
1192 $(CXXCOMPILE) -c -fpic -o $@ $<
1193 protected_3_pic.o: protected_3.cc
1194 $(CXXCOMPILE) -c -fpic -o $@ $<
1196 check_PROGRAMS += protected_2
1197 protected_2_SOURCES = protected_main_1.cc protected_3.cc
1198 protected_2_DEPENDENCIES = gcctestdir/ld protected_1.so
1199 protected_2_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1200 protected_2_LDADD = protected_1.so
1202 check_DATA += protected_3.err
1203 MOSTLYCLEANFILES += protected_3.err
1204 protected_4_pic.o: protected_4.cc
1205 $(CXXCOMPILE) -c -fpic -o $@ $<
1206 protected_3.err: protected_4_pic.o gcctestdir/ld
1207 @echo $(CXXLINK) -Bgcctestdir/ -shared -o protected_4.so protected_4_pic.o "2>$@"
1208 @if $(CXXLINK) -Bgcctestdir/ -shared -o protected_4.so protected_4_pic.o 2>$@; then \
1209 echo 1>&2 "Link of protected_4.so should have failed"; \
1214 check_PROGRAMS += relro_test
1215 check_SCRIPTS += relro_test.sh
1216 check_DATA += relro_test.stdout
1217 relro_test_SOURCES = relro_test_main.cc
1218 relro_test_DEPENDENCIES = gcctestdir/ld relro_test.so
1219 relro_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1220 relro_test_LDADD = relro_test.so
1221 relro_test.so: gcctestdir/ld relro_test_pic.o
1222 $(CXXLINK) -Bgcctestdir/ -shared -Wl,-z,relro relro_test_pic.o
1223 relro_test_pic.o: relro_test.cc
1224 $(CXXCOMPILE) -c -fpic -o $@ $<
1225 relro_test.stdout: relro_test.so
1226 $(TEST_READELF) -SlW relro_test.so > relro_test.stdout
1228 check_PROGRAMS += relro_now_test
1229 relro_now_test_SOURCES = relro_test_main.cc
1230 relro_now_test_DEPENDENCIES = gcctestdir/ld relro_now_test.so
1231 relro_now_test_LDFLAGS = -Bgcctestdir -Wl,-R,. -Wl,-z,relro -Wl,-z,now
1232 relro_now_test_LDADD = relro_now_test.so
1233 relro_now_test.so: gcctestdir/ld relro_test_pic.o
1234 $(CXXLINK) -Bgcctestdir/ -shared -Wl,-z,relro -Wl,-z,now relro_test_pic.o
1236 check_PROGRAMS += relro_strip_test
1237 relro_strip_test_SOURCES = relro_test_main.cc
1238 relro_strip_test_DEPENDENCIES = gcctestdir/ld relro_strip_test.so
1239 relro_strip_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1240 relro_strip_test_LDADD = relro_strip_test.so
1241 relro_strip_test.so: relro_test.so
1242 $(TEST_STRIP) -o $@ $<
1244 check_PROGRAMS += relro_script_test
1245 relro_script_test_SOURCES = relro_test_main.cc
1246 relro_script_test_DEPENDENCIES = gcctestdir/ld relro_script_test.so
1247 relro_script_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1248 relro_script_test_LDADD = relro_script_test.so
1249 relro_script_test.so: gcctestdir/ld relro_script_test.t relro_test_pic.o
1250 $(CXXLINK) -Bgcctestdir/ -shared -Wl,-z,relro -T $(srcdir)/relro_script_test.t relro_test_pic.o
1252 check_PROGRAMS += script_test_1
1253 script_test_1_SOURCES = script_test_1.cc
1254 script_test_1_DEPENDENCIES = gcctestdir/ld script_test_1.t
1255 script_test_1_LDFLAGS = -Bgcctestdir/ -Wl,-R,. -T $(srcdir)/script_test_1.t
1256 script_test_1_LDADD =
1258 check_PROGRAMS += script_test_2
1259 script_test_2_SOURCES = script_test_2.cc script_test_2a.cc script_test_2b.cc
1260 script_test_2_DEPENDENCIES = gcctestdir/ld script_test_2.t
1261 script_test_2_LDFLAGS = -Bgcctestdir/ -Wl,-R,. -T $(srcdir)/script_test_2.t
1262 script_test_2_LDADD =
1264 check_PROGRAMS += justsyms
1265 justsyms_SOURCES = justsyms_1.cc
1266 justsyms_DEPENDENCIES = gcctestdir/ld justsyms_2r.o
1267 justsyms_LDFLAGS = -Bgcctestdir/ -Wl,-R,justsyms_2r.o
1269 justsyms_2.o: justsyms_2.cc
1270 $(CXXCOMPILE) -c -o $@ $<
1271 justsyms_2r.o: justsyms_2.o gcctestdir/ld $(srcdir)/justsyms.t
1272 gcctestdir/ld -o $@ -r -T $(srcdir)/justsyms.t justsyms_2.o
1274 check_PROGRAMS += justsyms_exec
1275 justsyms_exec_SOURCES = justsyms_exec.c
1276 justsyms_exec_DEPENDENCIES = gcctestdir/ld justsyms_lib
1277 justsyms_exec_LDFLAGS = -Bgcctestdir/ -Wl,-R,justsyms_lib
1278 justsyms_exec_LDADD =
1279 justsyms_lib.o: justsyms_lib.c
1280 $(COMPILE) -c -o $@ $<
1281 justsyms_lib: justsyms_lib.o gcctestdir/ld
1282 gcctestdir/ld -o $@ -Ttext=0x1000200 -Tdata=0x2000000 -e exported_func justsyms_lib.o
1284 check_PROGRAMS += binary_test
1285 MOSTLYCLEANFILES += binary.txt
1286 binary_test_SOURCES = binary_test.cc
1287 binary_test_DEPENDENCIES = gcctestdir/ld binary.txt
1288 binary_test_LDFLAGS = -Bgcctestdir/ -Wl,--format,binary,binary.txt,--format,elf
1290 # Copy the file to the build directory to avoid worrying about the
1291 # full pathname in the generated symbols.
1292 binary.txt: $(srcdir)/binary.in
1296 check_SCRIPTS += ver_matching_test.sh
1297 check_DATA += ver_matching_test.stdout
1298 MOSTLYCLEANFILES += ver_matching_test.stdout
1299 ver_matching_def.so: ver_matching_def_pic.o $(srcdir)/version_script.map gcctestdir/ld
1300 $(CXXLINK) -O0 -Bgcctestdir/ -shared ver_matching_def_pic.o -Wl,--version-script=$(srcdir)/version_script.map
1301 ver_matching_def_pic.o: ver_matching_def.cc
1302 $(CXXCOMPILE) -O0 -c -fpic -o $@ $<
1303 ver_matching_test.stdout: ver_matching_def.so
1304 $(TEST_OBJDUMP) -T ver_matching_def.so | $(TEST_CXXFILT) > ver_matching_test.stdout
1306 check_PROGRAMS += script_test_3
1307 check_SCRIPTS += script_test_3.sh
1308 check_DATA += script_test_3.stdout
1309 MOSTLYCLEANFILES += script_test_3.stdout
1310 script_test_3: basic_test.o gcctestdir/ld script_test_3.t
1311 $(CXXLINK) -Bgcctestdir/ basic_test.o -T $(srcdir)/script_test_3.t
1312 script_test_3.stdout: script_test_3
1313 $(TEST_READELF) -SlW script_test_3 > script_test_3.stdout
1315 check_PROGRAMS += tls_phdrs_script_test
1316 tls_phdrs_script_test_SOURCES = $(tls_test_SOURCES)
1317 tls_phdrs_script_test_DEPENDENCIES = $(tls_test_DEPENDENCIES) $(srcdir)/script_test_3.t
1318 tls_phdrs_script_test_LDFLAGS = $(tls_test_LDFLAGS) -T $(srcdir)/script_test_3.t
1319 tls_phdrs_script_test_LDADD = $(tls_test_LDADD)
1321 check_SCRIPTS += script_test_4.sh
1322 check_DATA += script_test_4.stdout
1323 MOSTLYCLEANFILES += script_test_4
1324 script_test_4: basic_test.o gcctestdir/ld $(srcdir)/script_test_4.t
1325 $(CXXLINK) -Bgcctestdir/ basic_test.o -T $(srcdir)/script_test_4.t
1326 script_test_4.stdout: script_test_4
1327 $(TEST_READELF) -SlW script_test_4 > script_test_4.stdout
1329 check_PROGRAMS += tls_script_test
1330 tls_script_test_SOURCES = $(tls_test_SOURCES)
1331 tls_script_test_DEPENDENCIES = $(tls_test_DEPENDENCIES) $(srcdir)/script_test_4.t
1332 tls_script_test_LDFLAGS = $(tls_test_LDFLAGS) -T $(srcdir)/script_test_4.t
1333 tls_script_test_LDADD = $(tls_test_LDADD)
1335 check_SCRIPTS += script_test_5.sh
1336 check_DATA += script_test_5.stdout
1337 MOSTLYCLEANFILES += script_test_5
1338 script_test_5: script_test_5.o gcctestdir/ld $(srcdir)/script_test_5.t
1339 $(CXXLINK) -Bgcctestdir/ script_test_5.o -T $(srcdir)/script_test_5.t
1340 script_test_5.stdout: script_test_5
1341 $(TEST_READELF) -SW script_test_5 > script_test_5.stdout
1343 check_SCRIPTS += script_test_6.sh
1344 check_DATA += script_test_6.stdout
1345 MOSTLYCLEANFILES += script_test_6
1346 script_test_6: basic_test.o gcctestdir/ld $(srcdir)/script_test_6.t
1347 $(CXXLINK) -Bgcctestdir/ basic_test.o -T $(srcdir)/script_test_6.t \
1348 -Wl,-Ttext=0x10001000 -Wl,-Tdata=0x10200000 -Wl,-Tbss=0x10400000
1349 script_test_6.stdout: script_test_6
1350 $(TEST_READELF) -SlW script_test_6 > script_test_6.stdout
1352 check_SCRIPTS += script_test_7.sh
1353 check_DATA += script_test_7.stdout
1354 MOSTLYCLEANFILES += script_test_7
1355 script_test_7: basic_test.o gcctestdir/ld $(srcdir)/script_test_7.t
1356 $(CXXLINK) -Bgcctestdir/ basic_test.o -T $(srcdir)/script_test_7.t
1357 script_test_7.stdout: script_test_7
1358 $(TEST_READELF) -SlW script_test_7 > script_test_7.stdout
1360 check_SCRIPTS += script_test_8.sh
1361 check_DATA += script_test_8.stdout
1362 MOSTLYCLEANFILES += script_test_8
1363 script_test_8: basic_test.o gcctestdir/ld $(srcdir)/script_test_7.t
1364 $(CXXLINK) -Bgcctestdir/ basic_test.o -T $(srcdir)/script_test_7.t \
1365 -Wl,-Ttext=0x20001000 -Wl,-Tdata=0x20200000 -Wl,-Tbss=0x20400000
1366 script_test_8.stdout: script_test_8
1367 $(TEST_READELF) -SlW script_test_8 > script_test_8.stdout
1370 check_SCRIPTS += script_test_9.sh
1371 check_DATA += script_test_9.stdout
1372 script_test_9.o: script_test_9.cc
1373 $(CXXCOMPILE) -O0 -c -o $@ $<
1374 script_test_9: gcctestdir/ld $(srcdir)/script_test_9.t script_test_9.o
1375 $(CXXLINK) -Bgcctestdir/ script_test_9.o -T $(srcdir)/script_test_9.t
1376 script_test_9.stdout: script_test_9
1377 $(TEST_READELF) -lW script_test_9 > script_test_9.stdout
1380 # Test --dynamic-list, --dynamic-list-data, --dynamic-list-cpp-new,
1381 # and --dynamic-list-cpp-typeinfo
1383 check_SCRIPTS += dynamic_list.sh
1384 check_DATA += dynamic_list.stdout
1385 MOSTLYCLEANFILES += dynamic_list dynamic_list.stdout
1386 dynamic_list: basic_test.o gcctestdir/ld $(srcdir)/dynamic_list.t
1387 $(CXXLINK) -Bgcctestdir/ basic_test.o \
1388 -Wl,--dynamic-list $(srcdir)/dynamic_list.t \
1389 -Wl,--dynamic-list-data \
1390 -Wl,--dynamic-list-cpp-new \
1391 -Wl,--dynamic-list-cpp-typeinfo
1392 dynamic_list.stdout: dynamic_list
1393 $(TEST_READELF) -W --dyn-syms dynamic_list > dynamic_list.stdout
1395 check_PROGRAMS += thin_archive_test_1
1396 MOSTLYCLEANFILES += libthin1.a libthin3.a libthinall.a \
1397 alt/thin_archive_test_2.o alt/thin_archive_test_4.o \
1398 alt/libthin2.a alt/libthin4.a
1399 thin_archive_test_1_SOURCES = thin_archive_main.cc
1400 thin_archive_test_1_DEPENDENCIES = gcctestdir/ld libthin1.a alt/libthin2.a
1401 thin_archive_test_1_LDFLAGS = -Bgcctestdir/ -Lalt
1402 thin_archive_test_1_LDADD = libthin1.a -lthin2
1404 check_PROGRAMS += thin_archive_test_2
1405 thin_archive_test_2_SOURCES = thin_archive_main.cc
1406 thin_archive_test_2_DEPENDENCIES = gcctestdir/ld libthinall.a
1407 thin_archive_test_2_LDFLAGS = -Bgcctestdir/ -L.
1408 thin_archive_test_2_LDADD = -lthinall
1410 libthin1.a: thin_archive_test_1.o alt/thin_archive_test_2.o
1412 $(TEST_AR) crT $@ $^
1413 alt/libthin2.a: thin_archive_test_3.o alt/thin_archive_test_4.o
1415 $(TEST_AR) crT $@ $^
1416 libthin3.a: thin_archive_test_1.o alt/thin_archive_test_4.o
1418 $(TEST_AR) crT $@ $^
1419 alt/libthin4.a: alt/thin_archive_test_2.o thin_archive_test_3.o
1421 $(TEST_AR) crT $@ $^
1422 libthinall.a: libthin3.a alt/libthin4.a
1424 $(TEST_AR) crT $@ $^
1425 alt/thin_archive_test_2.o: thin_archive_test_2.cc
1426 test -d alt || mkdir -p alt
1427 $(CXXCOMPILE) -c -o $@ $<
1428 alt/thin_archive_test_4.o: thin_archive_test_4.cc
1429 test -d alt || mkdir -p alt
1430 $(CXXCOMPILE) -c -o $@ $<
1434 check_PROGRAMS += plugin_test_1
1435 check_SCRIPTS += plugin_test_1.sh
1436 check_DATA += plugin_test_1.err
1437 MOSTLYCLEANFILES += plugin_test_1.err
1438 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
1439 $(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
1440 plugin_test_1.err: plugin_test_1
1441 @touch plugin_test_1.err
1443 check_PROGRAMS += plugin_test_2
1444 check_SCRIPTS += plugin_test_2.sh
1445 check_DATA += plugin_test_2.err
1446 MOSTLYCLEANFILES += plugin_test_2.err
1447 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
1448 $(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
1449 plugin_test_2.err: plugin_test_2
1450 @touch plugin_test_2.err
1452 check_PROGRAMS += plugin_test_3
1453 check_SCRIPTS += plugin_test_3.sh
1454 check_DATA += plugin_test_3.err
1455 MOSTLYCLEANFILES += plugin_test_3.err
1456 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
1457 $(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
1458 plugin_test_3.err: plugin_test_3
1459 @touch plugin_test_3.err
1461 check_PROGRAMS += plugin_test_4
1462 check_SCRIPTS += plugin_test_4.sh
1463 check_DATA += plugin_test_4.err
1464 MOSTLYCLEANFILES += plugin_test_4.a plugin_test_4.err
1465 plugin_test_4: two_file_test_main.o plugin_test_4.a gcctestdir/ld plugin_test.so
1466 $(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
1467 plugin_test_4.err: plugin_test_4
1468 @touch plugin_test_4.err
1470 plugin_test_4.a: two_file_test_1.syms two_file_test_1b.syms two_file_test_2.syms
1473 check_PROGRAMS += plugin_test_5
1474 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
1475 $(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
1477 check_PROGRAMS += plugin_test_6
1478 check_SCRIPTS += plugin_test_6.sh
1479 check_DATA += plugin_test_6.err
1480 MOSTLYCLEANFILES += plugin_test_6.err
1481 plugin_test_6: plugin_common_test_1.syms plugin_common_test_2.syms gcctestdir/ld plugin_test.so
1482 $(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle,--plugin,"./plugin_test.so" plugin_common_test_1.syms plugin_common_test_2.syms 2>plugin_test_6.err
1483 plugin_test_6.err: plugin_test_6
1484 @touch plugin_test_6.err
1486 check_PROGRAMS += plugin_test_7
1487 check_SCRIPTS += plugin_test_7.sh
1488 check_DATA += plugin_test_7.err plugin_test_7.syms
1489 MOSTLYCLEANFILES += plugin_test_7.err
1490 plugin_test_7: plugin_test_7_1.o plugin_test_7_1.syms plugin_test_7_2.o gcctestdir/ld plugin_test.so
1491 $(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
1492 plugin_test_7.syms: plugin_test_7
1493 $(TEST_READELF) -sW $< >$@ 2>/dev/null
1494 plugin_test_7_1.o: plugin_test_7_1.c
1495 $(COMPILE) -DLTO -O0 -c -ffunction-sections -fdata-sections -o $@ $<
1496 plugin_test_7_1_orig.o: plugin_test_7_1.c
1497 $(COMPILE) -O0 -c -ffunction-sections -fdata-sections -o $@ $<
1498 plugin_test_7_1.syms: plugin_test_7_1_orig.o
1499 $(TEST_READELF) -sW $< >$@ 2>/dev/null
1500 plugin_test_7_2.o: plugin_test_7_2.c
1501 $(COMPILE) -O0 -c -ffunction-sections -fdata-sections -o $@ $<
1502 plugin_test_7.err: plugin_test_7
1504 # Test plugins with -r.
1505 check_PROGRAMS += plugin_test_8
1506 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
1507 ../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
1508 plugin_test_8: plugin_test_8.o gcctestdir/ld
1509 $(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle plugin_test_8.o
1511 # Test that symbols known in the IR file but not in the replacement file
1512 # produce an unresolved symbol error.
1513 check_DATA += plugin_test_9.err
1514 MOSTLYCLEANFILES += plugin_test_9.err
1515 plugin_test_9.err: two_file_test_main.o two_file_test_1c.syms two_file_test_2.syms gcctestdir/ld plugin_test.so
1516 @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>$@"
1517 @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 \
1518 echo 1>&2 "Link of plugin_test_9 should have failed"; \
1522 # Make a .syms file that claims to define the symbol _Z4t16av.
1523 two_file_test_1c.syms: two_file_test_1.syms two_file_test_1c.o
1524 cp two_file_test_1.syms $@.tmp
1525 grep "_Z4t16av" two_file_test_1b.syms >> $@.tmp
1527 # Make a copy of two_file_test_1.o, which does not define the symbol _Z4t16av.
1528 MOSTLYCLEANFILES += two_file_test_1c.o
1529 two_file_test_1c.o: two_file_test_1.o
1530 cp two_file_test_1.o $@
1532 plugin_test.so: plugin_test.o
1533 $(LINK) -Bgcctestdir/ -shared plugin_test.o
1534 plugin_test.o: plugin_test.c
1535 $(COMPILE) -O0 -c -fpic -o $@ $<
1537 two_file_test_main.syms: two_file_test_main.o
1538 $(TEST_READELF) -sW $< >$@ 2>/dev/null
1539 two_file_test_1.syms: two_file_test_1.o
1540 $(TEST_READELF) -sW $< >$@ 2>/dev/null
1541 two_file_test_1b.syms: two_file_test_1b.o
1542 $(TEST_READELF) -sW $< >$@ 2>/dev/null
1543 two_file_test_2.syms: two_file_test_2.o
1544 $(TEST_READELF) -sW $< >$@ 2>/dev/null
1545 plugin_common_test_1.syms: plugin_common_test_1.o
1546 $(TEST_READELF) -sW $< >$@ 2>/dev/null
1547 plugin_common_test_2.syms: plugin_common_test_2.o
1548 $(TEST_READELF) -sW $< >$@ 2>/dev/null
1552 @echo "Symbol table" >>$@
1554 MOSTLYCLEANFILES += unused.c
1555 unused.syms: unused.o
1556 $(TEST_READELF) -sW $< >$@ 2>/dev/null
1557 @echo " 1: 00000000 4 FUNC GLOBAL DEFAULT 1 UNUSED" >>$@
1559 $(COMPILE) -c -o $@ $<
1563 check_SCRIPTS += plugin_final_layout.sh
1564 check_DATA += plugin_final_layout.stdout plugin_final_layout_readelf.stdout
1565 plugin_final_layout.o: plugin_final_layout.cc
1566 $(CXXCOMPILE) -O0 -c -ffunction-sections -fdata-sections -g -o $@ $<
1567 plugin_final_layout: plugin_final_layout.o plugin_section_order.so gcctestdir/ld
1568 $(CXXLINK) -Bgcctestdir/ -Wl,--plugin,"./plugin_section_order.so" plugin_final_layout.o
1569 plugin_final_layout.stdout: plugin_final_layout
1570 $(TEST_NM) -n --synthetic plugin_final_layout > plugin_final_layout.stdout
1571 plugin_final_layout_readelf.stdout: plugin_final_layout
1572 $(TEST_READELF) -Wl plugin_final_layout > plugin_final_layout_readelf.stdout
1574 plugin_section_order.so: plugin_section_order.o
1575 $(LINK) -Bgcctestdir/ -shared plugin_section_order.o
1576 plugin_section_order.o: plugin_section_order.c
1577 $(COMPILE) -O0 -c -fpic -o $@ $<
1581 check_PROGRAMS += exclude_libs_test
1582 check_SCRIPTS += exclude_libs_test.sh
1583 check_DATA += exclude_libs_test.syms
1584 MOSTLYCLEANFILES += exclude_libs_test.syms libexclude_libs_test_1.a \
1585 libexclude_libs_test_2.a alt/libexclude_libs_test_3.a
1586 exclude_libs_test_SOURCES = exclude_libs_test.c
1587 exclude_libs_test_DEPENDENCIES = gcctestdir/ld libexclude_libs_test_1.a \
1588 libexclude_libs_test_2.a alt/libexclude_libs_test_3.a
1589 exclude_libs_test_LDFLAGS = -Bgcctestdir/ -L. -Lalt \
1590 -Wl,--exclude-libs,dummy:libexclude_libs_test_1 \
1591 -Wl,--exclude-libs,libexclude_libs_test_3
1592 exclude_libs_test_LDADD = -lexclude_libs_test_1 -lexclude_libs_test_2 \
1593 alt/libexclude_libs_test_3.a
1594 exclude_libs_test.syms: exclude_libs_test
1595 $(TEST_READELF) -sW $< >$@ 2>/dev/null
1596 libexclude_libs_test_1.a: exclude_libs_test_1.o
1598 libexclude_libs_test_2.a: exclude_libs_test_2.o
1600 alt/libexclude_libs_test_3.a: exclude_libs_test_3.o
1601 test -d alt || mkdir -p alt
1604 check_PROGRAMS += local_labels_test
1605 local_labels_test.o: ver_test_6.c
1606 $(COMPILE) -g -c -Wa,-L -o $@ $<
1607 local_labels_test: local_labels_test.o
1608 $(LINK) -Bgcctestdir/ local_labels_test.o
1610 check_PROGRAMS += discard_locals_test
1611 check_SCRIPTS += discard_locals_test.sh
1612 check_DATA += discard_locals_test.syms \
1613 discard_locals_relocatable_test1.syms \
1614 discard_locals_relocatable_test2.syms
1615 MOSTLYCLEANFILES += discard_locals_test.syms \
1616 discard_locals_relocatable_test1.syms \
1617 discard_locals_relocatable_test2.syms \
1618 discard_locals_relocatable_test1.out \
1619 discard_locals_relocatable_test2.out
1620 discard_locals_test_SOURCES = discard_locals_test.c
1621 discard_locals_test_LDFLAGS = -Bgcctestdir/ -Wl,--discard-locals
1622 discard_locals_test.syms: discard_locals_test
1623 $(TEST_READELF) -sW $< >$@ 2>/dev/null
1624 # '-Wa,-L' is required to preserve the local label used for testing.
1625 discard_locals_test.o: discard_locals_test.c
1626 $(COMPILE) -c -Wa,-L -o $@ $<
1628 discard_locals_relocatable_test1.syms: discard_locals_relocatable_test1.out
1629 $(TEST_READELF) -sW $< >$@ 2>/dev/null
1630 discard_locals_relocatable_test.o: discard_locals_relocatable_test.c
1631 $(COMPILE) -c -Wa,-L -fPIC -o $@ $<
1632 discard_locals_relocatable_test1.out: discard_locals_relocatable_test.o ../ld-new
1633 ../ld-new --discard-locals -relocatable -o $@ $<
1635 discard_locals_relocatable_test2.syms: discard_locals_relocatable_test2.out
1636 $(TEST_READELF) -sW $< >$@ 2>/dev/null
1637 discard_locals_relocatable_test2.out: discard_locals_relocatable_test.o ../ld-new
1638 ../ld-new --discard-all -relocatable -o $@ $<
1641 check_PROGRAMS += large
1642 large_SOURCES = large.c
1643 large_CFLAGS = -mcmodel=medium
1644 large_DEPENDENCIES = gcctestdir/ld
1645 large_LDFLAGS = -Bgcctestdir/
1647 endif MCMODEL_MEDIUM
1649 # Test that hidden and internal symbols in the main program cannot be
1650 # referenced by a shared library.
1651 check_SCRIPTS += hidden_test.sh
1652 check_DATA += hidden_test.err
1653 MOSTLYCLEANFILES += hidden_test hidden_test.err
1654 libhidden.so: hidden_test_1.c gcctestdir/ld
1655 $(COMPILE) -Bgcctestdir/ -g -shared -fPIC -w -o $@ $(srcdir)/hidden_test_1.c
1656 hidden_test: hidden_test_main.o libhidden.so gcctestdir/ld
1657 $(LINK) -Bgcctestdir/ -Wl,-R,. hidden_test_main.o libhidden.so 2>hidden_test.err
1658 hidden_test.err: hidden_test
1659 @touch hidden_test.err
1661 # Test -retain-symbols-file.
1662 check_SCRIPTS += retain_symbols_file_test.sh
1663 check_DATA += retain_symbols_file_test.stdout
1664 MOSTLYCLEANFILES += retain_symbols_file_test retain_symbols_file_test.in \
1665 retain_symbols_file_test.stdout
1666 retain_symbols_file_test.so: basic_pic_test.o gcctestdir/ld
1667 echo 'main' > retain_symbols_file_test.in
1668 echo 't1' >> retain_symbols_file_test.in
1669 echo '_ZN4t16bC1Ev' >> retain_symbols_file_test.in
1670 echo '_ZNK4t20a3getEv' >> retain_symbols_file_test.in
1671 echo '_Z3t18v' >> retain_symbols_file_test.in
1672 echo '__tcf_0' >> retain_symbols_file_test.in
1673 $(CXXLINK) -Bgcctestdir/ -shared -Wl,-retain-symbols-file,retain_symbols_file_test.in basic_pic_test.o
1674 retain_symbols_file_test.stdout: retain_symbols_file_test.so
1675 $(TEST_NM) -C retain_symbols_file_test.so > $@
1678 # Test that if the output file already exists and is empty,
1679 # it will get execute permission.
1680 check_PROGRAMS += permission_test
1681 permission_test: basic_test.o gcctestdir/ld
1686 $(CXXLINK) -Bgcctestdir/ basic_test.o
1689 check_PROGRAMS += searched_file_test
1690 MOSTLYCLEANFILES += searched_file_test searched_file_test_lib.o \
1691 alt/searched_file_test_lib.a
1692 searched_file_test_SOURCES = searched_file_test.cc
1693 searched_file_test_DEPENDENCIES = alt/searched_file_test_lib.a
1694 searched_file_test_LDFLAGS = -Bgcctestdir/ -Lalt
1695 searched_file_test_LDADD = -l:searched_file_test_lib.a
1696 searched_file_test_lib.o: searched_file_test_lib.cc
1697 $(CXXCOMPILE) -c -o $@ $<
1698 alt/searched_file_test_lib.a: searched_file_test_lib.o
1699 test -d alt || mkdir -p alt
1702 # Test that no .gnu.version sections are created when
1703 # symbol versioning is not used.
1704 check_SCRIPTS += no_version_test.sh
1705 check_DATA += no_version_test.stdout
1706 MOSTLYCLEANFILES += libno_version_test.so no_version_test.stdout
1707 # We invoke the linker directly since gcc may include additional objects that
1708 # uses symbol versioning.
1709 libno_version_test.so: no_version_test.o gcctestdir/ld
1710 gcctestdir/ld -shared -o $@ no_version_test.o
1711 no_version_test.o: no_version_test.c
1712 $(COMPILE) -o $@ -c -fPIC $<
1713 no_version_test.stdout: libno_version_test.so
1714 $(TEST_OBJDUMP) -h $< > $@
1716 # Test STT_GNU_IFUNC symbols.
1719 ifuncmod1.o: ifuncmod1.c
1720 $(COMPILE) -c -fPIC -o $@ $<
1721 ifuncmod1.so: ifuncmod1.o gcctestdir/ld
1722 $(LINK) -Bgcctestdir/ -shared ifuncmod1.o
1724 ifuncdep1.o: ifuncmod1.c
1725 $(COMPILE) -c -o $@ $<
1727 ifuncmain1pic.o: ifuncmain1.c
1728 $(COMPILE) -c -fPIC -o $@ $<
1729 ifuncmain1pie.o: ifuncmain1.c
1730 $(COMPILE) -c -fPIE -o $@ $<
1734 check_PROGRAMS += ifuncmain1static
1735 ifuncmain1static_SOURCES = ifuncmain1.c
1736 ifuncmain1static_DEPENDENCIES = gcctestdir/ld ifuncdep1.o
1737 ifuncmain1static_LDFLAGS = -Bgcctestdir/ -static
1738 ifuncmain1static_LDADD = ifuncdep1.o
1740 check_PROGRAMS += ifuncmain1picstatic
1741 ifuncmain1picstatic: ifuncmain1pic.o ifuncmod1.o gcctestdir/ld
1742 $(LINK) -Bgcctestdir/ -static ifuncmain1pic.o ifuncmod1.o
1746 check_PROGRAMS += ifuncmain1
1747 ifuncmain1_SOURCES = ifuncmain1.c
1748 ifuncmain1_DEPENDENCIES = gcctestdir/ld ifuncmod1.so
1749 ifuncmain1_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1750 ifuncmain1_LDADD = ifuncmod1.so
1752 check_PROGRAMS += ifuncmain1pic
1753 ifuncmain1pic: ifuncmain1pic.o ifuncmod1.so gcctestdir/ld
1754 $(LINK) -Bgcctestdir/ ifuncmain1pic.o ifuncmod1.so -Wl,-R,.
1756 check_PROGRAMS += ifuncmain1vis
1757 ifuncmain1vis_SOURCES = ifuncmain1vis.c
1758 ifuncmain1vis_DEPENDENCIES = gcctestdir/ld ifuncmod1.so
1759 ifuncmain1vis_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1760 ifuncmain1vis_LDADD = ifuncmod1.so
1762 check_PROGRAMS += ifuncmain1vispic
1763 ifuncmain1vispic.o: ifuncmain1vis.c
1764 $(COMPILE) -c -fPIC -o $@ $<
1765 ifuncmain1vispic: ifuncmain1vispic.o ifuncmod1.so gcctestdir/ld
1766 $(LINK) -Bgcctestdir/ ifuncmain1pic.o ifuncmod1.so -Wl,-R,.
1768 check_PROGRAMS += ifuncmain1staticpic
1769 ifuncmain1staticpic: ifuncmain1pic.o ifuncmod1.o gcctestdir/ld
1770 $(LINK) -Bgcctestdir/ ifuncmain1pic.o ifuncmod1.o
1772 check_PROGRAMS += ifuncmain1pie
1773 ifuncmain1pie: ifuncmain1pie.o ifuncmod1.so gcctestdir/ld
1774 $(LINK) -Bgcctestdir/ -pie ifuncmain1pie.o ifuncmod1.so -Wl,-R,.
1776 check_PROGRAMS += ifuncmain1vispie
1777 ifuncmain1vispie.o: ifuncmain1vis.c
1778 $(COMPILE) -c -fPIE -o $@ $<
1779 ifuncmain1vispie: ifuncmain1vispie.o ifuncmod1.so gcctestdir/ld
1780 $(LINK) -Bgcctestdir/ -pie ifuncmain1vispie.o ifuncmod1.so -Wl,-R,.
1782 check_PROGRAMS += ifuncmain1staticpie
1783 ifuncmain1staticpie: ifuncmain1pie.o ifuncmod1.o gcctestdir/ld
1784 $(LINK) -Bgcctestdir/ -pie ifuncmain1pie.o ifuncmod1.o
1786 ifuncmain2pic.o: ifuncmain2.c
1787 $(COMPILE) -c -fPIC -o $@ $<
1789 ifuncdep2pic.o: ifuncdep2.c
1790 $(COMPILE) -c -fPIC -o $@ $<
1794 check_PROGRAMS += ifuncmain2static
1795 ifuncmain2static_SOURCES = ifuncmain2.c ifuncdep2.c
1796 ifuncmain2static_DEPENDENCIES = gcctestdir/ld
1797 ifuncmain2static_LDFLAGS = -Bgcctestdir/ -static
1798 ifuncmain2static_LDADD =
1800 check_PROGRAMS += ifuncmain2picstatic
1801 ifuncmain2picstatic: ifuncmain2pic.o ifuncdep2pic.o gcctestdir/ld
1802 $(LINK) -Bgcctestdir/ -static ifuncmain2pic.o ifuncdep2pic.o
1806 check_PROGRAMS += ifuncmain2
1807 ifuncmain2_SOURCES = ifuncmain2.c ifuncdep2.c
1808 ifuncmain2_DEPENDENCIES = gcctestdir/ld
1809 ifuncmain2_LDFLAGS = -Bgcctestdir/
1812 check_PROGRAMS += ifuncmain2pic
1813 ifuncmain2pic: ifuncmain2pic.o ifuncdep2pic.o gcctestdir/ld
1814 $(LINK) -Bgcctestdir/ ifuncmain2pic.o ifuncdep2pic.o
1816 ifuncmod3.o: ifuncmod3.c
1817 $(COMPILE) -c -fPIC -o $@ $<
1818 ifuncmod3.so: ifuncmod3.o gcctestdir/ld
1819 $(LINK) -Bgcctestdir/ -shared ifuncmod3.o
1821 check_PROGRAMS += ifuncmain3
1822 ifuncmain3_SOURCES = ifuncmain3.c
1823 ifuncmain3_DEPENDENCIES = gcctestdir/ld ifuncmod3.so
1824 ifuncmain3_LDFLAGS = -Bgcctestdir/ -Wl,--export-dynamic -Wl,-R,.
1825 ifuncmain3_LDADD = -ldl
1827 ifuncmain4pic.o: ifuncmain4.c
1828 $(COMPILE) -c -fPIC -o $@ $<
1832 check_PROGRAMS += ifuncmain4static
1833 ifuncmain4static_SOURCES = ifuncmain4.c
1834 ifuncmain4static_DEPENDENCIES = gcctestdir/ld
1835 ifuncmain4static_LDFLAGS = -Bgcctestdir/ -static
1836 ifuncmain4static_LDADD =
1838 check_PROGRAMS += ifuncmain4picstatic
1839 ifuncmain4picstatic: ifuncmain4pic.o gcctestdir/ld
1840 $(LINK) -Bgcctestdir/ -static ifuncmain4pic.o
1844 check_PROGRAMS += ifuncmain4
1845 ifuncmain4_SOURCES = ifuncmain4.c
1846 ifuncmain4_DEPENDENCIES = gcctestdir/ld
1847 ifuncmain4_LDFLAGS = -Bgcctestdir/
1850 ifuncmain5pic.o: ifuncmain5.c
1851 $(COMPILE) -c -fPIC -o $@ $<
1853 ifuncmain5pie.o: ifuncmain5.c
1854 $(COMPILE) -c -fPIE -o $@ $<
1856 ifuncmod5.o: ifuncmod5.c
1857 $(COMPILE) -c -fPIC -o $@ $<
1858 ifuncmod5.so: ifuncmod5.o gcctestdir/ld
1859 $(LINK) -Bgcctestdir/ -shared ifuncmod5.o
1861 ifuncdep5.o: ifuncmod5.c
1862 $(COMPILE) -c -o $@ $<
1866 check_PROGRAMS += ifuncmain5static
1867 ifuncmain5static_SOURCES = ifuncmain5.c
1868 ifuncmain5static_DEPENDENCIES = gcctestdir/ld ifuncdep5.o
1869 ifuncmain5static_LDFLAGS = -Bgcctestdir/ -static
1870 ifuncmain5static_LDADD = ifuncdep5.o
1872 check_PROGRAMS += ifuncmain5picstatic
1873 ifuncmain5picstatic: ifuncmain5pic.o ifuncmod5.o gcctestdir/ld
1874 $(LINK) -Bgcctestdir/ -static ifuncmain5pic.o ifuncmod5.o
1878 check_PROGRAMS += ifuncmain5
1879 ifuncmain5_SOURCES = ifuncmain5.c
1880 ifuncmain5_DEPENDENCIES = gcctestdir/ld ifuncmod5.so
1881 ifuncmain5_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1882 ifuncmain5_LDADD = ifuncmod5.so
1884 check_PROGRAMS += ifuncmain5pic
1885 ifuncmain5pic: ifuncmain5pic.o ifuncmod5.so gcctestdir/ld
1886 $(LINK) -Bgcctestdir/ ifuncmain5pic.o ifuncmod5.so -Wl,-R,.
1888 check_PROGRAMS += ifuncmain5staticpic
1889 ifuncmain5staticpic: ifuncmain5pic.o ifuncmod5.o gcctestdir/ld
1890 $(LINK) -Bgcctestdir/ ifuncmain5pic.o ifuncmod5.o
1892 check_PROGRAMS += ifuncmain5pie
1893 ifuncmain5pie: ifuncmain5pie.o ifuncmod5.so gcctestdir/ld
1894 $(LINK) -Bgcctestdir/ -pie ifuncmain5pie.o ifuncmod5.so -Wl,-R,.
1896 ifuncmain6pie.o: ifuncmain6pie.c
1897 $(COMPILE) -c -fPIE -o $@ $<
1899 ifuncmod6.o: ifuncmod6.c
1900 $(COMPILE) -c -fPIC -o $@ $<
1901 ifuncmod6.so: ifuncmod6.o gcctestdir/ld
1902 $(LINK) -Bgcctestdir/ -shared ifuncmod6.o
1904 check_PROGRAMS += ifuncmain6pie
1905 ifuncmain6pie: ifuncmain6pie.o ifuncmod6.so gcctestdir/ld
1906 $(LINK) -Bgcctestdir/ -pie ifuncmain6pie.o ifuncmod6.so -Wl,-R,.
1908 ifuncmain7pic.o: ifuncmain7.c
1909 $(COMPILE) -c -fPIC -o $@ $<
1911 ifuncmain7pie.o: ifuncmain7.c
1912 $(COMPILE) -c -fPIE -o $@ $<
1916 check_PROGRAMS += ifuncmain7static
1917 ifuncmain7static_SOURCES = ifuncmain7.c
1918 ifuncmain7static_DEPENDENCIES = gcctestdir/ld
1919 ifuncmain7static_LDFLAGS = -Bgcctestdir/ -static
1920 ifuncmain7static_LDADD =
1922 check_PROGRAMS += ifuncmain7picstatic
1923 ifuncmain7picstatic: ifuncmain7pic.o gcctestdir/ld
1924 $(LINK) -Bgcctestdir/ -static ifuncmain7pic.o
1928 check_PROGRAMS += ifuncmain7
1929 ifuncmain7_SOURCES = ifuncmain7.c
1930 ifuncmain7_DEPENDENCIES = gcctestdir/ld
1931 ifuncmain7_LDFLAGS = -Bgcctestdir/
1934 check_PROGRAMS += ifuncmain7pic
1935 ifuncmain7pic: ifuncmain7pic.o gcctestdir/ld
1936 $(LINK) -Bgcctestdir/ ifuncmain7pic.o
1938 check_PROGRAMS += ifuncmain7pie
1939 ifuncmain7pie: ifuncmain7pie.o gcctestdir/ld
1940 $(LINK) -Bgcctestdir/ -pie ifuncmain7pie.o
1942 check_PROGRAMS += ifuncvar
1943 ifuncvar1_pic.o: ifuncvar1.c
1944 $(COMPILE) -c -fPIC -o $@ $<
1945 ifuncvar2_pic.o: ifuncvar2.c
1946 $(COMPILE) -c -fPIC -o $@ $<
1947 ifuncvar.so: ifuncvar1_pic.o ifuncvar2_pic.o gcctestdir/ld
1948 $(LINK) -Bgcctestdir/ -shared ifuncvar1_pic.o ifuncvar2_pic.o
1949 ifuncvar_SOURCES = ifuncvar3.c
1950 ifuncvar_DEPENDENCIES = gcctestdir/ld ifuncvar.so
1951 ifuncvar_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1952 ifuncvar_LDADD = ifuncvar.so
1956 # Test that strong reference to a weak symbol in a DSO remains strong.
1957 check_SCRIPTS += strong_ref_weak_def.sh
1958 check_DATA += strong_ref_weak_def.stdout
1959 MOSTLYCLEANFILES += strong_ref_weak_def_1.so strong_ref_weak_def_2.so \
1960 strong_ref_weak_def.stdout
1961 strong_ref_weak_def_2.o: strong_ref_weak_def_2.c
1962 $(COMPILE) -o $@ -c -fPIC $<
1963 strong_ref_weak_def_2.so: strong_ref_weak_def_2.o gcctestdir/ld
1964 gcctestdir/ld -shared -o $@ strong_ref_weak_def_2.o
1965 strong_ref_weak_def_1.o: strong_ref_weak_def_1.c
1966 $(COMPILE) -o $@ -c -fPIC $<
1967 strong_ref_weak_def_1.so: strong_ref_weak_def_1.o strong_ref_weak_def_2.so \
1969 gcctestdir/ld -shared -o $@ strong_ref_weak_def_1.o \
1970 strong_ref_weak_def_2.so
1971 strong_ref_weak_def.stdout: strong_ref_weak_def_1.so
1972 $(TEST_READELF) -sWD $< > $@
1974 # Test that a strong weak reference remains strong if there is another
1975 # weak reference in a DSO.
1976 check_SCRIPTS += dyn_weak_ref.sh
1977 check_DATA += dyn_weak_ref.stdout
1978 MOSTLYCLEANFILES += dyn_weak_ref_1.so dyn_weak_ref_2.so \
1980 dyn_weak_ref_2.o: dyn_weak_ref_2.c
1981 $(COMPILE) -o $@ -c -fPIC $<
1982 dyn_weak_ref_2.so: dyn_weak_ref_2.o gcctestdir/ld
1983 gcctestdir/ld -shared -o $@ dyn_weak_ref_2.o
1984 dyn_weak_ref_1.o: dyn_weak_ref_1.c
1985 $(COMPILE) -o $@ -c -fPIC $<
1986 # We intentionally put dyn_weak_ref_2.so in front of dyn_weak_ref_1.o
1987 # so that the weak ref there goes to gold's symbol table first.
1988 dyn_weak_ref_1.so: dyn_weak_ref_1.o dyn_weak_ref_2.so gcctestdir/ld
1989 gcctestdir/ld -shared -o $@ dyn_weak_ref_2.so dyn_weak_ref_1.o
1990 dyn_weak_ref.stdout: dyn_weak_ref_1.so
1991 $(TEST_READELF) -sWD $< > $@
1994 # Test that --start-lib and --end-lib function correctly.
1995 check_PROGRAMS += start_lib_test
1996 start_lib_test: start_lib_test_main.o libstart_lib_test.a start_lib_test_2.o start_lib_test_3.o \
1998 $(LINK) -Bgcctestdir/ -o $@ start_lib_test_main.o -L. -lstart_lib_test \
1999 -Wl,--start-lib start_lib_test_2.o start_lib_test_3.o -Wl,--end-lib
2000 libstart_lib_test.a: start_lib_test_1.o
2003 # Test that MEMORY region support works.
2004 check_SCRIPTS += memory_test.sh
2005 check_DATA += memory_test.stdout
2006 MOSTLYCLEANFILES += memory_test.stdout memory_test memory_test.o
2007 memory_test.o: memory_test.s
2008 $(COMPILE) -o $@ -c $<
2009 memory_test: memory_test.o gcctestdir/ld $(srcdir)/memory_test.t
2010 $(LINK) -Bgcctestdir/ -nostartfiles -nostdlib -z max-page-size=0x1000 -z common-page-size=0x1000 -T $(srcdir)/memory_test.t -o $@ memory_test.o
2011 memory_test.stdout: memory_test
2012 $(TEST_READELF) -lWS $< > $@
2016 # Test that --gdb-index functions correctly without gcc-generated pubnames.
2017 check_SCRIPTS += gdb_index_test_1.sh
2018 check_DATA += gdb_index_test_1.stdout
2019 MOSTLYCLEANFILES += gdb_index_test_1.stdout gdb_index_test_1
2020 gdb_index_test.o: gdb_index_test.cc
2021 $(CXXCOMPILE) -O0 -g -gno-pubnames -c -o $@ $<
2022 gdb_index_test_1: gdb_index_test.o gcctestdir/ld
2023 $(CXXLINK) -Bgcctestdir/ -Wl,--gdb-index $<
2024 gdb_index_test_1.stdout: gdb_index_test_1
2025 $(TEST_READELF) --debug-dump=gdb_index $< > $@
2029 # Test that --gdb-index functions correctly with compressed debug sections.
2030 check_SCRIPTS += gdb_index_test_2.sh
2031 check_DATA += gdb_index_test_2.stdout
2032 MOSTLYCLEANFILES += gdb_index_test_2.stdout gdb_index_test_2
2033 gdb_index_test_cdebug.o: gdb_index_test.cc
2034 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -Wa,--compress-debug-sections -c -o $@ $<
2035 gdb_index_test_2: gdb_index_test_cdebug.o gcctestdir/ld
2036 $(CXXLINK) -Bgcctestdir/ -Wl,--gdb-index $<
2037 gdb_index_test_2.stdout: gdb_index_test_2
2038 $(TEST_READELF) --debug-dump=gdb_index $< > $@
2042 # Another simple C test (DW_AT_high_pc encoding) for --gdb-index.
2043 check_SCRIPTS += gdb_index_test_3.sh
2044 check_DATA += gdb_index_test_3.stdout
2045 MOSTLYCLEANFILES += gdb_index_test_3.stdout gdb_index_test_3
2046 gdb_index_test_3.o: gdb_index_test_3.c
2047 $(COMPILE) -O0 -g -c -o $@ $<
2048 gdb_index_test_3: gdb_index_test_3.o gcctestdir/ld
2049 $(LINK) -Bgcctestdir/ -Wl,--gdb-index,--fatal-warnings $<
2050 gdb_index_test_3.stdout: gdb_index_test_3
2051 $(TEST_READELF) --debug-dump=gdb_index $< > $@
2053 # Test that --gdb-index functions correctly with gcc-generated pubnames.
2054 check_SCRIPTS += gdb_index_test_4.sh
2055 check_DATA += gdb_index_test_4.stdout
2056 MOSTLYCLEANFILES += gdb_index_test_4.stdout gdb_index_test_4
2057 gdb_index_test_pub.o: gdb_index_test.cc
2058 $(CXXCOMPILE) -O0 -g -gpubnames -c -o $@ $<
2059 gdb_index_test_4: gdb_index_test_pub.o gcctestdir/ld
2060 $(CXXLINK) -Bgcctestdir/ -Wl,--gdb-index $<
2061 gdb_index_test_4.stdout: gdb_index_test_4
2062 $(TEST_READELF) --debug-dump=gdb_index $< > $@
2066 # End-to-end incremental linking tests.
2067 # Incremental linking is currently supported only on the x86_64 target.
2069 if DEFAULT_TARGET_X86_64
2071 two_file_test_1_v1_ndebug.o: two_file_test_1_v1.cc
2072 $(CXXCOMPILE) -O0 -g0 -c -o $@ $<
2073 two_file_test_1_ndebug.o: two_file_test_1.cc
2074 $(CXXCOMPILE) -O0 -g0 -c -o $@ $<
2075 two_file_test_1b_ndebug.o: two_file_test_1b.cc
2076 $(CXXCOMPILE) -O0 -g0 -c -o $@ $<
2077 two_file_test_2_ndebug.o: two_file_test_2.cc
2078 $(CXXCOMPILE) -O0 -g0 -c -o $@ $<
2079 two_file_test_main_ndebug.o: two_file_test_main.cc
2080 $(CXXCOMPILE) -O0 -g0 -c -o $@ $<
2082 check_PROGRAMS += incremental_test_2
2083 MOSTLYCLEANFILES += two_file_test_tmp_2.o
2084 incremental_test_2: two_file_test_1_v1_ndebug.o two_file_test_1_ndebug.o two_file_test_1b_ndebug.o \
2085 two_file_test_2_ndebug.o two_file_test_main_ndebug.o gcctestdir/ld
2086 cp -f two_file_test_1_v1_ndebug.o two_file_test_tmp_2.o
2087 $(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
2089 cp -f two_file_test_1_ndebug.o two_file_test_tmp_2.o
2090 $(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
2092 check_PROGRAMS += incremental_test_3
2093 MOSTLYCLEANFILES += two_file_test_tmp_3.o
2094 incremental_test_3: two_file_test_1.o two_file_test_1b_v1.o two_file_test_1b.o \
2095 two_file_test_2.o two_file_test_main.o gcctestdir/ld
2096 cp -f two_file_test_1b_v1.o two_file_test_tmp_3.o
2097 $(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
2099 cp -f two_file_test_1b.o two_file_test_tmp_3.o
2100 $(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
2102 check_PROGRAMS += incremental_test_4
2103 MOSTLYCLEANFILES += incremental_test_4.base two_file_test_tmp_4.o
2104 incremental_test_4: two_file_test_1.o two_file_test_1b.o two_file_test_2_v1.o \
2105 two_file_test_2.o two_file_test_main.o gcctestdir/ld
2106 cp -f two_file_test_2_v1.o two_file_test_tmp_4.o
2107 $(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
2108 mv -f incremental_test_4 incremental_test_4.base
2110 cp -f two_file_test_2.o two_file_test_tmp_4.o
2111 $(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
2113 check_PROGRAMS += incremental_test_5
2114 MOSTLYCLEANFILES += two_file_test_5.a
2115 incremental_test_5: two_file_test_1.o two_file_test_1b_v1.o two_file_test_1b.o \
2116 two_file_test_2.o two_file_test_main.o gcctestdir/ld
2117 cp -f two_file_test_1b_v1.o two_file_test_tmp_5.o
2118 $(TEST_AR) rc two_file_test_5.a two_file_test_1.o two_file_test_tmp_5.o two_file_test_2.o
2119 $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Bgcctestdir/ two_file_test_main.o two_file_test_5.a
2121 cp -f two_file_test_1b.o two_file_test_tmp_5.o
2122 $(TEST_AR) rc two_file_test_5.a two_file_test_1.o two_file_test_tmp_5.o two_file_test_2.o
2123 $(CXXLINK) -Wl,--incremental-update -Bgcctestdir/ two_file_test_main.o two_file_test_5.a
2125 # Test the --incremental-unchanged flag with an archive library.
2126 # The second link should not update the library.
2127 check_PROGRAMS += incremental_test_6
2128 MOSTLYCLEANFILES += two_file_test_6.a
2129 incremental_test_6: two_file_test_1.o two_file_test_1b_v1.o two_file_test_1b.o \
2130 two_file_test_2.o two_file_test_main.o gcctestdir/ld
2131 cp -f two_file_test_1b.o two_file_test_tmp_6.o
2132 $(TEST_AR) rc two_file_test_6.a two_file_test_1.o two_file_test_tmp_6.o two_file_test_2.o
2133 $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Bgcctestdir/ two_file_test_main.o two_file_test_6.a
2135 cp -f two_file_test_1b_v1.o two_file_test_tmp_6.o
2136 $(TEST_AR) rc two_file_test_6.a two_file_test_1.o two_file_test_tmp_6.o two_file_test_2.o
2137 $(CXXLINK) -Wl,--incremental-update -Bgcctestdir/ two_file_test_main.o -Wl,--incremental-unchanged two_file_test_6.a -Wl,--incremental-unknown
2139 check_PROGRAMS += incremental_copy_test
2140 incremental_copy_test: copy_test_v1.o copy_test.o copy_test_1.so copy_test_2.so
2141 cp -f copy_test_v1.o copy_test_tmp.o
2142 $(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
2144 cp -f copy_test.o copy_test_tmp.o
2145 $(CXXLINK) -Wl,--incremental-update -Bgcctestdir/ -Wl,-R,. -Wl,--no-as-needed copy_test_tmp.o copy_test_1.so copy_test_2.so
2147 check_PROGRAMS += incremental_common_test_1
2148 incremental_common_test_1: common_test_1_v1.o common_test_1_v2.o gcctestdir/ld
2149 cp -f common_test_1_v1.o common_test_1_tmp.o
2150 $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Bgcctestdir/ common_test_1_tmp.o
2152 cp -f common_test_1_v2.o common_test_1_tmp.o
2153 $(CXXLINK) -Wl,--incremental-update -Bgcctestdir/ common_test_1_tmp.o
2155 check_PROGRAMS += incremental_comdat_test_1
2156 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
2157 cp -f incr_comdat_test_2_v1.o incr_comdat_test_1_tmp.o
2158 $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Bgcctestdir/ incr_comdat_test_1.o incr_comdat_test_1_tmp.o
2160 cp -f incr_comdat_test_2_v2.o incr_comdat_test_1_tmp.o
2161 $(CXXLINK) -Wl,--incremental-update -Bgcctestdir/ incr_comdat_test_1.o incr_comdat_test_1_tmp.o
2163 cp -f incr_comdat_test_2_v3.o incr_comdat_test_1_tmp.o
2164 $(CXXLINK) -Wl,--incremental-update -Bgcctestdir/ incr_comdat_test_1.o incr_comdat_test_1_tmp.o
2166 endif DEFAULT_TARGET_X86_64
2171 # These tests work with native and cross linkers.
2173 if NATIVE_OR_CROSS_LINKER
2175 # Test script section order.
2176 check_SCRIPTS += script_test_10.sh
2177 check_DATA += script_test_10.stdout
2178 script_test_10.o: script_test_10.s
2180 script_test_10: $(srcdir)/script_test_10.t script_test_10.o gcctestdir/ld
2181 gcctestdir/ld -o $@ script_test_10.o -T $(srcdir)/script_test_10.t
2182 script_test_10.stdout: script_test_10
2183 $(TEST_READELF) -SW script_test_10 > $@
2185 # These tests work with cross linkers only.
2187 if DEFAULT_TARGET_I386
2189 check_SCRIPTS += split_i386.sh
2190 check_DATA += split_i386_1.stdout split_i386_2.stdout \
2191 split_i386_3.stdout split_i386_4.stdout split_i386_r.stdout
2192 SPLIT_DEFSYMS = --defsym __morestack=0x100 --defsym __morestack_non_split=0x200
2193 split_i386_1.o: split_i386_1.s
2195 split_i386_2.o: split_i386_2.s
2197 split_i386_3.o: split_i386_3.s
2199 split_i386_4.o: split_i386_4.s
2201 split_i386_n.o: split_i386_n.s
2203 split_i386_1: split_i386_1.o split_i386_n.o ../ld-new
2204 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_i386_1.o split_i386_n.o
2205 split_i386_1.stdout: split_i386_1
2206 $(TEST_OBJDUMP) -d $< > $@
2207 split_i386_2: split_i386_2.o split_i386_n.o ../ld-new
2208 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_i386_2.o split_i386_n.o
2209 split_i386_2.stdout: split_i386_2
2210 $(TEST_OBJDUMP) -d $< > $@
2211 split_i386_3.stdout: split_i386_3.o split_i386_n.o ../ld-new
2212 ../ld-new $(SPLIT_DEFSYMS) -o split_i386_3 split_i386_3.o split_i386_n.o > $@ 2>&1 || exit 0
2213 split_i386_4: split_i386_4.o split_i386_n.o ../ld-new
2214 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_i386_4.o split_i386_n.o
2215 split_i386_4.stdout: split_i386_4
2216 $(TEST_OBJDUMP) -d $< > $@
2217 split_i386_r.stdout: split_i386_1.o split_i386_n.o ../ld-new
2218 ../ld-new -r split_i386_1.o split_i386_n.o -o split_i386_r > $@ 2>&1 || exit 0
2219 MOSTLYCLEANFILES += split_i386_1 split_i386_2 split_i386_3 \
2220 split_i386_4 split_i386_r
2222 endif DEFAULT_TARGET_I386
2224 if DEFAULT_TARGET_X86_64
2226 check_SCRIPTS += split_x86_64.sh
2227 check_DATA += split_x86_64_1.stdout split_x86_64_2.stdout \
2228 split_x86_64_3.stdout split_x86_64_4.stdout split_x86_64_r.stdout
2229 SPLIT_DEFSYMS = --defsym __morestack=0x100 --defsym __morestack_non_split=0x200
2230 split_x86_64_1.o: split_x86_64_1.s
2232 split_x86_64_2.o: split_x86_64_2.s
2234 split_x86_64_3.o: split_x86_64_3.s
2236 split_x86_64_4.o: split_x86_64_4.s
2238 split_x86_64_n.o: split_x86_64_n.s
2240 split_x86_64_1: split_x86_64_1.o split_x86_64_n.o ../ld-new
2241 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x86_64_1.o split_x86_64_n.o
2242 split_x86_64_1.stdout: split_x86_64_1
2243 $(TEST_OBJDUMP) -d $< > $@
2244 split_x86_64_2: split_x86_64_2.o split_x86_64_n.o ../ld-new
2245 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x86_64_2.o split_x86_64_n.o
2246 split_x86_64_2.stdout: split_x86_64_2
2247 $(TEST_OBJDUMP) -d $< > $@
2248 split_x86_64_3.stdout: split_x86_64_3.o split_x86_64_n.o ../ld-new
2249 ../ld-new $(SPLIT_DEFSYMS) -o split_x86_64_3 split_x86_64_3.o split_x86_64_n.o > $@ 2>&1 || exit 0
2250 split_x86_64_4: split_x86_64_4.o split_x86_64_n.o ../ld-new
2251 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x86_64_4.o split_x86_64_n.o
2252 split_x86_64_4.stdout: split_x86_64_4
2253 $(TEST_OBJDUMP) -d $< > $@
2254 split_x86_64_r.stdout: split_x86_64_1.o split_x86_64_n.o ../ld-new
2255 ../ld-new -r split_x86_64_1.o split_x86_64_n.o -o split_x86_64_r > $@ 2>&1 || exit 0
2256 MOSTLYCLEANFILES += split_x86_64_1 split_x86_64_2 split_x86_64_3 \
2257 split_x86_64_4 split_x86_64_r
2259 endif DEFAULT_TARGET_X86_64
2261 if DEFAULT_TARGET_ARM
2263 check_SCRIPTS += arm_abs_global.sh
2264 check_DATA += arm_abs_global.stdout
2265 arm_abs_lib.o: arm_abs_lib.s
2266 $(TEST_AS) -march=armv7-a -o $@ $<
2267 libarm_abs.so: arm_abs_lib.o ../ld-new
2268 ../ld-new -shared -o $@ arm_abs_lib.o
2269 arm_abs_global.o: arm_abs_global.s
2270 $(TEST_AS) -march=armv7-a -o $@ $<
2271 arm_abs_global: arm_abs_global.o libarm_abs.so ../ld-new
2272 ../ld-new -o $@ arm_abs_global.o -L. -larm_abs
2273 arm_abs_global.stdout: arm_abs_global
2274 $(TEST_READELF) -r $< > $@
2276 MOSTLYCLEANFILES += arm_abs_global
2278 check_SCRIPTS += arm_branch_in_range.sh arm_branch_out_of_range.sh
2279 check_DATA += arm_bl_in_range.stdout arm_bl_out_of_range.stdout \
2280 thumb_bl_in_range.stdout thumb_bl_out_of_range.stdout \
2281 thumb2_bl_in_range.stdout thumb2_bl_out_of_range.stdout \
2282 thumb_blx_in_range.stdout thumb_blx_out_of_range.stdout \
2283 thumb2_blx_in_range.stdout thumb2_blx_out_of_range.stdout \
2284 thumb_bl_out_of_range_local.stdout arm_thm_jump11.stdout \
2285 arm_thm_jump8.stdout
2287 arm_bl_in_range.stdout: arm_bl_in_range
2288 $(TEST_OBJDUMP) -D $< > $@
2290 arm_bl_in_range: arm_bl_in_range.o ../ld-new
2291 ../ld-new -T $(srcdir)/arm_branch_range.t -o $@ $<
2293 arm_bl_in_range.o: arm_bl_in_range.s
2296 arm_bl_out_of_range.stdout: arm_bl_out_of_range
2297 $(TEST_OBJDUMP) -S $< > $@
2299 arm_bl_out_of_range: arm_bl_out_of_range.o ../ld-new
2300 ../ld-new -T $(srcdir)/arm_branch_range.t -o $@ $<
2302 arm_bl_out_of_range.o: arm_bl_out_of_range.s
2305 thumb_bl_in_range.stdout: thumb_bl_in_range
2306 $(TEST_OBJDUMP) -D $< > $@
2308 thumb_bl_in_range: thumb_bl_in_range.o ../ld-new
2309 ../ld-new --no-fix-arm1176 -T $(srcdir)/thumb_branch_range.t -o $@ $<
2311 thumb_bl_in_range.o: thumb_bl_in_range.s
2312 $(TEST_AS) -o $@ -march=armv5te $<
2314 thumb_bl_out_of_range.stdout: thumb_bl_out_of_range
2315 $(TEST_OBJDUMP) -D $< > $@
2317 thumb_bl_out_of_range: thumb_bl_out_of_range.o ../ld-new
2318 ../ld-new --no-fix-arm1176 -T $(srcdir)/thumb_branch_range.t -o $@ $<
2320 thumb_bl_out_of_range.o: thumb_bl_out_of_range.s
2321 $(TEST_AS) -o $@ -march=armv5te $<
2323 thumb2_bl_in_range.stdout: thumb2_bl_in_range
2324 $(TEST_OBJDUMP) -D $< > $@
2326 thumb2_bl_in_range: thumb2_bl_in_range.o ../ld-new
2327 ../ld-new -T $(srcdir)/thumb2_branch_range.t -o $@ $<
2329 thumb2_bl_in_range.o: thumb_bl_in_range.s
2330 $(TEST_AS) -o $@ -march=armv7-a $<
2332 thumb2_bl_out_of_range.stdout: thumb2_bl_out_of_range
2333 $(TEST_OBJDUMP) -D $< > $@
2335 thumb2_bl_out_of_range: thumb2_bl_out_of_range.o ../ld-new
2336 ../ld-new -T $(srcdir)/thumb2_branch_range.t -o $@ $<
2338 thumb2_bl_out_of_range.o: thumb_bl_out_of_range.s
2339 $(TEST_AS) -o $@ -march=armv7-a $<
2341 thumb_blx_in_range.stdout: thumb_blx_in_range
2342 $(TEST_OBJDUMP) -D $< > $@
2344 thumb_blx_in_range: thumb_blx_in_range.o ../ld-new
2345 ../ld-new --no-fix-arm1176 -T $(srcdir)/thumb_branch_range.t -o $@ $<
2347 thumb_blx_in_range.o: thumb_blx_in_range.s
2348 $(TEST_AS) -o $@ -march=armv5te $<
2350 thumb_blx_out_of_range.stdout: thumb_blx_out_of_range
2351 $(TEST_OBJDUMP) -D $< > $@
2353 thumb_blx_out_of_range: thumb_blx_out_of_range.o ../ld-new
2354 ../ld-new --no-fix-arm1176 -T $(srcdir)/thumb_branch_range.t -o $@ $<
2356 thumb_blx_out_of_range.o: thumb_blx_out_of_range.s
2357 $(TEST_AS) -o $@ -march=armv5te $<
2359 thumb2_blx_in_range.stdout: thumb2_blx_in_range
2360 $(TEST_OBJDUMP) -D $< > $@
2362 thumb2_blx_in_range: thumb2_blx_in_range.o ../ld-new
2363 ../ld-new -T $(srcdir)/thumb2_branch_range.t -o $@ $<
2365 thumb2_blx_in_range.o: thumb_blx_in_range.s
2366 $(TEST_AS) -o $@ -march=armv7-a $<
2368 thumb2_blx_out_of_range.stdout: thumb2_blx_out_of_range
2369 $(TEST_OBJDUMP) -D $< > $@
2371 thumb2_blx_out_of_range: thumb2_blx_out_of_range.o ../ld-new
2372 ../ld-new -T $(srcdir)/thumb2_branch_range.t -o $@ $<
2374 thumb2_blx_out_of_range.o: thumb_blx_out_of_range.s
2375 $(TEST_AS) -o $@ -march=armv7-a $<
2377 thumb_bl_out_of_range_local.stdout: thumb_bl_out_of_range_local
2378 $(TEST_OBJDUMP) -D $< > $@
2380 thumb_bl_out_of_range_local: thumb_bl_out_of_range_local.o ../ld-new
2381 ../ld-new --no-fix-arm1176 -T $(srcdir)/thumb_branch_range.t -o $@ $<
2383 thumb_bl_out_of_range_local.o: thumb_bl_out_of_range_local.s
2384 $(TEST_AS) -o $@ -march=armv5te $<
2386 arm_thm_jump11.stdout: arm_thm_jump11
2387 $(TEST_OBJDUMP) -D $< > $@
2389 arm_thm_jump11: arm_thm_jump11.o ../ld-new
2390 ../ld-new -T $(srcdir)/arm_thm_jump11.t -o $@ $<
2392 arm_thm_jump11.o: arm_thm_jump11.s
2395 arm_thm_jump8.stdout: arm_thm_jump8
2396 $(TEST_OBJDUMP) -D $< > $@
2398 arm_thm_jump8: arm_thm_jump8.o ../ld-new
2399 ../ld-new -T $(srcdir)/arm_thm_jump8.t -o $@ $<
2401 arm_thm_jump8.o: arm_thm_jump8.s
2404 MOSTLYCLEANFILES += arm_bl_in_range arm_bl_out_of_range thumb_bl_in_range \
2405 thumb_bl_out_of_range thumb2_bl_in_range thumb2_bl_out_of_range \
2406 thumb_blx_in_range thumb_blx_out_of_range thumb2_blx_in_range \
2407 thumb2_blx_out_of_range thumb_bl_out_of_range_local arm_thm_jump11 \
2410 check_SCRIPTS += arm_fix_v4bx.sh
2411 check_DATA += arm_fix_v4bx.stdout arm_fix_v4bx_interworking.stdout \
2412 arm_no_fix_v4bx.stdout
2414 arm_fix_v4bx.stdout: arm_fix_v4bx
2415 $(TEST_OBJDUMP) -D -j.text $< > $@
2417 arm_fix_v4bx: arm_fix_v4bx.o ../ld-new
2418 ../ld-new --no-fix-arm1176 --fix-v4bx -o $@ $<
2420 arm_fix_v4bx.o: arm_fix_v4bx.s
2423 arm_fix_v4bx_interworking.stdout: arm_fix_v4bx_interworking
2424 $(TEST_OBJDUMP) -D -j.text $< > $@
2426 arm_fix_v4bx_interworking: arm_fix_v4bx.o ../ld-new
2427 ../ld-new --no-fix-arm1176 --fix-v4bx-interworking -o $@ $<
2429 arm_no_fix_v4bx.stdout: arm_no_fix_v4bx
2430 $(TEST_OBJDUMP) -D -j.text $< > $@
2432 arm_no_fix_v4bx: arm_fix_v4bx.o ../ld-new
2433 ../ld-new --no-fix-arm1176 -o $@ $<
2435 MOSTLYCLEANFILES += arm_fix_v4bx arm_fix_v4bx_interworking arm_no_fix_v4bx
2437 check_SCRIPTS += arm_attr_merge.sh
2438 check_DATA += arm_attr_merge_6.stdout arm_attr_merge_6r.stdout \
2439 arm_attr_merge_7.stdout
2441 arm_attr_merge_6.stdout: arm_attr_merge_6
2442 $(TEST_READELF) -A $< > $@
2444 arm_attr_merge_6: arm_attr_merge_6a.o arm_attr_merge_6b.o
2445 ../ld-new -o $@ arm_attr_merge_6a.o arm_attr_merge_6b.o
2447 arm_attr_merge_6a.o: arm_attr_merge_6a.s
2450 arm_attr_merge_6b.o: arm_attr_merge_6b.s
2453 arm_attr_merge_6r.stdout: arm_attr_merge_6r
2454 $(TEST_READELF) -A $< > $@
2456 arm_attr_merge_6r: arm_attr_merge_6b.o arm_attr_merge_6a.o
2457 ../ld-new -o $@ arm_attr_merge_6b.o arm_attr_merge_6a.o
2459 arm_attr_merge_7.stdout: arm_attr_merge_7
2460 $(TEST_READELF) -A $< > $@
2462 arm_attr_merge_7: arm_attr_merge_7a.o arm_attr_merge_7b.o
2463 ../ld-new -o $@ arm_attr_merge_7a.o arm_attr_merge_7b.o
2465 arm_attr_merge_7a.o: arm_attr_merge_7a.s
2468 arm_attr_merge_7b.o: arm_attr_merge_7b.s
2471 MOSTLYCLEANFILES += arm_attr_merge_6 arm_attr_merge_6r arm_attr_merge_7
2473 # ARM1176 workaround test.
2474 check_SCRIPTS += arm_fix_1176.sh
2475 check_DATA += arm_fix_1176_default_v6z.stdout arm_fix_1176_on_v6z.stdout \
2476 arm_fix_1176_off_v6z.stdout arm_fix_1176_default_v5te.stdout \
2477 arm_fix_1176_default_v7a.stdout arm_fix_1176_default_1156t2f_s.stdout
2479 arm_fix_1176_default_v6z.stdout: arm_fix_1176_default_v6z
2480 $(TEST_OBJDUMP) -D -j.foo $< > $@
2482 arm_fix_1176_default_v6z: arm_fix_1176_default_v6z.o ../ld-new
2483 ../ld-new --section-start=.foo=0x2001014 -o $@ $<
2485 arm_fix_1176_default_v6z.o: arm_fix_1176.s
2486 $(TEST_AS) -march=armv6z -o $@ $<
2488 arm_fix_1176_on_v6z.stdout: arm_fix_1176_on_v6z
2489 $(TEST_OBJDUMP) -D -j.foo $< > $@
2491 arm_fix_1176_on_v6z: arm_fix_1176_on_v6z.o ../ld-new
2492 ../ld-new --section-start=.foo=0x2001014 --fix-arm1176 -o $@ $<
2494 arm_fix_1176_on_v6z.o: arm_fix_1176.s
2495 $(TEST_AS) -march=armv6z -o $@ $<
2497 arm_fix_1176_off_v6z.stdout: arm_fix_1176_off_v6z
2498 $(TEST_OBJDUMP) -D -j.foo $< > $@
2500 arm_fix_1176_off_v6z: arm_fix_1176_off_v6z.o ../ld-new
2501 ../ld-new --section-start=.foo=0x2001014 --no-fix-arm1176 -o $@ $<
2503 arm_fix_1176_off_v6z.o: arm_fix_1176.s
2504 $(TEST_AS) -march=armv6z -o $@ $<
2506 arm_fix_1176_default_v5te.stdout: arm_fix_1176_default_v5te
2507 $(TEST_OBJDUMP) -D -j.foo $< > $@
2509 arm_fix_1176_default_v5te: arm_fix_1176_default_v5te.o ../ld-new
2510 ../ld-new --section-start=.foo=0x2001014 -o $@ $<
2512 arm_fix_1176_default_v5te.o: arm_fix_1176.s
2513 $(TEST_AS) -march=armv5te -o $@ $<
2515 arm_fix_1176_default_v7a.stdout: arm_fix_1176_default_v7a
2516 $(TEST_OBJDUMP) -D -j.foo $< > $@
2518 arm_fix_1176_default_v7a: arm_fix_1176_default_v7a.o ../ld-new
2519 ../ld-new --section-start=.foo=0x2001014 -o $@ $<
2521 arm_fix_1176_default_v7a.o: arm_fix_1176.s
2522 $(TEST_AS) -march=armv7-a -o $@ $<
2524 arm_fix_1176_default_1156t2f_s.stdout: arm_fix_1176_default_1156t2f_s
2525 $(TEST_OBJDUMP) -D -j.foo $< > $@
2527 arm_fix_1176_default_1156t2f_s: arm_fix_1176_default_1156t2f_s.o ../ld-new
2528 ../ld-new --section-start=.foo=0x2001014 -o $@ $<
2530 arm_fix_1176_default_1156t2f_s.o: arm_fix_1176.s
2531 $(TEST_AS) -mcpu=arm1156t2f-s -o $@ $<
2533 MOSTLYCLEANFILES += arm_fix_1176_default_v6z arm_fix_1176_on_v6z arm_fix_1176_off_v6z \
2534 arm_fix_1176_default_v5te arm_fix_1176_default_v7a arm_fix_1176_default_1156t2f_s
2536 # Cortex-A8 workaround test.
2538 check_SCRIPTS += arm_cortex_a8.sh
2539 check_DATA += arm_cortex_a8_b_cond.stdout arm_cortex_a8_b.stdout \
2540 arm_cortex_a8_bl.stdout arm_cortex_a8_blx.stdout \
2541 arm_cortex_a8_local.stdout arm_cortex_a8_local_reloc.stdout
2543 arm_cortex_a8_b_cond.stdout: arm_cortex_a8_b_cond
2544 $(TEST_OBJDUMP) -D -j.text $< > $@
2546 arm_cortex_a8_b_cond: arm_cortex_a8_b_cond.o ../ld-new
2549 arm_cortex_a8_b_cond.o: arm_cortex_a8_b_cond.s
2552 arm_cortex_a8_b.stdout: arm_cortex_a8_b
2553 $(TEST_OBJDUMP) -D -j.text $< > $@
2555 arm_cortex_a8_b: arm_cortex_a8_b.o ../ld-new
2556 ../ld-new --fix-cortex-a8 -o $@ $<
2558 arm_cortex_a8_b.o: arm_cortex_a8_b.s
2561 arm_cortex_a8_bl.stdout: arm_cortex_a8_bl
2562 $(TEST_OBJDUMP) -D -j.text $< > $@
2564 arm_cortex_a8_bl: arm_cortex_a8_bl.o ../ld-new
2567 arm_cortex_a8_bl.o: arm_cortex_a8_bl.s
2570 arm_cortex_a8_blx.stdout: arm_cortex_a8_blx
2571 $(TEST_OBJDUMP) -D -j.text $< > $@
2573 arm_cortex_a8_blx: arm_cortex_a8_blx.o ../ld-new
2576 arm_cortex_a8_blx.o: arm_cortex_a8_blx.s
2579 arm_cortex_a8_local.stdout: arm_cortex_a8_local
2580 $(TEST_OBJDUMP) -D -j.text $< > $@
2582 arm_cortex_a8_local: arm_cortex_a8_local.o ../ld-new
2585 arm_cortex_a8_local.o: arm_cortex_a8_local.s
2588 arm_cortex_a8_local_reloc.stdout: arm_cortex_a8_local_reloc
2589 $(TEST_OBJDUMP) -D -j.text $< > $@
2591 arm_cortex_a8_local_reloc: arm_cortex_a8_local_reloc.o ../ld-new
2594 arm_cortex_a8_local_reloc.o: arm_cortex_a8_local_reloc.s
2597 MOSTLYCLEANFILES += arm_cortex_a8_b_cond arm_cortex_a8_b arm_cortex_a8_bl \
2598 arm_cortex_a8_blx arm_cortex_a8_local arm_cortex_a8_local_reloc
2600 check_SCRIPTS += arm_exidx_test.sh
2601 check_DATA += arm_exidx_test.stdout
2603 arm_exidx_test.stdout: arm_exidx_test.so
2604 $(TEST_READELF) -Sr $< > $@
2606 arm_exidx_test.so: arm_exidx_test.o ../ld-new
2607 ../ld-new -shared -o $@ $<
2609 arm_exidx_test.o: arm_exidx_test.s
2612 check_SCRIPTS += pr12826.sh
2613 check_DATA += pr12826.stdout
2615 pr12826.stdout: pr12826.so
2616 $(TEST_READELF) -A $< > $@
2618 pr12826.so: pr12826_1.o pr12826_2.o ../ld-new
2619 ../ld-new -shared -o $@ $<
2621 pr12826_1.o: pr12826_1.s
2624 pr12826_2.o: pr12826_2.s
2627 check_SCRIPTS += arm_unaligned_reloc.sh
2628 check_DATA += arm_unaligned_reloc.stdout arm_unaligned_reloc_r.stdout
2630 arm_unaligned_reloc.stdout: arm_unaligned_reloc
2631 $(TEST_OBJDUMP) -D $< > $@
2633 arm_unaligned_reloc_r.stdout: arm_unaligned_reloc_r
2634 $(TEST_OBJDUMP) -Dr $< > $@
2636 arm_unaligned_reloc: arm_unaligned_reloc.o ../ld-new
2639 arm_unaligned_reloc_r: arm_unaligned_reloc.o ../ld-new
2640 ../ld-new -r -o $@ $<
2642 arm_unaligned_reloc.o: arm_unaligned_reloc.s
2645 MOSTLYCLEANFILES += arm_unaligned_reloc arm_unaligned_reloc_r
2647 # Check ARM to ARM farcall veneers
2649 check_SCRIPTS += arm_farcall_arm_arm.sh
2650 check_DATA += arm_farcall_arm_arm.stdout
2652 arm_farcall_arm_arm.stdout: arm_farcall_arm_arm
2653 $(TEST_OBJDUMP) -d $< > $@
2655 arm_farcall_arm_arm: arm_farcall_arm_arm.o ../ld-new
2656 ../ld-new --no-fix-arm1176 --section-start .text=0x1000 --section-start .foo=0x2001020 -o $@ $<
2658 arm_farcall_arm_arm.o: arm_farcall_arm_arm.s
2661 MOSTLYCLEANFILES += arm_farcall_arm_arm
2663 # Check ARM to Thumb farcall veneers
2665 check_SCRIPTS += arm_farcall_arm_thumb.sh
2666 check_DATA += arm_farcall_arm_thumb.stdout arm_farcall_arm_thumb_5t.stdout
2668 arm_farcall_arm_thumb.stdout: arm_farcall_arm_thumb
2669 $(TEST_OBJDUMP) -D $< > $@
2671 arm_farcall_arm_thumb: arm_farcall_arm_thumb.o ../ld-new
2672 ../ld-new --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
2674 arm_farcall_arm_thumb.o: arm_farcall_arm_thumb.s
2677 arm_farcall_arm_thumb_5t.stdout: arm_farcall_arm_thumb_5t
2678 $(TEST_OBJDUMP) -D $< > $@
2680 arm_farcall_arm_thumb_5t: arm_farcall_arm_thumb_5t.o ../ld-new
2681 ../ld-new --no-fix-arm1176 --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
2683 arm_farcall_arm_thumb_5t.o: arm_farcall_arm_thumb.s
2684 $(TEST_AS) -march=armv5t -o $@ $<
2686 MOSTLYCLEANFILES += arm_farcall_arm_thumb arm_farcall_arm_thumb_5t
2688 # Check Thumb to Thumb farcall veneers
2690 check_SCRIPTS += arm_farcall_thumb_thumb.sh
2691 check_DATA += arm_farcall_thumb_thumb.stdout \
2692 arm_farcall_thumb_thumb_5t.stdout \
2693 arm_farcall_thumb_thumb_7m.stdout \
2694 arm_farcall_thumb_thumb_6m.stdout
2696 arm_farcall_thumb_thumb.stdout: arm_farcall_thumb_thumb
2697 $(TEST_OBJDUMP) -D $< > $@
2699 arm_farcall_thumb_thumb: arm_farcall_thumb_thumb.o ../ld-new
2700 ../ld-new --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
2702 arm_farcall_thumb_thumb.o: arm_farcall_thumb_thumb.s
2703 $(TEST_AS) -march=armv4t -o $@ $<
2705 arm_farcall_thumb_thumb_5t.stdout: arm_farcall_thumb_thumb_5t
2706 $(TEST_OBJDUMP) -D $< > $@
2708 arm_farcall_thumb_thumb_5t: arm_farcall_thumb_thumb_5t.o ../ld-new
2709 ../ld-new --no-fix-arm1176 --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
2711 arm_farcall_thumb_thumb_5t.o: arm_farcall_thumb_thumb.s
2712 $(TEST_AS) -march=armv5t -o $@ $<
2714 arm_farcall_thumb_thumb_7m.stdout: arm_farcall_thumb_thumb_7m
2715 $(TEST_OBJDUMP) -D $< > $@
2717 arm_farcall_thumb_thumb_7m: arm_farcall_thumb_thumb_7m.o ../ld-new
2718 ../ld-new --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
2720 arm_farcall_thumb_thumb_7m.o: arm_farcall_thumb_thumb.s
2721 $(TEST_AS) -march=armv7-m -o $@ $<
2723 arm_farcall_thumb_thumb_6m.stdout: arm_farcall_thumb_thumb_6m
2724 $(TEST_OBJDUMP) -D $< > $@
2726 arm_farcall_thumb_thumb_6m: arm_farcall_thumb_thumb_6m.o ../ld-new
2727 ../ld-new --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
2729 arm_farcall_thumb_thumb_6m.o: arm_farcall_thumb_thumb.s
2730 $(TEST_AS) -march=armv6-m -o $@ $<
2732 MOSTLYCLEANFILES += arm_farcall_thumb_thumb arm_farcall_thumb_thumb_5t \
2733 arm_farcall_thumb_thumb_7m arm_farcall_thumb_thumb_6m
2735 # Check Thumb to ARM farcall veneers
2737 check_SCRIPTS += arm_farcall_thumb_arm.sh
2738 check_DATA += arm_farcall_thumb_arm.stdout \
2739 arm_farcall_thumb_arm_5t.stdout
2741 arm_farcall_thumb_arm.stdout: arm_farcall_thumb_arm
2742 $(TEST_OBJDUMP) -D $< > $@
2744 arm_farcall_thumb_arm: arm_farcall_thumb_arm.o ../ld-new
2745 ../ld-new --section-start .text=0x1c01010 --section-start .foo=0x2001014 -o $@ $<
2747 arm_farcall_thumb_arm.o: arm_farcall_thumb_arm.s
2750 arm_farcall_thumb_arm_5t.stdout: arm_farcall_thumb_arm_5t
2751 $(TEST_OBJDUMP) -D $< > $@
2753 arm_farcall_thumb_arm_5t: arm_farcall_thumb_arm_5t.o ../ld-new
2754 ../ld-new --no-fix-arm1176 --section-start .text=0x1c01010 --section-start .foo=0x2001014 -o $@ $<
2756 arm_farcall_thumb_arm_5t.o: arm_farcall_thumb_arm.s
2757 $(TEST_AS) -march=armv5t -o $@ $<
2759 MOSTLYCLEANFILES += arm_farcall_thumb_arm arm_farcall_thumb_arm_5t
2761 endif DEFAULT_TARGET_ARM
2763 endif NATIVE_OR_CROSS_LINKER
2765 # Tests for the dwp tool.
2766 # We don't want to rely yet on GCC support for -gsplit-dwarf,
2767 # so we use (for now) test cases in x86 assembly language,
2768 # compiled from the dwp_test_*.cc sources.
2770 if DEFAULT_TARGET_X86_64
2772 dwp_test_main.o: dwp_test_main.s
2774 dwp_test_1.o: dwp_test_1.s
2776 dwp_test_1b.o: dwp_test_1b.s
2778 dwp_test_2.o: dwp_test_2.s
2781 dwp_test_main.dwo: dwp_test_main.o
2782 $(TEST_OBJCOPY) --extract-dwo $< $@
2783 dwp_test_1.dwo: dwp_test_1.o
2784 $(TEST_OBJCOPY) --extract-dwo $< $@
2785 dwp_test_1b.dwo: dwp_test_1b.o
2786 $(TEST_OBJCOPY) --extract-dwo $< $@
2787 dwp_test_2.dwo: dwp_test_2.o
2788 $(TEST_OBJCOPY) --extract-dwo $< $@
2790 check_SCRIPTS += dwp_test_1.sh
2791 check_DATA += dwp_test_1.stdout
2792 dwp_test_1.stdout: dwp_test_1.dwp
2793 $(TEST_READELF) -wi $< > $@
2794 dwp_test_1.dwp: ../dwp dwp_test_main.dwo dwp_test_1.dwo dwp_test_1b.dwo dwp_test_2.dwo
2795 ../dwp -o $@ dwp_test_main.dwo dwp_test_1.dwo dwp_test_1b.dwo dwp_test_2.dwo
2797 check_SCRIPTS += dwp_test_2.sh
2798 check_DATA += dwp_test_2.stdout
2799 dwp_test_2.stdout: dwp_test_2.dwp
2800 $(TEST_READELF) -wi $< > $@
2801 dwp_test_2.dwp: ../dwp dwp_test_2a.dwp dwp_test_2b.dwp
2802 ../dwp -o $@ dwp_test_2a.dwp dwp_test_2b.dwp
2803 dwp_test_2a.dwp: ../dwp dwp_test_main.dwo dwp_test_1.dwo
2804 ../dwp -o $@ dwp_test_main.dwo dwp_test_1.dwo
2805 dwp_test_2b.dwp: ../dwp dwp_test_1b.dwo dwp_test_2.dwo
2806 ../dwp -o $@ dwp_test_1b.dwo dwp_test_2.dwo
2808 endif DEFAULT_TARGET_X86_64