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