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