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