2012-07-18 Cary Coutant <ccoutant@google.com>
[binutils-gdb.git] / gold / testsuite / Makefile.am
1 # Process this file with automake to generate Makefile.in
2
3 # As far as I can tell automake testing support assumes that the build
4 # system and the host system are the same. So these tests will not
5 # work when building with a cross-compiler.
6
7 # Ignore warning about AM_PROG_CC_C_O due to large_CFLAGS
8 AUTOMAKE_OPTIONS = foreign -Wno-portability
9
10 # The two_file_test tests -fmerge-constants, so we simply always turn
11 # it on. This may need to be controlled by a configure option
12 # eventually.
13 AM_CFLAGS = $(WARN_CFLAGS) $(LFS_CFLAGS) -fmerge-constants
14 AM_CXXFLAGS = $(WARN_CXXFLAGS) $(LFS_CFLAGS) -fmerge-constants
15
16 AM_CPPFLAGS = \
17 -I$(srcdir) -I$(srcdir)/.. -I$(srcdir)/../../include \
18 -I$(srcdir)/../../elfcpp -I.. \
19 -DLOCALEDIR="\"$(datadir)/locale\"" \
20 @INCINTL@
21
22 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
29
30 if PLUGINS
31 LIBDL = -ldl
32 endif
33
34 if THREADS
35 THREADSLIB = -lpthread
36 endif
37
38 if OMP_SUPPORT
39 TLS_TEST_C_CFLAGS = -fopenmp
40 endif
41
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
47
48
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.
52 check_SCRIPTS =
53 check_DATA =
54 check_PROGRAMS =
55 BUILT_SOURCES =
56
57 TESTS = $(check_SCRIPTS) $(check_PROGRAMS)
58
59 # ---------------------------------------------------------------------
60 # These tests test the internals of gold (unittests).
61
62 # Infrastucture needed for the unittests
63 check_LIBRARIES = libgoldtest.a
64 libgoldtest_a_SOURCES = test.cc testmain.cc testfile.cc
65
66 DEPENDENCIES = \
67 libgoldtest.a ../libgold.a ../../libiberty/libiberty.a $(LIBINTL_DEP)
68 LDADD = libgoldtest.a ../libgold.a ../../libiberty/libiberty.a $(LIBINTL) \
69 $(THREADSLIB) $(LIBDL)
70
71
72 # The unittests themselves
73 if NATIVE_OR_CROSS_LINKER
74 if GCC
75
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
80 rm -f gcctestdir/ld
81 (cd gcctestdir && $(LN_S) ../../ld-new ld)
82
83 # Some tests require the latest features of an in-tree assembler.
84 gcctestdir/as: $(TEST_AS)
85 test -d gcctestdir || mkdir -p gcctestdir
86 rm -f gcctestdir/as
87 (cd gcctestdir && $(LN_S) $(abs_top_builddir)/../gas/as-new as)
88
89 endif GCC
90
91 check_PROGRAMS += object_unittest
92 object_unittest_SOURCES = object_unittest.cc
93
94 check_PROGRAMS += binary_unittest
95 binary_unittest_SOURCES = binary_unittest.cc
96
97 check_PROGRAMS += leb128_unittest
98 leb128_unittest_SOURCES = leb128_unittest.cc
99
100 endif NATIVE_OR_CROSS_LINKER
101
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.
110
111 if NATIVE_LINKER
112 if GCC
113
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 $@ $<
122
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 > $@
134
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
146
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
156
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
166
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
176
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
186
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
198
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
210
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
222
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
229
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
239
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
249
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
261
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
268
269 if HAVE_STATIC
270 check_PROGRAMS += basic_static_test
271 basic_static_test: basic_test.o gcctestdir/ld
272 $(CXXLINK) -Bgcctestdir/ -static basic_test.o
273 endif
274
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
279
280 if HAVE_STATIC
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
284 endif
285
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
291
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 =
297
298 if HAVE_STATIC
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)
304 endif
305
306 check_PROGRAMS += two_file_test
307 check_PROGRAMS += two_file_pic_test
308 two_file_test_SOURCES = \
309 two_file_test_1.cc \
310 two_file_test_1b.cc \
311 two_file_test_2.cc \
312 two_file_test_main.cc \
313 two_file_test.h
314 two_file_test_DEPENDENCIES = gcctestdir/ld
315 two_file_test_LDFLAGS = -Bgcctestdir/
316 two_file_test_LDADD =
317
318 if HAVE_STATIC
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)
324 endif
325
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
331
332
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
352
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
357
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
362
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
368
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
374
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
379
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
386
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
393
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
402
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
415
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
421
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
425
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
443
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
450
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
457
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
463
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
470
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
477
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
482
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
487
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
492
493 endif FN_PTRS_IN_SO_WITHOUT_PIC
494
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
498
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
507
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 =
513
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
527
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
544
545 exception_test_SOURCES = \
546 exception_test_main.cc \
547 exception_test_1.cc \
548 exception_test_2.cc \
549 exception_test.h
550 exception_test_DEPENDENCIES = gcctestdir/ld
551 exception_test_LDFLAGS = -Bgcctestdir/
552 exception_test_LDADD =
553
554 if HAVE_STATIC
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)
560 endif
561
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
566
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
571
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
576
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
583
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
590
591
592 check_PROGRAMS += weak_test
593 weak_test_SOURCES = weak_test.cc
594 weak_test_DEPENDENCIES = gcctestdir/ld
595 weak_test_LDFLAGS = -Bgcctestdir/
596 weak_test_LDADD =
597
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
613
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
631
632
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
661
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
673
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
687
688 if TLS
689
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
707
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
716
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 $@ $<
723
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 \
726 tls_test_c_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 \
729 -lpthread
730
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
742
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
746
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
751
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
756
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
763
764 if TLS_GNU2_DIALECT
765
766 check_PROGRAMS += tls_shared_gnu2_gd_to_ie_test
767
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
776
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
783
784 if TLS_DESCRIPTORS
785
786 check_PROGRAMS += tls_shared_gnu2_test
787
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
790
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
795
796 endif TLS_DESCRIPTORS
797
798 endif TLS_GNU2_DIALECT
799
800 if HAVE_STATIC
801 if STATIC_TLS
802 check_PROGRAMS += tls_static_test
803 check_PROGRAMS += tls_static_pic_test
804
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)
809
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)
814 endif
815 endif
816
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
821
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
827
828 endif TLS
829
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 =
835
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;"; \
841 done) > $@.tmp
842 mv -f $@.tmp $@
843
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);"; \
849 done) > $@.tmp
850 mv -f $@.tmp $@
851
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)
857
858 check_PROGRAMS += initpri1
859 initpri1_SOURCES = initpri1.c
860 initpri1_DEPENDENCIES = gcctestdir/ld
861 initpri1_LDFLAGS = -Bgcctestdir/
862 initpri1_LDADD =
863
864 check_PROGRAMS += initpri2
865 initpri2_SOURCES = initpri2.c
866 initpri2_DEPENDENCIES = gcctestdir/ld
867 initpri2_LDFLAGS = -Bgcctestdir/ -Wl,--ctors-in-init-array
868 initpri2_LDADD =
869
870 check_PROGRAMS += initpri3a
871 initpri3a_SOURCES = initpri3.c
872 initpri3a_DEPENDENCIES = gcctestdir/ld
873 initpri3a_LDFLAGS = -Bgcctestdir/
874 initpri3a_LDADD =
875
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.
880
881 # check_PROGRAMS += initpri3b
882 # initpri3b_SOURCES = initpri3.c
883 # initpri3b_DEPENDENCIES = gcctestdir/ld
884 # initpri3b_LDFLAGS = -Bgcctestdir/ -Wl,--no-ctors-in-init-array
885 # initpri3b_LDADD =
886
887 # Test --detect-odr-violations
888 check_SCRIPTS += debug_msg.sh
889
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>$@; \
904 then \
905 echo 1>&2 "Link of debug_msg should have failed"; \
906 rm -f $@; \
907 exit 1; \
908 fi
909
910
911 if HAVE_ZLIB
912
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>$@; \
925 then \
926 echo 1>&2 "Link of debug_msg_cdebug should have failed"; \
927 rm -f $@; \
928 exit 1; \
929 fi
930
931 endif HAVE_ZLIB
932
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>$@; \
945 then \
946 echo 1>&2 "Link of debug_msg_so should have failed"; \
947 rm -f $@; \
948 exit 1; \
949 fi
950
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>$@; \
964 then \
965 echo 1>&2 "Link of debug_msg_ndebug should have failed"; \
966 rm -f $@; \
967 exit 1; \
968 fi
969
970
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>$@; \
982 then \
983 echo 1>&2 "Link of undef_symbol_test should have failed"; \
984 rm -f $@; \
985 exit 1; \
986 fi
987
988
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 > $@
993 chmod a+x $@
994 test -s $@
995
996 if HAVE_ZLIB
997
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
1002 test -s $@
1003
1004
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 \
1009 gcctestdir/ld
1010 $(CXXLINK) -Bgcctestdir/ -o /dev/stdout $< -Wl,--compress-debug-sections=zlib 2>&1 | cat > $@
1011 chmod a+x $@
1012 test -s $@
1013
1014 endif HAVE_ZLIB
1015
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
1020
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
1027
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 $@ $<
1048
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
1053
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
1059
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
1064
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
1069
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
1078
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
1084
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
1093
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
1103
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 $@ $<
1113
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
1120
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
1128 $(TEST_AR) rc $@ $^
1129
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
1137
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
1144
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 $@ $<
1153
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
1159
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"; \
1168 rm -f $@; \
1169 exit 1; \
1170 fi
1171
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
1185
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
1193
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 $@ $<
1201
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
1209
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 =
1215
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 =
1221
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
1226 justsyms_LDADD =
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
1231
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
1241
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
1247 binary_test_LDADD =
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
1251 rm -f $@
1252 $(LN_S) $< $@
1253
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
1263
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
1272
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)
1278
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
1286
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)
1292
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
1300
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
1309
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
1317
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
1326
1327
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
1336
1337
1338 # Test --dynamic-list, --dynamic-list-data, --dynamic-list-cpp-new,
1339 # and --dynamic-list-cpp-typeinfo
1340
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
1352
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
1361
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
1367
1368 libthin1.a: thin_archive_test_1.o alt/thin_archive_test_2.o
1369 rm -f $@
1370 $(TEST_AR) crT $@ $^
1371 alt/libthin2.a: thin_archive_test_3.o alt/thin_archive_test_4.o
1372 rm -f $@
1373 $(TEST_AR) crT $@ $^
1374 libthin3.a: thin_archive_test_1.o alt/thin_archive_test_4.o
1375 rm -f $@
1376 $(TEST_AR) crT $@ $^
1377 alt/libthin4.a: alt/thin_archive_test_2.o thin_archive_test_3.o
1378 rm -f $@
1379 $(TEST_AR) crT $@ $^
1380 libthinall.a: libthin3.a alt/libthin4.a
1381 rm -f $@
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 $@ $<
1389
1390 if PLUGINS
1391
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
1400
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
1409
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
1418
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
1427
1428 plugin_test_4.a: two_file_test_1.syms two_file_test_1b.syms two_file_test_2.syms
1429 $(TEST_AR) cr $@ $^
1430
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
1434
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
1443
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
1461
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
1468
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"; \
1477 rm -f $@; \
1478 exit 1; \
1479 fi
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
1484 mv -f $@.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 $@
1489
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 $@ $<
1494
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
1507
1508 empty.syms:
1509 @echo "" >$@
1510 @echo "Symbol table" >>$@
1511
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" >>$@
1516 unused.o: unused.c
1517 $(COMPILE) -c -o $@ $<
1518 unused.c:
1519 @cp /dev/null $@
1520
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
1529
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 $@ $<
1534
1535 endif PLUGINS
1536
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
1553 $(TEST_AR) rc $@ $^
1554 libexclude_libs_test_2.a: exclude_libs_test_2.o
1555 $(TEST_AR) rc $@ $^
1556 alt/libexclude_libs_test_3.a: exclude_libs_test_3.o
1557 test -d alt || mkdir -p alt
1558 $(TEST_AR) rc $@ $^
1559
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
1565
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 $@ $<
1583
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 $@ $<
1590
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 $@ $<
1595
1596 if MCMODEL_MEDIUM
1597 check_PROGRAMS += large
1598 large_SOURCES = large.c
1599 large_CFLAGS = -mcmodel=medium
1600 large_DEPENDENCIES = gcctestdir/ld
1601 large_LDFLAGS = -Bgcctestdir/
1602 large_LDADD =
1603 endif MCMODEL_MEDIUM
1604
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
1616
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 > $@
1632
1633
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
1638 umask 022; \
1639 rm -f $@; \
1640 touch $@; \
1641 chmod 600 $@; \
1642 $(CXXLINK) -Bgcctestdir/ basic_test.o
1643
1644 # Check -l:foo.a
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
1656 $(TEST_AR) rc $@ $^
1657
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 $< > $@
1671
1672 # Test STT_GNU_IFUNC symbols.
1673 if IFUNC
1674
1675 ifuncmod1.o: ifuncmod1.c
1676 $(COMPILE) -c -fPIC -o $@ $<
1677 ifuncmod1.so: ifuncmod1.o gcctestdir/ld
1678 $(LINK) -Bgcctestdir/ -shared ifuncmod1.o
1679
1680 ifuncdep1.o: ifuncmod1.c
1681 $(COMPILE) -c -o $@ $<
1682
1683 ifuncmain1pic.o: ifuncmain1.c
1684 $(COMPILE) -c -fPIC -o $@ $<
1685 ifuncmain1pie.o: ifuncmain1.c
1686 $(COMPILE) -c -fPIE -o $@ $<
1687
1688 if HAVE_STATIC
1689 if IFUNC_STATIC
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
1695
1696 check_PROGRAMS += ifuncmain1picstatic
1697 ifuncmain1picstatic: ifuncmain1pic.o ifuncmod1.o gcctestdir/ld
1698 $(LINK) -Bgcctestdir/ -static ifuncmain1pic.o ifuncmod1.o
1699 endif
1700 endif
1701
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
1707
1708 check_PROGRAMS += ifuncmain1pic
1709 ifuncmain1pic: ifuncmain1pic.o ifuncmod1.so gcctestdir/ld
1710 $(LINK) -Bgcctestdir/ ifuncmain1pic.o ifuncmod1.so -Wl,-R,.
1711
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
1717
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,.
1723
1724 check_PROGRAMS += ifuncmain1staticpic
1725 ifuncmain1staticpic: ifuncmain1pic.o ifuncmod1.o gcctestdir/ld
1726 $(LINK) -Bgcctestdir/ ifuncmain1pic.o ifuncmod1.o
1727
1728 check_PROGRAMS += ifuncmain1pie
1729 ifuncmain1pie: ifuncmain1pie.o ifuncmod1.so gcctestdir/ld
1730 $(LINK) -Bgcctestdir/ -pie ifuncmain1pie.o ifuncmod1.so -Wl,-R,.
1731
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,.
1737
1738 check_PROGRAMS += ifuncmain1staticpie
1739 ifuncmain1staticpie: ifuncmain1pie.o ifuncmod1.o gcctestdir/ld
1740 $(LINK) -Bgcctestdir/ -pie ifuncmain1pie.o ifuncmod1.o
1741
1742 ifuncmain2pic.o: ifuncmain2.c
1743 $(COMPILE) -c -fPIC -o $@ $<
1744
1745 ifuncdep2pic.o: ifuncdep2.c
1746 $(COMPILE) -c -fPIC -o $@ $<
1747
1748 if HAVE_STATIC
1749 if IFUNC_STATIC
1750 check_PROGRAMS += ifuncmain2static
1751 ifuncmain2static_SOURCES = ifuncmain2.c ifuncdep2.c
1752 ifuncmain2static_DEPENDENCIES = gcctestdir/ld
1753 ifuncmain2static_LDFLAGS = -Bgcctestdir/ -static
1754 ifuncmain2static_LDADD =
1755
1756 check_PROGRAMS += ifuncmain2picstatic
1757 ifuncmain2picstatic: ifuncmain2pic.o ifuncdep2pic.o gcctestdir/ld
1758 $(LINK) -Bgcctestdir/ -static ifuncmain2pic.o ifuncdep2pic.o
1759 endif
1760 endif
1761
1762 check_PROGRAMS += ifuncmain2
1763 ifuncmain2_SOURCES = ifuncmain2.c ifuncdep2.c
1764 ifuncmain2_DEPENDENCIES = gcctestdir/ld
1765 ifuncmain2_LDFLAGS = -Bgcctestdir/
1766 ifuncmain2_LDADD =
1767
1768 check_PROGRAMS += ifuncmain2pic
1769 ifuncmain2pic: ifuncmain2pic.o ifuncdep2pic.o gcctestdir/ld
1770 $(LINK) -Bgcctestdir/ ifuncmain2pic.o ifuncdep2pic.o
1771
1772 ifuncmod3.o: ifuncmod3.c
1773 $(COMPILE) -c -fPIC -o $@ $<
1774 ifuncmod3.so: ifuncmod3.o gcctestdir/ld
1775 $(LINK) -Bgcctestdir/ -shared ifuncmod3.o
1776
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
1782
1783 ifuncmain4pic.o: ifuncmain4.c
1784 $(COMPILE) -c -fPIC -o $@ $<
1785
1786 if HAVE_STATIC
1787 if IFUNC_STATIC
1788 check_PROGRAMS += ifuncmain4static
1789 ifuncmain4static_SOURCES = ifuncmain4.c
1790 ifuncmain4static_DEPENDENCIES = gcctestdir/ld
1791 ifuncmain4static_LDFLAGS = -Bgcctestdir/ -static
1792 ifuncmain4static_LDADD =
1793
1794 check_PROGRAMS += ifuncmain4picstatic
1795 ifuncmain4picstatic: ifuncmain4pic.o gcctestdir/ld
1796 $(LINK) -Bgcctestdir/ -static ifuncmain4pic.o
1797 endif
1798 endif
1799
1800 check_PROGRAMS += ifuncmain4
1801 ifuncmain4_SOURCES = ifuncmain4.c
1802 ifuncmain4_DEPENDENCIES = gcctestdir/ld
1803 ifuncmain4_LDFLAGS = -Bgcctestdir/
1804 ifuncmain4_LDADD =
1805
1806 ifuncmain5pic.o: ifuncmain5.c
1807 $(COMPILE) -c -fPIC -o $@ $<
1808
1809 ifuncmain5pie.o: ifuncmain5.c
1810 $(COMPILE) -c -fPIE -o $@ $<
1811
1812 ifuncmod5.o: ifuncmod5.c
1813 $(COMPILE) -c -fPIC -o $@ $<
1814 ifuncmod5.so: ifuncmod5.o gcctestdir/ld
1815 $(LINK) -Bgcctestdir/ -shared ifuncmod5.o
1816
1817 ifuncdep5.o: ifuncmod5.c
1818 $(COMPILE) -c -o $@ $<
1819
1820 if HAVE_STATIC
1821 if IFUNC_STATIC
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
1827
1828 check_PROGRAMS += ifuncmain5picstatic
1829 ifuncmain5picstatic: ifuncmain5pic.o ifuncmod5.o gcctestdir/ld
1830 $(LINK) -Bgcctestdir/ -static ifuncmain5pic.o ifuncmod5.o
1831 endif
1832 endif
1833
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
1839
1840 check_PROGRAMS += ifuncmain5pic
1841 ifuncmain5pic: ifuncmain5pic.o ifuncmod5.so gcctestdir/ld
1842 $(LINK) -Bgcctestdir/ ifuncmain5pic.o ifuncmod5.so -Wl,-R,.
1843
1844 check_PROGRAMS += ifuncmain5staticpic
1845 ifuncmain5staticpic: ifuncmain5pic.o ifuncmod5.o gcctestdir/ld
1846 $(LINK) -Bgcctestdir/ ifuncmain5pic.o ifuncmod5.o
1847
1848 check_PROGRAMS += ifuncmain5pie
1849 ifuncmain5pie: ifuncmain5pie.o ifuncmod5.so gcctestdir/ld
1850 $(LINK) -Bgcctestdir/ -pie ifuncmain5pie.o ifuncmod5.so -Wl,-R,.
1851
1852 ifuncmain6pie.o: ifuncmain6pie.c
1853 $(COMPILE) -c -fPIE -o $@ $<
1854
1855 ifuncmod6.o: ifuncmod6.c
1856 $(COMPILE) -c -fPIC -o $@ $<
1857 ifuncmod6.so: ifuncmod6.o gcctestdir/ld
1858 $(LINK) -Bgcctestdir/ -shared ifuncmod6.o
1859
1860 check_PROGRAMS += ifuncmain6pie
1861 ifuncmain6pie: ifuncmain6pie.o ifuncmod6.so gcctestdir/ld
1862 $(LINK) -Bgcctestdir/ -pie ifuncmain6pie.o ifuncmod6.so -Wl,-R,.
1863
1864 ifuncmain7pic.o: ifuncmain7.c
1865 $(COMPILE) -c -fPIC -o $@ $<
1866
1867 ifuncmain7pie.o: ifuncmain7.c
1868 $(COMPILE) -c -fPIE -o $@ $<
1869
1870 if HAVE_STATIC
1871 if IFUNC_STATIC
1872 check_PROGRAMS += ifuncmain7static
1873 ifuncmain7static_SOURCES = ifuncmain7.c
1874 ifuncmain7static_DEPENDENCIES = gcctestdir/ld
1875 ifuncmain7static_LDFLAGS = -Bgcctestdir/ -static
1876 ifuncmain7static_LDADD =
1877
1878 check_PROGRAMS += ifuncmain7picstatic
1879 ifuncmain7picstatic: ifuncmain7pic.o gcctestdir/ld
1880 $(LINK) -Bgcctestdir/ -static ifuncmain7pic.o
1881 endif
1882 endif
1883
1884 check_PROGRAMS += ifuncmain7
1885 ifuncmain7_SOURCES = ifuncmain7.c
1886 ifuncmain7_DEPENDENCIES = gcctestdir/ld
1887 ifuncmain7_LDFLAGS = -Bgcctestdir/
1888 ifuncmain7_LDADD =
1889
1890 check_PROGRAMS += ifuncmain7pic
1891 ifuncmain7pic: ifuncmain7pic.o gcctestdir/ld
1892 $(LINK) -Bgcctestdir/ ifuncmain7pic.o
1893
1894 check_PROGRAMS += ifuncmain7pie
1895 ifuncmain7pie: ifuncmain7pie.o gcctestdir/ld
1896 $(LINK) -Bgcctestdir/ -pie ifuncmain7pie.o
1897
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
1909
1910 endif IFUNC
1911
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 \
1924 gcctestdir/ld
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 $< > $@
1929
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 \
1935 dyn_weak_ref.stdout
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 $< > $@
1948
1949
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 \
1953 gcctestdir/ld
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
1957 $(TEST_AR) rc $@ $^
1958
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 $< > $@
1969
1970 if HAVE_PUBNAMES
1971
1972 # Test that --gdb-index functions correctly without gcc-generated pubnames.
1973 check_SCRIPTS += gdb_index_test_1.sh
1974 check_DATA += gdb_index_test_1.stdout
1975 MOSTLYCLEANFILES += gdb_index_test_1.stdout gdb_index_test_1
1976 gdb_index_test.o: gdb_index_test.cc
1977 $(CXXCOMPILE) -O0 -g -gno-pubnames -c -o $@ $<
1978 gdb_index_test_1: gdb_index_test.o gcctestdir/ld
1979 $(CXXLINK) -Bgcctestdir/ -Wl,--gdb-index $<
1980 gdb_index_test_1.stdout: gdb_index_test_1
1981 $(TEST_READELF) --debug-dump=gdb_index $< > $@
1982
1983 if HAVE_ZLIB
1984
1985 # Test that --gdb-index functions correctly with compressed debug sections.
1986 check_SCRIPTS += gdb_index_test_2.sh
1987 check_DATA += gdb_index_test_2.stdout
1988 MOSTLYCLEANFILES += gdb_index_test_2.stdout gdb_index_test_2
1989 gdb_index_test_cdebug.o: gdb_index_test.cc
1990 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -Wa,--compress-debug-sections -c -o $@ $<
1991 gdb_index_test_2: gdb_index_test_cdebug.o gcctestdir/ld
1992 $(CXXLINK) -Bgcctestdir/ -Wl,--gdb-index $<
1993 gdb_index_test_2.stdout: gdb_index_test_2
1994 $(TEST_READELF) --debug-dump=gdb_index $< > $@
1995
1996 endif HAVE_ZLIB
1997
1998 # Another simple C test (DW_AT_high_pc encoding) for --gdb-index.
1999 check_SCRIPTS += gdb_index_test_3.sh
2000 check_DATA += gdb_index_test_3.stdout
2001 MOSTLYCLEANFILES += gdb_index_test_3.stdout gdb_index_test_3
2002 gdb_index_test_3.o: gdb_index_test_3.c
2003 $(COMPILE) -O0 -g -c -o $@ $<
2004 gdb_index_test_3: gdb_index_test_3.o gcctestdir/ld
2005 $(LINK) -Bgcctestdir/ -Wl,--gdb-index,--fatal-warnings $<
2006 gdb_index_test_3.stdout: gdb_index_test_3
2007 $(TEST_READELF) --debug-dump=gdb_index $< > $@
2008
2009 # Test that --gdb-index functions correctly with gcc-generated pubnames.
2010 check_SCRIPTS += gdb_index_test_4.sh
2011 check_DATA += gdb_index_test_4.stdout
2012 MOSTLYCLEANFILES += gdb_index_test_4.stdout gdb_index_test_4
2013 gdb_index_test_pub.o: gdb_index_test.cc
2014 $(CXXCOMPILE) -O0 -g -gpubnames -c -o $@ $<
2015 gdb_index_test_4: gdb_index_test_pub.o gcctestdir/ld
2016 $(CXXLINK) -Bgcctestdir/ -Wl,--gdb-index $<
2017 gdb_index_test_4.stdout: gdb_index_test_4
2018 $(TEST_READELF) --debug-dump=gdb_index $< > $@
2019
2020 endif HAVE_PUBNAMES
2021
2022 # End-to-end incremental linking tests.
2023 # Incremental linking is currently supported only on the x86_64 target.
2024
2025 if DEFAULT_TARGET_X86_64
2026
2027 two_file_test_1_v1_ndebug.o: two_file_test_1_v1.cc
2028 $(CXXCOMPILE) -O0 -g0 -c -o $@ $<
2029 two_file_test_1_ndebug.o: two_file_test_1.cc
2030 $(CXXCOMPILE) -O0 -g0 -c -o $@ $<
2031 two_file_test_1b_ndebug.o: two_file_test_1b.cc
2032 $(CXXCOMPILE) -O0 -g0 -c -o $@ $<
2033 two_file_test_2_ndebug.o: two_file_test_2.cc
2034 $(CXXCOMPILE) -O0 -g0 -c -o $@ $<
2035 two_file_test_main_ndebug.o: two_file_test_main.cc
2036 $(CXXCOMPILE) -O0 -g0 -c -o $@ $<
2037
2038 check_PROGRAMS += incremental_test_2
2039 MOSTLYCLEANFILES += two_file_test_tmp_2.o
2040 incremental_test_2: two_file_test_1_v1_ndebug.o two_file_test_1_ndebug.o two_file_test_1b_ndebug.o \
2041 two_file_test_2_ndebug.o two_file_test_main_ndebug.o gcctestdir/ld
2042 cp -f two_file_test_1_v1_ndebug.o two_file_test_tmp_2.o
2043 $(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
2044 @sleep 1
2045 cp -f two_file_test_1_ndebug.o two_file_test_tmp_2.o
2046 $(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
2047
2048 check_PROGRAMS += incremental_test_3
2049 MOSTLYCLEANFILES += two_file_test_tmp_3.o
2050 incremental_test_3: two_file_test_1.o two_file_test_1b_v1.o two_file_test_1b.o \
2051 two_file_test_2.o two_file_test_main.o gcctestdir/ld
2052 cp -f two_file_test_1b_v1.o two_file_test_tmp_3.o
2053 $(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
2054 @sleep 1
2055 cp -f two_file_test_1b.o two_file_test_tmp_3.o
2056 $(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
2057
2058 check_PROGRAMS += incremental_test_4
2059 MOSTLYCLEANFILES += incremental_test_4.base two_file_test_tmp_4.o
2060 incremental_test_4: two_file_test_1.o two_file_test_1b.o two_file_test_2_v1.o \
2061 two_file_test_2.o two_file_test_main.o gcctestdir/ld
2062 cp -f two_file_test_2_v1.o two_file_test_tmp_4.o
2063 $(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
2064 mv -f incremental_test_4 incremental_test_4.base
2065 @sleep 1
2066 cp -f two_file_test_2.o two_file_test_tmp_4.o
2067 $(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
2068
2069 check_PROGRAMS += incremental_test_5
2070 MOSTLYCLEANFILES += two_file_test_5.a
2071 incremental_test_5: two_file_test_1.o two_file_test_1b_v1.o two_file_test_1b.o \
2072 two_file_test_2.o two_file_test_main.o gcctestdir/ld
2073 cp -f two_file_test_1b_v1.o two_file_test_tmp_5.o
2074 $(TEST_AR) rc two_file_test_5.a two_file_test_1.o two_file_test_tmp_5.o two_file_test_2.o
2075 $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Bgcctestdir/ two_file_test_main.o two_file_test_5.a
2076 @sleep 1
2077 cp -f two_file_test_1b.o two_file_test_tmp_5.o
2078 $(TEST_AR) rc two_file_test_5.a two_file_test_1.o two_file_test_tmp_5.o two_file_test_2.o
2079 $(CXXLINK) -Wl,--incremental-update -Bgcctestdir/ two_file_test_main.o two_file_test_5.a
2080
2081 # Test the --incremental-unchanged flag with an archive library.
2082 # The second link should not update the library.
2083 check_PROGRAMS += incremental_test_6
2084 MOSTLYCLEANFILES += two_file_test_6.a
2085 incremental_test_6: two_file_test_1.o two_file_test_1b_v1.o two_file_test_1b.o \
2086 two_file_test_2.o two_file_test_main.o gcctestdir/ld
2087 cp -f two_file_test_1b.o two_file_test_tmp_6.o
2088 $(TEST_AR) rc two_file_test_6.a two_file_test_1.o two_file_test_tmp_6.o two_file_test_2.o
2089 $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Bgcctestdir/ two_file_test_main.o two_file_test_6.a
2090 @sleep 1
2091 cp -f two_file_test_1b_v1.o two_file_test_tmp_6.o
2092 $(TEST_AR) rc two_file_test_6.a two_file_test_1.o two_file_test_tmp_6.o two_file_test_2.o
2093 $(CXXLINK) -Wl,--incremental-update -Bgcctestdir/ two_file_test_main.o -Wl,--incremental-unchanged two_file_test_6.a -Wl,--incremental-unknown
2094
2095 check_PROGRAMS += incremental_copy_test
2096 incremental_copy_test: copy_test_v1.o copy_test.o copy_test_1.so copy_test_2.so
2097 cp -f copy_test_v1.o copy_test_tmp.o
2098 $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Bgcctestdir/ -Wl,-R,. copy_test_tmp.o copy_test_1.so copy_test_2.so
2099 @sleep 1
2100 cp -f copy_test.o copy_test_tmp.o
2101 $(CXXLINK) -Wl,--incremental-update -Bgcctestdir/ -Wl,-R,. copy_test_tmp.o copy_test_1.so copy_test_2.so
2102
2103 check_PROGRAMS += incremental_common_test_1
2104 incremental_common_test_1: common_test_1_v1.o common_test_1_v2.o gcctestdir/ld
2105 cp -f common_test_1_v1.o common_test_1_tmp.o
2106 $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Bgcctestdir/ common_test_1_tmp.o
2107 @sleep 1
2108 cp -f common_test_1_v2.o common_test_1_tmp.o
2109 $(CXXLINK) -Wl,--incremental-update -Bgcctestdir/ common_test_1_tmp.o
2110
2111 check_PROGRAMS += incremental_comdat_test_1
2112 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
2113 cp -f incr_comdat_test_2_v1.o incr_comdat_test_1_tmp.o
2114 $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Bgcctestdir/ incr_comdat_test_1.o incr_comdat_test_1_tmp.o
2115 @sleep 1
2116 cp -f incr_comdat_test_2_v2.o incr_comdat_test_1_tmp.o
2117 $(CXXLINK) -Wl,--incremental-update -Bgcctestdir/ incr_comdat_test_1.o incr_comdat_test_1_tmp.o
2118 @sleep 1
2119 cp -f incr_comdat_test_2_v3.o incr_comdat_test_1_tmp.o
2120 $(CXXLINK) -Wl,--incremental-update -Bgcctestdir/ incr_comdat_test_1.o incr_comdat_test_1_tmp.o
2121
2122 endif DEFAULT_TARGET_X86_64
2123
2124 endif GCC
2125 endif NATIVE_LINKER
2126
2127 # These tests work with native and cross linkers.
2128
2129 if NATIVE_OR_CROSS_LINKER
2130
2131 # Test script section order.
2132 check_SCRIPTS += script_test_10.sh
2133 check_DATA += script_test_10.stdout
2134 script_test_10.o: script_test_10.s
2135 $(TEST_AS) -o $@ $<
2136 script_test_10: $(srcdir)/script_test_10.t script_test_10.o gcctestdir/ld
2137 gcctestdir/ld -o $@ script_test_10.o -T $(srcdir)/script_test_10.t
2138 script_test_10.stdout: script_test_10
2139 $(TEST_READELF) -SW script_test_10 > $@
2140
2141 # These tests work with cross linkers only.
2142
2143 if DEFAULT_TARGET_I386
2144
2145 check_SCRIPTS += split_i386.sh
2146 check_DATA += split_i386_1.stdout split_i386_2.stdout \
2147 split_i386_3.stdout split_i386_4.stdout split_i386_r.stdout
2148 SPLIT_DEFSYMS = --defsym __morestack=0x100 --defsym __morestack_non_split=0x200
2149 split_i386_1.o: split_i386_1.s
2150 $(TEST_AS) -o $@ $<
2151 split_i386_2.o: split_i386_2.s
2152 $(TEST_AS) -o $@ $<
2153 split_i386_3.o: split_i386_3.s
2154 $(TEST_AS) -o $@ $<
2155 split_i386_4.o: split_i386_4.s
2156 $(TEST_AS) -o $@ $<
2157 split_i386_n.o: split_i386_n.s
2158 $(TEST_AS) -o $@ $<
2159 split_i386_1: split_i386_1.o split_i386_n.o ../ld-new
2160 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_i386_1.o split_i386_n.o
2161 split_i386_1.stdout: split_i386_1
2162 $(TEST_OBJDUMP) -d $< > $@
2163 split_i386_2: split_i386_2.o split_i386_n.o ../ld-new
2164 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_i386_2.o split_i386_n.o
2165 split_i386_2.stdout: split_i386_2
2166 $(TEST_OBJDUMP) -d $< > $@
2167 split_i386_3.stdout: split_i386_3.o split_i386_n.o ../ld-new
2168 ../ld-new $(SPLIT_DEFSYMS) -o split_i386_3 split_i386_3.o split_i386_n.o > $@ 2>&1 || exit 0
2169 split_i386_4: split_i386_4.o split_i386_n.o ../ld-new
2170 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_i386_4.o split_i386_n.o
2171 split_i386_4.stdout: split_i386_4
2172 $(TEST_OBJDUMP) -d $< > $@
2173 split_i386_r.stdout: split_i386_1.o split_i386_n.o ../ld-new
2174 ../ld-new -r split_i386_1.o split_i386_n.o -o split_i386_r > $@ 2>&1 || exit 0
2175 MOSTLYCLEANFILES += split_i386_1 split_i386_2 split_i386_3 \
2176 split_i386_4 split_i386_r
2177
2178 endif DEFAULT_TARGET_I386
2179
2180 if DEFAULT_TARGET_X86_64
2181
2182 check_SCRIPTS += split_x86_64.sh
2183 check_DATA += split_x86_64_1.stdout split_x86_64_2.stdout \
2184 split_x86_64_3.stdout split_x86_64_4.stdout split_x86_64_r.stdout
2185 SPLIT_DEFSYMS = --defsym __morestack=0x100 --defsym __morestack_non_split=0x200
2186 split_x86_64_1.o: split_x86_64_1.s
2187 $(TEST_AS) -o $@ $<
2188 split_x86_64_2.o: split_x86_64_2.s
2189 $(TEST_AS) -o $@ $<
2190 split_x86_64_3.o: split_x86_64_3.s
2191 $(TEST_AS) -o $@ $<
2192 split_x86_64_4.o: split_x86_64_4.s
2193 $(TEST_AS) -o $@ $<
2194 split_x86_64_n.o: split_x86_64_n.s
2195 $(TEST_AS) -o $@ $<
2196 split_x86_64_1: split_x86_64_1.o split_x86_64_n.o ../ld-new
2197 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x86_64_1.o split_x86_64_n.o
2198 split_x86_64_1.stdout: split_x86_64_1
2199 $(TEST_OBJDUMP) -d $< > $@
2200 split_x86_64_2: split_x86_64_2.o split_x86_64_n.o ../ld-new
2201 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x86_64_2.o split_x86_64_n.o
2202 split_x86_64_2.stdout: split_x86_64_2
2203 $(TEST_OBJDUMP) -d $< > $@
2204 split_x86_64_3.stdout: split_x86_64_3.o split_x86_64_n.o ../ld-new
2205 ../ld-new $(SPLIT_DEFSYMS) -o split_x86_64_3 split_x86_64_3.o split_x86_64_n.o > $@ 2>&1 || exit 0
2206 split_x86_64_4: split_x86_64_4.o split_x86_64_n.o ../ld-new
2207 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x86_64_4.o split_x86_64_n.o
2208 split_x86_64_4.stdout: split_x86_64_4
2209 $(TEST_OBJDUMP) -d $< > $@
2210 split_x86_64_r.stdout: split_x86_64_1.o split_x86_64_n.o ../ld-new
2211 ../ld-new -r split_x86_64_1.o split_x86_64_n.o -o split_x86_64_r > $@ 2>&1 || exit 0
2212 MOSTLYCLEANFILES += split_x86_64_1 split_x86_64_2 split_x86_64_3 \
2213 split_x86_64_4 split_x86_64_r
2214
2215 endif DEFAULT_TARGET_X86_64
2216
2217 if DEFAULT_TARGET_ARM
2218
2219 check_SCRIPTS += arm_abs_global.sh
2220 check_DATA += arm_abs_global.stdout
2221 arm_abs_lib.o: arm_abs_lib.s
2222 $(TEST_AS) -march=armv7-a -o $@ $<
2223 libarm_abs.so: arm_abs_lib.o ../ld-new
2224 ../ld-new -shared -o $@ arm_abs_lib.o
2225 arm_abs_global.o: arm_abs_global.s
2226 $(TEST_AS) -march=armv7-a -o $@ $<
2227 arm_abs_global: arm_abs_global.o libarm_abs.so ../ld-new
2228 ../ld-new -o $@ arm_abs_global.o -L. -larm_abs
2229 arm_abs_global.stdout: arm_abs_global
2230 $(TEST_READELF) -r $< > $@
2231
2232 MOSTLYCLEANFILES += arm_abs_global
2233
2234 check_SCRIPTS += arm_branch_in_range.sh arm_branch_out_of_range.sh
2235 check_DATA += arm_bl_in_range.stdout arm_bl_out_of_range.stdout \
2236 thumb_bl_in_range.stdout thumb_bl_out_of_range.stdout \
2237 thumb2_bl_in_range.stdout thumb2_bl_out_of_range.stdout \
2238 thumb_blx_in_range.stdout thumb_blx_out_of_range.stdout \
2239 thumb2_blx_in_range.stdout thumb2_blx_out_of_range.stdout \
2240 thumb_bl_out_of_range_local.stdout arm_thm_jump11.stdout \
2241 arm_thm_jump8.stdout
2242
2243 arm_bl_in_range.stdout: arm_bl_in_range
2244 $(TEST_OBJDUMP) -D $< > $@
2245
2246 arm_bl_in_range: arm_bl_in_range.o ../ld-new
2247 ../ld-new -T $(srcdir)/arm_branch_range.t -o $@ $<
2248
2249 arm_bl_in_range.o: arm_bl_in_range.s
2250 $(TEST_AS) -o $@ $<
2251
2252 arm_bl_out_of_range.stdout: arm_bl_out_of_range
2253 $(TEST_OBJDUMP) -S $< > $@
2254
2255 arm_bl_out_of_range: arm_bl_out_of_range.o ../ld-new
2256 ../ld-new -T $(srcdir)/arm_branch_range.t -o $@ $<
2257
2258 arm_bl_out_of_range.o: arm_bl_out_of_range.s
2259 $(TEST_AS) -o $@ $<
2260
2261 thumb_bl_in_range.stdout: thumb_bl_in_range
2262 $(TEST_OBJDUMP) -D $< > $@
2263
2264 thumb_bl_in_range: thumb_bl_in_range.o ../ld-new
2265 ../ld-new --no-fix-arm1176 -T $(srcdir)/thumb_branch_range.t -o $@ $<
2266
2267 thumb_bl_in_range.o: thumb_bl_in_range.s
2268 $(TEST_AS) -o $@ -march=armv5te $<
2269
2270 thumb_bl_out_of_range.stdout: thumb_bl_out_of_range
2271 $(TEST_OBJDUMP) -D $< > $@
2272
2273 thumb_bl_out_of_range: thumb_bl_out_of_range.o ../ld-new
2274 ../ld-new --no-fix-arm1176 -T $(srcdir)/thumb_branch_range.t -o $@ $<
2275
2276 thumb_bl_out_of_range.o: thumb_bl_out_of_range.s
2277 $(TEST_AS) -o $@ -march=armv5te $<
2278
2279 thumb2_bl_in_range.stdout: thumb2_bl_in_range
2280 $(TEST_OBJDUMP) -D $< > $@
2281
2282 thumb2_bl_in_range: thumb2_bl_in_range.o ../ld-new
2283 ../ld-new -T $(srcdir)/thumb2_branch_range.t -o $@ $<
2284
2285 thumb2_bl_in_range.o: thumb_bl_in_range.s
2286 $(TEST_AS) -o $@ -march=armv7-a $<
2287
2288 thumb2_bl_out_of_range.stdout: thumb2_bl_out_of_range
2289 $(TEST_OBJDUMP) -D $< > $@
2290
2291 thumb2_bl_out_of_range: thumb2_bl_out_of_range.o ../ld-new
2292 ../ld-new -T $(srcdir)/thumb2_branch_range.t -o $@ $<
2293
2294 thumb2_bl_out_of_range.o: thumb_bl_out_of_range.s
2295 $(TEST_AS) -o $@ -march=armv7-a $<
2296
2297 thumb_blx_in_range.stdout: thumb_blx_in_range
2298 $(TEST_OBJDUMP) -D $< > $@
2299
2300 thumb_blx_in_range: thumb_blx_in_range.o ../ld-new
2301 ../ld-new --no-fix-arm1176 -T $(srcdir)/thumb_branch_range.t -o $@ $<
2302
2303 thumb_blx_in_range.o: thumb_blx_in_range.s
2304 $(TEST_AS) -o $@ -march=armv5te $<
2305
2306 thumb_blx_out_of_range.stdout: thumb_blx_out_of_range
2307 $(TEST_OBJDUMP) -D $< > $@
2308
2309 thumb_blx_out_of_range: thumb_blx_out_of_range.o ../ld-new
2310 ../ld-new --no-fix-arm1176 -T $(srcdir)/thumb_branch_range.t -o $@ $<
2311
2312 thumb_blx_out_of_range.o: thumb_blx_out_of_range.s
2313 $(TEST_AS) -o $@ -march=armv5te $<
2314
2315 thumb2_blx_in_range.stdout: thumb2_blx_in_range
2316 $(TEST_OBJDUMP) -D $< > $@
2317
2318 thumb2_blx_in_range: thumb2_blx_in_range.o ../ld-new
2319 ../ld-new -T $(srcdir)/thumb2_branch_range.t -o $@ $<
2320
2321 thumb2_blx_in_range.o: thumb_blx_in_range.s
2322 $(TEST_AS) -o $@ -march=armv7-a $<
2323
2324 thumb2_blx_out_of_range.stdout: thumb2_blx_out_of_range
2325 $(TEST_OBJDUMP) -D $< > $@
2326
2327 thumb2_blx_out_of_range: thumb2_blx_out_of_range.o ../ld-new
2328 ../ld-new -T $(srcdir)/thumb2_branch_range.t -o $@ $<
2329
2330 thumb2_blx_out_of_range.o: thumb_blx_out_of_range.s
2331 $(TEST_AS) -o $@ -march=armv7-a $<
2332
2333 thumb_bl_out_of_range_local.stdout: thumb_bl_out_of_range_local
2334 $(TEST_OBJDUMP) -D $< > $@
2335
2336 thumb_bl_out_of_range_local: thumb_bl_out_of_range_local.o ../ld-new
2337 ../ld-new --no-fix-arm1176 -T $(srcdir)/thumb_branch_range.t -o $@ $<
2338
2339 thumb_bl_out_of_range_local.o: thumb_bl_out_of_range_local.s
2340 $(TEST_AS) -o $@ -march=armv5te $<
2341
2342 arm_thm_jump11.stdout: arm_thm_jump11
2343 $(TEST_OBJDUMP) -D $< > $@
2344
2345 arm_thm_jump11: arm_thm_jump11.o ../ld-new
2346 ../ld-new -T $(srcdir)/arm_thm_jump11.t -o $@ $<
2347
2348 arm_thm_jump11.o: arm_thm_jump11.s
2349 $(TEST_AS) -o $@ $<
2350
2351 arm_thm_jump8.stdout: arm_thm_jump8
2352 $(TEST_OBJDUMP) -D $< > $@
2353
2354 arm_thm_jump8: arm_thm_jump8.o ../ld-new
2355 ../ld-new -T $(srcdir)/arm_thm_jump8.t -o $@ $<
2356
2357 arm_thm_jump8.o: arm_thm_jump8.s
2358 $(TEST_AS) -o $@ $<
2359
2360 MOSTLYCLEANFILES += arm_bl_in_range arm_bl_out_of_range thumb_bl_in_range \
2361 thumb_bl_out_of_range thumb2_bl_in_range thumb2_bl_out_of_range \
2362 thumb_blx_in_range thumb_blx_out_of_range thumb2_blx_in_range \
2363 thumb2_blx_out_of_range thumb_bl_out_of_range_local arm_thm_jump11 \
2364 arm_thm_jump8
2365
2366 check_SCRIPTS += arm_fix_v4bx.sh
2367 check_DATA += arm_fix_v4bx.stdout arm_fix_v4bx_interworking.stdout \
2368 arm_no_fix_v4bx.stdout
2369
2370 arm_fix_v4bx.stdout: arm_fix_v4bx
2371 $(TEST_OBJDUMP) -D -j.text $< > $@
2372
2373 arm_fix_v4bx: arm_fix_v4bx.o ../ld-new
2374 ../ld-new --no-fix-arm1176 --fix-v4bx -o $@ $<
2375
2376 arm_fix_v4bx.o: arm_fix_v4bx.s
2377 $(TEST_AS) -o $@ $<
2378
2379 arm_fix_v4bx_interworking.stdout: arm_fix_v4bx_interworking
2380 $(TEST_OBJDUMP) -D -j.text $< > $@
2381
2382 arm_fix_v4bx_interworking: arm_fix_v4bx.o ../ld-new
2383 ../ld-new --no-fix-arm1176 --fix-v4bx-interworking -o $@ $<
2384
2385 arm_no_fix_v4bx.stdout: arm_no_fix_v4bx
2386 $(TEST_OBJDUMP) -D -j.text $< > $@
2387
2388 arm_no_fix_v4bx: arm_fix_v4bx.o ../ld-new
2389 ../ld-new --no-fix-arm1176 -o $@ $<
2390
2391 MOSTLYCLEANFILES += arm_fix_v4bx arm_fix_v4bx_interworking arm_no_fix_v4bx
2392
2393 check_SCRIPTS += arm_attr_merge.sh
2394 check_DATA += arm_attr_merge_6.stdout arm_attr_merge_6r.stdout \
2395 arm_attr_merge_7.stdout
2396
2397 arm_attr_merge_6.stdout: arm_attr_merge_6
2398 $(TEST_READELF) -A $< > $@
2399
2400 arm_attr_merge_6: arm_attr_merge_6a.o arm_attr_merge_6b.o
2401 ../ld-new -o $@ arm_attr_merge_6a.o arm_attr_merge_6b.o
2402
2403 arm_attr_merge_6a.o: arm_attr_merge_6a.s
2404 $(TEST_AS) -o $@ $<
2405
2406 arm_attr_merge_6b.o: arm_attr_merge_6b.s
2407 $(TEST_AS) -o $@ $<
2408
2409 arm_attr_merge_6r.stdout: arm_attr_merge_6r
2410 $(TEST_READELF) -A $< > $@
2411
2412 arm_attr_merge_6r: arm_attr_merge_6b.o arm_attr_merge_6a.o
2413 ../ld-new -o $@ arm_attr_merge_6b.o arm_attr_merge_6a.o
2414
2415 arm_attr_merge_7.stdout: arm_attr_merge_7
2416 $(TEST_READELF) -A $< > $@
2417
2418 arm_attr_merge_7: arm_attr_merge_7a.o arm_attr_merge_7b.o
2419 ../ld-new -o $@ arm_attr_merge_7a.o arm_attr_merge_7b.o
2420
2421 arm_attr_merge_7a.o: arm_attr_merge_7a.s
2422 $(TEST_AS) -o $@ $<
2423
2424 arm_attr_merge_7b.o: arm_attr_merge_7b.s
2425 $(TEST_AS) -o $@ $<
2426
2427 MOSTLYCLEANFILES += arm_attr_merge_6 arm_attr_merge_6r arm_attr_merge_7
2428
2429 # ARM1176 workaround test.
2430 check_SCRIPTS += arm_fix_1176.sh
2431 check_DATA += arm_fix_1176_default_v6z.stdout arm_fix_1176_on_v6z.stdout \
2432 arm_fix_1176_off_v6z.stdout arm_fix_1176_default_v5te.stdout \
2433 arm_fix_1176_default_v7a.stdout arm_fix_1176_default_1156t2f_s.stdout
2434
2435 arm_fix_1176_default_v6z.stdout: arm_fix_1176_default_v6z
2436 $(TEST_OBJDUMP) -D -j.foo $< > $@
2437
2438 arm_fix_1176_default_v6z: arm_fix_1176_default_v6z.o ../ld-new
2439 ../ld-new --section-start=.foo=0x2001014 -o $@ $<
2440
2441 arm_fix_1176_default_v6z.o: arm_fix_1176.s
2442 $(TEST_AS) -march=armv6z -o $@ $<
2443
2444 arm_fix_1176_on_v6z.stdout: arm_fix_1176_on_v6z
2445 $(TEST_OBJDUMP) -D -j.foo $< > $@
2446
2447 arm_fix_1176_on_v6z: arm_fix_1176_on_v6z.o ../ld-new
2448 ../ld-new --section-start=.foo=0x2001014 --fix-arm1176 -o $@ $<
2449
2450 arm_fix_1176_on_v6z.o: arm_fix_1176.s
2451 $(TEST_AS) -march=armv6z -o $@ $<
2452
2453 arm_fix_1176_off_v6z.stdout: arm_fix_1176_off_v6z
2454 $(TEST_OBJDUMP) -D -j.foo $< > $@
2455
2456 arm_fix_1176_off_v6z: arm_fix_1176_off_v6z.o ../ld-new
2457 ../ld-new --section-start=.foo=0x2001014 --no-fix-arm1176 -o $@ $<
2458
2459 arm_fix_1176_off_v6z.o: arm_fix_1176.s
2460 $(TEST_AS) -march=armv6z -o $@ $<
2461
2462 arm_fix_1176_default_v5te.stdout: arm_fix_1176_default_v5te
2463 $(TEST_OBJDUMP) -D -j.foo $< > $@
2464
2465 arm_fix_1176_default_v5te: arm_fix_1176_default_v5te.o ../ld-new
2466 ../ld-new --section-start=.foo=0x2001014 -o $@ $<
2467
2468 arm_fix_1176_default_v5te.o: arm_fix_1176.s
2469 $(TEST_AS) -march=armv5te -o $@ $<
2470
2471 arm_fix_1176_default_v7a.stdout: arm_fix_1176_default_v7a
2472 $(TEST_OBJDUMP) -D -j.foo $< > $@
2473
2474 arm_fix_1176_default_v7a: arm_fix_1176_default_v7a.o ../ld-new
2475 ../ld-new --section-start=.foo=0x2001014 -o $@ $<
2476
2477 arm_fix_1176_default_v7a.o: arm_fix_1176.s
2478 $(TEST_AS) -march=armv7-a -o $@ $<
2479
2480 arm_fix_1176_default_1156t2f_s.stdout: arm_fix_1176_default_1156t2f_s
2481 $(TEST_OBJDUMP) -D -j.foo $< > $@
2482
2483 arm_fix_1176_default_1156t2f_s: arm_fix_1176_default_1156t2f_s.o ../ld-new
2484 ../ld-new --section-start=.foo=0x2001014 -o $@ $<
2485
2486 arm_fix_1176_default_1156t2f_s.o: arm_fix_1176.s
2487 $(TEST_AS) -mcpu=arm1156t2f-s -o $@ $<
2488
2489 MOSTLYCLEANFILES += arm_fix_1176_default_v6z arm_fix_1176_on_v6z arm_fix_1176_off_v6z \
2490 arm_fix_1176_default_v5te arm_fix_1176_default_v7a arm_fix_1176_default_1156t2f_s
2491
2492 # Cortex-A8 workaround test.
2493
2494 check_SCRIPTS += arm_cortex_a8.sh
2495 check_DATA += arm_cortex_a8_b_cond.stdout arm_cortex_a8_b.stdout \
2496 arm_cortex_a8_bl.stdout arm_cortex_a8_blx.stdout \
2497 arm_cortex_a8_local.stdout arm_cortex_a8_local_reloc.stdout
2498
2499 arm_cortex_a8_b_cond.stdout: arm_cortex_a8_b_cond
2500 $(TEST_OBJDUMP) -D -j.text $< > $@
2501
2502 arm_cortex_a8_b_cond: arm_cortex_a8_b_cond.o ../ld-new
2503 ../ld-new -o $@ $<
2504
2505 arm_cortex_a8_b_cond.o: arm_cortex_a8_b_cond.s
2506 $(TEST_AS) -o $@ $<
2507
2508 arm_cortex_a8_b.stdout: arm_cortex_a8_b
2509 $(TEST_OBJDUMP) -D -j.text $< > $@
2510
2511 arm_cortex_a8_b: arm_cortex_a8_b.o ../ld-new
2512 ../ld-new --fix-cortex-a8 -o $@ $<
2513
2514 arm_cortex_a8_b.o: arm_cortex_a8_b.s
2515 $(TEST_AS) -o $@ $<
2516
2517 arm_cortex_a8_bl.stdout: arm_cortex_a8_bl
2518 $(TEST_OBJDUMP) -D -j.text $< > $@
2519
2520 arm_cortex_a8_bl: arm_cortex_a8_bl.o ../ld-new
2521 ../ld-new -o $@ $<
2522
2523 arm_cortex_a8_bl.o: arm_cortex_a8_bl.s
2524 $(TEST_AS) -o $@ $<
2525
2526 arm_cortex_a8_blx.stdout: arm_cortex_a8_blx
2527 $(TEST_OBJDUMP) -D -j.text $< > $@
2528
2529 arm_cortex_a8_blx: arm_cortex_a8_blx.o ../ld-new
2530 ../ld-new -o $@ $<
2531
2532 arm_cortex_a8_blx.o: arm_cortex_a8_blx.s
2533 $(TEST_AS) -o $@ $<
2534
2535 arm_cortex_a8_local.stdout: arm_cortex_a8_local
2536 $(TEST_OBJDUMP) -D -j.text $< > $@
2537
2538 arm_cortex_a8_local: arm_cortex_a8_local.o ../ld-new
2539 ../ld-new -o $@ $<
2540
2541 arm_cortex_a8_local.o: arm_cortex_a8_local.s
2542 $(TEST_AS) -o $@ $<
2543
2544 arm_cortex_a8_local_reloc.stdout: arm_cortex_a8_local_reloc
2545 $(TEST_OBJDUMP) -D -j.text $< > $@
2546
2547 arm_cortex_a8_local_reloc: arm_cortex_a8_local_reloc.o ../ld-new
2548 ../ld-new -o $@ $<
2549
2550 arm_cortex_a8_local_reloc.o: arm_cortex_a8_local_reloc.s
2551 $(TEST_AS) -o $@ $<
2552
2553 MOSTLYCLEANFILES += arm_cortex_a8_b_cond arm_cortex_a8_b arm_cortex_a8_bl \
2554 arm_cortex_a8_blx arm_cortex_a8_local arm_cortex_a8_local_reloc
2555
2556 check_SCRIPTS += arm_exidx_test.sh
2557 check_DATA += arm_exidx_test.stdout
2558
2559 arm_exidx_test.stdout: arm_exidx_test.so
2560 $(TEST_READELF) -Sr $< > $@
2561
2562 arm_exidx_test.so: arm_exidx_test.o ../ld-new
2563 ../ld-new -shared -o $@ $<
2564
2565 arm_exidx_test.o: arm_exidx_test.s
2566 $(TEST_AS) -o $@ $<
2567
2568 check_SCRIPTS += pr12826.sh
2569 check_DATA += pr12826.stdout
2570
2571 pr12826.stdout: pr12826.so
2572 $(TEST_READELF) -A $< > $@
2573
2574 pr12826.so: pr12826_1.o pr12826_2.o ../ld-new
2575 ../ld-new -shared -o $@ $<
2576
2577 pr12826_1.o: pr12826_1.s
2578 $(TEST_AS) -o $@ $<
2579
2580 pr12826_2.o: pr12826_2.s
2581 $(TEST_AS) -o $@ $<
2582
2583 check_SCRIPTS += arm_unaligned_reloc.sh
2584 check_DATA += arm_unaligned_reloc.stdout arm_unaligned_reloc_r.stdout
2585
2586 arm_unaligned_reloc.stdout: arm_unaligned_reloc
2587 $(TEST_OBJDUMP) -D $< > $@
2588
2589 arm_unaligned_reloc_r.stdout: arm_unaligned_reloc_r
2590 $(TEST_OBJDUMP) -Dr $< > $@
2591
2592 arm_unaligned_reloc: arm_unaligned_reloc.o ../ld-new
2593 ../ld-new -o $@ $<
2594
2595 arm_unaligned_reloc_r: arm_unaligned_reloc.o ../ld-new
2596 ../ld-new -r -o $@ $<
2597
2598 arm_unaligned_reloc.o: arm_unaligned_reloc.s
2599 $(TEST_AS) -o $@ $<
2600
2601 MOSTLYCLEANFILES += arm_unaligned_reloc arm_unaligned_reloc_r
2602
2603 # Check ARM to ARM farcall veneers
2604
2605 check_SCRIPTS += arm_farcall_arm_arm.sh
2606 check_DATA += arm_farcall_arm_arm.stdout
2607
2608 arm_farcall_arm_arm.stdout: arm_farcall_arm_arm
2609 $(TEST_OBJDUMP) -d $< > $@
2610
2611 arm_farcall_arm_arm: arm_farcall_arm_arm.o ../ld-new
2612 ../ld-new --no-fix-arm1176 --section-start .text=0x1000 --section-start .foo=0x2001020 -o $@ $<
2613
2614 arm_farcall_arm_arm.o: arm_farcall_arm_arm.s
2615 $(TEST_AS) -o $@ $<
2616
2617 MOSTLYCLEANFILES += arm_farcall_arm_arm
2618
2619 # Check ARM to Thumb farcall veneers
2620
2621 check_SCRIPTS += arm_farcall_arm_thumb.sh
2622 check_DATA += arm_farcall_arm_thumb.stdout arm_farcall_arm_thumb_5t.stdout
2623
2624 arm_farcall_arm_thumb.stdout: arm_farcall_arm_thumb
2625 $(TEST_OBJDUMP) -D $< > $@
2626
2627 arm_farcall_arm_thumb: arm_farcall_arm_thumb.o ../ld-new
2628 ../ld-new --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
2629
2630 arm_farcall_arm_thumb.o: arm_farcall_arm_thumb.s
2631 $(TEST_AS) -o $@ $<
2632
2633 arm_farcall_arm_thumb_5t.stdout: arm_farcall_arm_thumb_5t
2634 $(TEST_OBJDUMP) -D $< > $@
2635
2636 arm_farcall_arm_thumb_5t: arm_farcall_arm_thumb_5t.o ../ld-new
2637 ../ld-new --no-fix-arm1176 --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
2638
2639 arm_farcall_arm_thumb_5t.o: arm_farcall_arm_thumb.s
2640 $(TEST_AS) -march=armv5t -o $@ $<
2641
2642 MOSTLYCLEANFILES += arm_farcall_arm_thumb arm_farcall_arm_thumb_5t
2643
2644 # Check Thumb to Thumb farcall veneers
2645
2646 check_SCRIPTS += arm_farcall_thumb_thumb.sh
2647 check_DATA += arm_farcall_thumb_thumb.stdout \
2648 arm_farcall_thumb_thumb_5t.stdout \
2649 arm_farcall_thumb_thumb_7m.stdout \
2650 arm_farcall_thumb_thumb_6m.stdout
2651
2652 arm_farcall_thumb_thumb.stdout: arm_farcall_thumb_thumb
2653 $(TEST_OBJDUMP) -D $< > $@
2654
2655 arm_farcall_thumb_thumb: arm_farcall_thumb_thumb.o ../ld-new
2656 ../ld-new --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
2657
2658 arm_farcall_thumb_thumb.o: arm_farcall_thumb_thumb.s
2659 $(TEST_AS) -march=armv4t -o $@ $<
2660
2661 arm_farcall_thumb_thumb_5t.stdout: arm_farcall_thumb_thumb_5t
2662 $(TEST_OBJDUMP) -D $< > $@
2663
2664 arm_farcall_thumb_thumb_5t: arm_farcall_thumb_thumb_5t.o ../ld-new
2665 ../ld-new --no-fix-arm1176 --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
2666
2667 arm_farcall_thumb_thumb_5t.o: arm_farcall_thumb_thumb.s
2668 $(TEST_AS) -march=armv5t -o $@ $<
2669
2670 arm_farcall_thumb_thumb_7m.stdout: arm_farcall_thumb_thumb_7m
2671 $(TEST_OBJDUMP) -D $< > $@
2672
2673 arm_farcall_thumb_thumb_7m: arm_farcall_thumb_thumb_7m.o ../ld-new
2674 ../ld-new --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
2675
2676 arm_farcall_thumb_thumb_7m.o: arm_farcall_thumb_thumb.s
2677 $(TEST_AS) -march=armv7-m -o $@ $<
2678
2679 arm_farcall_thumb_thumb_6m.stdout: arm_farcall_thumb_thumb_6m
2680 $(TEST_OBJDUMP) -D $< > $@
2681
2682 arm_farcall_thumb_thumb_6m: arm_farcall_thumb_thumb_6m.o ../ld-new
2683 ../ld-new --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
2684
2685 arm_farcall_thumb_thumb_6m.o: arm_farcall_thumb_thumb.s
2686 $(TEST_AS) -march=armv6-m -o $@ $<
2687
2688 MOSTLYCLEANFILES += arm_farcall_thumb_thumb arm_farcall_thumb_thumb_5t \
2689 arm_farcall_thumb_thumb_7m arm_farcall_thumb_thumb_6m
2690
2691 # Check Thumb to ARM farcall veneers
2692
2693 check_SCRIPTS += arm_farcall_thumb_arm.sh
2694 check_DATA += arm_farcall_thumb_arm.stdout \
2695 arm_farcall_thumb_arm_5t.stdout
2696
2697 arm_farcall_thumb_arm.stdout: arm_farcall_thumb_arm
2698 $(TEST_OBJDUMP) -D $< > $@
2699
2700 arm_farcall_thumb_arm: arm_farcall_thumb_arm.o ../ld-new
2701 ../ld-new --section-start .text=0x1c01010 --section-start .foo=0x2001014 -o $@ $<
2702
2703 arm_farcall_thumb_arm.o: arm_farcall_thumb_arm.s
2704 $(TEST_AS) -o $@ $<
2705
2706 arm_farcall_thumb_arm_5t.stdout: arm_farcall_thumb_arm_5t
2707 $(TEST_OBJDUMP) -D $< > $@
2708
2709 arm_farcall_thumb_arm_5t: arm_farcall_thumb_arm_5t.o ../ld-new
2710 ../ld-new --no-fix-arm1176 --section-start .text=0x1c01010 --section-start .foo=0x2001014 -o $@ $<
2711
2712 arm_farcall_thumb_arm_5t.o: arm_farcall_thumb_arm.s
2713 $(TEST_AS) -march=armv5t -o $@ $<
2714
2715 MOSTLYCLEANFILES += arm_farcall_thumb_arm arm_farcall_thumb_arm_5t
2716
2717 endif DEFAULT_TARGET_ARM
2718
2719 endif NATIVE_OR_CROSS_LINKER
2720