include/ChangeLog
[deliverable/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 endif NATIVE_OR_CROSS_LINKER
98
99 # ---------------------------------------------------------------------
100 # These tests test the output of gold (end-to-end tests). In
101 # particular, they make sure that gold can link "difficult" object
102 # files, and the resulting object files run correctly. These can only
103 # run if we've built ld-new for the native architecture (that is,
104 # we're not cross-compiling it), since we run ld-new as part of these
105 # tests. We use the gcc-specific flag '-B' to use our linker instead
106 # of the default linker, which is why we only run our tests under gcc.
107
108 if NATIVE_LINKER
109 if GCC
110
111 # Each of these .o's is a useful, small complete program. They're
112 # particularly useful for making sure ld-new's flags do what they're
113 # supposed to (hence their names), but are used for many tests that
114 # don't actually involve analyzing input data.
115 flagstest_debug.o: constructor_test.cc
116 $(CXXCOMPILE) -O0 -g -c -o $@ $<
117 flagstest_ndebug.o: constructor_test.cc
118 $(CXXCOMPILE) -O0 -c -o $@ $<
119
120 check_SCRIPTS += incremental_test.sh
121 check_DATA += incremental_test.stdout
122 MOSTLYCLEANFILES += incremental_test
123 incremental_test_1.o: incremental_test_1.c
124 $(COMPILE) -O0 -c -ffunction-sections -g -o $@ $<
125 incremental_test_2.o: incremental_test_2.c
126 $(COMPILE) -O0 -c -ffunction-sections -g -o $@ $<
127 incremental_test: incremental_test_1.o incremental_test_2.o gcctestdir/ld
128 $(LINK) -Bgcctestdir/ -Wl,--incremental-full incremental_test_1.o incremental_test_2.o -Wl,-debug 2> incremental_test.cmdline
129 incremental_test.stdout: incremental_test ../incremental-dump
130 ../incremental-dump incremental_test > $@
131
132 check_SCRIPTS += gc_comdat_test.sh
133 check_DATA += gc_comdat_test.stdout
134 MOSTLYCLEANFILES += gc_comdat_test
135 gc_comdat_test_1.o: gc_comdat_test_1.cc
136 $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
137 gc_comdat_test_2.o: gc_comdat_test_2.cc
138 $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
139 gc_comdat_test: gc_comdat_test_1.o gc_comdat_test_2.o gcctestdir/ld
140 $(CXXLINK) -Bgcctestdir/ -Wl,--gc-sections gc_comdat_test_1.o gc_comdat_test_2.o
141 gc_comdat_test.stdout: gc_comdat_test
142 $(TEST_NM) -C gc_comdat_test > gc_comdat_test.stdout
143
144 check_SCRIPTS += gc_tls_test.sh
145 check_DATA += gc_tls_test.stdout
146 MOSTLYCLEANFILES += gc_tls_test
147 gc_tls_test.o: gc_tls_test.cc
148 $(CXXCOMPILE) -O0 -c -g -o $@ $<
149 gc_tls_test:gc_tls_test.o gcctestdir/ld
150 $(CXXLINK) -Bgcctestdir/ -Wl,--gc-sections gc_tls_test.o
151 gc_tls_test.stdout: gc_tls_test
152 $(TEST_NM) -C gc_tls_test > gc_tls_test.stdout
153
154 check_SCRIPTS += gc_orphan_section_test.sh
155 check_DATA += gc_orphan_section_test.stdout
156 MOSTLYCLEANFILES += gc_orphan_section_test
157 gc_orphan_section_test.o: gc_orphan_section_test.cc
158 $(CXXCOMPILE) -O0 -c -g -o $@ $<
159 gc_orphan_section_test:gc_orphan_section_test.o gcctestdir/ld
160 $(CXXLINK) -Bgcctestdir/ -Wl,--gc-sections gc_orphan_section_test.o
161 gc_orphan_section_test.stdout: gc_orphan_section_test
162 $(TEST_NM) gc_orphan_section_test > gc_orphan_section_test.stdout
163
164 check_SCRIPTS += icf_test.sh
165 check_DATA += icf_test.stdout
166 MOSTLYCLEANFILES += icf_test
167 icf_test.o: icf_test.cc
168 $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
169 icf_test: icf_test.o gcctestdir/ld
170 $(CXXLINK) -Bgcctestdir/ -Wl,--icf=all icf_test.o
171 icf_test.stdout: icf_test
172 $(TEST_NM) -C icf_test > icf_test.stdout
173
174 check_SCRIPTS += icf_keep_unique_test.sh
175 check_DATA += icf_keep_unique_test.stdout
176 MOSTLYCLEANFILES += icf_keep_unique_test
177 icf_keep_unique_test.o: icf_keep_unique_test.cc
178 $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
179 icf_keep_unique_test: icf_keep_unique_test.o gcctestdir/ld
180 $(CXXLINK) -Bgcctestdir/ -Wl,--icf=all -Wl,--keep-unique,_Z11unique_funcv icf_keep_unique_test.o
181 icf_keep_unique_test.stdout: icf_keep_unique_test
182 $(TEST_NM) -C icf_keep_unique_test > icf_keep_unique_test.stdout
183
184 check_SCRIPTS += icf_safe_test.sh
185 check_DATA += icf_safe_test_1.stdout icf_safe_test_2.stdout
186 MOSTLYCLEANFILES += icf_safe_test
187 icf_safe_test.o: icf_safe_test.cc
188 $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
189 icf_safe_test: icf_safe_test.o gcctestdir/ld
190 $(CXXLINK) -Bgcctestdir/ -Wl,--icf=safe icf_safe_test.o
191 icf_safe_test_1.stdout: icf_safe_test
192 $(TEST_NM) icf_safe_test > icf_safe_test_1.stdout
193 icf_safe_test_2.stdout: icf_safe_test
194 $(TEST_READELF) -h icf_safe_test > icf_safe_test_2.stdout
195
196 check_SCRIPTS += icf_safe_so_test.sh
197 check_DATA += icf_safe_so_test_1.stdout icf_safe_so_test_2.stdout
198 MOSTLYCLEANFILES += icf_safe_so_test
199 icf_safe_so_test.o: icf_safe_so_test.cc
200 $(CXXCOMPILE) -O0 -c -ffunction-sections -fPIC -g -o $@ $<
201 icf_safe_so_test: icf_safe_so_test.o gcctestdir/ld
202 $(CXXLINK) -Bgcctestdir/ -Wl,--icf=safe icf_safe_so_test.o -fPIC -shared
203 icf_safe_so_test_1.stdout: icf_safe_so_test
204 $(TEST_NM) icf_safe_so_test > icf_safe_so_test_1.stdout
205 icf_safe_so_test_2.stdout: icf_safe_so_test
206 $(TEST_READELF) -h icf_safe_so_test > icf_safe_so_test_2.stdout
207
208 check_SCRIPTS += final_layout.sh
209 check_DATA += final_layout.stdout
210 MOSTLYCLEANFILES += final_layout
211 final_layout.o: final_layout.cc
212 $(CXXCOMPILE) -O0 -c -ffunction-sections -fdata-sections -g -o $@ $<
213 final_layout_sequence.txt:
214 (echo "*_Z3barv*" && echo ".text._Z3bazv" && echo "*_Z3foov*" && echo "*global_varb*" && echo "*global_vara*" && echo "*global_varc*") > final_layout_sequence.txt
215 final_layout: final_layout.o final_layout_sequence.txt gcctestdir/ld
216 $(CXXLINK) -Bgcctestdir/ -Wl,--section-ordering-file,final_layout_sequence.txt final_layout.o
217 final_layout.stdout: final_layout
218 $(TEST_NM) -n final_layout > final_layout.stdout
219
220 check_PROGRAMS += icf_virtual_function_folding_test
221 MOSTLYCLEANFILES += icf_virtual_function_folding_test
222 icf_virtual_function_folding_test.o: icf_virtual_function_folding_test.cc
223 $(CXXCOMPILE) -O0 -c -ffunction-sections -fPIE -g -o $@ $<
224 icf_virtual_function_folding_test: icf_virtual_function_folding_test.o gcctestdir/ld
225 $(CXXLINK) -Bgcctestdir/ -Wl,--icf=all icf_virtual_function_folding_test.o -pie
226
227 check_SCRIPTS += icf_preemptible_functions_test.sh
228 check_DATA += icf_preemptible_functions_test.stdout
229 MOSTLYCLEANFILES += icf_preemptible_functions_test
230 icf_preemptible_functions_test.o: icf_preemptible_functions_test.cc
231 $(CXXCOMPILE) -O0 -c -ffunction-sections -fPIC -g -o $@ $<
232 icf_preemptible_functions_test: icf_preemptible_functions_test.o gcctestdir/ld
233 $(CXXLINK) -Bgcctestdir/ -Wl,--icf=all icf_preemptible_functions_test.o -fPIC -shared
234 icf_preemptible_functions_test.stdout: icf_preemptible_functions_test
235 $(TEST_NM) icf_preemptible_functions_test > icf_preemptible_functions_test.stdout
236
237 check_SCRIPTS += icf_string_merge_test.sh
238 check_DATA += icf_string_merge_test.stdout
239 MOSTLYCLEANFILES += icf_string_merge_test
240 icf_string_merge_test.o: icf_string_merge_test.cc
241 $(CXXCOMPILE) -O0 -c -ffunction-sections -fPIC -g -o $@ $<
242 icf_string_merge_test: icf_string_merge_test.o gcctestdir/ld
243 $(CXXLINK) -Bgcctestdir/ -Wl,--icf=all icf_string_merge_test.o
244 icf_string_merge_test.stdout: icf_string_merge_test
245 $(TEST_NM) icf_string_merge_test > icf_string_merge_test.stdout
246
247 check_SCRIPTS += icf_sht_rel_addend_test.sh
248 check_DATA += icf_sht_rel_addend_test.stdout
249 MOSTLYCLEANFILES += icf_sht_rel_addend_test
250 icf_sht_rel_addend_test_1.o: icf_sht_rel_addend_test_1.cc
251 $(CXXCOMPILE) -O0 -c -ffunction-sections -fPIC -g -o $@ $<
252 icf_sht_rel_addend_test_2.o: icf_sht_rel_addend_test_2.cc
253 $(CXXCOMPILE) -O0 -c -ffunction-sections -fPIC -g -o $@ $<
254 icf_sht_rel_addend_test: icf_sht_rel_addend_test_1.o icf_sht_rel_addend_test_2.o gcctestdir/ld
255 $(CXXLINK) -Bgcctestdir/ -Wl,--icf=all icf_sht_rel_addend_test_1.o icf_sht_rel_addend_test_2.o
256 icf_sht_rel_addend_test.stdout: icf_sht_rel_addend_test
257 $(TEST_NM) icf_sht_rel_addend_test > icf_sht_rel_addend_test.stdout
258
259 check_PROGRAMS += basic_test
260 check_PROGRAMS += basic_pic_test
261 basic_test.o: basic_test.cc
262 $(CXXCOMPILE) -O0 -c -o $@ $<
263 basic_test: basic_test.o gcctestdir/ld
264 $(CXXLINK) -Bgcctestdir/ basic_test.o
265
266 if HAVE_STATIC
267 check_PROGRAMS += basic_static_test
268 basic_static_test: basic_test.o gcctestdir/ld
269 $(CXXLINK) -Bgcctestdir/ -static basic_test.o
270 endif
271
272 basic_pic_test.o: basic_test.cc
273 $(CXXCOMPILE) -O0 -c -fpic -o $@ $<
274 basic_pic_test: basic_pic_test.o gcctestdir/ld
275 $(CXXLINK) -Bgcctestdir/ basic_pic_test.o
276
277 if HAVE_STATIC
278 check_PROGRAMS += basic_static_pic_test
279 basic_static_pic_test: basic_pic_test.o gcctestdir/ld
280 $(CXXLINK) -Bgcctestdir/ -static basic_pic_test.o
281 endif
282
283 check_PROGRAMS += basic_pie_test
284 basic_pie_test.o: basic_test.cc
285 $(CXXCOMPILE) -O0 -c -fpie -o $@ $<
286 basic_pie_test: basic_pie_test.o gcctestdir/ld
287 $(CXXLINK) -Bgcctestdir/ -pie basic_pie_test.o
288
289 check_PROGRAMS += constructor_test
290 constructor_test_SOURCES = constructor_test.cc
291 constructor_test_DEPENDENCIES = gcctestdir/ld
292 constructor_test_LDFLAGS = -Bgcctestdir/
293 constructor_test_LDADD =
294
295 if HAVE_STATIC
296 check_PROGRAMS += constructor_static_test
297 constructor_static_test_SOURCES = $(constructor_test_SOURCES)
298 constructor_static_test_DEPENDENCIES = $(constructor_test_DEPENDENCIES)
299 constructor_static_test_LDFLAGS = $(constructor_test_LDFLAGS) -static
300 constructor_static_test_LDADD = $(constructor_test_LDADD)
301 endif
302
303 check_PROGRAMS += two_file_test
304 check_PROGRAMS += two_file_pic_test
305 two_file_test_SOURCES = \
306 two_file_test_1.cc \
307 two_file_test_1b.cc \
308 two_file_test_2.cc \
309 two_file_test_main.cc \
310 two_file_test.h
311 two_file_test_DEPENDENCIES = gcctestdir/ld
312 two_file_test_LDFLAGS = -Bgcctestdir/
313 two_file_test_LDADD =
314
315 if HAVE_STATIC
316 check_PROGRAMS += two_file_static_test
317 two_file_static_test_SOURCES = $(two_file_test_SOURCES)
318 two_file_static_test_DEPENDENCIES = $(two_file_test_DEPENDENCIES)
319 two_file_static_test_LDFLAGS = $(two_file_test_LDFLAGS) -static
320 two_file_static_test_LDADD = $(two_file_test_LDADD)
321 endif
322
323 two_file_pic_test_SOURCES = two_file_test_main.cc
324 two_file_pic_test_DEPENDENCIES = \
325 gcctestdir/ld two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o
326 two_file_pic_test_LDFLAGS = -Bgcctestdir/
327 two_file_pic_test_LDADD = two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o
328
329
330 check_PROGRAMS += two_file_shared_1_test
331 check_PROGRAMS += two_file_shared_2_test
332 check_PROGRAMS += two_file_shared_1_pic_2_test
333 check_PROGRAMS += two_file_shared_2_pic_1_test
334 check_PROGRAMS += two_file_same_shared_test
335 check_PROGRAMS += two_file_separate_shared_12_test
336 check_PROGRAMS += two_file_separate_shared_21_test
337 two_file_test_1_pic.o: two_file_test_1.cc
338 $(CXXCOMPILE) -c -fpic -o $@ $<
339 two_file_test_1b_pic.o: two_file_test_1b.cc
340 $(CXXCOMPILE) -c -fpic -o $@ $<
341 two_file_test_2_pic.o: two_file_test_2.cc
342 $(CXXCOMPILE) -c -fpic -o $@ $<
343 two_file_shared_1.so: two_file_test_1_pic.o two_file_test_1b_pic.o gcctestdir/ld
344 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1_pic.o two_file_test_1b_pic.o
345 two_file_shared_2.so: two_file_test_2_pic.o gcctestdir/ld
346 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_2_pic.o
347 two_file_shared.so: two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o gcctestdir/ld
348 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o
349
350 two_file_shared_1_test_SOURCES = two_file_test_2.cc two_file_test_main.cc
351 two_file_shared_1_test_DEPENDENCIES = gcctestdir/ld two_file_shared_1.so
352 two_file_shared_1_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
353 two_file_shared_1_test_LDADD = two_file_shared_1.so
354
355 two_file_shared_2_test_SOURCES = two_file_test_1.cc two_file_test_1b.cc two_file_test_main.cc
356 two_file_shared_2_test_DEPENDENCIES = gcctestdir/ld two_file_shared_2.so
357 two_file_shared_2_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
358 two_file_shared_2_test_LDADD = two_file_shared_2.so
359
360 two_file_shared_1_pic_2_test_SOURCES = two_file_test_main.cc
361 two_file_shared_1_pic_2_test_DEPENDENCIES = \
362 gcctestdir/ld two_file_shared_2.so two_file_test_1_pic.o two_file_test_1b_pic.o
363 two_file_shared_1_pic_2_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
364 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
365
366 two_file_shared_2_pic_1_test_SOURCES = two_file_test_main.cc
367 two_file_shared_2_pic_1_test_DEPENDENCIES = \
368 gcctestdir/ld two_file_shared_2.so two_file_test_2_pic.o
369 two_file_shared_2_pic_1_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
370 two_file_shared_2_pic_1_test_LDADD = two_file_test_2_pic.o two_file_shared_1.so
371
372 two_file_same_shared_test_SOURCES = two_file_test_main.cc
373 two_file_same_shared_test_DEPENDENCIES = gcctestdir/ld two_file_shared.so
374 two_file_same_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
375 two_file_same_shared_test_LDADD = two_file_shared.so
376
377 two_file_separate_shared_12_test_SOURCES = two_file_test_main.cc
378 two_file_separate_shared_12_test_DEPENDENCIES = \
379 gcctestdir/ld two_file_shared_1.so two_file_shared_2.so
380 two_file_separate_shared_12_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
381 two_file_separate_shared_12_test_LDADD = \
382 two_file_shared_1.so two_file_shared_2.so
383
384 two_file_separate_shared_21_test_SOURCES = two_file_test_main.cc
385 two_file_separate_shared_21_test_DEPENDENCIES = \
386 gcctestdir/ld two_file_shared_1.so two_file_shared_2.so
387 two_file_separate_shared_21_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
388 two_file_separate_shared_21_test_LDADD = \
389 two_file_shared_2.so two_file_shared_1.so
390
391 check_PROGRAMS += two_file_relocatable_test
392 two_file_relocatable_test_SOURCES = two_file_test_main.cc
393 two_file_relocatable_test_DEPENDENCIES = \
394 gcctestdir/ld two_file_relocatable.o
395 two_file_relocatable_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
396 two_file_relocatable_test_LDADD = two_file_relocatable.o
397 two_file_relocatable.o: gcctestdir/ld two_file_test_1.o two_file_test_1b.o two_file_test_2.o
398 gcctestdir/ld -r -o $@ two_file_test_1.o two_file_test_1b.o two_file_test_2.o
399
400 check_PROGRAMS += two_file_pie_test
401 two_file_test_1_pie.o: two_file_test_1.cc
402 $(CXXCOMPILE) -c -fpie -o $@ $<
403 two_file_test_1b_pie.o: two_file_test_1b.cc
404 $(CXXCOMPILE) -c -fpie -o $@ $<
405 two_file_test_2_pie.o: two_file_test_2.cc
406 $(CXXCOMPILE) -c -fpie -o $@ $<
407 two_file_test_main_pie.o: two_file_test_main.cc
408 $(CXXCOMPILE) -c -fpie -o $@ $<
409 two_file_pie_test: two_file_test_1_pie.o two_file_test_1b_pie.o \
410 two_file_test_2_pie.o two_file_test_main_pie.o gcctestdir/ld
411 $(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
412
413 check_SCRIPTS += two_file_shared.sh
414 check_DATA += two_file_shared.dbg
415 MOSTLYCLEANFILES += two_file_shared.dbg
416 two_file_shared.dbg: two_file_shared.so
417 $(TEST_READELF) -w $< >$@ 2>/dev/null
418
419 # The nonpic tests will fail on platforms which can not put non-PIC
420 # code into shared libraries, so we just don't run them in that case.
421 if FN_PTRS_IN_SO_WITHOUT_PIC
422
423 check_PROGRAMS += two_file_shared_1_nonpic_test
424 check_PROGRAMS += two_file_shared_2_nonpic_test
425 check_PROGRAMS += two_file_same_shared_nonpic_test
426 check_PROGRAMS += two_file_separate_shared_12_nonpic_test
427 check_PROGRAMS += two_file_separate_shared_21_nonpic_test
428 check_PROGRAMS += two_file_mixed_shared_test
429 check_PROGRAMS += two_file_mixed_2_shared_test
430 two_file_shared_1_nonpic.so: two_file_test_1.o gcctestdir/ld
431 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1.o two_file_test_1b.o -Wl,-z,notext
432 two_file_shared_2_nonpic.so: two_file_test_2.o gcctestdir/ld
433 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_2.o
434 two_file_shared_nonpic.so: two_file_test_1.o two_file_test_1b.o two_file_test_2.o gcctestdir/ld
435 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1.o two_file_test_1b.o two_file_test_2.o -Wl,-z,notext
436 two_file_shared_mixed.so: two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2.o gcctestdir/ld
437 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2.o -Wl,-z,notext
438 two_file_shared_mixed_1.so: two_file_test_1.o two_file_test_1b_pic.o two_file_shared_2.so gcctestdir/ld
439 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1.o two_file_test_1b_pic.o two_file_shared_2.so -Wl,-z,notext
440
441 two_file_shared_1_nonpic_test_SOURCES = \
442 two_file_test_2.cc two_file_test_main.cc
443 two_file_shared_1_nonpic_test_DEPENDENCIES = \
444 gcctestdir/ld two_file_shared_1_nonpic.so
445 two_file_shared_1_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
446 two_file_shared_1_nonpic_test_LDADD = two_file_shared_1_nonpic.so
447
448 two_file_shared_2_nonpic_test_SOURCES = \
449 two_file_test_1.cc two_file_test_1b.cc two_file_test_main.cc
450 two_file_shared_2_nonpic_test_DEPENDENCIES = \
451 gcctestdir/ld two_file_shared_2_nonpic.so
452 two_file_shared_2_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
453 two_file_shared_2_nonpic_test_LDADD = two_file_shared_2_nonpic.so
454
455 two_file_same_shared_nonpic_test_SOURCES = two_file_test_main.cc
456 two_file_same_shared_nonpic_test_DEPENDENCIES = \
457 gcctestdir/ld two_file_shared_nonpic.so
458 two_file_same_shared_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
459 two_file_same_shared_nonpic_test_LDADD = two_file_shared_nonpic.so
460
461 two_file_separate_shared_12_nonpic_test_SOURCES = two_file_test_main.cc
462 two_file_separate_shared_12_nonpic_test_DEPENDENCIES = \
463 gcctestdir/ld two_file_shared_1_nonpic.so two_file_shared_2_nonpic.so
464 two_file_separate_shared_12_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
465 two_file_separate_shared_12_nonpic_test_LDADD = \
466 two_file_shared_1_nonpic.so two_file_shared_2_nonpic.so
467
468 two_file_separate_shared_21_nonpic_test_SOURCES = two_file_test_main.cc
469 two_file_separate_shared_21_nonpic_test_DEPENDENCIES = \
470 gcctestdir/ld two_file_shared_1_nonpic.so two_file_shared_2_nonpic.so
471 two_file_separate_shared_21_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
472 two_file_separate_shared_21_nonpic_test_LDADD = \
473 two_file_shared_2_nonpic.so two_file_shared_1_nonpic.so
474
475 two_file_mixed_shared_test_SOURCES = two_file_test_main.cc
476 two_file_mixed_shared_test_DEPENDENCIES = gcctestdir/ld two_file_shared_mixed.so
477 two_file_mixed_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
478 two_file_mixed_shared_test_LDADD = two_file_shared_mixed.so
479
480 two_file_mixed_2_shared_test_SOURCES = two_file_test_main.cc
481 two_file_mixed_2_shared_test_DEPENDENCIES = gcctestdir/ld two_file_shared_mixed_1.so two_file_shared_2.so
482 two_file_mixed_2_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
483 two_file_mixed_2_shared_test_LDADD = two_file_shared_mixed_1.so two_file_shared_2.so
484
485 check_PROGRAMS += two_file_mixed_pie_test
486 two_file_mixed_pie_test: two_file_test_1.o two_file_test_1b_pie.o \
487 two_file_test_main_pie.o two_file_shared_2.so gcctestdir/ld
488 $(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
489
490 endif FN_PTRS_IN_SO_WITHOUT_PIC
491
492 check_PROGRAMS += two_file_strip_test
493 two_file_strip_test: two_file_test
494 $(TEST_STRIP) -o two_file_strip_test two_file_test
495
496 check_PROGRAMS += two_file_same_shared_strip_test
497 two_file_same_shared_strip_test_SOURCES = two_file_test_main.cc
498 two_file_same_shared_strip_test_DEPENDENCIES = \
499 gcctestdir/ld two_file_shared_strip.so
500 two_file_same_shared_strip_test_LDFLAGS = -Bgcctestdir/ -Wl,-R.
501 two_file_same_shared_strip_test_LDADD = two_file_shared_strip.so
502 two_file_shared_strip.so: two_file_shared.so
503 $(TEST_STRIP) -S -o two_file_shared_strip.so two_file_shared.so
504
505 check_PROGRAMS += common_test_1
506 common_test_1_SOURCES = common_test_1.c
507 common_test_1_DEPENDENCIES = gcctestdir/ld
508 common_test_1_LDFLAGS = -Bgcctestdir/
509 common_test_1_LDADD =
510
511 check_PROGRAMS += common_test_2
512 common_test_2_SOURCES = common_test_1.c
513 common_test_2_DEPENDENCIES = common_test_2.so common_test_3.so gcctestdir/ld
514 common_test_2_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
515 common_test_2_LDADD = common_test_2.so common_test_3.so
516 common_test_2_pic.o: common_test_2.c
517 $(COMPILE) -c -fpic -o $@ $<
518 common_test_2.so: common_test_2_pic.o common_test_3.so gcctestdir/ld
519 $(LINK) -Bgcctestdir/ -shared common_test_2_pic.o common_test_3.so
520 common_test_3_pic.o: common_test_3.c
521 $(COMPILE) -c -fpic -o $@ $<
522 common_test_3.so: common_test_3_pic.o ver_test_2.script gcctestdir/ld
523 $(LINK) -Bgcctestdir/ -shared common_test_3_pic.o -Wl,--version-script,$(srcdir)/ver_test_2.script
524
525 check_PROGRAMS += exception_test
526 check_PROGRAMS += exception_shared_1_test
527 check_PROGRAMS += exception_shared_2_test
528 check_PROGRAMS += exception_same_shared_test
529 check_PROGRAMS += exception_separate_shared_12_test
530 check_PROGRAMS += exception_separate_shared_21_test
531 exception_test_1_pic.o: exception_test_1.cc
532 $(CXXCOMPILE) -c -fpic -o $@ $<
533 exception_test_2_pic.o: exception_test_2.cc
534 $(CXXCOMPILE) -c -fpic -o $@ $<
535 exception_shared_1.so: exception_test_1_pic.o gcctestdir/ld
536 $(CXXLINK) -Bgcctestdir/ -shared exception_test_1_pic.o
537 exception_shared_2.so: exception_test_2_pic.o gcctestdir/ld
538 $(CXXLINK) -Bgcctestdir/ -shared exception_test_2_pic.o
539 exception_shared.so: exception_test_1_pic.o exception_test_2_pic.o gcctestdir/ld
540 $(CXXLINK) -Bgcctestdir/ -shared exception_test_1_pic.o exception_test_2_pic.o
541
542 exception_test_SOURCES = \
543 exception_test_main.cc \
544 exception_test_1.cc \
545 exception_test_2.cc \
546 exception_test.h
547 exception_test_DEPENDENCIES = gcctestdir/ld
548 exception_test_LDFLAGS = -Bgcctestdir/
549 exception_test_LDADD =
550
551 if HAVE_STATIC
552 check_PROGRAMS += exception_static_test
553 exception_static_test_SOURCES = $(exception_test_SOURCES)
554 exception_static_test_DEPENDENCIES = $(exception_test_DEPENDENCIES)
555 exception_static_test_LDFLAGS = $(exception_test_LDFLAGS) -static
556 exception_static_test_LDADD = $(exception_test_LDADD)
557 endif
558
559 exception_shared_1_test_SOURCES = exception_test_2.cc exception_test_main.cc
560 exception_shared_1_test_DEPENDENCIES = gcctestdir/ld exception_shared_1.so
561 exception_shared_1_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
562 exception_shared_1_test_LDADD = exception_shared_1.so
563
564 exception_shared_2_test_SOURCES = exception_test_1.cc exception_test_main.cc
565 exception_shared_2_test_DEPENDENCIES = gcctestdir/ld exception_shared_2.so
566 exception_shared_2_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
567 exception_shared_2_test_LDADD = exception_shared_2.so
568
569 exception_same_shared_test_SOURCES = exception_test_main.cc
570 exception_same_shared_test_DEPENDENCIES = gcctestdir/ld exception_shared.so
571 exception_same_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
572 exception_same_shared_test_LDADD = exception_shared.so
573
574 exception_separate_shared_12_test_SOURCES = exception_test_main.cc
575 exception_separate_shared_12_test_DEPENDENCIES = \
576 gcctestdir/ld exception_shared_1.so exception_shared_2.so
577 exception_separate_shared_12_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
578 exception_separate_shared_12_test_LDADD = \
579 exception_shared_1.so exception_shared_2.so
580
581 exception_separate_shared_21_test_SOURCES = exception_test_main.cc
582 exception_separate_shared_21_test_DEPENDENCIES = \
583 gcctestdir/ld exception_shared_1.so exception_shared_2.so
584 exception_separate_shared_21_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
585 exception_separate_shared_21_test_LDADD = \
586 exception_shared_2.so exception_shared_1.so
587
588
589 check_PROGRAMS += weak_test
590 weak_test_SOURCES = weak_test.cc
591 weak_test_DEPENDENCIES = gcctestdir/ld
592 weak_test_LDFLAGS = -Bgcctestdir/
593 weak_test_LDADD =
594
595 check_PROGRAMS += weak_undef_test
596 MOSTLYCLEANFILES += alt/weak_undef_lib.so
597 weak_undef_test_SOURCES = weak_undef_test.cc
598 weak_undef_test_DEPENDENCIES = gcctestdir/ld weak_undef_lib.so alt/weak_undef_lib.so
599 weak_undef_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,alt
600 weak_undef_test_LDADD = -L . weak_undef_lib.so
601 weak_undef_file1.o: weak_undef_file1.cc
602 $(CXXCOMPILE) -c -fpic -o $@ $<
603 weak_undef_file2.o: weak_undef_file2.cc
604 $(CXXCOMPILE) -c -fpic -o $@ $<
605 weak_undef_lib.so: weak_undef_file1.o
606 $(CXXLINK) -Bgcctestdir/ -shared weak_undef_file1.o
607 alt/weak_undef_lib.so: weak_undef_file2.o
608 test -d alt || mkdir -p alt
609 $(CXXLINK) -Bgcctestdir/ -shared weak_undef_file2.o
610
611 if FN_PTRS_IN_SO_WITHOUT_PIC
612 check_PROGRAMS += weak_undef_nonpic_test
613 MOSTLYCLEANFILES += alt/weak_undef_lib_nonpic.so
614 weak_undef_nonpic_test_SOURCES = weak_undef_test.cc
615 weak_undef_nonpic_test_DEPENDENCIES = gcctestdir/ld weak_undef_lib_nonpic.so alt/weak_undef_lib_nonpic.so
616 weak_undef_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,alt
617 weak_undef_nonpic_test_LDADD = -L . weak_undef_lib_nonpic.so
618 weak_undef_file1_nonpic.o: weak_undef_file1.cc
619 $(CXXCOMPILE) -c -o $@ $<
620 weak_undef_file2_nonpic.o: weak_undef_file2.cc
621 $(CXXCOMPILE) -c -o $@ $<
622 weak_undef_lib_nonpic.so: weak_undef_file1_nonpic.o
623 $(CXXLINK) -Bgcctestdir/ -shared weak_undef_file1_nonpic.o -Wl,-z,notext
624 alt/weak_undef_lib_nonpic.so: weak_undef_file2_nonpic.o
625 test -d alt || mkdir -p alt
626 $(CXXLINK) -Bgcctestdir/ -shared weak_undef_file2_nonpic.o -Wl,-z,notext
627 endif FN_PTRS_IN_SO_WITHOUT_PIC
628
629
630 check_PROGRAMS += weak_alias_test
631 weak_alias_test_SOURCES = weak_alias_test_main.cc
632 weak_alias_test_DEPENDENCIES = \
633 gcctestdir/ld weak_alias_test_1.so weak_alias_test_2.so \
634 weak_alias_test_3.o weak_alias_test_4.so weak_alias_test_5.so
635 weak_alias_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
636 weak_alias_test_LDADD = \
637 weak_alias_test_1.so weak_alias_test_2.so weak_alias_test_3.o \
638 weak_alias_test_4.so weak_alias_test_5.so
639 weak_alias_test_1_pic.o: weak_alias_test_1.cc
640 $(CXXCOMPILE) -c -fpic -o $@ $<
641 weak_alias_test_1.so: weak_alias_test_1_pic.o gcctestdir/ld
642 $(CXXLINK) -Bgcctestdir/ -shared weak_alias_test_1_pic.o
643 weak_alias_test_2_pic.o: weak_alias_test_2.cc
644 $(CXXCOMPILE) -c -fpic -o $@ $<
645 weak_alias_test_2.so: weak_alias_test_2_pic.o gcctestdir/ld
646 $(CXXLINK) -Bgcctestdir/ -shared weak_alias_test_2_pic.o
647 weak_alias_test_3.o: weak_alias_test_3.cc
648 $(CXXCOMPILE) -c -o $@ $<
649 weak_alias_test_4_pic.o: weak_alias_test_4.cc
650 $(CXXCOMPILE) -c -fpic -o $@ $<
651 weak_alias_test_4.so: weak_alias_test_4_pic.o gcctestdir/ld
652 $(CXXLINK) -Bgcctestdir/ -shared weak_alias_test_4_pic.o
653 weak_alias_test_5_pic.o: weak_alias_test_5.cc
654 $(CXXCOMPILE) -c -fpic -o $@ $<
655 weak_alias_test_5.so: weak_alias_test_5_pic.o $(srcdir)/weak_alias_test.script gcctestdir/ld
656 $(CXXLINK) -Bgcctestdir/ -shared weak_alias_test_5_pic.o \
657 -Wl,--version-script,$(srcdir)/weak_alias_test.script
658
659 check_SCRIPTS += weak_plt.sh
660 check_PROGRAMS += weak_plt
661 check_DATA += weak_plt_shared.so
662 weak_plt_main_pic.o: weak_plt_main.cc
663 $(CXXCOMPILE) -c -fpic -o $@ $<
664 weak_plt: weak_plt_main_pic.o gcctestdir/ld
665 $(CXXLINK) -Bgcctestdir/ weak_plt_main_pic.o
666 weak_plt_shared_pic.o: weak_plt_shared.cc
667 $(CXXCOMPILE) -c -fpic -o $@ $<
668 weak_plt_shared.so: weak_plt_shared_pic.o gcctestdir/ld
669 $(CXXLINK) -Bgcctestdir/ -shared weak_plt_shared_pic.o
670
671 check_PROGRAMS += copy_test
672 copy_test_SOURCES = copy_test.cc
673 copy_test_DEPENDENCIES = gcctestdir/ld copy_test_1.so copy_test_2.so
674 copy_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
675 copy_test_LDADD = copy_test_1.so copy_test_2.so
676 copy_test_1_pic.o: copy_test_1.cc
677 $(CXXCOMPILE) -c -fpic -o $@ $<
678 copy_test_1.so: gcctestdir/ld copy_test_1_pic.o
679 $(CXXLINK) -Bgcctestdir/ -shared copy_test_1_pic.o
680 copy_test_2_pic.o: copy_test_2.cc
681 $(CXXCOMPILE) -c -fpic -o $@ $<
682 copy_test_2.so: gcctestdir/ld copy_test_2_pic.o
683 $(CXXLINK) -Bgcctestdir/ -shared copy_test_2_pic.o
684
685 if TLS
686
687 check_PROGRAMS += tls_test
688 check_PROGRAMS += tls_pic_test
689 check_PROGRAMS += tls_pie_test
690 check_PROGRAMS += tls_pie_pic_test
691 check_PROGRAMS += tls_shared_test
692 check_PROGRAMS += tls_shared_ie_test
693 check_PROGRAMS += tls_shared_gd_to_ie_test
694 tls_test_pic.o: tls_test.cc
695 $(CXXCOMPILE) -c -fpic -o $@ $<
696 tls_test_file2_pic.o: tls_test_file2.cc
697 $(CXXCOMPILE) -c -fpic -o $@ $<
698 tls_test_c_pic.o: tls_test_c.c
699 $(COMPILE) -c -fpic $(TLS_TEST_C_CFLAGS) -o $@ $<
700 tls_test_shared.so: tls_test_pic.o tls_test_file2_pic.o tls_test_c_pic.o gcctestdir/ld
701 $(CXXLINK) -Bgcctestdir/ -shared tls_test_pic.o tls_test_file2_pic.o tls_test_c_pic.o -Wl,-z,defs
702 tls_test_shared2.so: tls_test_file2_pic.o gcctestdir/ld
703 $(CXXLINK) -Bgcctestdir/ -shared tls_test_file2_pic.o
704
705 tls_test_pic_ie.o: tls_test.cc
706 $(CXXCOMPILE) -c -fpic -ftls-model=initial-exec -o $@ $<
707 tls_test_file2_pic_ie.o: tls_test_file2.cc
708 $(CXXCOMPILE) -c -fpic -ftls-model=initial-exec -o $@ $<
709 tls_test_c_pic_ie.o: tls_test_c.c
710 $(COMPILE) -c -fpic -ftls-model=initial-exec $(TLS_TEST_C_CFLAGS) -o $@ $<
711 tls_test_ie_shared.so: tls_test_pic_ie.o tls_test_file2_pic_ie.o tls_test_c_pic_ie.o gcctestdir/ld
712 $(CXXLINK) -Bgcctestdir/ -shared tls_test_pic_ie.o tls_test_file2_pic_ie.o tls_test_c_pic_ie.o
713
714 tls_test_SOURCES = tls_test.cc tls_test_file2.cc tls_test_main.cc tls_test.h
715 tls_test_DEPENDENCIES = gcctestdir/ld tls_test_c.o
716 tls_test_LDFLAGS = -Bgcctestdir/
717 tls_test_LDADD = tls_test_c.o -lpthread
718 tls_test_c.o: tls_test_c.c
719 $(COMPILE) -c $(TLS_TEST_C_CFLAGS) -o $@ $<
720
721 tls_pic_test_SOURCES = tls_test_main.cc
722 tls_pic_test_DEPENDENCIES = gcctestdir/ld tls_test_pic.o tls_test_file2_pic.o \
723 tls_test_c_pic.o
724 tls_pic_test_LDFLAGS = -Bgcctestdir/
725 tls_pic_test_LDADD = tls_test_pic.o tls_test_file2_pic.o tls_test_c_pic.o \
726 -lpthread
727
728 tls_test_main_pie.o: tls_test_main.cc tls_test.h
729 $(CXXCOMPILE) -c -fpie -o $@ $<
730 tls_test_pie.o: tls_test.cc tls_test.h
731 $(CXXCOMPILE) -c -fpie -o $@ $<
732 tls_test_file2_pie.o: tls_test_file2.cc tls_test.h
733 $(CXXCOMPILE) -c -fpie -o $@ $<
734 tls_test_c_pie.o: tls_test_c.c
735 $(COMPILE) -c -fpic $(TLS_TEST_C_CFLAGS) -o $@ $<
736 tls_pie_test: tls_test_main_pie.o tls_test_pie.o tls_test_file2_pie.o \
737 tls_test_c_pie.o gcctestdir/ld
738 $(CXXLINK) -Bgcctestdir/ -pie tls_test_main_pie.o tls_test_pie.o tls_test_file2_pie.o tls_test_c_pie.o -lpthread
739
740 tls_pie_pic_test: tls_test_main_pie.o tls_test_pic.o tls_test_file2_pic.o \
741 tls_test_c_pic.o gcctestdir/ld
742 $(CXXLINK) -Bgcctestdir/ -pie tls_test_main_pie.o tls_test_pic.o tls_test_file2_pic.o tls_test_c_pic.o -lpthread
743
744 tls_shared_test_SOURCES = tls_test_main.cc
745 tls_shared_test_DEPENDENCIES = gcctestdir/ld tls_test_shared.so
746 tls_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
747 tls_shared_test_LDADD = tls_test_shared.so -lpthread
748
749 tls_shared_ie_test_SOURCES = tls_test_main.cc
750 tls_shared_ie_test_DEPENDENCIES = gcctestdir/ld tls_test_ie_shared.so
751 tls_shared_ie_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
752 tls_shared_ie_test_LDADD = tls_test_ie_shared.so -lpthread
753
754 tls_shared_gd_to_ie_test_SOURCES = tls_test_main.cc
755 tls_shared_gd_to_ie_test_DEPENDENCIES = gcctestdir/ld tls_test_pic.o \
756 tls_test_c_pic.o tls_test_shared2.so
757 tls_shared_gd_to_ie_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
758 tls_shared_gd_to_ie_test_LDADD = tls_test_pic.o tls_test_c_pic.o \
759 tls_test_shared2.so -lpthread
760
761 if TLS_GNU2_DIALECT
762
763 check_PROGRAMS += tls_shared_gnu2_gd_to_ie_test
764
765 tls_test_gnu2.o: tls_test.cc
766 $(CXXCOMPILE) -c -fpic -mtls-dialect=gnu2 -o $@ $<
767 tls_test_file2_gnu2.o: tls_test_file2.cc
768 $(CXXCOMPILE) -c -fpic -mtls-dialect=gnu2 -o $@ $<
769 tls_test_c_gnu2.o: tls_test_c.c
770 $(COMPILE) -c -fpic -mtls-dialect=gnu2 $(TLS_TEST_C_CFLAGS) -o $@ $<
771 tls_test_gnu2_shared2.so: tls_test_file2_gnu2.o gcctestdir/ld
772 $(CXXLINK) -Bgcctestdir/ -shared tls_test_file2_gnu2.o
773
774 tls_shared_gnu2_gd_to_ie_test_SOURCES = tls_test_main.cc
775 tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES = gcctestdir/ld tls_test_gnu2.o \
776 tls_test_c_gnu2.o tls_test_gnu2_shared2.so
777 tls_shared_gnu2_gd_to_ie_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
778 tls_shared_gnu2_gd_to_ie_test_LDADD = tls_test_gnu2.o tls_test_c_gnu2.o \
779 tls_test_gnu2_shared2.so -lpthread
780
781 if TLS_DESCRIPTORS
782
783 check_PROGRAMS += tls_shared_gnu2_test
784
785 tls_test_gnu2_shared.so: tls_test_gnu2.o tls_test_file2_gnu2.o tls_test_c_gnu2.o gcctestdir/ld
786 $(CXXLINK) -Bgcctestdir/ -shared tls_test_gnu2.o tls_test_file2_gnu2.o tls_test_c_gnu2.o
787
788 tls_shared_gnu2_test_SOURCES = tls_test_main.cc
789 tls_shared_gnu2_test_DEPENDENCIES = gcctestdir/ld tls_test_gnu2_shared.so
790 tls_shared_gnu2_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
791 tls_shared_gnu2_test_LDADD = tls_test_gnu2_shared.so -lpthread
792
793 endif TLS_DESCRIPTORS
794
795 endif TLS_GNU2_DIALECT
796
797 if HAVE_STATIC
798 if STATIC_TLS
799 check_PROGRAMS += tls_static_test
800 check_PROGRAMS += tls_static_pic_test
801
802 tls_static_test_SOURCES = $(tls_test_SOURCES)
803 tls_static_test_DEPENDENCIES = $(tls_test_DEPENDENCIES)
804 tls_static_test_LDFLAGS = $(tls_test_LDFLAGS) -static
805 tls_static_test_LDADD = $(tls_test_LDADD)
806
807 tls_static_pic_test_SOURCES = $(tls_pic_test_SOURCES)
808 tls_static_pic_test_DEPENDENCIES = $(tls_pic_test_DEPENDENCIES)
809 tls_static_pic_test_LDFLAGS = $(tls_pic_test_LDFLAGS) -static
810 tls_static_pic_test_LDADD = $(tls_pic_test_LDADD)
811 endif
812 endif
813
814 if FN_PTRS_IN_SO_WITHOUT_PIC
815 check_PROGRAMS += tls_shared_nonpic_test
816 tls_test_shared_nonpic.so: tls_test.o tls_test_file2.o tls_test_c.o gcctestdir/ld
817 $(CXXLINK) -Bgcctestdir/ -shared tls_test.o tls_test_file2.o tls_test_c.o -Wl,-z,notext
818
819 tls_shared_nonpic_test_SOURCES = tls_test_main.cc
820 tls_shared_nonpic_test_DEPENDENCIES = gcctestdir/ld tls_test_shared_nonpic.so
821 tls_shared_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
822 tls_shared_nonpic_test_LDADD = tls_test_shared_nonpic.so -lpthread
823 endif FN_PTRS_IN_SO_WITHOUT_PIC
824
825 endif TLS
826
827 check_PROGRAMS += many_sections_test
828 many_sections_test_SOURCES = many_sections_test.cc
829 many_sections_test_DEPENDENCIES = gcctestdir/ld
830 many_sections_test_LDFLAGS = -Bgcctestdir/ -rdynamic
831 many_sections_test_LDADD =
832
833 BUILT_SOURCES += many_sections_define.h
834 MOSTLYCLEANFILES += many_sections_define.h
835 many_sections_define.h:
836 (for i in `seq 1 70000`; do \
837 echo "int var_$$i __attribute__((section(\"section_$$i\"))) = $$i;"; \
838 done) > $@.tmp
839 mv -f $@.tmp $@
840
841 BUILT_SOURCES += many_sections_check.h
842 MOSTLYCLEANFILES += many_sections_check.h
843 many_sections_check.h:
844 (for i in `seq 1 1000 70000`; do \
845 echo "assert(var_$$i == $$i);"; \
846 done) > $@.tmp
847 mv -f $@.tmp $@
848
849 check_PROGRAMS += many_sections_r_test
850 many_sections_r_test.o: many_sections_test.o gcctestdir/ld
851 gcctestdir/ld -r -o $@ many_sections_test.o
852 many_sections_r_test: many_sections_r_test.o gcctestdir/ld
853 $(CXXLINK) -Bgcctestdir/ many_sections_r_test.o $(LIBS)
854
855 check_PROGRAMS += initpri1
856 initpri1_SOURCES = initpri1.c
857 initpri1_DEPENDENCIES = gcctestdir/ld
858 initpri1_LDFLAGS = -Bgcctestdir/
859 initpri1_LDADD =
860
861 check_PROGRAMS += initpri2
862 initpri2_SOURCES = initpri2.c
863 initpri2_DEPENDENCIES = gcctestdir/ld
864 initpri2_LDFLAGS = -Bgcctestdir/
865 initpri2_LDADD =
866
867 check_PROGRAMS += initpri3a
868 initpri3a_SOURCES = initpri3.c
869 initpri3a_DEPENDENCIES = gcctestdir/ld
870 initpri3a_LDFLAGS = -Bgcctestdir/
871 initpri3a_LDADD =
872
873 check_PROGRAMS += initpri3b
874 initpri3b_SOURCES = initpri3.c
875 initpri3b_DEPENDENCIES = gcctestdir/ld
876 initpri3b_LDFLAGS = -Bgcctestdir/ -Wl,--no-ctors-in-init-array
877 initpri3b_LDADD =
878
879 # Test --detect-odr-violations
880 check_SCRIPTS += debug_msg.sh
881
882 # Create the data files that debug_msg.sh analyzes.
883 check_DATA += debug_msg.err
884 MOSTLYCLEANFILES += debug_msg.err
885 debug_msg.o: debug_msg.cc
886 $(CXXCOMPILE) -O0 -g -c -w -o $@ $(srcdir)/debug_msg.cc
887 odr_violation1.o: odr_violation1.cc
888 $(CXXCOMPILE) -O0 -g -c -w -o $@ $(srcdir)/odr_violation1.cc
889 # Compile with different optimization flags to check that rearranged
890 # instructions don't cause a false positive.
891 odr_violation2.o: odr_violation2.cc
892 $(CXXCOMPILE) -O2 -g -c -w -o $@ $(srcdir)/odr_violation2.cc
893 debug_msg.err: debug_msg.o odr_violation1.o odr_violation2.o gcctestdir/ld
894 @echo $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg debug_msg.o odr_violation1.o odr_violation2.o "2>$@"
895 @if $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg debug_msg.o odr_violation1.o odr_violation2.o 2>$@; \
896 then \
897 echo 1>&2 "Link of debug_msg should have failed"; \
898 rm -f $@; \
899 exit 1; \
900 fi
901
902
903 if HAVE_ZLIB
904
905 # Check that --detect-odr-violations works with compressed debug sections.
906 check_DATA += debug_msg_cdebug.err
907 MOSTLYCLEANFILES += debug_msg_cdebug.err
908 debug_msg_cdebug.o: debug_msg.cc gcctestdir/as
909 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -Wa,--compress-debug-sections -c -w -o $@ $(srcdir)/debug_msg.cc
910 odr_violation1_cdebug.o: odr_violation1.cc gcctestdir/as
911 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -Wa,--compress-debug-sections -c -w -o $@ $(srcdir)/odr_violation1.cc
912 odr_violation2_cdebug.o: odr_violation2.cc gcctestdir/as
913 $(CXXCOMPILE) -Bgcctestdir/ -O2 -g -Wa,--compress-debug-sections -c -w -o $@ $(srcdir)/odr_violation2.cc
914 debug_msg_cdebug.err: debug_msg_cdebug.o odr_violation1_cdebug.o odr_violation2_cdebug.o gcctestdir/ld
915 @echo $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_cdebug debug_msg_cdebug.o odr_violation1_cdebug.o odr_violation2_cdebug.o "2>$@"
916 @if $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_cdebug debug_msg_cdebug.o odr_violation1_cdebug.o odr_violation2_cdebug.o 2>$@; \
917 then \
918 echo 1>&2 "Link of debug_msg_cdebug should have failed"; \
919 rm -f $@; \
920 exit 1; \
921 fi
922
923 endif HAVE_ZLIB
924
925 # See if we can also detect problems when we're linking .so's, not .o's.
926 check_DATA += debug_msg_so.err
927 MOSTLYCLEANFILES += debug_msg_so.err
928 debug_msg.so: debug_msg.cc gcctestdir/ld
929 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -shared -fPIC -w -o $@ $(srcdir)/debug_msg.cc
930 odr_violation1.so: odr_violation1.cc gcctestdir/ld
931 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -shared -fPIC -w -o $@ $(srcdir)/odr_violation1.cc
932 odr_violation2.so: odr_violation2.cc gcctestdir/ld
933 $(CXXCOMPILE) -Bgcctestdir/ -O2 -g -shared -fPIC -w -o $@ $(srcdir)/odr_violation2.cc
934 debug_msg_so.err: debug_msg.so odr_violation1.so odr_violation2.so gcctestdir/ld
935 @echo $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_so debug_msg.so odr_violation1.so odr_violation2.so "2>$@"
936 @if $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_so debug_msg.so odr_violation1.so odr_violation2.so 2>$@; \
937 then \
938 echo 1>&2 "Link of debug_msg_so should have failed"; \
939 rm -f $@; \
940 exit 1; \
941 fi
942
943 # We also want to make sure we do something reasonable when there's no
944 # debug info available. For the best test, we use .so's.
945 check_DATA += debug_msg_ndebug.err
946 MOSTLYCLEANFILES += debug_msg_ndebug.err
947 debug_msg_ndebug.so: debug_msg.cc gcctestdir/ld
948 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g0 -shared -fPIC -w -o $@ $(srcdir)/debug_msg.cc
949 odr_violation1_ndebug.so: odr_violation1.cc gcctestdir/ld
950 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g0 -shared -fPIC -w -o $@ $(srcdir)/odr_violation1.cc
951 odr_violation2_ndebug.so: odr_violation2.cc gcctestdir/ld
952 $(CXXCOMPILE) -Bgcctestdir/ -O2 -g0 -shared -fPIC -w -o $@ $(srcdir)/odr_violation2.cc
953 debug_msg_ndebug.err: debug_msg_ndebug.so odr_violation1_ndebug.so odr_violation2_ndebug.so gcctestdir/ld
954 @echo $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_ndebug debug_msg_ndebug.so odr_violation1_ndebug.so odr_violation2_ndebug.so "2>$@"
955 @if $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_ndebug debug_msg_ndebug.so odr_violation1_ndebug.so odr_violation2_ndebug.so 2>$@; \
956 then \
957 echo 1>&2 "Link of debug_msg_ndebug should have failed"; \
958 rm -f $@; \
959 exit 1; \
960 fi
961
962
963 # Similar to --detect-odr-violations: check for undefined symbols in .so's
964 check_SCRIPTS += undef_symbol.sh
965 check_DATA += undef_symbol.err
966 MOSTLYCLEANFILES += undef_symbol.err
967 undef_symbol.o: undef_symbol.cc
968 $(CXXCOMPILE) -O0 -g -c -fPIC $<
969 undef_symbol.so: undef_symbol.o gcctestdir/ld
970 $(CXXLINK) -Bgcctestdir/ -shared undef_symbol.o
971 undef_symbol.err: undef_symbol_main.o undef_symbol.so gcctestdir/ld
972 @echo $(CXXLINK) -Bgcctestdir/ -o undef_symbol_test undef_symbol_main.o undef_symbol.so "2>$@"
973 @if $(CXXLINK) -Bgcctestdir/ -o undef_symbol_test undef_symbol_main.o undef_symbol.so 2>$@; \
974 then \
975 echo 1>&2 "Link of undef_symbol_test should have failed"; \
976 rm -f $@; \
977 exit 1; \
978 fi
979
980
981 # Test -o when emitting to a special file (such as something in /dev).
982 check_PROGRAMS += flagstest_o_specialfile
983 flagstest_o_specialfile: flagstest_debug.o gcctestdir/ld
984 $(CXXLINK) -Bgcctestdir/ -o /dev/stdout $< 2>&1 | cat > $@
985 chmod a+x $@
986 test -s $@
987
988 if HAVE_ZLIB
989
990 # Test --compress-debug-sections. FIXME: check we actually compress.
991 check_PROGRAMS += flagstest_compress_debug_sections
992 flagstest_compress_debug_sections: flagstest_debug.o gcctestdir/ld
993 $(CXXLINK) -Bgcctestdir/ -o $@ $< -Wl,--compress-debug-sections=zlib
994 test -s $@
995
996
997 # The specialfile output has a tricky case when we also compress debug
998 # sections, because it requires output-file resizing.
999 check_PROGRAMS += flagstest_o_specialfile_and_compress_debug_sections
1000 flagstest_o_specialfile_and_compress_debug_sections: flagstest_debug.o \
1001 gcctestdir/ld
1002 $(CXXLINK) -Bgcctestdir/ -o /dev/stdout $< -Wl,--compress-debug-sections=zlib 2>&1 | cat > $@
1003 chmod a+x $@
1004 test -s $@
1005
1006 endif HAVE_ZLIB
1007
1008 # Test -TText and -Tdata.
1009 check_PROGRAMS += flagstest_o_ttext_1
1010 flagstest_o_ttext_1: flagstest_debug.o gcctestdir/ld
1011 $(CXXLINK) -Bgcctestdir/ -o $@ $< -Wl,-Ttext,0x400000 -Wl,-Tdata,0x800000
1012
1013 # This version won't be runnable, because there is no way to put the
1014 # PT_PHDR segment at file offset 0. We just make sure that we can
1015 # build it without error.
1016 check_DATA += flagstest_o_ttext_2
1017 flagstest_o_ttext_2: flagstest_debug.o gcctestdir/ld
1018 $(CXXLINK) -Bgcctestdir/ -o $@ $< -Wl,-Ttext,0x400010 -Wl,-Tdata,0x800010
1019
1020 # Test symbol versioning.
1021 check_PROGRAMS += ver_test
1022 ver_test_SOURCES = ver_test_main.cc
1023 ver_test_DEPENDENCIES = gcctestdir/ld ver_test_1.so ver_test_2.so ver_test_4.so
1024 ver_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1025 ver_test_LDADD = ver_test_1.so ver_test_2.so ver_test_4.so
1026 ver_test_1.so: ver_test_1.o ver_test_2.so ver_test_3.o ver_test_4.so gcctestdir/ld
1027 $(CXXLINK) -Bgcctestdir/ -shared ver_test_1.o ver_test_2.so ver_test_3.o ver_test_4.so
1028 ver_test_2.so: ver_test_2.o $(srcdir)/ver_test_2.script ver_test_4.so gcctestdir/ld
1029 $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_2.script -Wl,-R,. ver_test_2.o ver_test_4.so
1030 ver_test_4.so: ver_test_4.o $(srcdir)/ver_test_4.script gcctestdir/ld
1031 $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_4.script ver_test_4.o
1032 ver_test_1.o: ver_test_1.cc
1033 $(CXXCOMPILE) -c -fpic -o $@ $<
1034 ver_test_2.o: ver_test_2.cc
1035 $(CXXCOMPILE) -c -fpic -o $@ $<
1036 ver_test_3.o: ver_test_3.cc
1037 $(CXXCOMPILE) -c -fpic -o $@ $<
1038 ver_test_4.o: ver_test_4.cc
1039 $(CXXCOMPILE) -c -fpic -o $@ $<
1040
1041 check_SCRIPTS += ver_test_1.sh
1042 check_DATA += ver_test_1.syms
1043 ver_test_1.syms: ver_test_1.so
1044 $(TEST_READELF) -s $< >$@ 2>/dev/null
1045
1046 check_PROGRAMS += ver_test_2
1047 ver_test_2_SOURCES = ver_test_main_2.cc
1048 ver_test_2_DEPENDENCIES = gcctestdir/ld ver_test_4.so ver_test_2.so
1049 ver_test_2_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1050 ver_test_2_LDADD = ver_test_4.so ver_test_2.so
1051
1052 check_SCRIPTS += ver_test_2.sh
1053 check_DATA += ver_test_2.syms
1054 ver_test_2.syms: ver_test_2
1055 $(TEST_READELF) -s $< >$@ 2>/dev/null
1056
1057 check_SCRIPTS += ver_test_4.sh
1058 check_DATA += ver_test_4.syms
1059 ver_test_4.syms: ver_test_4.so
1060 $(TEST_READELF) -s $< >$@ 2>/dev/null
1061
1062 ver_test_5.so: ver_test_5.o $(srcdir)/ver_test_5.script ver_test_4.so gcctestdir/ld
1063 $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_5.script ver_test_5.o ver_test_4.so
1064 ver_test_5.o: ver_test_5.cc
1065 $(CXXCOMPILE) -c -fpic -o $@ $<
1066 check_SCRIPTS += ver_test_5.sh
1067 check_DATA += ver_test_5.syms
1068 ver_test_5.syms: ver_test_5.so
1069 $(TEST_READELF) -s $< >$@ 2>/dev/null
1070
1071 check_PROGRAMS += ver_test_6
1072 ver_test_6_SOURCES = ver_test_6.c
1073 ver_test_6_DEPENDENCIES = gcctestdir/ld ver_test_2.so
1074 ver_test_6_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1075 ver_test_6_LDADD = ver_test_2.so
1076
1077 ver_test_7.so: ver_test_4.o $(srcdir)/ver_test_4.script ver_test_7.o gcctestdir/ld
1078 $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_4.script ver_test_4.o ver_test_7.o
1079 ver_test_7.o: ver_test_7.cc
1080 $(CXXCOMPILE) -c -fpic -o $@ $<
1081 check_SCRIPTS += ver_test_7.sh
1082 check_DATA += ver_test_7.syms
1083 ver_test_7.syms: ver_test_7.so
1084 $(TEST_READELF) -s $< >$@ 2>/dev/null
1085
1086 check_PROGRAMS += ver_test_8
1087 ver_test_8_SOURCES = two_file_test_main.cc
1088 ver_test_8_DEPENDENCIES = gcctestdir/ld ver_test_8_1.so ver_test_8_2.so
1089 ver_test_8_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1090 ver_test_8_LDADD = ver_test_8_1.so ver_test_8_2.so
1091 ver_test_8_1.so: two_file_test_1_pic.o two_file_test_1b_pic.o ver_test_8_2.so gcctestdir/ld
1092 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1_pic.o two_file_test_1b_pic.o ver_test_8_2.so
1093 ver_test_8_2.so: two_file_test_2_pic.o $(srcdir)/ver_test_8.script gcctestdir/ld
1094 $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_8.script two_file_test_2_pic.o
1095
1096 check_PROGRAMS += ver_test_9
1097 ver_test_9_SOURCES = ver_test_main.cc
1098 ver_test_9_DEPENDENCIES = gcctestdir/ld ver_test_9.so
1099 ver_test_9_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1100 ver_test_9_LDADD = ver_test_9.so
1101 ver_test_9.so: ver_test_9.o ver_test_4.so ver_test_5.so gcctestdir/ld
1102 $(CXXLINK) -Bgcctestdir/ -shared -Wl,-R,. ver_test_9.o ver_test_5.so ver_test_4.so
1103 ver_test_9.o: ver_test_9.cc
1104 $(CXXCOMPILE) -c -fpic -o $@ $<
1105
1106 check_SCRIPTS += ver_test_10.sh
1107 check_DATA += ver_test_10.syms
1108 ver_test_10.syms: ver_test_10.so
1109 $(TEST_READELF) -s $< >$@ 2>/dev/null
1110 ver_test_10.so: gcctestdir/ld ver_test_2.o ver_test_10.script
1111 $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_10.script ver_test_2.o
1112
1113 check_PROGRAMS += ver_test_11
1114 MOSTLYCLEANFILES += ver_test_11.a
1115 ver_test_11_SOURCES = ver_test_main_2.cc
1116 ver_test_11_DEPENDENCIES = gcctestdir/ld ver_test_11.a
1117 ver_test_11_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1118 ver_test_11_LDADD = ver_test_11.a
1119 ver_test_11.a: ver_test_1.o ver_test_2.o ver_test_4.o
1120 $(TEST_AR) rc $@ $^
1121
1122 check_PROGRAMS += ver_test_12
1123 ver_test_12_SOURCES = ver_test_main_2.cc
1124 ver_test_12_DEPENDENCIES = gcctestdir/ld ver_test_12.o
1125 ver_test_12_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1126 ver_test_12_LDADD = ver_test_12.o
1127 ver_test_12.o: gcctestdir/ld ver_test_1.o ver_test_2.o ver_test_4.o
1128 gcctestdir/ld -r -o $@ ver_test_1.o ver_test_2.o ver_test_4.o
1129
1130 check_PROGRAMS += protected_1
1131 protected_1_SOURCES = \
1132 protected_main_1.cc protected_main_2.cc protected_main_3.cc
1133 protected_1_DEPENDENCIES = gcctestdir/ld protected_1.so
1134 protected_1_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1135 protected_1_LDADD = protected_1.so
1136
1137 protected_1.so: gcctestdir/ld protected_1_pic.o protected_2_pic.o protected_3_pic.o
1138 $(CXXLINK) -Bgcctestdir/ -shared protected_1_pic.o protected_2_pic.o protected_3_pic.o
1139 protected_1_pic.o: protected_1.cc
1140 $(CXXCOMPILE) -c -fpic -o $@ $<
1141 protected_2_pic.o: protected_2.cc
1142 $(CXXCOMPILE) -c -fpic -o $@ $<
1143 protected_3_pic.o: protected_3.cc
1144 $(CXXCOMPILE) -c -fpic -o $@ $<
1145
1146 check_PROGRAMS += protected_2
1147 protected_2_SOURCES = protected_main_1.cc protected_3.cc
1148 protected_2_DEPENDENCIES = gcctestdir/ld protected_1.so
1149 protected_2_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1150 protected_2_LDADD = protected_1.so
1151
1152 check_DATA += protected_3.err
1153 MOSTLYCLEANFILES += protected_3.err
1154 protected_4_pic.o: protected_4.cc
1155 $(CXXCOMPILE) -c -fpic -o $@ $<
1156 protected_3.err: protected_4_pic.o gcctestdir/ld
1157 @echo $(CXXLINK) -Bgcctestdir/ -shared -o protected_4.so protected_4_pic.o "2>$@"
1158 @if $(CXXLINK) -Bgcctestdir/ -shared -o protected_4.so protected_4_pic.o 2>$@; then \
1159 echo 1>&2 "Link of protected_4.so should have failed"; \
1160 rm -f $@; \
1161 exit 1; \
1162 fi
1163
1164 check_PROGRAMS += relro_test
1165 check_SCRIPTS += relro_test.sh
1166 check_DATA += relro_test.stdout
1167 relro_test_SOURCES = relro_test_main.cc
1168 relro_test_DEPENDENCIES = gcctestdir/ld relro_test.so
1169 relro_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1170 relro_test_LDADD = relro_test.so
1171 relro_test.so: gcctestdir/ld relro_test_pic.o
1172 $(CXXLINK) -Bgcctestdir/ -shared -Wl,-z,relro relro_test_pic.o
1173 relro_test_pic.o: relro_test.cc
1174 $(CXXCOMPILE) -c -fpic -o $@ $<
1175 relro_test.stdout: relro_test.so
1176 $(TEST_READELF) -SlW relro_test.so > relro_test.stdout
1177
1178 check_PROGRAMS += relro_now_test
1179 relro_now_test_SOURCES = relro_test_main.cc
1180 relro_now_test_DEPENDENCIES = gcctestdir/ld relro_now_test.so
1181 relro_now_test_LDFLAGS = -Bgcctestdir -Wl,-R,. -Wl,-z,relro -Wl,-z,now
1182 relro_now_test_LDADD = relro_now_test.so
1183 relro_now_test.so: gcctestdir/ld relro_test_pic.o
1184 $(CXXLINK) -Bgcctestdir/ -shared -Wl,-z,relro -Wl,-z,now relro_test_pic.o
1185
1186 check_PROGRAMS += relro_strip_test
1187 relro_strip_test_SOURCES = relro_test_main.cc
1188 relro_strip_test_DEPENDENCIES = gcctestdir/ld relro_strip_test.so
1189 relro_strip_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1190 relro_strip_test_LDADD = relro_strip_test.so
1191 relro_strip_test.so: relro_test.so
1192 $(TEST_STRIP) -o $@ $<
1193
1194 check_PROGRAMS += relro_script_test
1195 relro_script_test_SOURCES = relro_test_main.cc
1196 relro_script_test_DEPENDENCIES = gcctestdir/ld relro_script_test.so
1197 relro_script_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1198 relro_script_test_LDADD = relro_script_test.so
1199 relro_script_test.so: gcctestdir/ld relro_script_test.t relro_test_pic.o
1200 $(CXXLINK) -Bgcctestdir/ -shared -Wl,-z,relro -T $(srcdir)/relro_script_test.t relro_test_pic.o
1201
1202 check_PROGRAMS += script_test_1
1203 script_test_1_SOURCES = script_test_1.cc
1204 script_test_1_DEPENDENCIES = gcctestdir/ld script_test_1.t
1205 script_test_1_LDFLAGS = -Bgcctestdir/ -Wl,-R,. -T $(srcdir)/script_test_1.t
1206 script_test_1_LDADD =
1207
1208 check_PROGRAMS += script_test_2
1209 script_test_2_SOURCES = script_test_2.cc script_test_2a.cc script_test_2b.cc
1210 script_test_2_DEPENDENCIES = gcctestdir/ld script_test_2.t
1211 script_test_2_LDFLAGS = -Bgcctestdir/ -Wl,-R,. -T $(srcdir)/script_test_2.t
1212 script_test_2_LDADD =
1213
1214 check_PROGRAMS += justsyms
1215 justsyms_SOURCES = justsyms_1.cc
1216 justsyms_DEPENDENCIES = gcctestdir/ld justsyms_2r.o
1217 justsyms_LDFLAGS = -Bgcctestdir/ -Wl,-R,justsyms_2r.o
1218 justsyms_LDADD =
1219 justsyms_2.o: justsyms_2.cc
1220 $(CXXCOMPILE) -c -o $@ $<
1221 justsyms_2r.o: justsyms_2.o gcctestdir/ld $(srcdir)/justsyms.t
1222 gcctestdir/ld -o $@ -r -T $(srcdir)/justsyms.t justsyms_2.o
1223
1224 check_PROGRAMS += justsyms_exec
1225 justsyms_exec_SOURCES = justsyms_exec.c
1226 justsyms_exec_DEPENDENCIES = gcctestdir/ld justsyms_lib
1227 justsyms_exec_LDFLAGS = -Bgcctestdir/ -Wl,-R,justsyms_lib
1228 justsyms_exec_LDADD =
1229 justsyms_lib.o: justsyms_lib.c
1230 $(COMPILE) -c -o $@ $<
1231 justsyms_lib: justsyms_lib.o gcctestdir/ld
1232 gcctestdir/ld -o $@ -Ttext=0x1000200 -Tdata=0x2000000 -e exported_func justsyms_lib.o
1233
1234 check_PROGRAMS += binary_test
1235 MOSTLYCLEANFILES += binary.txt
1236 binary_test_SOURCES = binary_test.cc
1237 binary_test_DEPENDENCIES = gcctestdir/ld binary.txt
1238 binary_test_LDFLAGS = -Bgcctestdir/ -Wl,--format,binary,binary.txt,--format,elf
1239 binary_test_LDADD =
1240 # Copy the file to the build directory to avoid worrying about the
1241 # full pathname in the generated symbols.
1242 binary.txt: $(srcdir)/binary.in
1243 rm -f $@
1244 $(LN_S) $< $@
1245
1246 check_SCRIPTS += ver_matching_test.sh
1247 check_DATA += ver_matching_test.stdout
1248 MOSTLYCLEANFILES += ver_matching_test.stdout
1249 ver_matching_def.so: ver_matching_def_pic.o $(srcdir)/version_script.map gcctestdir/ld
1250 $(CXXLINK) -O0 -Bgcctestdir/ -shared ver_matching_def_pic.o -Wl,--version-script=$(srcdir)/version_script.map
1251 ver_matching_def_pic.o: ver_matching_def.cc
1252 $(CXXCOMPILE) -O0 -c -fpic -o $@ $<
1253 ver_matching_test.stdout: ver_matching_def.so
1254 $(TEST_OBJDUMP) -T ver_matching_def.so | $(TEST_CXXFILT) > ver_matching_test.stdout
1255
1256 check_PROGRAMS += script_test_3
1257 check_SCRIPTS += script_test_3.sh
1258 check_DATA += script_test_3.stdout
1259 MOSTLYCLEANFILES += script_test_3.stdout
1260 script_test_3: basic_test.o gcctestdir/ld script_test_3.t
1261 $(CXXLINK) -Bgcctestdir/ basic_test.o -T $(srcdir)/script_test_3.t
1262 script_test_3.stdout: script_test_3
1263 $(TEST_READELF) -SlW script_test_3 > script_test_3.stdout
1264
1265 check_PROGRAMS += tls_phdrs_script_test
1266 tls_phdrs_script_test_SOURCES = $(tls_test_SOURCES)
1267 tls_phdrs_script_test_DEPENDENCIES = $(tls_test_DEPENDENCIES) $(srcdir)/script_test_3.t
1268 tls_phdrs_script_test_LDFLAGS = $(tls_test_LDFLAGS) -T $(srcdir)/script_test_3.t
1269 tls_phdrs_script_test_LDADD = $(tls_test_LDADD)
1270
1271 check_SCRIPTS += script_test_4.sh
1272 check_DATA += script_test_4.stdout
1273 MOSTLYCLEANFILES += script_test_4
1274 script_test_4: basic_test.o gcctestdir/ld $(srcdir)/script_test_4.t
1275 $(CXXLINK) -Bgcctestdir/ basic_test.o -T $(srcdir)/script_test_4.t
1276 script_test_4.stdout: script_test_4
1277 $(TEST_READELF) -SlW script_test_4 > script_test_4.stdout
1278
1279 check_PROGRAMS += tls_script_test
1280 tls_script_test_SOURCES = $(tls_test_SOURCES)
1281 tls_script_test_DEPENDENCIES = $(tls_test_DEPENDENCIES) $(srcdir)/script_test_4.t
1282 tls_script_test_LDFLAGS = $(tls_test_LDFLAGS) -T $(srcdir)/script_test_4.t
1283 tls_script_test_LDADD = $(tls_test_LDADD)
1284
1285 check_SCRIPTS += script_test_5.sh
1286 check_DATA += script_test_5.stdout
1287 MOSTLYCLEANFILES += script_test_5
1288 script_test_5: script_test_5.o gcctestdir/ld $(srcdir)/script_test_5.t
1289 $(CXXLINK) -Bgcctestdir/ script_test_5.o -T $(srcdir)/script_test_5.t
1290 script_test_5.stdout: script_test_5
1291 $(TEST_READELF) -SW script_test_5 > script_test_5.stdout
1292
1293 check_SCRIPTS += script_test_6.sh
1294 check_DATA += script_test_6.stdout
1295 MOSTLYCLEANFILES += script_test_6
1296 script_test_6: basic_test.o gcctestdir/ld $(srcdir)/script_test_6.t
1297 $(CXXLINK) -Bgcctestdir/ basic_test.o -T $(srcdir)/script_test_6.t \
1298 -Wl,-Ttext=0x10001000 -Wl,-Tdata=0x10200000 -Wl,-Tbss=0x10400000
1299 script_test_6.stdout: script_test_6
1300 $(TEST_READELF) -SlW script_test_6 > script_test_6.stdout
1301
1302 check_SCRIPTS += script_test_7.sh
1303 check_DATA += script_test_7.stdout
1304 MOSTLYCLEANFILES += script_test_7
1305 script_test_7: basic_test.o gcctestdir/ld $(srcdir)/script_test_7.t
1306 $(CXXLINK) -Bgcctestdir/ basic_test.o -T $(srcdir)/script_test_7.t
1307 script_test_7.stdout: script_test_7
1308 $(TEST_READELF) -SlW script_test_7 > script_test_7.stdout
1309
1310 check_SCRIPTS += script_test_8.sh
1311 check_DATA += script_test_8.stdout
1312 MOSTLYCLEANFILES += script_test_8
1313 script_test_8: basic_test.o gcctestdir/ld $(srcdir)/script_test_7.t
1314 $(CXXLINK) -Bgcctestdir/ basic_test.o -T $(srcdir)/script_test_7.t \
1315 -Wl,-Ttext=0x20001000 -Wl,-Tdata=0x20200000 -Wl,-Tbss=0x20400000
1316 script_test_8.stdout: script_test_8
1317 $(TEST_READELF) -SlW script_test_8 > script_test_8.stdout
1318
1319
1320 check_SCRIPTS += script_test_9.sh
1321 check_DATA += script_test_9.stdout
1322 script_test_9.o: script_test_9.cc
1323 $(CXXCOMPILE) -O0 -c -o $@ $<
1324 script_test_9: gcctestdir/ld $(srcdir)/script_test_9.t script_test_9.o
1325 $(CXXLINK) -Bgcctestdir/ script_test_9.o -T $(srcdir)/script_test_9.t
1326 script_test_9.stdout: script_test_9
1327 $(TEST_READELF) -lW script_test_9 > script_test_9.stdout
1328
1329
1330 # Test --dynamic-list, --dynamic-list-data, --dynamic-list-cpp-new,
1331 # and --dynamic-list-cpp-typeinfo
1332
1333 check_SCRIPTS += dynamic_list.sh
1334 check_DATA += dynamic_list.stdout
1335 MOSTLYCLEANFILES += dynamic_list dynamic_list.stdout
1336 dynamic_list: basic_test.o gcctestdir/ld $(srcdir)/dynamic_list.t
1337 $(CXXLINK) -Bgcctestdir/ basic_test.o \
1338 -Wl,--dynamic-list $(srcdir)/dynamic_list.t \
1339 -Wl,--dynamic-list-data \
1340 -Wl,--dynamic-list-cpp-new \
1341 -Wl,--dynamic-list-cpp-typeinfo
1342 dynamic_list.stdout: dynamic_list
1343 $(TEST_READELF) -W --dyn-syms dynamic_list > dynamic_list.stdout
1344
1345 check_PROGRAMS += thin_archive_test_1
1346 MOSTLYCLEANFILES += libthin1.a libthin3.a libthinall.a \
1347 alt/thin_archive_test_2.o alt/thin_archive_test_4.o \
1348 alt/libthin2.a alt/libthin4.a
1349 thin_archive_test_1_SOURCES = thin_archive_main.cc
1350 thin_archive_test_1_DEPENDENCIES = gcctestdir/ld libthin1.a alt/libthin2.a
1351 thin_archive_test_1_LDFLAGS = -Bgcctestdir/ -Lalt
1352 thin_archive_test_1_LDADD = libthin1.a -lthin2
1353
1354 check_PROGRAMS += thin_archive_test_2
1355 thin_archive_test_2_SOURCES = thin_archive_main.cc
1356 thin_archive_test_2_DEPENDENCIES = gcctestdir/ld libthinall.a
1357 thin_archive_test_2_LDFLAGS = -Bgcctestdir/ -L.
1358 thin_archive_test_2_LDADD = -lthinall
1359
1360 libthin1.a: thin_archive_test_1.o alt/thin_archive_test_2.o
1361 rm -f $@
1362 $(TEST_AR) crT $@ $^
1363 alt/libthin2.a: thin_archive_test_3.o alt/thin_archive_test_4.o
1364 rm -f $@
1365 $(TEST_AR) crT $@ $^
1366 libthin3.a: thin_archive_test_1.o alt/thin_archive_test_4.o
1367 rm -f $@
1368 $(TEST_AR) crT $@ $^
1369 alt/libthin4.a: alt/thin_archive_test_2.o thin_archive_test_3.o
1370 rm -f $@
1371 $(TEST_AR) crT $@ $^
1372 libthinall.a: libthin3.a alt/libthin4.a
1373 rm -f $@
1374 $(TEST_AR) crT $@ $^
1375 alt/thin_archive_test_2.o: thin_archive_test_2.cc
1376 test -d alt || mkdir -p alt
1377 $(CXXCOMPILE) -c -o $@ $<
1378 alt/thin_archive_test_4.o: thin_archive_test_4.cc
1379 test -d alt || mkdir -p alt
1380 $(CXXCOMPILE) -c -o $@ $<
1381
1382 if PLUGINS
1383
1384 check_PROGRAMS += plugin_test_1
1385 check_SCRIPTS += plugin_test_1.sh
1386 check_DATA += plugin_test_1.err
1387 MOSTLYCLEANFILES += plugin_test_1.err
1388 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
1389 $(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
1390 plugin_test_1.err: plugin_test_1
1391 @touch plugin_test_1.err
1392
1393 check_PROGRAMS += plugin_test_2
1394 check_SCRIPTS += plugin_test_2.sh
1395 check_DATA += plugin_test_2.err
1396 MOSTLYCLEANFILES += plugin_test_2.err
1397 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
1398 $(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
1399 plugin_test_2.err: plugin_test_2
1400 @touch plugin_test_2.err
1401
1402 check_PROGRAMS += plugin_test_3
1403 check_SCRIPTS += plugin_test_3.sh
1404 check_DATA += plugin_test_3.err
1405 MOSTLYCLEANFILES += plugin_test_3.err
1406 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
1407 $(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
1408 plugin_test_3.err: plugin_test_3
1409 @touch plugin_test_3.err
1410
1411 check_PROGRAMS += plugin_test_4
1412 check_SCRIPTS += plugin_test_4.sh
1413 check_DATA += plugin_test_4.err
1414 MOSTLYCLEANFILES += plugin_test_4.a plugin_test_4.err
1415 plugin_test_4: two_file_test_main.o plugin_test_4.a gcctestdir/ld plugin_test.so
1416 $(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
1417 plugin_test_4.err: plugin_test_4
1418 @touch plugin_test_4.err
1419
1420 plugin_test_4.a: two_file_test_1.syms two_file_test_1b.syms two_file_test_2.syms
1421 $(TEST_AR) cr $@ $^
1422
1423 check_PROGRAMS += plugin_test_5
1424 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
1425 $(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
1426
1427 check_PROGRAMS += plugin_test_6
1428 check_SCRIPTS += plugin_test_6.sh
1429 check_DATA += plugin_test_6.err
1430 MOSTLYCLEANFILES += plugin_test_6.err
1431 plugin_test_6: plugin_common_test_1.syms plugin_common_test_2.syms gcctestdir/ld plugin_test.so
1432 $(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle,--plugin,"./plugin_test.so" plugin_common_test_1.syms plugin_common_test_2.syms 2>plugin_test_6.err
1433 plugin_test_6.err: plugin_test_6
1434 @touch plugin_test_6.err
1435
1436 check_PROGRAMS += plugin_test_7
1437 check_SCRIPTS += plugin_test_7.sh
1438 check_DATA += plugin_test_7.err plugin_test_7.syms
1439 MOSTLYCLEANFILES += plugin_test_7.err
1440 plugin_test_7: plugin_test_7_1.o plugin_test_7_1.syms plugin_test_7_2.o gcctestdir/ld plugin_test.so
1441 $(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
1442 plugin_test_7.syms: plugin_test_7
1443 $(TEST_READELF) -sW $< >$@ 2>/dev/null
1444 plugin_test_7_1.o: plugin_test_7_1.c
1445 $(COMPILE) -DLTO -O0 -c -ffunction-sections -fdata-sections -o $@ $<
1446 plugin_test_7_1_orig.o: plugin_test_7_1.c
1447 $(COMPILE) -O0 -c -ffunction-sections -fdata-sections -o $@ $<
1448 plugin_test_7_1.syms: plugin_test_7_1_orig.o
1449 $(TEST_READELF) -sW $< >$@ 2>/dev/null
1450 plugin_test_7_2.o: plugin_test_7_2.c
1451 $(COMPILE) -O0 -c -ffunction-sections -fdata-sections -o $@ $<
1452 plugin_test_7.err: plugin_test_7
1453
1454 # Test plugins with -r.
1455 check_PROGRAMS += plugin_test_8
1456 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
1457 ../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
1458 plugin_test_8: plugin_test_8.o gcctestdir/ld
1459 $(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle plugin_test_8.o
1460
1461 # Test that symbols known in the IR file but not in the replacement file
1462 # produce an unresolved symbol error.
1463 check_DATA += plugin_test_9.err
1464 MOSTLYCLEANFILES += plugin_test_9.err
1465 plugin_test_9.err: two_file_test_main.o two_file_test_1c.syms two_file_test_2.syms gcctestdir/ld plugin_test.so
1466 @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>$@"
1467 @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 \
1468 echo 1>&2 "Link of plugin_test_9 should have failed"; \
1469 rm -f $@; \
1470 exit 1; \
1471 fi
1472 # Make a .syms file that claims to define the symbol _Z4t16av.
1473 two_file_test_1c.syms: two_file_test_1.syms two_file_test_1c.o
1474 cp two_file_test_1.syms $@.tmp
1475 grep "_Z4t16av" two_file_test_1b.syms >> $@.tmp
1476 mv -f $@.tmp $@
1477 # Make a copy of two_file_test_1.o, which does not define the symbol _Z4t16av.
1478 MOSTLYCLEANFILES += two_file_test_1c.o
1479 two_file_test_1c.o: two_file_test_1.o
1480 cp two_file_test_1.o $@
1481
1482 plugin_test.so: plugin_test.o
1483 $(LINK) -Bgcctestdir/ -shared plugin_test.o
1484 plugin_test.o: plugin_test.c
1485 $(COMPILE) -O0 -c -fpic -o $@ $<
1486
1487 two_file_test_main.syms: two_file_test_main.o
1488 $(TEST_READELF) -sW $< >$@ 2>/dev/null
1489 two_file_test_1.syms: two_file_test_1.o
1490 $(TEST_READELF) -sW $< >$@ 2>/dev/null
1491 two_file_test_1b.syms: two_file_test_1b.o
1492 $(TEST_READELF) -sW $< >$@ 2>/dev/null
1493 two_file_test_2.syms: two_file_test_2.o
1494 $(TEST_READELF) -sW $< >$@ 2>/dev/null
1495 plugin_common_test_1.syms: plugin_common_test_1.o
1496 $(TEST_READELF) -sW $< >$@ 2>/dev/null
1497 plugin_common_test_2.syms: plugin_common_test_2.o
1498 $(TEST_READELF) -sW $< >$@ 2>/dev/null
1499
1500 empty.syms:
1501 @echo "" >$@
1502 @echo "Symbol table" >>$@
1503
1504 MOSTLYCLEANFILES += unused.c
1505 unused.syms: unused.o
1506 $(TEST_READELF) -sW $< >$@ 2>/dev/null
1507 @echo " 1: 00000000 4 FUNC GLOBAL DEFAULT 1 UNUSED" >>$@
1508 unused.o: unused.c
1509 $(COMPILE) -c -o $@ $<
1510 unused.c:
1511 @cp /dev/null $@
1512
1513 endif PLUGINS
1514
1515 check_PROGRAMS += exclude_libs_test
1516 check_SCRIPTS += exclude_libs_test.sh
1517 check_DATA += exclude_libs_test.syms
1518 MOSTLYCLEANFILES += exclude_libs_test.syms libexclude_libs_test_1.a \
1519 libexclude_libs_test_2.a alt/libexclude_libs_test_3.a
1520 exclude_libs_test_SOURCES = exclude_libs_test.c
1521 exclude_libs_test_DEPENDENCIES = gcctestdir/ld libexclude_libs_test_1.a \
1522 libexclude_libs_test_2.a alt/libexclude_libs_test_3.a
1523 exclude_libs_test_LDFLAGS = -Bgcctestdir/ -L. -Lalt \
1524 -Wl,--exclude-libs,dummy:libexclude_libs_test_1 \
1525 -Wl,--exclude-libs,libexclude_libs_test_3
1526 exclude_libs_test_LDADD = -lexclude_libs_test_1 -lexclude_libs_test_2 \
1527 alt/libexclude_libs_test_3.a
1528 exclude_libs_test.syms: exclude_libs_test
1529 $(TEST_READELF) -sW $< >$@ 2>/dev/null
1530 libexclude_libs_test_1.a: exclude_libs_test_1.o
1531 $(TEST_AR) rc $@ $^
1532 libexclude_libs_test_2.a: exclude_libs_test_2.o
1533 $(TEST_AR) rc $@ $^
1534 alt/libexclude_libs_test_3.a: exclude_libs_test_3.o
1535 test -d alt || mkdir -p alt
1536 $(TEST_AR) rc $@ $^
1537
1538 check_PROGRAMS += local_labels_test
1539 local_labels_test.o: ver_test_6.c
1540 $(COMPILE) -g -c -Wa,-L -o $@ $<
1541 local_labels_test: local_labels_test.o
1542 $(LINK) -Bgcctestdir/ local_labels_test.o
1543
1544 check_PROGRAMS += discard_locals_test
1545 check_SCRIPTS += discard_locals_test.sh
1546 check_DATA += discard_locals_test.syms \
1547 discard_locals_relocatable_test1.syms \
1548 discard_locals_relocatable_test2.syms
1549 MOSTLYCLEANFILES += discard_locals_test.syms \
1550 discard_locals_relocatable_test1.syms \
1551 discard_locals_relocatable_test2.syms \
1552 discard_locals_relocatable_test1.out \
1553 discard_locals_relocatable_test2.out
1554 discard_locals_test_SOURCES = discard_locals_test.c
1555 discard_locals_test_LDFLAGS = -Bgcctestdir/ -Wl,--discard-locals
1556 discard_locals_test.syms: discard_locals_test
1557 $(TEST_READELF) -sW $< >$@ 2>/dev/null
1558 # '-Wa,-L' is required to preserve the local label used for testing.
1559 discard_locals_test.o: discard_locals_test.c
1560 $(COMPILE) -c -Wa,-L -o $@ $<
1561
1562 discard_locals_relocatable_test1.syms: discard_locals_relocatable_test1.out
1563 $(TEST_READELF) -sW $< >$@ 2>/dev/null
1564 discard_locals_relocatable_test.o: discard_locals_relocatable_test.c
1565 $(COMPILE) -c -Wa,-L -fPIC -o $@ $<
1566 discard_locals_relocatable_test1.out: discard_locals_relocatable_test.o ../ld-new
1567 ../ld-new --discard-locals -relocatable -o $@ $<
1568
1569 discard_locals_relocatable_test2.syms: discard_locals_relocatable_test2.out
1570 $(TEST_READELF) -sW $< >$@ 2>/dev/null
1571 discard_locals_relocatable_test2.out: discard_locals_relocatable_test.o ../ld-new
1572 ../ld-new --discard-all -relocatable -o $@ $<
1573
1574 if MCMODEL_MEDIUM
1575 check_PROGRAMS += large
1576 large_SOURCES = large.c
1577 large_CFLAGS = -mcmodel=medium
1578 large_DEPENDENCIES = gcctestdir/ld
1579 large_LDFLAGS = -Bgcctestdir/
1580 large_LDADD =
1581 endif MCMODEL_MEDIUM
1582
1583 # Test that hidden and internal symbols in the main program cannot be
1584 # referenced by a shared library.
1585 check_SCRIPTS += hidden_test.sh
1586 check_DATA += hidden_test.err
1587 MOSTLYCLEANFILES += hidden_test hidden_test.err
1588 libhidden.so: hidden_test_1.c gcctestdir/ld
1589 $(COMPILE) -Bgcctestdir/ -g -shared -fPIC -w -o $@ $(srcdir)/hidden_test_1.c
1590 hidden_test: hidden_test_main.o libhidden.so gcctestdir/ld
1591 $(LINK) -Bgcctestdir/ -Wl,-R,. hidden_test_main.o libhidden.so 2>hidden_test.err
1592 hidden_test.err: hidden_test
1593 @touch hidden_test.err
1594
1595 # Test -retain-symbols-file.
1596 check_SCRIPTS += retain_symbols_file_test.sh
1597 check_DATA += retain_symbols_file_test.stdout
1598 MOSTLYCLEANFILES += retain_symbols_file_test retain_symbols_file_test.in \
1599 retain_symbols_file_test.stdout
1600 retain_symbols_file_test.so: basic_pic_test.o gcctestdir/ld
1601 echo 'main' > retain_symbols_file_test.in
1602 echo 't1' >> retain_symbols_file_test.in
1603 echo '_ZN4t16bC1Ev' >> retain_symbols_file_test.in
1604 echo '_ZNK4t20a3getEv' >> retain_symbols_file_test.in
1605 echo '_Z3t18v' >> retain_symbols_file_test.in
1606 echo '__tcf_0' >> retain_symbols_file_test.in
1607 $(CXXLINK) -Bgcctestdir/ -shared -Wl,-retain-symbols-file,retain_symbols_file_test.in basic_pic_test.o
1608 retain_symbols_file_test.stdout: retain_symbols_file_test.so
1609 $(TEST_NM) -C retain_symbols_file_test.so > $@
1610
1611
1612 # Test that if the output file already exists and is empty,
1613 # it will get execute permission.
1614 check_PROGRAMS += permission_test
1615 permission_test: basic_test.o gcctestdir/ld
1616 umask 022; \
1617 rm -f $@; \
1618 touch $@; \
1619 chmod 600 $@; \
1620 $(CXXLINK) -Bgcctestdir/ basic_test.o
1621
1622 # Check -l:foo.a
1623 check_PROGRAMS += searched_file_test
1624 MOSTLYCLEANFILES += searched_file_test searched_file_test_lib.o \
1625 alt/searched_file_test_lib.a
1626 searched_file_test_SOURCES = searched_file_test.cc
1627 searched_file_test_DEPENDENCIES = alt/searched_file_test_lib.a
1628 searched_file_test_LDFLAGS = -Bgcctestdir/ -Lalt
1629 searched_file_test_LDADD = -l:searched_file_test_lib.a
1630 searched_file_test_lib.o: searched_file_test_lib.cc
1631 $(CXXCOMPILE) -c -o $@ $<
1632 alt/searched_file_test_lib.a: searched_file_test_lib.o
1633 test -d alt || mkdir -p alt
1634 $(TEST_AR) rc $@ $^
1635
1636 # Test that no .gnu.version sections are created when
1637 # symbol versioning is not used.
1638 check_SCRIPTS += no_version_test.sh
1639 check_DATA += no_version_test.stdout
1640 MOSTLYCLEANFILES += libno_version_test.so no_version_test.stdout
1641 # We invoke the linker directly since gcc may include additional objects that
1642 # uses symbol versioning.
1643 libno_version_test.so: no_version_test.o gcctestdir/ld
1644 gcctestdir/ld -shared -o $@ no_version_test.o
1645 no_version_test.o: no_version_test.c
1646 $(COMPILE) -o $@ -c -fPIC $<
1647 no_version_test.stdout: libno_version_test.so
1648 $(TEST_OBJDUMP) -h $< > $@
1649
1650 # Test STT_GNU_IFUNC symbols.
1651 if IFUNC
1652
1653 ifuncmod1.o: ifuncmod1.c
1654 $(COMPILE) -c -fpic -o $@ $<
1655 ifuncmod1.so: ifuncmod1.o gcctestdir/ld
1656 $(LINK) -Bgcctestdir/ -shared ifuncmod1.o
1657
1658 ifuncdep1.o: ifuncmod1.c
1659 $(COMPILE) -c -o $@ $<
1660
1661 ifuncmain1pic.o: ifuncmain1.c
1662 $(COMPILE) -c -fpic -o $@ $<
1663 ifuncmain1pie.o: ifuncmain1.c
1664 $(COMPILE) -c -fpie -o $@ $<
1665
1666 if HAVE_STATIC
1667 if IFUNC_STATIC
1668 check_PROGRAMS += ifuncmain1static
1669 ifuncmain1static_SOURCES = ifuncmain1.c
1670 ifuncmain1static_DEPENDENCIES = gcctestdir/ld ifuncdep1.o
1671 ifuncmain1static_LDFLAGS = -Bgcctestdir/ -static
1672 ifuncmain1static_LDADD = ifuncdep1.o
1673
1674 check_PROGRAMS += ifuncmain1picstatic
1675 ifuncmain1picstatic: ifuncmain1pic.o ifuncmod1.o gcctestdir/ld
1676 $(LINK) -Bgcctestdir/ -static ifuncmain1pic.o ifuncmod1.o
1677 endif
1678 endif
1679
1680 check_PROGRAMS += ifuncmain1
1681 ifuncmain1_SOURCES = ifuncmain1.c
1682 ifuncmain1_DEPENDENCIES = gcctestdir/ld ifuncmod1.so
1683 ifuncmain1_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1684 ifuncmain1_LDADD = ifuncmod1.so
1685
1686 check_PROGRAMS += ifuncmain1pic
1687 ifuncmain1pic: ifuncmain1pic.o ifuncmod1.so gcctestdir/ld
1688 $(LINK) -Bgcctestdir/ ifuncmain1pic.o ifuncmod1.so -Wl,-R,.
1689
1690 check_PROGRAMS += ifuncmain1vis
1691 ifuncmain1vis_SOURCES = ifuncmain1vis.c
1692 ifuncmain1vis_DEPENDENCIES = gcctestdir/ld ifuncmod1.so
1693 ifuncmain1vis_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1694 ifuncmain1vis_LDADD = ifuncmod1.so
1695
1696 check_PROGRAMS += ifuncmain1vispic
1697 ifuncmain1vispic.o: ifuncmain1vis.c
1698 $(COMPILE) -c -fpic -o $@ $<
1699 ifuncmain1vispic: ifuncmain1vispic.o ifuncmod1.so gcctestdir/ld
1700 $(LINK) -Bgcctestdir/ ifuncmain1pic.o ifuncmod1.so -Wl,-R,.
1701
1702 check_PROGRAMS += ifuncmain1staticpic
1703 ifuncmain1staticpic: ifuncmain1pic.o ifuncmod1.o gcctestdir/ld
1704 $(LINK) -Bgcctestdir/ ifuncmain1pic.o ifuncmod1.o
1705
1706 check_PROGRAMS += ifuncmain1pie
1707 ifuncmain1pie: ifuncmain1pie.o ifuncmod1.so gcctestdir/ld
1708 $(LINK) -Bgcctestdir/ -pie ifuncmain1pie.o ifuncmod1.so -Wl,-R,.
1709
1710 check_PROGRAMS += ifuncmain1vispie
1711 ifuncmain1vispie.o: ifuncmain1vis.c
1712 $(COMPILE) -c -fpie -o $@ $<
1713 ifuncmain1vispie: ifuncmain1vispie.o ifuncmod1.so gcctestdir/ld
1714 $(LINK) -Bgcctestdir/ -pie ifuncmain1vispie.o ifuncmod1.so -Wl,-R,.
1715
1716 check_PROGRAMS += ifuncmain1staticpie
1717 ifuncmain1staticpie: ifuncmain1pie.o ifuncmod1.o gcctestdir/ld
1718 $(LINK) -Bgcctestdir/ -pie ifuncmain1pie.o ifuncmod1.o
1719
1720 ifuncmain2pic.o: ifuncmain2.c
1721 $(COMPILE) -c -fpic -o $@ $<
1722
1723 ifuncdep2pic.o: ifuncdep2.c
1724 $(COMPILE) -c -fpic -o $@ $<
1725
1726 if HAVE_STATIC
1727 if IFUNC_STATIC
1728 check_PROGRAMS += ifuncmain2static
1729 ifuncmain2static_SOURCES = ifuncmain2.c ifuncdep2.c
1730 ifuncmain2static_DEPENDENCIES = gcctestdir/ld
1731 ifuncmain2static_LDFLAGS = -Bgcctestdir/ -static
1732 ifuncmain2static_LDADD =
1733
1734 check_PROGRAMS += ifuncmain2picstatic
1735 ifuncmain2picstatic: ifuncmain2pic.o ifuncdep2pic.o gcctestdir/ld
1736 $(LINK) -Bgcctestdir/ -static ifuncmain2pic.o ifuncdep2pic.o
1737 endif
1738 endif
1739
1740 check_PROGRAMS += ifuncmain2
1741 ifuncmain2_SOURCES = ifuncmain2.c ifuncdep2.c
1742 ifuncmain2_DEPENDENCIES = gcctestdir/ld
1743 ifuncmain2_LDFLAGS = -Bgcctestdir/
1744 ifuncmain2_LDADD =
1745
1746 check_PROGRAMS += ifuncmain2pic
1747 ifuncmain2pic: ifuncmain2pic.o ifuncdep2pic.o gcctestdir/ld
1748 $(LINK) -Bgcctestdir/ ifuncmain2pic.o ifuncdep2pic.o
1749
1750 ifuncmod3.o: ifuncmod3.c
1751 $(COMPILE) -c -fpic -o $@ $<
1752 ifuncmod3.so: ifuncmod3.o gcctestdir/ld
1753 $(LINK) -Bgcctestdir/ -shared ifuncmod3.o
1754
1755 check_PROGRAMS += ifuncmain3
1756 ifuncmain3_SOURCES = ifuncmain3.c
1757 ifuncmain3_DEPENDENCIES = gcctestdir/ld ifuncmod3.so
1758 ifuncmain3_LDFLAGS = -Bgcctestdir/ -Wl,--export-dynamic -Wl,-R,.
1759 ifuncmain3_LDADD = -ldl
1760
1761 ifuncmain4pic.o: ifuncmain4.c
1762 $(COMPILE) -c -fpic -o $@ $<
1763
1764 if HAVE_STATIC
1765 if IFUNC_STATIC
1766 check_PROGRAMS += ifuncmain4static
1767 ifuncmain4static_SOURCES = ifuncmain4.c
1768 ifuncmain4static_DEPENDENCIES = gcctestdir/ld
1769 ifuncmain4static_LDFLAGS = -Bgcctestdir/ -static
1770 ifuncmain4static_LDADD =
1771
1772 check_PROGRAMS += ifuncmain4picstatic
1773 ifuncmain4picstatic: ifuncmain4pic.o gcctestdir/ld
1774 $(LINK) -Bgcctestdir/ -static ifuncmain4pic.o
1775 endif
1776 endif
1777
1778 check_PROGRAMS += ifuncmain4
1779 ifuncmain4_SOURCES = ifuncmain4.c
1780 ifuncmain4_DEPENDENCIES = gcctestdir/ld
1781 ifuncmain4_LDFLAGS = -Bgcctestdir/
1782 ifuncmain4_LDADD =
1783
1784 ifuncmain5pic.o: ifuncmain5.c
1785 $(COMPILE) -c -fpic -o $@ $<
1786
1787 ifuncmain5pie.o: ifuncmain5.c
1788 $(COMPILE) -c -fpie -o $@ $<
1789
1790 ifuncmod5.o: ifuncmod5.c
1791 $(COMPILE) -c -fpic -o $@ $<
1792 ifuncmod5.so: ifuncmod5.o gcctestdir/ld
1793 $(LINK) -Bgcctestdir/ -shared ifuncmod5.o
1794
1795 ifuncdep5.o: ifuncmod5.c
1796 $(COMPILE) -c -o $@ $<
1797
1798 if HAVE_STATIC
1799 if IFUNC_STATIC
1800 check_PROGRAMS += ifuncmain5static
1801 ifuncmain5static_SOURCES = ifuncmain5.c
1802 ifuncmain5static_DEPENDENCIES = gcctestdir/ld ifuncdep5.o
1803 ifuncmain5static_LDFLAGS = -Bgcctestdir/ -static
1804 ifuncmain5static_LDADD = ifuncdep5.o
1805
1806 check_PROGRAMS += ifuncmain5picstatic
1807 ifuncmain5picstatic: ifuncmain5pic.o ifuncmod5.o gcctestdir/ld
1808 $(LINK) -Bgcctestdir/ -static ifuncmain5pic.o ifuncmod5.o
1809 endif
1810 endif
1811
1812 check_PROGRAMS += ifuncmain5
1813 ifuncmain5_SOURCES = ifuncmain5.c
1814 ifuncmain5_DEPENDENCIES = gcctestdir/ld ifuncmod5.so
1815 ifuncmain5_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1816 ifuncmain5_LDADD = ifuncmod5.so
1817
1818 check_PROGRAMS += ifuncmain5pic
1819 ifuncmain5pic: ifuncmain5pic.o ifuncmod5.so gcctestdir/ld
1820 $(LINK) -Bgcctestdir/ ifuncmain5pic.o ifuncmod5.so -Wl,-R,.
1821
1822 check_PROGRAMS += ifuncmain5staticpic
1823 ifuncmain5staticpic: ifuncmain5pic.o ifuncmod5.o gcctestdir/ld
1824 $(LINK) -Bgcctestdir/ ifuncmain5pic.o ifuncmod5.o
1825
1826 check_PROGRAMS += ifuncmain5pie
1827 ifuncmain5pie: ifuncmain5pie.o ifuncmod5.so gcctestdir/ld
1828 $(LINK) -Bgcctestdir/ -pie ifuncmain5pie.o ifuncmod5.so -Wl,-R,.
1829
1830 ifuncmain6pie.o: ifuncmain6pie.c
1831 $(COMPILE) -c -fpie -o $@ $<
1832
1833 ifuncmod6.o: ifuncmod6.c
1834 $(COMPILE) -c -fpic -o $@ $<
1835 ifuncmod6.so: ifuncmod6.o gcctestdir/ld
1836 $(LINK) -Bgcctestdir/ -shared ifuncmod6.o
1837
1838 check_PROGRAMS += ifuncmain6pie
1839 ifuncmain6pie: ifuncmain6pie.o ifuncmod6.so gcctestdir/ld
1840 $(LINK) -Bgcctestdir/ -pie ifuncmain6pie.o ifuncmod6.so -Wl,-R,.
1841
1842 ifuncmain7pic.o: ifuncmain7.c
1843 $(COMPILE) -c -fpic -o $@ $<
1844
1845 ifuncmain7pie.o: ifuncmain7.c
1846 $(COMPILE) -c -fpie -o $@ $<
1847
1848 if HAVE_STATIC
1849 if IFUNC_STATIC
1850 check_PROGRAMS += ifuncmain7static
1851 ifuncmain7static_SOURCES = ifuncmain7.c
1852 ifuncmain7static_DEPENDENCIES = gcctestdir/ld
1853 ifuncmain7static_LDFLAGS = -Bgcctestdir/ -static
1854 ifuncmain7static_LDADD =
1855
1856 check_PROGRAMS += ifuncmain7picstatic
1857 ifuncmain7picstatic: ifuncmain7pic.o gcctestdir/ld
1858 $(LINK) -Bgcctestdir/ -static ifuncmain7pic.o
1859 endif
1860 endif
1861
1862 check_PROGRAMS += ifuncmain7
1863 ifuncmain7_SOURCES = ifuncmain7.c
1864 ifuncmain7_DEPENDENCIES = gcctestdir/ld
1865 ifuncmain7_LDFLAGS = -Bgcctestdir/
1866 ifuncmain7_LDADD =
1867
1868 check_PROGRAMS += ifuncmain7pic
1869 ifuncmain7pic: ifuncmain7pic.o gcctestdir/ld
1870 $(LINK) -Bgcctestdir/ ifuncmain7pic.o
1871
1872 check_PROGRAMS += ifuncmain7pie
1873 ifuncmain7pie: ifuncmain7pie.o gcctestdir/ld
1874 $(LINK) -Bgcctestdir/ -pie ifuncmain7pie.o
1875
1876 check_PROGRAMS += ifuncvar
1877 ifuncvar1_pic.o: ifuncvar1.c
1878 $(COMPILE) -c -fpic -o $@ $<
1879 ifuncvar2_pic.o: ifuncvar2.c
1880 $(COMPILE) -c -fpic -o $@ $<
1881 ifuncvar.so: ifuncvar1_pic.o ifuncvar2_pic.o gcctestdir/ld
1882 $(LINK) -Bgcctestdir/ -shared ifuncvar1_pic.o ifuncvar2_pic.o
1883 ifuncvar_SOURCES = ifuncvar3.c
1884 ifuncvar_DEPENDENCIES = gcctestdir/ld ifuncvar.so
1885 ifuncvar_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1886 ifuncvar_LDADD = ifuncvar.so
1887
1888 endif IFUNC
1889
1890 # Test that strong reference to a weak symbol in a DSO remains strong.
1891 check_SCRIPTS += strong_ref_weak_def.sh
1892 check_DATA += strong_ref_weak_def.stdout
1893 MOSTLYCLEANFILES += strong_ref_weak_def_1.so strong_ref_weak_def_2.so \
1894 strong_ref_weak_def.stdout
1895 strong_ref_weak_def_2.o: strong_ref_weak_def_2.c
1896 $(COMPILE) -o $@ -c -fPIC $<
1897 strong_ref_weak_def_2.so: strong_ref_weak_def_2.o gcctestdir/ld
1898 gcctestdir/ld -shared -o $@ strong_ref_weak_def_2.o
1899 strong_ref_weak_def_1.o: strong_ref_weak_def_1.c
1900 $(COMPILE) -o $@ -c -fPIC $<
1901 strong_ref_weak_def_1.so: strong_ref_weak_def_1.o strong_ref_weak_def_2.so \
1902 gcctestdir/ld
1903 gcctestdir/ld -shared -o $@ strong_ref_weak_def_1.o \
1904 strong_ref_weak_def_2.so
1905 strong_ref_weak_def.stdout: strong_ref_weak_def_1.so
1906 $(TEST_READELF) -sWD $< > $@
1907
1908 # Test that a strong weak reference remains strong if there is another
1909 # weak reference in a DSO.
1910 check_SCRIPTS += dyn_weak_ref.sh
1911 check_DATA += dyn_weak_ref.stdout
1912 MOSTLYCLEANFILES += dyn_weak_ref_1.so dyn_weak_ref_2.so \
1913 dyn_weak_ref.stdout
1914 dyn_weak_ref_2.o: dyn_weak_ref_2.c
1915 $(COMPILE) -o $@ -c -fPIC $<
1916 dyn_weak_ref_2.so: dyn_weak_ref_2.o gcctestdir/ld
1917 gcctestdir/ld -shared -o $@ dyn_weak_ref_2.o
1918 dyn_weak_ref_1.o: dyn_weak_ref_1.c
1919 $(COMPILE) -o $@ -c -fPIC $<
1920 # We intentionally put dyn_weak_ref_2.so in front of dyn_weak_ref_1.o
1921 # so that the weak ref there goes to gold's symbol table first.
1922 dyn_weak_ref_1.so: dyn_weak_ref_1.o dyn_weak_ref_2.so gcctestdir/ld
1923 gcctestdir/ld -shared -o $@ dyn_weak_ref_2.so dyn_weak_ref_1.o
1924 dyn_weak_ref.stdout: dyn_weak_ref_1.so
1925 $(TEST_READELF) -sWD $< > $@
1926
1927
1928 # Test that --start-lib and --end-lib function correctly.
1929 check_PROGRAMS += start_lib_test
1930 start_lib_test: start_lib_test_main.o libstart_lib_test.a start_lib_test_2.o start_lib_test_3.o \
1931 gcctestdir/ld
1932 $(LINK) -Bgcctestdir/ -o $@ start_lib_test_main.o -L. -lstart_lib_test \
1933 -Wl,--start-lib start_lib_test_2.o start_lib_test_3.o -Wl,--end-lib
1934 libstart_lib_test.a: start_lib_test_1.o
1935 $(TEST_AR) rc $@ $^
1936
1937 # Test that MEMORY region support works.
1938 check_SCRIPTS += memory_test.sh
1939 check_DATA += memory_test.stdout
1940 MOSTLYCLEANFILES += memory_test.stdout memory_test memory_test.o
1941 memory_test.o: memory_test.s
1942 $(COMPILE) -o $@ -c $<
1943 memory_test: memory_test.o gcctestdir/ld $(srcdir)/memory_test.t
1944 $(LINK) -Bgcctestdir/ -nostartfiles -nostdlib -T $(srcdir)/memory_test.t -o $@ memory_test.o
1945 memory_test.stdout: memory_test
1946 $(TEST_READELF) -lWS $< > $@
1947
1948 # End-to-end incremental linking tests.
1949 # Incremental linking is currently supported only on the x86_64 target.
1950
1951 if DEFAULT_TARGET_X86_64
1952
1953 two_file_test_1_v1_ndebug.o: two_file_test_1_v1.cc
1954 $(CXXCOMPILE) -O0 -g0 -c -o $@ $<
1955 two_file_test_1_ndebug.o: two_file_test_1.cc
1956 $(CXXCOMPILE) -O0 -g0 -c -o $@ $<
1957 two_file_test_1b_ndebug.o: two_file_test_1b.cc
1958 $(CXXCOMPILE) -O0 -g0 -c -o $@ $<
1959 two_file_test_2_ndebug.o: two_file_test_2.cc
1960 $(CXXCOMPILE) -O0 -g0 -c -o $@ $<
1961 two_file_test_main_ndebug.o: two_file_test_main.cc
1962 $(CXXCOMPILE) -O0 -g0 -c -o $@ $<
1963
1964 check_PROGRAMS += incremental_test_2
1965 MOSTLYCLEANFILES += two_file_test_tmp_2.o
1966 incremental_test_2: two_file_test_1_v1_ndebug.o two_file_test_1_ndebug.o two_file_test_1b_ndebug.o \
1967 two_file_test_2_ndebug.o two_file_test_main_ndebug.o gcctestdir/ld
1968 cp -f two_file_test_1_v1_ndebug.o two_file_test_tmp_2.o
1969 $(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
1970 @sleep 1
1971 cp -f two_file_test_1_ndebug.o two_file_test_tmp_2.o
1972 $(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
1973
1974 check_PROGRAMS += incremental_test_3
1975 MOSTLYCLEANFILES += two_file_test_tmp_3.o
1976 incremental_test_3: two_file_test_1.o two_file_test_1b_v1.o two_file_test_1b.o \
1977 two_file_test_2.o two_file_test_main.o gcctestdir/ld
1978 cp -f two_file_test_1b_v1.o two_file_test_tmp_3.o
1979 $(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
1980 @sleep 1
1981 cp -f two_file_test_1b.o two_file_test_tmp_3.o
1982 $(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
1983
1984 check_PROGRAMS += incremental_test_4
1985 MOSTLYCLEANFILES += incremental_test_4.base two_file_test_tmp_4.o
1986 incremental_test_4: two_file_test_1.o two_file_test_1b.o two_file_test_2_v1.o \
1987 two_file_test_2.o two_file_test_main.o gcctestdir/ld
1988 cp -f two_file_test_2_v1.o two_file_test_tmp_4.o
1989 $(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
1990 mv -f incremental_test_4 incremental_test_4.base
1991 @sleep 1
1992 cp -f two_file_test_2.o two_file_test_tmp_4.o
1993 $(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
1994
1995 check_PROGRAMS += incremental_test_5
1996 MOSTLYCLEANFILES += two_file_test_5.a
1997 incremental_test_5: two_file_test_1.o two_file_test_1b_v1.o two_file_test_1b.o \
1998 two_file_test_2.o two_file_test_main.o gcctestdir/ld
1999 cp -f two_file_test_1b_v1.o two_file_test_tmp_5.o
2000 $(TEST_AR) rc two_file_test_5.a two_file_test_1.o two_file_test_tmp_5.o two_file_test_2.o
2001 $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Bgcctestdir/ two_file_test_main.o two_file_test_5.a
2002 @sleep 1
2003 cp -f two_file_test_1b.o two_file_test_tmp_5.o
2004 $(TEST_AR) rc two_file_test_5.a two_file_test_1.o two_file_test_tmp_5.o two_file_test_2.o
2005 $(CXXLINK) -Wl,--incremental-update -Bgcctestdir/ two_file_test_main.o two_file_test_5.a
2006
2007 # Test the --incremental-unchanged flag with an archive library.
2008 # The second link should not update the library.
2009 check_PROGRAMS += incremental_test_6
2010 MOSTLYCLEANFILES += two_file_test_6.a
2011 incremental_test_6: two_file_test_1.o two_file_test_1b_v1.o two_file_test_1b.o \
2012 two_file_test_2.o two_file_test_main.o gcctestdir/ld
2013 cp -f two_file_test_1b.o two_file_test_tmp_6.o
2014 $(TEST_AR) rc two_file_test_6.a two_file_test_1.o two_file_test_tmp_6.o two_file_test_2.o
2015 $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Bgcctestdir/ two_file_test_main.o two_file_test_6.a
2016 @sleep 1
2017 cp -f two_file_test_1b_v1.o two_file_test_tmp_6.o
2018 $(TEST_AR) rc two_file_test_6.a two_file_test_1.o two_file_test_tmp_6.o two_file_test_2.o
2019 $(CXXLINK) -Wl,--incremental-update -Bgcctestdir/ two_file_test_main.o -Wl,--incremental-unchanged two_file_test_6.a -Wl,--incremental-unknown
2020
2021 check_PROGRAMS += incremental_copy_test
2022 incremental_copy_test: copy_test_v1.o copy_test.o copy_test_1.so copy_test_2.so
2023 cp -f copy_test_v1.o copy_test_tmp.o
2024 $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Bgcctestdir/ -Wl,-R,. copy_test_tmp.o copy_test_1.so copy_test_2.so
2025 @sleep 1
2026 cp -f copy_test.o copy_test_tmp.o
2027 $(CXXLINK) -Wl,--incremental-update -Bgcctestdir/ -Wl,-R,. copy_test_tmp.o copy_test_1.so copy_test_2.so
2028
2029 check_PROGRAMS += incremental_common_test_1
2030 incremental_common_test_1: common_test_1_v1.o common_test_1_v2.o gcctestdir/ld
2031 cp -f common_test_1_v1.o common_test_1_tmp.o
2032 $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Bgcctestdir/ common_test_1_tmp.o
2033 @sleep 1
2034 cp -f common_test_1_v2.o common_test_1_tmp.o
2035 $(CXXLINK) -Wl,--incremental-update -Bgcctestdir/ common_test_1_tmp.o
2036
2037 check_PROGRAMS += incremental_comdat_test_1
2038 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
2039 cp -f incr_comdat_test_2_v1.o incr_comdat_test_1_tmp.o
2040 $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Bgcctestdir/ incr_comdat_test_1.o incr_comdat_test_1_tmp.o
2041 @sleep 1
2042 cp -f incr_comdat_test_2_v2.o incr_comdat_test_1_tmp.o
2043 $(CXXLINK) -Wl,--incremental-update -Bgcctestdir/ incr_comdat_test_1.o incr_comdat_test_1_tmp.o
2044 @sleep 1
2045 cp -f incr_comdat_test_2_v3.o incr_comdat_test_1_tmp.o
2046 $(CXXLINK) -Wl,--incremental-update -Bgcctestdir/ incr_comdat_test_1.o incr_comdat_test_1_tmp.o
2047
2048 endif DEFAULT_TARGET_X86_64
2049
2050 endif GCC
2051 endif NATIVE_LINKER
2052
2053 # These tests work with native and cross linkers.
2054
2055 if NATIVE_OR_CROSS_LINKER
2056
2057 # Test script section order.
2058 check_SCRIPTS += script_test_10.sh
2059 check_DATA += script_test_10.stdout
2060 script_test_10.o: script_test_10.s
2061 $(TEST_AS) -o $@ $<
2062 script_test_10: $(srcdir)/script_test_10.t script_test_10.o gcctestdir/ld
2063 gcctestdir/ld -o $@ script_test_10.o -T $(srcdir)/script_test_10.t
2064 script_test_10.stdout: script_test_10
2065 $(TEST_READELF) -SW script_test_10 > $@
2066
2067 # These tests work with cross linkers only.
2068
2069 if DEFAULT_TARGET_I386
2070
2071 check_SCRIPTS += split_i386.sh
2072 check_DATA += split_i386_1.stdout split_i386_2.stdout \
2073 split_i386_3.stdout split_i386_4.stdout split_i386_r.stdout
2074 SPLIT_DEFSYMS = --defsym __morestack=0x100 --defsym __morestack_non_split=0x200
2075 split_i386_1.o: split_i386_1.s
2076 $(TEST_AS) -o $@ $<
2077 split_i386_2.o: split_i386_2.s
2078 $(TEST_AS) -o $@ $<
2079 split_i386_3.o: split_i386_3.s
2080 $(TEST_AS) -o $@ $<
2081 split_i386_4.o: split_i386_4.s
2082 $(TEST_AS) -o $@ $<
2083 split_i386_n.o: split_i386_n.s
2084 $(TEST_AS) -o $@ $<
2085 split_i386_1: split_i386_1.o split_i386_n.o ../ld-new
2086 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_i386_1.o split_i386_n.o
2087 split_i386_1.stdout: split_i386_1
2088 $(TEST_OBJDUMP) -d $< > $@
2089 split_i386_2: split_i386_2.o split_i386_n.o ../ld-new
2090 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_i386_2.o split_i386_n.o
2091 split_i386_2.stdout: split_i386_2
2092 $(TEST_OBJDUMP) -d $< > $@
2093 split_i386_3.stdout: split_i386_3.o split_i386_n.o ../ld-new
2094 ../ld-new $(SPLIT_DEFSYMS) -o split_i386_3 split_i386_3.o split_i386_n.o > $@ 2>&1 || exit 0
2095 split_i386_4: split_i386_4.o split_i386_n.o ../ld-new
2096 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_i386_4.o split_i386_n.o
2097 split_i386_4.stdout: split_i386_4
2098 $(TEST_OBJDUMP) -d $< > $@
2099 split_i386_r.stdout: split_i386_1.o split_i386_n.o ../ld-new
2100 ../ld-new -r split_i386_1.o split_i386_n.o -o split_i386_r > $@ 2>&1 || exit 0
2101 MOSTLYCLEANFILES += split_i386_1 split_i386_2 split_i386_3 \
2102 split_i386_4 split_i386_r
2103
2104 endif DEFAULT_TARGET_I386
2105
2106 if DEFAULT_TARGET_X86_64
2107
2108 check_SCRIPTS += split_x86_64.sh
2109 check_DATA += split_x86_64_1.stdout split_x86_64_2.stdout \
2110 split_x86_64_3.stdout split_x86_64_4.stdout split_x86_64_r.stdout
2111 SPLIT_DEFSYMS = --defsym __morestack=0x100 --defsym __morestack_non_split=0x200
2112 split_x86_64_1.o: split_x86_64_1.s
2113 $(TEST_AS) -o $@ $<
2114 split_x86_64_2.o: split_x86_64_2.s
2115 $(TEST_AS) -o $@ $<
2116 split_x86_64_3.o: split_x86_64_3.s
2117 $(TEST_AS) -o $@ $<
2118 split_x86_64_4.o: split_x86_64_4.s
2119 $(TEST_AS) -o $@ $<
2120 split_x86_64_n.o: split_x86_64_n.s
2121 $(TEST_AS) -o $@ $<
2122 split_x86_64_1: split_x86_64_1.o split_x86_64_n.o ../ld-new
2123 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x86_64_1.o split_x86_64_n.o
2124 split_x86_64_1.stdout: split_x86_64_1
2125 $(TEST_OBJDUMP) -d $< > $@
2126 split_x86_64_2: split_x86_64_2.o split_x86_64_n.o ../ld-new
2127 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x86_64_2.o split_x86_64_n.o
2128 split_x86_64_2.stdout: split_x86_64_2
2129 $(TEST_OBJDUMP) -d $< > $@
2130 split_x86_64_3.stdout: split_x86_64_3.o split_x86_64_n.o ../ld-new
2131 ../ld-new $(SPLIT_DEFSYMS) -o split_x86_64_3 split_x86_64_3.o split_x86_64_n.o > $@ 2>&1 || exit 0
2132 split_x86_64_4: split_x86_64_4.o split_x86_64_n.o ../ld-new
2133 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x86_64_4.o split_x86_64_n.o
2134 split_x86_64_4.stdout: split_x86_64_4
2135 $(TEST_OBJDUMP) -d $< > $@
2136 split_x86_64_r.stdout: split_x86_64_1.o split_x86_64_n.o ../ld-new
2137 ../ld-new -r split_x86_64_1.o split_x86_64_n.o -o split_x86_64_r > $@ 2>&1 || exit 0
2138 MOSTLYCLEANFILES += split_x86_64_1 split_x86_64_2 split_x86_64_3 \
2139 split_x86_64_4 split_x86_64_r
2140
2141 endif DEFAULT_TARGET_X86_64
2142
2143 if DEFAULT_TARGET_ARM
2144
2145 check_SCRIPTS += arm_abs_global.sh
2146 check_DATA += arm_abs_global.stdout
2147 arm_abs_lib.o: arm_abs_lib.s
2148 $(TEST_AS) -march=armv7-a -o $@ $<
2149 libarm_abs.so: arm_abs_lib.o ../ld-new
2150 ../ld-new -shared -o $@ arm_abs_lib.o
2151 arm_abs_global.o: arm_abs_global.s
2152 $(TEST_AS) -march=armv7-a -o $@ $<
2153 arm_abs_global: arm_abs_global.o libarm_abs.so ../ld-new
2154 ../ld-new -o $@ arm_abs_global.o -L. -larm_abs
2155 arm_abs_global.stdout: arm_abs_global
2156 $(TEST_READELF) -r $< > $@
2157
2158 MOSTLYCLEANFILES += arm_abs_global
2159
2160 check_SCRIPTS += arm_branch_in_range.sh arm_branch_out_of_range.sh
2161 check_DATA += arm_bl_in_range.stdout arm_bl_out_of_range.stdout \
2162 thumb_bl_in_range.stdout thumb_bl_out_of_range.stdout \
2163 thumb2_bl_in_range.stdout thumb2_bl_out_of_range.stdout \
2164 thumb_blx_in_range.stdout thumb_blx_out_of_range.stdout \
2165 thumb2_blx_in_range.stdout thumb2_blx_out_of_range.stdout \
2166 thumb_bl_out_of_range_local.stdout arm_thm_jump11.stdout \
2167 arm_thm_jump8.stdout
2168
2169 arm_bl_in_range.stdout: arm_bl_in_range
2170 $(TEST_OBJDUMP) -D $< > $@
2171
2172 arm_bl_in_range: arm_bl_in_range.o ../ld-new
2173 ../ld-new -T $(srcdir)/arm_branch_range.t -o $@ $<
2174
2175 arm_bl_in_range.o: arm_bl_in_range.s
2176 $(TEST_AS) -o $@ $<
2177
2178 arm_bl_out_of_range.stdout: arm_bl_out_of_range
2179 $(TEST_OBJDUMP) -S $< > $@
2180
2181 arm_bl_out_of_range: arm_bl_out_of_range.o ../ld-new
2182 ../ld-new -T $(srcdir)/arm_branch_range.t -o $@ $<
2183
2184 arm_bl_out_of_range.o: arm_bl_out_of_range.s
2185 $(TEST_AS) -o $@ $<
2186
2187 thumb_bl_in_range.stdout: thumb_bl_in_range
2188 $(TEST_OBJDUMP) -D $< > $@
2189
2190 thumb_bl_in_range: thumb_bl_in_range.o ../ld-new
2191 ../ld-new -T $(srcdir)/thumb_branch_range.t -o $@ $<
2192
2193 thumb_bl_in_range.o: thumb_bl_in_range.s
2194 $(TEST_AS) -o $@ -march=armv5te $<
2195
2196 thumb_bl_out_of_range.stdout: thumb_bl_out_of_range
2197 $(TEST_OBJDUMP) -D $< > $@
2198
2199 thumb_bl_out_of_range: thumb_bl_out_of_range.o ../ld-new
2200 ../ld-new -T $(srcdir)/thumb_branch_range.t -o $@ $<
2201
2202 thumb_bl_out_of_range.o: thumb_bl_out_of_range.s
2203 $(TEST_AS) -o $@ -march=armv5te $<
2204
2205 thumb2_bl_in_range.stdout: thumb2_bl_in_range
2206 $(TEST_OBJDUMP) -D $< > $@
2207
2208 thumb2_bl_in_range: thumb2_bl_in_range.o ../ld-new
2209 ../ld-new -T $(srcdir)/thumb2_branch_range.t -o $@ $<
2210
2211 thumb2_bl_in_range.o: thumb_bl_in_range.s
2212 $(TEST_AS) -o $@ -march=armv7-a $<
2213
2214 thumb2_bl_out_of_range.stdout: thumb2_bl_out_of_range
2215 $(TEST_OBJDUMP) -D $< > $@
2216
2217 thumb2_bl_out_of_range: thumb2_bl_out_of_range.o ../ld-new
2218 ../ld-new -T $(srcdir)/thumb2_branch_range.t -o $@ $<
2219
2220 thumb2_bl_out_of_range.o: thumb_bl_out_of_range.s
2221 $(TEST_AS) -o $@ -march=armv7-a $<
2222
2223 thumb_blx_in_range.stdout: thumb_blx_in_range
2224 $(TEST_OBJDUMP) -D $< > $@
2225
2226 thumb_blx_in_range: thumb_blx_in_range.o ../ld-new
2227 ../ld-new -T $(srcdir)/thumb_branch_range.t -o $@ $<
2228
2229 thumb_blx_in_range.o: thumb_blx_in_range.s
2230 $(TEST_AS) -o $@ -march=armv5te $<
2231
2232 thumb_blx_out_of_range.stdout: thumb_blx_out_of_range
2233 $(TEST_OBJDUMP) -D $< > $@
2234
2235 thumb_blx_out_of_range: thumb_blx_out_of_range.o ../ld-new
2236 ../ld-new -T $(srcdir)/thumb_branch_range.t -o $@ $<
2237
2238 thumb_blx_out_of_range.o: thumb_blx_out_of_range.s
2239 $(TEST_AS) -o $@ -march=armv5te $<
2240
2241 thumb2_blx_in_range.stdout: thumb2_blx_in_range
2242 $(TEST_OBJDUMP) -D $< > $@
2243
2244 thumb2_blx_in_range: thumb2_blx_in_range.o ../ld-new
2245 ../ld-new -T $(srcdir)/thumb2_branch_range.t -o $@ $<
2246
2247 thumb2_blx_in_range.o: thumb_blx_in_range.s
2248 $(TEST_AS) -o $@ -march=armv7-a $<
2249
2250 thumb2_blx_out_of_range.stdout: thumb2_blx_out_of_range
2251 $(TEST_OBJDUMP) -D $< > $@
2252
2253 thumb2_blx_out_of_range: thumb2_blx_out_of_range.o ../ld-new
2254 ../ld-new -T $(srcdir)/thumb2_branch_range.t -o $@ $<
2255
2256 thumb2_blx_out_of_range.o: thumb_blx_out_of_range.s
2257 $(TEST_AS) -o $@ -march=armv7-a $<
2258
2259 thumb_bl_out_of_range_local.stdout: thumb_bl_out_of_range_local
2260 $(TEST_OBJDUMP) -D $< > $@
2261
2262 thumb_bl_out_of_range_local: thumb_bl_out_of_range_local.o ../ld-new
2263 ../ld-new -T $(srcdir)/thumb_branch_range.t -o $@ $<
2264
2265 thumb_bl_out_of_range_local.o: thumb_bl_out_of_range_local.s
2266 $(TEST_AS) -o $@ -march=armv5te $<
2267
2268 arm_thm_jump11.stdout: arm_thm_jump11
2269 $(TEST_OBJDUMP) -D $< > $@
2270
2271 arm_thm_jump11: arm_thm_jump11.o ../ld-new
2272 ../ld-new -T $(srcdir)/arm_thm_jump11.t -o $@ $<
2273
2274 arm_thm_jump11.o: arm_thm_jump11.s
2275 $(TEST_AS) -o $@ $<
2276
2277 arm_thm_jump8.stdout: arm_thm_jump8
2278 $(TEST_OBJDUMP) -D $< > $@
2279
2280 arm_thm_jump8: arm_thm_jump8.o ../ld-new
2281 ../ld-new -T $(srcdir)/arm_thm_jump8.t -o $@ $<
2282
2283 arm_thm_jump8.o: arm_thm_jump8.s
2284 $(TEST_AS) -o $@ $<
2285
2286 MOSTLYCLEANFILES += arm_bl_in_range arm_bl_out_of_range thumb_bl_in_range \
2287 thumb_bl_out_of_range thumb2_bl_in_range thumb2_bl_out_of_range \
2288 thumb_blx_in_range thumb_blx_out_of_range thumb2_blx_in_range \
2289 thumb2_blx_out_of_range thumb_bl_out_of_range_local arm_thm_jump11 \
2290 arm_thm_jump8
2291
2292 check_SCRIPTS += arm_fix_v4bx.sh
2293 check_DATA += arm_fix_v4bx.stdout arm_fix_v4bx_interworking.stdout \
2294 arm_no_fix_v4bx.stdout
2295
2296 arm_fix_v4bx.stdout: arm_fix_v4bx
2297 $(TEST_OBJDUMP) -D -j.text $< > $@
2298
2299 arm_fix_v4bx: arm_fix_v4bx.o ../ld-new
2300 ../ld-new --fix-v4bx -o $@ $<
2301
2302 arm_fix_v4bx.o: arm_fix_v4bx.s
2303 $(TEST_AS) -o $@ $<
2304
2305 arm_fix_v4bx_interworking.stdout: arm_fix_v4bx_interworking
2306 $(TEST_OBJDUMP) -D -j.text $< > $@
2307
2308 arm_fix_v4bx_interworking: arm_fix_v4bx.o ../ld-new
2309 ../ld-new --fix-v4bx-interworking -o $@ $<
2310
2311 arm_no_fix_v4bx.stdout: arm_no_fix_v4bx
2312 $(TEST_OBJDUMP) -D -j.text $< > $@
2313
2314 arm_no_fix_v4bx: arm_fix_v4bx.o ../ld-new
2315 ../ld-new -o $@ $<
2316
2317 MOSTLYCLEANFILES += arm_fix_v4bx arm_fix_v4bx_interworking arm_no_fix_v4bx
2318
2319 check_SCRIPTS += arm_attr_merge.sh
2320 check_DATA += arm_attr_merge_6.stdout arm_attr_merge_6r.stdout \
2321 arm_attr_merge_7.stdout
2322
2323 arm_attr_merge_6.stdout: arm_attr_merge_6
2324 $(TEST_READELF) -A $< > $@
2325
2326 arm_attr_merge_6: arm_attr_merge_6a.o arm_attr_merge_6b.o
2327 ../ld-new -o $@ arm_attr_merge_6a.o arm_attr_merge_6b.o
2328
2329 arm_attr_merge_6a.o: arm_attr_merge_6a.s
2330 $(TEST_AS) -o $@ $<
2331
2332 arm_attr_merge_6b.o: arm_attr_merge_6b.s
2333 $(TEST_AS) -o $@ $<
2334
2335 arm_attr_merge_6r.stdout: arm_attr_merge_6r
2336 $(TEST_READELF) -A $< > $@
2337
2338 arm_attr_merge_6r: arm_attr_merge_6b.o arm_attr_merge_6a.o
2339 ../ld-new -o $@ arm_attr_merge_6b.o arm_attr_merge_6a.o
2340
2341 arm_attr_merge_7.stdout: arm_attr_merge_7
2342 $(TEST_READELF) -A $< > $@
2343
2344 arm_attr_merge_7: arm_attr_merge_7a.o arm_attr_merge_7b.o
2345 ../ld-new -o $@ arm_attr_merge_7a.o arm_attr_merge_7b.o
2346
2347 arm_attr_merge_7a.o: arm_attr_merge_7a.s
2348 $(TEST_AS) -o $@ $<
2349
2350 arm_attr_merge_7b.o: arm_attr_merge_7b.s
2351 $(TEST_AS) -o $@ $<
2352
2353 MOSTLYCLEANFILES += arm_attr_merge_6 arm_attr_merge_6r arm_attr_merge_7
2354
2355 # Cortex-A8 workaround test.
2356
2357 check_SCRIPTS += arm_cortex_a8.sh
2358 check_DATA += arm_cortex_a8_b_cond.stdout arm_cortex_a8_b.stdout \
2359 arm_cortex_a8_bl.stdout arm_cortex_a8_blx.stdout \
2360 arm_cortex_a8_local.stdout arm_cortex_a8_local_reloc.stdout
2361
2362 arm_cortex_a8_b_cond.stdout: arm_cortex_a8_b_cond
2363 $(TEST_OBJDUMP) -D -j.text $< > $@
2364
2365 arm_cortex_a8_b_cond: arm_cortex_a8_b_cond.o ../ld-new
2366 ../ld-new -o $@ $<
2367
2368 arm_cortex_a8_b_cond.o: arm_cortex_a8_b_cond.s
2369 $(TEST_AS) -o $@ $<
2370
2371 arm_cortex_a8_b.stdout: arm_cortex_a8_b
2372 $(TEST_OBJDUMP) -D -j.text $< > $@
2373
2374 arm_cortex_a8_b: arm_cortex_a8_b.o ../ld-new
2375 ../ld-new --fix-cortex-a8 -o $@ $<
2376
2377 arm_cortex_a8_b.o: arm_cortex_a8_b.s
2378 $(TEST_AS) -o $@ $<
2379
2380 arm_cortex_a8_bl.stdout: arm_cortex_a8_bl
2381 $(TEST_OBJDUMP) -D -j.text $< > $@
2382
2383 arm_cortex_a8_bl: arm_cortex_a8_bl.o ../ld-new
2384 ../ld-new -o $@ $<
2385
2386 arm_cortex_a8_bl.o: arm_cortex_a8_bl.s
2387 $(TEST_AS) -o $@ $<
2388
2389 arm_cortex_a8_blx.stdout: arm_cortex_a8_blx
2390 $(TEST_OBJDUMP) -D -j.text $< > $@
2391
2392 arm_cortex_a8_blx: arm_cortex_a8_blx.o ../ld-new
2393 ../ld-new -o $@ $<
2394
2395 arm_cortex_a8_blx.o: arm_cortex_a8_blx.s
2396 $(TEST_AS) -o $@ $<
2397
2398 arm_cortex_a8_local.stdout: arm_cortex_a8_local
2399 $(TEST_OBJDUMP) -D -j.text $< > $@
2400
2401 arm_cortex_a8_local: arm_cortex_a8_local.o ../ld-new
2402 ../ld-new -o $@ $<
2403
2404 arm_cortex_a8_local.o: arm_cortex_a8_local.s
2405 $(TEST_AS) -o $@ $<
2406
2407 arm_cortex_a8_local_reloc.stdout: arm_cortex_a8_local_reloc
2408 $(TEST_OBJDUMP) -D -j.text $< > $@
2409
2410 arm_cortex_a8_local_reloc: arm_cortex_a8_local_reloc.o ../ld-new
2411 ../ld-new -o $@ $<
2412
2413 arm_cortex_a8_local_reloc.o: arm_cortex_a8_local_reloc.s
2414 $(TEST_AS) -o $@ $<
2415
2416 MOSTLYCLEANFILES += arm_cortex_a8_b_cond arm_cortex_a8_b arm_cortex_a8_bl \
2417 arm_cortex_a8_blx arm_cortex_a8_local arm_cortex_a8_local_reloc
2418
2419 check_SCRIPTS += arm_exidx_test.sh
2420 check_DATA += arm_exidx_test.stdout
2421
2422 arm_exidx_test.stdout: arm_exidx_test.so
2423 $(TEST_READELF) -S $< > $@
2424
2425 arm_exidx_test.so: arm_exidx_test.o ../ld-new
2426 ../ld-new -shared -o $@ $<
2427
2428 arm_exidx_test.o: arm_exidx_test.s
2429 $(TEST_AS) -o $@ $<
2430
2431 check_SCRIPTS += pr12826.sh
2432 check_DATA += pr12826.stdout
2433
2434 pr12826.stdout: pr12826.so
2435 $(TEST_READELF) -A $< > $@
2436
2437 pr12826.so: pr12826_1.o pr12826_2.o ../ld-new
2438 ../ld-new -shared -o $@ $<
2439
2440 pr12826_1.o: pr12826_1.s
2441 $(TEST_AS) -o $@ $<
2442
2443 pr12826_2.o: pr12826_2.s
2444 $(TEST_AS) -o $@ $<
2445
2446 check_SCRIPTS += arm_unaligned_reloc.sh
2447 check_DATA += arm_unaligned_reloc.stdout
2448
2449 arm_unaligned_reloc.stdout: arm_unaligned_reloc
2450 $(TEST_OBJDUMP) -D $< > $@
2451
2452 arm_unaligned_reloc: arm_unaligned_reloc.o ../ld-new
2453 ../ld-new -o $@ $<
2454
2455 arm_unaligned_reloc.o: arm_unaligned_reloc.s
2456 $(TEST_AS) -o $@ $<
2457
2458 MOSTLYCLEANFILES += arm_unaligned_reloc
2459
2460 endif DEFAULT_TARGET_ARM
2461
2462 endif NATIVE_OR_CROSS_LINKER
2463
This page took 0.107197 seconds and 4 git commands to generate.