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