2012-03-16 Doug Kwan <dougkwan@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 # End-to-end incremental linking tests.
1971 # Incremental linking is currently supported only on the x86_64 target.
1972
1973 if DEFAULT_TARGET_X86_64
1974
1975 two_file_test_1_v1_ndebug.o: two_file_test_1_v1.cc
1976 $(CXXCOMPILE) -O0 -g0 -c -o $@ $<
1977 two_file_test_1_ndebug.o: two_file_test_1.cc
1978 $(CXXCOMPILE) -O0 -g0 -c -o $@ $<
1979 two_file_test_1b_ndebug.o: two_file_test_1b.cc
1980 $(CXXCOMPILE) -O0 -g0 -c -o $@ $<
1981 two_file_test_2_ndebug.o: two_file_test_2.cc
1982 $(CXXCOMPILE) -O0 -g0 -c -o $@ $<
1983 two_file_test_main_ndebug.o: two_file_test_main.cc
1984 $(CXXCOMPILE) -O0 -g0 -c -o $@ $<
1985
1986 check_PROGRAMS += incremental_test_2
1987 MOSTLYCLEANFILES += two_file_test_tmp_2.o
1988 incremental_test_2: two_file_test_1_v1_ndebug.o two_file_test_1_ndebug.o two_file_test_1b_ndebug.o \
1989 two_file_test_2_ndebug.o two_file_test_main_ndebug.o gcctestdir/ld
1990 cp -f two_file_test_1_v1_ndebug.o two_file_test_tmp_2.o
1991 $(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
1992 @sleep 1
1993 cp -f two_file_test_1_ndebug.o two_file_test_tmp_2.o
1994 $(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
1995
1996 check_PROGRAMS += incremental_test_3
1997 MOSTLYCLEANFILES += two_file_test_tmp_3.o
1998 incremental_test_3: two_file_test_1.o two_file_test_1b_v1.o two_file_test_1b.o \
1999 two_file_test_2.o two_file_test_main.o gcctestdir/ld
2000 cp -f two_file_test_1b_v1.o two_file_test_tmp_3.o
2001 $(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
2002 @sleep 1
2003 cp -f two_file_test_1b.o two_file_test_tmp_3.o
2004 $(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
2005
2006 check_PROGRAMS += incremental_test_4
2007 MOSTLYCLEANFILES += incremental_test_4.base two_file_test_tmp_4.o
2008 incremental_test_4: two_file_test_1.o two_file_test_1b.o two_file_test_2_v1.o \
2009 two_file_test_2.o two_file_test_main.o gcctestdir/ld
2010 cp -f two_file_test_2_v1.o two_file_test_tmp_4.o
2011 $(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
2012 mv -f incremental_test_4 incremental_test_4.base
2013 @sleep 1
2014 cp -f two_file_test_2.o two_file_test_tmp_4.o
2015 $(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
2016
2017 check_PROGRAMS += incremental_test_5
2018 MOSTLYCLEANFILES += two_file_test_5.a
2019 incremental_test_5: two_file_test_1.o two_file_test_1b_v1.o two_file_test_1b.o \
2020 two_file_test_2.o two_file_test_main.o gcctestdir/ld
2021 cp -f two_file_test_1b_v1.o two_file_test_tmp_5.o
2022 $(TEST_AR) rc two_file_test_5.a two_file_test_1.o two_file_test_tmp_5.o two_file_test_2.o
2023 $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Bgcctestdir/ two_file_test_main.o two_file_test_5.a
2024 @sleep 1
2025 cp -f two_file_test_1b.o two_file_test_tmp_5.o
2026 $(TEST_AR) rc two_file_test_5.a two_file_test_1.o two_file_test_tmp_5.o two_file_test_2.o
2027 $(CXXLINK) -Wl,--incremental-update -Bgcctestdir/ two_file_test_main.o two_file_test_5.a
2028
2029 # Test the --incremental-unchanged flag with an archive library.
2030 # The second link should not update the library.
2031 check_PROGRAMS += incremental_test_6
2032 MOSTLYCLEANFILES += two_file_test_6.a
2033 incremental_test_6: two_file_test_1.o two_file_test_1b_v1.o two_file_test_1b.o \
2034 two_file_test_2.o two_file_test_main.o gcctestdir/ld
2035 cp -f two_file_test_1b.o two_file_test_tmp_6.o
2036 $(TEST_AR) rc two_file_test_6.a two_file_test_1.o two_file_test_tmp_6.o two_file_test_2.o
2037 $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Bgcctestdir/ two_file_test_main.o two_file_test_6.a
2038 @sleep 1
2039 cp -f two_file_test_1b_v1.o two_file_test_tmp_6.o
2040 $(TEST_AR) rc two_file_test_6.a two_file_test_1.o two_file_test_tmp_6.o two_file_test_2.o
2041 $(CXXLINK) -Wl,--incremental-update -Bgcctestdir/ two_file_test_main.o -Wl,--incremental-unchanged two_file_test_6.a -Wl,--incremental-unknown
2042
2043 check_PROGRAMS += incremental_copy_test
2044 incremental_copy_test: copy_test_v1.o copy_test.o copy_test_1.so copy_test_2.so
2045 cp -f copy_test_v1.o copy_test_tmp.o
2046 $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Bgcctestdir/ -Wl,-R,. copy_test_tmp.o copy_test_1.so copy_test_2.so
2047 @sleep 1
2048 cp -f copy_test.o copy_test_tmp.o
2049 $(CXXLINK) -Wl,--incremental-update -Bgcctestdir/ -Wl,-R,. copy_test_tmp.o copy_test_1.so copy_test_2.so
2050
2051 check_PROGRAMS += incremental_common_test_1
2052 incremental_common_test_1: common_test_1_v1.o common_test_1_v2.o gcctestdir/ld
2053 cp -f common_test_1_v1.o common_test_1_tmp.o
2054 $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Bgcctestdir/ common_test_1_tmp.o
2055 @sleep 1
2056 cp -f common_test_1_v2.o common_test_1_tmp.o
2057 $(CXXLINK) -Wl,--incremental-update -Bgcctestdir/ common_test_1_tmp.o
2058
2059 check_PROGRAMS += incremental_comdat_test_1
2060 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
2061 cp -f incr_comdat_test_2_v1.o incr_comdat_test_1_tmp.o
2062 $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Bgcctestdir/ incr_comdat_test_1.o incr_comdat_test_1_tmp.o
2063 @sleep 1
2064 cp -f incr_comdat_test_2_v2.o incr_comdat_test_1_tmp.o
2065 $(CXXLINK) -Wl,--incremental-update -Bgcctestdir/ incr_comdat_test_1.o incr_comdat_test_1_tmp.o
2066 @sleep 1
2067 cp -f incr_comdat_test_2_v3.o incr_comdat_test_1_tmp.o
2068 $(CXXLINK) -Wl,--incremental-update -Bgcctestdir/ incr_comdat_test_1.o incr_comdat_test_1_tmp.o
2069
2070 endif DEFAULT_TARGET_X86_64
2071
2072 endif GCC
2073 endif NATIVE_LINKER
2074
2075 # These tests work with native and cross linkers.
2076
2077 if NATIVE_OR_CROSS_LINKER
2078
2079 # Test script section order.
2080 check_SCRIPTS += script_test_10.sh
2081 check_DATA += script_test_10.stdout
2082 script_test_10.o: script_test_10.s
2083 $(TEST_AS) -o $@ $<
2084 script_test_10: $(srcdir)/script_test_10.t script_test_10.o gcctestdir/ld
2085 gcctestdir/ld -o $@ script_test_10.o -T $(srcdir)/script_test_10.t
2086 script_test_10.stdout: script_test_10
2087 $(TEST_READELF) -SW script_test_10 > $@
2088
2089 # These tests work with cross linkers only.
2090
2091 if DEFAULT_TARGET_I386
2092
2093 check_SCRIPTS += split_i386.sh
2094 check_DATA += split_i386_1.stdout split_i386_2.stdout \
2095 split_i386_3.stdout split_i386_4.stdout split_i386_r.stdout
2096 SPLIT_DEFSYMS = --defsym __morestack=0x100 --defsym __morestack_non_split=0x200
2097 split_i386_1.o: split_i386_1.s
2098 $(TEST_AS) -o $@ $<
2099 split_i386_2.o: split_i386_2.s
2100 $(TEST_AS) -o $@ $<
2101 split_i386_3.o: split_i386_3.s
2102 $(TEST_AS) -o $@ $<
2103 split_i386_4.o: split_i386_4.s
2104 $(TEST_AS) -o $@ $<
2105 split_i386_n.o: split_i386_n.s
2106 $(TEST_AS) -o $@ $<
2107 split_i386_1: split_i386_1.o split_i386_n.o ../ld-new
2108 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_i386_1.o split_i386_n.o
2109 split_i386_1.stdout: split_i386_1
2110 $(TEST_OBJDUMP) -d $< > $@
2111 split_i386_2: split_i386_2.o split_i386_n.o ../ld-new
2112 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_i386_2.o split_i386_n.o
2113 split_i386_2.stdout: split_i386_2
2114 $(TEST_OBJDUMP) -d $< > $@
2115 split_i386_3.stdout: split_i386_3.o split_i386_n.o ../ld-new
2116 ../ld-new $(SPLIT_DEFSYMS) -o split_i386_3 split_i386_3.o split_i386_n.o > $@ 2>&1 || exit 0
2117 split_i386_4: split_i386_4.o split_i386_n.o ../ld-new
2118 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_i386_4.o split_i386_n.o
2119 split_i386_4.stdout: split_i386_4
2120 $(TEST_OBJDUMP) -d $< > $@
2121 split_i386_r.stdout: split_i386_1.o split_i386_n.o ../ld-new
2122 ../ld-new -r split_i386_1.o split_i386_n.o -o split_i386_r > $@ 2>&1 || exit 0
2123 MOSTLYCLEANFILES += split_i386_1 split_i386_2 split_i386_3 \
2124 split_i386_4 split_i386_r
2125
2126 endif DEFAULT_TARGET_I386
2127
2128 if DEFAULT_TARGET_X86_64
2129
2130 check_SCRIPTS += split_x86_64.sh
2131 check_DATA += split_x86_64_1.stdout split_x86_64_2.stdout \
2132 split_x86_64_3.stdout split_x86_64_4.stdout split_x86_64_r.stdout
2133 SPLIT_DEFSYMS = --defsym __morestack=0x100 --defsym __morestack_non_split=0x200
2134 split_x86_64_1.o: split_x86_64_1.s
2135 $(TEST_AS) -o $@ $<
2136 split_x86_64_2.o: split_x86_64_2.s
2137 $(TEST_AS) -o $@ $<
2138 split_x86_64_3.o: split_x86_64_3.s
2139 $(TEST_AS) -o $@ $<
2140 split_x86_64_4.o: split_x86_64_4.s
2141 $(TEST_AS) -o $@ $<
2142 split_x86_64_n.o: split_x86_64_n.s
2143 $(TEST_AS) -o $@ $<
2144 split_x86_64_1: split_x86_64_1.o split_x86_64_n.o ../ld-new
2145 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x86_64_1.o split_x86_64_n.o
2146 split_x86_64_1.stdout: split_x86_64_1
2147 $(TEST_OBJDUMP) -d $< > $@
2148 split_x86_64_2: split_x86_64_2.o split_x86_64_n.o ../ld-new
2149 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x86_64_2.o split_x86_64_n.o
2150 split_x86_64_2.stdout: split_x86_64_2
2151 $(TEST_OBJDUMP) -d $< > $@
2152 split_x86_64_3.stdout: split_x86_64_3.o split_x86_64_n.o ../ld-new
2153 ../ld-new $(SPLIT_DEFSYMS) -o split_x86_64_3 split_x86_64_3.o split_x86_64_n.o > $@ 2>&1 || exit 0
2154 split_x86_64_4: split_x86_64_4.o split_x86_64_n.o ../ld-new
2155 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x86_64_4.o split_x86_64_n.o
2156 split_x86_64_4.stdout: split_x86_64_4
2157 $(TEST_OBJDUMP) -d $< > $@
2158 split_x86_64_r.stdout: split_x86_64_1.o split_x86_64_n.o ../ld-new
2159 ../ld-new -r split_x86_64_1.o split_x86_64_n.o -o split_x86_64_r > $@ 2>&1 || exit 0
2160 MOSTLYCLEANFILES += split_x86_64_1 split_x86_64_2 split_x86_64_3 \
2161 split_x86_64_4 split_x86_64_r
2162
2163 endif DEFAULT_TARGET_X86_64
2164
2165 if DEFAULT_TARGET_ARM
2166
2167 check_SCRIPTS += arm_abs_global.sh
2168 check_DATA += arm_abs_global.stdout
2169 arm_abs_lib.o: arm_abs_lib.s
2170 $(TEST_AS) -march=armv7-a -o $@ $<
2171 libarm_abs.so: arm_abs_lib.o ../ld-new
2172 ../ld-new -shared -o $@ arm_abs_lib.o
2173 arm_abs_global.o: arm_abs_global.s
2174 $(TEST_AS) -march=armv7-a -o $@ $<
2175 arm_abs_global: arm_abs_global.o libarm_abs.so ../ld-new
2176 ../ld-new -o $@ arm_abs_global.o -L. -larm_abs
2177 arm_abs_global.stdout: arm_abs_global
2178 $(TEST_READELF) -r $< > $@
2179
2180 MOSTLYCLEANFILES += arm_abs_global
2181
2182 check_SCRIPTS += arm_branch_in_range.sh arm_branch_out_of_range.sh
2183 check_DATA += arm_bl_in_range.stdout arm_bl_out_of_range.stdout \
2184 thumb_bl_in_range.stdout thumb_bl_out_of_range.stdout \
2185 thumb2_bl_in_range.stdout thumb2_bl_out_of_range.stdout \
2186 thumb_blx_in_range.stdout thumb_blx_out_of_range.stdout \
2187 thumb2_blx_in_range.stdout thumb2_blx_out_of_range.stdout \
2188 thumb_bl_out_of_range_local.stdout arm_thm_jump11.stdout \
2189 arm_thm_jump8.stdout
2190
2191 arm_bl_in_range.stdout: arm_bl_in_range
2192 $(TEST_OBJDUMP) -D $< > $@
2193
2194 arm_bl_in_range: arm_bl_in_range.o ../ld-new
2195 ../ld-new -T $(srcdir)/arm_branch_range.t -o $@ $<
2196
2197 arm_bl_in_range.o: arm_bl_in_range.s
2198 $(TEST_AS) -o $@ $<
2199
2200 arm_bl_out_of_range.stdout: arm_bl_out_of_range
2201 $(TEST_OBJDUMP) -S $< > $@
2202
2203 arm_bl_out_of_range: arm_bl_out_of_range.o ../ld-new
2204 ../ld-new -T $(srcdir)/arm_branch_range.t -o $@ $<
2205
2206 arm_bl_out_of_range.o: arm_bl_out_of_range.s
2207 $(TEST_AS) -o $@ $<
2208
2209 thumb_bl_in_range.stdout: thumb_bl_in_range
2210 $(TEST_OBJDUMP) -D $< > $@
2211
2212 thumb_bl_in_range: thumb_bl_in_range.o ../ld-new
2213 ../ld-new --no-fix-arm1176 -T $(srcdir)/thumb_branch_range.t -o $@ $<
2214
2215 thumb_bl_in_range.o: thumb_bl_in_range.s
2216 $(TEST_AS) -o $@ -march=armv5te $<
2217
2218 thumb_bl_out_of_range.stdout: thumb_bl_out_of_range
2219 $(TEST_OBJDUMP) -D $< > $@
2220
2221 thumb_bl_out_of_range: thumb_bl_out_of_range.o ../ld-new
2222 ../ld-new --no-fix-arm1176 -T $(srcdir)/thumb_branch_range.t -o $@ $<
2223
2224 thumb_bl_out_of_range.o: thumb_bl_out_of_range.s
2225 $(TEST_AS) -o $@ -march=armv5te $<
2226
2227 thumb2_bl_in_range.stdout: thumb2_bl_in_range
2228 $(TEST_OBJDUMP) -D $< > $@
2229
2230 thumb2_bl_in_range: thumb2_bl_in_range.o ../ld-new
2231 ../ld-new -T $(srcdir)/thumb2_branch_range.t -o $@ $<
2232
2233 thumb2_bl_in_range.o: thumb_bl_in_range.s
2234 $(TEST_AS) -o $@ -march=armv7-a $<
2235
2236 thumb2_bl_out_of_range.stdout: thumb2_bl_out_of_range
2237 $(TEST_OBJDUMP) -D $< > $@
2238
2239 thumb2_bl_out_of_range: thumb2_bl_out_of_range.o ../ld-new
2240 ../ld-new -T $(srcdir)/thumb2_branch_range.t -o $@ $<
2241
2242 thumb2_bl_out_of_range.o: thumb_bl_out_of_range.s
2243 $(TEST_AS) -o $@ -march=armv7-a $<
2244
2245 thumb_blx_in_range.stdout: thumb_blx_in_range
2246 $(TEST_OBJDUMP) -D $< > $@
2247
2248 thumb_blx_in_range: thumb_blx_in_range.o ../ld-new
2249 ../ld-new --no-fix-arm1176 -T $(srcdir)/thumb_branch_range.t -o $@ $<
2250
2251 thumb_blx_in_range.o: thumb_blx_in_range.s
2252 $(TEST_AS) -o $@ -march=armv5te $<
2253
2254 thumb_blx_out_of_range.stdout: thumb_blx_out_of_range
2255 $(TEST_OBJDUMP) -D $< > $@
2256
2257 thumb_blx_out_of_range: thumb_blx_out_of_range.o ../ld-new
2258 ../ld-new --no-fix-arm1176 -T $(srcdir)/thumb_branch_range.t -o $@ $<
2259
2260 thumb_blx_out_of_range.o: thumb_blx_out_of_range.s
2261 $(TEST_AS) -o $@ -march=armv5te $<
2262
2263 thumb2_blx_in_range.stdout: thumb2_blx_in_range
2264 $(TEST_OBJDUMP) -D $< > $@
2265
2266 thumb2_blx_in_range: thumb2_blx_in_range.o ../ld-new
2267 ../ld-new -T $(srcdir)/thumb2_branch_range.t -o $@ $<
2268
2269 thumb2_blx_in_range.o: thumb_blx_in_range.s
2270 $(TEST_AS) -o $@ -march=armv7-a $<
2271
2272 thumb2_blx_out_of_range.stdout: thumb2_blx_out_of_range
2273 $(TEST_OBJDUMP) -D $< > $@
2274
2275 thumb2_blx_out_of_range: thumb2_blx_out_of_range.o ../ld-new
2276 ../ld-new -T $(srcdir)/thumb2_branch_range.t -o $@ $<
2277
2278 thumb2_blx_out_of_range.o: thumb_blx_out_of_range.s
2279 $(TEST_AS) -o $@ -march=armv7-a $<
2280
2281 thumb_bl_out_of_range_local.stdout: thumb_bl_out_of_range_local
2282 $(TEST_OBJDUMP) -D $< > $@
2283
2284 thumb_bl_out_of_range_local: thumb_bl_out_of_range_local.o ../ld-new
2285 ../ld-new --no-fix-arm1176 -T $(srcdir)/thumb_branch_range.t -o $@ $<
2286
2287 thumb_bl_out_of_range_local.o: thumb_bl_out_of_range_local.s
2288 $(TEST_AS) -o $@ -march=armv5te $<
2289
2290 arm_thm_jump11.stdout: arm_thm_jump11
2291 $(TEST_OBJDUMP) -D $< > $@
2292
2293 arm_thm_jump11: arm_thm_jump11.o ../ld-new
2294 ../ld-new -T $(srcdir)/arm_thm_jump11.t -o $@ $<
2295
2296 arm_thm_jump11.o: arm_thm_jump11.s
2297 $(TEST_AS) -o $@ $<
2298
2299 arm_thm_jump8.stdout: arm_thm_jump8
2300 $(TEST_OBJDUMP) -D $< > $@
2301
2302 arm_thm_jump8: arm_thm_jump8.o ../ld-new
2303 ../ld-new -T $(srcdir)/arm_thm_jump8.t -o $@ $<
2304
2305 arm_thm_jump8.o: arm_thm_jump8.s
2306 $(TEST_AS) -o $@ $<
2307
2308 MOSTLYCLEANFILES += arm_bl_in_range arm_bl_out_of_range thumb_bl_in_range \
2309 thumb_bl_out_of_range thumb2_bl_in_range thumb2_bl_out_of_range \
2310 thumb_blx_in_range thumb_blx_out_of_range thumb2_blx_in_range \
2311 thumb2_blx_out_of_range thumb_bl_out_of_range_local arm_thm_jump11 \
2312 arm_thm_jump8
2313
2314 check_SCRIPTS += arm_fix_v4bx.sh
2315 check_DATA += arm_fix_v4bx.stdout arm_fix_v4bx_interworking.stdout \
2316 arm_no_fix_v4bx.stdout
2317
2318 arm_fix_v4bx.stdout: arm_fix_v4bx
2319 $(TEST_OBJDUMP) -D -j.text $< > $@
2320
2321 arm_fix_v4bx: arm_fix_v4bx.o ../ld-new
2322 ../ld-new --no-fix-arm1176 --fix-v4bx -o $@ $<
2323
2324 arm_fix_v4bx.o: arm_fix_v4bx.s
2325 $(TEST_AS) -o $@ $<
2326
2327 arm_fix_v4bx_interworking.stdout: arm_fix_v4bx_interworking
2328 $(TEST_OBJDUMP) -D -j.text $< > $@
2329
2330 arm_fix_v4bx_interworking: arm_fix_v4bx.o ../ld-new
2331 ../ld-new --no-fix-arm1176 --fix-v4bx-interworking -o $@ $<
2332
2333 arm_no_fix_v4bx.stdout: arm_no_fix_v4bx
2334 $(TEST_OBJDUMP) -D -j.text $< > $@
2335
2336 arm_no_fix_v4bx: arm_fix_v4bx.o ../ld-new
2337 ../ld-new --no-fix-arm1176 -o $@ $<
2338
2339 MOSTLYCLEANFILES += arm_fix_v4bx arm_fix_v4bx_interworking arm_no_fix_v4bx
2340
2341 check_SCRIPTS += arm_attr_merge.sh
2342 check_DATA += arm_attr_merge_6.stdout arm_attr_merge_6r.stdout \
2343 arm_attr_merge_7.stdout
2344
2345 arm_attr_merge_6.stdout: arm_attr_merge_6
2346 $(TEST_READELF) -A $< > $@
2347
2348 arm_attr_merge_6: arm_attr_merge_6a.o arm_attr_merge_6b.o
2349 ../ld-new -o $@ arm_attr_merge_6a.o arm_attr_merge_6b.o
2350
2351 arm_attr_merge_6a.o: arm_attr_merge_6a.s
2352 $(TEST_AS) -o $@ $<
2353
2354 arm_attr_merge_6b.o: arm_attr_merge_6b.s
2355 $(TEST_AS) -o $@ $<
2356
2357 arm_attr_merge_6r.stdout: arm_attr_merge_6r
2358 $(TEST_READELF) -A $< > $@
2359
2360 arm_attr_merge_6r: arm_attr_merge_6b.o arm_attr_merge_6a.o
2361 ../ld-new -o $@ arm_attr_merge_6b.o arm_attr_merge_6a.o
2362
2363 arm_attr_merge_7.stdout: arm_attr_merge_7
2364 $(TEST_READELF) -A $< > $@
2365
2366 arm_attr_merge_7: arm_attr_merge_7a.o arm_attr_merge_7b.o
2367 ../ld-new -o $@ arm_attr_merge_7a.o arm_attr_merge_7b.o
2368
2369 arm_attr_merge_7a.o: arm_attr_merge_7a.s
2370 $(TEST_AS) -o $@ $<
2371
2372 arm_attr_merge_7b.o: arm_attr_merge_7b.s
2373 $(TEST_AS) -o $@ $<
2374
2375 MOSTLYCLEANFILES += arm_attr_merge_6 arm_attr_merge_6r arm_attr_merge_7
2376
2377 # ARM1176 workaround test.
2378 check_SCRIPTS += arm_fix_1176.sh
2379 check_DATA += arm_fix_1176_default_v6z.stdout arm_fix_1176_on_v6z.stdout \
2380 arm_fix_1176_off_v6z.stdout arm_fix_1176_default_v5te.stdout \
2381 arm_fix_1176_default_v7a.stdout arm_fix_1176_default_1156t2f_s.stdout
2382
2383 arm_fix_1176_default_v6z.stdout: arm_fix_1176_default_v6z
2384 $(TEST_OBJDUMP) -D -j.foo $< > $@
2385
2386 arm_fix_1176_default_v6z: arm_fix_1176_default_v6z.o ../ld-new
2387 ../ld-new --section-start=.foo=0x2001014 -o $@ $<
2388
2389 arm_fix_1176_default_v6z.o: arm_fix_1176.s
2390 $(TEST_AS) -march=armv6z -o $@ $<
2391
2392 arm_fix_1176_on_v6z.stdout: arm_fix_1176_on_v6z
2393 $(TEST_OBJDUMP) -D -j.foo $< > $@
2394
2395 arm_fix_1176_on_v6z: arm_fix_1176_on_v6z.o ../ld-new
2396 ../ld-new --section-start=.foo=0x2001014 --fix-arm1176 -o $@ $<
2397
2398 arm_fix_1176_on_v6z.o: arm_fix_1176.s
2399 $(TEST_AS) -march=armv6z -o $@ $<
2400
2401 arm_fix_1176_off_v6z.stdout: arm_fix_1176_off_v6z
2402 $(TEST_OBJDUMP) -D -j.foo $< > $@
2403
2404 arm_fix_1176_off_v6z: arm_fix_1176_off_v6z.o ../ld-new
2405 ../ld-new --section-start=.foo=0x2001014 --no-fix-arm1176 -o $@ $<
2406
2407 arm_fix_1176_off_v6z.o: arm_fix_1176.s
2408 $(TEST_AS) -march=armv6z -o $@ $<
2409
2410 arm_fix_1176_default_v5te.stdout: arm_fix_1176_default_v5te
2411 $(TEST_OBJDUMP) -D -j.foo $< > $@
2412
2413 arm_fix_1176_default_v5te: arm_fix_1176_default_v5te.o ../ld-new
2414 ../ld-new --section-start=.foo=0x2001014 -o $@ $<
2415
2416 arm_fix_1176_default_v5te.o: arm_fix_1176.s
2417 $(TEST_AS) -march=armv5te -o $@ $<
2418
2419 arm_fix_1176_default_v7a.stdout: arm_fix_1176_default_v7a
2420 $(TEST_OBJDUMP) -D -j.foo $< > $@
2421
2422 arm_fix_1176_default_v7a: arm_fix_1176_default_v7a.o ../ld-new
2423 ../ld-new --section-start=.foo=0x2001014 -o $@ $<
2424
2425 arm_fix_1176_default_v7a.o: arm_fix_1176.s
2426 $(TEST_AS) -march=armv7-a -o $@ $<
2427
2428 arm_fix_1176_default_1156t2f_s.stdout: arm_fix_1176_default_1156t2f_s
2429 $(TEST_OBJDUMP) -D -j.foo $< > $@
2430
2431 arm_fix_1176_default_1156t2f_s: arm_fix_1176_default_1156t2f_s.o ../ld-new
2432 ../ld-new --section-start=.foo=0x2001014 -o $@ $<
2433
2434 arm_fix_1176_default_1156t2f_s.o: arm_fix_1176.s
2435 $(TEST_AS) -mcpu=arm1156t2f-s -o $@ $<
2436
2437 MOSTLYCLEANFILES += arm_fix_1176_default_v6z arm_fix_1176_on_v6z arm_fix_1176_off_v6z \
2438 arm_fix_1176_default_v5te arm_fix_1176_default_v7a arm_fix_1176_default_1156t2f_s
2439
2440 # Cortex-A8 workaround test.
2441
2442 check_SCRIPTS += arm_cortex_a8.sh
2443 check_DATA += arm_cortex_a8_b_cond.stdout arm_cortex_a8_b.stdout \
2444 arm_cortex_a8_bl.stdout arm_cortex_a8_blx.stdout \
2445 arm_cortex_a8_local.stdout arm_cortex_a8_local_reloc.stdout
2446
2447 arm_cortex_a8_b_cond.stdout: arm_cortex_a8_b_cond
2448 $(TEST_OBJDUMP) -D -j.text $< > $@
2449
2450 arm_cortex_a8_b_cond: arm_cortex_a8_b_cond.o ../ld-new
2451 ../ld-new -o $@ $<
2452
2453 arm_cortex_a8_b_cond.o: arm_cortex_a8_b_cond.s
2454 $(TEST_AS) -o $@ $<
2455
2456 arm_cortex_a8_b.stdout: arm_cortex_a8_b
2457 $(TEST_OBJDUMP) -D -j.text $< > $@
2458
2459 arm_cortex_a8_b: arm_cortex_a8_b.o ../ld-new
2460 ../ld-new --fix-cortex-a8 -o $@ $<
2461
2462 arm_cortex_a8_b.o: arm_cortex_a8_b.s
2463 $(TEST_AS) -o $@ $<
2464
2465 arm_cortex_a8_bl.stdout: arm_cortex_a8_bl
2466 $(TEST_OBJDUMP) -D -j.text $< > $@
2467
2468 arm_cortex_a8_bl: arm_cortex_a8_bl.o ../ld-new
2469 ../ld-new -o $@ $<
2470
2471 arm_cortex_a8_bl.o: arm_cortex_a8_bl.s
2472 $(TEST_AS) -o $@ $<
2473
2474 arm_cortex_a8_blx.stdout: arm_cortex_a8_blx
2475 $(TEST_OBJDUMP) -D -j.text $< > $@
2476
2477 arm_cortex_a8_blx: arm_cortex_a8_blx.o ../ld-new
2478 ../ld-new -o $@ $<
2479
2480 arm_cortex_a8_blx.o: arm_cortex_a8_blx.s
2481 $(TEST_AS) -o $@ $<
2482
2483 arm_cortex_a8_local.stdout: arm_cortex_a8_local
2484 $(TEST_OBJDUMP) -D -j.text $< > $@
2485
2486 arm_cortex_a8_local: arm_cortex_a8_local.o ../ld-new
2487 ../ld-new -o $@ $<
2488
2489 arm_cortex_a8_local.o: arm_cortex_a8_local.s
2490 $(TEST_AS) -o $@ $<
2491
2492 arm_cortex_a8_local_reloc.stdout: arm_cortex_a8_local_reloc
2493 $(TEST_OBJDUMP) -D -j.text $< > $@
2494
2495 arm_cortex_a8_local_reloc: arm_cortex_a8_local_reloc.o ../ld-new
2496 ../ld-new -o $@ $<
2497
2498 arm_cortex_a8_local_reloc.o: arm_cortex_a8_local_reloc.s
2499 $(TEST_AS) -o $@ $<
2500
2501 MOSTLYCLEANFILES += arm_cortex_a8_b_cond arm_cortex_a8_b arm_cortex_a8_bl \
2502 arm_cortex_a8_blx arm_cortex_a8_local arm_cortex_a8_local_reloc
2503
2504 check_SCRIPTS += arm_exidx_test.sh
2505 check_DATA += arm_exidx_test.stdout
2506
2507 arm_exidx_test.stdout: arm_exidx_test.so
2508 $(TEST_READELF) -S $< > $@
2509
2510 arm_exidx_test.so: arm_exidx_test.o ../ld-new
2511 ../ld-new -shared -o $@ $<
2512
2513 arm_exidx_test.o: arm_exidx_test.s
2514 $(TEST_AS) -o $@ $<
2515
2516 check_SCRIPTS += pr12826.sh
2517 check_DATA += pr12826.stdout
2518
2519 pr12826.stdout: pr12826.so
2520 $(TEST_READELF) -A $< > $@
2521
2522 pr12826.so: pr12826_1.o pr12826_2.o ../ld-new
2523 ../ld-new -shared -o $@ $<
2524
2525 pr12826_1.o: pr12826_1.s
2526 $(TEST_AS) -o $@ $<
2527
2528 pr12826_2.o: pr12826_2.s
2529 $(TEST_AS) -o $@ $<
2530
2531 check_SCRIPTS += arm_unaligned_reloc.sh
2532 check_DATA += arm_unaligned_reloc.stdout arm_unaligned_reloc_r.stdout
2533
2534 arm_unaligned_reloc.stdout: arm_unaligned_reloc
2535 $(TEST_OBJDUMP) -D $< > $@
2536
2537 arm_unaligned_reloc_r.stdout: arm_unaligned_reloc_r
2538 $(TEST_OBJDUMP) -Dr $< > $@
2539
2540 arm_unaligned_reloc: arm_unaligned_reloc.o ../ld-new
2541 ../ld-new -o $@ $<
2542
2543 arm_unaligned_reloc_r: arm_unaligned_reloc.o ../ld-new
2544 ../ld-new -r -o $@ $<
2545
2546 arm_unaligned_reloc.o: arm_unaligned_reloc.s
2547 $(TEST_AS) -o $@ $<
2548
2549 MOSTLYCLEANFILES += arm_unaligned_reloc arm_unaligned_reloc_r
2550
2551 # Check ARM to ARM farcall veneers
2552
2553 check_SCRIPTS += arm_farcall_arm_arm.sh
2554 check_DATA += arm_farcall_arm_arm.stdout
2555
2556 arm_farcall_arm_arm.stdout: arm_farcall_arm_arm
2557 $(TEST_OBJDUMP) -d $< > $@
2558
2559 arm_farcall_arm_arm: arm_farcall_arm_arm.o ../ld-new
2560 ../ld-new --no-fix-arm1176 --section-start .text=0x1000 --section-start .foo=0x2001020 -o $@ $<
2561
2562 arm_farcall_arm_arm.o: arm_farcall_arm_arm.s
2563 $(TEST_AS) -o $@ $<
2564
2565 MOSTLYCLEANFILES += arm_farcall_arm_arm
2566
2567 # Check ARM to Thumb farcall veneers
2568
2569 check_SCRIPTS += arm_farcall_arm_thumb.sh
2570 check_DATA += arm_farcall_arm_thumb.stdout arm_farcall_arm_thumb_5t.stdout
2571
2572 arm_farcall_arm_thumb.stdout: arm_farcall_arm_thumb
2573 $(TEST_OBJDUMP) -D $< > $@
2574
2575 arm_farcall_arm_thumb: arm_farcall_arm_thumb.o ../ld-new
2576 ../ld-new --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
2577
2578 arm_farcall_arm_thumb.o: arm_farcall_arm_thumb.s
2579 $(TEST_AS) -o $@ $<
2580
2581 arm_farcall_arm_thumb_5t.stdout: arm_farcall_arm_thumb_5t
2582 $(TEST_OBJDUMP) -D $< > $@
2583
2584 arm_farcall_arm_thumb_5t: arm_farcall_arm_thumb_5t.o ../ld-new
2585 ../ld-new --no-fix-arm1176 --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
2586
2587 arm_farcall_arm_thumb_5t.o: arm_farcall_arm_thumb.s
2588 $(TEST_AS) -march=armv5t -o $@ $<
2589
2590 MOSTLYCLEANFILES += arm_farcall_arm_thumb arm_farcall_arm_thumb_5t
2591
2592 # Check Thumb to Thumb farcall veneers
2593
2594 check_SCRIPTS += arm_farcall_thumb_thumb.sh
2595 check_DATA += arm_farcall_thumb_thumb.stdout \
2596 arm_farcall_thumb_thumb_5t.stdout \
2597 arm_farcall_thumb_thumb_7m.stdout \
2598 arm_farcall_thumb_thumb_6m.stdout
2599
2600 arm_farcall_thumb_thumb.stdout: arm_farcall_thumb_thumb
2601 $(TEST_OBJDUMP) -D $< > $@
2602
2603 arm_farcall_thumb_thumb: arm_farcall_thumb_thumb.o ../ld-new
2604 ../ld-new --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
2605
2606 arm_farcall_thumb_thumb.o: arm_farcall_thumb_thumb.s
2607 $(TEST_AS) -march=armv4t -o $@ $<
2608
2609 arm_farcall_thumb_thumb_5t.stdout: arm_farcall_thumb_thumb_5t
2610 $(TEST_OBJDUMP) -D $< > $@
2611
2612 arm_farcall_thumb_thumb_5t: arm_farcall_thumb_thumb_5t.o ../ld-new
2613 ../ld-new --no-fix-arm1176 --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
2614
2615 arm_farcall_thumb_thumb_5t.o: arm_farcall_thumb_thumb.s
2616 $(TEST_AS) -march=armv5t -o $@ $<
2617
2618 arm_farcall_thumb_thumb_7m.stdout: arm_farcall_thumb_thumb_7m
2619 $(TEST_OBJDUMP) -D $< > $@
2620
2621 arm_farcall_thumb_thumb_7m: arm_farcall_thumb_thumb_7m.o ../ld-new
2622 ../ld-new --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
2623
2624 arm_farcall_thumb_thumb_7m.o: arm_farcall_thumb_thumb.s
2625 $(TEST_AS) -march=armv7-m -o $@ $<
2626
2627 arm_farcall_thumb_thumb_6m.stdout: arm_farcall_thumb_thumb_6m
2628 $(TEST_OBJDUMP) -D $< > $@
2629
2630 arm_farcall_thumb_thumb_6m: arm_farcall_thumb_thumb_6m.o ../ld-new
2631 ../ld-new --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
2632
2633 arm_farcall_thumb_thumb_6m.o: arm_farcall_thumb_thumb.s
2634 $(TEST_AS) -march=armv6-m -o $@ $<
2635
2636 MOSTLYCLEANFILES += arm_farcall_thumb_thumb arm_farcall_thumb_thumb_5t \
2637 arm_farcall_thumb_thumb_7m arm_farcall_thumb_thumb_6m
2638
2639 # Check Thumb to ARM farcall veneers
2640
2641 check_SCRIPTS += arm_farcall_thumb_arm.sh
2642 check_DATA += arm_farcall_thumb_arm.stdout \
2643 arm_farcall_thumb_arm_5t.stdout
2644
2645 arm_farcall_thumb_arm.stdout: arm_farcall_thumb_arm
2646 $(TEST_OBJDUMP) -D $< > $@
2647
2648 arm_farcall_thumb_arm: arm_farcall_thumb_arm.o ../ld-new
2649 ../ld-new --section-start .text=0x1c01010 --section-start .foo=0x2001014 -o $@ $<
2650
2651 arm_farcall_thumb_arm.o: arm_farcall_thumb_arm.s
2652 $(TEST_AS) -o $@ $<
2653
2654 arm_farcall_thumb_arm_5t.stdout: arm_farcall_thumb_arm_5t
2655 $(TEST_OBJDUMP) -D $< > $@
2656
2657 arm_farcall_thumb_arm_5t: arm_farcall_thumb_arm_5t.o ../ld-new
2658 ../ld-new --no-fix-arm1176 --section-start .text=0x1c01010 --section-start .foo=0x2001014 -o $@ $<
2659
2660 arm_farcall_thumb_arm_5t.o: arm_farcall_thumb_arm.s
2661 $(TEST_AS) -march=armv5t -o $@ $<
2662
2663 MOSTLYCLEANFILES += arm_farcall_thumb_arm arm_farcall_thumb_arm_5t
2664
2665 endif DEFAULT_TARGET_ARM
2666
2667 endif NATIVE_OR_CROSS_LINKER
2668