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 TEST_READELF = $(top_builddir)/../binutils/readelf
23 TEST_OBJDUMP = $(top_builddir)/../binutils/objdump
24 TEST_CXXFILT = $(top_builddir)/../binutils/cxxfilt
25 TEST_STRIP = $(top_builddir)/../binutils/strip-new
26 TEST_AR = $(top_builddir)/../binutils/ar
27 TEST_NM = $(top_builddir)/../binutils/nm-new
28 TEST_AS = $(top_builddir)/../gas/as-new
35 THREADSLIB = -lpthread
39 TLS_TEST_C_CFLAGS = -fopenmp
42 # 'make clean' is good about deleting some intermediate files (such as
43 # .o's), but not all of them (such as .so's and .err files). We
44 # improve on that here. automake-1.9 info docs say "mostlyclean" is
45 # the right choice for files 'make' builds that people rebuild.
46 MOSTLYCLEANFILES = *.so *.syms *.stdout
49 # We will add to these later, for each individual test. Note
50 # that we add each test under check_SCRIPTS or check_PROGRAMS;
51 # the TESTS variable is automatically populated from these.
57 TESTS = $(check_SCRIPTS) $(check_PROGRAMS)
59 # ---------------------------------------------------------------------
60 # These tests test the internals of gold (unittests).
62 # Infrastucture needed for the unittests
63 check_LIBRARIES = libgoldtest.a
64 libgoldtest_a_SOURCES = test.cc testmain.cc testfile.cc
67 libgoldtest.a ../libgold.a ../../libiberty/libiberty.a $(LIBINTL_DEP)
68 LDADD = libgoldtest.a ../libgold.a ../../libiberty/libiberty.a $(LIBINTL) \
69 $(THREADSLIB) $(LIBDL)
72 # The unittests themselves
73 if NATIVE_OR_CROSS_LINKER
76 # Infrastucture needed for the unittests: a directory where the linker
77 # is named 'ld'. This is because the -B flag appends 'ld' to its arg.
78 gcctestdir/ld: ../ld-new
79 test -d gcctestdir || mkdir -p gcctestdir
81 (cd gcctestdir && $(LN_S) ../../ld-new ld)
83 # Some tests require the latest features of an in-tree assembler.
84 gcctestdir/as: $(TEST_AS)
85 test -d gcctestdir || mkdir -p gcctestdir
87 (cd gcctestdir && $(LN_S) $(abs_top_builddir)/../gas/as-new as)
91 check_PROGRAMS += object_unittest
92 object_unittest_SOURCES = object_unittest.cc
94 check_PROGRAMS += binary_unittest
95 binary_unittest_SOURCES = binary_unittest.cc
97 check_PROGRAMS += leb128_unittest
98 leb128_unittest_SOURCES = leb128_unittest.cc
100 endif NATIVE_OR_CROSS_LINKER
102 # ---------------------------------------------------------------------
103 # These tests test the output of gold (end-to-end tests). In
104 # particular, they make sure that gold can link "difficult" object
105 # files, and the resulting object files run correctly. These can only
106 # run if we've built ld-new for the native architecture (that is,
107 # we're not cross-compiling it), since we run ld-new as part of these
108 # tests. We use the gcc-specific flag '-B' to use our linker instead
109 # of the default linker, which is why we only run our tests under gcc.
114 # Each of these .o's is a useful, small complete program. They're
115 # particularly useful for making sure ld-new's flags do what they're
116 # supposed to (hence their names), but are used for many tests that
117 # don't actually involve analyzing input data.
118 flagstest_debug.o: constructor_test.cc
119 $(CXXCOMPILE) -O0 -g -c -o $@ $<
120 flagstest_ndebug.o: constructor_test.cc
121 $(CXXCOMPILE) -O0 -c -o $@ $<
123 check_SCRIPTS += incremental_test.sh
124 check_DATA += incremental_test.stdout
125 MOSTLYCLEANFILES += incremental_test
126 incremental_test_1.o: incremental_test_1.c
127 $(COMPILE) -O0 -c -ffunction-sections -g -o $@ $<
128 incremental_test_2.o: incremental_test_2.c
129 $(COMPILE) -O0 -c -ffunction-sections -g -o $@ $<
130 incremental_test: incremental_test_1.o incremental_test_2.o gcctestdir/ld
131 $(LINK) -Bgcctestdir/ -Wl,--incremental-full incremental_test_1.o incremental_test_2.o -Wl,-debug 2> incremental_test.cmdline
132 incremental_test.stdout: incremental_test ../incremental-dump
133 ../incremental-dump incremental_test > $@
135 check_SCRIPTS += gc_comdat_test.sh
136 check_DATA += gc_comdat_test.stdout
137 MOSTLYCLEANFILES += gc_comdat_test
138 gc_comdat_test_1.o: gc_comdat_test_1.cc
139 $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
140 gc_comdat_test_2.o: gc_comdat_test_2.cc
141 $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
142 gc_comdat_test: gc_comdat_test_1.o gc_comdat_test_2.o gcctestdir/ld
143 $(CXXLINK) -Bgcctestdir/ -Wl,--gc-sections gc_comdat_test_1.o gc_comdat_test_2.o
144 gc_comdat_test.stdout: gc_comdat_test
145 $(TEST_NM) -C gc_comdat_test > gc_comdat_test.stdout
147 check_SCRIPTS += gc_tls_test.sh
148 check_DATA += gc_tls_test.stdout
149 MOSTLYCLEANFILES += gc_tls_test
150 gc_tls_test.o: gc_tls_test.cc
151 $(CXXCOMPILE) -O0 -c -g -o $@ $<
152 gc_tls_test:gc_tls_test.o gcctestdir/ld
153 $(CXXLINK) -Bgcctestdir/ -Wl,--gc-sections gc_tls_test.o
154 gc_tls_test.stdout: gc_tls_test
155 $(TEST_NM) -C gc_tls_test > gc_tls_test.stdout
157 check_SCRIPTS += gc_orphan_section_test.sh
158 check_DATA += gc_orphan_section_test.stdout
159 MOSTLYCLEANFILES += gc_orphan_section_test
160 gc_orphan_section_test.o: gc_orphan_section_test.cc
161 $(CXXCOMPILE) -O0 -c -g -o $@ $<
162 gc_orphan_section_test:gc_orphan_section_test.o gcctestdir/ld
163 $(CXXLINK) -Bgcctestdir/ -Wl,--gc-sections gc_orphan_section_test.o
164 gc_orphan_section_test.stdout: gc_orphan_section_test
165 $(TEST_NM) gc_orphan_section_test > gc_orphan_section_test.stdout
167 check_SCRIPTS += icf_test.sh
168 check_DATA += icf_test.stdout
169 MOSTLYCLEANFILES += icf_test
170 icf_test.o: icf_test.cc
171 $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
172 icf_test: icf_test.o gcctestdir/ld
173 $(CXXLINK) -Bgcctestdir/ -Wl,--icf=all icf_test.o
174 icf_test.stdout: icf_test
175 $(TEST_NM) -C icf_test > icf_test.stdout
177 check_SCRIPTS += icf_keep_unique_test.sh
178 check_DATA += icf_keep_unique_test.stdout
179 MOSTLYCLEANFILES += icf_keep_unique_test
180 icf_keep_unique_test.o: icf_keep_unique_test.cc
181 $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
182 icf_keep_unique_test: icf_keep_unique_test.o gcctestdir/ld
183 $(CXXLINK) -Bgcctestdir/ -Wl,--icf=all -Wl,--keep-unique,_Z11unique_funcv icf_keep_unique_test.o
184 icf_keep_unique_test.stdout: icf_keep_unique_test
185 $(TEST_NM) -C icf_keep_unique_test > icf_keep_unique_test.stdout
187 check_SCRIPTS += icf_safe_test.sh
188 check_DATA += icf_safe_test_1.stdout icf_safe_test_2.stdout
189 MOSTLYCLEANFILES += icf_safe_test
190 icf_safe_test.o: icf_safe_test.cc
191 $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
192 icf_safe_test: icf_safe_test.o gcctestdir/ld
193 $(CXXLINK) -Bgcctestdir/ -Wl,--icf=safe icf_safe_test.o
194 icf_safe_test_1.stdout: icf_safe_test
195 $(TEST_NM) icf_safe_test > icf_safe_test_1.stdout
196 icf_safe_test_2.stdout: icf_safe_test
197 $(TEST_READELF) -h icf_safe_test > icf_safe_test_2.stdout
199 check_SCRIPTS += icf_safe_so_test.sh
200 check_DATA += icf_safe_so_test_1.stdout icf_safe_so_test_2.stdout
201 MOSTLYCLEANFILES += icf_safe_so_test
202 icf_safe_so_test.o: icf_safe_so_test.cc
203 $(CXXCOMPILE) -O0 -c -ffunction-sections -fPIC -g -o $@ $<
204 icf_safe_so_test: icf_safe_so_test.o gcctestdir/ld
205 $(CXXLINK) -Bgcctestdir/ -Wl,--icf=safe icf_safe_so_test.o -fPIC -shared
206 icf_safe_so_test_1.stdout: icf_safe_so_test
207 $(TEST_NM) icf_safe_so_test > icf_safe_so_test_1.stdout
208 icf_safe_so_test_2.stdout: icf_safe_so_test
209 $(TEST_READELF) -h icf_safe_so_test > icf_safe_so_test_2.stdout
211 check_SCRIPTS += final_layout.sh
212 check_DATA += final_layout.stdout
213 MOSTLYCLEANFILES += final_layout
214 final_layout.o: final_layout.cc
215 $(CXXCOMPILE) -O0 -c -ffunction-sections -fdata-sections -g -o $@ $<
216 final_layout_sequence.txt:
217 (echo "*_Z3barv*" && echo ".text._Z3bazv" && echo "*_Z3foov*" && echo "*global_varb*" && echo "*global_vara*" && echo "*global_varc*") > final_layout_sequence.txt
218 final_layout: final_layout.o final_layout_sequence.txt gcctestdir/ld
219 $(CXXLINK) -Bgcctestdir/ -Wl,--section-ordering-file,final_layout_sequence.txt final_layout.o
220 final_layout.stdout: final_layout
221 $(TEST_NM) -n final_layout > final_layout.stdout
223 check_PROGRAMS += icf_virtual_function_folding_test
224 MOSTLYCLEANFILES += icf_virtual_function_folding_test
225 icf_virtual_function_folding_test.o: icf_virtual_function_folding_test.cc
226 $(CXXCOMPILE) -O0 -c -ffunction-sections -fPIE -g -o $@ $<
227 icf_virtual_function_folding_test: icf_virtual_function_folding_test.o gcctestdir/ld
228 $(CXXLINK) -Bgcctestdir/ -Wl,--icf=all icf_virtual_function_folding_test.o -pie
230 check_SCRIPTS += icf_preemptible_functions_test.sh
231 check_DATA += icf_preemptible_functions_test.stdout
232 MOSTLYCLEANFILES += icf_preemptible_functions_test
233 icf_preemptible_functions_test.o: icf_preemptible_functions_test.cc
234 $(CXXCOMPILE) -O0 -c -ffunction-sections -fPIC -g -o $@ $<
235 icf_preemptible_functions_test: icf_preemptible_functions_test.o gcctestdir/ld
236 $(CXXLINK) -Bgcctestdir/ -Wl,--icf=all icf_preemptible_functions_test.o -fPIC -shared
237 icf_preemptible_functions_test.stdout: icf_preemptible_functions_test
238 $(TEST_NM) icf_preemptible_functions_test > icf_preemptible_functions_test.stdout
240 check_SCRIPTS += icf_string_merge_test.sh
241 check_DATA += icf_string_merge_test.stdout
242 MOSTLYCLEANFILES += icf_string_merge_test
243 icf_string_merge_test.o: icf_string_merge_test.cc
244 $(CXXCOMPILE) -O0 -c -ffunction-sections -fPIC -g -o $@ $<
245 icf_string_merge_test: icf_string_merge_test.o gcctestdir/ld
246 $(CXXLINK) -Bgcctestdir/ -Wl,--icf=all icf_string_merge_test.o
247 icf_string_merge_test.stdout: icf_string_merge_test
248 $(TEST_NM) icf_string_merge_test > icf_string_merge_test.stdout
250 check_SCRIPTS += icf_sht_rel_addend_test.sh
251 check_DATA += icf_sht_rel_addend_test.stdout
252 MOSTLYCLEANFILES += icf_sht_rel_addend_test
253 icf_sht_rel_addend_test_1.o: icf_sht_rel_addend_test_1.cc
254 $(CXXCOMPILE) -O0 -c -ffunction-sections -fPIC -g -o $@ $<
255 icf_sht_rel_addend_test_2.o: icf_sht_rel_addend_test_2.cc
256 $(CXXCOMPILE) -O0 -c -ffunction-sections -fPIC -g -o $@ $<
257 icf_sht_rel_addend_test: icf_sht_rel_addend_test_1.o icf_sht_rel_addend_test_2.o gcctestdir/ld
258 $(CXXLINK) -Bgcctestdir/ -Wl,--icf=all icf_sht_rel_addend_test_1.o icf_sht_rel_addend_test_2.o
259 icf_sht_rel_addend_test.stdout: icf_sht_rel_addend_test
260 $(TEST_NM) icf_sht_rel_addend_test > icf_sht_rel_addend_test.stdout
262 check_PROGRAMS += basic_test
263 check_PROGRAMS += basic_pic_test
264 basic_test.o: basic_test.cc
265 $(CXXCOMPILE) -O0 -c -o $@ $<
266 basic_test: basic_test.o gcctestdir/ld
267 $(CXXLINK) -Bgcctestdir/ basic_test.o
270 check_PROGRAMS += basic_static_test
271 basic_static_test: basic_test.o gcctestdir/ld
272 $(CXXLINK) -Bgcctestdir/ -static basic_test.o
275 basic_pic_test.o: basic_test.cc
276 $(CXXCOMPILE) -O0 -c -fpic -o $@ $<
277 basic_pic_test: basic_pic_test.o gcctestdir/ld
278 $(CXXLINK) -Bgcctestdir/ basic_pic_test.o
281 check_PROGRAMS += basic_static_pic_test
282 basic_static_pic_test: basic_pic_test.o gcctestdir/ld
283 $(CXXLINK) -Bgcctestdir/ -static basic_pic_test.o
286 check_PROGRAMS += basic_pie_test
287 basic_pie_test.o: basic_test.cc
288 $(CXXCOMPILE) -O0 -c -fpie -o $@ $<
289 basic_pie_test: basic_pie_test.o gcctestdir/ld
290 $(CXXLINK) -Bgcctestdir/ -pie basic_pie_test.o
292 check_PROGRAMS += constructor_test
293 constructor_test_SOURCES = constructor_test.cc
294 constructor_test_DEPENDENCIES = gcctestdir/ld
295 constructor_test_LDFLAGS = -Bgcctestdir/
296 constructor_test_LDADD =
299 check_PROGRAMS += constructor_static_test
300 constructor_static_test_SOURCES = $(constructor_test_SOURCES)
301 constructor_static_test_DEPENDENCIES = $(constructor_test_DEPENDENCIES)
302 constructor_static_test_LDFLAGS = $(constructor_test_LDFLAGS) -static
303 constructor_static_test_LDADD = $(constructor_test_LDADD)
306 check_PROGRAMS += two_file_test
307 check_PROGRAMS += two_file_pic_test
308 two_file_test_SOURCES = \
310 two_file_test_1b.cc \
312 two_file_test_main.cc \
314 two_file_test_DEPENDENCIES = gcctestdir/ld
315 two_file_test_LDFLAGS = -Bgcctestdir/
316 two_file_test_LDADD =
319 check_PROGRAMS += two_file_static_test
320 two_file_static_test_SOURCES = $(two_file_test_SOURCES)
321 two_file_static_test_DEPENDENCIES = $(two_file_test_DEPENDENCIES)
322 two_file_static_test_LDFLAGS = $(two_file_test_LDFLAGS) -static
323 two_file_static_test_LDADD = $(two_file_test_LDADD)
326 two_file_pic_test_SOURCES = two_file_test_main.cc
327 two_file_pic_test_DEPENDENCIES = \
328 gcctestdir/ld two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o
329 two_file_pic_test_LDFLAGS = -Bgcctestdir/
330 two_file_pic_test_LDADD = two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o
333 check_PROGRAMS += two_file_shared_1_test
334 check_PROGRAMS += two_file_shared_2_test
335 check_PROGRAMS += two_file_shared_1_pic_2_test
336 check_PROGRAMS += two_file_shared_2_pic_1_test
337 check_PROGRAMS += two_file_same_shared_test
338 check_PROGRAMS += two_file_separate_shared_12_test
339 check_PROGRAMS += two_file_separate_shared_21_test
340 two_file_test_1_pic.o: two_file_test_1.cc
341 $(CXXCOMPILE) -c -fpic -o $@ $<
342 two_file_test_1b_pic.o: two_file_test_1b.cc
343 $(CXXCOMPILE) -c -fpic -o $@ $<
344 two_file_test_2_pic.o: two_file_test_2.cc
345 $(CXXCOMPILE) -c -fpic -o $@ $<
346 two_file_shared_1.so: two_file_test_1_pic.o two_file_test_1b_pic.o gcctestdir/ld
347 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1_pic.o two_file_test_1b_pic.o
348 two_file_shared_2.so: two_file_test_2_pic.o gcctestdir/ld
349 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_2_pic.o
350 two_file_shared.so: two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o gcctestdir/ld
351 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o
353 two_file_shared_1_test_SOURCES = two_file_test_2.cc two_file_test_main.cc
354 two_file_shared_1_test_DEPENDENCIES = gcctestdir/ld two_file_shared_1.so
355 two_file_shared_1_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
356 two_file_shared_1_test_LDADD = two_file_shared_1.so
358 two_file_shared_2_test_SOURCES = two_file_test_1.cc two_file_test_1b.cc two_file_test_main.cc
359 two_file_shared_2_test_DEPENDENCIES = gcctestdir/ld two_file_shared_2.so
360 two_file_shared_2_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
361 two_file_shared_2_test_LDADD = two_file_shared_2.so
363 two_file_shared_1_pic_2_test_SOURCES = two_file_test_main.cc
364 two_file_shared_1_pic_2_test_DEPENDENCIES = \
365 gcctestdir/ld two_file_shared_2.so two_file_test_1_pic.o two_file_test_1b_pic.o
366 two_file_shared_1_pic_2_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
367 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
369 two_file_shared_2_pic_1_test_SOURCES = two_file_test_main.cc
370 two_file_shared_2_pic_1_test_DEPENDENCIES = \
371 gcctestdir/ld two_file_shared_2.so two_file_test_2_pic.o
372 two_file_shared_2_pic_1_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
373 two_file_shared_2_pic_1_test_LDADD = two_file_test_2_pic.o two_file_shared_1.so
375 two_file_same_shared_test_SOURCES = two_file_test_main.cc
376 two_file_same_shared_test_DEPENDENCIES = gcctestdir/ld two_file_shared.so
377 two_file_same_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
378 two_file_same_shared_test_LDADD = two_file_shared.so
380 two_file_separate_shared_12_test_SOURCES = two_file_test_main.cc
381 two_file_separate_shared_12_test_DEPENDENCIES = \
382 gcctestdir/ld two_file_shared_1.so two_file_shared_2.so
383 two_file_separate_shared_12_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
384 two_file_separate_shared_12_test_LDADD = \
385 two_file_shared_1.so two_file_shared_2.so
387 two_file_separate_shared_21_test_SOURCES = two_file_test_main.cc
388 two_file_separate_shared_21_test_DEPENDENCIES = \
389 gcctestdir/ld two_file_shared_1.so two_file_shared_2.so
390 two_file_separate_shared_21_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
391 two_file_separate_shared_21_test_LDADD = \
392 two_file_shared_2.so two_file_shared_1.so
394 check_PROGRAMS += two_file_relocatable_test
395 two_file_relocatable_test_SOURCES = two_file_test_main.cc
396 two_file_relocatable_test_DEPENDENCIES = \
397 gcctestdir/ld two_file_relocatable.o
398 two_file_relocatable_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
399 two_file_relocatable_test_LDADD = two_file_relocatable.o
400 two_file_relocatable.o: gcctestdir/ld two_file_test_1.o two_file_test_1b.o two_file_test_2.o
401 gcctestdir/ld -r -o $@ two_file_test_1.o two_file_test_1b.o two_file_test_2.o
403 check_PROGRAMS += two_file_pie_test
404 two_file_test_1_pie.o: two_file_test_1.cc
405 $(CXXCOMPILE) -c -fpie -o $@ $<
406 two_file_test_1b_pie.o: two_file_test_1b.cc
407 $(CXXCOMPILE) -c -fpie -o $@ $<
408 two_file_test_2_pie.o: two_file_test_2.cc
409 $(CXXCOMPILE) -c -fpie -o $@ $<
410 two_file_test_main_pie.o: two_file_test_main.cc
411 $(CXXCOMPILE) -c -fpie -o $@ $<
412 two_file_pie_test: two_file_test_1_pie.o two_file_test_1b_pie.o \
413 two_file_test_2_pie.o two_file_test_main_pie.o gcctestdir/ld
414 $(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
416 check_SCRIPTS += two_file_shared.sh
417 check_DATA += two_file_shared.dbg
418 MOSTLYCLEANFILES += two_file_shared.dbg
419 two_file_shared.dbg: two_file_shared.so
420 $(TEST_READELF) -w $< >$@ 2>/dev/null
422 # The nonpic tests will fail on platforms which can not put non-PIC
423 # code into shared libraries, so we just don't run them in that case.
424 if FN_PTRS_IN_SO_WITHOUT_PIC
426 check_PROGRAMS += two_file_shared_1_nonpic_test
427 check_PROGRAMS += two_file_shared_2_nonpic_test
428 check_PROGRAMS += two_file_same_shared_nonpic_test
429 check_PROGRAMS += two_file_separate_shared_12_nonpic_test
430 check_PROGRAMS += two_file_separate_shared_21_nonpic_test
431 check_PROGRAMS += two_file_mixed_shared_test
432 check_PROGRAMS += two_file_mixed_2_shared_test
433 two_file_shared_1_nonpic.so: two_file_test_1.o gcctestdir/ld
434 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1.o two_file_test_1b.o -Wl,-z,notext
435 two_file_shared_2_nonpic.so: two_file_test_2.o gcctestdir/ld
436 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_2.o
437 two_file_shared_nonpic.so: two_file_test_1.o two_file_test_1b.o two_file_test_2.o gcctestdir/ld
438 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1.o two_file_test_1b.o two_file_test_2.o -Wl,-z,notext
439 two_file_shared_mixed.so: two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2.o gcctestdir/ld
440 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2.o -Wl,-z,notext
441 two_file_shared_mixed_1.so: two_file_test_1.o two_file_test_1b_pic.o two_file_shared_2.so gcctestdir/ld
442 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1.o two_file_test_1b_pic.o two_file_shared_2.so -Wl,-z,notext
444 two_file_shared_1_nonpic_test_SOURCES = \
445 two_file_test_2.cc two_file_test_main.cc
446 two_file_shared_1_nonpic_test_DEPENDENCIES = \
447 gcctestdir/ld two_file_shared_1_nonpic.so
448 two_file_shared_1_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
449 two_file_shared_1_nonpic_test_LDADD = two_file_shared_1_nonpic.so
451 two_file_shared_2_nonpic_test_SOURCES = \
452 two_file_test_1.cc two_file_test_1b.cc two_file_test_main.cc
453 two_file_shared_2_nonpic_test_DEPENDENCIES = \
454 gcctestdir/ld two_file_shared_2_nonpic.so
455 two_file_shared_2_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
456 two_file_shared_2_nonpic_test_LDADD = two_file_shared_2_nonpic.so
458 two_file_same_shared_nonpic_test_SOURCES = two_file_test_main.cc
459 two_file_same_shared_nonpic_test_DEPENDENCIES = \
460 gcctestdir/ld two_file_shared_nonpic.so
461 two_file_same_shared_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
462 two_file_same_shared_nonpic_test_LDADD = two_file_shared_nonpic.so
464 two_file_separate_shared_12_nonpic_test_SOURCES = two_file_test_main.cc
465 two_file_separate_shared_12_nonpic_test_DEPENDENCIES = \
466 gcctestdir/ld two_file_shared_1_nonpic.so two_file_shared_2_nonpic.so
467 two_file_separate_shared_12_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
468 two_file_separate_shared_12_nonpic_test_LDADD = \
469 two_file_shared_1_nonpic.so two_file_shared_2_nonpic.so
471 two_file_separate_shared_21_nonpic_test_SOURCES = two_file_test_main.cc
472 two_file_separate_shared_21_nonpic_test_DEPENDENCIES = \
473 gcctestdir/ld two_file_shared_1_nonpic.so two_file_shared_2_nonpic.so
474 two_file_separate_shared_21_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
475 two_file_separate_shared_21_nonpic_test_LDADD = \
476 two_file_shared_2_nonpic.so two_file_shared_1_nonpic.so
478 two_file_mixed_shared_test_SOURCES = two_file_test_main.cc
479 two_file_mixed_shared_test_DEPENDENCIES = gcctestdir/ld two_file_shared_mixed.so
480 two_file_mixed_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
481 two_file_mixed_shared_test_LDADD = two_file_shared_mixed.so
483 two_file_mixed_2_shared_test_SOURCES = two_file_test_main.cc
484 two_file_mixed_2_shared_test_DEPENDENCIES = gcctestdir/ld two_file_shared_mixed_1.so two_file_shared_2.so
485 two_file_mixed_2_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
486 two_file_mixed_2_shared_test_LDADD = two_file_shared_mixed_1.so two_file_shared_2.so
488 check_PROGRAMS += two_file_mixed_pie_test
489 two_file_mixed_pie_test: two_file_test_1.o two_file_test_1b_pie.o \
490 two_file_test_main_pie.o two_file_shared_2.so gcctestdir/ld
491 $(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
493 endif FN_PTRS_IN_SO_WITHOUT_PIC
495 check_PROGRAMS += two_file_strip_test
496 two_file_strip_test: two_file_test
497 $(TEST_STRIP) -o two_file_strip_test two_file_test
499 check_PROGRAMS += two_file_same_shared_strip_test
500 two_file_same_shared_strip_test_SOURCES = two_file_test_main.cc
501 two_file_same_shared_strip_test_DEPENDENCIES = \
502 gcctestdir/ld two_file_shared_strip.so
503 two_file_same_shared_strip_test_LDFLAGS = -Bgcctestdir/ -Wl,-R.
504 two_file_same_shared_strip_test_LDADD = two_file_shared_strip.so
505 two_file_shared_strip.so: two_file_shared.so
506 $(TEST_STRIP) -S -o two_file_shared_strip.so two_file_shared.so
508 check_PROGRAMS += common_test_1
509 common_test_1_SOURCES = common_test_1.c
510 common_test_1_DEPENDENCIES = gcctestdir/ld
511 common_test_1_LDFLAGS = -Bgcctestdir/
512 common_test_1_LDADD =
514 check_PROGRAMS += common_test_2
515 common_test_2_SOURCES = common_test_1.c
516 common_test_2_DEPENDENCIES = common_test_2.so common_test_3.so gcctestdir/ld
517 common_test_2_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
518 common_test_2_LDADD = common_test_2.so common_test_3.so
519 common_test_2_pic.o: common_test_2.c
520 $(COMPILE) -c -fpic -o $@ $<
521 common_test_2.so: common_test_2_pic.o common_test_3.so gcctestdir/ld
522 $(LINK) -Bgcctestdir/ -shared common_test_2_pic.o common_test_3.so
523 common_test_3_pic.o: common_test_3.c
524 $(COMPILE) -c -fpic -o $@ $<
525 common_test_3.so: common_test_3_pic.o ver_test_2.script gcctestdir/ld
526 $(LINK) -Bgcctestdir/ -shared common_test_3_pic.o -Wl,--version-script,$(srcdir)/ver_test_2.script
528 check_PROGRAMS += exception_test
529 check_PROGRAMS += exception_shared_1_test
530 check_PROGRAMS += exception_shared_2_test
531 check_PROGRAMS += exception_same_shared_test
532 check_PROGRAMS += exception_separate_shared_12_test
533 check_PROGRAMS += exception_separate_shared_21_test
534 exception_test_1_pic.o: exception_test_1.cc
535 $(CXXCOMPILE) -c -fpic -o $@ $<
536 exception_test_2_pic.o: exception_test_2.cc
537 $(CXXCOMPILE) -c -fpic -o $@ $<
538 exception_shared_1.so: exception_test_1_pic.o gcctestdir/ld
539 $(CXXLINK) -Bgcctestdir/ -shared exception_test_1_pic.o
540 exception_shared_2.so: exception_test_2_pic.o gcctestdir/ld
541 $(CXXLINK) -Bgcctestdir/ -shared exception_test_2_pic.o
542 exception_shared.so: exception_test_1_pic.o exception_test_2_pic.o gcctestdir/ld
543 $(CXXLINK) -Bgcctestdir/ -shared exception_test_1_pic.o exception_test_2_pic.o
545 exception_test_SOURCES = \
546 exception_test_main.cc \
547 exception_test_1.cc \
548 exception_test_2.cc \
550 exception_test_DEPENDENCIES = gcctestdir/ld
551 exception_test_LDFLAGS = -Bgcctestdir/
552 exception_test_LDADD =
555 check_PROGRAMS += exception_static_test
556 exception_static_test_SOURCES = $(exception_test_SOURCES)
557 exception_static_test_DEPENDENCIES = $(exception_test_DEPENDENCIES)
558 exception_static_test_LDFLAGS = $(exception_test_LDFLAGS) -static
559 exception_static_test_LDADD = $(exception_test_LDADD)
562 exception_shared_1_test_SOURCES = exception_test_2.cc exception_test_main.cc
563 exception_shared_1_test_DEPENDENCIES = gcctestdir/ld exception_shared_1.so
564 exception_shared_1_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
565 exception_shared_1_test_LDADD = exception_shared_1.so
567 exception_shared_2_test_SOURCES = exception_test_1.cc exception_test_main.cc
568 exception_shared_2_test_DEPENDENCIES = gcctestdir/ld exception_shared_2.so
569 exception_shared_2_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
570 exception_shared_2_test_LDADD = exception_shared_2.so
572 exception_same_shared_test_SOURCES = exception_test_main.cc
573 exception_same_shared_test_DEPENDENCIES = gcctestdir/ld exception_shared.so
574 exception_same_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
575 exception_same_shared_test_LDADD = exception_shared.so
577 exception_separate_shared_12_test_SOURCES = exception_test_main.cc
578 exception_separate_shared_12_test_DEPENDENCIES = \
579 gcctestdir/ld exception_shared_1.so exception_shared_2.so
580 exception_separate_shared_12_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
581 exception_separate_shared_12_test_LDADD = \
582 exception_shared_1.so exception_shared_2.so
584 exception_separate_shared_21_test_SOURCES = exception_test_main.cc
585 exception_separate_shared_21_test_DEPENDENCIES = \
586 gcctestdir/ld exception_shared_1.so exception_shared_2.so
587 exception_separate_shared_21_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
588 exception_separate_shared_21_test_LDADD = \
589 exception_shared_2.so exception_shared_1.so
592 check_PROGRAMS += weak_test
593 weak_test_SOURCES = weak_test.cc
594 weak_test_DEPENDENCIES = gcctestdir/ld
595 weak_test_LDFLAGS = -Bgcctestdir/
598 check_PROGRAMS += weak_undef_test
599 MOSTLYCLEANFILES += alt/weak_undef_lib.so
600 weak_undef_test_SOURCES = weak_undef_test.cc
601 weak_undef_test_DEPENDENCIES = gcctestdir/ld weak_undef_lib.so alt/weak_undef_lib.so
602 weak_undef_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,alt
603 weak_undef_test_LDADD = -L . weak_undef_lib.so
604 weak_undef_file1.o: weak_undef_file1.cc
605 $(CXXCOMPILE) -c -fpic -o $@ $<
606 weak_undef_file2.o: weak_undef_file2.cc
607 $(CXXCOMPILE) -c -fpic -o $@ $<
608 weak_undef_lib.so: weak_undef_file1.o
609 $(CXXLINK) -Bgcctestdir/ -shared weak_undef_file1.o
610 alt/weak_undef_lib.so: weak_undef_file2.o
611 test -d alt || mkdir -p alt
612 $(CXXLINK) -Bgcctestdir/ -shared weak_undef_file2.o
614 if FN_PTRS_IN_SO_WITHOUT_PIC
615 check_PROGRAMS += weak_undef_nonpic_test
616 MOSTLYCLEANFILES += alt/weak_undef_lib_nonpic.so
617 weak_undef_nonpic_test_SOURCES = weak_undef_test.cc
618 weak_undef_nonpic_test_DEPENDENCIES = gcctestdir/ld weak_undef_lib_nonpic.so alt/weak_undef_lib_nonpic.so
619 weak_undef_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,alt
620 weak_undef_nonpic_test_LDADD = -L . weak_undef_lib_nonpic.so
621 weak_undef_file1_nonpic.o: weak_undef_file1.cc
622 $(CXXCOMPILE) -c -o $@ $<
623 weak_undef_file2_nonpic.o: weak_undef_file2.cc
624 $(CXXCOMPILE) -c -o $@ $<
625 weak_undef_lib_nonpic.so: weak_undef_file1_nonpic.o
626 $(CXXLINK) -Bgcctestdir/ -shared weak_undef_file1_nonpic.o -Wl,-z,notext
627 alt/weak_undef_lib_nonpic.so: weak_undef_file2_nonpic.o
628 test -d alt || mkdir -p alt
629 $(CXXLINK) -Bgcctestdir/ -shared weak_undef_file2_nonpic.o -Wl,-z,notext
630 endif FN_PTRS_IN_SO_WITHOUT_PIC
633 check_PROGRAMS += weak_alias_test
634 weak_alias_test_SOURCES = weak_alias_test_main.cc
635 weak_alias_test_DEPENDENCIES = \
636 gcctestdir/ld weak_alias_test_1.so weak_alias_test_2.so \
637 weak_alias_test_3.o weak_alias_test_4.so weak_alias_test_5.so
638 weak_alias_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
639 weak_alias_test_LDADD = \
640 weak_alias_test_1.so weak_alias_test_2.so weak_alias_test_3.o \
641 weak_alias_test_4.so weak_alias_test_5.so
642 weak_alias_test_1_pic.o: weak_alias_test_1.cc
643 $(CXXCOMPILE) -c -fpic -o $@ $<
644 weak_alias_test_1.so: weak_alias_test_1_pic.o gcctestdir/ld
645 $(CXXLINK) -Bgcctestdir/ -shared weak_alias_test_1_pic.o
646 weak_alias_test_2_pic.o: weak_alias_test_2.cc
647 $(CXXCOMPILE) -c -fpic -o $@ $<
648 weak_alias_test_2.so: weak_alias_test_2_pic.o gcctestdir/ld
649 $(CXXLINK) -Bgcctestdir/ -shared weak_alias_test_2_pic.o
650 weak_alias_test_3.o: weak_alias_test_3.cc
651 $(CXXCOMPILE) -c -o $@ $<
652 weak_alias_test_4_pic.o: weak_alias_test_4.cc
653 $(CXXCOMPILE) -c -fpic -o $@ $<
654 weak_alias_test_4.so: weak_alias_test_4_pic.o gcctestdir/ld
655 $(CXXLINK) -Bgcctestdir/ -shared weak_alias_test_4_pic.o
656 weak_alias_test_5_pic.o: weak_alias_test_5.cc
657 $(CXXCOMPILE) -c -fpic -o $@ $<
658 weak_alias_test_5.so: weak_alias_test_5_pic.o $(srcdir)/weak_alias_test.script gcctestdir/ld
659 $(CXXLINK) -Bgcctestdir/ -shared weak_alias_test_5_pic.o \
660 -Wl,--version-script,$(srcdir)/weak_alias_test.script
662 check_SCRIPTS += weak_plt.sh
663 check_PROGRAMS += weak_plt
664 check_DATA += weak_plt_shared.so
665 weak_plt_main_pic.o: weak_plt_main.cc
666 $(CXXCOMPILE) -c -fpic -o $@ $<
667 weak_plt: weak_plt_main_pic.o gcctestdir/ld
668 $(CXXLINK) -Bgcctestdir/ weak_plt_main_pic.o
669 weak_plt_shared_pic.o: weak_plt_shared.cc
670 $(CXXCOMPILE) -c -fpic -o $@ $<
671 weak_plt_shared.so: weak_plt_shared_pic.o gcctestdir/ld
672 $(CXXLINK) -Bgcctestdir/ -shared weak_plt_shared_pic.o
674 check_PROGRAMS += copy_test
675 copy_test_SOURCES = copy_test.cc
676 copy_test_DEPENDENCIES = gcctestdir/ld copy_test_1.so copy_test_2.so
677 copy_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
678 copy_test_LDADD = copy_test_1.so copy_test_2.so
679 copy_test_1_pic.o: copy_test_1.cc
680 $(CXXCOMPILE) -c -fpic -o $@ $<
681 copy_test_1.so: gcctestdir/ld copy_test_1_pic.o
682 $(CXXLINK) -Bgcctestdir/ -shared copy_test_1_pic.o
683 copy_test_2_pic.o: copy_test_2.cc
684 $(CXXCOMPILE) -c -fpic -o $@ $<
685 copy_test_2.so: gcctestdir/ld copy_test_2_pic.o
686 $(CXXLINK) -Bgcctestdir/ -shared copy_test_2_pic.o
690 check_PROGRAMS += tls_test
691 check_PROGRAMS += tls_pic_test
692 check_PROGRAMS += tls_pie_test
693 check_PROGRAMS += tls_pie_pic_test
694 check_PROGRAMS += tls_shared_test
695 check_PROGRAMS += tls_shared_ie_test
696 check_PROGRAMS += tls_shared_gd_to_ie_test
697 tls_test_pic.o: tls_test.cc
698 $(CXXCOMPILE) -c -fpic -o $@ $<
699 tls_test_file2_pic.o: tls_test_file2.cc
700 $(CXXCOMPILE) -c -fpic -o $@ $<
701 tls_test_c_pic.o: tls_test_c.c
702 $(COMPILE) -c -fpic $(TLS_TEST_C_CFLAGS) -o $@ $<
703 tls_test_shared.so: tls_test_pic.o tls_test_file2_pic.o tls_test_c_pic.o gcctestdir/ld
704 $(CXXLINK) -Bgcctestdir/ -shared tls_test_pic.o tls_test_file2_pic.o tls_test_c_pic.o -Wl,-z,defs
705 tls_test_shared2.so: tls_test_file2_pic.o gcctestdir/ld
706 $(CXXLINK) -Bgcctestdir/ -shared tls_test_file2_pic.o
708 tls_test_pic_ie.o: tls_test.cc
709 $(CXXCOMPILE) -c -fpic -ftls-model=initial-exec -o $@ $<
710 tls_test_file2_pic_ie.o: tls_test_file2.cc
711 $(CXXCOMPILE) -c -fpic -ftls-model=initial-exec -o $@ $<
712 tls_test_c_pic_ie.o: tls_test_c.c
713 $(COMPILE) -c -fpic -ftls-model=initial-exec $(TLS_TEST_C_CFLAGS) -o $@ $<
714 tls_test_ie_shared.so: tls_test_pic_ie.o tls_test_file2_pic_ie.o tls_test_c_pic_ie.o gcctestdir/ld
715 $(CXXLINK) -Bgcctestdir/ -shared tls_test_pic_ie.o tls_test_file2_pic_ie.o tls_test_c_pic_ie.o
717 tls_test_SOURCES = tls_test.cc tls_test_file2.cc tls_test_main.cc tls_test.h
718 tls_test_DEPENDENCIES = gcctestdir/ld tls_test_c.o
719 tls_test_LDFLAGS = -Bgcctestdir/
720 tls_test_LDADD = tls_test_c.o -lpthread
721 tls_test_c.o: tls_test_c.c
722 $(COMPILE) -c $(TLS_TEST_C_CFLAGS) -o $@ $<
724 tls_pic_test_SOURCES = tls_test_main.cc
725 tls_pic_test_DEPENDENCIES = gcctestdir/ld tls_test_pic.o tls_test_file2_pic.o \
727 tls_pic_test_LDFLAGS = -Bgcctestdir/
728 tls_pic_test_LDADD = tls_test_pic.o tls_test_file2_pic.o tls_test_c_pic.o \
731 tls_test_main_pie.o: tls_test_main.cc tls_test.h
732 $(CXXCOMPILE) -c -fpie -o $@ $<
733 tls_test_pie.o: tls_test.cc tls_test.h
734 $(CXXCOMPILE) -c -fpie -o $@ $<
735 tls_test_file2_pie.o: tls_test_file2.cc tls_test.h
736 $(CXXCOMPILE) -c -fpie -o $@ $<
737 tls_test_c_pie.o: tls_test_c.c
738 $(COMPILE) -c -fpic $(TLS_TEST_C_CFLAGS) -o $@ $<
739 tls_pie_test: tls_test_main_pie.o tls_test_pie.o tls_test_file2_pie.o \
740 tls_test_c_pie.o gcctestdir/ld
741 $(CXXLINK) -Bgcctestdir/ -pie tls_test_main_pie.o tls_test_pie.o tls_test_file2_pie.o tls_test_c_pie.o -lpthread
743 tls_pie_pic_test: tls_test_main_pie.o tls_test_pic.o tls_test_file2_pic.o \
744 tls_test_c_pic.o gcctestdir/ld
745 $(CXXLINK) -Bgcctestdir/ -pie tls_test_main_pie.o tls_test_pic.o tls_test_file2_pic.o tls_test_c_pic.o -lpthread
747 tls_shared_test_SOURCES = tls_test_main.cc
748 tls_shared_test_DEPENDENCIES = gcctestdir/ld tls_test_shared.so
749 tls_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
750 tls_shared_test_LDADD = tls_test_shared.so -lpthread
752 tls_shared_ie_test_SOURCES = tls_test_main.cc
753 tls_shared_ie_test_DEPENDENCIES = gcctestdir/ld tls_test_ie_shared.so
754 tls_shared_ie_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
755 tls_shared_ie_test_LDADD = tls_test_ie_shared.so -lpthread
757 tls_shared_gd_to_ie_test_SOURCES = tls_test_main.cc
758 tls_shared_gd_to_ie_test_DEPENDENCIES = gcctestdir/ld tls_test_pic.o \
759 tls_test_c_pic.o tls_test_shared2.so
760 tls_shared_gd_to_ie_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
761 tls_shared_gd_to_ie_test_LDADD = tls_test_pic.o tls_test_c_pic.o \
762 tls_test_shared2.so -lpthread
766 check_PROGRAMS += tls_shared_gnu2_gd_to_ie_test
768 tls_test_gnu2.o: tls_test.cc
769 $(CXXCOMPILE) -c -fpic -mtls-dialect=gnu2 -o $@ $<
770 tls_test_file2_gnu2.o: tls_test_file2.cc
771 $(CXXCOMPILE) -c -fpic -mtls-dialect=gnu2 -o $@ $<
772 tls_test_c_gnu2.o: tls_test_c.c
773 $(COMPILE) -c -fpic -mtls-dialect=gnu2 $(TLS_TEST_C_CFLAGS) -o $@ $<
774 tls_test_gnu2_shared2.so: tls_test_file2_gnu2.o gcctestdir/ld
775 $(CXXLINK) -Bgcctestdir/ -shared tls_test_file2_gnu2.o
777 tls_shared_gnu2_gd_to_ie_test_SOURCES = tls_test_main.cc
778 tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES = gcctestdir/ld tls_test_gnu2.o \
779 tls_test_c_gnu2.o tls_test_gnu2_shared2.so
780 tls_shared_gnu2_gd_to_ie_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
781 tls_shared_gnu2_gd_to_ie_test_LDADD = tls_test_gnu2.o tls_test_c_gnu2.o \
782 tls_test_gnu2_shared2.so -lpthread
786 check_PROGRAMS += tls_shared_gnu2_test
788 tls_test_gnu2_shared.so: tls_test_gnu2.o tls_test_file2_gnu2.o tls_test_c_gnu2.o gcctestdir/ld
789 $(CXXLINK) -Bgcctestdir/ -shared tls_test_gnu2.o tls_test_file2_gnu2.o tls_test_c_gnu2.o
791 tls_shared_gnu2_test_SOURCES = tls_test_main.cc
792 tls_shared_gnu2_test_DEPENDENCIES = gcctestdir/ld tls_test_gnu2_shared.so
793 tls_shared_gnu2_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
794 tls_shared_gnu2_test_LDADD = tls_test_gnu2_shared.so -lpthread
796 endif TLS_DESCRIPTORS
798 endif TLS_GNU2_DIALECT
802 check_PROGRAMS += tls_static_test
803 check_PROGRAMS += tls_static_pic_test
805 tls_static_test_SOURCES = $(tls_test_SOURCES)
806 tls_static_test_DEPENDENCIES = $(tls_test_DEPENDENCIES)
807 tls_static_test_LDFLAGS = $(tls_test_LDFLAGS) -static
808 tls_static_test_LDADD = $(tls_test_LDADD)
810 tls_static_pic_test_SOURCES = $(tls_pic_test_SOURCES)
811 tls_static_pic_test_DEPENDENCIES = $(tls_pic_test_DEPENDENCIES)
812 tls_static_pic_test_LDFLAGS = $(tls_pic_test_LDFLAGS) -static
813 tls_static_pic_test_LDADD = $(tls_pic_test_LDADD)
817 if FN_PTRS_IN_SO_WITHOUT_PIC
818 check_PROGRAMS += tls_shared_nonpic_test
819 tls_test_shared_nonpic.so: tls_test.o tls_test_file2.o tls_test_c.o gcctestdir/ld
820 $(CXXLINK) -Bgcctestdir/ -shared tls_test.o tls_test_file2.o tls_test_c.o -Wl,-z,notext
822 tls_shared_nonpic_test_SOURCES = tls_test_main.cc
823 tls_shared_nonpic_test_DEPENDENCIES = gcctestdir/ld tls_test_shared_nonpic.so
824 tls_shared_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
825 tls_shared_nonpic_test_LDADD = tls_test_shared_nonpic.so -lpthread
826 endif FN_PTRS_IN_SO_WITHOUT_PIC
830 check_PROGRAMS += many_sections_test
831 many_sections_test_SOURCES = many_sections_test.cc
832 many_sections_test_DEPENDENCIES = gcctestdir/ld
833 many_sections_test_LDFLAGS = -Bgcctestdir/ -rdynamic
834 many_sections_test_LDADD =
836 BUILT_SOURCES += many_sections_define.h
837 MOSTLYCLEANFILES += many_sections_define.h
838 many_sections_define.h:
839 (for i in `seq 1 70000`; do \
840 echo "int var_$$i __attribute__((section(\"section_$$i\"))) = $$i;"; \
844 BUILT_SOURCES += many_sections_check.h
845 MOSTLYCLEANFILES += many_sections_check.h
846 many_sections_check.h:
847 (for i in `seq 1 1000 70000`; do \
848 echo "assert(var_$$i == $$i);"; \
852 check_PROGRAMS += many_sections_r_test
853 many_sections_r_test.o: many_sections_test.o gcctestdir/ld
854 gcctestdir/ld -r -o $@ many_sections_test.o
855 many_sections_r_test: many_sections_r_test.o gcctestdir/ld
856 $(CXXLINK) -Bgcctestdir/ many_sections_r_test.o $(LIBS)
858 check_PROGRAMS += initpri1
859 initpri1_SOURCES = initpri1.c
860 initpri1_DEPENDENCIES = gcctestdir/ld
861 initpri1_LDFLAGS = -Bgcctestdir/
864 check_PROGRAMS += initpri2
865 initpri2_SOURCES = initpri2.c
866 initpri2_DEPENDENCIES = gcctestdir/ld
867 initpri2_LDFLAGS = -Bgcctestdir/ -Wl,--ctors-in-init-array
870 check_PROGRAMS += initpri3a
871 initpri3a_SOURCES = initpri3.c
872 initpri3a_DEPENDENCIES = gcctestdir/ld
873 initpri3a_LDFLAGS = -Bgcctestdir/
876 # This test fails on targets not using .ctors and .dtors sections (e.g. ARM
877 # EABI). Given that gcc is moving towards using .init_array in all cases,
878 # this test is commented out. A better fix would be checking whether gcc
879 # uses .ctors or .init_array sections in configure.
881 # check_PROGRAMS += initpri3b
882 # initpri3b_SOURCES = initpri3.c
883 # initpri3b_DEPENDENCIES = gcctestdir/ld
884 # initpri3b_LDFLAGS = -Bgcctestdir/ -Wl,--no-ctors-in-init-array
887 # Test --detect-odr-violations
888 check_SCRIPTS += debug_msg.sh
890 # Create the data files that debug_msg.sh analyzes.
891 check_DATA += debug_msg.err
892 MOSTLYCLEANFILES += debug_msg.err
893 debug_msg.o: debug_msg.cc
894 $(CXXCOMPILE) -O0 -g -c -w -o $@ $(srcdir)/debug_msg.cc
895 odr_violation1.o: odr_violation1.cc
896 $(CXXCOMPILE) -O0 -g -c -w -o $@ $(srcdir)/odr_violation1.cc
897 # Compile with different optimization flags to check that rearranged
898 # instructions don't cause a false positive.
899 odr_violation2.o: odr_violation2.cc
900 $(CXXCOMPILE) -O2 -g -c -w -o $@ $(srcdir)/odr_violation2.cc
901 debug_msg.err: debug_msg.o odr_violation1.o odr_violation2.o gcctestdir/ld
902 @echo $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg debug_msg.o odr_violation1.o odr_violation2.o "2>$@"
903 @if $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg debug_msg.o odr_violation1.o odr_violation2.o 2>$@; \
905 echo 1>&2 "Link of debug_msg should have failed"; \
913 # Check that --detect-odr-violations works with compressed debug sections.
914 check_DATA += debug_msg_cdebug.err
915 MOSTLYCLEANFILES += debug_msg_cdebug.err
916 debug_msg_cdebug.o: debug_msg.cc gcctestdir/as
917 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -Wa,--compress-debug-sections -c -w -o $@ $(srcdir)/debug_msg.cc
918 odr_violation1_cdebug.o: odr_violation1.cc gcctestdir/as
919 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -Wa,--compress-debug-sections -c -w -o $@ $(srcdir)/odr_violation1.cc
920 odr_violation2_cdebug.o: odr_violation2.cc gcctestdir/as
921 $(CXXCOMPILE) -Bgcctestdir/ -O2 -g -Wa,--compress-debug-sections -c -w -o $@ $(srcdir)/odr_violation2.cc
922 debug_msg_cdebug.err: debug_msg_cdebug.o odr_violation1_cdebug.o odr_violation2_cdebug.o gcctestdir/ld
923 @echo $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_cdebug debug_msg_cdebug.o odr_violation1_cdebug.o odr_violation2_cdebug.o "2>$@"
924 @if $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_cdebug debug_msg_cdebug.o odr_violation1_cdebug.o odr_violation2_cdebug.o 2>$@; \
926 echo 1>&2 "Link of debug_msg_cdebug should have failed"; \
933 # See if we can also detect problems when we're linking .so's, not .o's.
934 check_DATA += debug_msg_so.err
935 MOSTLYCLEANFILES += debug_msg_so.err
936 debug_msg.so: debug_msg.cc gcctestdir/ld
937 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -shared -fPIC -w -o $@ $(srcdir)/debug_msg.cc
938 odr_violation1.so: odr_violation1.cc gcctestdir/ld
939 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -shared -fPIC -w -o $@ $(srcdir)/odr_violation1.cc
940 odr_violation2.so: odr_violation2.cc gcctestdir/ld
941 $(CXXCOMPILE) -Bgcctestdir/ -O2 -g -shared -fPIC -w -o $@ $(srcdir)/odr_violation2.cc
942 debug_msg_so.err: debug_msg.so odr_violation1.so odr_violation2.so gcctestdir/ld
943 @echo $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_so debug_msg.so odr_violation1.so odr_violation2.so "2>$@"
944 @if $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_so debug_msg.so odr_violation1.so odr_violation2.so 2>$@; \
946 echo 1>&2 "Link of debug_msg_so should have failed"; \
951 # We also want to make sure we do something reasonable when there's no
952 # debug info available. For the best test, we use .so's.
953 check_DATA += debug_msg_ndebug.err
954 MOSTLYCLEANFILES += debug_msg_ndebug.err
955 debug_msg_ndebug.so: debug_msg.cc gcctestdir/ld
956 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g0 -shared -fPIC -w -o $@ $(srcdir)/debug_msg.cc
957 odr_violation1_ndebug.so: odr_violation1.cc gcctestdir/ld
958 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g0 -shared -fPIC -w -o $@ $(srcdir)/odr_violation1.cc
959 odr_violation2_ndebug.so: odr_violation2.cc gcctestdir/ld
960 $(CXXCOMPILE) -Bgcctestdir/ -O2 -g0 -shared -fPIC -w -o $@ $(srcdir)/odr_violation2.cc
961 debug_msg_ndebug.err: debug_msg_ndebug.so odr_violation1_ndebug.so odr_violation2_ndebug.so gcctestdir/ld
962 @echo $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_ndebug debug_msg_ndebug.so odr_violation1_ndebug.so odr_violation2_ndebug.so "2>$@"
963 @if $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_ndebug debug_msg_ndebug.so odr_violation1_ndebug.so odr_violation2_ndebug.so 2>$@; \
965 echo 1>&2 "Link of debug_msg_ndebug should have failed"; \
971 # Similar to --detect-odr-violations: check for undefined symbols in .so's
972 check_SCRIPTS += undef_symbol.sh
973 check_DATA += undef_symbol.err
974 MOSTLYCLEANFILES += undef_symbol.err
975 undef_symbol.o: undef_symbol.cc
976 $(CXXCOMPILE) -O0 -g -c -fPIC $<
977 undef_symbol.so: undef_symbol.o gcctestdir/ld
978 $(CXXLINK) -Bgcctestdir/ -shared undef_symbol.o
979 undef_symbol.err: undef_symbol_main.o undef_symbol.so gcctestdir/ld
980 @echo $(CXXLINK) -Bgcctestdir/ -o undef_symbol_test undef_symbol_main.o undef_symbol.so "2>$@"
981 @if $(CXXLINK) -Bgcctestdir/ -o undef_symbol_test undef_symbol_main.o undef_symbol.so 2>$@; \
983 echo 1>&2 "Link of undef_symbol_test should have failed"; \
989 # Test -o when emitting to a special file (such as something in /dev).
990 check_PROGRAMS += flagstest_o_specialfile
991 flagstest_o_specialfile: flagstest_debug.o gcctestdir/ld
992 $(CXXLINK) -Bgcctestdir/ -o /dev/stdout $< 2>&1 | cat > $@
998 # Test --compress-debug-sections. FIXME: check we actually compress.
999 check_PROGRAMS += flagstest_compress_debug_sections
1000 flagstest_compress_debug_sections: flagstest_debug.o gcctestdir/ld
1001 $(CXXLINK) -Bgcctestdir/ -o $@ $< -Wl,--compress-debug-sections=zlib
1005 # The specialfile output has a tricky case when we also compress debug
1006 # sections, because it requires output-file resizing.
1007 check_PROGRAMS += flagstest_o_specialfile_and_compress_debug_sections
1008 flagstest_o_specialfile_and_compress_debug_sections: flagstest_debug.o \
1010 $(CXXLINK) -Bgcctestdir/ -o /dev/stdout $< -Wl,--compress-debug-sections=zlib 2>&1 | cat > $@
1016 # Test -TText and -Tdata.
1017 check_PROGRAMS += flagstest_o_ttext_1
1018 flagstest_o_ttext_1: flagstest_debug.o gcctestdir/ld
1019 $(CXXLINK) -Bgcctestdir/ -o $@ $< -Wl,-Ttext,0x400000 -Wl,-Tdata,0x800000
1021 # This version won't be runnable, because there is no way to put the
1022 # PT_PHDR segment at file offset 0. We just make sure that we can
1023 # build it without error.
1024 check_DATA += flagstest_o_ttext_2
1025 flagstest_o_ttext_2: flagstest_debug.o gcctestdir/ld
1026 $(CXXLINK) -Bgcctestdir/ -o $@ $< -Wl,-Ttext,0x400010 -Wl,-Tdata,0x800010
1028 # Test symbol versioning.
1029 check_PROGRAMS += ver_test
1030 ver_test_SOURCES = ver_test_main.cc
1031 ver_test_DEPENDENCIES = gcctestdir/ld ver_test_1.so ver_test_2.so ver_test_4.so
1032 ver_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1033 ver_test_LDADD = ver_test_1.so ver_test_2.so ver_test_4.so
1034 ver_test_1.so: ver_test_1.o ver_test_2.so ver_test_3.o ver_test_4.so gcctestdir/ld
1035 $(CXXLINK) -Bgcctestdir/ -shared ver_test_1.o ver_test_2.so ver_test_3.o ver_test_4.so
1036 ver_test_2.so: ver_test_2.o $(srcdir)/ver_test_2.script ver_test_4.so gcctestdir/ld
1037 $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_2.script -Wl,-R,. ver_test_2.o ver_test_4.so
1038 ver_test_4.so: ver_test_4.o $(srcdir)/ver_test_4.script gcctestdir/ld
1039 $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_4.script ver_test_4.o
1040 ver_test_1.o: ver_test_1.cc
1041 $(CXXCOMPILE) -c -fpic -o $@ $<
1042 ver_test_2.o: ver_test_2.cc
1043 $(CXXCOMPILE) -c -fpic -o $@ $<
1044 ver_test_3.o: ver_test_3.cc
1045 $(CXXCOMPILE) -c -fpic -o $@ $<
1046 ver_test_4.o: ver_test_4.cc
1047 $(CXXCOMPILE) -c -fpic -o $@ $<
1049 check_SCRIPTS += ver_test_1.sh
1050 check_DATA += ver_test_1.syms
1051 ver_test_1.syms: ver_test_1.so
1052 $(TEST_READELF) -s $< >$@ 2>/dev/null
1054 check_PROGRAMS += ver_test_2
1055 ver_test_2_SOURCES = ver_test_main_2.cc
1056 ver_test_2_DEPENDENCIES = gcctestdir/ld ver_test_4.so ver_test_2.so
1057 ver_test_2_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1058 ver_test_2_LDADD = ver_test_4.so ver_test_2.so
1060 check_SCRIPTS += ver_test_2.sh
1061 check_DATA += ver_test_2.syms
1062 ver_test_2.syms: ver_test_2
1063 $(TEST_READELF) -s $< >$@ 2>/dev/null
1065 check_SCRIPTS += ver_test_4.sh
1066 check_DATA += ver_test_4.syms
1067 ver_test_4.syms: ver_test_4.so
1068 $(TEST_READELF) -s $< >$@ 2>/dev/null
1070 ver_test_5.so: ver_test_5.o $(srcdir)/ver_test_5.script ver_test_4.so gcctestdir/ld
1071 $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_5.script ver_test_5.o ver_test_4.so
1072 ver_test_5.o: ver_test_5.cc
1073 $(CXXCOMPILE) -c -fpic -o $@ $<
1074 check_SCRIPTS += ver_test_5.sh
1075 check_DATA += ver_test_5.syms
1076 ver_test_5.syms: ver_test_5.so
1077 $(TEST_READELF) -s $< >$@ 2>/dev/null
1079 check_PROGRAMS += ver_test_6
1080 ver_test_6_SOURCES = ver_test_6.c
1081 ver_test_6_DEPENDENCIES = gcctestdir/ld ver_test_2.so
1082 ver_test_6_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1083 ver_test_6_LDADD = ver_test_2.so
1085 ver_test_7.so: ver_test_4.o $(srcdir)/ver_test_4.script ver_test_7.o gcctestdir/ld
1086 $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_4.script ver_test_4.o ver_test_7.o
1087 ver_test_7.o: ver_test_7.cc
1088 $(CXXCOMPILE) -c -fpic -o $@ $<
1089 check_SCRIPTS += ver_test_7.sh
1090 check_DATA += ver_test_7.syms
1091 ver_test_7.syms: ver_test_7.so
1092 $(TEST_READELF) -s $< >$@ 2>/dev/null
1094 check_PROGRAMS += ver_test_8
1095 ver_test_8_SOURCES = two_file_test_main.cc
1096 ver_test_8_DEPENDENCIES = gcctestdir/ld ver_test_8_1.so ver_test_8_2.so
1097 ver_test_8_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1098 ver_test_8_LDADD = ver_test_8_1.so ver_test_8_2.so
1099 ver_test_8_1.so: two_file_test_1_pic.o two_file_test_1b_pic.o ver_test_8_2.so gcctestdir/ld
1100 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1_pic.o two_file_test_1b_pic.o ver_test_8_2.so
1101 ver_test_8_2.so: two_file_test_2_pic.o $(srcdir)/ver_test_8.script gcctestdir/ld
1102 $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_8.script two_file_test_2_pic.o
1104 check_PROGRAMS += ver_test_9
1105 ver_test_9_SOURCES = ver_test_main.cc
1106 ver_test_9_DEPENDENCIES = gcctestdir/ld ver_test_9.so
1107 ver_test_9_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1108 ver_test_9_LDADD = ver_test_9.so
1109 ver_test_9.so: ver_test_9.o ver_test_4.so ver_test_5.so gcctestdir/ld
1110 $(CXXLINK) -Bgcctestdir/ -shared -Wl,-R,. ver_test_9.o ver_test_5.so ver_test_4.so
1111 ver_test_9.o: ver_test_9.cc
1112 $(CXXCOMPILE) -c -fpic -o $@ $<
1114 check_SCRIPTS += ver_test_10.sh
1115 check_DATA += ver_test_10.syms
1116 ver_test_10.syms: ver_test_10.so
1117 $(TEST_READELF) -s $< >$@ 2>/dev/null
1118 ver_test_10.so: gcctestdir/ld ver_test_2.o ver_test_10.script
1119 $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_10.script ver_test_2.o
1121 check_PROGRAMS += ver_test_11
1122 MOSTLYCLEANFILES += ver_test_11.a
1123 ver_test_11_SOURCES = ver_test_main_2.cc
1124 ver_test_11_DEPENDENCIES = gcctestdir/ld ver_test_11.a
1125 ver_test_11_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1126 ver_test_11_LDADD = ver_test_11.a
1127 ver_test_11.a: ver_test_1.o ver_test_2.o ver_test_4.o
1130 check_PROGRAMS += ver_test_12
1131 ver_test_12_SOURCES = ver_test_main_2.cc
1132 ver_test_12_DEPENDENCIES = gcctestdir/ld ver_test_12.o
1133 ver_test_12_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1134 ver_test_12_LDADD = ver_test_12.o
1135 ver_test_12.o: gcctestdir/ld ver_test_1.o ver_test_2.o ver_test_4.o
1136 gcctestdir/ld -r -o $@ ver_test_1.o ver_test_2.o ver_test_4.o
1138 check_PROGRAMS += protected_1
1139 protected_1_SOURCES = \
1140 protected_main_1.cc protected_main_2.cc protected_main_3.cc
1141 protected_1_DEPENDENCIES = gcctestdir/ld protected_1.so
1142 protected_1_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1143 protected_1_LDADD = protected_1.so
1145 protected_1.so: gcctestdir/ld protected_1_pic.o protected_2_pic.o protected_3_pic.o
1146 $(CXXLINK) -Bgcctestdir/ -shared protected_1_pic.o protected_2_pic.o protected_3_pic.o
1147 protected_1_pic.o: protected_1.cc
1148 $(CXXCOMPILE) -c -fpic -o $@ $<
1149 protected_2_pic.o: protected_2.cc
1150 $(CXXCOMPILE) -c -fpic -o $@ $<
1151 protected_3_pic.o: protected_3.cc
1152 $(CXXCOMPILE) -c -fpic -o $@ $<
1154 check_PROGRAMS += protected_2
1155 protected_2_SOURCES = protected_main_1.cc protected_3.cc
1156 protected_2_DEPENDENCIES = gcctestdir/ld protected_1.so
1157 protected_2_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1158 protected_2_LDADD = protected_1.so
1160 check_DATA += protected_3.err
1161 MOSTLYCLEANFILES += protected_3.err
1162 protected_4_pic.o: protected_4.cc
1163 $(CXXCOMPILE) -c -fpic -o $@ $<
1164 protected_3.err: protected_4_pic.o gcctestdir/ld
1165 @echo $(CXXLINK) -Bgcctestdir/ -shared -o protected_4.so protected_4_pic.o "2>$@"
1166 @if $(CXXLINK) -Bgcctestdir/ -shared -o protected_4.so protected_4_pic.o 2>$@; then \
1167 echo 1>&2 "Link of protected_4.so should have failed"; \
1172 check_PROGRAMS += relro_test
1173 check_SCRIPTS += relro_test.sh
1174 check_DATA += relro_test.stdout
1175 relro_test_SOURCES = relro_test_main.cc
1176 relro_test_DEPENDENCIES = gcctestdir/ld relro_test.so
1177 relro_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1178 relro_test_LDADD = relro_test.so
1179 relro_test.so: gcctestdir/ld relro_test_pic.o
1180 $(CXXLINK) -Bgcctestdir/ -shared -Wl,-z,relro relro_test_pic.o
1181 relro_test_pic.o: relro_test.cc
1182 $(CXXCOMPILE) -c -fpic -o $@ $<
1183 relro_test.stdout: relro_test.so
1184 $(TEST_READELF) -SlW relro_test.so > relro_test.stdout
1186 check_PROGRAMS += relro_now_test
1187 relro_now_test_SOURCES = relro_test_main.cc
1188 relro_now_test_DEPENDENCIES = gcctestdir/ld relro_now_test.so
1189 relro_now_test_LDFLAGS = -Bgcctestdir -Wl,-R,. -Wl,-z,relro -Wl,-z,now
1190 relro_now_test_LDADD = relro_now_test.so
1191 relro_now_test.so: gcctestdir/ld relro_test_pic.o
1192 $(CXXLINK) -Bgcctestdir/ -shared -Wl,-z,relro -Wl,-z,now relro_test_pic.o
1194 check_PROGRAMS += relro_strip_test
1195 relro_strip_test_SOURCES = relro_test_main.cc
1196 relro_strip_test_DEPENDENCIES = gcctestdir/ld relro_strip_test.so
1197 relro_strip_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1198 relro_strip_test_LDADD = relro_strip_test.so
1199 relro_strip_test.so: relro_test.so
1200 $(TEST_STRIP) -o $@ $<
1202 check_PROGRAMS += relro_script_test
1203 relro_script_test_SOURCES = relro_test_main.cc
1204 relro_script_test_DEPENDENCIES = gcctestdir/ld relro_script_test.so
1205 relro_script_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1206 relro_script_test_LDADD = relro_script_test.so
1207 relro_script_test.so: gcctestdir/ld relro_script_test.t relro_test_pic.o
1208 $(CXXLINK) -Bgcctestdir/ -shared -Wl,-z,relro -T $(srcdir)/relro_script_test.t relro_test_pic.o
1210 check_PROGRAMS += script_test_1
1211 script_test_1_SOURCES = script_test_1.cc
1212 script_test_1_DEPENDENCIES = gcctestdir/ld script_test_1.t
1213 script_test_1_LDFLAGS = -Bgcctestdir/ -Wl,-R,. -T $(srcdir)/script_test_1.t
1214 script_test_1_LDADD =
1216 check_PROGRAMS += script_test_2
1217 script_test_2_SOURCES = script_test_2.cc script_test_2a.cc script_test_2b.cc
1218 script_test_2_DEPENDENCIES = gcctestdir/ld script_test_2.t
1219 script_test_2_LDFLAGS = -Bgcctestdir/ -Wl,-R,. -T $(srcdir)/script_test_2.t
1220 script_test_2_LDADD =
1222 check_PROGRAMS += justsyms
1223 justsyms_SOURCES = justsyms_1.cc
1224 justsyms_DEPENDENCIES = gcctestdir/ld justsyms_2r.o
1225 justsyms_LDFLAGS = -Bgcctestdir/ -Wl,-R,justsyms_2r.o
1227 justsyms_2.o: justsyms_2.cc
1228 $(CXXCOMPILE) -c -o $@ $<
1229 justsyms_2r.o: justsyms_2.o gcctestdir/ld $(srcdir)/justsyms.t
1230 gcctestdir/ld -o $@ -r -T $(srcdir)/justsyms.t justsyms_2.o
1232 check_PROGRAMS += justsyms_exec
1233 justsyms_exec_SOURCES = justsyms_exec.c
1234 justsyms_exec_DEPENDENCIES = gcctestdir/ld justsyms_lib
1235 justsyms_exec_LDFLAGS = -Bgcctestdir/ -Wl,-R,justsyms_lib
1236 justsyms_exec_LDADD =
1237 justsyms_lib.o: justsyms_lib.c
1238 $(COMPILE) -c -o $@ $<
1239 justsyms_lib: justsyms_lib.o gcctestdir/ld
1240 gcctestdir/ld -o $@ -Ttext=0x1000200 -Tdata=0x2000000 -e exported_func justsyms_lib.o
1242 check_PROGRAMS += binary_test
1243 MOSTLYCLEANFILES += binary.txt
1244 binary_test_SOURCES = binary_test.cc
1245 binary_test_DEPENDENCIES = gcctestdir/ld binary.txt
1246 binary_test_LDFLAGS = -Bgcctestdir/ -Wl,--format,binary,binary.txt,--format,elf
1248 # Copy the file to the build directory to avoid worrying about the
1249 # full pathname in the generated symbols.
1250 binary.txt: $(srcdir)/binary.in
1254 check_SCRIPTS += ver_matching_test.sh
1255 check_DATA += ver_matching_test.stdout
1256 MOSTLYCLEANFILES += ver_matching_test.stdout
1257 ver_matching_def.so: ver_matching_def_pic.o $(srcdir)/version_script.map gcctestdir/ld
1258 $(CXXLINK) -O0 -Bgcctestdir/ -shared ver_matching_def_pic.o -Wl,--version-script=$(srcdir)/version_script.map
1259 ver_matching_def_pic.o: ver_matching_def.cc
1260 $(CXXCOMPILE) -O0 -c -fpic -o $@ $<
1261 ver_matching_test.stdout: ver_matching_def.so
1262 $(TEST_OBJDUMP) -T ver_matching_def.so | $(TEST_CXXFILT) > ver_matching_test.stdout
1264 check_PROGRAMS += script_test_3
1265 check_SCRIPTS += script_test_3.sh
1266 check_DATA += script_test_3.stdout
1267 MOSTLYCLEANFILES += script_test_3.stdout
1268 script_test_3: basic_test.o gcctestdir/ld script_test_3.t
1269 $(CXXLINK) -Bgcctestdir/ basic_test.o -T $(srcdir)/script_test_3.t
1270 script_test_3.stdout: script_test_3
1271 $(TEST_READELF) -SlW script_test_3 > script_test_3.stdout
1273 check_PROGRAMS += tls_phdrs_script_test
1274 tls_phdrs_script_test_SOURCES = $(tls_test_SOURCES)
1275 tls_phdrs_script_test_DEPENDENCIES = $(tls_test_DEPENDENCIES) $(srcdir)/script_test_3.t
1276 tls_phdrs_script_test_LDFLAGS = $(tls_test_LDFLAGS) -T $(srcdir)/script_test_3.t
1277 tls_phdrs_script_test_LDADD = $(tls_test_LDADD)
1279 check_SCRIPTS += script_test_4.sh
1280 check_DATA += script_test_4.stdout
1281 MOSTLYCLEANFILES += script_test_4
1282 script_test_4: basic_test.o gcctestdir/ld $(srcdir)/script_test_4.t
1283 $(CXXLINK) -Bgcctestdir/ basic_test.o -T $(srcdir)/script_test_4.t
1284 script_test_4.stdout: script_test_4
1285 $(TEST_READELF) -SlW script_test_4 > script_test_4.stdout
1287 check_PROGRAMS += tls_script_test
1288 tls_script_test_SOURCES = $(tls_test_SOURCES)
1289 tls_script_test_DEPENDENCIES = $(tls_test_DEPENDENCIES) $(srcdir)/script_test_4.t
1290 tls_script_test_LDFLAGS = $(tls_test_LDFLAGS) -T $(srcdir)/script_test_4.t
1291 tls_script_test_LDADD = $(tls_test_LDADD)
1293 check_SCRIPTS += script_test_5.sh
1294 check_DATA += script_test_5.stdout
1295 MOSTLYCLEANFILES += script_test_5
1296 script_test_5: script_test_5.o gcctestdir/ld $(srcdir)/script_test_5.t
1297 $(CXXLINK) -Bgcctestdir/ script_test_5.o -T $(srcdir)/script_test_5.t
1298 script_test_5.stdout: script_test_5
1299 $(TEST_READELF) -SW script_test_5 > script_test_5.stdout
1301 check_SCRIPTS += script_test_6.sh
1302 check_DATA += script_test_6.stdout
1303 MOSTLYCLEANFILES += script_test_6
1304 script_test_6: basic_test.o gcctestdir/ld $(srcdir)/script_test_6.t
1305 $(CXXLINK) -Bgcctestdir/ basic_test.o -T $(srcdir)/script_test_6.t \
1306 -Wl,-Ttext=0x10001000 -Wl,-Tdata=0x10200000 -Wl,-Tbss=0x10400000
1307 script_test_6.stdout: script_test_6
1308 $(TEST_READELF) -SlW script_test_6 > script_test_6.stdout
1310 check_SCRIPTS += script_test_7.sh
1311 check_DATA += script_test_7.stdout
1312 MOSTLYCLEANFILES += script_test_7
1313 script_test_7: basic_test.o gcctestdir/ld $(srcdir)/script_test_7.t
1314 $(CXXLINK) -Bgcctestdir/ basic_test.o -T $(srcdir)/script_test_7.t
1315 script_test_7.stdout: script_test_7
1316 $(TEST_READELF) -SlW script_test_7 > script_test_7.stdout
1318 check_SCRIPTS += script_test_8.sh
1319 check_DATA += script_test_8.stdout
1320 MOSTLYCLEANFILES += script_test_8
1321 script_test_8: basic_test.o gcctestdir/ld $(srcdir)/script_test_7.t
1322 $(CXXLINK) -Bgcctestdir/ basic_test.o -T $(srcdir)/script_test_7.t \
1323 -Wl,-Ttext=0x20001000 -Wl,-Tdata=0x20200000 -Wl,-Tbss=0x20400000
1324 script_test_8.stdout: script_test_8
1325 $(TEST_READELF) -SlW script_test_8 > script_test_8.stdout
1328 check_SCRIPTS += script_test_9.sh
1329 check_DATA += script_test_9.stdout
1330 script_test_9.o: script_test_9.cc
1331 $(CXXCOMPILE) -O0 -c -o $@ $<
1332 script_test_9: gcctestdir/ld $(srcdir)/script_test_9.t script_test_9.o
1333 $(CXXLINK) -Bgcctestdir/ script_test_9.o -T $(srcdir)/script_test_9.t
1334 script_test_9.stdout: script_test_9
1335 $(TEST_READELF) -lW script_test_9 > script_test_9.stdout
1338 # Test --dynamic-list, --dynamic-list-data, --dynamic-list-cpp-new,
1339 # and --dynamic-list-cpp-typeinfo
1341 check_SCRIPTS += dynamic_list.sh
1342 check_DATA += dynamic_list.stdout
1343 MOSTLYCLEANFILES += dynamic_list dynamic_list.stdout
1344 dynamic_list: basic_test.o gcctestdir/ld $(srcdir)/dynamic_list.t
1345 $(CXXLINK) -Bgcctestdir/ basic_test.o \
1346 -Wl,--dynamic-list $(srcdir)/dynamic_list.t \
1347 -Wl,--dynamic-list-data \
1348 -Wl,--dynamic-list-cpp-new \
1349 -Wl,--dynamic-list-cpp-typeinfo
1350 dynamic_list.stdout: dynamic_list
1351 $(TEST_READELF) -W --dyn-syms dynamic_list > dynamic_list.stdout
1353 check_PROGRAMS += thin_archive_test_1
1354 MOSTLYCLEANFILES += libthin1.a libthin3.a libthinall.a \
1355 alt/thin_archive_test_2.o alt/thin_archive_test_4.o \
1356 alt/libthin2.a alt/libthin4.a
1357 thin_archive_test_1_SOURCES = thin_archive_main.cc
1358 thin_archive_test_1_DEPENDENCIES = gcctestdir/ld libthin1.a alt/libthin2.a
1359 thin_archive_test_1_LDFLAGS = -Bgcctestdir/ -Lalt
1360 thin_archive_test_1_LDADD = libthin1.a -lthin2
1362 check_PROGRAMS += thin_archive_test_2
1363 thin_archive_test_2_SOURCES = thin_archive_main.cc
1364 thin_archive_test_2_DEPENDENCIES = gcctestdir/ld libthinall.a
1365 thin_archive_test_2_LDFLAGS = -Bgcctestdir/ -L.
1366 thin_archive_test_2_LDADD = -lthinall
1368 libthin1.a: thin_archive_test_1.o alt/thin_archive_test_2.o
1370 $(TEST_AR) crT $@ $^
1371 alt/libthin2.a: thin_archive_test_3.o alt/thin_archive_test_4.o
1373 $(TEST_AR) crT $@ $^
1374 libthin3.a: thin_archive_test_1.o alt/thin_archive_test_4.o
1376 $(TEST_AR) crT $@ $^
1377 alt/libthin4.a: alt/thin_archive_test_2.o thin_archive_test_3.o
1379 $(TEST_AR) crT $@ $^
1380 libthinall.a: libthin3.a alt/libthin4.a
1382 $(TEST_AR) crT $@ $^
1383 alt/thin_archive_test_2.o: thin_archive_test_2.cc
1384 test -d alt || mkdir -p alt
1385 $(CXXCOMPILE) -c -o $@ $<
1386 alt/thin_archive_test_4.o: thin_archive_test_4.cc
1387 test -d alt || mkdir -p alt
1388 $(CXXCOMPILE) -c -o $@ $<
1392 check_PROGRAMS += plugin_test_1
1393 check_SCRIPTS += plugin_test_1.sh
1394 check_DATA += plugin_test_1.err
1395 MOSTLYCLEANFILES += plugin_test_1.err
1396 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
1397 $(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
1398 plugin_test_1.err: plugin_test_1
1399 @touch plugin_test_1.err
1401 check_PROGRAMS += plugin_test_2
1402 check_SCRIPTS += plugin_test_2.sh
1403 check_DATA += plugin_test_2.err
1404 MOSTLYCLEANFILES += plugin_test_2.err
1405 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
1406 $(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
1407 plugin_test_2.err: plugin_test_2
1408 @touch plugin_test_2.err
1410 check_PROGRAMS += plugin_test_3
1411 check_SCRIPTS += plugin_test_3.sh
1412 check_DATA += plugin_test_3.err
1413 MOSTLYCLEANFILES += plugin_test_3.err
1414 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
1415 $(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
1416 plugin_test_3.err: plugin_test_3
1417 @touch plugin_test_3.err
1419 check_PROGRAMS += plugin_test_4
1420 check_SCRIPTS += plugin_test_4.sh
1421 check_DATA += plugin_test_4.err
1422 MOSTLYCLEANFILES += plugin_test_4.a plugin_test_4.err
1423 plugin_test_4: two_file_test_main.o plugin_test_4.a gcctestdir/ld plugin_test.so
1424 $(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
1425 plugin_test_4.err: plugin_test_4
1426 @touch plugin_test_4.err
1428 plugin_test_4.a: two_file_test_1.syms two_file_test_1b.syms two_file_test_2.syms
1431 check_PROGRAMS += plugin_test_5
1432 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
1433 $(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
1435 check_PROGRAMS += plugin_test_6
1436 check_SCRIPTS += plugin_test_6.sh
1437 check_DATA += plugin_test_6.err
1438 MOSTLYCLEANFILES += plugin_test_6.err
1439 plugin_test_6: plugin_common_test_1.syms plugin_common_test_2.syms gcctestdir/ld plugin_test.so
1440 $(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle,--plugin,"./plugin_test.so" plugin_common_test_1.syms plugin_common_test_2.syms 2>plugin_test_6.err
1441 plugin_test_6.err: plugin_test_6
1442 @touch plugin_test_6.err
1444 check_PROGRAMS += plugin_test_7
1445 check_SCRIPTS += plugin_test_7.sh
1446 check_DATA += plugin_test_7.err plugin_test_7.syms
1447 MOSTLYCLEANFILES += plugin_test_7.err
1448 plugin_test_7: plugin_test_7_1.o plugin_test_7_1.syms plugin_test_7_2.o gcctestdir/ld plugin_test.so
1449 $(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
1450 plugin_test_7.syms: plugin_test_7
1451 $(TEST_READELF) -sW $< >$@ 2>/dev/null
1452 plugin_test_7_1.o: plugin_test_7_1.c
1453 $(COMPILE) -DLTO -O0 -c -ffunction-sections -fdata-sections -o $@ $<
1454 plugin_test_7_1_orig.o: plugin_test_7_1.c
1455 $(COMPILE) -O0 -c -ffunction-sections -fdata-sections -o $@ $<
1456 plugin_test_7_1.syms: plugin_test_7_1_orig.o
1457 $(TEST_READELF) -sW $< >$@ 2>/dev/null
1458 plugin_test_7_2.o: plugin_test_7_2.c
1459 $(COMPILE) -O0 -c -ffunction-sections -fdata-sections -o $@ $<
1460 plugin_test_7.err: plugin_test_7
1462 # Test plugins with -r.
1463 check_PROGRAMS += plugin_test_8
1464 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
1465 ../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
1466 plugin_test_8: plugin_test_8.o gcctestdir/ld
1467 $(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle plugin_test_8.o
1469 # Test that symbols known in the IR file but not in the replacement file
1470 # produce an unresolved symbol error.
1471 check_DATA += plugin_test_9.err
1472 MOSTLYCLEANFILES += plugin_test_9.err
1473 plugin_test_9.err: two_file_test_main.o two_file_test_1c.syms two_file_test_2.syms gcctestdir/ld plugin_test.so
1474 @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>$@"
1475 @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 \
1476 echo 1>&2 "Link of plugin_test_9 should have failed"; \
1480 # Make a .syms file that claims to define the symbol _Z4t16av.
1481 two_file_test_1c.syms: two_file_test_1.syms two_file_test_1c.o
1482 cp two_file_test_1.syms $@.tmp
1483 grep "_Z4t16av" two_file_test_1b.syms >> $@.tmp
1485 # Make a copy of two_file_test_1.o, which does not define the symbol _Z4t16av.
1486 MOSTLYCLEANFILES += two_file_test_1c.o
1487 two_file_test_1c.o: two_file_test_1.o
1488 cp two_file_test_1.o $@
1490 plugin_test.so: plugin_test.o
1491 $(LINK) -Bgcctestdir/ -shared plugin_test.o
1492 plugin_test.o: plugin_test.c
1493 $(COMPILE) -O0 -c -fpic -o $@ $<
1495 two_file_test_main.syms: two_file_test_main.o
1496 $(TEST_READELF) -sW $< >$@ 2>/dev/null
1497 two_file_test_1.syms: two_file_test_1.o
1498 $(TEST_READELF) -sW $< >$@ 2>/dev/null
1499 two_file_test_1b.syms: two_file_test_1b.o
1500 $(TEST_READELF) -sW $< >$@ 2>/dev/null
1501 two_file_test_2.syms: two_file_test_2.o
1502 $(TEST_READELF) -sW $< >$@ 2>/dev/null
1503 plugin_common_test_1.syms: plugin_common_test_1.o
1504 $(TEST_READELF) -sW $< >$@ 2>/dev/null
1505 plugin_common_test_2.syms: plugin_common_test_2.o
1506 $(TEST_READELF) -sW $< >$@ 2>/dev/null
1510 @echo "Symbol table" >>$@
1512 MOSTLYCLEANFILES += unused.c
1513 unused.syms: unused.o
1514 $(TEST_READELF) -sW $< >$@ 2>/dev/null
1515 @echo " 1: 00000000 4 FUNC GLOBAL DEFAULT 1 UNUSED" >>$@
1517 $(COMPILE) -c -o $@ $<
1521 check_SCRIPTS += plugin_final_layout.sh
1522 check_DATA += plugin_final_layout.stdout
1523 plugin_final_layout.o: plugin_final_layout.cc
1524 $(CXXCOMPILE) -O0 -c -ffunction-sections -fdata-sections -g -o $@ $<
1525 plugin_final_layout: plugin_final_layout.o plugin_section_order.so gcctestdir/ld
1526 $(CXXLINK) -Bgcctestdir/ -Wl,--plugin,"./plugin_section_order.so" plugin_final_layout.o
1527 plugin_final_layout.stdout: plugin_final_layout
1528 $(TEST_NM) -n plugin_final_layout > plugin_final_layout.stdout
1530 plugin_section_order.so: plugin_section_order.o
1531 $(LINK) -Bgcctestdir/ -shared plugin_section_order.o
1532 plugin_section_order.o: plugin_section_order.c
1533 $(COMPILE) -O0 -c -fpic -o $@ $<
1537 check_PROGRAMS += exclude_libs_test
1538 check_SCRIPTS += exclude_libs_test.sh
1539 check_DATA += exclude_libs_test.syms
1540 MOSTLYCLEANFILES += exclude_libs_test.syms libexclude_libs_test_1.a \
1541 libexclude_libs_test_2.a alt/libexclude_libs_test_3.a
1542 exclude_libs_test_SOURCES = exclude_libs_test.c
1543 exclude_libs_test_DEPENDENCIES = gcctestdir/ld libexclude_libs_test_1.a \
1544 libexclude_libs_test_2.a alt/libexclude_libs_test_3.a
1545 exclude_libs_test_LDFLAGS = -Bgcctestdir/ -L. -Lalt \
1546 -Wl,--exclude-libs,dummy:libexclude_libs_test_1 \
1547 -Wl,--exclude-libs,libexclude_libs_test_3
1548 exclude_libs_test_LDADD = -lexclude_libs_test_1 -lexclude_libs_test_2 \
1549 alt/libexclude_libs_test_3.a
1550 exclude_libs_test.syms: exclude_libs_test
1551 $(TEST_READELF) -sW $< >$@ 2>/dev/null
1552 libexclude_libs_test_1.a: exclude_libs_test_1.o
1554 libexclude_libs_test_2.a: exclude_libs_test_2.o
1556 alt/libexclude_libs_test_3.a: exclude_libs_test_3.o
1557 test -d alt || mkdir -p alt
1560 check_PROGRAMS += local_labels_test
1561 local_labels_test.o: ver_test_6.c
1562 $(COMPILE) -g -c -Wa,-L -o $@ $<
1563 local_labels_test: local_labels_test.o
1564 $(LINK) -Bgcctestdir/ local_labels_test.o
1566 check_PROGRAMS += discard_locals_test
1567 check_SCRIPTS += discard_locals_test.sh
1568 check_DATA += discard_locals_test.syms \
1569 discard_locals_relocatable_test1.syms \
1570 discard_locals_relocatable_test2.syms
1571 MOSTLYCLEANFILES += discard_locals_test.syms \
1572 discard_locals_relocatable_test1.syms \
1573 discard_locals_relocatable_test2.syms \
1574 discard_locals_relocatable_test1.out \
1575 discard_locals_relocatable_test2.out
1576 discard_locals_test_SOURCES = discard_locals_test.c
1577 discard_locals_test_LDFLAGS = -Bgcctestdir/ -Wl,--discard-locals
1578 discard_locals_test.syms: discard_locals_test
1579 $(TEST_READELF) -sW $< >$@ 2>/dev/null
1580 # '-Wa,-L' is required to preserve the local label used for testing.
1581 discard_locals_test.o: discard_locals_test.c
1582 $(COMPILE) -c -Wa,-L -o $@ $<
1584 discard_locals_relocatable_test1.syms: discard_locals_relocatable_test1.out
1585 $(TEST_READELF) -sW $< >$@ 2>/dev/null
1586 discard_locals_relocatable_test.o: discard_locals_relocatable_test.c
1587 $(COMPILE) -c -Wa,-L -fPIC -o $@ $<
1588 discard_locals_relocatable_test1.out: discard_locals_relocatable_test.o ../ld-new
1589 ../ld-new --discard-locals -relocatable -o $@ $<
1591 discard_locals_relocatable_test2.syms: discard_locals_relocatable_test2.out
1592 $(TEST_READELF) -sW $< >$@ 2>/dev/null
1593 discard_locals_relocatable_test2.out: discard_locals_relocatable_test.o ../ld-new
1594 ../ld-new --discard-all -relocatable -o $@ $<
1597 check_PROGRAMS += large
1598 large_SOURCES = large.c
1599 large_CFLAGS = -mcmodel=medium
1600 large_DEPENDENCIES = gcctestdir/ld
1601 large_LDFLAGS = -Bgcctestdir/
1603 endif MCMODEL_MEDIUM
1605 # Test that hidden and internal symbols in the main program cannot be
1606 # referenced by a shared library.
1607 check_SCRIPTS += hidden_test.sh
1608 check_DATA += hidden_test.err
1609 MOSTLYCLEANFILES += hidden_test hidden_test.err
1610 libhidden.so: hidden_test_1.c gcctestdir/ld
1611 $(COMPILE) -Bgcctestdir/ -g -shared -fPIC -w -o $@ $(srcdir)/hidden_test_1.c
1612 hidden_test: hidden_test_main.o libhidden.so gcctestdir/ld
1613 $(LINK) -Bgcctestdir/ -Wl,-R,. hidden_test_main.o libhidden.so 2>hidden_test.err
1614 hidden_test.err: hidden_test
1615 @touch hidden_test.err
1617 # Test -retain-symbols-file.
1618 check_SCRIPTS += retain_symbols_file_test.sh
1619 check_DATA += retain_symbols_file_test.stdout
1620 MOSTLYCLEANFILES += retain_symbols_file_test retain_symbols_file_test.in \
1621 retain_symbols_file_test.stdout
1622 retain_symbols_file_test.so: basic_pic_test.o gcctestdir/ld
1623 echo 'main' > retain_symbols_file_test.in
1624 echo 't1' >> retain_symbols_file_test.in
1625 echo '_ZN4t16bC1Ev' >> retain_symbols_file_test.in
1626 echo '_ZNK4t20a3getEv' >> retain_symbols_file_test.in
1627 echo '_Z3t18v' >> retain_symbols_file_test.in
1628 echo '__tcf_0' >> retain_symbols_file_test.in
1629 $(CXXLINK) -Bgcctestdir/ -shared -Wl,-retain-symbols-file,retain_symbols_file_test.in basic_pic_test.o
1630 retain_symbols_file_test.stdout: retain_symbols_file_test.so
1631 $(TEST_NM) -C retain_symbols_file_test.so > $@
1634 # Test that if the output file already exists and is empty,
1635 # it will get execute permission.
1636 check_PROGRAMS += permission_test
1637 permission_test: basic_test.o gcctestdir/ld
1642 $(CXXLINK) -Bgcctestdir/ basic_test.o
1645 check_PROGRAMS += searched_file_test
1646 MOSTLYCLEANFILES += searched_file_test searched_file_test_lib.o \
1647 alt/searched_file_test_lib.a
1648 searched_file_test_SOURCES = searched_file_test.cc
1649 searched_file_test_DEPENDENCIES = alt/searched_file_test_lib.a
1650 searched_file_test_LDFLAGS = -Bgcctestdir/ -Lalt
1651 searched_file_test_LDADD = -l:searched_file_test_lib.a
1652 searched_file_test_lib.o: searched_file_test_lib.cc
1653 $(CXXCOMPILE) -c -o $@ $<
1654 alt/searched_file_test_lib.a: searched_file_test_lib.o
1655 test -d alt || mkdir -p alt
1658 # Test that no .gnu.version sections are created when
1659 # symbol versioning is not used.
1660 check_SCRIPTS += no_version_test.sh
1661 check_DATA += no_version_test.stdout
1662 MOSTLYCLEANFILES += libno_version_test.so no_version_test.stdout
1663 # We invoke the linker directly since gcc may include additional objects that
1664 # uses symbol versioning.
1665 libno_version_test.so: no_version_test.o gcctestdir/ld
1666 gcctestdir/ld -shared -o $@ no_version_test.o
1667 no_version_test.o: no_version_test.c
1668 $(COMPILE) -o $@ -c -fPIC $<
1669 no_version_test.stdout: libno_version_test.so
1670 $(TEST_OBJDUMP) -h $< > $@
1672 # Test STT_GNU_IFUNC symbols.
1675 ifuncmod1.o: ifuncmod1.c
1676 $(COMPILE) -c -fPIC -o $@ $<
1677 ifuncmod1.so: ifuncmod1.o gcctestdir/ld
1678 $(LINK) -Bgcctestdir/ -shared ifuncmod1.o
1680 ifuncdep1.o: ifuncmod1.c
1681 $(COMPILE) -c -o $@ $<
1683 ifuncmain1pic.o: ifuncmain1.c
1684 $(COMPILE) -c -fPIC -o $@ $<
1685 ifuncmain1pie.o: ifuncmain1.c
1686 $(COMPILE) -c -fPIE -o $@ $<
1690 check_PROGRAMS += ifuncmain1static
1691 ifuncmain1static_SOURCES = ifuncmain1.c
1692 ifuncmain1static_DEPENDENCIES = gcctestdir/ld ifuncdep1.o
1693 ifuncmain1static_LDFLAGS = -Bgcctestdir/ -static
1694 ifuncmain1static_LDADD = ifuncdep1.o
1696 check_PROGRAMS += ifuncmain1picstatic
1697 ifuncmain1picstatic: ifuncmain1pic.o ifuncmod1.o gcctestdir/ld
1698 $(LINK) -Bgcctestdir/ -static ifuncmain1pic.o ifuncmod1.o
1702 check_PROGRAMS += ifuncmain1
1703 ifuncmain1_SOURCES = ifuncmain1.c
1704 ifuncmain1_DEPENDENCIES = gcctestdir/ld ifuncmod1.so
1705 ifuncmain1_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1706 ifuncmain1_LDADD = ifuncmod1.so
1708 check_PROGRAMS += ifuncmain1pic
1709 ifuncmain1pic: ifuncmain1pic.o ifuncmod1.so gcctestdir/ld
1710 $(LINK) -Bgcctestdir/ ifuncmain1pic.o ifuncmod1.so -Wl,-R,.
1712 check_PROGRAMS += ifuncmain1vis
1713 ifuncmain1vis_SOURCES = ifuncmain1vis.c
1714 ifuncmain1vis_DEPENDENCIES = gcctestdir/ld ifuncmod1.so
1715 ifuncmain1vis_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1716 ifuncmain1vis_LDADD = ifuncmod1.so
1718 check_PROGRAMS += ifuncmain1vispic
1719 ifuncmain1vispic.o: ifuncmain1vis.c
1720 $(COMPILE) -c -fPIC -o $@ $<
1721 ifuncmain1vispic: ifuncmain1vispic.o ifuncmod1.so gcctestdir/ld
1722 $(LINK) -Bgcctestdir/ ifuncmain1pic.o ifuncmod1.so -Wl,-R,.
1724 check_PROGRAMS += ifuncmain1staticpic
1725 ifuncmain1staticpic: ifuncmain1pic.o ifuncmod1.o gcctestdir/ld
1726 $(LINK) -Bgcctestdir/ ifuncmain1pic.o ifuncmod1.o
1728 check_PROGRAMS += ifuncmain1pie
1729 ifuncmain1pie: ifuncmain1pie.o ifuncmod1.so gcctestdir/ld
1730 $(LINK) -Bgcctestdir/ -pie ifuncmain1pie.o ifuncmod1.so -Wl,-R,.
1732 check_PROGRAMS += ifuncmain1vispie
1733 ifuncmain1vispie.o: ifuncmain1vis.c
1734 $(COMPILE) -c -fPIE -o $@ $<
1735 ifuncmain1vispie: ifuncmain1vispie.o ifuncmod1.so gcctestdir/ld
1736 $(LINK) -Bgcctestdir/ -pie ifuncmain1vispie.o ifuncmod1.so -Wl,-R,.
1738 check_PROGRAMS += ifuncmain1staticpie
1739 ifuncmain1staticpie: ifuncmain1pie.o ifuncmod1.o gcctestdir/ld
1740 $(LINK) -Bgcctestdir/ -pie ifuncmain1pie.o ifuncmod1.o
1742 ifuncmain2pic.o: ifuncmain2.c
1743 $(COMPILE) -c -fPIC -o $@ $<
1745 ifuncdep2pic.o: ifuncdep2.c
1746 $(COMPILE) -c -fPIC -o $@ $<
1750 check_PROGRAMS += ifuncmain2static
1751 ifuncmain2static_SOURCES = ifuncmain2.c ifuncdep2.c
1752 ifuncmain2static_DEPENDENCIES = gcctestdir/ld
1753 ifuncmain2static_LDFLAGS = -Bgcctestdir/ -static
1754 ifuncmain2static_LDADD =
1756 check_PROGRAMS += ifuncmain2picstatic
1757 ifuncmain2picstatic: ifuncmain2pic.o ifuncdep2pic.o gcctestdir/ld
1758 $(LINK) -Bgcctestdir/ -static ifuncmain2pic.o ifuncdep2pic.o
1762 check_PROGRAMS += ifuncmain2
1763 ifuncmain2_SOURCES = ifuncmain2.c ifuncdep2.c
1764 ifuncmain2_DEPENDENCIES = gcctestdir/ld
1765 ifuncmain2_LDFLAGS = -Bgcctestdir/
1768 check_PROGRAMS += ifuncmain2pic
1769 ifuncmain2pic: ifuncmain2pic.o ifuncdep2pic.o gcctestdir/ld
1770 $(LINK) -Bgcctestdir/ ifuncmain2pic.o ifuncdep2pic.o
1772 ifuncmod3.o: ifuncmod3.c
1773 $(COMPILE) -c -fPIC -o $@ $<
1774 ifuncmod3.so: ifuncmod3.o gcctestdir/ld
1775 $(LINK) -Bgcctestdir/ -shared ifuncmod3.o
1777 check_PROGRAMS += ifuncmain3
1778 ifuncmain3_SOURCES = ifuncmain3.c
1779 ifuncmain3_DEPENDENCIES = gcctestdir/ld ifuncmod3.so
1780 ifuncmain3_LDFLAGS = -Bgcctestdir/ -Wl,--export-dynamic -Wl,-R,.
1781 ifuncmain3_LDADD = -ldl
1783 ifuncmain4pic.o: ifuncmain4.c
1784 $(COMPILE) -c -fPIC -o $@ $<
1788 check_PROGRAMS += ifuncmain4static
1789 ifuncmain4static_SOURCES = ifuncmain4.c
1790 ifuncmain4static_DEPENDENCIES = gcctestdir/ld
1791 ifuncmain4static_LDFLAGS = -Bgcctestdir/ -static
1792 ifuncmain4static_LDADD =
1794 check_PROGRAMS += ifuncmain4picstatic
1795 ifuncmain4picstatic: ifuncmain4pic.o gcctestdir/ld
1796 $(LINK) -Bgcctestdir/ -static ifuncmain4pic.o
1800 check_PROGRAMS += ifuncmain4
1801 ifuncmain4_SOURCES = ifuncmain4.c
1802 ifuncmain4_DEPENDENCIES = gcctestdir/ld
1803 ifuncmain4_LDFLAGS = -Bgcctestdir/
1806 ifuncmain5pic.o: ifuncmain5.c
1807 $(COMPILE) -c -fPIC -o $@ $<
1809 ifuncmain5pie.o: ifuncmain5.c
1810 $(COMPILE) -c -fPIE -o $@ $<
1812 ifuncmod5.o: ifuncmod5.c
1813 $(COMPILE) -c -fPIC -o $@ $<
1814 ifuncmod5.so: ifuncmod5.o gcctestdir/ld
1815 $(LINK) -Bgcctestdir/ -shared ifuncmod5.o
1817 ifuncdep5.o: ifuncmod5.c
1818 $(COMPILE) -c -o $@ $<
1822 check_PROGRAMS += ifuncmain5static
1823 ifuncmain5static_SOURCES = ifuncmain5.c
1824 ifuncmain5static_DEPENDENCIES = gcctestdir/ld ifuncdep5.o
1825 ifuncmain5static_LDFLAGS = -Bgcctestdir/ -static
1826 ifuncmain5static_LDADD = ifuncdep5.o
1828 check_PROGRAMS += ifuncmain5picstatic
1829 ifuncmain5picstatic: ifuncmain5pic.o ifuncmod5.o gcctestdir/ld
1830 $(LINK) -Bgcctestdir/ -static ifuncmain5pic.o ifuncmod5.o
1834 check_PROGRAMS += ifuncmain5
1835 ifuncmain5_SOURCES = ifuncmain5.c
1836 ifuncmain5_DEPENDENCIES = gcctestdir/ld ifuncmod5.so
1837 ifuncmain5_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1838 ifuncmain5_LDADD = ifuncmod5.so
1840 check_PROGRAMS += ifuncmain5pic
1841 ifuncmain5pic: ifuncmain5pic.o ifuncmod5.so gcctestdir/ld
1842 $(LINK) -Bgcctestdir/ ifuncmain5pic.o ifuncmod5.so -Wl,-R,.
1844 check_PROGRAMS += ifuncmain5staticpic
1845 ifuncmain5staticpic: ifuncmain5pic.o ifuncmod5.o gcctestdir/ld
1846 $(LINK) -Bgcctestdir/ ifuncmain5pic.o ifuncmod5.o
1848 check_PROGRAMS += ifuncmain5pie
1849 ifuncmain5pie: ifuncmain5pie.o ifuncmod5.so gcctestdir/ld
1850 $(LINK) -Bgcctestdir/ -pie ifuncmain5pie.o ifuncmod5.so -Wl,-R,.
1852 ifuncmain6pie.o: ifuncmain6pie.c
1853 $(COMPILE) -c -fPIE -o $@ $<
1855 ifuncmod6.o: ifuncmod6.c
1856 $(COMPILE) -c -fPIC -o $@ $<
1857 ifuncmod6.so: ifuncmod6.o gcctestdir/ld
1858 $(LINK) -Bgcctestdir/ -shared ifuncmod6.o
1860 check_PROGRAMS += ifuncmain6pie
1861 ifuncmain6pie: ifuncmain6pie.o ifuncmod6.so gcctestdir/ld
1862 $(LINK) -Bgcctestdir/ -pie ifuncmain6pie.o ifuncmod6.so -Wl,-R,.
1864 ifuncmain7pic.o: ifuncmain7.c
1865 $(COMPILE) -c -fPIC -o $@ $<
1867 ifuncmain7pie.o: ifuncmain7.c
1868 $(COMPILE) -c -fPIE -o $@ $<
1872 check_PROGRAMS += ifuncmain7static
1873 ifuncmain7static_SOURCES = ifuncmain7.c
1874 ifuncmain7static_DEPENDENCIES = gcctestdir/ld
1875 ifuncmain7static_LDFLAGS = -Bgcctestdir/ -static
1876 ifuncmain7static_LDADD =
1878 check_PROGRAMS += ifuncmain7picstatic
1879 ifuncmain7picstatic: ifuncmain7pic.o gcctestdir/ld
1880 $(LINK) -Bgcctestdir/ -static ifuncmain7pic.o
1884 check_PROGRAMS += ifuncmain7
1885 ifuncmain7_SOURCES = ifuncmain7.c
1886 ifuncmain7_DEPENDENCIES = gcctestdir/ld
1887 ifuncmain7_LDFLAGS = -Bgcctestdir/
1890 check_PROGRAMS += ifuncmain7pic
1891 ifuncmain7pic: ifuncmain7pic.o gcctestdir/ld
1892 $(LINK) -Bgcctestdir/ ifuncmain7pic.o
1894 check_PROGRAMS += ifuncmain7pie
1895 ifuncmain7pie: ifuncmain7pie.o gcctestdir/ld
1896 $(LINK) -Bgcctestdir/ -pie ifuncmain7pie.o
1898 check_PROGRAMS += ifuncvar
1899 ifuncvar1_pic.o: ifuncvar1.c
1900 $(COMPILE) -c -fPIC -o $@ $<
1901 ifuncvar2_pic.o: ifuncvar2.c
1902 $(COMPILE) -c -fPIC -o $@ $<
1903 ifuncvar.so: ifuncvar1_pic.o ifuncvar2_pic.o gcctestdir/ld
1904 $(LINK) -Bgcctestdir/ -shared ifuncvar1_pic.o ifuncvar2_pic.o
1905 ifuncvar_SOURCES = ifuncvar3.c
1906 ifuncvar_DEPENDENCIES = gcctestdir/ld ifuncvar.so
1907 ifuncvar_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1908 ifuncvar_LDADD = ifuncvar.so
1912 # Test that strong reference to a weak symbol in a DSO remains strong.
1913 check_SCRIPTS += strong_ref_weak_def.sh
1914 check_DATA += strong_ref_weak_def.stdout
1915 MOSTLYCLEANFILES += strong_ref_weak_def_1.so strong_ref_weak_def_2.so \
1916 strong_ref_weak_def.stdout
1917 strong_ref_weak_def_2.o: strong_ref_weak_def_2.c
1918 $(COMPILE) -o $@ -c -fPIC $<
1919 strong_ref_weak_def_2.so: strong_ref_weak_def_2.o gcctestdir/ld
1920 gcctestdir/ld -shared -o $@ strong_ref_weak_def_2.o
1921 strong_ref_weak_def_1.o: strong_ref_weak_def_1.c
1922 $(COMPILE) -o $@ -c -fPIC $<
1923 strong_ref_weak_def_1.so: strong_ref_weak_def_1.o strong_ref_weak_def_2.so \
1925 gcctestdir/ld -shared -o $@ strong_ref_weak_def_1.o \
1926 strong_ref_weak_def_2.so
1927 strong_ref_weak_def.stdout: strong_ref_weak_def_1.so
1928 $(TEST_READELF) -sWD $< > $@
1930 # Test that a strong weak reference remains strong if there is another
1931 # weak reference in a DSO.
1932 check_SCRIPTS += dyn_weak_ref.sh
1933 check_DATA += dyn_weak_ref.stdout
1934 MOSTLYCLEANFILES += dyn_weak_ref_1.so dyn_weak_ref_2.so \
1936 dyn_weak_ref_2.o: dyn_weak_ref_2.c
1937 $(COMPILE) -o $@ -c -fPIC $<
1938 dyn_weak_ref_2.so: dyn_weak_ref_2.o gcctestdir/ld
1939 gcctestdir/ld -shared -o $@ dyn_weak_ref_2.o
1940 dyn_weak_ref_1.o: dyn_weak_ref_1.c
1941 $(COMPILE) -o $@ -c -fPIC $<
1942 # We intentionally put dyn_weak_ref_2.so in front of dyn_weak_ref_1.o
1943 # so that the weak ref there goes to gold's symbol table first.
1944 dyn_weak_ref_1.so: dyn_weak_ref_1.o dyn_weak_ref_2.so gcctestdir/ld
1945 gcctestdir/ld -shared -o $@ dyn_weak_ref_2.so dyn_weak_ref_1.o
1946 dyn_weak_ref.stdout: dyn_weak_ref_1.so
1947 $(TEST_READELF) -sWD $< > $@
1950 # Test that --start-lib and --end-lib function correctly.
1951 check_PROGRAMS += start_lib_test
1952 start_lib_test: start_lib_test_main.o libstart_lib_test.a start_lib_test_2.o start_lib_test_3.o \
1954 $(LINK) -Bgcctestdir/ -o $@ start_lib_test_main.o -L. -lstart_lib_test \
1955 -Wl,--start-lib start_lib_test_2.o start_lib_test_3.o -Wl,--end-lib
1956 libstart_lib_test.a: start_lib_test_1.o
1959 # Test that MEMORY region support works.
1960 check_SCRIPTS += memory_test.sh
1961 check_DATA += memory_test.stdout
1962 MOSTLYCLEANFILES += memory_test.stdout memory_test memory_test.o
1963 memory_test.o: memory_test.s
1964 $(COMPILE) -o $@ -c $<
1965 memory_test: memory_test.o gcctestdir/ld $(srcdir)/memory_test.t
1966 $(LINK) -Bgcctestdir/ -nostartfiles -nostdlib -T $(srcdir)/memory_test.t -o $@ memory_test.o
1967 memory_test.stdout: memory_test
1968 $(TEST_READELF) -lWS $< > $@
1970 # Test that --gdb-index functions correctly.
1971 check_SCRIPTS += gdb_index_test_1.sh
1972 check_DATA += gdb_index_test_1.stdout
1973 MOSTLYCLEANFILES += gdb_index_test_1.stdout gdb_index_test_1
1974 gdb_index_test.o: gdb_index_test.cc
1975 $(CXXCOMPILE) -O0 -g -c -o $@ $<
1976 gdb_index_test_1: gdb_index_test.o gcctestdir/ld
1977 $(CXXLINK) -Bgcctestdir/ -Wl,--gdb-index $<
1978 gdb_index_test_1.stdout: gdb_index_test_1
1979 $(TEST_READELF) --debug-dump=gdb_index $< > $@
1983 check_SCRIPTS += gdb_index_test_2.sh
1984 check_DATA += gdb_index_test_2.stdout
1985 MOSTLYCLEANFILES += gdb_index_test_2.stdout gdb_index_test_2
1986 gdb_index_test_cdebug.o: gdb_index_test.cc
1987 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -Wa,--compress-debug-sections -c -o $@ $<
1988 gdb_index_test_2: gdb_index_test_cdebug.o gcctestdir/ld
1989 $(CXXLINK) -Bgcctestdir/ -Wl,--gdb-index $<
1990 gdb_index_test_2.stdout: gdb_index_test_2
1991 $(TEST_READELF) --debug-dump=gdb_index $< > $@
1995 # Another simple C test (DW_AT_high_pc encoding) for --gdb-index
1996 check_SCRIPTS += gdb_index_test_3.sh
1997 check_DATA += gdb_index_test_3.stdout
1998 MOSTLYCLEANFILES += gdb_index_test_3.stdout gdb_index_test_3
1999 gdb_index_test_3.o: gdb_index_test_3.c
2000 $(COMPILE) -O0 -g -c -o $@ $<
2001 gdb_index_test_3: gdb_index_test_3.o gcctestdir/ld
2002 $(LINK) -Bgcctestdir/ -Wl,--gdb-index,--fatal-warnings $<
2003 gdb_index_test_3.stdout: gdb_index_test_3
2004 $(TEST_READELF) --debug-dump=gdb_index $< > $@
2007 # End-to-end incremental linking tests.
2008 # Incremental linking is currently supported only on the x86_64 target.
2010 if DEFAULT_TARGET_X86_64
2012 two_file_test_1_v1_ndebug.o: two_file_test_1_v1.cc
2013 $(CXXCOMPILE) -O0 -g0 -c -o $@ $<
2014 two_file_test_1_ndebug.o: two_file_test_1.cc
2015 $(CXXCOMPILE) -O0 -g0 -c -o $@ $<
2016 two_file_test_1b_ndebug.o: two_file_test_1b.cc
2017 $(CXXCOMPILE) -O0 -g0 -c -o $@ $<
2018 two_file_test_2_ndebug.o: two_file_test_2.cc
2019 $(CXXCOMPILE) -O0 -g0 -c -o $@ $<
2020 two_file_test_main_ndebug.o: two_file_test_main.cc
2021 $(CXXCOMPILE) -O0 -g0 -c -o $@ $<
2023 check_PROGRAMS += incremental_test_2
2024 MOSTLYCLEANFILES += two_file_test_tmp_2.o
2025 incremental_test_2: two_file_test_1_v1_ndebug.o two_file_test_1_ndebug.o two_file_test_1b_ndebug.o \
2026 two_file_test_2_ndebug.o two_file_test_main_ndebug.o gcctestdir/ld
2027 cp -f two_file_test_1_v1_ndebug.o two_file_test_tmp_2.o
2028 $(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
2030 cp -f two_file_test_1_ndebug.o two_file_test_tmp_2.o
2031 $(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
2033 check_PROGRAMS += incremental_test_3
2034 MOSTLYCLEANFILES += two_file_test_tmp_3.o
2035 incremental_test_3: two_file_test_1.o two_file_test_1b_v1.o two_file_test_1b.o \
2036 two_file_test_2.o two_file_test_main.o gcctestdir/ld
2037 cp -f two_file_test_1b_v1.o two_file_test_tmp_3.o
2038 $(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
2040 cp -f two_file_test_1b.o two_file_test_tmp_3.o
2041 $(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
2043 check_PROGRAMS += incremental_test_4
2044 MOSTLYCLEANFILES += incremental_test_4.base two_file_test_tmp_4.o
2045 incremental_test_4: two_file_test_1.o two_file_test_1b.o two_file_test_2_v1.o \
2046 two_file_test_2.o two_file_test_main.o gcctestdir/ld
2047 cp -f two_file_test_2_v1.o two_file_test_tmp_4.o
2048 $(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
2049 mv -f incremental_test_4 incremental_test_4.base
2051 cp -f two_file_test_2.o two_file_test_tmp_4.o
2052 $(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
2054 check_PROGRAMS += incremental_test_5
2055 MOSTLYCLEANFILES += two_file_test_5.a
2056 incremental_test_5: two_file_test_1.o two_file_test_1b_v1.o two_file_test_1b.o \
2057 two_file_test_2.o two_file_test_main.o gcctestdir/ld
2058 cp -f two_file_test_1b_v1.o two_file_test_tmp_5.o
2059 $(TEST_AR) rc two_file_test_5.a two_file_test_1.o two_file_test_tmp_5.o two_file_test_2.o
2060 $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Bgcctestdir/ two_file_test_main.o two_file_test_5.a
2062 cp -f two_file_test_1b.o two_file_test_tmp_5.o
2063 $(TEST_AR) rc two_file_test_5.a two_file_test_1.o two_file_test_tmp_5.o two_file_test_2.o
2064 $(CXXLINK) -Wl,--incremental-update -Bgcctestdir/ two_file_test_main.o two_file_test_5.a
2066 # Test the --incremental-unchanged flag with an archive library.
2067 # The second link should not update the library.
2068 check_PROGRAMS += incremental_test_6
2069 MOSTLYCLEANFILES += two_file_test_6.a
2070 incremental_test_6: two_file_test_1.o two_file_test_1b_v1.o two_file_test_1b.o \
2071 two_file_test_2.o two_file_test_main.o gcctestdir/ld
2072 cp -f two_file_test_1b.o two_file_test_tmp_6.o
2073 $(TEST_AR) rc two_file_test_6.a two_file_test_1.o two_file_test_tmp_6.o two_file_test_2.o
2074 $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Bgcctestdir/ two_file_test_main.o two_file_test_6.a
2076 cp -f two_file_test_1b_v1.o two_file_test_tmp_6.o
2077 $(TEST_AR) rc two_file_test_6.a two_file_test_1.o two_file_test_tmp_6.o two_file_test_2.o
2078 $(CXXLINK) -Wl,--incremental-update -Bgcctestdir/ two_file_test_main.o -Wl,--incremental-unchanged two_file_test_6.a -Wl,--incremental-unknown
2080 check_PROGRAMS += incremental_copy_test
2081 incremental_copy_test: copy_test_v1.o copy_test.o copy_test_1.so copy_test_2.so
2082 cp -f copy_test_v1.o copy_test_tmp.o
2083 $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Bgcctestdir/ -Wl,-R,. copy_test_tmp.o copy_test_1.so copy_test_2.so
2085 cp -f copy_test.o copy_test_tmp.o
2086 $(CXXLINK) -Wl,--incremental-update -Bgcctestdir/ -Wl,-R,. copy_test_tmp.o copy_test_1.so copy_test_2.so
2088 check_PROGRAMS += incremental_common_test_1
2089 incremental_common_test_1: common_test_1_v1.o common_test_1_v2.o gcctestdir/ld
2090 cp -f common_test_1_v1.o common_test_1_tmp.o
2091 $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Bgcctestdir/ common_test_1_tmp.o
2093 cp -f common_test_1_v2.o common_test_1_tmp.o
2094 $(CXXLINK) -Wl,--incremental-update -Bgcctestdir/ common_test_1_tmp.o
2096 check_PROGRAMS += incremental_comdat_test_1
2097 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
2098 cp -f incr_comdat_test_2_v1.o incr_comdat_test_1_tmp.o
2099 $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Bgcctestdir/ incr_comdat_test_1.o incr_comdat_test_1_tmp.o
2101 cp -f incr_comdat_test_2_v2.o incr_comdat_test_1_tmp.o
2102 $(CXXLINK) -Wl,--incremental-update -Bgcctestdir/ incr_comdat_test_1.o incr_comdat_test_1_tmp.o
2104 cp -f incr_comdat_test_2_v3.o incr_comdat_test_1_tmp.o
2105 $(CXXLINK) -Wl,--incremental-update -Bgcctestdir/ incr_comdat_test_1.o incr_comdat_test_1_tmp.o
2107 endif DEFAULT_TARGET_X86_64
2112 # These tests work with native and cross linkers.
2114 if NATIVE_OR_CROSS_LINKER
2116 # Test script section order.
2117 check_SCRIPTS += script_test_10.sh
2118 check_DATA += script_test_10.stdout
2119 script_test_10.o: script_test_10.s
2121 script_test_10: $(srcdir)/script_test_10.t script_test_10.o gcctestdir/ld
2122 gcctestdir/ld -o $@ script_test_10.o -T $(srcdir)/script_test_10.t
2123 script_test_10.stdout: script_test_10
2124 $(TEST_READELF) -SW script_test_10 > $@
2126 # These tests work with cross linkers only.
2128 if DEFAULT_TARGET_I386
2130 check_SCRIPTS += split_i386.sh
2131 check_DATA += split_i386_1.stdout split_i386_2.stdout \
2132 split_i386_3.stdout split_i386_4.stdout split_i386_r.stdout
2133 SPLIT_DEFSYMS = --defsym __morestack=0x100 --defsym __morestack_non_split=0x200
2134 split_i386_1.o: split_i386_1.s
2136 split_i386_2.o: split_i386_2.s
2138 split_i386_3.o: split_i386_3.s
2140 split_i386_4.o: split_i386_4.s
2142 split_i386_n.o: split_i386_n.s
2144 split_i386_1: split_i386_1.o split_i386_n.o ../ld-new
2145 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_i386_1.o split_i386_n.o
2146 split_i386_1.stdout: split_i386_1
2147 $(TEST_OBJDUMP) -d $< > $@
2148 split_i386_2: split_i386_2.o split_i386_n.o ../ld-new
2149 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_i386_2.o split_i386_n.o
2150 split_i386_2.stdout: split_i386_2
2151 $(TEST_OBJDUMP) -d $< > $@
2152 split_i386_3.stdout: split_i386_3.o split_i386_n.o ../ld-new
2153 ../ld-new $(SPLIT_DEFSYMS) -o split_i386_3 split_i386_3.o split_i386_n.o > $@ 2>&1 || exit 0
2154 split_i386_4: split_i386_4.o split_i386_n.o ../ld-new
2155 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_i386_4.o split_i386_n.o
2156 split_i386_4.stdout: split_i386_4
2157 $(TEST_OBJDUMP) -d $< > $@
2158 split_i386_r.stdout: split_i386_1.o split_i386_n.o ../ld-new
2159 ../ld-new -r split_i386_1.o split_i386_n.o -o split_i386_r > $@ 2>&1 || exit 0
2160 MOSTLYCLEANFILES += split_i386_1 split_i386_2 split_i386_3 \
2161 split_i386_4 split_i386_r
2163 endif DEFAULT_TARGET_I386
2165 if DEFAULT_TARGET_X86_64
2167 check_SCRIPTS += split_x86_64.sh
2168 check_DATA += split_x86_64_1.stdout split_x86_64_2.stdout \
2169 split_x86_64_3.stdout split_x86_64_4.stdout split_x86_64_r.stdout
2170 SPLIT_DEFSYMS = --defsym __morestack=0x100 --defsym __morestack_non_split=0x200
2171 split_x86_64_1.o: split_x86_64_1.s
2173 split_x86_64_2.o: split_x86_64_2.s
2175 split_x86_64_3.o: split_x86_64_3.s
2177 split_x86_64_4.o: split_x86_64_4.s
2179 split_x86_64_n.o: split_x86_64_n.s
2181 split_x86_64_1: split_x86_64_1.o split_x86_64_n.o ../ld-new
2182 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x86_64_1.o split_x86_64_n.o
2183 split_x86_64_1.stdout: split_x86_64_1
2184 $(TEST_OBJDUMP) -d $< > $@
2185 split_x86_64_2: split_x86_64_2.o split_x86_64_n.o ../ld-new
2186 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x86_64_2.o split_x86_64_n.o
2187 split_x86_64_2.stdout: split_x86_64_2
2188 $(TEST_OBJDUMP) -d $< > $@
2189 split_x86_64_3.stdout: split_x86_64_3.o split_x86_64_n.o ../ld-new
2190 ../ld-new $(SPLIT_DEFSYMS) -o split_x86_64_3 split_x86_64_3.o split_x86_64_n.o > $@ 2>&1 || exit 0
2191 split_x86_64_4: split_x86_64_4.o split_x86_64_n.o ../ld-new
2192 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x86_64_4.o split_x86_64_n.o
2193 split_x86_64_4.stdout: split_x86_64_4
2194 $(TEST_OBJDUMP) -d $< > $@
2195 split_x86_64_r.stdout: split_x86_64_1.o split_x86_64_n.o ../ld-new
2196 ../ld-new -r split_x86_64_1.o split_x86_64_n.o -o split_x86_64_r > $@ 2>&1 || exit 0
2197 MOSTLYCLEANFILES += split_x86_64_1 split_x86_64_2 split_x86_64_3 \
2198 split_x86_64_4 split_x86_64_r
2200 endif DEFAULT_TARGET_X86_64
2202 if DEFAULT_TARGET_ARM
2204 check_SCRIPTS += arm_abs_global.sh
2205 check_DATA += arm_abs_global.stdout
2206 arm_abs_lib.o: arm_abs_lib.s
2207 $(TEST_AS) -march=armv7-a -o $@ $<
2208 libarm_abs.so: arm_abs_lib.o ../ld-new
2209 ../ld-new -shared -o $@ arm_abs_lib.o
2210 arm_abs_global.o: arm_abs_global.s
2211 $(TEST_AS) -march=armv7-a -o $@ $<
2212 arm_abs_global: arm_abs_global.o libarm_abs.so ../ld-new
2213 ../ld-new -o $@ arm_abs_global.o -L. -larm_abs
2214 arm_abs_global.stdout: arm_abs_global
2215 $(TEST_READELF) -r $< > $@
2217 MOSTLYCLEANFILES += arm_abs_global
2219 check_SCRIPTS += arm_branch_in_range.sh arm_branch_out_of_range.sh
2220 check_DATA += arm_bl_in_range.stdout arm_bl_out_of_range.stdout \
2221 thumb_bl_in_range.stdout thumb_bl_out_of_range.stdout \
2222 thumb2_bl_in_range.stdout thumb2_bl_out_of_range.stdout \
2223 thumb_blx_in_range.stdout thumb_blx_out_of_range.stdout \
2224 thumb2_blx_in_range.stdout thumb2_blx_out_of_range.stdout \
2225 thumb_bl_out_of_range_local.stdout arm_thm_jump11.stdout \
2226 arm_thm_jump8.stdout
2228 arm_bl_in_range.stdout: arm_bl_in_range
2229 $(TEST_OBJDUMP) -D $< > $@
2231 arm_bl_in_range: arm_bl_in_range.o ../ld-new
2232 ../ld-new -T $(srcdir)/arm_branch_range.t -o $@ $<
2234 arm_bl_in_range.o: arm_bl_in_range.s
2237 arm_bl_out_of_range.stdout: arm_bl_out_of_range
2238 $(TEST_OBJDUMP) -S $< > $@
2240 arm_bl_out_of_range: arm_bl_out_of_range.o ../ld-new
2241 ../ld-new -T $(srcdir)/arm_branch_range.t -o $@ $<
2243 arm_bl_out_of_range.o: arm_bl_out_of_range.s
2246 thumb_bl_in_range.stdout: thumb_bl_in_range
2247 $(TEST_OBJDUMP) -D $< > $@
2249 thumb_bl_in_range: thumb_bl_in_range.o ../ld-new
2250 ../ld-new --no-fix-arm1176 -T $(srcdir)/thumb_branch_range.t -o $@ $<
2252 thumb_bl_in_range.o: thumb_bl_in_range.s
2253 $(TEST_AS) -o $@ -march=armv5te $<
2255 thumb_bl_out_of_range.stdout: thumb_bl_out_of_range
2256 $(TEST_OBJDUMP) -D $< > $@
2258 thumb_bl_out_of_range: thumb_bl_out_of_range.o ../ld-new
2259 ../ld-new --no-fix-arm1176 -T $(srcdir)/thumb_branch_range.t -o $@ $<
2261 thumb_bl_out_of_range.o: thumb_bl_out_of_range.s
2262 $(TEST_AS) -o $@ -march=armv5te $<
2264 thumb2_bl_in_range.stdout: thumb2_bl_in_range
2265 $(TEST_OBJDUMP) -D $< > $@
2267 thumb2_bl_in_range: thumb2_bl_in_range.o ../ld-new
2268 ../ld-new -T $(srcdir)/thumb2_branch_range.t -o $@ $<
2270 thumb2_bl_in_range.o: thumb_bl_in_range.s
2271 $(TEST_AS) -o $@ -march=armv7-a $<
2273 thumb2_bl_out_of_range.stdout: thumb2_bl_out_of_range
2274 $(TEST_OBJDUMP) -D $< > $@
2276 thumb2_bl_out_of_range: thumb2_bl_out_of_range.o ../ld-new
2277 ../ld-new -T $(srcdir)/thumb2_branch_range.t -o $@ $<
2279 thumb2_bl_out_of_range.o: thumb_bl_out_of_range.s
2280 $(TEST_AS) -o $@ -march=armv7-a $<
2282 thumb_blx_in_range.stdout: thumb_blx_in_range
2283 $(TEST_OBJDUMP) -D $< > $@
2285 thumb_blx_in_range: thumb_blx_in_range.o ../ld-new
2286 ../ld-new --no-fix-arm1176 -T $(srcdir)/thumb_branch_range.t -o $@ $<
2288 thumb_blx_in_range.o: thumb_blx_in_range.s
2289 $(TEST_AS) -o $@ -march=armv5te $<
2291 thumb_blx_out_of_range.stdout: thumb_blx_out_of_range
2292 $(TEST_OBJDUMP) -D $< > $@
2294 thumb_blx_out_of_range: thumb_blx_out_of_range.o ../ld-new
2295 ../ld-new --no-fix-arm1176 -T $(srcdir)/thumb_branch_range.t -o $@ $<
2297 thumb_blx_out_of_range.o: thumb_blx_out_of_range.s
2298 $(TEST_AS) -o $@ -march=armv5te $<
2300 thumb2_blx_in_range.stdout: thumb2_blx_in_range
2301 $(TEST_OBJDUMP) -D $< > $@
2303 thumb2_blx_in_range: thumb2_blx_in_range.o ../ld-new
2304 ../ld-new -T $(srcdir)/thumb2_branch_range.t -o $@ $<
2306 thumb2_blx_in_range.o: thumb_blx_in_range.s
2307 $(TEST_AS) -o $@ -march=armv7-a $<
2309 thumb2_blx_out_of_range.stdout: thumb2_blx_out_of_range
2310 $(TEST_OBJDUMP) -D $< > $@
2312 thumb2_blx_out_of_range: thumb2_blx_out_of_range.o ../ld-new
2313 ../ld-new -T $(srcdir)/thumb2_branch_range.t -o $@ $<
2315 thumb2_blx_out_of_range.o: thumb_blx_out_of_range.s
2316 $(TEST_AS) -o $@ -march=armv7-a $<
2318 thumb_bl_out_of_range_local.stdout: thumb_bl_out_of_range_local
2319 $(TEST_OBJDUMP) -D $< > $@
2321 thumb_bl_out_of_range_local: thumb_bl_out_of_range_local.o ../ld-new
2322 ../ld-new --no-fix-arm1176 -T $(srcdir)/thumb_branch_range.t -o $@ $<
2324 thumb_bl_out_of_range_local.o: thumb_bl_out_of_range_local.s
2325 $(TEST_AS) -o $@ -march=armv5te $<
2327 arm_thm_jump11.stdout: arm_thm_jump11
2328 $(TEST_OBJDUMP) -D $< > $@
2330 arm_thm_jump11: arm_thm_jump11.o ../ld-new
2331 ../ld-new -T $(srcdir)/arm_thm_jump11.t -o $@ $<
2333 arm_thm_jump11.o: arm_thm_jump11.s
2336 arm_thm_jump8.stdout: arm_thm_jump8
2337 $(TEST_OBJDUMP) -D $< > $@
2339 arm_thm_jump8: arm_thm_jump8.o ../ld-new
2340 ../ld-new -T $(srcdir)/arm_thm_jump8.t -o $@ $<
2342 arm_thm_jump8.o: arm_thm_jump8.s
2345 MOSTLYCLEANFILES += arm_bl_in_range arm_bl_out_of_range thumb_bl_in_range \
2346 thumb_bl_out_of_range thumb2_bl_in_range thumb2_bl_out_of_range \
2347 thumb_blx_in_range thumb_blx_out_of_range thumb2_blx_in_range \
2348 thumb2_blx_out_of_range thumb_bl_out_of_range_local arm_thm_jump11 \
2351 check_SCRIPTS += arm_fix_v4bx.sh
2352 check_DATA += arm_fix_v4bx.stdout arm_fix_v4bx_interworking.stdout \
2353 arm_no_fix_v4bx.stdout
2355 arm_fix_v4bx.stdout: arm_fix_v4bx
2356 $(TEST_OBJDUMP) -D -j.text $< > $@
2358 arm_fix_v4bx: arm_fix_v4bx.o ../ld-new
2359 ../ld-new --no-fix-arm1176 --fix-v4bx -o $@ $<
2361 arm_fix_v4bx.o: arm_fix_v4bx.s
2364 arm_fix_v4bx_interworking.stdout: arm_fix_v4bx_interworking
2365 $(TEST_OBJDUMP) -D -j.text $< > $@
2367 arm_fix_v4bx_interworking: arm_fix_v4bx.o ../ld-new
2368 ../ld-new --no-fix-arm1176 --fix-v4bx-interworking -o $@ $<
2370 arm_no_fix_v4bx.stdout: arm_no_fix_v4bx
2371 $(TEST_OBJDUMP) -D -j.text $< > $@
2373 arm_no_fix_v4bx: arm_fix_v4bx.o ../ld-new
2374 ../ld-new --no-fix-arm1176 -o $@ $<
2376 MOSTLYCLEANFILES += arm_fix_v4bx arm_fix_v4bx_interworking arm_no_fix_v4bx
2378 check_SCRIPTS += arm_attr_merge.sh
2379 check_DATA += arm_attr_merge_6.stdout arm_attr_merge_6r.stdout \
2380 arm_attr_merge_7.stdout
2382 arm_attr_merge_6.stdout: arm_attr_merge_6
2383 $(TEST_READELF) -A $< > $@
2385 arm_attr_merge_6: arm_attr_merge_6a.o arm_attr_merge_6b.o
2386 ../ld-new -o $@ arm_attr_merge_6a.o arm_attr_merge_6b.o
2388 arm_attr_merge_6a.o: arm_attr_merge_6a.s
2391 arm_attr_merge_6b.o: arm_attr_merge_6b.s
2394 arm_attr_merge_6r.stdout: arm_attr_merge_6r
2395 $(TEST_READELF) -A $< > $@
2397 arm_attr_merge_6r: arm_attr_merge_6b.o arm_attr_merge_6a.o
2398 ../ld-new -o $@ arm_attr_merge_6b.o arm_attr_merge_6a.o
2400 arm_attr_merge_7.stdout: arm_attr_merge_7
2401 $(TEST_READELF) -A $< > $@
2403 arm_attr_merge_7: arm_attr_merge_7a.o arm_attr_merge_7b.o
2404 ../ld-new -o $@ arm_attr_merge_7a.o arm_attr_merge_7b.o
2406 arm_attr_merge_7a.o: arm_attr_merge_7a.s
2409 arm_attr_merge_7b.o: arm_attr_merge_7b.s
2412 MOSTLYCLEANFILES += arm_attr_merge_6 arm_attr_merge_6r arm_attr_merge_7
2414 # ARM1176 workaround test.
2415 check_SCRIPTS += arm_fix_1176.sh
2416 check_DATA += arm_fix_1176_default_v6z.stdout arm_fix_1176_on_v6z.stdout \
2417 arm_fix_1176_off_v6z.stdout arm_fix_1176_default_v5te.stdout \
2418 arm_fix_1176_default_v7a.stdout arm_fix_1176_default_1156t2f_s.stdout
2420 arm_fix_1176_default_v6z.stdout: arm_fix_1176_default_v6z
2421 $(TEST_OBJDUMP) -D -j.foo $< > $@
2423 arm_fix_1176_default_v6z: arm_fix_1176_default_v6z.o ../ld-new
2424 ../ld-new --section-start=.foo=0x2001014 -o $@ $<
2426 arm_fix_1176_default_v6z.o: arm_fix_1176.s
2427 $(TEST_AS) -march=armv6z -o $@ $<
2429 arm_fix_1176_on_v6z.stdout: arm_fix_1176_on_v6z
2430 $(TEST_OBJDUMP) -D -j.foo $< > $@
2432 arm_fix_1176_on_v6z: arm_fix_1176_on_v6z.o ../ld-new
2433 ../ld-new --section-start=.foo=0x2001014 --fix-arm1176 -o $@ $<
2435 arm_fix_1176_on_v6z.o: arm_fix_1176.s
2436 $(TEST_AS) -march=armv6z -o $@ $<
2438 arm_fix_1176_off_v6z.stdout: arm_fix_1176_off_v6z
2439 $(TEST_OBJDUMP) -D -j.foo $< > $@
2441 arm_fix_1176_off_v6z: arm_fix_1176_off_v6z.o ../ld-new
2442 ../ld-new --section-start=.foo=0x2001014 --no-fix-arm1176 -o $@ $<
2444 arm_fix_1176_off_v6z.o: arm_fix_1176.s
2445 $(TEST_AS) -march=armv6z -o $@ $<
2447 arm_fix_1176_default_v5te.stdout: arm_fix_1176_default_v5te
2448 $(TEST_OBJDUMP) -D -j.foo $< > $@
2450 arm_fix_1176_default_v5te: arm_fix_1176_default_v5te.o ../ld-new
2451 ../ld-new --section-start=.foo=0x2001014 -o $@ $<
2453 arm_fix_1176_default_v5te.o: arm_fix_1176.s
2454 $(TEST_AS) -march=armv5te -o $@ $<
2456 arm_fix_1176_default_v7a.stdout: arm_fix_1176_default_v7a
2457 $(TEST_OBJDUMP) -D -j.foo $< > $@
2459 arm_fix_1176_default_v7a: arm_fix_1176_default_v7a.o ../ld-new
2460 ../ld-new --section-start=.foo=0x2001014 -o $@ $<
2462 arm_fix_1176_default_v7a.o: arm_fix_1176.s
2463 $(TEST_AS) -march=armv7-a -o $@ $<
2465 arm_fix_1176_default_1156t2f_s.stdout: arm_fix_1176_default_1156t2f_s
2466 $(TEST_OBJDUMP) -D -j.foo $< > $@
2468 arm_fix_1176_default_1156t2f_s: arm_fix_1176_default_1156t2f_s.o ../ld-new
2469 ../ld-new --section-start=.foo=0x2001014 -o $@ $<
2471 arm_fix_1176_default_1156t2f_s.o: arm_fix_1176.s
2472 $(TEST_AS) -mcpu=arm1156t2f-s -o $@ $<
2474 MOSTLYCLEANFILES += arm_fix_1176_default_v6z arm_fix_1176_on_v6z arm_fix_1176_off_v6z \
2475 arm_fix_1176_default_v5te arm_fix_1176_default_v7a arm_fix_1176_default_1156t2f_s
2477 # Cortex-A8 workaround test.
2479 check_SCRIPTS += arm_cortex_a8.sh
2480 check_DATA += arm_cortex_a8_b_cond.stdout arm_cortex_a8_b.stdout \
2481 arm_cortex_a8_bl.stdout arm_cortex_a8_blx.stdout \
2482 arm_cortex_a8_local.stdout arm_cortex_a8_local_reloc.stdout
2484 arm_cortex_a8_b_cond.stdout: arm_cortex_a8_b_cond
2485 $(TEST_OBJDUMP) -D -j.text $< > $@
2487 arm_cortex_a8_b_cond: arm_cortex_a8_b_cond.o ../ld-new
2490 arm_cortex_a8_b_cond.o: arm_cortex_a8_b_cond.s
2493 arm_cortex_a8_b.stdout: arm_cortex_a8_b
2494 $(TEST_OBJDUMP) -D -j.text $< > $@
2496 arm_cortex_a8_b: arm_cortex_a8_b.o ../ld-new
2497 ../ld-new --fix-cortex-a8 -o $@ $<
2499 arm_cortex_a8_b.o: arm_cortex_a8_b.s
2502 arm_cortex_a8_bl.stdout: arm_cortex_a8_bl
2503 $(TEST_OBJDUMP) -D -j.text $< > $@
2505 arm_cortex_a8_bl: arm_cortex_a8_bl.o ../ld-new
2508 arm_cortex_a8_bl.o: arm_cortex_a8_bl.s
2511 arm_cortex_a8_blx.stdout: arm_cortex_a8_blx
2512 $(TEST_OBJDUMP) -D -j.text $< > $@
2514 arm_cortex_a8_blx: arm_cortex_a8_blx.o ../ld-new
2517 arm_cortex_a8_blx.o: arm_cortex_a8_blx.s
2520 arm_cortex_a8_local.stdout: arm_cortex_a8_local
2521 $(TEST_OBJDUMP) -D -j.text $< > $@
2523 arm_cortex_a8_local: arm_cortex_a8_local.o ../ld-new
2526 arm_cortex_a8_local.o: arm_cortex_a8_local.s
2529 arm_cortex_a8_local_reloc.stdout: arm_cortex_a8_local_reloc
2530 $(TEST_OBJDUMP) -D -j.text $< > $@
2532 arm_cortex_a8_local_reloc: arm_cortex_a8_local_reloc.o ../ld-new
2535 arm_cortex_a8_local_reloc.o: arm_cortex_a8_local_reloc.s
2538 MOSTLYCLEANFILES += arm_cortex_a8_b_cond arm_cortex_a8_b arm_cortex_a8_bl \
2539 arm_cortex_a8_blx arm_cortex_a8_local arm_cortex_a8_local_reloc
2541 check_SCRIPTS += arm_exidx_test.sh
2542 check_DATA += arm_exidx_test.stdout
2544 arm_exidx_test.stdout: arm_exidx_test.so
2545 $(TEST_READELF) -Sr $< > $@
2547 arm_exidx_test.so: arm_exidx_test.o ../ld-new
2548 ../ld-new -shared -o $@ $<
2550 arm_exidx_test.o: arm_exidx_test.s
2553 check_SCRIPTS += pr12826.sh
2554 check_DATA += pr12826.stdout
2556 pr12826.stdout: pr12826.so
2557 $(TEST_READELF) -A $< > $@
2559 pr12826.so: pr12826_1.o pr12826_2.o ../ld-new
2560 ../ld-new -shared -o $@ $<
2562 pr12826_1.o: pr12826_1.s
2565 pr12826_2.o: pr12826_2.s
2568 check_SCRIPTS += arm_unaligned_reloc.sh
2569 check_DATA += arm_unaligned_reloc.stdout arm_unaligned_reloc_r.stdout
2571 arm_unaligned_reloc.stdout: arm_unaligned_reloc
2572 $(TEST_OBJDUMP) -D $< > $@
2574 arm_unaligned_reloc_r.stdout: arm_unaligned_reloc_r
2575 $(TEST_OBJDUMP) -Dr $< > $@
2577 arm_unaligned_reloc: arm_unaligned_reloc.o ../ld-new
2580 arm_unaligned_reloc_r: arm_unaligned_reloc.o ../ld-new
2581 ../ld-new -r -o $@ $<
2583 arm_unaligned_reloc.o: arm_unaligned_reloc.s
2586 MOSTLYCLEANFILES += arm_unaligned_reloc arm_unaligned_reloc_r
2588 # Check ARM to ARM farcall veneers
2590 check_SCRIPTS += arm_farcall_arm_arm.sh
2591 check_DATA += arm_farcall_arm_arm.stdout
2593 arm_farcall_arm_arm.stdout: arm_farcall_arm_arm
2594 $(TEST_OBJDUMP) -d $< > $@
2596 arm_farcall_arm_arm: arm_farcall_arm_arm.o ../ld-new
2597 ../ld-new --no-fix-arm1176 --section-start .text=0x1000 --section-start .foo=0x2001020 -o $@ $<
2599 arm_farcall_arm_arm.o: arm_farcall_arm_arm.s
2602 MOSTLYCLEANFILES += arm_farcall_arm_arm
2604 # Check ARM to Thumb farcall veneers
2606 check_SCRIPTS += arm_farcall_arm_thumb.sh
2607 check_DATA += arm_farcall_arm_thumb.stdout arm_farcall_arm_thumb_5t.stdout
2609 arm_farcall_arm_thumb.stdout: arm_farcall_arm_thumb
2610 $(TEST_OBJDUMP) -D $< > $@
2612 arm_farcall_arm_thumb: arm_farcall_arm_thumb.o ../ld-new
2613 ../ld-new --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
2615 arm_farcall_arm_thumb.o: arm_farcall_arm_thumb.s
2618 arm_farcall_arm_thumb_5t.stdout: arm_farcall_arm_thumb_5t
2619 $(TEST_OBJDUMP) -D $< > $@
2621 arm_farcall_arm_thumb_5t: arm_farcall_arm_thumb_5t.o ../ld-new
2622 ../ld-new --no-fix-arm1176 --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
2624 arm_farcall_arm_thumb_5t.o: arm_farcall_arm_thumb.s
2625 $(TEST_AS) -march=armv5t -o $@ $<
2627 MOSTLYCLEANFILES += arm_farcall_arm_thumb arm_farcall_arm_thumb_5t
2629 # Check Thumb to Thumb farcall veneers
2631 check_SCRIPTS += arm_farcall_thumb_thumb.sh
2632 check_DATA += arm_farcall_thumb_thumb.stdout \
2633 arm_farcall_thumb_thumb_5t.stdout \
2634 arm_farcall_thumb_thumb_7m.stdout \
2635 arm_farcall_thumb_thumb_6m.stdout
2637 arm_farcall_thumb_thumb.stdout: arm_farcall_thumb_thumb
2638 $(TEST_OBJDUMP) -D $< > $@
2640 arm_farcall_thumb_thumb: arm_farcall_thumb_thumb.o ../ld-new
2641 ../ld-new --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
2643 arm_farcall_thumb_thumb.o: arm_farcall_thumb_thumb.s
2644 $(TEST_AS) -march=armv4t -o $@ $<
2646 arm_farcall_thumb_thumb_5t.stdout: arm_farcall_thumb_thumb_5t
2647 $(TEST_OBJDUMP) -D $< > $@
2649 arm_farcall_thumb_thumb_5t: arm_farcall_thumb_thumb_5t.o ../ld-new
2650 ../ld-new --no-fix-arm1176 --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
2652 arm_farcall_thumb_thumb_5t.o: arm_farcall_thumb_thumb.s
2653 $(TEST_AS) -march=armv5t -o $@ $<
2655 arm_farcall_thumb_thumb_7m.stdout: arm_farcall_thumb_thumb_7m
2656 $(TEST_OBJDUMP) -D $< > $@
2658 arm_farcall_thumb_thumb_7m: arm_farcall_thumb_thumb_7m.o ../ld-new
2659 ../ld-new --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
2661 arm_farcall_thumb_thumb_7m.o: arm_farcall_thumb_thumb.s
2662 $(TEST_AS) -march=armv7-m -o $@ $<
2664 arm_farcall_thumb_thumb_6m.stdout: arm_farcall_thumb_thumb_6m
2665 $(TEST_OBJDUMP) -D $< > $@
2667 arm_farcall_thumb_thumb_6m: arm_farcall_thumb_thumb_6m.o ../ld-new
2668 ../ld-new --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
2670 arm_farcall_thumb_thumb_6m.o: arm_farcall_thumb_thumb.s
2671 $(TEST_AS) -march=armv6-m -o $@ $<
2673 MOSTLYCLEANFILES += arm_farcall_thumb_thumb arm_farcall_thumb_thumb_5t \
2674 arm_farcall_thumb_thumb_7m arm_farcall_thumb_thumb_6m
2676 # Check Thumb to ARM farcall veneers
2678 check_SCRIPTS += arm_farcall_thumb_arm.sh
2679 check_DATA += arm_farcall_thumb_arm.stdout \
2680 arm_farcall_thumb_arm_5t.stdout
2682 arm_farcall_thumb_arm.stdout: arm_farcall_thumb_arm
2683 $(TEST_OBJDUMP) -D $< > $@
2685 arm_farcall_thumb_arm: arm_farcall_thumb_arm.o ../ld-new
2686 ../ld-new --section-start .text=0x1c01010 --section-start .foo=0x2001014 -o $@ $<
2688 arm_farcall_thumb_arm.o: arm_farcall_thumb_arm.s
2691 arm_farcall_thumb_arm_5t.stdout: arm_farcall_thumb_arm_5t
2692 $(TEST_OBJDUMP) -D $< > $@
2694 arm_farcall_thumb_arm_5t: arm_farcall_thumb_arm_5t.o ../ld-new
2695 ../ld-new --no-fix-arm1176 --section-start .text=0x1c01010 --section-start .foo=0x2001014 -o $@ $<
2697 arm_farcall_thumb_arm_5t.o: arm_farcall_thumb_arm.s
2698 $(TEST_AS) -march=armv5t -o $@ $<
2700 MOSTLYCLEANFILES += arm_farcall_thumb_arm arm_farcall_thumb_arm_5t
2702 endif DEFAULT_TARGET_ARM
2704 endif NATIVE_OR_CROSS_LINKER