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