gold: Support x86-64 TLS code sequences without PLT
[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 # This is where we get zlib from. zlib is in ../../zlib unless we were
11 # configured with --with-system-zlib, in which case ../../zlib either
12 # doesn't exist or not configured.
13 ZLIB = -L../../zlib -lz
14
15 # The two_file_test tests -fmerge-constants, so we simply always turn
16 # it on. For compilers that do not support the command-line option,
17 # we assume they just always emit SHF_MERGE sections unconditionally.
18 AM_CFLAGS = $(WARN_CFLAGS) $(LFS_CFLAGS) $(MERGE_CONSTANTS_FLAG)
19 AM_CXXFLAGS = $(WARN_CXXFLAGS) $(LFS_CFLAGS) $(MERGE_CONSTANTS_FLAG)
20
21 AM_CPPFLAGS = \
22 -I$(srcdir) -I$(srcdir)/.. -I$(srcdir)/../../include \
23 -I$(srcdir)/../../elfcpp -I.. \
24 -DLOCALEDIR="\"$(datadir)/locale\"" \
25 @INCINTL@
26
27 # Some versions of GCC now automatically enable linker plugins,
28 # but we want to run our tests without GCC's plugins.
29 if HAVE_NO_USE_LINKER_PLUGIN
30 OPT_NO_PLUGINS = -fno-use-linker-plugin
31 endif
32
33 # COMPILE1, LINK1, CXXCOMPILE1, CXXLINK1 are renamed from COMPILE, LINK,
34 # CXXCOMPILE and CXXLINK generated by automake 1.11.1. FIXME: they should
35 # be updated if they are different from automake used by gold.
36 COMPILE1 = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
37 $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
38 LINK1 = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(OPT_NO_PLUGINS) \
39 $(AM_LDFLAGS) $(LDFLAGS) -o $@
40 CXXCOMPILE1 = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
41 $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
42 CXXLINK1 = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(OPT_NO_PLUGINS) \
43 $(AM_LDFLAGS) $(LDFLAGS) -o $@
44
45 # Strip out -Wp,-D_FORTIFY_SOURCE=, which is irrelevant for the gold
46 # testsuite and incompatible with -O0 used in gold tests, from
47 # COMPILE, LINK, CXXCOMPILE and CXXLINK.
48 COMPILE = `echo $(COMPILE1) | sed -e 's/-Wp,-D_FORTIFY_SOURCE=[0-9[0-9]]*//'`
49 LINK = `echo $(LINK1) | sed -e 's/-Wp,-D_FORTIFY_SOURCE=[0-9][0-9]*//'`
50 CXXCOMPILE = `echo $(CXXCOMPILE1) | sed -e 's/-Wp,-D_FORTIFY_SOURCE=[0-9][0-9]*//'`
51 CXXLINK = `echo $(CXXLINK1) | sed -e 's/-Wp,-D_FORTIFY_SOURCE=[0-9][0-9]*//'`
52
53 # Strip out -static-libgcc and -static-libstdc++ options, for tests
54 # that must have these libraries linked dynamically. The -shared-libgcc
55 # option does not work correctly, and there is no -shared-libstdc++ option.
56 # (See GCC PR 55781 and PR 55782.)
57 CXXLINK_S = `echo $(CXXLINK1) | sed -e 's/-static-lib\\(gcc\\|stdc++\\)//g'`
58
59 TEST_READELF = $(top_builddir)/../binutils/readelf
60 TEST_OBJDUMP = $(top_builddir)/../binutils/objdump
61 TEST_OBJCOPY = $(top_builddir)/../binutils/objcopy
62 TEST_CXXFILT = $(top_builddir)/../binutils/cxxfilt
63 TEST_STRIP = $(top_builddir)/../binutils/strip-new
64 TEST_AR = $(top_builddir)/../binutils/ar
65 TEST_NM = $(top_builddir)/../binutils/nm-new
66 TEST_AS = $(top_builddir)/../gas/as-new
67
68 if PLUGINS
69 LIBDL = -ldl
70 endif
71
72 if THREADS
73 THREADSLIB = -lpthread
74 endif
75
76 if OMP_SUPPORT
77 TLS_TEST_C_CFLAGS = -fopenmp
78 endif
79
80 # 'make clean' is good about deleting some intermediate files (such as
81 # .o's), but not all of them (such as .so's and .err files). We
82 # improve on that here. automake-1.9 info docs say "mostlyclean" is
83 # the right choice for files 'make' builds that people rebuild.
84 MOSTLYCLEANFILES = *.so *.syms *.stdout
85
86 # Export make variables to the shell scripts so that they can see
87 # (for example) DEFAULT_TARGET.
88 .EXPORT_ALL_VARIABLES:
89
90 # We will add to these later, for each individual test. Note
91 # that we add each test under check_SCRIPTS or check_PROGRAMS;
92 # the TESTS variable is automatically populated from these.
93 check_SCRIPTS =
94 check_DATA =
95 check_PROGRAMS =
96 BUILT_SOURCES =
97
98 TESTS = $(check_SCRIPTS) $(check_PROGRAMS)
99
100 # ---------------------------------------------------------------------
101 # These tests test the internals of gold (unittests).
102
103 # Infrastucture needed for the unittests
104 check_LIBRARIES = libgoldtest.a
105 libgoldtest_a_SOURCES = test.cc testmain.cc testfile.cc
106
107 DEPENDENCIES = \
108 libgoldtest.a ../libgold.a ../../libiberty/libiberty.a $(LIBINTL_DEP)
109 LDADD = libgoldtest.a ../libgold.a ../../libiberty/libiberty.a $(LIBINTL) \
110 $(THREADSLIB) $(LIBDL) $(ZLIB)
111
112
113 # The unittests themselves
114 if NATIVE_OR_CROSS_LINKER
115 if GCC
116
117 # Infrastucture needed for the unittests: a directory where the linker
118 # is named 'ld'. This is because the -B flag appends 'ld' to its arg.
119 gcctestdir/ld: ../ld-new
120 test -d gcctestdir || mkdir -p gcctestdir
121 rm -f gcctestdir/ld
122 (cd gcctestdir && $(LN_S) ../../ld-new ld)
123
124 # Some tests require the latest features of an in-tree assembler.
125 gcctestdir/as: $(TEST_AS)
126 test -d gcctestdir || mkdir -p gcctestdir
127 rm -f gcctestdir/as
128 (cd gcctestdir && $(LN_S) $(abs_top_builddir)/../gas/as-new as)
129
130 endif GCC
131
132 check_PROGRAMS += object_unittest
133 object_unittest_SOURCES = object_unittest.cc
134
135 check_PROGRAMS += binary_unittest
136 binary_unittest_SOURCES = binary_unittest.cc
137
138 check_PROGRAMS += leb128_unittest
139 leb128_unittest_SOURCES = leb128_unittest.cc
140
141 check_PROGRAMS += overflow_unittest
142 overflow_unittest_SOURCES = overflow_unittest.cc
143 overflow_unittest.o: overflow_unittest.cc
144 $(CXXCOMPILE) -O3 -c -o $@ $<
145
146 endif NATIVE_OR_CROSS_LINKER
147
148 # ---------------------------------------------------------------------
149 # These tests test the output of gold (end-to-end tests). In
150 # particular, they make sure that gold can link "difficult" object
151 # files, and the resulting object files run correctly. These can only
152 # run if we've built ld-new for the native architecture (that is,
153 # we're not cross-compiling it), since we run ld-new as part of these
154 # tests. We use the gcc-specific flag '-B' to use our linker instead
155 # of the default linker, which is why we only run our tests under gcc.
156
157 if NATIVE_LINKER
158 if GCC
159
160 # Each of these .o's is a useful, small complete program. They're
161 # particularly useful for making sure ld-new's flags do what they're
162 # supposed to (hence their names), but are used for many tests that
163 # don't actually involve analyzing input data.
164 flagstest_debug.o: constructor_test.cc
165 $(CXXCOMPILE) -O0 -g -c -o $@ $<
166 flagstest_ndebug.o: constructor_test.cc
167 $(CXXCOMPILE) -O0 -c -o $@ $<
168
169 check_SCRIPTS += incremental_test.sh
170 check_DATA += incremental_test.stdout
171 MOSTLYCLEANFILES += incremental_test incremental_test.cmdline
172 incremental_test_1.o: incremental_test_1.c
173 $(COMPILE) -O0 -c -ffunction-sections -g -o $@ $<
174 incremental_test_2.o: incremental_test_2.c
175 $(COMPILE) -O0 -c -ffunction-sections -g -o $@ $<
176 incremental_test: incremental_test_1.o incremental_test_2.o gcctestdir/ld
177 $(LINK) -Bgcctestdir/ -Wl,--incremental-full -Wl,-z,norelro incremental_test_1.o incremental_test_2.o -Wl,-debug 2> incremental_test.cmdline
178 incremental_test.stdout: incremental_test ../incremental-dump
179 ../incremental-dump incremental_test > $@
180
181 check_SCRIPTS += gc_comdat_test.sh
182 check_DATA += gc_comdat_test.stdout
183 MOSTLYCLEANFILES += gc_comdat_test
184 gc_comdat_test_1.o: gc_comdat_test_1.cc
185 $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
186 gc_comdat_test_2.o: gc_comdat_test_2.cc
187 $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
188 gc_comdat_test: gc_comdat_test_1.o gc_comdat_test_2.o gcctestdir/ld
189 $(CXXLINK) -Bgcctestdir/ -Wl,--gc-sections gc_comdat_test_1.o gc_comdat_test_2.o
190 gc_comdat_test.stdout: gc_comdat_test
191 $(TEST_NM) -C gc_comdat_test > gc_comdat_test.stdout
192
193 check_SCRIPTS += gc_tls_test.sh
194 check_DATA += gc_tls_test.stdout
195 MOSTLYCLEANFILES += gc_tls_test
196 gc_tls_test.o: gc_tls_test.cc
197 $(CXXCOMPILE) -O0 -c -g -o $@ $<
198 gc_tls_test:gc_tls_test.o gcctestdir/ld
199 $(CXXLINK) -Bgcctestdir/ -Wl,--gc-sections gc_tls_test.o
200 gc_tls_test.stdout: gc_tls_test
201 $(TEST_NM) -C gc_tls_test > gc_tls_test.stdout
202
203 check_SCRIPTS += gc_orphan_section_test.sh
204 check_DATA += gc_orphan_section_test.stdout
205 MOSTLYCLEANFILES += gc_orphan_section_test
206 gc_orphan_section_test.o: gc_orphan_section_test.cc
207 $(CXXCOMPILE) -O0 -c -g -o $@ $<
208 gc_orphan_section_test:gc_orphan_section_test.o gcctestdir/ld
209 $(CXXLINK) -Bgcctestdir/ -Wl,--gc-sections gc_orphan_section_test.o
210 gc_orphan_section_test.stdout: gc_orphan_section_test
211 $(TEST_NM) gc_orphan_section_test > gc_orphan_section_test.stdout
212
213 check_SCRIPTS += pr14265.sh
214 check_DATA += pr14265.stdout
215 MOSTLYCLEANFILES += pr14265
216 pr14265.o: pr14265.c
217 $(COMPILE) -O0 -c -o $@ $<
218 pr14265: pr14265.o
219 $(LINK) -Bgcctestdir/ -Wl,--gc-sections -Wl,-T,$(srcdir)/pr14265.t -o $@ $<
220 pr14265.stdout: pr14265
221 $(TEST_NM) --format=bsd --numeric-sort $< > $@
222
223 check_SCRIPTS += gc_dynamic_list_test.sh
224 check_DATA += gc_dynamic_list_test.stdout
225 MOSTLYCLEANFILES += gc_dynamic_list_test
226 gc_dynamic_list_test.o: gc_dynamic_list_test.c
227 $(COMPILE) -c -ffunction-sections -o $@ $<
228 gc_dynamic_list_test: gc_dynamic_list_test.o gcctestdir/ld $(srcdir)/gc_dynamic_list_test.t
229 $(LINK) -Bgcctestdir/ -Wl,--gc-sections -Wl,--dynamic-list,$(srcdir)/gc_dynamic_list_test.t gc_dynamic_list_test.o
230 gc_dynamic_list_test.stdout: gc_dynamic_list_test
231 $(TEST_NM) gc_dynamic_list_test > $@
232
233 check_SCRIPTS += icf_test.sh
234 check_DATA += icf_test.map
235 MOSTLYCLEANFILES += icf_test icf_test.map
236 icf_test.o: icf_test.cc
237 $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
238 icf_test: icf_test.o gcctestdir/ld
239 $(CXXLINK) -o icf_test -Bgcctestdir/ -Wl,--icf=all,-Map,icf_test.map icf_test.o
240 icf_test.map: icf_test
241 @touch icf_test.map
242
243 check_SCRIPTS += icf_keep_unique_test.sh
244 check_DATA += icf_keep_unique_test.stdout
245 MOSTLYCLEANFILES += icf_keep_unique_test
246 icf_keep_unique_test.o: icf_keep_unique_test.cc
247 $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
248 icf_keep_unique_test: icf_keep_unique_test.o gcctestdir/ld
249 $(CXXLINK) -Bgcctestdir/ -Wl,--icf=all -Wl,--keep-unique,_Z11unique_funcv icf_keep_unique_test.o
250 icf_keep_unique_test.stdout: icf_keep_unique_test
251 $(TEST_NM) -C $< > $@
252
253 check_SCRIPTS += icf_safe_test.sh
254 check_DATA += icf_safe_test_1.stdout icf_safe_test_2.stdout icf_safe_test.map
255 MOSTLYCLEANFILES += icf_safe_test icf_safe_test.map
256 icf_safe_test.o: icf_safe_test.cc
257 $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
258 icf_safe_test: icf_safe_test.o gcctestdir/ld
259 $(CXXLINK) -o icf_safe_test -Bgcctestdir/ -Wl,--icf=safe,-Map,icf_safe_test.map icf_safe_test.o
260 icf_safe_test.map: icf_safe_test
261 @touch icf_safe_test.map
262 icf_safe_test_1.stdout: icf_safe_test
263 $(TEST_NM) $< > $@
264 icf_safe_test_2.stdout: icf_safe_test
265 $(TEST_READELF) -h $< > $@
266
267 check_SCRIPTS += icf_safe_so_test.sh
268 check_DATA += icf_safe_so_test_1.stdout icf_safe_so_test_2.stdout icf_safe_so_test.map
269 MOSTLYCLEANFILES += icf_safe_so_test icf_safe_so_test.map
270 icf_safe_so_test.o: icf_safe_so_test.cc
271 $(CXXCOMPILE) -O0 -c -ffunction-sections -fPIC -g -o $@ $<
272 icf_safe_so_test: icf_safe_so_test.o gcctestdir/ld
273 $(CXXLINK) -o icf_safe_so_test -Bgcctestdir/ -Wl,--icf=safe,-Map,icf_safe_so_test.map icf_safe_so_test.o -fPIC -shared
274 icf_safe_so_test.map:
275 @touch icf_safe_so_test.map
276 icf_safe_so_test_1.stdout: icf_safe_so_test
277 $(TEST_NM) $< > $@
278 icf_safe_so_test_2.stdout: icf_safe_so_test
279 $(TEST_READELF) -h $< > $@
280
281 check_SCRIPTS += final_layout.sh
282 check_DATA += final_layout.stdout
283 MOSTLYCLEANFILES += final_layout final_layout_sequence.txt final_layout_script.lds
284 final_layout.o: final_layout.cc
285 $(CXXCOMPILE) -O0 -c -ffunction-sections -fdata-sections -g -o $@ $<
286 final_layout_sequence.txt:
287 (echo "*_Z3barv*" && echo ".text._Z3bazv" && echo "*_Z3foov*" && echo "*global_varb*" && echo "*global_vara*" && echo "*global_varc*") > final_layout_sequence.txt
288 final_layout_script.lds:
289 (echo "SECTIONS { .text : { *(.text*) } .got : { *(.got .toc) } .sbss : { *(.sbss*) } .bss : { *(.bss*) } }") > final_layout_script.lds
290 final_layout: final_layout.o final_layout_sequence.txt final_layout_script.lds gcctestdir/ld
291 $(CXXLINK) -Bgcctestdir/ -Wl,--section-ordering-file,final_layout_sequence.txt -Wl,-T,final_layout_script.lds final_layout.o
292 final_layout.stdout: final_layout
293 $(TEST_NM) -n --synthetic final_layout > final_layout.stdout
294
295 check_SCRIPTS += text_section_grouping.sh
296 check_DATA += text_section_grouping.stdout text_section_no_grouping.stdout
297 MOSTLYCLEANFILES += text_section_grouping text_section_no_grouping
298 text_section_grouping.o: text_section_grouping.cc
299 $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
300 text_section_grouping: text_section_grouping.o gcctestdir/ld
301 $(CXXLINK) -Bgcctestdir/ text_section_grouping.o
302 text_section_no_grouping: text_section_grouping.o gcctestdir/ld
303 $(CXXLINK) -Bgcctestdir/ -Wl,--no-text-reorder text_section_grouping.o
304 text_section_grouping.stdout: text_section_grouping
305 $(TEST_NM) -n --synthetic text_section_grouping > text_section_grouping.stdout
306 text_section_no_grouping.stdout: text_section_no_grouping
307 $(TEST_NM) -n --synthetic text_section_no_grouping > text_section_no_grouping.stdout
308
309 check_SCRIPTS += section_sorting_name.sh
310 check_DATA += section_sorting_name.stdout
311 MOSTLYCLEANFILES += section_sorting_name
312 section_sorting_name.o: section_sorting_name.cc
313 $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
314 section_sorting_name: section_sorting_name.o gcctestdir/ld
315 $(CXXLINK) -Bgcctestdir/ -Wl,--sort-section=name section_sorting_name.o
316 section_sorting_name.stdout: section_sorting_name
317 $(TEST_NM) -n --synthetic section_sorting_name > section_sorting_name.stdout
318
319 check_PROGRAMS += icf_virtual_function_folding_test
320 MOSTLYCLEANFILES += icf_virtual_function_folding_test icf_virtual_function_folding_test.map
321 icf_virtual_function_folding_test.o: icf_virtual_function_folding_test.cc
322 $(CXXCOMPILE) -O0 -c -ffunction-sections -fPIE -g -o $@ $<
323 icf_virtual_function_folding_test: icf_virtual_function_folding_test.o gcctestdir/ld
324 $(CXXLINK) -Bgcctestdir/ -Wl,--icf=all icf_virtual_function_folding_test.o -pie
325
326 check_SCRIPTS += icf_preemptible_functions_test.sh
327 check_DATA += icf_preemptible_functions_test.stdout
328 MOSTLYCLEANFILES += icf_preemptible_functions_test
329 icf_preemptible_functions_test.o: icf_preemptible_functions_test.cc
330 $(CXXCOMPILE) -O0 -c -ffunction-sections -fPIC -g -o $@ $<
331 icf_preemptible_functions_test: icf_preemptible_functions_test.o gcctestdir/ld
332 $(CXXLINK) -Bgcctestdir/ -Wl,--icf=all icf_preemptible_functions_test.o -fPIC -shared
333 icf_preemptible_functions_test.stdout: icf_preemptible_functions_test
334 $(TEST_NM) icf_preemptible_functions_test > icf_preemptible_functions_test.stdout
335
336 check_SCRIPTS += icf_string_merge_test.sh
337 check_DATA += icf_string_merge_test.stdout
338 MOSTLYCLEANFILES += icf_string_merge_test
339 icf_string_merge_test.o: icf_string_merge_test.cc
340 $(CXXCOMPILE) -O0 -c -ffunction-sections -fPIC -g -o $@ $<
341 icf_string_merge_test: icf_string_merge_test.o gcctestdir/ld
342 $(CXXLINK) -Bgcctestdir/ -Wl,--icf=all icf_string_merge_test.o
343 icf_string_merge_test.stdout: icf_string_merge_test
344 $(TEST_NM) icf_string_merge_test > icf_string_merge_test.stdout
345
346 check_SCRIPTS += icf_sht_rel_addend_test.sh
347 check_DATA += icf_sht_rel_addend_test.stdout
348 MOSTLYCLEANFILES += icf_sht_rel_addend_test
349 icf_sht_rel_addend_test_1.o: icf_sht_rel_addend_test_1.cc
350 $(CXXCOMPILE) -O0 -c -ffunction-sections -fPIC -g -o $@ $<
351 icf_sht_rel_addend_test_2.o: icf_sht_rel_addend_test_2.cc
352 $(CXXCOMPILE) -O0 -c -ffunction-sections -fPIC -g -o $@ $<
353 icf_sht_rel_addend_test: icf_sht_rel_addend_test_1.o icf_sht_rel_addend_test_2.o gcctestdir/ld
354 $(CXXLINK) -Bgcctestdir/ -Wl,--icf=all icf_sht_rel_addend_test_1.o icf_sht_rel_addend_test_2.o
355 icf_sht_rel_addend_test.stdout: icf_sht_rel_addend_test
356 $(TEST_NM) icf_sht_rel_addend_test > icf_sht_rel_addend_test.stdout
357
358 check_PROGRAMS += large_symbol_alignment
359 large_symbol_alignment_SOURCES = large_symbol_alignment.cc
360 large_symbol_alignment_DEPENDENCIES = gcctestdir/ld
361 large_symbol_alignment_LDFLAGS = -Bgcctestdir/
362 large_symbol_alignment_LDADD =
363
364 check_SCRIPTS += merge_string_literals.sh
365 check_DATA += merge_string_literals.stdout
366 MOSTLYCLEANFILES += merge_string_literals
367 merge_string_literals_1.o: merge_string_literals_1.cc
368 $(CXXCOMPILE) -O2 -c -fPIC -g -o $@ $<
369 merge_string_literals_2.o: merge_string_literals_2.cc
370 $(CXXCOMPILE) -O2 -c -fPIC -g -o $@ $<
371 merge_string_literals: merge_string_literals_1.o merge_string_literals_2.o gcctestdir/ld
372 $(CXXLINK) -Bgcctestdir/ merge_string_literals_1.o merge_string_literals_2.o -O2 -shared -nostdlib
373 merge_string_literals.stdout: merge_string_literals
374 $(TEST_OBJDUMP) -s -j.rodata merge_string_literals > merge_string_literals.stdout
375
376 check_PROGRAMS += basic_test
377 check_PROGRAMS += basic_pic_test
378 basic_test.o: basic_test.cc
379 $(CXXCOMPILE) -O0 -c -o $@ $<
380 basic_test: basic_test.o gcctestdir/ld
381 $(CXXLINK) -Bgcctestdir/ basic_test.o
382
383 check_PROGRAMS += eh_test
384 eh_test_a.o: eh_test_a.cc
385 $(CXXCOMPILE) -O0 -c -o $@ $<
386 eh_test_b.o: eh_test_b.cc
387 $(CXXCOMPILE) -O0 -c -o $@ $<
388 eh_test: eh_test_a.o eh_test_b.o gcctestdir/ld
389 $(CXXLINK_S) -Bgcctestdir/ eh_test_a.o eh_test_b.o
390
391 check_SCRIPTS += eh_test_2.sh
392 check_DATA += eh_test_2.sects
393 MOSTLYCLEANFILES += eh_test_2.sects
394 eh_test_r.o: eh_test_a.o eh_test_b.o gcctestdir/ld
395 gcctestdir/ld -r -o $@ eh_test_a.o eh_test_b.o
396 eh_test_2: eh_test_r.o gcctestdir/ld
397 $(CXXLINK_S) -Bgcctestdir/ -Wl,--eh-frame-hdr eh_test_r.o
398 eh_test_2.sects: eh_test_2
399 $(TEST_READELF) -SW $< >$@ 2>/dev/null
400
401 if HAVE_STATIC
402 check_PROGRAMS += basic_static_test
403 basic_static_test: basic_test.o gcctestdir/ld
404 $(CXXLINK) -Bgcctestdir/ -static basic_test.o
405 endif
406
407 basic_pic_test.o: basic_test.cc
408 $(CXXCOMPILE) -O0 -c -fpic -o $@ $<
409 basic_pic_test: basic_pic_test.o gcctestdir/ld
410 $(CXXLINK) -Bgcctestdir/ basic_pic_test.o
411
412 if HAVE_STATIC
413 check_PROGRAMS += basic_static_pic_test
414 basic_static_pic_test: basic_pic_test.o gcctestdir/ld
415 $(CXXLINK) -Bgcctestdir/ -static basic_pic_test.o
416 endif
417
418 check_PROGRAMS += basic_pie_test
419 basic_pie_test.o: basic_test.cc
420 $(CXXCOMPILE) -O0 -c -fpie -o $@ $<
421 basic_pie_test: basic_pie_test.o gcctestdir/ld
422 $(CXXLINK) -Bgcctestdir/ -pie basic_pie_test.o
423
424 check_PROGRAMS += constructor_test
425 constructor_test_SOURCES = constructor_test.cc
426 constructor_test_DEPENDENCIES = gcctestdir/ld
427 constructor_test_LDFLAGS = -Bgcctestdir/
428 constructor_test_LDADD =
429
430 if HAVE_STATIC
431 check_PROGRAMS += constructor_static_test
432 constructor_static_test_SOURCES = $(constructor_test_SOURCES)
433 constructor_static_test_DEPENDENCIES = $(constructor_test_DEPENDENCIES)
434 constructor_static_test_LDFLAGS = $(constructor_test_LDFLAGS) -static
435 constructor_static_test_LDADD = $(constructor_test_LDADD)
436 endif
437
438 check_PROGRAMS += two_file_test
439 check_PROGRAMS += two_file_pic_test
440 two_file_test_SOURCES = \
441 two_file_test_1.cc \
442 two_file_test_1b.cc \
443 two_file_test_2.cc \
444 two_file_test_main.cc \
445 two_file_test.h
446 two_file_test_DEPENDENCIES = gcctestdir/ld
447 two_file_test_LDFLAGS = -Bgcctestdir/
448 two_file_test_LDADD =
449
450 if HAVE_STATIC
451 check_PROGRAMS += two_file_static_test
452 two_file_static_test_SOURCES = $(two_file_test_SOURCES)
453 two_file_static_test_DEPENDENCIES = $(two_file_test_DEPENDENCIES)
454 two_file_static_test_LDFLAGS = $(two_file_test_LDFLAGS) -static
455 two_file_static_test_LDADD = $(two_file_test_LDADD)
456 endif
457
458 two_file_pic_test_SOURCES = two_file_test_main.cc
459 two_file_pic_test_DEPENDENCIES = \
460 gcctestdir/ld two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o
461 two_file_pic_test_LDFLAGS = -Bgcctestdir/
462 two_file_pic_test_LDADD = two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o
463
464
465 check_PROGRAMS += two_file_shared_1_test
466 check_PROGRAMS += two_file_shared_2_test
467 check_PROGRAMS += two_file_shared_1_pic_2_test
468 check_PROGRAMS += two_file_shared_2_pic_1_test
469 check_PROGRAMS += two_file_same_shared_test
470 check_PROGRAMS += two_file_separate_shared_12_test
471 check_PROGRAMS += two_file_separate_shared_21_test
472 two_file_test_1_pic.o: two_file_test_1.cc
473 $(CXXCOMPILE) -c -fpic -o $@ $<
474 two_file_test_1b_pic.o: two_file_test_1b.cc
475 $(CXXCOMPILE) -c -fpic -o $@ $<
476 two_file_test_2_pic.o: two_file_test_2.cc
477 $(CXXCOMPILE) -c -fpic -o $@ $<
478 two_file_shared_1.so: two_file_test_1_pic.o two_file_test_1b_pic.o gcctestdir/ld
479 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1_pic.o two_file_test_1b_pic.o
480 two_file_shared_2.so: two_file_test_2_pic.o gcctestdir/ld
481 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_2_pic.o
482 two_file_shared.so: two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o gcctestdir/ld
483 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o
484
485 two_file_shared_1_test_SOURCES = two_file_test_2.cc two_file_test_main.cc
486 two_file_shared_1_test_DEPENDENCIES = gcctestdir/ld two_file_shared_1.so
487 two_file_shared_1_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
488 two_file_shared_1_test_LDADD = two_file_shared_1.so
489
490 two_file_shared_2_test_SOURCES = two_file_test_1.cc two_file_test_1b.cc two_file_test_main.cc
491 two_file_shared_2_test_DEPENDENCIES = gcctestdir/ld two_file_shared_2.so
492 two_file_shared_2_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
493 two_file_shared_2_test_LDADD = two_file_shared_2.so
494
495 two_file_shared_1_pic_2_test_SOURCES = two_file_test_main.cc
496 two_file_shared_1_pic_2_test_DEPENDENCIES = \
497 gcctestdir/ld two_file_shared_2.so two_file_test_1_pic.o two_file_test_1b_pic.o
498 two_file_shared_1_pic_2_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
499 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
500
501 two_file_shared_2_pic_1_test_SOURCES = two_file_test_main.cc
502 two_file_shared_2_pic_1_test_DEPENDENCIES = \
503 gcctestdir/ld two_file_shared_1.so two_file_test_2_pic.o
504 two_file_shared_2_pic_1_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
505 two_file_shared_2_pic_1_test_LDADD = two_file_test_2_pic.o two_file_shared_1.so
506
507 two_file_same_shared_test_SOURCES = two_file_test_main.cc
508 two_file_same_shared_test_DEPENDENCIES = gcctestdir/ld two_file_shared.so
509 two_file_same_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
510 two_file_same_shared_test_LDADD = two_file_shared.so
511
512 two_file_separate_shared_12_test_SOURCES = two_file_test_main.cc
513 two_file_separate_shared_12_test_DEPENDENCIES = \
514 gcctestdir/ld two_file_shared_1.so two_file_shared_2.so
515 two_file_separate_shared_12_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
516 two_file_separate_shared_12_test_LDADD = \
517 two_file_shared_1.so two_file_shared_2.so
518
519 two_file_separate_shared_21_test_SOURCES = two_file_test_main.cc
520 two_file_separate_shared_21_test_DEPENDENCIES = \
521 gcctestdir/ld two_file_shared_1.so two_file_shared_2.so
522 two_file_separate_shared_21_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
523 two_file_separate_shared_21_test_LDADD = \
524 two_file_shared_2.so two_file_shared_1.so
525
526 check_PROGRAMS += two_file_relocatable_test
527 two_file_relocatable_test_SOURCES = two_file_test_main.cc
528 two_file_relocatable_test_DEPENDENCIES = \
529 gcctestdir/ld two_file_relocatable.o
530 two_file_relocatable_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
531 two_file_relocatable_test_LDADD = two_file_relocatable.o
532 two_file_relocatable.o: gcctestdir/ld two_file_test_1.o two_file_test_1b.o two_file_test_2.o
533 gcctestdir/ld -r -o $@ two_file_test_1.o two_file_test_1b.o two_file_test_2.o
534
535 check_PROGRAMS += two_file_pie_test
536 two_file_test_1_pie.o: two_file_test_1.cc
537 $(CXXCOMPILE) -c -fpie -o $@ $<
538 two_file_test_1b_pie.o: two_file_test_1b.cc
539 $(CXXCOMPILE) -c -fpie -o $@ $<
540 two_file_test_2_pie.o: two_file_test_2.cc
541 $(CXXCOMPILE) -c -fpie -o $@ $<
542 two_file_test_main_pie.o: two_file_test_main.cc
543 $(CXXCOMPILE) -c -fpie -o $@ $<
544 two_file_pie_test: two_file_test_1_pie.o two_file_test_1b_pie.o \
545 two_file_test_2_pie.o two_file_test_main_pie.o gcctestdir/ld
546 $(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
547
548 check_PROGRAMS += pie_copyrelocs_test
549 pie_copyrelocs_test_SOURCES = pie_copyrelocs_test.cc
550 pie_copyrelocs_test_DEPENDENCIES = gcctestdir/ld pie_copyrelocs_shared_test.so
551 pie_copyrelocs_test_CXXFLAGS = -fno-exceptions -fno-asynchronous-unwind-tables
552 pie_copyrelocs_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. -pie
553 pie_copyrelocs_test_LDADD = pie_copyrelocs_shared_test.so
554 pie_copyrelocs_shared_test.o: pie_copyrelocs_shared_test.cc
555 $(CXXCOMPILE) -O2 -fpic -c -o $@ $<
556 pie_copyrelocs_shared_test.so: pie_copyrelocs_shared_test.o gcctestdir/ld
557 $(CXXLINK) -Bgcctestdir/ -shared pie_copyrelocs_shared_test.o
558
559 check_PROGRAMS += weak_unresolved_symbols_test
560 weak_unresolved_symbols_test_SOURCES = weak_unresolved_symbols_test.cc
561 weak_unresolved_symbols_test_CXXFLAGS = -fPIE
562 weak_unresolved_symbols_test_LDFLAGS = -Bgcctestdir/ -pie -Wl,--weak-unresolved-symbols
563
564 check_SCRIPTS += two_file_shared.sh
565 check_DATA += two_file_shared.dbg
566 MOSTLYCLEANFILES += two_file_shared.dbg
567 two_file_shared.dbg: two_file_shared.so
568 $(TEST_READELF) -w $< >$@ 2>/dev/null
569
570 # The nonpic tests will fail on platforms which can not put non-PIC
571 # code into shared libraries, so we just don't run them in that case.
572 if FN_PTRS_IN_SO_WITHOUT_PIC
573
574 check_PROGRAMS += two_file_shared_1_nonpic_test
575 check_PROGRAMS += two_file_shared_2_nonpic_test
576 check_PROGRAMS += two_file_same_shared_nonpic_test
577 check_PROGRAMS += two_file_separate_shared_12_nonpic_test
578 check_PROGRAMS += two_file_separate_shared_21_nonpic_test
579 check_PROGRAMS += two_file_mixed_shared_test
580 check_PROGRAMS += two_file_mixed_2_shared_test
581 two_file_shared_1_nonpic.so: two_file_test_1.o gcctestdir/ld
582 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1.o two_file_test_1b.o -Wl,-z,notext
583 two_file_shared_2_nonpic.so: two_file_test_2.o gcctestdir/ld
584 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_2.o
585 two_file_shared_nonpic.so: two_file_test_1.o two_file_test_1b.o two_file_test_2.o gcctestdir/ld
586 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1.o two_file_test_1b.o two_file_test_2.o -Wl,-z,notext
587 two_file_shared_mixed.so: two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2.o gcctestdir/ld
588 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2.o -Wl,-z,notext
589 two_file_shared_mixed_1.so: two_file_test_1.o two_file_test_1b_pic.o two_file_shared_2.so gcctestdir/ld
590 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1.o two_file_test_1b_pic.o two_file_shared_2.so -Wl,-z,notext
591
592 two_file_shared_1_nonpic_test_SOURCES = \
593 two_file_test_2.cc two_file_test_main.cc
594 two_file_shared_1_nonpic_test_DEPENDENCIES = \
595 gcctestdir/ld two_file_shared_1_nonpic.so
596 two_file_shared_1_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
597 two_file_shared_1_nonpic_test_LDADD = two_file_shared_1_nonpic.so
598
599 two_file_shared_2_nonpic_test_SOURCES = \
600 two_file_test_1.cc two_file_test_1b.cc two_file_test_main.cc
601 two_file_shared_2_nonpic_test_DEPENDENCIES = \
602 gcctestdir/ld two_file_shared_2_nonpic.so
603 two_file_shared_2_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
604 two_file_shared_2_nonpic_test_LDADD = two_file_shared_2_nonpic.so
605
606 two_file_same_shared_nonpic_test_SOURCES = two_file_test_main.cc
607 two_file_same_shared_nonpic_test_DEPENDENCIES = \
608 gcctestdir/ld two_file_shared_nonpic.so
609 two_file_same_shared_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
610 two_file_same_shared_nonpic_test_LDADD = two_file_shared_nonpic.so
611
612 two_file_separate_shared_12_nonpic_test_SOURCES = two_file_test_main.cc
613 two_file_separate_shared_12_nonpic_test_DEPENDENCIES = \
614 gcctestdir/ld two_file_shared_1_nonpic.so two_file_shared_2_nonpic.so
615 two_file_separate_shared_12_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
616 two_file_separate_shared_12_nonpic_test_LDADD = \
617 two_file_shared_1_nonpic.so two_file_shared_2_nonpic.so
618
619 two_file_separate_shared_21_nonpic_test_SOURCES = two_file_test_main.cc
620 two_file_separate_shared_21_nonpic_test_DEPENDENCIES = \
621 gcctestdir/ld two_file_shared_1_nonpic.so two_file_shared_2_nonpic.so
622 two_file_separate_shared_21_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
623 two_file_separate_shared_21_nonpic_test_LDADD = \
624 two_file_shared_2_nonpic.so two_file_shared_1_nonpic.so
625
626 two_file_mixed_shared_test_SOURCES = two_file_test_main.cc
627 two_file_mixed_shared_test_DEPENDENCIES = gcctestdir/ld two_file_shared_mixed.so
628 two_file_mixed_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
629 two_file_mixed_shared_test_LDADD = two_file_shared_mixed.so
630
631 two_file_mixed_2_shared_test_SOURCES = two_file_test_main.cc
632 two_file_mixed_2_shared_test_DEPENDENCIES = gcctestdir/ld two_file_shared_mixed_1.so two_file_shared_2.so
633 two_file_mixed_2_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
634 two_file_mixed_2_shared_test_LDADD = two_file_shared_mixed_1.so two_file_shared_2.so
635
636 check_PROGRAMS += two_file_mixed_pie_test
637 two_file_mixed_pie_test: two_file_test_1.o two_file_test_1b_pie.o \
638 two_file_test_main_pie.o two_file_shared_2.so gcctestdir/ld
639 $(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
640
641 endif FN_PTRS_IN_SO_WITHOUT_PIC
642
643 check_PROGRAMS += two_file_strip_test
644 two_file_strip_test: two_file_test
645 $(TEST_STRIP) -o two_file_strip_test two_file_test
646
647 check_PROGRAMS += two_file_same_shared_strip_test
648 two_file_same_shared_strip_test_SOURCES = two_file_test_main.cc
649 two_file_same_shared_strip_test_DEPENDENCIES = \
650 gcctestdir/ld two_file_shared_strip.so
651 two_file_same_shared_strip_test_LDFLAGS = -Bgcctestdir/ -Wl,-R.
652 two_file_same_shared_strip_test_LDADD = two_file_shared_strip.so
653 two_file_shared_strip.so: two_file_shared.so
654 $(TEST_STRIP) -S -o two_file_shared_strip.so two_file_shared.so
655
656 check_PROGRAMS += common_test_1
657 common_test_1_SOURCES = common_test_1.c
658 common_test_1_DEPENDENCIES = gcctestdir/ld
659 common_test_1_LDFLAGS = -Bgcctestdir/
660 common_test_1_LDADD =
661
662 check_PROGRAMS += common_test_2
663 common_test_2_SOURCES = common_test_1.c
664 common_test_2_DEPENDENCIES = common_test_2.so common_test_3.so gcctestdir/ld
665 common_test_2_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
666 common_test_2_LDADD = common_test_2.so common_test_3.so
667 common_test_2_pic.o: common_test_2.c
668 $(COMPILE) -c -fpic -o $@ $<
669 common_test_2.so: common_test_2_pic.o common_test_3.so gcctestdir/ld
670 $(LINK) -Bgcctestdir/ -shared common_test_2_pic.o common_test_3.so
671 common_test_3_pic.o: common_test_3.c
672 $(COMPILE) -c -fpic -o $@ $<
673 common_test_3.so: common_test_3_pic.o ver_test_2.script gcctestdir/ld
674 $(LINK) -Bgcctestdir/ -shared common_test_3_pic.o -Wl,--version-script,$(srcdir)/ver_test_2.script
675
676 check_PROGRAMS += exception_test
677 check_PROGRAMS += exception_shared_1_test
678 check_PROGRAMS += exception_shared_2_test
679 check_PROGRAMS += exception_same_shared_test
680 check_PROGRAMS += exception_separate_shared_12_test
681 check_PROGRAMS += exception_separate_shared_21_test
682 exception_test_1_pic.o: exception_test_1.cc
683 $(CXXCOMPILE) -c -fpic -o $@ $<
684 exception_test_2_pic.o: exception_test_2.cc
685 $(CXXCOMPILE) -c -fpic -o $@ $<
686 exception_shared_1.so: exception_test_1_pic.o gcctestdir/ld
687 $(CXXLINK) -Bgcctestdir/ -shared exception_test_1_pic.o
688 exception_shared_2.so: exception_test_2_pic.o gcctestdir/ld
689 $(CXXLINK) -Bgcctestdir/ -shared exception_test_2_pic.o
690 exception_shared.so: exception_test_1_pic.o exception_test_2_pic.o gcctestdir/ld
691 $(CXXLINK) -Bgcctestdir/ -shared exception_test_1_pic.o exception_test_2_pic.o
692
693 exception_test_SOURCES = \
694 exception_test_main.cc \
695 exception_test_1.cc \
696 exception_test_2.cc \
697 exception_test.h
698 exception_test_DEPENDENCIES = gcctestdir/ld
699 exception_test_LDFLAGS = -Bgcctestdir/
700 exception_test_LDADD =
701
702 if HAVE_STATIC
703 check_PROGRAMS += exception_static_test
704 exception_static_test_SOURCES = $(exception_test_SOURCES)
705 exception_static_test_DEPENDENCIES = $(exception_test_DEPENDENCIES)
706 exception_static_test_LDFLAGS = $(exception_test_LDFLAGS) -static
707 exception_static_test_LDADD = $(exception_test_LDADD)
708 endif
709
710 exception_shared_1_test_SOURCES = exception_test_2.cc exception_test_main.cc
711 exception_shared_1_test_DEPENDENCIES = gcctestdir/ld exception_shared_1.so
712 exception_shared_1_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
713 exception_shared_1_test_LDADD = exception_shared_1.so
714
715 exception_shared_2_test_SOURCES = exception_test_1.cc exception_test_main.cc
716 exception_shared_2_test_DEPENDENCIES = gcctestdir/ld exception_shared_2.so
717 exception_shared_2_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
718 exception_shared_2_test_LDADD = exception_shared_2.so
719
720 exception_same_shared_test_SOURCES = exception_test_main.cc
721 exception_same_shared_test_DEPENDENCIES = gcctestdir/ld exception_shared.so
722 exception_same_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
723 exception_same_shared_test_LDADD = exception_shared.so
724
725 exception_separate_shared_12_test_SOURCES = exception_test_main.cc
726 exception_separate_shared_12_test_DEPENDENCIES = \
727 gcctestdir/ld exception_shared_1.so exception_shared_2.so
728 exception_separate_shared_12_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. \
729 -Wl,--no-as-needed
730 exception_separate_shared_12_test_LDADD = \
731 exception_shared_1.so exception_shared_2.so
732
733 exception_separate_shared_21_test_SOURCES = exception_test_main.cc
734 exception_separate_shared_21_test_DEPENDENCIES = \
735 gcctestdir/ld exception_shared_1.so exception_shared_2.so
736 exception_separate_shared_21_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. \
737 -Wl,--no-as-needed
738 exception_separate_shared_21_test_LDADD = \
739 exception_shared_2.so exception_shared_1.so
740
741
742 check_PROGRAMS += weak_test
743 weak_test_SOURCES = weak_test.cc
744 weak_test_DEPENDENCIES = gcctestdir/ld
745 weak_test_LDFLAGS = -Bgcctestdir/
746 weak_test_LDADD =
747
748 check_PROGRAMS += weak_undef_test
749 MOSTLYCLEANFILES += alt/weak_undef_lib.so
750 weak_undef_test_SOURCES = weak_undef_test.cc
751 weak_undef_test_DEPENDENCIES = gcctestdir/ld weak_undef_lib.so alt/weak_undef_lib.so
752 weak_undef_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,alt
753 weak_undef_test_LDADD = -L . weak_undef_lib.so
754 weak_undef_file1.o: weak_undef_file1.cc
755 $(CXXCOMPILE) -c -fpic -o $@ $<
756 weak_undef_file2.o: weak_undef_file2.cc
757 $(CXXCOMPILE) -c -fpic -o $@ $<
758 weak_undef_lib.so: weak_undef_file1.o
759 $(CXXLINK) -Bgcctestdir/ -shared weak_undef_file1.o
760 alt/weak_undef_lib.so: weak_undef_file2.o
761 test -d alt || mkdir -p alt
762 $(CXXLINK) -Bgcctestdir/ -shared weak_undef_file2.o
763
764 check_PROGRAMS += weak_undef_test_2
765 weak_undef_test_2_SOURCES = weak_undef_test_2.cc
766 weak_undef_test_2_DEPENDENCIES = gcctestdir/ld libweak_undef_2.a
767 weak_undef_test_2_LDFLAGS = -Bgcctestdir/ -u weak_undef_2
768 weak_undef_test_2_LDADD = -L . -lweak_undef_2
769 MOSTLYCLEANFILES += libweak_undef_2.a
770 libweak_undef_2.a: weak_undef_file3.o weak_undef_file4.o
771 $(TEST_AR) rc $@ $^
772 weak_undef_file3.o: weak_undef_file3.cc
773 $(CXXCOMPILE) -c -o $@ $<
774 weak_undef_file4.o: weak_undef_file4.cc
775 $(CXXCOMPILE) -c -o $@ $<
776
777 if FN_PTRS_IN_SO_WITHOUT_PIC
778 check_PROGRAMS += weak_undef_nonpic_test
779 MOSTLYCLEANFILES += alt/weak_undef_lib_nonpic.so
780 weak_undef_nonpic_test_SOURCES = weak_undef_test.cc
781 weak_undef_nonpic_test_DEPENDENCIES = gcctestdir/ld weak_undef_lib_nonpic.so alt/weak_undef_lib_nonpic.so
782 weak_undef_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,alt
783 weak_undef_nonpic_test_LDADD = -L . weak_undef_lib_nonpic.so
784 weak_undef_file1_nonpic.o: weak_undef_file1.cc
785 $(CXXCOMPILE) -c -o $@ $<
786 weak_undef_file2_nonpic.o: weak_undef_file2.cc
787 $(CXXCOMPILE) -c -o $@ $<
788 weak_undef_lib_nonpic.so: weak_undef_file1_nonpic.o
789 $(CXXLINK) -Bgcctestdir/ -shared weak_undef_file1_nonpic.o -Wl,-z,notext
790 alt/weak_undef_lib_nonpic.so: weak_undef_file2_nonpic.o
791 test -d alt || mkdir -p alt
792 $(CXXLINK) -Bgcctestdir/ -shared weak_undef_file2_nonpic.o -Wl,-z,notext
793 endif FN_PTRS_IN_SO_WITHOUT_PIC
794
795
796 check_PROGRAMS += weak_alias_test
797 weak_alias_test_SOURCES = weak_alias_test_main.cc
798 weak_alias_test_DEPENDENCIES = \
799 gcctestdir/ld weak_alias_test_1.so weak_alias_test_2.so \
800 weak_alias_test_3.o weak_alias_test_4.so weak_alias_test_5.so
801 weak_alias_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
802 weak_alias_test_LDADD = \
803 weak_alias_test_1.so weak_alias_test_2.so weak_alias_test_3.o \
804 weak_alias_test_4.so weak_alias_test_5.so
805 weak_alias_test_1_pic.o: weak_alias_test_1.cc
806 $(CXXCOMPILE) -c -fpic -o $@ $<
807 weak_alias_test_1.so: weak_alias_test_1_pic.o gcctestdir/ld
808 $(CXXLINK) -Bgcctestdir/ -shared weak_alias_test_1_pic.o
809 weak_alias_test_2_pic.o: weak_alias_test_2.cc
810 $(CXXCOMPILE) -c -fpic -o $@ $<
811 weak_alias_test_2.so: weak_alias_test_2_pic.o gcctestdir/ld
812 $(CXXLINK) -Bgcctestdir/ -shared weak_alias_test_2_pic.o
813 weak_alias_test_3.o: weak_alias_test_3.cc
814 $(CXXCOMPILE) -c -o $@ $<
815 weak_alias_test_4_pic.o: weak_alias_test_4.cc
816 $(CXXCOMPILE) -c -fpic -o $@ $<
817 weak_alias_test_4.so: weak_alias_test_4_pic.o gcctestdir/ld
818 $(CXXLINK) -Bgcctestdir/ -shared weak_alias_test_4_pic.o
819 weak_alias_test_5_pic.o: weak_alias_test_5.cc
820 $(CXXCOMPILE) -c -fpic -o $@ $<
821 weak_alias_test_5.so: weak_alias_test_5_pic.o $(srcdir)/weak_alias_test.script gcctestdir/ld
822 $(CXXLINK) -Bgcctestdir/ -shared weak_alias_test_5_pic.o \
823 -Wl,--version-script,$(srcdir)/weak_alias_test.script
824
825 check_SCRIPTS += weak_plt.sh
826 check_PROGRAMS += weak_plt
827 check_DATA += weak_plt_shared.so
828 weak_plt_main_pic.o: weak_plt_main.cc
829 $(CXXCOMPILE) -c -fpic -o $@ $<
830 weak_plt: weak_plt_main_pic.o gcctestdir/ld
831 $(CXXLINK) -Bgcctestdir/ weak_plt_main_pic.o
832 weak_plt_shared_pic.o: weak_plt_shared.cc
833 $(CXXCOMPILE) -c -fpic -o $@ $<
834 weak_plt_shared.so: weak_plt_shared_pic.o gcctestdir/ld
835 $(CXXLINK) -Bgcctestdir/ -shared weak_plt_shared_pic.o
836
837 check_PROGRAMS += copy_test
838 copy_test_SOURCES = copy_test.cc
839 copy_test_DEPENDENCIES = gcctestdir/ld copy_test_1.so copy_test_2.so
840 copy_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
841 copy_test_LDADD = copy_test_1.so copy_test_2.so
842 copy_test_1_pic.o: copy_test_1.cc
843 $(CXXCOMPILE) -c -fpic -o $@ $<
844 copy_test_1.so: gcctestdir/ld copy_test_1_pic.o
845 $(CXXLINK) -Bgcctestdir/ -shared copy_test_1_pic.o
846 copy_test_2_pic.o: copy_test_2.cc
847 $(CXXCOMPILE) -c -fpic -o $@ $<
848 copy_test_2.so: gcctestdir/ld copy_test_2_pic.o
849 $(CXXLINK) -Bgcctestdir/ -shared copy_test_2_pic.o
850
851 if !DEFAULT_TARGET_POWERPC
852 check_SCRIPTS += copy_test_protected.sh
853 check_DATA += copy_test_protected.err
854 MOSTLYCLEANFILES += copy_test_protected.err
855 copy_test_protected.err: copy_test_protected.o copy_test_2.so gcctestdir/ld
856 @echo $(CXXLINK) -Bgcctestdir/ -o copy_test_protected copy_test_protected.o copy_test_2.so -Wl,-R,. "2>$@"
857 @if $(CXXLINK) -Bgcctestdir/ -o copy_test_protected copy_test_protected.o copy_test_2.so -Wl,-R,. 2>$@; \
858 then \
859 echo 1>&2 "Link of copy_test_protected should have failed"; \
860 rm -f $@; \
861 exit 1; \
862 fi
863 endif
864
865 if TLS
866
867 check_PROGRAMS += tls_test
868 check_PROGRAMS += tls_pic_test
869 check_PROGRAMS += tls_pie_test
870 check_PROGRAMS += tls_pie_pic_test
871 check_PROGRAMS += tls_shared_test
872 check_PROGRAMS += tls_shared_ie_test
873 check_PROGRAMS += tls_shared_gd_to_ie_test
874 tls_test_pic.o: tls_test.cc
875 $(CXXCOMPILE) -c -fpic -o $@ $<
876 tls_test_file2_pic.o: tls_test_file2.cc
877 $(CXXCOMPILE) -c -fpic -o $@ $<
878 tls_test_c_pic.o: tls_test_c.c
879 $(COMPILE) -c -fpic $(TLS_TEST_C_CFLAGS) -o $@ $<
880 tls_test_shared.so: tls_test_pic.o tls_test_file2_pic.o tls_test_c_pic.o gcctestdir/ld
881 $(CXXLINK) -Bgcctestdir/ -shared tls_test_pic.o tls_test_file2_pic.o tls_test_c_pic.o -Wl,-z,defs
882 tls_test_shared2.so: tls_test_file2_pic.o gcctestdir/ld
883 $(CXXLINK) -Bgcctestdir/ -shared tls_test_file2_pic.o
884
885 tls_test_pic_ie.o: tls_test.cc
886 $(CXXCOMPILE) -c -fpic -ftls-model=initial-exec -o $@ $<
887 tls_test_file2_pic_ie.o: tls_test_file2.cc
888 $(CXXCOMPILE) -c -fpic -ftls-model=initial-exec -o $@ $<
889 tls_test_c_pic_ie.o: tls_test_c.c
890 $(COMPILE) -c -fpic -ftls-model=initial-exec $(TLS_TEST_C_CFLAGS) -o $@ $<
891 tls_test_ie_shared.so: tls_test_pic_ie.o tls_test_file2_pic_ie.o tls_test_c_pic_ie.o gcctestdir/ld
892 $(CXXLINK) -Bgcctestdir/ -shared tls_test_pic_ie.o tls_test_file2_pic_ie.o tls_test_c_pic_ie.o
893
894 tls_test_SOURCES = tls_test.cc tls_test_file2.cc tls_test_main.cc tls_test.h
895 tls_test_DEPENDENCIES = gcctestdir/ld tls_test_c.o
896 tls_test_LDFLAGS = -Bgcctestdir/
897 tls_test_LDADD = tls_test_c.o -lpthread
898 tls_test_c.o: tls_test_c.c
899 $(COMPILE) -c $(TLS_TEST_C_CFLAGS) -o $@ $<
900
901 tls_pic_test_SOURCES = tls_test_main.cc
902 tls_pic_test_DEPENDENCIES = gcctestdir/ld tls_test_pic.o tls_test_file2_pic.o \
903 tls_test_c_pic.o
904 tls_pic_test_LDFLAGS = -Bgcctestdir/
905 tls_pic_test_LDADD = tls_test_pic.o tls_test_file2_pic.o tls_test_c_pic.o \
906 -lpthread
907
908 tls_test_main_pie.o: tls_test_main.cc tls_test.h
909 $(CXXCOMPILE) -c -fpie -o $@ $<
910 tls_test_pie.o: tls_test.cc tls_test.h
911 $(CXXCOMPILE) -c -fpie -o $@ $<
912 tls_test_file2_pie.o: tls_test_file2.cc tls_test.h
913 $(CXXCOMPILE) -c -fpie -o $@ $<
914 tls_test_c_pie.o: tls_test_c.c
915 $(COMPILE) -c -fpic $(TLS_TEST_C_CFLAGS) -o $@ $<
916 tls_pie_test: tls_test_main_pie.o tls_test_pie.o tls_test_file2_pie.o \
917 tls_test_c_pie.o gcctestdir/ld
918 $(CXXLINK) -Bgcctestdir/ -pie tls_test_main_pie.o tls_test_pie.o tls_test_file2_pie.o tls_test_c_pie.o -lpthread
919
920 check_SCRIPTS += tls_pie_test.sh
921 check_DATA += tls_pie_test.stdout
922 tls_pie_test.stdout: tls_pie_test
923 $(TEST_READELF) -rW $< > $@ 2>/dev/null
924
925 tls_pie_pic_test: tls_test_main_pie.o tls_test_pic.o tls_test_file2_pic.o \
926 tls_test_c_pic.o gcctestdir/ld
927 $(CXXLINK) -Bgcctestdir/ -pie tls_test_main_pie.o tls_test_pic.o tls_test_file2_pic.o tls_test_c_pic.o -lpthread
928
929 tls_shared_test_SOURCES = tls_test_main.cc
930 tls_shared_test_DEPENDENCIES = gcctestdir/ld tls_test_shared.so
931 tls_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
932 tls_shared_test_LDADD = tls_test_shared.so -lpthread
933
934 tls_shared_ie_test_SOURCES = tls_test_main.cc
935 tls_shared_ie_test_DEPENDENCIES = gcctestdir/ld tls_test_ie_shared.so
936 tls_shared_ie_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
937 tls_shared_ie_test_LDADD = tls_test_ie_shared.so -lpthread
938
939 tls_shared_gd_to_ie_test_SOURCES = tls_test_main.cc
940 tls_shared_gd_to_ie_test_DEPENDENCIES = gcctestdir/ld tls_test_pic.o \
941 tls_test_c_pic.o tls_test_shared2.so
942 tls_shared_gd_to_ie_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
943 tls_shared_gd_to_ie_test_LDADD = tls_test_pic.o tls_test_c_pic.o \
944 tls_test_shared2.so -lpthread
945
946 if TLS_GNU2_DIALECT
947
948 check_PROGRAMS += tls_shared_gnu2_gd_to_ie_test
949
950 tls_test_gnu2.o: tls_test.cc
951 $(CXXCOMPILE) -c -fpic -mtls-dialect=gnu2 -o $@ $<
952 tls_test_file2_gnu2.o: tls_test_file2.cc
953 $(CXXCOMPILE) -c -fpic -mtls-dialect=gnu2 -o $@ $<
954 tls_test_c_gnu2.o: tls_test_c.c
955 $(COMPILE) -c -fpic -mtls-dialect=gnu2 $(TLS_TEST_C_CFLAGS) -o $@ $<
956 tls_test_gnu2_shared2.so: tls_test_file2_gnu2.o gcctestdir/ld
957 $(CXXLINK) -Bgcctestdir/ -shared tls_test_file2_gnu2.o
958
959 tls_shared_gnu2_gd_to_ie_test_SOURCES = tls_test_main.cc
960 tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES = gcctestdir/ld tls_test_gnu2.o \
961 tls_test_c_gnu2.o tls_test_gnu2_shared2.so
962 tls_shared_gnu2_gd_to_ie_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
963 tls_shared_gnu2_gd_to_ie_test_LDADD = tls_test_gnu2.o tls_test_c_gnu2.o \
964 tls_test_gnu2_shared2.so -lpthread
965
966 if TLS_DESCRIPTORS
967
968 check_PROGRAMS += tls_shared_gnu2_test
969
970 tls_test_gnu2_shared.so: tls_test_gnu2.o tls_test_file2_gnu2.o tls_test_c_gnu2.o gcctestdir/ld
971 $(CXXLINK) -Bgcctestdir/ -shared tls_test_gnu2.o tls_test_file2_gnu2.o tls_test_c_gnu2.o
972
973 tls_shared_gnu2_test_SOURCES = tls_test_main.cc
974 tls_shared_gnu2_test_DEPENDENCIES = gcctestdir/ld tls_test_gnu2_shared.so
975 tls_shared_gnu2_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
976 tls_shared_gnu2_test_LDADD = tls_test_gnu2_shared.so -lpthread
977
978 endif TLS_DESCRIPTORS
979
980 endif TLS_GNU2_DIALECT
981
982 if HAVE_STATIC
983 if STATIC_TLS
984 check_PROGRAMS += tls_static_test
985 check_PROGRAMS += tls_static_pic_test
986
987 tls_static_test_SOURCES = $(tls_test_SOURCES)
988 tls_static_test_DEPENDENCIES = $(tls_test_DEPENDENCIES)
989 tls_static_test_LDFLAGS = $(tls_test_LDFLAGS) -static
990 tls_static_test_LDADD = $(tls_test_LDADD)
991
992 tls_static_pic_test_SOURCES = $(tls_pic_test_SOURCES)
993 tls_static_pic_test_DEPENDENCIES = $(tls_pic_test_DEPENDENCIES)
994 tls_static_pic_test_LDFLAGS = $(tls_pic_test_LDFLAGS) -static
995 tls_static_pic_test_LDADD = $(tls_pic_test_LDADD)
996 endif
997 endif
998
999 if FN_PTRS_IN_SO_WITHOUT_PIC
1000 check_PROGRAMS += tls_shared_nonpic_test
1001 tls_test_shared_nonpic.so: tls_test.o tls_test_file2.o tls_test_c.o gcctestdir/ld
1002 $(CXXLINK) -Bgcctestdir/ -shared tls_test.o tls_test_file2.o tls_test_c.o -Wl,-z,notext
1003
1004 tls_shared_nonpic_test_SOURCES = tls_test_main.cc
1005 tls_shared_nonpic_test_DEPENDENCIES = gcctestdir/ld tls_test_shared_nonpic.so
1006 tls_shared_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1007 tls_shared_nonpic_test_LDADD = tls_test_shared_nonpic.so -lpthread
1008 endif FN_PTRS_IN_SO_WITHOUT_PIC
1009
1010 endif TLS
1011
1012 if DEFAULT_TARGET_X86_64
1013
1014 check_SCRIPTS += x86_64_mov_to_lea.sh
1015 check_DATA += x86_64_mov_to_lea1.stdout x86_64_mov_to_lea2.stdout \
1016 x86_64_mov_to_lea3.stdout x86_64_mov_to_lea4.stdout \
1017 x86_64_mov_to_lea5.stdout x86_64_mov_to_lea6.stdout \
1018 x86_64_mov_to_lea7.stdout x86_64_mov_to_lea8.stdout \
1019 x86_64_mov_to_lea9.stdout x86_64_mov_to_lea10.stdout \
1020 x86_64_mov_to_lea11.stdout x86_64_mov_to_lea12.stdout \
1021 x86_64_mov_to_lea13.stdout x86_64_mov_to_lea14.stdout
1022 MOSTLYCLEANFILES += x86_64_mov_to_lea1 x86_64_mov_to_lea2 \
1023 x86_64_mov_to_lea3 x86_64_mov_to_lea4 x86_64_mov_to_lea5 \
1024 x86_64_mov_to_lea6 x86_64_mov_to_lea7 x86_64_mov_to_lea8 \
1025 x86_64_mov_to_lea9 x86_64_mov_to_lea10 x86_64_mov_to_lea11 \
1026 x86_64_mov_to_lea12 x86_64_mov_to_lea13 x86_64_mov_to_lea14
1027
1028 x86_64_mov_to_lea1.o: x86_64_mov_to_lea1.s
1029 $(TEST_AS) --64 -o $@ $<
1030 x86_64_mov_to_lea2.o: x86_64_mov_to_lea1.s
1031 $(TEST_AS) --x32 -o $@ $<
1032 x86_64_mov_to_lea3.o: x86_64_mov_to_lea2.s
1033 $(TEST_AS) --x32 -o $@ $<
1034 x86_64_mov_to_lea4.o: x86_64_mov_to_lea2.s
1035 $(TEST_AS) --64 -o $@ $<
1036 x86_64_mov_to_lea5.o: x86_64_mov_to_lea3.s
1037 $(TEST_AS) --x32 -mrelax-relocations=yes -o $@ $<
1038 x86_64_mov_to_lea6.o: x86_64_mov_to_lea3.s
1039 $(TEST_AS) --64 -mrelax-relocations=yes -o $@ $<
1040 x86_64_mov_to_lea7.o: x86_64_mov_to_lea4.s
1041 $(TEST_AS) --x32 -o $@ $<
1042 x86_64_mov_to_lea8.o: x86_64_mov_to_lea4.s
1043 $(TEST_AS) --64 -o $@ $<
1044 x86_64_mov_to_lea1: x86_64_mov_to_lea1.o
1045 ../ld-new -Bsymbolic -shared -melf_x86_64 -o $@ $<
1046 x86_64_mov_to_lea2: x86_64_mov_to_lea1.o
1047 ../ld-new -pie -melf_x86_64 -o $@ $<
1048 x86_64_mov_to_lea3: x86_64_mov_to_lea1.o
1049 ../ld-new -melf_x86_64 -o $@ $<
1050 x86_64_mov_to_lea4: x86_64_mov_to_lea2.o
1051 ../ld-new -Bsymbolic -shared -melf32_x86_64 -o $@ $<
1052 x86_64_mov_to_lea5: x86_64_mov_to_lea2.o
1053 ../ld-new -pie -melf32_x86_64 -o $@ $<
1054 x86_64_mov_to_lea6: x86_64_mov_to_lea2.o
1055 ../ld-new -melf32_x86_64 -o $@ $<
1056 x86_64_mov_to_lea7: x86_64_mov_to_lea3.o
1057 ../ld-new -melf32_x86_64 -pie -o $@ $<
1058 x86_64_mov_to_lea8: x86_64_mov_to_lea4.o
1059 ../ld-new -melf_x86_64 -pie -o $@ $<
1060 x86_64_mov_to_lea9: x86_64_mov_to_lea5.o
1061 ../ld-new -melf32_x86_64 -o $@ $<
1062 x86_64_mov_to_lea10: x86_64_mov_to_lea6.o
1063 ../ld-new -melf_x86_64 -o $@ $<
1064 x86_64_mov_to_lea11: x86_64_mov_to_lea2.o
1065 ../ld-new -melf32_x86_64 -shared -o $@ $<
1066 x86_64_mov_to_lea12: x86_64_mov_to_lea1.o
1067 ../ld-new -melf_x86_64 -shared -o $@ $<
1068 x86_64_mov_to_lea13: x86_64_mov_to_lea7.o
1069 ../ld-new -melf32_x86_64 -shared -o $@ $<
1070 x86_64_mov_to_lea14: x86_64_mov_to_lea8.o
1071 ../ld-new -melf_x86_64 -shared -o $@ $<
1072 x86_64_mov_to_lea1.stdout: x86_64_mov_to_lea1
1073 $(TEST_OBJDUMP) -dw $< > $@
1074 x86_64_mov_to_lea2.stdout: x86_64_mov_to_lea2
1075 $(TEST_OBJDUMP) -dw $< > $@
1076 x86_64_mov_to_lea3.stdout: x86_64_mov_to_lea3
1077 $(TEST_OBJDUMP) -dw $< > $@
1078 x86_64_mov_to_lea4.stdout: x86_64_mov_to_lea4
1079 $(TEST_OBJDUMP) -dw $< > $@
1080 x86_64_mov_to_lea5.stdout: x86_64_mov_to_lea5
1081 $(TEST_OBJDUMP) -dw $< > $@
1082 x86_64_mov_to_lea6.stdout: x86_64_mov_to_lea6
1083 $(TEST_OBJDUMP) -dw $< > $@
1084 x86_64_mov_to_lea7.stdout: x86_64_mov_to_lea7
1085 $(TEST_OBJDUMP) -dw $< > $@
1086 x86_64_mov_to_lea8.stdout: x86_64_mov_to_lea8
1087 $(TEST_OBJDUMP) -dw $< > $@
1088 x86_64_mov_to_lea9.stdout: x86_64_mov_to_lea9
1089 $(TEST_OBJDUMP) -dw $< > $@
1090 x86_64_mov_to_lea10.stdout: x86_64_mov_to_lea10
1091 $(TEST_OBJDUMP) -dw $< > $@
1092 x86_64_mov_to_lea11.stdout: x86_64_mov_to_lea11
1093 $(TEST_OBJDUMP) -dw $< > $@
1094 x86_64_mov_to_lea12.stdout: x86_64_mov_to_lea12
1095 $(TEST_OBJDUMP) -dw $< > $@
1096 x86_64_mov_to_lea13.stdout: x86_64_mov_to_lea13
1097 $(TEST_OBJDUMP) -dw $< > $@
1098 x86_64_mov_to_lea14.stdout: x86_64_mov_to_lea14
1099 $(TEST_OBJDUMP) -dw $< > $@
1100
1101 check_SCRIPTS += x86_64_indirect_call_to_direct.sh
1102 check_DATA += x86_64_indirect_call_to_direct1.stdout \
1103 x86_64_indirect_jump_to_direct1.stdout
1104 MOSTLYCLEANFILES += x86_64_indirect_call_to_direct1 \
1105 x86_64_indirect_jump_to_direct1
1106
1107 x86_64_indirect_call_to_direct1.o: x86_64_indirect_call_to_direct1.s
1108 $(TEST_AS) --64 -mrelax-relocations=yes -o $@ $<
1109 x86_64_indirect_call_to_direct1: x86_64_indirect_call_to_direct1.o gcctestdir/ld
1110 gcctestdir/ld -o $@ $<
1111 x86_64_indirect_call_to_direct1.stdout: x86_64_indirect_call_to_direct1
1112 $(TEST_OBJDUMP) -dw $< > $@
1113 x86_64_indirect_jump_to_direct1.o: x86_64_indirect_jump_to_direct1.s
1114 $(TEST_AS) --64 -mrelax-relocations=yes -o $@ $<
1115 x86_64_indirect_jump_to_direct1: x86_64_indirect_jump_to_direct1.o gcctestdir/ld
1116 gcctestdir/ld -o $@ $<
1117 x86_64_indirect_jump_to_direct1.stdout: x86_64_indirect_jump_to_direct1
1118 $(TEST_OBJDUMP) -dw $< > $@
1119
1120 check_SCRIPTS += x86_64_overflow_pc32.sh
1121 check_DATA += x86_64_overflow_pc32.err
1122 MOSTLYCLEANFILES += x86_64_overflow_pc32.err
1123 x86_64_overflow_pc32.o: x86_64_overflow_pc32.s
1124 $(TEST_AS) -o $@ $<
1125 x86_64_overflow_pc32.err: x86_64_overflow_pc32.o gcctestdir/ld
1126 @echo gcctestdir/ld -e bar -Tdata=0x81000000 -o x86_64_overflow_pc32 x86_64_overflow_pc32.o "2>$@"
1127 @if gcctestdir/ld -e bar -Tdata=0x81000000 -o x86_64_overflow_pc32 x86_64_overflow_pc32.o 2>$@; \
1128 then \
1129 echo 1>&2 "Link of x86_64_overflow_pc32 should have failed"; \
1130 rm -f $@; \
1131 exit 1; \
1132 fi
1133
1134 check_SCRIPTS += x32_overflow_pc32.sh
1135 check_DATA += x32_overflow_pc32.err
1136 MOSTLYCLEANFILES += x32_overflow_pc32.err
1137 x32_overflow_pc32.o: x86_64_overflow_pc32.s
1138 $(TEST_AS) --x32 -o $@ $<
1139 x32_overflow_pc32.err: x32_overflow_pc32.o gcctestdir/ld
1140 @echo gcctestdir/ld -e bar -Tdata=0x81000000 -o x32_overflow_pc32 x32_overflow_pc32.o "2>$@"
1141 @if gcctestdir/ld -e bar -Tdata=0x81000000 -o x32_overflow_pc32 x32_overflow_pc32.o 2>$@; \
1142 then \
1143 echo 1>&2 "Link of x32_overflow_pc32 should have failed"; \
1144 rm -f $@; \
1145 exit 1; \
1146 fi
1147
1148 endif DEFAULT_TARGET_X86_64
1149
1150 if DEFAULT_TARGET_X86_64_OR_X32
1151
1152 check_PROGRAMS += pr20216a_test
1153 pr20216a_test_SOURCES = pr20216_main.c pr20216_def.c
1154 pr20216a_test_DEPENDENCIES = pr20216_gd.o pr20216_ld.o gcctestdir/ld gcctestdir/as
1155 pr20216a_test_CFLAGS = -Bgcctestdir/ -fPIE
1156 pr20216a_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1157 pr20216a_test_LDADD = pr20216_gd.o pr20216_ld.o
1158
1159 check_PROGRAMS += pr20216b_test
1160 pr20216b_test_SOURCES = pr20216_main.c pr20216_def.c
1161 pr20216b_test_DEPENDENCIES = pr20216_gd.o pr20216_ld.o gcctestdir/ld gcctestdir/as
1162 pr20216b_test_CFLAGS = -Bgcctestdir/ -fPIE
1163 pr20216b_test_LDFLAGS = -pie -Bgcctestdir/ -Wl,-R,.
1164 pr20216b_test_LDADD = pr20216_gd.o pr20216_ld.o
1165
1166 check_PROGRAMS += pr20216c_test
1167 pr20216c_test_SOURCES = pr20216_main.c pr20216_def.c
1168 pr20216c_test_DEPENDENCIES = pr20216_gd.o pr20216_ld.o gcctestdir/ld gcctestdir/as
1169 pr20216c_test_CFLAGS = -Bgcctestdir/ -fPIE
1170 pr20216c_test_LDFLAGS = -static -Bgcctestdir/ -Wl,-R,.
1171 pr20216c_test_LDADD = pr20216_gd.o pr20216_ld.o
1172
1173 check_PROGRAMS += pr20216d_test
1174 pr20216d_test_SOURCES = pr20216_main.c pr20216_def.c
1175 pr20216d_test_DEPENDENCIES = pr20216a.so gcctestdir/ld gcctestdir/as
1176 pr20216d_test_CFLAGS = -Bgcctestdir/ -fPIE
1177 pr20216d_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1178 pr20216d_test_LDADD = pr20216a.so
1179
1180 check_PROGRAMS += pr20216e_test
1181 pr20216e_test_SOURCES = pr20216_main.c
1182 pr20216e_test_DEPENDENCIES = pr20216_gd.o pr20216_ld.o pr20216b.so gcctestdir/ld gcctestdir/as
1183 pr20216e_test_CFLAGS = -Bgcctestdir/ -fPIE
1184 pr20216e_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1185 pr20216e_test_LDADD = pr20216_gd.o pr20216_ld.o pr20216b.so
1186
1187 MOSTLYCLEANFILES += pr20216a.so pr20216b.so
1188
1189 pr20216a.so: pr20216_gd.o pr20216_ld.o gcctestdir/ld
1190 $(LINK) -Bgcctestdir/ -shared pr20216_gd.o pr20216_ld.o
1191
1192 pr20216b.so: pr20216_def.o gcctestdir/ld
1193 $(LINK) -Bgcctestdir/ -shared pr20216_def.o
1194
1195 pr20216_gd.o: pr20216_gd.S
1196 $(COMPILE) -c -o $@ $<
1197
1198 pr20216_ld.o: pr20216_ld.S
1199 $(COMPILE) -c -o $@ $<
1200
1201 endif DEFAULT_TARGET_X86_64_OR_X32
1202
1203 if DEFAULT_TARGET_I386
1204
1205 check_SCRIPTS += i386_mov_to_lea.sh
1206 check_DATA += i386_mov_to_lea1.stdout i386_mov_to_lea2.stdout \
1207 i386_mov_to_lea3.stdout i386_mov_to_lea4.stdout \
1208 i386_mov_to_lea5.stdout i386_mov_to_lea6.stdout \
1209 i386_mov_to_lea7.stdout i386_mov_to_lea8.stdout
1210 MOSTLYCLEANFILES += i386_mov_to_lea1 i386_mov_to_lea2 i386_mov_to_lea3 \
1211 i386_mov_to_lea4 i386_mov_to_lea5 i386_mov_to_lea6 \
1212 i386_mov_to_lea7 i386_mov_to_lea8
1213
1214 i386_mov_to_lea1.o: i386_mov_to_lea1.s
1215 $(TEST_AS) --32 -o $@ $<
1216 i386_mov_to_lea2.o: i386_mov_to_lea2.s
1217 $(TEST_AS) --32 -o $@ $<
1218 i386_mov_to_lea3.o: i386_mov_to_lea3.s
1219 $(TEST_AS) --32 -o $@ $<
1220 i386_mov_to_lea4.o: i386_mov_to_lea4.s
1221 $(TEST_AS) --32 -o $@ $<
1222 i386_mov_to_lea5.o: i386_mov_to_lea5.s
1223 $(TEST_AS) --32 -o $@ $<
1224 i386_mov_to_lea1: i386_mov_to_lea1.o
1225 ../ld-new -Bsymbolic -shared -melf_i386 -o $@ $<
1226 i386_mov_to_lea2: i386_mov_to_lea1.o
1227 ../ld-new -pie -melf_i386 -o $@ $<
1228 i386_mov_to_lea3: i386_mov_to_lea1.o
1229 ../ld-new -melf_i386 -o $@ $<
1230 i386_mov_to_lea4: i386_mov_to_lea1.o
1231 ../ld-new -melf_i386 -shared -o $@ $<
1232 i386_mov_to_lea5: i386_mov_to_lea2.o
1233 ../ld-new -melf_i386 -shared -o $@ $<
1234 i386_mov_to_lea6: i386_mov_to_lea3.o
1235 ../ld-new -melf_i386 -shared -o $@ $<
1236 i386_mov_to_lea7: i386_mov_to_lea4.o
1237 ../ld-new -melf_i386 -shared -o $@ $<
1238 i386_mov_to_lea8: i386_mov_to_lea5.o
1239 ../ld-new -melf_i386 -shared -o $@ $<
1240 i386_mov_to_lea1.stdout: i386_mov_to_lea1
1241 $(TEST_OBJDUMP) -dw $< > $@
1242 i386_mov_to_lea2.stdout: i386_mov_to_lea2
1243 $(TEST_OBJDUMP) -dw $< > $@
1244 i386_mov_to_lea3.stdout: i386_mov_to_lea3
1245 $(TEST_OBJDUMP) -dw $< > $@
1246 i386_mov_to_lea4.stdout: i386_mov_to_lea4
1247 $(TEST_OBJDUMP) -dw $< > $@
1248 i386_mov_to_lea5.stdout: i386_mov_to_lea5
1249 $(TEST_OBJDUMP) -dw $< > $@
1250 i386_mov_to_lea6.stdout: i386_mov_to_lea6
1251 $(TEST_OBJDUMP) -dw $< > $@
1252 i386_mov_to_lea7.stdout: i386_mov_to_lea7
1253 $(TEST_OBJDUMP) -dw $< > $@
1254 i386_mov_to_lea8.stdout: i386_mov_to_lea8
1255 $(TEST_OBJDUMP) -dw $< > $@
1256
1257 endif DEFAULT_TARGET_I386
1258
1259 check_PROGRAMS += many_sections_test
1260 many_sections_test_SOURCES = many_sections_test.cc
1261 many_sections_test_DEPENDENCIES = gcctestdir/ld
1262 many_sections_test_LDFLAGS = -Bgcctestdir/ -rdynamic
1263 many_sections_test_LDADD =
1264
1265 BUILT_SOURCES += many_sections_define.h
1266 MOSTLYCLEANFILES += many_sections_define.h
1267 many_sections_define.h:
1268 (for i in `seq 1 70000`; do \
1269 echo "int var_$$i __attribute__((section(\"section_$$i\"))) = $$i;"; \
1270 done) > $@.tmp
1271 mv -f $@.tmp $@
1272
1273 BUILT_SOURCES += many_sections_check.h
1274 MOSTLYCLEANFILES += many_sections_check.h
1275 many_sections_check.h:
1276 (for i in `seq 1 1000 70000`; do \
1277 echo "assert(var_$$i == $$i);"; \
1278 done) > $@.tmp
1279 mv -f $@.tmp $@
1280
1281 check_PROGRAMS += many_sections_r_test
1282 many_sections_r_test.o: many_sections_test.o gcctestdir/ld
1283 gcctestdir/ld -r -o $@ many_sections_test.o
1284 many_sections_r_test: many_sections_r_test.o gcctestdir/ld
1285 $(CXXLINK) -Bgcctestdir/ many_sections_r_test.o $(LIBS)
1286
1287 check_PROGRAMS += initpri1
1288 initpri1_SOURCES = initpri1.c
1289 initpri1_DEPENDENCIES = gcctestdir/ld
1290 initpri1_LDFLAGS = -Bgcctestdir/
1291 initpri1_LDADD =
1292
1293 check_PROGRAMS += initpri2
1294 initpri2_SOURCES = initpri2.c
1295 initpri2_DEPENDENCIES = gcctestdir/ld
1296 initpri2_LDFLAGS = -Bgcctestdir/ -Wl,--ctors-in-init-array
1297 initpri2_LDADD =
1298
1299 check_PROGRAMS += initpri3a
1300 initpri3a_SOURCES = initpri3.c
1301 initpri3a_DEPENDENCIES = gcctestdir/ld
1302 initpri3a_LDFLAGS = -Bgcctestdir/
1303 initpri3a_LDADD =
1304
1305 # This test fails on targets not using .ctors and .dtors sections (e.g. ARM
1306 # EABI). Given that gcc is moving towards using .init_array in all cases,
1307 # this test is commented out. A better fix would be checking whether gcc
1308 # uses .ctors or .init_array sections in configure.
1309
1310 # check_PROGRAMS += initpri3b
1311 # initpri3b_SOURCES = initpri3.c
1312 # initpri3b_DEPENDENCIES = gcctestdir/ld
1313 # initpri3b_LDFLAGS = -Bgcctestdir/ -Wl,--no-ctors-in-init-array
1314 # initpri3b_LDADD =
1315
1316 # Test --detect-odr-violations
1317 check_SCRIPTS += debug_msg.sh
1318
1319 # Create the data files that debug_msg.sh analyzes.
1320 check_DATA += debug_msg.err
1321 MOSTLYCLEANFILES += debug_msg.err
1322 debug_msg.o: debug_msg.cc
1323 $(CXXCOMPILE) -O0 -g -c -w -o $@ $(srcdir)/debug_msg.cc
1324 odr_violation1.o: odr_violation1.cc
1325 $(CXXCOMPILE) -O0 -g -c -w -o $@ $(srcdir)/odr_violation1.cc
1326 # Compile with different optimization flags to check that rearranged
1327 # instructions don't cause a false positive.
1328 odr_violation2.o: odr_violation2.cc
1329 $(CXXCOMPILE) -O2 -g -c -w -o $@ $(srcdir)/odr_violation2.cc
1330 debug_msg.err: debug_msg.o odr_violation1.o odr_violation2.o gcctestdir/ld
1331 @echo $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg debug_msg.o odr_violation1.o odr_violation2.o "2>$@"
1332 @if $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg debug_msg.o odr_violation1.o odr_violation2.o 2>$@; \
1333 then \
1334 echo 1>&2 "Link of debug_msg should have failed"; \
1335 rm -f $@; \
1336 exit 1; \
1337 fi
1338
1339 # Test error message when a vtable is undefined.
1340 check_SCRIPTS += missing_key_func.sh
1341 check_DATA += missing_key_func.err
1342 MOSTLYCLEANFILES += missing_key_func.err
1343 missing_key_func.o: missing_key_func.cc
1344 $(CXXCOMPILE) -O0 -g -c -o $@ $(srcdir)/missing_key_func.cc
1345 missing_key_func.err: missing_key_func.o gcctestdir/ld
1346 @echo $(CXXLINK) -Bgcctestdir/ -o missing_key_func missing_key_func.o "2>$@"
1347 @if $(CXXLINK) -Bgcctestdir/ -o missing_key_func missing_key_func.o 2>$@; \
1348 then \
1349 echo 1>&2 "Link of missing_key_func should have failed"; \
1350 rm -f $@; \
1351 exit 1; \
1352 fi
1353
1354 # Check that --detect-odr-violations works with compressed debug sections.
1355 check_DATA += debug_msg_cdebug.err
1356 MOSTLYCLEANFILES += debug_msg_cdebug.err
1357 debug_msg_cdebug.o: debug_msg.cc gcctestdir/as
1358 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -Wa,--compress-debug-sections -c -w -o $@ $(srcdir)/debug_msg.cc
1359 odr_violation1_cdebug.o: odr_violation1.cc gcctestdir/as
1360 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -Wa,--compress-debug-sections -c -w -o $@ $(srcdir)/odr_violation1.cc
1361 odr_violation2_cdebug.o: odr_violation2.cc gcctestdir/as
1362 $(CXXCOMPILE) -Bgcctestdir/ -O2 -g -Wa,--compress-debug-sections -c -w -o $@ $(srcdir)/odr_violation2.cc
1363 debug_msg_cdebug.err: debug_msg_cdebug.o odr_violation1_cdebug.o odr_violation2_cdebug.o gcctestdir/ld
1364 @echo $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_cdebug debug_msg_cdebug.o odr_violation1_cdebug.o odr_violation2_cdebug.o "2>$@"
1365 @if $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_cdebug debug_msg_cdebug.o odr_violation1_cdebug.o odr_violation2_cdebug.o 2>$@; \
1366 then \
1367 echo 1>&2 "Link of debug_msg_cdebug should have failed"; \
1368 rm -f $@; \
1369 exit 1; \
1370 fi
1371 check_DATA += debug_msg_cdebug_gabi.err
1372 MOSTLYCLEANFILES += debug_msg_cdebug_gabi.err
1373 debug_msg_cdebug_gabi.o: debug_msg.cc gcctestdir/as
1374 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -Wa,--compress-debug-sections=zlib-gabi -c -w -o $@ $(srcdir)/debug_msg.cc
1375 odr_violation1_cdebug_gabi.o: odr_violation1.cc gcctestdir/as
1376 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -Wa,--compress-debug-sections=zlib-gabi -c -w -o $@ $(srcdir)/odr_violation1.cc
1377 odr_violation2_cdebug_gabi.o: odr_violation2.cc gcctestdir/as
1378 $(CXXCOMPILE) -Bgcctestdir/ -O2 -g -Wa,--compress-debug-sections=zlib-gabi -c -w -o $@ $(srcdir)/odr_violation2.cc
1379 debug_msg_cdebug_gabi.err: debug_msg_cdebug_gabi.o odr_violation1_cdebug_gabi.o odr_violation2_cdebug_gabi.o gcctestdir/ld
1380 @echo $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_cdebug debug_msg_cdebug_gabi.o odr_violation1_cdebug_gabi.o odr_violation2_cdebug_gabi.o "2>$@"
1381 @if $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_cdebug_gabi debug_msg_cdebug_gabi.o odr_violation1_cdebug_gabi.o odr_violation2_cdebug_gabi.o 2>$@; \
1382 then \
1383 echo 1>&2 "Link of debug_msg_cdebug_gabi should have failed"; \
1384 rm -f $@; \
1385 exit 1; \
1386 fi
1387
1388 # See if we can also detect problems when we're linking .so's, not .o's.
1389 check_DATA += debug_msg_so.err
1390 MOSTLYCLEANFILES += debug_msg_so.err
1391 debug_msg.so: debug_msg.cc gcctestdir/ld
1392 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -shared -fPIC -w -o $@ $(srcdir)/debug_msg.cc
1393 odr_violation1.so: odr_violation1.cc gcctestdir/ld
1394 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -shared -fPIC -w -o $@ $(srcdir)/odr_violation1.cc
1395 odr_violation2.so: odr_violation2.cc gcctestdir/ld
1396 $(CXXCOMPILE) -Bgcctestdir/ -O2 -g -shared -fPIC -w -o $@ $(srcdir)/odr_violation2.cc
1397 debug_msg_so.err: debug_msg.so odr_violation1.so odr_violation2.so gcctestdir/ld
1398 @echo $(CXXLINK_S) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_so debug_msg.so odr_violation1.so odr_violation2.so "2>$@"
1399 @if $(CXXLINK_S) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_so debug_msg.so odr_violation1.so odr_violation2.so 2>$@; \
1400 then \
1401 echo 1>&2 "Link of debug_msg_so should have failed"; \
1402 rm -f $@; \
1403 exit 1; \
1404 fi
1405
1406 # We also want to make sure we do something reasonable when there's no
1407 # debug info available. For the best test, we use .so's.
1408 check_DATA += debug_msg_ndebug.err
1409 MOSTLYCLEANFILES += debug_msg_ndebug.err
1410 debug_msg_ndebug.so: debug_msg.cc gcctestdir/ld
1411 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g0 -shared -fPIC -w -o $@ $(srcdir)/debug_msg.cc
1412 odr_violation1_ndebug.so: odr_violation1.cc gcctestdir/ld
1413 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g0 -shared -fPIC -w -o $@ $(srcdir)/odr_violation1.cc
1414 odr_violation2_ndebug.so: odr_violation2.cc gcctestdir/ld
1415 $(CXXCOMPILE) -Bgcctestdir/ -O2 -g0 -shared -fPIC -w -o $@ $(srcdir)/odr_violation2.cc
1416 debug_msg_ndebug.err: debug_msg_ndebug.so odr_violation1_ndebug.so odr_violation2_ndebug.so gcctestdir/ld
1417 @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>$@"
1418 @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>$@; \
1419 then \
1420 echo 1>&2 "Link of debug_msg_ndebug should have failed"; \
1421 rm -f $@; \
1422 exit 1; \
1423 fi
1424
1425
1426 # Similar to --detect-odr-violations: check for undefined symbols in .so's
1427 check_SCRIPTS += undef_symbol.sh
1428 check_DATA += undef_symbol.err
1429 MOSTLYCLEANFILES += undef_symbol.err
1430 undef_symbol.o: undef_symbol.cc
1431 $(CXXCOMPILE) -O0 -g -c -fPIC $<
1432 undef_symbol.so: undef_symbol.o gcctestdir/ld
1433 $(CXXLINK) -Bgcctestdir/ -shared undef_symbol.o
1434 undef_symbol.err: undef_symbol_main.o undef_symbol.so gcctestdir/ld
1435 @echo $(CXXLINK) -Bgcctestdir/ -o undef_symbol_test undef_symbol_main.o undef_symbol.so "2>$@"
1436 @if $(CXXLINK) -Bgcctestdir/ -o undef_symbol_test undef_symbol_main.o undef_symbol.so 2>$@; \
1437 then \
1438 echo 1>&2 "Link of undef_symbol_test should have failed"; \
1439 rm -f $@; \
1440 exit 1; \
1441 fi
1442
1443
1444 # Test -o when emitting to a special file (such as something in /dev).
1445 check_PROGRAMS += flagstest_o_specialfile
1446 flagstest_o_specialfile: flagstest_debug.o gcctestdir/ld
1447 $(CXXLINK) -Bgcctestdir/ -o /dev/stdout $< 2>&1 | cat > $@
1448 chmod a+x $@
1449 test -s $@
1450
1451 # Test --compress-debug-sections.
1452 check_PROGRAMS += flagstest_compress_debug_sections_none
1453 check_DATA += flagstest_compress_debug_sections_none.stdout
1454 flagstest_compress_debug_sections_none: flagstest_debug.o gcctestdir/ld
1455 $(CXXLINK) -Bgcctestdir/ -o $@ $< -Wl,--compress-debug-sections=none
1456 test -s $@
1457
1458 # Dump DWARF debug sections.
1459 flagstest_compress_debug_sections_none.stdout: flagstest_compress_debug_sections_none
1460 $(TEST_READELF) -w $< > $@.tmp
1461 mv -f $@.tmp $@
1462
1463 check_PROGRAMS += flagstest_compress_debug_sections
1464 check_DATA += flagstest_compress_debug_sections.stdout \
1465 flagstest_compress_debug_sections.cmp \
1466 flagstest_compress_debug_sections.check
1467 MOSTLYCLEANFILES += flagstest_compress_debug_sections.check \
1468 flagstest_compress_debug_sections.cmp
1469 flagstest_compress_debug_sections: flagstest_debug.o gcctestdir/ld
1470 $(CXXLINK) -Bgcctestdir/ -o $@ $< -Wl,--compress-debug-sections=zlib
1471 test -s $@
1472
1473 # Test --compress-debug-sections with --build-id=tree.
1474 check_PROGRAMS += flagstest_compress_debug_sections_and_build_id_tree
1475 flagstest_compress_debug_sections_and_build_id_tree: flagstest_debug.o gcctestdir/ld
1476 $(CXXLINK) -Bgcctestdir/ -o $@ $< -Wl,--compress-debug-sections=zlib \
1477 -Wl,--build-id=tree \
1478 -Wl,--build-id-chunk-size-for-treehash=4096 \
1479 -Wl,--build-id-min-file-size-for-treehash=0
1480 test -s $@
1481
1482 # Dump compressed DWARF debug sections.
1483 flagstest_compress_debug_sections.stdout: flagstest_compress_debug_sections
1484 $(TEST_READELF) -w $< | sed -e "s/.zdebug_/.debug_/" > $@.tmp
1485 mv -f $@.tmp $@
1486
1487 # Check there are compressed DWARF .debug_* sections.
1488 flagstest_compress_debug_sections.check: flagstest_compress_debug_sections
1489 $(TEST_READELF) -SW $< | egrep ".debug_.* C *" > $@.tmp
1490 mv -f $@.tmp $@
1491
1492 # Compare DWARF debug info.
1493 flagstest_compress_debug_sections.cmp: flagstest_compress_debug_sections.stdout \
1494 flagstest_compress_debug_sections_none.stdout
1495 cmp flagstest_compress_debug_sections.stdout \
1496 flagstest_compress_debug_sections_none.stdout > $@.tmp
1497 mv -f $@.tmp $@
1498
1499 check_PROGRAMS += flagstest_compress_debug_sections_gnu
1500 check_DATA += flagstest_compress_debug_sections_gnu.stdout \
1501 flagstest_compress_debug_sections_gnu.cmp \
1502 flagstest_compress_debug_sections_gnu.check
1503 MOSTLYCLEANFILES += flagstest_compress_debug_sections_gnu.check \
1504 flagstest_compress_debug_sections_gnu.cmp
1505 flagstest_compress_debug_sections_gnu: flagstest_debug.o gcctestdir/ld
1506 $(CXXLINK) -Bgcctestdir/ -o $@ $< -Wl,--compress-debug-sections=zlib-gnu
1507 test -s $@
1508
1509 # Dump compressed DWARF debug sections.
1510 flagstest_compress_debug_sections_gnu.stdout: flagstest_compress_debug_sections_gnu
1511 $(TEST_READELF) -w $< | sed -e "s/.zdebug_/.debug_/" > $@.tmp
1512 mv -f $@.tmp $@
1513
1514 # Check there are compressed DWARF .zdebug_* sections.
1515 flagstest_compress_debug_sections_gnu.check: flagstest_compress_debug_sections_gnu
1516 $(TEST_READELF) -SW $< | grep ".zdebug_" > $@.tmp
1517 mv -f $@.tmp $@
1518
1519 # Compare DWARF debug info.
1520 flagstest_compress_debug_sections_gnu.cmp: flagstest_compress_debug_sections_gnu.stdout \
1521 flagstest_compress_debug_sections_none.stdout
1522 cmp flagstest_compress_debug_sections_gnu.stdout \
1523 flagstest_compress_debug_sections_none.stdout > $@.tmp
1524 mv -f $@.tmp $@
1525
1526 check_PROGRAMS += flagstest_compress_debug_sections_gabi
1527 check_DATA += flagstest_compress_debug_sections_gabi.stdout \
1528 flagstest_compress_debug_sections_gabi.cmp \
1529 flagstest_compress_debug_sections_gabi.check
1530 MOSTLYCLEANFILES += flagstest_compress_debug_sections_gabi.cmp \
1531 flagstest_compress_debug_sections_gabi.check
1532 flagstest_compress_debug_sections_gabi: flagstest_debug.o gcctestdir/ld
1533 $(CXXLINK) -Bgcctestdir/ -o $@ $< -Wl,--compress-debug-sections=zlib-gabi
1534 test -s $@
1535
1536 # Dump compressed DWARF debug sections.
1537 flagstest_compress_debug_sections_gabi.stdout: flagstest_compress_debug_sections_gabi
1538 $(TEST_READELF) -w $< > $@.tmp
1539 mv -f $@.tmp $@
1540
1541 # Check there are compressed DWARF .debug_* sections.
1542 flagstest_compress_debug_sections_gabi.check: flagstest_compress_debug_sections_gabi
1543 $(TEST_READELF) -tW $< | grep "COMPRESSED" > $@.tmp
1544 mv -f $@.tmp $@
1545
1546 # Compare DWARF debug info.
1547 flagstest_compress_debug_sections_gabi.cmp: flagstest_compress_debug_sections_gabi.stdout \
1548 flagstest_compress_debug_sections_none.stdout
1549 cmp flagstest_compress_debug_sections_gabi.stdout \
1550 flagstest_compress_debug_sections_none.stdout > $@.tmp
1551 mv -f $@.tmp $@
1552
1553 # The specialfile output has a tricky case when we also compress debug
1554 # sections, because it requires output-file resizing.
1555 check_PROGRAMS += flagstest_o_specialfile_and_compress_debug_sections
1556 flagstest_o_specialfile_and_compress_debug_sections: flagstest_debug.o \
1557 gcctestdir/ld
1558 $(CXXLINK) -Bgcctestdir/ -o /dev/stdout $< -Wl,--compress-debug-sections=zlib 2>&1 | cat > $@
1559 chmod a+x $@
1560 test -s $@
1561
1562 check_SCRIPTS += pr18689.sh
1563 check_DATA += pr18689.stdout
1564 MOSTLYCLEANFILES += pr18689a.o pr18689b.o
1565
1566 pr18689.stdout: pr18689b.o
1567 $(TEST_READELF) -SW $< > $@
1568
1569 pr18689a.o: pr18689.o ../ld-new
1570 ../ld-new -r -o $@ $<
1571
1572 pr18689b.o: pr18689a.o ../ld-new
1573 ../ld-new -r -o $@ $<
1574
1575 pr18689.o: pr18689.c gcctestdir/as
1576 $(COMPILE) -Bgcctestdir/ -ggdb3 -g -Wa,--compress-debug-sections=zlib-gabi -c -w -o $@ $(srcdir)/pr18689.c
1577
1578 # Test -TText and -Tdata.
1579 check_PROGRAMS += flagstest_o_ttext_1
1580 flagstest_o_ttext_1: flagstest_debug.o gcctestdir/ld
1581 $(CXXLINK) -Bgcctestdir/ -o $@ $< -Wl,-Ttext,0x400000 -Wl,-Tdata,0x800000
1582
1583 # This version won't be runnable, because there is no way to put the
1584 # PT_PHDR segment at file offset 0. We just make sure that we can
1585 # build it without error.
1586 check_DATA += flagstest_o_ttext_2
1587 MOSTLYCLEANFILES += flagstest_o_ttext_2
1588 flagstest_o_ttext_2: flagstest_debug.o gcctestdir/ld
1589 $(CXXLINK) -Bgcctestdir/ -o $@ $< -Wl,-Ttext,0x400010 -Wl,-Tdata,0x800010
1590
1591 # Test symbol versioning.
1592 check_PROGRAMS += ver_test
1593 ver_test_SOURCES = ver_test_main.cc
1594 ver_test_DEPENDENCIES = gcctestdir/ld ver_test_1.so ver_test_2.so ver_test_4.so
1595 ver_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1596 ver_test_LDADD = ver_test_1.so ver_test_2.so ver_test_4.so
1597 ver_test_1.so: ver_test_1.o ver_test_2.so ver_test_3.o ver_test_4.so gcctestdir/ld
1598 $(CXXLINK) -Bgcctestdir/ -shared ver_test_1.o ver_test_2.so ver_test_3.o ver_test_4.so
1599 ver_test_2.so: ver_test_2.o $(srcdir)/ver_test_2.script ver_test_4.so gcctestdir/ld
1600 $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_2.script -Wl,-R,. ver_test_2.o ver_test_4.so
1601 ver_test_4.so: ver_test_4.o $(srcdir)/ver_test_4.script gcctestdir/ld
1602 $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_4.script ver_test_4.o
1603 ver_test_1.o: ver_test_1.cc
1604 $(CXXCOMPILE) -c -fpic -o $@ $<
1605 ver_test_2.o: ver_test_2.cc
1606 $(CXXCOMPILE) -c -fpic -o $@ $<
1607 ver_test_3.o: ver_test_3.cc
1608 $(CXXCOMPILE) -c -fpic -o $@ $<
1609 ver_test_4.o: ver_test_4.cc
1610 $(CXXCOMPILE) -c -fpic -o $@ $<
1611
1612 check_SCRIPTS += ver_test_1.sh
1613 check_DATA += ver_test_1.syms
1614 ver_test_1.syms: ver_test_1.so
1615 $(TEST_READELF) -s $< >$@ 2>/dev/null
1616
1617 check_PROGRAMS += ver_test_2
1618 ver_test_2_SOURCES = ver_test_main_2.cc
1619 ver_test_2_DEPENDENCIES = gcctestdir/ld ver_test_4.so ver_test_2.so
1620 ver_test_2_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1621 ver_test_2_LDADD = ver_test_4.so ver_test_2.so
1622
1623 check_SCRIPTS += ver_test_2.sh
1624 check_DATA += ver_test_2.syms
1625 ver_test_2.syms: ver_test_2
1626 $(TEST_READELF) -s $< >$@ 2>/dev/null
1627
1628 check_SCRIPTS += ver_test_4.sh
1629 check_DATA += ver_test_4.syms
1630 ver_test_4.syms: ver_test_4.so
1631 $(TEST_READELF) -s $< >$@ 2>/dev/null
1632
1633 ver_test_5.so: ver_test_5.o $(srcdir)/ver_test_5.script ver_test_4.so gcctestdir/ld
1634 $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_5.script ver_test_5.o ver_test_4.so
1635 ver_test_5.o: ver_test_5.cc
1636 $(CXXCOMPILE) -c -fpic -o $@ $<
1637 check_SCRIPTS += ver_test_5.sh
1638 check_DATA += ver_test_5.syms
1639 ver_test_5.syms: ver_test_5.so
1640 $(TEST_READELF) -s $< >$@ 2>/dev/null
1641
1642 check_PROGRAMS += ver_test_6
1643 ver_test_6_SOURCES = ver_test_6.c
1644 ver_test_6_DEPENDENCIES = gcctestdir/ld ver_test_2.so
1645 ver_test_6_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1646 ver_test_6_LDADD = ver_test_2.so
1647
1648 ver_test_7.so: ver_test_4.o $(srcdir)/ver_test_4.script ver_test_7.o gcctestdir/ld
1649 $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_4.script ver_test_4.o ver_test_7.o
1650 ver_test_7.o: ver_test_7.cc
1651 $(CXXCOMPILE) -c -fpic -o $@ $<
1652 check_SCRIPTS += ver_test_7.sh
1653 check_DATA += ver_test_7.syms
1654 ver_test_7.syms: ver_test_7.so
1655 $(TEST_READELF) -s $< >$@ 2>/dev/null
1656
1657 check_PROGRAMS += ver_test_8
1658 ver_test_8_SOURCES = two_file_test_main.cc
1659 ver_test_8_DEPENDENCIES = gcctestdir/ld ver_test_8_1.so ver_test_8_2.so
1660 ver_test_8_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1661 ver_test_8_LDADD = ver_test_8_1.so ver_test_8_2.so
1662 ver_test_8_1.so: two_file_test_1_pic.o two_file_test_1b_pic.o ver_test_8_2.so gcctestdir/ld
1663 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1_pic.o two_file_test_1b_pic.o ver_test_8_2.so
1664 ver_test_8_2.so: two_file_test_2_pic.o $(srcdir)/ver_test_8.script gcctestdir/ld
1665 $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_8.script two_file_test_2_pic.o
1666
1667 check_PROGRAMS += ver_test_9
1668 ver_test_9_SOURCES = ver_test_main.cc
1669 ver_test_9_DEPENDENCIES = gcctestdir/ld ver_test_9.so
1670 ver_test_9_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1671 ver_test_9_LDADD = ver_test_9.so
1672 ver_test_9.so: ver_test_9.o ver_test_4.so ver_test_5.so gcctestdir/ld
1673 $(CXXLINK) -Bgcctestdir/ -shared -Wl,-R,. ver_test_9.o ver_test_5.so ver_test_4.so
1674 ver_test_9.o: ver_test_9.cc
1675 $(CXXCOMPILE) -c -fpic -o $@ $<
1676
1677 check_SCRIPTS += ver_test_10.sh
1678 check_DATA += ver_test_10.syms
1679 ver_test_10.syms: ver_test_10.so
1680 $(TEST_READELF) -s $< >$@ 2>/dev/null
1681 ver_test_10.so: gcctestdir/ld ver_test_2.o ver_test_10.script
1682 $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_10.script ver_test_2.o
1683
1684 check_PROGRAMS += ver_test_11
1685 MOSTLYCLEANFILES += ver_test_11.a
1686 ver_test_11_SOURCES = ver_test_main_2.cc
1687 ver_test_11_DEPENDENCIES = gcctestdir/ld ver_test_11.a
1688 ver_test_11_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1689 ver_test_11_LDADD = ver_test_11.a
1690 ver_test_11.a: ver_test_1.o ver_test_2.o ver_test_4.o
1691 $(TEST_AR) rc $@ $^
1692
1693 check_PROGRAMS += ver_test_12
1694 ver_test_12_SOURCES = ver_test_main_2.cc
1695 ver_test_12_DEPENDENCIES = gcctestdir/ld ver_test_12.o
1696 ver_test_12_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1697 ver_test_12_LDADD = ver_test_12.o
1698 ver_test_12.o: gcctestdir/ld ver_test_1.o ver_test_2.o ver_test_4.o
1699 gcctestdir/ld -r -o $@ ver_test_1.o ver_test_2.o ver_test_4.o
1700
1701 check_SCRIPTS += ver_test_13.sh
1702 check_DATA += ver_test_13.syms
1703 ver_test_13.syms: ver_test_13.so
1704 $(TEST_READELF) -s $< >$@ 2>/dev/null
1705 ver_test_13.so: gcctestdir/ld ver_test_13.o ver_test_13.script
1706 $(LINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_13.script ver_test_13.o
1707 ver_test_13.o: ver_test_13.c
1708 $(COMPILE) -c -fpic -o $@ $<
1709
1710 check_PROGRAMS += protected_1
1711 protected_1_SOURCES = \
1712 protected_main_1.cc protected_main_2.cc protected_main_3.cc
1713 protected_1_DEPENDENCIES = gcctestdir/ld protected_1.so
1714 protected_1_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1715 protected_1_LDADD = protected_1.so
1716
1717 protected_1.so: gcctestdir/ld protected_1_pic.o protected_2_pic.o protected_3_pic.o
1718 $(CXXLINK) -Bgcctestdir/ -shared protected_1_pic.o protected_2_pic.o protected_3_pic.o
1719 protected_1_pic.o: protected_1.cc
1720 $(CXXCOMPILE) -c -fpic -o $@ $<
1721 protected_2_pic.o: protected_2.cc
1722 $(CXXCOMPILE) -c -fpic -o $@ $<
1723 protected_3_pic.o: protected_3.cc
1724 $(CXXCOMPILE) -c -fpic -o $@ $<
1725
1726 check_PROGRAMS += protected_2
1727 protected_2_SOURCES = protected_main_1.cc protected_3.cc
1728 protected_2_DEPENDENCIES = gcctestdir/ld protected_1.so
1729 protected_2_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1730 protected_2_LDADD = protected_1.so
1731
1732 check_DATA += protected_3.err
1733 MOSTLYCLEANFILES += protected_3.err
1734 protected_4_pic.o: protected_4.cc
1735 $(CXXCOMPILE) -c -fpic -o $@ $<
1736 protected_3.err: protected_4_pic.o gcctestdir/ld
1737 @echo $(CXXLINK) -Bgcctestdir/ -shared -o protected_4.so protected_4_pic.o "2>$@"
1738 @if $(CXXLINK) -Bgcctestdir/ -shared -o protected_4.so protected_4_pic.o 2>$@; then \
1739 echo 1>&2 "Link of protected_4.so should have failed"; \
1740 rm -f $@; \
1741 exit 1; \
1742 fi
1743
1744 check_PROGRAMS += relro_test
1745 check_SCRIPTS += relro_test.sh
1746 check_DATA += relro_test.stdout
1747 relro_test_SOURCES = relro_test_main.cc
1748 relro_test_DEPENDENCIES = gcctestdir/ld relro_test.so
1749 relro_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1750 relro_test_LDADD = relro_test.so
1751 relro_test.so: gcctestdir/ld relro_test_pic.o
1752 $(CXXLINK) -Bgcctestdir/ -shared -Wl,-z,relro relro_test_pic.o
1753 relro_test_pic.o: relro_test.cc
1754 $(CXXCOMPILE) -c -fpic -o $@ $<
1755 relro_test.stdout: relro_test.so
1756 $(TEST_READELF) -SlW relro_test.so > relro_test.stdout
1757
1758 check_PROGRAMS += relro_now_test
1759 relro_now_test_SOURCES = relro_test_main.cc
1760 relro_now_test_DEPENDENCIES = gcctestdir/ld relro_now_test.so
1761 relro_now_test_LDFLAGS = -Bgcctestdir -Wl,-R,. -Wl,-z,relro -Wl,-z,now
1762 relro_now_test_LDADD = relro_now_test.so
1763 relro_now_test.so: gcctestdir/ld relro_test_pic.o
1764 $(CXXLINK) -Bgcctestdir/ -shared -Wl,-z,relro -Wl,-z,now relro_test_pic.o
1765
1766 check_PROGRAMS += relro_strip_test
1767 relro_strip_test_SOURCES = relro_test_main.cc
1768 relro_strip_test_DEPENDENCIES = gcctestdir/ld relro_strip_test.so
1769 relro_strip_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1770 relro_strip_test_LDADD = relro_strip_test.so
1771 relro_strip_test.so: relro_test.so
1772 $(TEST_STRIP) -o $@ $<
1773
1774 check_PROGRAMS += relro_script_test
1775 relro_script_test_SOURCES = relro_test_main.cc
1776 relro_script_test_DEPENDENCIES = gcctestdir/ld relro_script_test.so
1777 relro_script_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1778 relro_script_test_LDADD = relro_script_test.so
1779 relro_script_test.so: gcctestdir/ld relro_script_test.t relro_test_pic.o
1780 $(CXXLINK) -Bgcctestdir/ -shared -Wl,-z,relro -Wl,-T,$(srcdir)/relro_script_test.t relro_test_pic.o
1781
1782 check_PROGRAMS += script_test_1
1783 script_test_1_SOURCES = script_test_1a.cc script_test_1b.cc
1784 script_test_1_DEPENDENCIES = gcctestdir/ld script_test_1.t
1785 script_test_1_LDFLAGS = -Bgcctestdir/ -Wl,-R,. -Wl,-T,$(srcdir)/script_test_1.t
1786 script_test_1_LDADD =
1787
1788 check_PROGRAMS += script_test_2
1789 script_test_2_SOURCES = script_test_2.cc script_test_2a.cc script_test_2b.cc
1790 script_test_2_DEPENDENCIES = gcctestdir/ld script_test_2.t
1791 script_test_2_LDFLAGS = -Bgcctestdir/ -Wl,-R,. -Wl,-T,$(srcdir)/script_test_2.t
1792 script_test_2_LDADD =
1793
1794 check_PROGRAMS += justsyms
1795 justsyms_SOURCES = justsyms_1.cc
1796 justsyms_DEPENDENCIES = gcctestdir/ld justsyms_2r.o
1797 justsyms_LDFLAGS = -Bgcctestdir/ -Wl,-R,justsyms_2r.o
1798 justsyms_LDADD =
1799 justsyms_2.o: justsyms_2.cc
1800 $(CXXCOMPILE) -c -o $@ $<
1801 justsyms_2r.o: justsyms_2.o gcctestdir/ld $(srcdir)/justsyms.t
1802 gcctestdir/ld -o $@ -r -T $(srcdir)/justsyms.t justsyms_2.o
1803
1804 check_PROGRAMS += justsyms_exec
1805 justsyms_exec_SOURCES = justsyms_exec.c
1806 justsyms_exec_DEPENDENCIES = gcctestdir/ld justsyms_lib
1807 justsyms_exec_LDFLAGS = -Bgcctestdir/ -Wl,-R,justsyms_lib
1808 justsyms_exec_LDADD =
1809 MOSTLYCLEANFILES += justsyms_lib
1810 justsyms_lib.o: justsyms_lib.c
1811 $(COMPILE) -c -o $@ $<
1812 justsyms_lib: justsyms_lib.o gcctestdir/ld
1813 gcctestdir/ld -o $@ -Ttext=0x1000200 -Tdata=0x2000000 -e exported_func justsyms_lib.o
1814
1815 check_PROGRAMS += binary_test
1816 MOSTLYCLEANFILES += binary.txt
1817 binary_test_SOURCES = binary_test.cc
1818 binary_test_DEPENDENCIES = gcctestdir/ld binary.txt
1819 binary_test_LDFLAGS = -Bgcctestdir/ -Wl,--format,binary,binary.txt,--format,elf
1820 binary_test_LDADD =
1821 # Copy the file to the build directory to avoid worrying about the
1822 # full pathname in the generated symbols.
1823 binary.txt: $(srcdir)/binary.in
1824 rm -f $@
1825 $(LN_S) $< $@
1826
1827 check_SCRIPTS += ver_matching_test.sh
1828 check_DATA += ver_matching_test.stdout
1829 MOSTLYCLEANFILES += ver_matching_test.stdout
1830 ver_matching_def.so: ver_matching_def_pic.o $(srcdir)/version_script.map gcctestdir/ld
1831 $(CXXLINK) -O0 -Bgcctestdir/ -shared ver_matching_def_pic.o -Wl,--version-script=$(srcdir)/version_script.map
1832 ver_matching_def_pic.o: ver_matching_def.cc
1833 $(CXXCOMPILE) -O0 -c -fpic -o $@ $<
1834 ver_matching_test.stdout: ver_matching_def.so
1835 $(TEST_OBJDUMP) -T ver_matching_def.so | $(TEST_CXXFILT) > ver_matching_test.stdout
1836
1837 check_PROGRAMS += script_test_3
1838 check_SCRIPTS += script_test_3.sh
1839 check_DATA += script_test_3.stdout
1840 MOSTLYCLEANFILES += script_test_3.stdout
1841 script_test_3: basic_test.o gcctestdir/ld script_test_3.t
1842 $(CXXLINK) -Bgcctestdir/ basic_test.o -Wl,-T,$(srcdir)/script_test_3.t
1843 script_test_3.stdout: script_test_3
1844 $(TEST_READELF) -SlW script_test_3 > script_test_3.stdout
1845
1846 check_PROGRAMS += tls_phdrs_script_test
1847 tls_phdrs_script_test_SOURCES = $(tls_test_SOURCES)
1848 tls_phdrs_script_test_DEPENDENCIES = $(tls_test_DEPENDENCIES) $(srcdir)/script_test_3.t
1849 tls_phdrs_script_test_LDFLAGS = $(tls_test_LDFLAGS) -Wl,-T,$(srcdir)/script_test_3.t
1850 tls_phdrs_script_test_LDADD = $(tls_test_LDADD)
1851
1852 check_SCRIPTS += script_test_4.sh
1853 check_DATA += script_test_4.stdout
1854 MOSTLYCLEANFILES += script_test_4
1855 script_test_4: basic_test.o gcctestdir/ld $(srcdir)/script_test_4.t
1856 $(CXXLINK) -Bgcctestdir/ basic_test.o -Wl,-T,$(srcdir)/script_test_4.t
1857 script_test_4.stdout: script_test_4
1858 $(TEST_READELF) -SlW script_test_4 > script_test_4.stdout
1859
1860 check_PROGRAMS += tls_script_test
1861 tls_script_test_SOURCES = $(tls_test_SOURCES)
1862 tls_script_test_DEPENDENCIES = $(tls_test_DEPENDENCIES) $(srcdir)/script_test_4.t
1863 tls_script_test_LDFLAGS = $(tls_test_LDFLAGS) -Wl,-T,$(srcdir)/script_test_4.t
1864 tls_script_test_LDADD = $(tls_test_LDADD)
1865
1866 check_SCRIPTS += script_test_5.sh
1867 check_DATA += script_test_5.stdout
1868 MOSTLYCLEANFILES += script_test_5
1869 script_test_5: script_test_5.o gcctestdir/ld $(srcdir)/script_test_5.t
1870 $(CXXLINK) -Bgcctestdir/ script_test_5.o -Wl,-T,$(srcdir)/script_test_5.t
1871 script_test_5.stdout: script_test_5
1872 $(TEST_READELF) -SW script_test_5 > script_test_5.stdout
1873
1874 check_SCRIPTS += script_test_6.sh
1875 check_DATA += script_test_6.stdout
1876 MOSTLYCLEANFILES += script_test_6
1877 script_test_6: basic_test.o gcctestdir/ld $(srcdir)/script_test_6.t
1878 $(CXXLINK) -Bgcctestdir/ basic_test.o -Wl,-T,$(srcdir)/script_test_6.t \
1879 -Wl,-Ttext=0x10001000 -Wl,-Tdata=0x10200000 -Wl,-Tbss=0x10400000
1880 script_test_6.stdout: script_test_6
1881 $(TEST_READELF) -SlW script_test_6 > script_test_6.stdout
1882
1883 check_SCRIPTS += script_test_7.sh
1884 check_DATA += script_test_7.stdout
1885 MOSTLYCLEANFILES += script_test_7
1886 script_test_7: basic_test.o gcctestdir/ld $(srcdir)/script_test_7.t
1887 $(CXXLINK) -Bgcctestdir/ basic_test.o -Wl,-T,$(srcdir)/script_test_7.t
1888 script_test_7.stdout: script_test_7
1889 $(TEST_READELF) -SlW script_test_7 > script_test_7.stdout
1890
1891 check_SCRIPTS += script_test_8.sh
1892 check_DATA += script_test_8.stdout
1893 MOSTLYCLEANFILES += script_test_8
1894 script_test_8: basic_test.o gcctestdir/ld $(srcdir)/script_test_7.t
1895 $(CXXLINK) -Bgcctestdir/ basic_test.o -Wl,-T,$(srcdir)/script_test_7.t \
1896 -Wl,-Ttext=0x20001000 -Wl,-Tdata=0x20200000 -Wl,-Tbss=0x20400000
1897 script_test_8.stdout: script_test_8
1898 $(TEST_READELF) -SlW script_test_8 > script_test_8.stdout
1899
1900 check_SCRIPTS += script_test_9.sh
1901 check_DATA += script_test_9.stdout
1902 MOSTLYCLEANFILES += script_test_9
1903 script_test_9.o: script_test_9.cc
1904 $(CXXCOMPILE) -O0 -c -o $@ $<
1905 script_test_9: gcctestdir/ld $(srcdir)/script_test_9.t script_test_9.o
1906 $(CXXLINK) -Bgcctestdir/ script_test_9.o -Wl,-T,$(srcdir)/script_test_9.t
1907 script_test_9.stdout: script_test_9
1908 $(TEST_READELF) -lW script_test_9 > script_test_9.stdout
1909
1910 # Test scripts with a relocatable link.
1911 # The -g option is necessary to trigger a bug where a section
1912 # declared in a script file is assigned a non-zero starting address.
1913 check_PROGRAMS += script_test_11
1914 script_test_11: gcctestdir/ld script_test_11_r.o
1915 $(LINK) -Bgcctestdir/ script_test_11_r.o
1916 script_test_11_r.o: gcctestdir/ld $(srcdir)/script_test_11.t script_test_11a.o script_test_11b.o
1917 gcctestdir/ld -r -o $@ -T $(srcdir)/script_test_11.t script_test_11a.o script_test_11b.o
1918 script_test_11a.o: script_test_11a.c
1919 $(COMPILE) -c -g -o $@ $<
1920 script_test_11b.o: script_test_11b.c
1921 $(COMPILE) -c -g -o $@ $<
1922
1923 # Test difference between "*(a b)" and "*(a) *(b)" in input section spec.
1924 check_PROGRAMS += script_test_12
1925 script_test_12: gcctestdir/ld $(srcdir)/script_test_12.t script_test_12a.o script_test_12b.o
1926 $(LINK) -Bgcctestdir/ -Wl,-T,$(srcdir)/script_test_12.t script_test_12a.o script_test_12b.o
1927
1928 check_PROGRAMS += script_test_12i
1929 script_test_12i: gcctestdir/ld $(srcdir)/script_test_12i.t script_test_12a.o script_test_12b.o
1930 $(LINK) -Bgcctestdir/ -Wl,-T,$(srcdir)/script_test_12i.t script_test_12a.o script_test_12b.o
1931 script_test_12a.o: script_test_12a.c
1932 $(COMPILE) -O0 -c -o $@ $<
1933 script_test_12b.o: script_test_12b.c
1934 $(COMPILE) -O0 -c -o $@ $<
1935
1936 # Test for SORT_BY_INIT_PRIORITY.
1937 check_SCRIPTS += script_test_14.sh
1938 check_DATA += script_test_14.stdout
1939 MOSTLYCLEANFILES += script_test_14
1940 script_test_14.o: script_test_14.s
1941 $(TEST_AS) -o $@ $<
1942 script_test_14: $(srcdir)/script_test_14.t script_test_14.o gcctestdir/ld
1943 gcctestdir/ld -o $@ script_test_14.o -T $(srcdir)/script_test_14.t
1944 script_test_14.stdout: script_test_14
1945 $(TEST_OBJDUMP) -s script_test_14 > $@
1946
1947 # Test --dynamic-list, --dynamic-list-data, --dynamic-list-cpp-new,
1948 # and --dynamic-list-cpp-typeinfo
1949
1950 check_SCRIPTS += dynamic_list.sh
1951 check_DATA += dynamic_list.stdout
1952 MOSTLYCLEANFILES += dynamic_list dynamic_list.stdout
1953 dynamic_list: basic_test.o gcctestdir/ld $(srcdir)/dynamic_list.t
1954 $(CXXLINK) -Bgcctestdir/ basic_test.o \
1955 -Wl,--dynamic-list $(srcdir)/dynamic_list.t \
1956 -Wl,--dynamic-list-data \
1957 -Wl,--dynamic-list-cpp-new \
1958 -Wl,--dynamic-list-cpp-typeinfo
1959 dynamic_list.stdout: dynamic_list
1960 $(TEST_READELF) -W --dyn-syms dynamic_list > dynamic_list.stdout
1961
1962 check_PROGRAMS += dynamic_list_2
1963 dynamic_list_2_SOURCES = dynamic_list_2.cc
1964 dynamic_list_2_DEPENDENCIES = gcctestdir/ld dynamic_list_lib1.so dynamic_list_lib2.so
1965 dynamic_list_2_LDFLAGS = -Bgcctestdir/ -L. -Wl,-R,. -Wl,--no-as-needed
1966 dynamic_list_2_LDADD = dynamic_list_lib1.so dynamic_list_lib2.so
1967
1968 dynamic_list_lib1.so: gcctestdir/ld dynamic_list_lib1.o
1969 $(CXXLINK) -Bgcctestdir/ -shared dynamic_list_lib1.o
1970 dynamic_list_lib1.o: dynamic_list_lib1.cc
1971 $(CXXCOMPILE) -c -fpic -o $@ $<
1972
1973 dynamic_list_lib2.so: gcctestdir/ld dynamic_list_lib2.o $(srcdir)/dynamic_list_2.t
1974 $(CXXLINK) -Bgcctestdir/ -shared -Wl,-Bsymbolic-functions -Wl,--dynamic-list,$(srcdir)/dynamic_list_2.t dynamic_list_lib2.o
1975 dynamic_list_lib2.o: dynamic_list_lib2.cc
1976 $(CXXCOMPILE) -c -fpic -o $@ $<
1977
1978 check_PROGRAMS += thin_archive_test_1
1979 MOSTLYCLEANFILES += libthin1.a libthin3.a libthinall.a \
1980 alt/thin_archive_test_2.o alt/thin_archive_test_4.o \
1981 alt/libthin2.a alt/libthin4.a
1982 thin_archive_test_1_SOURCES = thin_archive_main.cc
1983 thin_archive_test_1_DEPENDENCIES = gcctestdir/ld libthin1.a alt/libthin2.a
1984 thin_archive_test_1_LDFLAGS = -Bgcctestdir/ -Lalt
1985 thin_archive_test_1_LDADD = libthin1.a -lthin2
1986
1987 check_PROGRAMS += thin_archive_test_2
1988 thin_archive_test_2_SOURCES = thin_archive_main.cc
1989 thin_archive_test_2_DEPENDENCIES = gcctestdir/ld libthinall.a
1990 thin_archive_test_2_LDFLAGS = -Bgcctestdir/ -L.
1991 thin_archive_test_2_LDADD = -lthinall
1992
1993 libthin1.a: thin_archive_test_1.o alt/thin_archive_test_2.o
1994 rm -f $@
1995 $(TEST_AR) crT $@ $^
1996 alt/libthin2.a: thin_archive_test_3.o alt/thin_archive_test_4.o
1997 rm -f $@
1998 $(TEST_AR) crT $@ $^
1999 libthin3.a: thin_archive_test_1.o alt/thin_archive_test_4.o
2000 rm -f $@
2001 $(TEST_AR) crT $@ $^
2002 alt/libthin4.a: alt/thin_archive_test_2.o thin_archive_test_3.o
2003 rm -f $@
2004 $(TEST_AR) crT $@ $^
2005 libthinall.a: libthin3.a alt/libthin4.a
2006 rm -f $@
2007 $(TEST_AR) crT $@ $^
2008 alt/thin_archive_test_2.o: thin_archive_test_2.cc
2009 test -d alt || mkdir -p alt
2010 $(CXXCOMPILE) -c -o $@ $<
2011 alt/thin_archive_test_4.o: thin_archive_test_4.cc
2012 test -d alt || mkdir -p alt
2013 $(CXXCOMPILE) -c -o $@ $<
2014
2015 if PLUGINS
2016
2017 check_PROGRAMS += plugin_test_1
2018 check_SCRIPTS += plugin_test_1.sh
2019 check_DATA += plugin_test_1.err
2020 MOSTLYCLEANFILES += plugin_test_1.err
2021 plugin_test_1: two_file_test_main.o two_file_test_1.o.syms two_file_test_1b.o.syms two_file_test_2.o.syms empty.o.syms gcctestdir/ld plugin_test.so
2022 $(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle,--plugin,"./plugin_test.so",--plugin-opt,"_Z4f13iv" two_file_test_main.o two_file_test_1.o.syms two_file_test_1b.o.syms two_file_test_2.o.syms empty.o.syms 2>plugin_test_1.err
2023 plugin_test_1.err: plugin_test_1
2024 @touch plugin_test_1.err
2025
2026 check_PROGRAMS += plugin_test_2
2027 check_SCRIPTS += plugin_test_2.sh
2028 check_DATA += plugin_test_2.err
2029 MOSTLYCLEANFILES += plugin_test_2.err
2030 plugin_test_2: two_file_test_main.o two_file_test_1.o.syms two_file_test_1b.o.syms two_file_shared_2.so gcctestdir/ld plugin_test.so
2031 $(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle,-R,.,--plugin,"./plugin_test.so" two_file_test_main.o two_file_test_1.o.syms two_file_test_1b.o.syms two_file_shared_2.so 2>plugin_test_2.err
2032 plugin_test_2.err: plugin_test_2
2033 @touch plugin_test_2.err
2034
2035 check_PROGRAMS += plugin_test_3
2036 check_SCRIPTS += plugin_test_3.sh
2037 check_DATA += plugin_test_3.err
2038 MOSTLYCLEANFILES += plugin_test_3.err
2039 plugin_test_3: two_file_test_main.o two_file_test_1.o.syms two_file_test_1b.o.syms two_file_test_2.o.syms empty.o.syms gcctestdir/ld plugin_test.so
2040 $(CXXLINK) -Bgcctestdir/ -Wl,--export-dynamic -Wl,--no-demangle,--plugin,"./plugin_test.so",--plugin-opt,"_Z4f13iv" two_file_test_main.o two_file_test_1.o.syms two_file_test_1b.o.syms two_file_test_2.o.syms empty.o.syms 2>plugin_test_3.err
2041 plugin_test_3.err: plugin_test_3
2042 @touch plugin_test_3.err
2043
2044 check_PROGRAMS += plugin_test_4
2045 check_SCRIPTS += plugin_test_4.sh
2046 check_DATA += plugin_test_4.err
2047 MOSTLYCLEANFILES += plugin_test_4.a plugin_test_4.err
2048 plugin_test_4: two_file_test_main.o plugin_test_4.a gcctestdir/ld plugin_test.so
2049 $(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
2050 plugin_test_4.err: plugin_test_4
2051 @touch plugin_test_4.err
2052
2053 plugin_test_4.a: two_file_test_1.o.syms two_file_test_1b.o.syms two_file_test_2.o.syms
2054 $(TEST_AR) cr $@ $^
2055
2056 check_PROGRAMS += plugin_test_5
2057 plugin_test_5: two_file_test_main.o two_file_test_1.o.syms two_file_test_1b.o.syms two_file_test_2.o.syms unused.o.syms gcctestdir/ld plugin_test.so
2058 $(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle,--plugin,"./plugin_test.so",--plugin-opt,"_Z4f13iv",--gc-sections two_file_test_main.o two_file_test_1.o.syms two_file_test_1b.o.syms two_file_test_2.o.syms unused.o.syms
2059
2060 check_PROGRAMS += plugin_test_6
2061 check_SCRIPTS += plugin_test_6.sh
2062 check_DATA += plugin_test_6.err
2063 MOSTLYCLEANFILES += plugin_test_6.err
2064 plugin_test_6: plugin_common_test_1.o.syms plugin_common_test_2.o.syms gcctestdir/ld plugin_test.so
2065 $(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle,--plugin,"./plugin_test.so" plugin_common_test_1.o.syms plugin_common_test_2.o.syms 2>plugin_test_6.err
2066 plugin_test_6.err: plugin_test_6
2067 @touch plugin_test_6.err
2068
2069 check_PROGRAMS += plugin_test_7
2070 check_SCRIPTS += plugin_test_7.sh
2071 check_DATA += plugin_test_7.err plugin_test_7.o.syms
2072 MOSTLYCLEANFILES += plugin_test_7.err
2073 plugin_test_7: plugin_test_7_1.o plugin_test_7_1.o.syms plugin_test_7_2.o gcctestdir/ld plugin_test.so
2074 $(LINK) -Bgcctestdir/ -Wl,--no-demangle,--plugin,"./plugin_test.so",--gc-sections,--print-gc-sections plugin_test_7_1.o.syms plugin_test_7_2.o 2>plugin_test_7.err
2075 plugin_test_7.o.syms: plugin_test_7
2076 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2077 plugin_test_7_1.o: plugin_test_7_1.c
2078 $(COMPILE) -DLTO -O0 -c -ffunction-sections -fdata-sections -o $@ $<
2079 plugin_test_7_1_orig.o: plugin_test_7_1.c
2080 $(COMPILE) -O0 -c -ffunction-sections -fdata-sections -o $@ $<
2081 plugin_test_7_1.o.syms: plugin_test_7_1_orig.o
2082 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2083 plugin_test_7_2.o: plugin_test_7_2.c
2084 $(COMPILE) -O0 -c -ffunction-sections -fdata-sections -o $@ $<
2085 plugin_test_7.err: plugin_test_7
2086
2087 # Test plugins with -r.
2088 check_PROGRAMS += plugin_test_8
2089 plugin_test_8.o: two_file_test_main.o two_file_test_1.o.syms two_file_test_1b.o.syms two_file_test_2.o ../ld-new plugin_test.so
2090 ../ld-new -r -o $@ --no-demangle --plugin "./plugin_test.so" two_file_test_main.o two_file_test_1.o.syms two_file_test_1b.o.syms two_file_test_2.o
2091 plugin_test_8: plugin_test_8.o gcctestdir/ld
2092 $(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle plugin_test_8.o
2093
2094 # Test that symbols known in the IR file but not in the replacement file
2095 # produce an unresolved symbol error.
2096 check_DATA += plugin_test_9.err
2097 MOSTLYCLEANFILES += plugin_test_9.err
2098 plugin_test_9.err: two_file_test_main.o two_file_test_1c.o.syms two_file_test_2.o.syms gcctestdir/ld plugin_test.so
2099 @echo $(CXXLINK) -Bgcctestdir/ -o plugin_test_9 -Wl,--no-demangle,--plugin,"./plugin_test.so" two_file_test_main.o two_file_test_1c.o.syms two_file_test_2.o.syms "2>$@"
2100 @if $(CXXLINK) -Bgcctestdir/ -o plugin_test_9 -Wl,--no-demangle,--plugin,"./plugin_test.so" two_file_test_main.o two_file_test_1c.o.syms two_file_test_2.o.syms 2>$@; then \
2101 echo 1>&2 "Link of plugin_test_9 should have failed"; \
2102 rm -f $@; \
2103 exit 1; \
2104 fi
2105 # Make a .syms file that claims to define the symbol _Z4t16av.
2106 two_file_test_1c.o.syms: two_file_test_1.o.syms two_file_test_1c.o
2107 cp two_file_test_1.o.syms $@.tmp
2108 grep "_Z4t16av" two_file_test_1b.o.syms >> $@.tmp
2109 mv -f $@.tmp $@
2110 # Make a copy of two_file_test_1.o, which does not define the symbol _Z4t16av.
2111 MOSTLYCLEANFILES += two_file_test_1c.o
2112 two_file_test_1c.o: two_file_test_1.o
2113 cp two_file_test_1.o $@
2114
2115 # As above, but check COMDAT case, where a non-IR file contains a duplicate
2116 # of a COMDAT group in an IR file.
2117 check_DATA += plugin_test_9b.err
2118 MOSTLYCLEANFILES += plugin_test_9b.err
2119 plugin_test_9b.err: plugin_test_9b_ir.o.syms plugin_test_9b_ir.o plugin_test_9b_elf.o gcctestdir/ld plugin_test.so
2120 @echo $(CXXLINK) -Bgcctestdir/ -o plugin_test_9b -Wl,--no-demangle,--plugin,"./plugin_test.so",--plugin-opt,"_ZN1A5printEv" plugin_test_9b_ir.o plugin_test_9b_elf.o "2>$@"
2121 @if $(CXXLINK) -Bgcctestdir/ -o plugin_test_9b -Wl,--no-demangle,--plugin,"./plugin_test.so",--plugin-opt,"_ZN1A5printEv" plugin_test_9b_ir.o plugin_test_9b_elf.o 2>$@; then \
2122 echo 1>&2 "Link of plugin_test_9b should have failed"; \
2123 rm -f $@; \
2124 exit 1; \
2125 fi
2126 # Make a .syms file that claims to define a method in class A in a COMDAT group.
2127 # The real plugin_test_9b_ir.o will be compiled without the -D, and will not
2128 # define any methods in class A.
2129 plugin_test_9b_ir.o.syms: plugin_test_9b_ir_witha.o
2130 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2131 plugin_test_9b_ir_witha.o: plugin_test_9b_ir.cc
2132 $(CXXCOMPILE) -c -DUSE_CLASS_A -o $@ $<
2133
2134 check_PROGRAMS += plugin_test_10
2135 check_SCRIPTS += plugin_test_10.sh
2136 check_DATA += plugin_test_10.sections
2137 MOSTLYCLEANFILES += plugin_test_10.sections
2138 plugin_test_10: plugin_common_test_1.o.syms plugin_common_test_2.o gcctestdir/ld plugin_test.so
2139 $(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle,--plugin,"./plugin_test.so" plugin_common_test_1.o.syms plugin_common_test_2.o
2140 plugin_test_10.sections: plugin_test_10
2141 $(TEST_READELF) -SW $< >$@ 2>/dev/null
2142
2143 check_PROGRAMS += plugin_test_11
2144 check_SCRIPTS += plugin_test_11.sh
2145 check_DATA += plugin_test_11.err
2146 MOSTLYCLEANFILES += plugin_test_11.err plugin_test_thin.a
2147 PLUGIN_TEST_11_SYMS = two_file_test_1.o.syms two_file_test_1b.o.syms two_file_test_2.o.syms
2148 plugin_test_11: two_file_test_main.o plugin_test_thin.a gcctestdir/ld plugin_test.so $(PLUGIN_TEST_11_SYMS)
2149 $(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle,--plugin,"./plugin_test.so",--plugin-opt,"_Z4f13iv" two_file_test_main.o plugin_test_thin.a 2>plugin_test_11.err
2150 plugin_test_11.err: plugin_test_11
2151 @touch plugin_test_11.err
2152 plugin_test_thin.a: two_file_test_1.o two_file_test_1b.o two_file_test_2.o
2153 rm -f $@
2154 $(TEST_AR) crT $@ $^
2155
2156
2157 check_PROGRAMS += plugin_test_start_lib
2158 check_SCRIPTS += plugin_test_start_lib.sh
2159 check_DATA += plugin_test_start_lib.err
2160 MOSTLYCLEANFILES += plugin_test_start_lib.err
2161 plugin_test_start_lib: unused.o plugin_start_lib_test.o plugin_start_lib_test_2.syms gcctestdir/ld plugin_test.so
2162 $(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle,--plugin,"./plugin_test.so" plugin_start_lib_test.o \
2163 -Wl,--start-lib plugin_start_lib_test_2.syms -Wl,--end-lib 2>plugin_test_start_lib.err
2164 plugin_test_start_lib.err: plugin_test_start_lib
2165 @touch plugin_test_start_lib.err
2166
2167
2168 plugin_start_lib_test_2.syms: plugin_start_lib_test_2.o
2169 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2170
2171
2172 plugin_test.so: plugin_test.o
2173 $(LINK) -Bgcctestdir/ -shared plugin_test.o
2174 plugin_test.o: plugin_test.c
2175 $(COMPILE) -O0 -c -fpic -o $@ $<
2176
2177 two_file_test_main.o.syms: two_file_test_main.o
2178 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2179 two_file_test_1.o.syms: two_file_test_1.o
2180 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2181 two_file_test_1b.o.syms: two_file_test_1b.o
2182 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2183 two_file_test_2.o.syms: two_file_test_2.o
2184 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2185 plugin_common_test_1.o.syms: plugin_common_test_1.o
2186 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2187 plugin_common_test_2.o.syms: plugin_common_test_2.o
2188 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2189
2190 empty.o.syms:
2191 @echo "" >$@
2192 @echo "Symbol table" >>$@
2193
2194 if TLS
2195
2196 check_PROGRAMS += plugin_test_tls
2197 check_SCRIPTS += plugin_test_tls.sh
2198 check_DATA += plugin_test_tls.err
2199 MOSTLYCLEANFILES += plugin_test_tls.err
2200 plugin_test_tls: two_file_test_tls.o two_file_test_1.o.syms two_file_test_1b.o.syms two_file_test_2_tls.o.syms gcctestdir/ld plugin_test.so
2201 $(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle,--plugin,"./plugin_test.so",--plugin-opt,"_Z4f13iv" two_file_test_tls.o two_file_test_1.o.syms two_file_test_1b.o.syms two_file_test_2_tls.o.syms 2>plugin_test_tls.err
2202 plugin_test_tls.err: plugin_test_tls
2203 @touch plugin_test_tls.err
2204
2205 two_file_test_2_tls.o.syms: two_file_test_2_tls.o
2206 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2207
2208 endif TLS
2209
2210 MOSTLYCLEANFILES += unused.c
2211 unused.o.syms: unused.o
2212 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2213 @echo " 1: 00000000 4 FUNC GLOBAL DEFAULT 1 UNUSED" >>$@
2214 unused.o: unused.c
2215 $(COMPILE) -c -o $@ $<
2216 unused.c:
2217 @cp /dev/null $@
2218
2219 check_SCRIPTS += plugin_final_layout.sh
2220 check_DATA += plugin_final_layout.stdout plugin_final_layout_readelf.stdout
2221 MOSTLYCLEANFILES += plugin_final_layout
2222 plugin_final_layout.o: plugin_final_layout.cc
2223 $(CXXCOMPILE) -O0 -c -ffunction-sections -fdata-sections -g -o $@ $<
2224 plugin_final_layout: plugin_final_layout.o plugin_section_order.so gcctestdir/ld
2225 $(CXXLINK) -Bgcctestdir/ -Wl,--plugin,"./plugin_section_order.so" plugin_final_layout.o
2226 plugin_final_layout.stdout: plugin_final_layout
2227 $(TEST_NM) -n --synthetic plugin_final_layout > plugin_final_layout.stdout
2228 plugin_final_layout_readelf.stdout: plugin_final_layout
2229 $(TEST_READELF) -Wl plugin_final_layout > plugin_final_layout_readelf.stdout
2230
2231 plugin_section_order.so: plugin_section_order.o
2232 $(LINK) -Bgcctestdir/ -shared plugin_section_order.o
2233 plugin_section_order.o: plugin_section_order.c
2234 $(COMPILE) -O0 -c -fpic -o $@ $<
2235
2236 check_SCRIPTS += plugin_layout_with_alignment.sh
2237 check_DATA += plugin_layout_with_alignment.stdout
2238 MOSTLYCLEANFILES += plugin_layout_with_alignment
2239 plugin_layout_with_alignment.o: plugin_layout_with_alignment.c
2240 $(COMPILE) -O0 -c -ffunction-sections -fdata-sections -g -o $@ $<
2241 plugin_layout_with_alignment: plugin_layout_with_alignment.o plugin_section_alignment.so gcctestdir/ld
2242 $(LINK) -Bgcctestdir/ -Wl,--plugin,"./plugin_section_alignment.so" plugin_layout_with_alignment.o
2243 plugin_layout_with_alignment.stdout: plugin_layout_with_alignment
2244 $(TEST_NM) -n --synthetic plugin_layout_with_alignment > plugin_layout_with_alignment.stdout
2245
2246 plugin_section_alignment.so: plugin_section_alignment.o
2247 $(CXXLINK) -Bgcctestdir/ -shared plugin_section_alignment.o
2248 plugin_section_alignment.o: plugin_section_alignment.cc
2249 $(CXXCOMPILE) -O0 -c -fpic -o $@ $<
2250
2251 endif PLUGINS
2252
2253 check_PROGRAMS += exclude_libs_test
2254 check_SCRIPTS += exclude_libs_test.sh
2255 check_DATA += exclude_libs_test.syms
2256 MOSTLYCLEANFILES += exclude_libs_test.syms libexclude_libs_test_1.a \
2257 libexclude_libs_test_2.a alt/libexclude_libs_test_3.a
2258 exclude_libs_test_SOURCES = exclude_libs_test.c
2259 exclude_libs_test_DEPENDENCIES = gcctestdir/ld libexclude_libs_test_1.a \
2260 libexclude_libs_test_2.a alt/libexclude_libs_test_3.a
2261 exclude_libs_test_LDFLAGS = -Bgcctestdir/ -L. -Lalt \
2262 -Wl,--exclude-libs,dummy:libexclude_libs_test_1 \
2263 -Wl,--exclude-libs,libexclude_libs_test_3
2264 exclude_libs_test_LDADD = -lexclude_libs_test_1 -lexclude_libs_test_2 \
2265 alt/libexclude_libs_test_3.a
2266 exclude_libs_test.syms: exclude_libs_test
2267 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2268 libexclude_libs_test_1.a: exclude_libs_test_1.o
2269 $(TEST_AR) rc $@ $^
2270 libexclude_libs_test_2.a: exclude_libs_test_2.o
2271 $(TEST_AR) rc $@ $^
2272 alt/libexclude_libs_test_3.a: exclude_libs_test_3.o
2273 test -d alt || mkdir -p alt
2274 $(TEST_AR) rc $@ $^
2275
2276 check_PROGRAMS += local_labels_test
2277 local_labels_test.o: ver_test_6.c
2278 $(COMPILE) -g -c -Wa,-L -o $@ $<
2279 local_labels_test: local_labels_test.o
2280 $(LINK) -Bgcctestdir/ local_labels_test.o
2281
2282 check_PROGRAMS += discard_locals_test
2283 check_SCRIPTS += discard_locals_test.sh
2284 check_DATA += discard_locals_test.syms \
2285 discard_locals_relocatable_test1.syms \
2286 discard_locals_relocatable_test2.syms
2287 MOSTLYCLEANFILES += discard_locals_test.syms \
2288 discard_locals_relocatable_test1.syms \
2289 discard_locals_relocatable_test2.syms \
2290 discard_locals_relocatable_test1.out \
2291 discard_locals_relocatable_test2.out
2292 discard_locals_test_SOURCES = discard_locals_test.c
2293 discard_locals_test_LDFLAGS = -Bgcctestdir/ -Wl,--discard-locals
2294 discard_locals_test.syms: discard_locals_test
2295 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2296 # '-Wa,-L' is required to preserve the local label used for testing.
2297 discard_locals_test.o: discard_locals_test.c
2298 $(COMPILE) -c -Wa,-L -o $@ $<
2299
2300 discard_locals_relocatable_test1.syms: discard_locals_relocatable_test1.out
2301 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2302 discard_locals_relocatable_test.o: discard_locals_relocatable_test.c
2303 $(COMPILE) -c -Wa,-L -fPIC -o $@ $<
2304 discard_locals_relocatable_test1.out: discard_locals_relocatable_test.o ../ld-new
2305 ../ld-new --discard-locals -relocatable -o $@ $<
2306
2307 discard_locals_relocatable_test2.syms: discard_locals_relocatable_test2.out
2308 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2309 discard_locals_relocatable_test2.out: discard_locals_relocatable_test.o ../ld-new
2310 ../ld-new --discard-all -relocatable -o $@ $<
2311
2312 if MCMODEL_MEDIUM
2313 check_PROGRAMS += large
2314 large_SOURCES = large.c
2315 large_CFLAGS = -mcmodel=medium
2316 large_DEPENDENCIES = gcctestdir/ld
2317 large_LDFLAGS = -Bgcctestdir/
2318 large_LDADD =
2319 endif MCMODEL_MEDIUM
2320
2321 # Test that hidden and internal symbols in the main program cannot be
2322 # referenced by a shared library.
2323 check_SCRIPTS += hidden_test.sh
2324 check_DATA += hidden_test.err
2325 MOSTLYCLEANFILES += hidden_test hidden_test.err hidden_test.syms
2326 libhidden.so: hidden_test_1.c gcctestdir/ld
2327 $(COMPILE) -Bgcctestdir/ -g -shared -fPIC -w -o $@ $(srcdir)/hidden_test_1.c
2328 hidden_test: hidden_test_main.o libhidden.so gcctestdir/ld
2329 $(LINK) -Bgcctestdir/ -Wl,-R,. hidden_test_main.o libhidden.so 2>hidden_test.err
2330 hidden_test.syms: hidden_test
2331 $(TEST_NM) -D hidden_test > $@
2332 hidden_test.err: hidden_test
2333 @touch hidden_test.err
2334
2335 # Test -retain-symbols-file.
2336 check_SCRIPTS += retain_symbols_file_test.sh
2337 check_DATA += retain_symbols_file_test.stdout
2338 MOSTLYCLEANFILES += retain_symbols_file_test retain_symbols_file_test.in \
2339 retain_symbols_file_test.stdout
2340 retain_symbols_file_test.so: basic_pic_test.o gcctestdir/ld
2341 echo 'main' > retain_symbols_file_test.in
2342 echo 't1' >> retain_symbols_file_test.in
2343 echo '_ZNK4t20a3getEv' >> retain_symbols_file_test.in
2344 echo '_Z3t18v' >> retain_symbols_file_test.in
2345 echo '__tcf_0' >> retain_symbols_file_test.in
2346 $(CXXLINK) -Bgcctestdir/ -shared -Wl,-retain-symbols-file,retain_symbols_file_test.in basic_pic_test.o
2347 retain_symbols_file_test.stdout: retain_symbols_file_test.so
2348 $(TEST_NM) -C retain_symbols_file_test.so > $@
2349
2350
2351 # Test that if the output file already exists and is empty,
2352 # it will get execute permission.
2353 check_PROGRAMS += permission_test
2354 permission_test: basic_test.o gcctestdir/ld
2355 umask 022; \
2356 rm -f $@; \
2357 touch $@; \
2358 chmod 600 $@; \
2359 $(CXXLINK) -Bgcctestdir/ basic_test.o
2360
2361 # Check -l:foo.a
2362 check_PROGRAMS += searched_file_test
2363 MOSTLYCLEANFILES += searched_file_test searched_file_test_lib.o \
2364 alt/searched_file_test_lib.a
2365 searched_file_test_SOURCES = searched_file_test.cc
2366 searched_file_test_DEPENDENCIES = alt/searched_file_test_lib.a
2367 searched_file_test_LDFLAGS = -Bgcctestdir/ -Lalt
2368 searched_file_test_LDADD = -l:searched_file_test_lib.a
2369 searched_file_test_lib.o: searched_file_test_lib.cc
2370 $(CXXCOMPILE) -c -o $@ $<
2371 alt/searched_file_test_lib.a: searched_file_test_lib.o
2372 test -d alt || mkdir -p alt
2373 $(TEST_AR) rc $@ $^
2374
2375 # Test that no .gnu.version sections are created when
2376 # symbol versioning is not used.
2377 check_SCRIPTS += no_version_test.sh
2378 check_DATA += no_version_test.stdout
2379 MOSTLYCLEANFILES += libno_version_test.so no_version_test.stdout
2380 # We invoke the linker directly since gcc may include additional objects that
2381 # uses symbol versioning.
2382 libno_version_test.so: no_version_test.o gcctestdir/ld
2383 gcctestdir/ld -shared -o $@ no_version_test.o
2384 no_version_test.o: no_version_test.c
2385 $(COMPILE) -o $@ -c -fPIC $<
2386 no_version_test.stdout: libno_version_test.so
2387 $(TEST_OBJDUMP) -h $< > $@
2388
2389 # Test STT_GNU_IFUNC symbols.
2390 if IFUNC
2391
2392 ifuncmod1.o: ifuncmod1.c
2393 $(COMPILE) -c -fPIC -o $@ $<
2394 ifuncmod1.so: ifuncmod1.o gcctestdir/ld
2395 $(LINK) -Bgcctestdir/ -shared ifuncmod1.o
2396
2397 ifuncdep1.o: ifuncmod1.c
2398 $(COMPILE) -c -o $@ $<
2399
2400 ifuncmain1pic.o: ifuncmain1.c
2401 $(COMPILE) -c -fPIC -o $@ $<
2402 ifuncmain1pie.o: ifuncmain1.c
2403 $(COMPILE) -c -fPIE -o $@ $<
2404
2405 if HAVE_STATIC
2406 if IFUNC_STATIC
2407 check_PROGRAMS += ifuncmain1static
2408 ifuncmain1static_SOURCES = ifuncmain1.c
2409 ifuncmain1static_DEPENDENCIES = gcctestdir/ld ifuncdep1.o
2410 ifuncmain1static_LDFLAGS = -Bgcctestdir/ -static
2411 ifuncmain1static_LDADD = ifuncdep1.o
2412
2413 check_PROGRAMS += ifuncmain1picstatic
2414 ifuncmain1picstatic: ifuncmain1pic.o ifuncmod1.o gcctestdir/ld
2415 $(LINK) -Bgcctestdir/ -static ifuncmain1pic.o ifuncmod1.o
2416 endif
2417 endif
2418
2419 check_PROGRAMS += ifuncmain1
2420 ifuncmain1_SOURCES = ifuncmain1.c
2421 ifuncmain1_DEPENDENCIES = gcctestdir/ld ifuncmod1.so
2422 ifuncmain1_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
2423 ifuncmain1_LDADD = ifuncmod1.so
2424
2425 check_PROGRAMS += ifuncmain1pic
2426 ifuncmain1pic: ifuncmain1pic.o ifuncmod1.so gcctestdir/ld
2427 $(LINK) -Bgcctestdir/ ifuncmain1pic.o ifuncmod1.so -Wl,-R,.
2428
2429 check_PROGRAMS += ifuncmain1vis
2430 ifuncmain1vis_SOURCES = ifuncmain1vis.c
2431 ifuncmain1vis_DEPENDENCIES = gcctestdir/ld ifuncmod1.so
2432 ifuncmain1vis_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
2433 ifuncmain1vis_LDADD = ifuncmod1.so
2434
2435 check_PROGRAMS += ifuncmain1vispic
2436 ifuncmain1vispic.o: ifuncmain1vis.c
2437 $(COMPILE) -c -fPIC -o $@ $<
2438 ifuncmain1vispic: ifuncmain1vispic.o ifuncmod1.so gcctestdir/ld
2439 $(LINK) -Bgcctestdir/ ifuncmain1pic.o ifuncmod1.so -Wl,-R,.
2440
2441 check_PROGRAMS += ifuncmain1staticpic
2442 ifuncmain1staticpic: ifuncmain1pic.o ifuncmod1.o gcctestdir/ld
2443 $(LINK) -Bgcctestdir/ ifuncmain1pic.o ifuncmod1.o
2444
2445 check_PROGRAMS += ifuncmain1pie
2446 ifuncmain1pie: ifuncmain1pie.o ifuncmod1.so gcctestdir/ld
2447 $(LINK) -Bgcctestdir/ -pie ifuncmain1pie.o ifuncmod1.so -Wl,-R,.
2448
2449 check_PROGRAMS += ifuncmain1vispie
2450 ifuncmain1vispie.o: ifuncmain1vis.c
2451 $(COMPILE) -c -fPIE -o $@ $<
2452 ifuncmain1vispie: ifuncmain1vispie.o ifuncmod1.so gcctestdir/ld
2453 $(LINK) -Bgcctestdir/ -pie ifuncmain1vispie.o ifuncmod1.so -Wl,-R,.
2454
2455 check_PROGRAMS += ifuncmain1staticpie
2456 ifuncmain1staticpie: ifuncmain1pie.o ifuncmod1.o gcctestdir/ld
2457 $(LINK) -Bgcctestdir/ -pie ifuncmain1pie.o ifuncmod1.o
2458
2459 ifuncmain2pic.o: ifuncmain2.c
2460 $(COMPILE) -c -fPIC -o $@ $<
2461
2462 ifuncdep2pic.o: ifuncdep2.c
2463 $(COMPILE) -c -fPIC -o $@ $<
2464
2465 if HAVE_STATIC
2466 if IFUNC_STATIC
2467 check_PROGRAMS += ifuncmain2static
2468 ifuncmain2static_SOURCES = ifuncmain2.c ifuncdep2.c
2469 ifuncmain2static_DEPENDENCIES = gcctestdir/ld
2470 ifuncmain2static_LDFLAGS = -Bgcctestdir/ -static
2471 ifuncmain2static_LDADD =
2472
2473 check_PROGRAMS += ifuncmain2picstatic
2474 ifuncmain2picstatic: ifuncmain2pic.o ifuncdep2pic.o gcctestdir/ld
2475 $(LINK) -Bgcctestdir/ -static ifuncmain2pic.o ifuncdep2pic.o
2476 endif
2477 endif
2478
2479 check_PROGRAMS += ifuncmain2
2480 ifuncmain2_SOURCES = ifuncmain2.c ifuncdep2.c
2481 ifuncmain2_DEPENDENCIES = gcctestdir/ld
2482 ifuncmain2_LDFLAGS = -Bgcctestdir/
2483 ifuncmain2_LDADD =
2484
2485 check_PROGRAMS += ifuncmain2pic
2486 ifuncmain2pic: ifuncmain2pic.o ifuncdep2pic.o gcctestdir/ld
2487 $(LINK) -Bgcctestdir/ ifuncmain2pic.o ifuncdep2pic.o
2488
2489 ifuncmod3.o: ifuncmod3.c
2490 $(COMPILE) -c -fPIC -o $@ $<
2491 ifuncmod3.so: ifuncmod3.o gcctestdir/ld
2492 $(LINK) -Bgcctestdir/ -shared ifuncmod3.o
2493
2494 check_PROGRAMS += ifuncmain3
2495 ifuncmain3_SOURCES = ifuncmain3.c
2496 ifuncmain3_DEPENDENCIES = gcctestdir/ld ifuncmod3.so
2497 ifuncmain3_LDFLAGS = -Bgcctestdir/ -Wl,--export-dynamic -Wl,-R,.
2498 ifuncmain3_LDADD = -ldl
2499
2500 ifuncmain4pic.o: ifuncmain4.c
2501 $(COMPILE) -c -fPIC -o $@ $<
2502
2503 if HAVE_STATIC
2504 if IFUNC_STATIC
2505 check_PROGRAMS += ifuncmain4static
2506 ifuncmain4static_SOURCES = ifuncmain4.c
2507 ifuncmain4static_DEPENDENCIES = gcctestdir/ld
2508 ifuncmain4static_LDFLAGS = -Bgcctestdir/ -static
2509 ifuncmain4static_LDADD =
2510
2511 check_PROGRAMS += ifuncmain4picstatic
2512 ifuncmain4picstatic: ifuncmain4pic.o gcctestdir/ld
2513 $(LINK) -Bgcctestdir/ -static ifuncmain4pic.o
2514 endif
2515 endif
2516
2517 check_PROGRAMS += ifuncmain4
2518 ifuncmain4_SOURCES = ifuncmain4.c
2519 ifuncmain4_DEPENDENCIES = gcctestdir/ld
2520 ifuncmain4_LDFLAGS = -Bgcctestdir/
2521 ifuncmain4_LDADD =
2522
2523 ifuncmain5pic.o: ifuncmain5.c
2524 $(COMPILE) -c -fPIC -o $@ $<
2525
2526 ifuncmain5pie.o: ifuncmain5.c
2527 $(COMPILE) -c -fPIE -o $@ $<
2528
2529 ifuncmod5.o: ifuncmod5.c
2530 $(COMPILE) -c -fPIC -o $@ $<
2531 ifuncmod5.so: ifuncmod5.o gcctestdir/ld
2532 $(LINK) -Bgcctestdir/ -shared ifuncmod5.o
2533
2534 ifuncdep5.o: ifuncmod5.c
2535 $(COMPILE) -c -o $@ $<
2536
2537 if HAVE_STATIC
2538 if IFUNC_STATIC
2539 check_PROGRAMS += ifuncmain5static
2540 ifuncmain5static_SOURCES = ifuncmain5.c
2541 ifuncmain5static_DEPENDENCIES = gcctestdir/ld ifuncdep5.o
2542 ifuncmain5static_LDFLAGS = -Bgcctestdir/ -static
2543 ifuncmain5static_LDADD = ifuncdep5.o
2544
2545 check_PROGRAMS += ifuncmain5picstatic
2546 ifuncmain5picstatic: ifuncmain5pic.o ifuncmod5.o gcctestdir/ld
2547 $(LINK) -Bgcctestdir/ -static ifuncmain5pic.o ifuncmod5.o
2548 endif
2549 endif
2550
2551 check_PROGRAMS += ifuncmain5
2552 ifuncmain5_SOURCES = ifuncmain5.c
2553 ifuncmain5_DEPENDENCIES = gcctestdir/ld ifuncmod5.so
2554 ifuncmain5_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
2555 ifuncmain5_LDADD = ifuncmod5.so
2556
2557 check_PROGRAMS += ifuncmain5pic
2558 ifuncmain5pic: ifuncmain5pic.o ifuncmod5.so gcctestdir/ld
2559 $(LINK) -Bgcctestdir/ ifuncmain5pic.o ifuncmod5.so -Wl,-R,.
2560
2561 check_PROGRAMS += ifuncmain5staticpic
2562 ifuncmain5staticpic: ifuncmain5pic.o ifuncmod5.o gcctestdir/ld
2563 $(LINK) -Bgcctestdir/ ifuncmain5pic.o ifuncmod5.o
2564
2565 check_PROGRAMS += ifuncmain5pie
2566 ifuncmain5pie: ifuncmain5pie.o ifuncmod5.so gcctestdir/ld
2567 $(LINK) -Bgcctestdir/ -pie ifuncmain5pie.o ifuncmod5.so -Wl,-R,.
2568
2569 ifuncmain6pie.o: ifuncmain6pie.c
2570 $(COMPILE) -c -fPIE -o $@ $<
2571
2572 ifuncmod6.o: ifuncmod6.c
2573 $(COMPILE) -c -fPIC -o $@ $<
2574 ifuncmod6.so: ifuncmod6.o gcctestdir/ld
2575 $(LINK) -Bgcctestdir/ -shared ifuncmod6.o
2576
2577 check_PROGRAMS += ifuncmain6pie
2578 ifuncmain6pie: ifuncmain6pie.o ifuncmod6.so gcctestdir/ld
2579 $(LINK) -Bgcctestdir/ -pie ifuncmain6pie.o ifuncmod6.so -Wl,-R,.
2580
2581 ifuncmain7pic.o: ifuncmain7.c
2582 $(COMPILE) -c -fPIC -o $@ $<
2583
2584 ifuncmain7pie.o: ifuncmain7.c
2585 $(COMPILE) -c -fPIE -o $@ $<
2586
2587 if HAVE_STATIC
2588 if IFUNC_STATIC
2589 check_PROGRAMS += ifuncmain7static
2590 ifuncmain7static_SOURCES = ifuncmain7.c
2591 ifuncmain7static_DEPENDENCIES = gcctestdir/ld
2592 ifuncmain7static_LDFLAGS = -Bgcctestdir/ -static
2593 ifuncmain7static_LDADD =
2594
2595 check_PROGRAMS += ifuncmain7picstatic
2596 ifuncmain7picstatic: ifuncmain7pic.o gcctestdir/ld
2597 $(LINK) -Bgcctestdir/ -static ifuncmain7pic.o
2598 endif
2599 endif
2600
2601 check_PROGRAMS += ifuncmain7
2602 ifuncmain7_SOURCES = ifuncmain7.c
2603 ifuncmain7_DEPENDENCIES = gcctestdir/ld
2604 ifuncmain7_LDFLAGS = -Bgcctestdir/
2605 ifuncmain7_LDADD =
2606
2607 check_PROGRAMS += ifuncmain7pic
2608 ifuncmain7pic: ifuncmain7pic.o gcctestdir/ld
2609 $(LINK) -Bgcctestdir/ ifuncmain7pic.o
2610
2611 check_PROGRAMS += ifuncmain7pie
2612 ifuncmain7pie: ifuncmain7pie.o gcctestdir/ld
2613 $(LINK) -Bgcctestdir/ -pie ifuncmain7pie.o
2614
2615 check_PROGRAMS += ifuncvar
2616 ifuncvar1_pic.o: ifuncvar1.c
2617 $(COMPILE) -c -fPIC -o $@ $<
2618 ifuncvar2_pic.o: ifuncvar2.c
2619 $(COMPILE) -c -fPIC -o $@ $<
2620 ifuncvar.so: ifuncvar1_pic.o ifuncvar2_pic.o gcctestdir/ld
2621 $(LINK) -Bgcctestdir/ -shared ifuncvar1_pic.o ifuncvar2_pic.o
2622 ifuncvar_SOURCES = ifuncvar3.c
2623 ifuncvar_DEPENDENCIES = gcctestdir/ld ifuncvar.so
2624 ifuncvar_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
2625 ifuncvar_LDADD = ifuncvar.so
2626
2627 endif IFUNC
2628
2629 # Test that strong reference to a weak symbol in a DSO remains strong.
2630 check_SCRIPTS += strong_ref_weak_def.sh
2631 check_DATA += strong_ref_weak_def.stdout
2632 MOSTLYCLEANFILES += strong_ref_weak_def_1.so strong_ref_weak_def_2.so \
2633 strong_ref_weak_def.stdout
2634 strong_ref_weak_def_2.o: strong_ref_weak_def_2.c
2635 $(COMPILE) -o $@ -c -fPIC $<
2636 strong_ref_weak_def_2.so: strong_ref_weak_def_2.o gcctestdir/ld
2637 gcctestdir/ld -shared -o $@ strong_ref_weak_def_2.o
2638 strong_ref_weak_def_1.o: strong_ref_weak_def_1.c
2639 $(COMPILE) -o $@ -c -fPIC $<
2640 strong_ref_weak_def_1.so: strong_ref_weak_def_1.o strong_ref_weak_def_2.so \
2641 gcctestdir/ld
2642 gcctestdir/ld -shared -o $@ strong_ref_weak_def_1.o \
2643 strong_ref_weak_def_2.so
2644 strong_ref_weak_def.stdout: strong_ref_weak_def_1.so
2645 $(TEST_READELF) -sWD $< > $@
2646
2647 # Test that a strong weak reference remains strong if there is another
2648 # weak reference in a DSO.
2649 check_SCRIPTS += dyn_weak_ref.sh
2650 check_DATA += dyn_weak_ref.stdout
2651 MOSTLYCLEANFILES += dyn_weak_ref_1.so dyn_weak_ref_2.so \
2652 dyn_weak_ref.stdout
2653 dyn_weak_ref_2.o: dyn_weak_ref_2.c
2654 $(COMPILE) -o $@ -c -fPIC $<
2655 dyn_weak_ref_2.so: dyn_weak_ref_2.o gcctestdir/ld
2656 gcctestdir/ld -shared -o $@ dyn_weak_ref_2.o
2657 dyn_weak_ref_1.o: dyn_weak_ref_1.c
2658 $(COMPILE) -o $@ -c -fPIC $<
2659 # We intentionally put dyn_weak_ref_2.so in front of dyn_weak_ref_1.o
2660 # so that the weak ref there goes to gold's symbol table first.
2661 dyn_weak_ref_1.so: dyn_weak_ref_1.o dyn_weak_ref_2.so gcctestdir/ld
2662 gcctestdir/ld -shared -o $@ dyn_weak_ref_2.so dyn_weak_ref_1.o
2663 dyn_weak_ref.stdout: dyn_weak_ref_1.so
2664 $(TEST_READELF) -sWD $< > $@
2665
2666
2667 # Test that --start-lib and --end-lib function correctly.
2668 check_PROGRAMS += start_lib_test
2669 MOSTLYCLEANFILES += libstart_lib_test.a
2670 start_lib_test: start_lib_test_main.o libstart_lib_test.a start_lib_test_2.o start_lib_test_3.o \
2671 gcctestdir/ld
2672 $(LINK) -Bgcctestdir/ -o $@ start_lib_test_main.o -L. -lstart_lib_test \
2673 -Wl,--start-lib start_lib_test_2.o start_lib_test_3.o -Wl,--end-lib
2674 libstart_lib_test.a: start_lib_test_1.o
2675 $(TEST_AR) rc $@ $^
2676
2677 # Test that MEMORY region support works.
2678 check_SCRIPTS += memory_test.sh
2679 check_DATA += memory_test.stdout
2680 MOSTLYCLEANFILES += memory_test.stdout memory_test memory_test.o
2681 memory_test.o: memory_test.s
2682 $(COMPILE) -o $@ -c $<
2683 memory_test: memory_test.o gcctestdir/ld $(srcdir)/memory_test.t
2684 $(LINK) -Bgcctestdir/ -nostartfiles -nostdlib -z max-page-size=0x1000 -z common-page-size=0x1000 -Wl,-T,$(srcdir)/memory_test.t -o $@ memory_test.o
2685 memory_test.stdout: memory_test
2686 $(TEST_READELF) -lWS $< > $@
2687
2688 # Test INCLUDE directives in linker scripts.
2689 # The binary isn't runnable, so we just check that we can build it without errors.
2690 check_DATA += memory_test_2
2691 MOSTLYCLEANFILES += memory_test_inc_1.t memory_test_inc_2.t memory_test_inc_3.t memory_test_2
2692 memory_test_inc_1.t: $(srcdir)/memory_test_inc_1.t.src
2693 cp $< $@
2694 memory_test_inc_2.t: $(srcdir)/memory_test_inc_2.t.src
2695 cp $< $@
2696 memory_test_inc_3.t: $(srcdir)/memory_test_inc_3.t.src
2697 cp $< $@
2698 memory_test_2: memory_test.o gcctestdir/ld $(srcdir)/memory_test.t memory_test_inc_1.t memory_test_inc_2.t memory_test_inc_3.t
2699 $(LINK) -Bgcctestdir/ -nostartfiles -nostdlib -z max-page-size=0x1000 -z common-page-size=0x1000 -Wl,-T,$(srcdir)/memory_test.t -o $@ memory_test.o
2700
2701 if HAVE_PUBNAMES
2702
2703 # Test that --gdb-index functions correctly without gcc-generated pubnames.
2704 check_SCRIPTS += gdb_index_test_1.sh
2705 check_DATA += gdb_index_test_1.stdout
2706 MOSTLYCLEANFILES += gdb_index_test_1.stdout gdb_index_test_1
2707 gdb_index_test.o: gdb_index_test.cc
2708 $(CXXCOMPILE) -O0 -g -gno-pubnames -c -o $@ $<
2709 gdb_index_test_1: gdb_index_test.o gcctestdir/ld
2710 $(CXXLINK) -Bgcctestdir/ -Wl,--gdb-index $<
2711 gdb_index_test_1.stdout: gdb_index_test_1
2712 $(TEST_READELF) --debug-dump=gdb_index $< > $@
2713
2714 # Test that --gdb-index functions correctly with compressed debug sections.
2715 check_SCRIPTS += gdb_index_test_2.sh
2716 check_DATA += gdb_index_test_2.stdout
2717 MOSTLYCLEANFILES += gdb_index_test_2.stdout gdb_index_test_2 gdb_index_test_2_gabi
2718 gdb_index_test_cdebug.o: gdb_index_test.cc
2719 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -Wa,--compress-debug-sections -c -o $@ $<
2720 gdb_index_test_2: gdb_index_test_cdebug.o gcctestdir/ld
2721 $(CXXLINK) -Bgcctestdir/ -Wl,--gdb-index $<
2722 gdb_index_test_2.stdout: gdb_index_test_2
2723 $(TEST_READELF) --debug-dump=gdb_index $< > $@
2724 check_SCRIPTS += gdb_index_test_2_gabi.sh
2725 check_DATA += gdb_index_test_2_gabi.stdout
2726 MOSTLYCLEANFILES += gdb_index_test_2.stdout gdb_index_test_2
2727 gdb_index_test_cdebug_gabi.o: gdb_index_test.cc
2728 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -Wa,--compress-debug-sections=zlib-gabi -c -o $@ $<
2729 gdb_index_test_2_gabi: gdb_index_test_cdebug_gabi.o gcctestdir/ld
2730 $(CXXLINK) -Bgcctestdir/ -Wl,--gdb-index $<
2731 gdb_index_test_2_gabi.stdout: gdb_index_test_2_gabi
2732 $(TEST_READELF) --debug-dump=gdb_index $< > $@
2733
2734 # Another simple C test (DW_AT_high_pc encoding) for --gdb-index.
2735 check_SCRIPTS += gdb_index_test_3.sh
2736 check_DATA += gdb_index_test_3.stdout
2737 MOSTLYCLEANFILES += gdb_index_test_3.stdout gdb_index_test_3
2738 gdb_index_test_3.o: gdb_index_test_3.c
2739 $(COMPILE) -O0 -g -c -o $@ $<
2740 gdb_index_test_3: gdb_index_test_3.o gcctestdir/ld
2741 $(LINK) -Bgcctestdir/ -Wl,--gdb-index,--fatal-warnings $<
2742 gdb_index_test_3.stdout: gdb_index_test_3
2743 $(TEST_READELF) --debug-dump=gdb_index $< > $@
2744
2745 # Test that --gdb-index functions correctly with gcc-generated pubnames.
2746 check_SCRIPTS += gdb_index_test_4.sh
2747 check_DATA += gdb_index_test_4.stdout
2748 MOSTLYCLEANFILES += gdb_index_test_4.stdout gdb_index_test_4
2749 gdb_index_test_pub.o: gdb_index_test.cc
2750 $(CXXCOMPILE) -O0 -g -gpubnames -c -o $@ $<
2751 gdb_index_test_4: gdb_index_test_pub.o gcctestdir/ld
2752 $(CXXLINK) -Bgcctestdir/ -Wl,--gdb-index $<
2753 gdb_index_test_4.stdout: gdb_index_test_4
2754 $(TEST_READELF) --debug-dump=gdb_index $< > $@
2755
2756 endif HAVE_PUBNAMES
2757
2758 # Test that __ehdr_start is defined correctly.
2759 check_PROGRAMS += ehdr_start_test_1
2760 ehdr_start_test_1_SOURCES = ehdr_start_test.cc
2761 ehdr_start_test_1_DEPENDENCIES = gcctestdir/ld
2762 ehdr_start_test_1_CXXFLAGS =
2763 ehdr_start_test_1_LDFLAGS = -Bgcctestdir/
2764 ehdr_start_test_1_LDADD =
2765
2766 # Test that __ehdr_start is defined correctly with a weak reference.
2767 check_PROGRAMS += ehdr_start_test_2
2768 ehdr_start_test_2_SOURCES = ehdr_start_test.cc
2769 ehdr_start_test_2_DEPENDENCIES = gcctestdir/ld
2770 ehdr_start_test_2_CXXFLAGS = -DEHDR_START_WEAK
2771 ehdr_start_test_2_LDFLAGS = -Bgcctestdir/
2772 ehdr_start_test_2_LDADD =
2773
2774 # Test that __ehdr_start is defined correctly when used with a linker script.
2775 check_PROGRAMS += ehdr_start_test_3
2776 ehdr_start_test_3_SOURCES = ehdr_start_test.cc
2777 ehdr_start_test_3_DEPENDENCIES = gcctestdir/ld $(srcdir)/ehdr_start_test.t
2778 ehdr_start_test_3_CXXFLAGS = -DEHDR_START_WEAK
2779 ehdr_start_test_3_LDFLAGS = -Bgcctestdir/ -Wl,-T,$(srcdir)/ehdr_start_test.t
2780 ehdr_start_test_3_LDADD =
2781
2782 # Test that __ehdr_start is left undefined when the text segment is not
2783 # appropriately aligned.
2784 check_SCRIPTS += ehdr_start_test_4.sh
2785 check_DATA += ehdr_start_test_4.syms
2786 MOSTLYCLEANFILES += ehdr_start_test_4
2787 ehdr_start_test_4.syms: ehdr_start_test_4
2788 $(TEST_NM) ehdr_start_test_4 > $@
2789 ehdr_start_test_4: ehdr_start_test_4.o gcctestdir/ld
2790 $(CXXLINK) -Bgcctestdir/ -Wl,-Ttext=0x100100 $<
2791 ehdr_start_test_4.o: ehdr_start_test.cc
2792 $(CXXCOMPILE) -c -DEHDR_START_WEAK -o $@ $<
2793
2794 # Test that __ehdr_start is not overridden when supplied by the user.
2795 check_PROGRAMS += ehdr_start_test_5
2796 ehdr_start_test_5_SOURCES = ehdr_start_test.cc ehdr_start_def.cc
2797 ehdr_start_test_5_DEPENDENCIES = gcctestdir/ld
2798 ehdr_start_test_5_CXXFLAGS = -DEHDR_START_USER_DEF
2799 ehdr_start_test_5_LDFLAGS = -Bgcctestdir/
2800 ehdr_start_test_5_LDADD =
2801
2802 # Test that the --defsym option copies the symbol type and visibility.
2803 check_SCRIPTS += defsym_test.sh
2804 check_DATA += defsym_test.syms
2805 MOSTLYCLEANFILES += defsym_test defsym_test.syms
2806 defsym_test.syms: defsym_test
2807 $(TEST_READELF) -sW $< > $@
2808 defsym_test: defsym_test.o gcctestdir/ld
2809 $(LINK) -Bgcctestdir/ -Wl,--defsym=bar=foo defsym_test.o
2810 defsym_test.o: defsym_test.c
2811 $(COMPILE) -c -o $@ $<
2812
2813 # End-to-end incremental linking tests.
2814 # Incremental linking is currently supported only on the x86_64 target.
2815
2816 if DEFAULT_TARGET_X86_64
2817
2818 two_file_test_1_v1_ndebug.o: two_file_test_1_v1.cc
2819 $(CXXCOMPILE) -O0 -g0 -c -o $@ $<
2820 two_file_test_1_ndebug.o: two_file_test_1.cc
2821 $(CXXCOMPILE) -O0 -g0 -c -o $@ $<
2822 two_file_test_1b_ndebug.o: two_file_test_1b.cc
2823 $(CXXCOMPILE) -O0 -g0 -c -o $@ $<
2824 two_file_test_2_ndebug.o: two_file_test_2.cc
2825 $(CXXCOMPILE) -O0 -g0 -c -o $@ $<
2826 two_file_test_main_ndebug.o: two_file_test_main.cc
2827 $(CXXCOMPILE) -O0 -g0 -c -o $@ $<
2828
2829 check_PROGRAMS += incremental_test_2
2830 MOSTLYCLEANFILES += two_file_test_tmp_2.o
2831 incremental_test_2: two_file_test_1_v1_ndebug.o two_file_test_1_ndebug.o two_file_test_1b_ndebug.o \
2832 two_file_test_2_ndebug.o two_file_test_main_ndebug.o gcctestdir/ld
2833 cp -f two_file_test_1_v1_ndebug.o two_file_test_tmp_2.o
2834 $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Wl,-z,norelro -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
2835 @sleep 1
2836 cp -f two_file_test_1_ndebug.o two_file_test_tmp_2.o
2837 $(CXXLINK) -Wl,--incremental-update -Wl,-z,norelro -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
2838
2839 check_PROGRAMS += incremental_test_3
2840 MOSTLYCLEANFILES += two_file_test_tmp_3.o
2841 incremental_test_3: two_file_test_1.o two_file_test_1b_v1.o two_file_test_1b.o \
2842 two_file_test_2.o two_file_test_main.o gcctestdir/ld
2843 cp -f two_file_test_1b_v1.o two_file_test_tmp_3.o
2844 $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Wl,-z,norelro -Bgcctestdir/ two_file_test_1.o two_file_test_tmp_3.o two_file_test_2.o two_file_test_main.o
2845 @sleep 1
2846 cp -f two_file_test_1b.o two_file_test_tmp_3.o
2847 $(CXXLINK) -Wl,--incremental-update -Wl,-z,norelro -Bgcctestdir/ two_file_test_1.o two_file_test_tmp_3.o two_file_test_2.o two_file_test_main.o
2848
2849 check_PROGRAMS += incremental_test_4
2850 MOSTLYCLEANFILES += incremental_test_4.base two_file_test_tmp_4.o
2851 incremental_test_4: two_file_test_1.o two_file_test_1b.o two_file_test_2_v1.o \
2852 two_file_test_2.o two_file_test_main.o gcctestdir/ld
2853 cp -f two_file_test_2_v1.o two_file_test_tmp_4.o
2854 $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Wl,-z,norelro -Bgcctestdir/ two_file_test_1.o two_file_test_1b.o two_file_test_tmp_4.o two_file_test_main.o
2855 mv -f incremental_test_4 incremental_test_4.base
2856 @sleep 1
2857 cp -f two_file_test_2.o two_file_test_tmp_4.o
2858 $(CXXLINK) -Wl,--incremental-update,--incremental-base=incremental_test_4.base -Wl,-z,norelro -Bgcctestdir/ two_file_test_1.o two_file_test_1b.o two_file_test_tmp_4.o two_file_test_main.o
2859
2860 check_PROGRAMS += incremental_test_5
2861 MOSTLYCLEANFILES += two_file_test_5.a
2862 incremental_test_5: two_file_test_1.o two_file_test_1b_v1.o two_file_test_1b.o \
2863 two_file_test_2.o two_file_test_main.o gcctestdir/ld
2864 cp -f two_file_test_1b_v1.o two_file_test_tmp_5.o
2865 $(TEST_AR) rc two_file_test_5.a two_file_test_1.o two_file_test_tmp_5.o two_file_test_2.o
2866 $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Wl,-z,norelro -Bgcctestdir/ two_file_test_main.o two_file_test_5.a
2867 @sleep 1
2868 cp -f two_file_test_1b.o two_file_test_tmp_5.o
2869 $(TEST_AR) rc two_file_test_5.a two_file_test_1.o two_file_test_tmp_5.o two_file_test_2.o
2870 $(CXXLINK) -Wl,--incremental-update -Wl,-z,norelro -Bgcctestdir/ two_file_test_main.o two_file_test_5.a
2871
2872 # Test the --incremental-unchanged flag with an archive library.
2873 # The second link should not update the library.
2874 check_PROGRAMS += incremental_test_6
2875 MOSTLYCLEANFILES += two_file_test_6.a
2876 incremental_test_6: two_file_test_1.o two_file_test_1b_v1.o two_file_test_1b.o \
2877 two_file_test_2.o two_file_test_main.o gcctestdir/ld
2878 cp -f two_file_test_1b.o two_file_test_tmp_6.o
2879 $(TEST_AR) rc two_file_test_6.a two_file_test_1.o two_file_test_tmp_6.o two_file_test_2.o
2880 $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Wl,-z,norelro -Bgcctestdir/ two_file_test_main.o two_file_test_6.a
2881 @sleep 1
2882 cp -f two_file_test_1b_v1.o two_file_test_tmp_6.o
2883 $(TEST_AR) rc two_file_test_6.a two_file_test_1.o two_file_test_tmp_6.o two_file_test_2.o
2884 $(CXXLINK) -Wl,--incremental-update -Wl,-z,norelro -Bgcctestdir/ two_file_test_main.o -Wl,--incremental-unchanged two_file_test_6.a -Wl,--incremental-unknown
2885
2886 check_PROGRAMS += incremental_copy_test
2887 incremental_copy_test: copy_test_v1.o copy_test.o copy_test_1.so copy_test_2.so
2888 cp -f copy_test_v1.o copy_test_tmp.o
2889 $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Wl,-z,norelro -Bgcctestdir/ -Wl,-R,. -Wl,--no-as-needed copy_test_tmp.o copy_test_1.so copy_test_2.so
2890 @sleep 1
2891 cp -f copy_test.o copy_test_tmp.o
2892 $(CXXLINK) -Wl,--incremental-update -Wl,-z,norelro -Bgcctestdir/ -Wl,-R,. -Wl,--no-as-needed copy_test_tmp.o copy_test_1.so copy_test_2.so
2893
2894 check_PROGRAMS += incremental_common_test_1
2895 incremental_common_test_1: common_test_1_v1.o common_test_1_v2.o gcctestdir/ld
2896 cp -f common_test_1_v1.o common_test_1_tmp.o
2897 $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Wl,-z,norelro -Bgcctestdir/ common_test_1_tmp.o
2898 @sleep 1
2899 cp -f common_test_1_v2.o common_test_1_tmp.o
2900 $(CXXLINK) -Wl,--incremental-update -Wl,-z,norelro -Bgcctestdir/ common_test_1_tmp.o
2901
2902 check_PROGRAMS += incremental_comdat_test_1
2903 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
2904 cp -f incr_comdat_test_2_v1.o incr_comdat_test_1_tmp.o
2905 $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Wl,-z,norelro -Bgcctestdir/ incr_comdat_test_1.o incr_comdat_test_1_tmp.o
2906 @sleep 1
2907 cp -f incr_comdat_test_2_v2.o incr_comdat_test_1_tmp.o
2908 $(CXXLINK) -Wl,--incremental-update -Wl,-z,norelro -Bgcctestdir/ incr_comdat_test_1.o incr_comdat_test_1_tmp.o
2909 @sleep 1
2910 cp -f incr_comdat_test_2_v3.o incr_comdat_test_1_tmp.o
2911 $(CXXLINK) -Wl,--incremental-update -Wl,-z,norelro -Bgcctestdir/ incr_comdat_test_1.o incr_comdat_test_1_tmp.o
2912
2913 endif DEFAULT_TARGET_X86_64
2914
2915 if DEFAULT_TARGET_X86_64
2916 check_PROGRAMS += exception_x86_64_bnd_test
2917 exception_x86_64_bnd_test_SOURCES = exception_test_main.cc
2918 exception_x86_64_bnd_test_DEPENDENCIES = gcctestdir/ld exception_x86_64_bnd_1.o exception_x86_64_bnd_2.o
2919 exception_x86_64_bnd_test_LDFLAGS = $(exception_test_LDFLAGS)
2920 exception_x86_64_bnd_test_LDADD = exception_x86_64_bnd_1.o exception_x86_64_bnd_2.o
2921 exception_x86_64_bnd_1.o: exception_test_1.cc gcctestdir/as
2922 $(CXXCOMPILE) -c -fpic -Bgcctestdir/ -Wa,-madd-bnd-prefix -o $@ $<
2923 exception_x86_64_bnd_2.o: exception_test_2.cc gcctestdir/as
2924 $(CXXCOMPILE) -c -Bgcctestdir/ -Wa,-madd-bnd-prefix -o $@ $<
2925 endif DEFAULT_TARGET_X86_64
2926
2927 endif GCC
2928 endif NATIVE_LINKER
2929
2930 # These tests work with native and cross linkers.
2931
2932 if NATIVE_OR_CROSS_LINKER
2933
2934 # Test script section order.
2935 check_SCRIPTS += script_test_10.sh
2936 check_DATA += script_test_10.stdout
2937 MOSTLYCLEANFILES += script_test_10
2938 script_test_10.o: script_test_10.s
2939 $(TEST_AS) -o $@ $<
2940 script_test_10: $(srcdir)/script_test_10.t script_test_10.o gcctestdir/ld
2941 gcctestdir/ld -o $@ script_test_10.o -T $(srcdir)/script_test_10.t
2942 script_test_10.stdout: script_test_10
2943 $(TEST_READELF) -SW script_test_10 > $@
2944
2945 # These tests work with cross linkers only.
2946
2947 if DEFAULT_TARGET_I386
2948
2949 check_SCRIPTS += split_i386.sh
2950 check_DATA += split_i386_1.stdout split_i386_2.stdout \
2951 split_i386_3.stdout split_i386_4.stdout split_i386_r.stdout
2952 SPLIT_DEFSYMS = --defsym __morestack=0x100 --defsym __morestack_non_split=0x200
2953 split_i386_1.o: split_i386_1.s
2954 $(TEST_AS) -o $@ $<
2955 split_i386_2.o: split_i386_2.s
2956 $(TEST_AS) -o $@ $<
2957 split_i386_3.o: split_i386_3.s
2958 $(TEST_AS) -o $@ $<
2959 split_i386_4.o: split_i386_4.s
2960 $(TEST_AS) -o $@ $<
2961 split_i386_n.o: split_i386_n.s
2962 $(TEST_AS) -o $@ $<
2963 split_i386_1: split_i386_1.o split_i386_n.o ../ld-new
2964 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_i386_1.o split_i386_n.o
2965 split_i386_1.stdout: split_i386_1
2966 $(TEST_OBJDUMP) -d $< > $@
2967 split_i386_2: split_i386_2.o split_i386_n.o ../ld-new
2968 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_i386_2.o split_i386_n.o
2969 split_i386_2.stdout: split_i386_2
2970 $(TEST_OBJDUMP) -d $< > $@
2971 split_i386_3.stdout: split_i386_3.o split_i386_n.o ../ld-new
2972 ../ld-new $(SPLIT_DEFSYMS) -o split_i386_3 split_i386_3.o split_i386_n.o > $@ 2>&1 || exit 0
2973 split_i386_4: split_i386_4.o split_i386_n.o ../ld-new
2974 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_i386_4.o split_i386_n.o
2975 split_i386_4.stdout: split_i386_4
2976 $(TEST_OBJDUMP) -d $< > $@
2977 split_i386_r.stdout: split_i386_1.o split_i386_n.o ../ld-new
2978 ../ld-new -r split_i386_1.o split_i386_n.o -o split_i386_r > $@ 2>&1 || exit 0
2979 MOSTLYCLEANFILES += split_i386_1 split_i386_2 split_i386_3 \
2980 split_i386_4 split_i386_r
2981
2982 endif DEFAULT_TARGET_I386
2983
2984 if DEFAULT_TARGET_X86_64
2985
2986 check_SCRIPTS += split_x86_64.sh
2987 check_DATA += split_x86_64_1.stdout split_x86_64_2.stdout \
2988 split_x86_64_3.stdout split_x86_64_4.stdout split_x86_64_r.stdout
2989 SPLIT_DEFSYMS = --defsym __morestack=0x100 --defsym __morestack_non_split=0x200
2990 split_x86_64_1.o: split_x86_64_1.s
2991 $(TEST_AS) -o $@ $<
2992 split_x86_64_2.o: split_x86_64_2.s
2993 $(TEST_AS) -o $@ $<
2994 split_x86_64_3.o: split_x86_64_3.s
2995 $(TEST_AS) -o $@ $<
2996 split_x86_64_4.o: split_x86_64_4.s
2997 $(TEST_AS) -o $@ $<
2998 split_x86_64_n.o: split_x86_64_n.s
2999 $(TEST_AS) -o $@ $<
3000 split_x86_64_1: split_x86_64_1.o split_x86_64_n.o ../ld-new
3001 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x86_64_1.o split_x86_64_n.o
3002 split_x86_64_1.stdout: split_x86_64_1
3003 $(TEST_OBJDUMP) -d $< > $@
3004 split_x86_64_2: split_x86_64_2.o split_x86_64_n.o ../ld-new
3005 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x86_64_2.o split_x86_64_n.o
3006 split_x86_64_2.stdout: split_x86_64_2
3007 $(TEST_OBJDUMP) -d $< > $@
3008 split_x86_64_3.stdout: split_x86_64_3.o split_x86_64_n.o ../ld-new
3009 ../ld-new $(SPLIT_DEFSYMS) -o split_x86_64_3 split_x86_64_3.o split_x86_64_n.o > $@ 2>&1 || exit 0
3010 split_x86_64_4: split_x86_64_4.o split_x86_64_n.o ../ld-new
3011 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x86_64_4.o split_x86_64_n.o
3012 split_x86_64_4.stdout: split_x86_64_4
3013 $(TEST_OBJDUMP) -d $< > $@
3014 split_x86_64_r.stdout: split_x86_64_1.o split_x86_64_n.o ../ld-new
3015 ../ld-new -r split_x86_64_1.o split_x86_64_n.o -o split_x86_64_r > $@ 2>&1 || exit 0
3016 MOSTLYCLEANFILES += split_x86_64_1 split_x86_64_2 split_x86_64_3 \
3017 split_x86_64_4 split_x86_64_r
3018
3019 endif DEFAULT_TARGET_X86_64
3020
3021 if DEFAULT_TARGET_X32
3022
3023 check_SCRIPTS += split_x32.sh
3024 check_DATA += split_x32_1.stdout split_x32_2.stdout \
3025 split_x32_3.stdout split_x32_4.stdout split_x32_r.stdout
3026 SPLIT_DEFSYMS = --defsym __morestack=0x100 --defsym __morestack_non_split=0x200
3027 split_x32_1.o: split_x32_1.s
3028 $(TEST_AS) -o $@ $<
3029 split_x32_2.o: split_x32_2.s
3030 $(TEST_AS) -o $@ $<
3031 split_x32_3.o: split_x32_3.s
3032 $(TEST_AS) -o $@ $<
3033 split_x32_4.o: split_x32_4.s
3034 $(TEST_AS) -o $@ $<
3035 split_x32_n.o: split_x32_n.s
3036 $(TEST_AS) -o $@ $<
3037 split_x32_1: split_x32_1.o split_x32_n.o ../ld-new
3038 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x32_1.o split_x32_n.o
3039 split_x32_1.stdout: split_x32_1
3040 $(TEST_OBJDUMP) -d $< > $@
3041 split_x32_2: split_x32_2.o split_x32_n.o ../ld-new
3042 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x32_2.o split_x32_n.o
3043 split_x32_2.stdout: split_x32_2
3044 $(TEST_OBJDUMP) -d $< > $@
3045 split_x32_3.stdout: split_x32_3.o split_x32_n.o ../ld-new
3046 ../ld-new $(SPLIT_DEFSYMS) -o split_x32_3 split_x32_3.o split_x32_n.o > $@ 2>&1 || exit 0
3047 split_x32_4: split_x32_4.o split_x32_n.o ../ld-new
3048 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x32_4.o split_x32_n.o
3049 split_x32_4.stdout: split_x32_4
3050 $(TEST_OBJDUMP) -d $< > $@
3051 split_x32_r.stdout: split_x32_1.o split_x32_n.o ../ld-new
3052 ../ld-new -r split_x32_1.o split_x32_n.o -o split_x32_r > $@ 2>&1 || exit 0
3053 MOSTLYCLEANFILES += split_x32_1 split_x32_2 split_x32_3 \
3054 split_x32_4 split_x32_r
3055
3056 endif DEFAULT_TARGET_X32
3057
3058 if DEFAULT_TARGET_ARM
3059
3060 check_SCRIPTS += arm_abs_global.sh
3061 check_DATA += arm_abs_global.stdout
3062 arm_abs_lib.o: arm_abs_lib.s
3063 $(TEST_AS) -march=armv7-a -o $@ $<
3064 libarm_abs.so: arm_abs_lib.o ../ld-new
3065 ../ld-new -shared -o $@ arm_abs_lib.o
3066 arm_abs_global.o: arm_abs_global.s
3067 $(TEST_AS) -march=armv7-a -o $@ $<
3068 arm_abs_global: arm_abs_global.o libarm_abs.so ../ld-new
3069 ../ld-new -o $@ arm_abs_global.o -L. -larm_abs
3070 arm_abs_global.stdout: arm_abs_global
3071 $(TEST_READELF) -r $< > $@
3072
3073 MOSTLYCLEANFILES += arm_abs_global
3074
3075 check_SCRIPTS += arm_branch_in_range.sh arm_branch_out_of_range.sh
3076 check_DATA += arm_bl_in_range.stdout arm_bl_out_of_range.stdout \
3077 thumb_bl_in_range.stdout thumb_bl_out_of_range.stdout \
3078 thumb2_bl_in_range.stdout thumb2_bl_out_of_range.stdout \
3079 thumb_blx_in_range.stdout thumb_blx_out_of_range.stdout \
3080 thumb2_blx_in_range.stdout thumb2_blx_out_of_range.stdout \
3081 thumb_bl_out_of_range_local.stdout arm_thm_jump11.stdout \
3082 arm_thm_jump8.stdout
3083
3084 arm_bl_in_range.stdout: arm_bl_in_range
3085 $(TEST_OBJDUMP) -D $< > $@
3086
3087 arm_bl_in_range: arm_bl_in_range.o ../ld-new
3088 ../ld-new -T $(srcdir)/arm_branch_range.t -o $@ $<
3089
3090 arm_bl_in_range.o: arm_bl_in_range.s
3091 $(TEST_AS) -o $@ $<
3092
3093 arm_bl_out_of_range.stdout: arm_bl_out_of_range
3094 $(TEST_OBJDUMP) -S $< > $@
3095
3096 arm_bl_out_of_range: arm_bl_out_of_range.o ../ld-new
3097 ../ld-new -T $(srcdir)/arm_branch_range.t -o $@ $<
3098
3099 arm_bl_out_of_range.o: arm_bl_out_of_range.s
3100 $(TEST_AS) -o $@ $<
3101
3102 thumb_bl_in_range.stdout: thumb_bl_in_range
3103 $(TEST_OBJDUMP) -D $< > $@
3104
3105 thumb_bl_in_range: thumb_bl_in_range.o ../ld-new
3106 ../ld-new --no-fix-arm1176 -T $(srcdir)/thumb_branch_range.t -o $@ $<
3107
3108 thumb_bl_in_range.o: thumb_bl_in_range.s
3109 $(TEST_AS) -o $@ -march=armv5te $<
3110
3111 thumb_bl_out_of_range.stdout: thumb_bl_out_of_range
3112 $(TEST_OBJDUMP) -D $< > $@
3113
3114 thumb_bl_out_of_range: thumb_bl_out_of_range.o ../ld-new
3115 ../ld-new --no-fix-arm1176 -T $(srcdir)/thumb_branch_range.t -o $@ $<
3116
3117 thumb_bl_out_of_range.o: thumb_bl_out_of_range.s
3118 $(TEST_AS) -o $@ -march=armv5te $<
3119
3120 thumb2_bl_in_range.stdout: thumb2_bl_in_range
3121 $(TEST_OBJDUMP) -D $< > $@
3122
3123 thumb2_bl_in_range: thumb2_bl_in_range.o ../ld-new
3124 ../ld-new -T $(srcdir)/thumb2_branch_range.t -o $@ $<
3125
3126 thumb2_bl_in_range.o: thumb_bl_in_range.s
3127 $(TEST_AS) -o $@ -march=armv7-a $<
3128
3129 thumb2_bl_out_of_range.stdout: thumb2_bl_out_of_range
3130 $(TEST_OBJDUMP) -D $< > $@
3131
3132 thumb2_bl_out_of_range: thumb2_bl_out_of_range.o ../ld-new
3133 ../ld-new -T $(srcdir)/thumb2_branch_range.t -o $@ $<
3134
3135 thumb2_bl_out_of_range.o: thumb_bl_out_of_range.s
3136 $(TEST_AS) -o $@ -march=armv7-a $<
3137
3138 thumb_blx_in_range.stdout: thumb_blx_in_range
3139 $(TEST_OBJDUMP) -D $< > $@
3140
3141 thumb_blx_in_range: thumb_blx_in_range.o ../ld-new
3142 ../ld-new --no-fix-arm1176 -T $(srcdir)/thumb_branch_range.t -o $@ $<
3143
3144 thumb_blx_in_range.o: thumb_blx_in_range.s
3145 $(TEST_AS) -o $@ -march=armv5te $<
3146
3147 thumb_blx_out_of_range.stdout: thumb_blx_out_of_range
3148 $(TEST_OBJDUMP) -D $< > $@
3149
3150 thumb_blx_out_of_range: thumb_blx_out_of_range.o ../ld-new
3151 ../ld-new --no-fix-arm1176 -T $(srcdir)/thumb_branch_range.t -o $@ $<
3152
3153 thumb_blx_out_of_range.o: thumb_blx_out_of_range.s
3154 $(TEST_AS) -o $@ -march=armv5te $<
3155
3156 thumb2_blx_in_range.stdout: thumb2_blx_in_range
3157 $(TEST_OBJDUMP) -D $< > $@
3158
3159 thumb2_blx_in_range: thumb2_blx_in_range.o ../ld-new
3160 ../ld-new -T $(srcdir)/thumb2_branch_range.t -o $@ $<
3161
3162 thumb2_blx_in_range.o: thumb_blx_in_range.s
3163 $(TEST_AS) -o $@ -march=armv7-a $<
3164
3165 thumb2_blx_out_of_range.stdout: thumb2_blx_out_of_range
3166 $(TEST_OBJDUMP) -D $< > $@
3167
3168 thumb2_blx_out_of_range: thumb2_blx_out_of_range.o ../ld-new
3169 ../ld-new -T $(srcdir)/thumb2_branch_range.t -o $@ $<
3170
3171 thumb2_blx_out_of_range.o: thumb_blx_out_of_range.s
3172 $(TEST_AS) -o $@ -march=armv7-a $<
3173
3174 thumb_bl_out_of_range_local.stdout: thumb_bl_out_of_range_local
3175 $(TEST_OBJDUMP) -D $< > $@
3176
3177 thumb_bl_out_of_range_local: thumb_bl_out_of_range_local.o ../ld-new
3178 ../ld-new --no-fix-arm1176 -T $(srcdir)/thumb_branch_range.t -o $@ $<
3179
3180 thumb_bl_out_of_range_local.o: thumb_bl_out_of_range_local.s
3181 $(TEST_AS) -o $@ -march=armv5te $<
3182
3183 arm_thm_jump11.stdout: arm_thm_jump11
3184 $(TEST_OBJDUMP) -D $< > $@
3185
3186 arm_thm_jump11: arm_thm_jump11.o ../ld-new
3187 ../ld-new -T $(srcdir)/arm_thm_jump11.t -o $@ $<
3188
3189 arm_thm_jump11.o: arm_thm_jump11.s
3190 $(TEST_AS) -o $@ $<
3191
3192 arm_thm_jump8.stdout: arm_thm_jump8
3193 $(TEST_OBJDUMP) -D $< > $@
3194
3195 arm_thm_jump8: arm_thm_jump8.o ../ld-new
3196 ../ld-new -T $(srcdir)/arm_thm_jump8.t -o $@ $<
3197
3198 arm_thm_jump8.o: arm_thm_jump8.s
3199 $(TEST_AS) -o $@ $<
3200
3201 MOSTLYCLEANFILES += arm_bl_in_range arm_bl_out_of_range thumb_bl_in_range \
3202 thumb_bl_out_of_range thumb2_bl_in_range thumb2_bl_out_of_range \
3203 thumb_blx_in_range thumb_blx_out_of_range thumb2_blx_in_range \
3204 thumb2_blx_out_of_range thumb_bl_out_of_range_local arm_thm_jump11 \
3205 arm_thm_jump8
3206
3207 check_SCRIPTS += arm_fix_v4bx.sh
3208 check_DATA += arm_fix_v4bx.stdout arm_fix_v4bx_interworking.stdout \
3209 arm_no_fix_v4bx.stdout
3210
3211 arm_fix_v4bx.stdout: arm_fix_v4bx
3212 $(TEST_OBJDUMP) -D -j.text $< > $@
3213
3214 arm_fix_v4bx: arm_fix_v4bx.o ../ld-new
3215 ../ld-new --no-fix-arm1176 --fix-v4bx -o $@ $<
3216
3217 arm_fix_v4bx.o: arm_fix_v4bx.s
3218 $(TEST_AS) -o $@ $<
3219
3220 arm_fix_v4bx_interworking.stdout: arm_fix_v4bx_interworking
3221 $(TEST_OBJDUMP) -D -j.text $< > $@
3222
3223 arm_fix_v4bx_interworking: arm_fix_v4bx.o ../ld-new
3224 ../ld-new --no-fix-arm1176 --fix-v4bx-interworking -o $@ $<
3225
3226 arm_no_fix_v4bx.stdout: arm_no_fix_v4bx
3227 $(TEST_OBJDUMP) -D -j.text $< > $@
3228
3229 arm_no_fix_v4bx: arm_fix_v4bx.o ../ld-new
3230 ../ld-new --no-fix-arm1176 -o $@ $<
3231
3232 MOSTLYCLEANFILES += arm_fix_v4bx arm_fix_v4bx_interworking arm_no_fix_v4bx
3233
3234 check_SCRIPTS += arm_attr_merge.sh
3235 check_DATA += arm_attr_merge_6.stdout arm_attr_merge_6r.stdout \
3236 arm_attr_merge_7.stdout
3237
3238 arm_attr_merge_6.stdout: arm_attr_merge_6
3239 $(TEST_READELF) -A $< > $@
3240
3241 arm_attr_merge_6: arm_attr_merge_6a.o arm_attr_merge_6b.o
3242 ../ld-new -o $@ arm_attr_merge_6a.o arm_attr_merge_6b.o
3243
3244 arm_attr_merge_6a.o: arm_attr_merge_6a.s
3245 $(TEST_AS) -o $@ $<
3246
3247 arm_attr_merge_6b.o: arm_attr_merge_6b.s
3248 $(TEST_AS) -o $@ $<
3249
3250 arm_attr_merge_6r.stdout: arm_attr_merge_6r
3251 $(TEST_READELF) -A $< > $@
3252
3253 arm_attr_merge_6r: arm_attr_merge_6b.o arm_attr_merge_6a.o
3254 ../ld-new -o $@ arm_attr_merge_6b.o arm_attr_merge_6a.o
3255
3256 arm_attr_merge_7.stdout: arm_attr_merge_7
3257 $(TEST_READELF) -A $< > $@
3258
3259 arm_attr_merge_7: arm_attr_merge_7a.o arm_attr_merge_7b.o
3260 ../ld-new -o $@ arm_attr_merge_7a.o arm_attr_merge_7b.o
3261
3262 arm_attr_merge_7a.o: arm_attr_merge_7a.s
3263 $(TEST_AS) -o $@ $<
3264
3265 arm_attr_merge_7b.o: arm_attr_merge_7b.s
3266 $(TEST_AS) -o $@ $<
3267
3268 MOSTLYCLEANFILES += arm_attr_merge_6 arm_attr_merge_6r arm_attr_merge_7
3269
3270 # ARM1176 workaround test.
3271 check_SCRIPTS += arm_fix_1176.sh
3272 check_DATA += arm_fix_1176_default_v6z.stdout arm_fix_1176_on_v6z.stdout \
3273 arm_fix_1176_off_v6z.stdout arm_fix_1176_default_v5te.stdout \
3274 arm_fix_1176_default_v7a.stdout arm_fix_1176_default_1156t2f_s.stdout
3275
3276 arm_fix_1176_default_v6z.stdout: arm_fix_1176_default_v6z
3277 $(TEST_OBJDUMP) -D -j.foo $< > $@
3278
3279 arm_fix_1176_default_v6z: arm_fix_1176_default_v6z.o ../ld-new
3280 ../ld-new --section-start=.foo=0x2001014 -o $@ $<
3281
3282 arm_fix_1176_default_v6z.o: arm_fix_1176.s
3283 $(TEST_AS) -march=armv6z -o $@ $<
3284
3285 arm_fix_1176_on_v6z.stdout: arm_fix_1176_on_v6z
3286 $(TEST_OBJDUMP) -D -j.foo $< > $@
3287
3288 arm_fix_1176_on_v6z: arm_fix_1176_on_v6z.o ../ld-new
3289 ../ld-new --section-start=.foo=0x2001014 --fix-arm1176 -o $@ $<
3290
3291 arm_fix_1176_on_v6z.o: arm_fix_1176.s
3292 $(TEST_AS) -march=armv6z -o $@ $<
3293
3294 arm_fix_1176_off_v6z.stdout: arm_fix_1176_off_v6z
3295 $(TEST_OBJDUMP) -D -j.foo $< > $@
3296
3297 arm_fix_1176_off_v6z: arm_fix_1176_off_v6z.o ../ld-new
3298 ../ld-new --section-start=.foo=0x2001014 --no-fix-arm1176 -o $@ $<
3299
3300 arm_fix_1176_off_v6z.o: arm_fix_1176.s
3301 $(TEST_AS) -march=armv6z -o $@ $<
3302
3303 arm_fix_1176_default_v5te.stdout: arm_fix_1176_default_v5te
3304 $(TEST_OBJDUMP) -D -j.foo $< > $@
3305
3306 arm_fix_1176_default_v5te: arm_fix_1176_default_v5te.o ../ld-new
3307 ../ld-new --section-start=.foo=0x2001014 -o $@ $<
3308
3309 arm_fix_1176_default_v5te.o: arm_fix_1176.s
3310 $(TEST_AS) -march=armv5te -o $@ $<
3311
3312 arm_fix_1176_default_v7a.stdout: arm_fix_1176_default_v7a
3313 $(TEST_OBJDUMP) -D -j.foo $< > $@
3314
3315 arm_fix_1176_default_v7a: arm_fix_1176_default_v7a.o ../ld-new
3316 ../ld-new --section-start=.foo=0x2001014 -o $@ $<
3317
3318 arm_fix_1176_default_v7a.o: arm_fix_1176.s
3319 $(TEST_AS) -march=armv7-a -o $@ $<
3320
3321 arm_fix_1176_default_1156t2f_s.stdout: arm_fix_1176_default_1156t2f_s
3322 $(TEST_OBJDUMP) -D -j.foo $< > $@
3323
3324 arm_fix_1176_default_1156t2f_s: arm_fix_1176_default_1156t2f_s.o ../ld-new
3325 ../ld-new --section-start=.foo=0x2001014 -o $@ $<
3326
3327 arm_fix_1176_default_1156t2f_s.o: arm_fix_1176.s
3328 $(TEST_AS) -mcpu=arm1156t2f-s -o $@ $<
3329
3330 MOSTLYCLEANFILES += arm_fix_1176_default_v6z arm_fix_1176_on_v6z arm_fix_1176_off_v6z \
3331 arm_fix_1176_default_v5te arm_fix_1176_default_v7a arm_fix_1176_default_1156t2f_s
3332
3333 # Cortex-A8 workaround test.
3334
3335 check_SCRIPTS += arm_cortex_a8.sh
3336 check_DATA += arm_cortex_a8_b_cond.stdout arm_cortex_a8_b.stdout \
3337 arm_cortex_a8_bl.stdout arm_cortex_a8_blx.stdout \
3338 arm_cortex_a8_local.stdout arm_cortex_a8_local_reloc.stdout
3339
3340 arm_cortex_a8_b_cond.stdout: arm_cortex_a8_b_cond
3341 $(TEST_OBJDUMP) -D -j.text $< > $@
3342
3343 arm_cortex_a8_b_cond: arm_cortex_a8_b_cond.o ../ld-new
3344 ../ld-new -o $@ $<
3345
3346 arm_cortex_a8_b_cond.o: arm_cortex_a8_b_cond.s
3347 $(TEST_AS) -o $@ $<
3348
3349 arm_cortex_a8_b.stdout: arm_cortex_a8_b
3350 $(TEST_OBJDUMP) -D -j.text $< > $@
3351
3352 arm_cortex_a8_b: arm_cortex_a8_b.o ../ld-new
3353 ../ld-new --fix-cortex-a8 -o $@ $<
3354
3355 arm_cortex_a8_b.o: arm_cortex_a8_b.s
3356 $(TEST_AS) -o $@ $<
3357
3358 arm_cortex_a8_bl.stdout: arm_cortex_a8_bl
3359 $(TEST_OBJDUMP) -D -j.text $< > $@
3360
3361 arm_cortex_a8_bl: arm_cortex_a8_bl.o ../ld-new
3362 ../ld-new -o $@ $<
3363
3364 arm_cortex_a8_bl.o: arm_cortex_a8_bl.s
3365 $(TEST_AS) -o $@ $<
3366
3367 arm_cortex_a8_blx.stdout: arm_cortex_a8_blx
3368 $(TEST_OBJDUMP) -D -j.text $< > $@
3369
3370 arm_cortex_a8_blx: arm_cortex_a8_blx.o ../ld-new
3371 ../ld-new -o $@ $<
3372
3373 arm_cortex_a8_blx.o: arm_cortex_a8_blx.s
3374 $(TEST_AS) -o $@ $<
3375
3376 arm_cortex_a8_local.stdout: arm_cortex_a8_local
3377 $(TEST_OBJDUMP) -D -j.text $< > $@
3378
3379 arm_cortex_a8_local: arm_cortex_a8_local.o ../ld-new
3380 ../ld-new -o $@ $<
3381
3382 arm_cortex_a8_local.o: arm_cortex_a8_local.s
3383 $(TEST_AS) -o $@ $<
3384
3385 arm_cortex_a8_local_reloc.stdout: arm_cortex_a8_local_reloc
3386 $(TEST_OBJDUMP) -D -j.text $< > $@
3387
3388 arm_cortex_a8_local_reloc: arm_cortex_a8_local_reloc.o ../ld-new
3389 ../ld-new -o $@ $<
3390
3391 arm_cortex_a8_local_reloc.o: arm_cortex_a8_local_reloc.s
3392 $(TEST_AS) -o $@ $<
3393
3394 MOSTLYCLEANFILES += arm_cortex_a8_b_cond arm_cortex_a8_b arm_cortex_a8_bl \
3395 arm_cortex_a8_blx arm_cortex_a8_local arm_cortex_a8_local_reloc
3396
3397 check_SCRIPTS += arm_exidx_test.sh
3398 check_DATA += arm_exidx_test.stdout
3399
3400 arm_exidx_test.stdout: arm_exidx_test.so
3401 $(TEST_READELF) -Sr $< > $@
3402
3403 arm_exidx_test.so: arm_exidx_test.o ../ld-new
3404 ../ld-new -shared -o $@ $<
3405
3406 arm_exidx_test.o: arm_exidx_test.s
3407 $(TEST_AS) -o $@ $<
3408
3409 check_SCRIPTS += pr12826.sh
3410 check_DATA += pr12826.stdout
3411
3412 pr12826.stdout: pr12826.so
3413 $(TEST_READELF) -A $< > $@
3414
3415 pr12826.so: pr12826_1.o pr12826_2.o ../ld-new
3416 ../ld-new -shared -o $@ $<
3417
3418 pr12826_1.o: pr12826_1.s
3419 $(TEST_AS) -o $@ $<
3420
3421 pr12826_2.o: pr12826_2.s
3422 $(TEST_AS) -o $@ $<
3423
3424 check_SCRIPTS += arm_unaligned_reloc.sh
3425 check_DATA += arm_unaligned_reloc.stdout arm_unaligned_reloc_r.stdout
3426
3427 arm_unaligned_reloc.stdout: arm_unaligned_reloc
3428 $(TEST_OBJDUMP) -D $< > $@
3429
3430 arm_unaligned_reloc_r.stdout: arm_unaligned_reloc_r
3431 $(TEST_OBJDUMP) -Dr $< > $@
3432
3433 arm_unaligned_reloc: arm_unaligned_reloc.o ../ld-new
3434 ../ld-new -o $@ $<
3435
3436 arm_unaligned_reloc_r: arm_unaligned_reloc.o ../ld-new
3437 ../ld-new -r -o $@ $<
3438
3439 arm_unaligned_reloc.o: arm_unaligned_reloc.s
3440 $(TEST_AS) -o $@ $<
3441
3442 MOSTLYCLEANFILES += arm_unaligned_reloc arm_unaligned_reloc_r
3443
3444 # Check ARM to ARM farcall veneers
3445
3446 check_SCRIPTS += arm_farcall_arm_arm.sh
3447 check_DATA += arm_farcall_arm_arm.stdout
3448
3449 arm_farcall_arm_arm.stdout: arm_farcall_arm_arm
3450 $(TEST_OBJDUMP) -d $< > $@
3451
3452 arm_farcall_arm_arm: arm_farcall_arm_arm.o ../ld-new
3453 ../ld-new --no-fix-arm1176 --section-start .text=0x1000 --section-start .foo=0x2001020 -o $@ $<
3454
3455 arm_farcall_arm_arm.o: arm_farcall_arm_arm.s
3456 $(TEST_AS) -o $@ $<
3457
3458 MOSTLYCLEANFILES += arm_farcall_arm_arm
3459
3460 # Check ARM to Thumb farcall veneers
3461
3462 check_SCRIPTS += arm_farcall_arm_thumb.sh
3463 check_DATA += arm_farcall_arm_thumb.stdout arm_farcall_arm_thumb_5t.stdout
3464
3465 arm_farcall_arm_thumb.stdout: arm_farcall_arm_thumb
3466 $(TEST_OBJDUMP) -D $< > $@
3467
3468 arm_farcall_arm_thumb: arm_farcall_arm_thumb.o ../ld-new
3469 ../ld-new --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
3470
3471 arm_farcall_arm_thumb.o: arm_farcall_arm_thumb.s
3472 $(TEST_AS) -o $@ $<
3473
3474 arm_farcall_arm_thumb_5t.stdout: arm_farcall_arm_thumb_5t
3475 $(TEST_OBJDUMP) -D $< > $@
3476
3477 arm_farcall_arm_thumb_5t: arm_farcall_arm_thumb_5t.o ../ld-new
3478 ../ld-new --no-fix-arm1176 --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
3479
3480 arm_farcall_arm_thumb_5t.o: arm_farcall_arm_thumb.s
3481 $(TEST_AS) -march=armv5t -o $@ $<
3482
3483 MOSTLYCLEANFILES += arm_farcall_arm_thumb arm_farcall_arm_thumb_5t
3484
3485 # Check Thumb to Thumb farcall veneers
3486
3487 check_SCRIPTS += arm_farcall_thumb_thumb.sh
3488 check_DATA += arm_farcall_thumb_thumb.stdout \
3489 arm_farcall_thumb_thumb_5t.stdout \
3490 arm_farcall_thumb_thumb_7m.stdout \
3491 arm_farcall_thumb_thumb_6m.stdout
3492
3493 arm_farcall_thumb_thumb.stdout: arm_farcall_thumb_thumb
3494 $(TEST_OBJDUMP) -D $< > $@
3495
3496 arm_farcall_thumb_thumb: arm_farcall_thumb_thumb.o ../ld-new
3497 ../ld-new --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
3498
3499 arm_farcall_thumb_thumb.o: arm_farcall_thumb_thumb.s
3500 $(TEST_AS) -march=armv4t -o $@ $<
3501
3502 arm_farcall_thumb_thumb_5t.stdout: arm_farcall_thumb_thumb_5t
3503 $(TEST_OBJDUMP) -D $< > $@
3504
3505 arm_farcall_thumb_thumb_5t: arm_farcall_thumb_thumb_5t.o ../ld-new
3506 ../ld-new --no-fix-arm1176 --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
3507
3508 arm_farcall_thumb_thumb_5t.o: arm_farcall_thumb_thumb.s
3509 $(TEST_AS) -march=armv5t -o $@ $<
3510
3511 arm_farcall_thumb_thumb_7m.stdout: arm_farcall_thumb_thumb_7m
3512 $(TEST_OBJDUMP) -D $< > $@
3513
3514 arm_farcall_thumb_thumb_7m: arm_farcall_thumb_thumb_7m.o ../ld-new
3515 ../ld-new --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
3516
3517 arm_farcall_thumb_thumb_7m.o: arm_farcall_thumb_thumb.s
3518 $(TEST_AS) -march=armv7-m -o $@ $<
3519
3520 arm_farcall_thumb_thumb_6m.stdout: arm_farcall_thumb_thumb_6m
3521 $(TEST_OBJDUMP) -D $< > $@
3522
3523 arm_farcall_thumb_thumb_6m: arm_farcall_thumb_thumb_6m.o ../ld-new
3524 ../ld-new --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
3525
3526 arm_farcall_thumb_thumb_6m.o: arm_farcall_thumb_thumb.s
3527 $(TEST_AS) -march=armv6-m -o $@ $<
3528
3529 MOSTLYCLEANFILES += arm_farcall_thumb_thumb arm_farcall_thumb_thumb_5t \
3530 arm_farcall_thumb_thumb_7m arm_farcall_thumb_thumb_6m
3531
3532 # Check Thumb to ARM farcall veneers
3533
3534 check_SCRIPTS += arm_farcall_thumb_arm.sh
3535 check_DATA += arm_farcall_thumb_arm.stdout \
3536 arm_farcall_thumb_arm_5t.stdout
3537
3538 arm_farcall_thumb_arm.stdout: arm_farcall_thumb_arm
3539 $(TEST_OBJDUMP) -D $< > $@
3540
3541 arm_farcall_thumb_arm: arm_farcall_thumb_arm.o ../ld-new
3542 ../ld-new --section-start .text=0x1c01010 --section-start .foo=0x2001014 -o $@ $<
3543
3544 arm_farcall_thumb_arm.o: arm_farcall_thumb_arm.s
3545 $(TEST_AS) -o $@ $<
3546
3547 arm_farcall_thumb_arm_5t.stdout: arm_farcall_thumb_arm_5t
3548 $(TEST_OBJDUMP) -D $< > $@
3549
3550 arm_farcall_thumb_arm_5t: arm_farcall_thumb_arm_5t.o ../ld-new
3551 ../ld-new --no-fix-arm1176 --section-start .text=0x1c01010 --section-start .foo=0x2001014 -o $@ $<
3552
3553 arm_farcall_thumb_arm_5t.o: arm_farcall_thumb_arm.s
3554 $(TEST_AS) -march=armv5t -o $@ $<
3555
3556 MOSTLYCLEANFILES += arm_farcall_thumb_arm arm_farcall_thumb_arm_5t
3557
3558 endif DEFAULT_TARGET_ARM
3559
3560 if DEFAULT_TARGET_AARCH64
3561
3562 check_SCRIPTS += aarch64_reloc_none.sh
3563 check_DATA += aarch64_reloc_none.stdout
3564 aarch64_reloc_none.o: aarch64_reloc_none.s
3565 $(TEST_AS) -o $@ $<
3566 aarch64_reloc_none: aarch64_reloc_none.o ../ld-new
3567 ../ld-new -o $@ aarch64_reloc_none.o --gc-sections
3568 aarch64_reloc_none.stdout: aarch64_reloc_none
3569 $(TEST_NM) $< > $@
3570
3571 MOSTLYCLEANFILES += aarch64_reloc_none
3572
3573 endif DEFAULT_TARGET_AARCH64
3574
3575 if DEFAULT_TARGET_S390
3576
3577 check_SCRIPTS += split_s390.sh
3578 check_DATA += split_s390_z1.stdout split_s390_z2.stdout split_s390_z3.stdout \
3579 split_s390_z4.stdout split_s390_n1.stdout split_s390_n2.stdout \
3580 split_s390_a1.stdout split_s390_a2.stdout split_s390_z1_ns.stdout \
3581 split_s390_z2_ns.stdout split_s390_z3_ns.stdout split_s390_z4_ns.stdout \
3582 split_s390_n1_ns.stdout split_s390_n2_ns.stdout split_s390_r.stdout \
3583 split_s390x_z1.stdout split_s390x_z2.stdout split_s390x_z3.stdout \
3584 split_s390x_z4.stdout split_s390x_n1.stdout split_s390x_n2.stdout \
3585 split_s390x_a1.stdout split_s390x_a2.stdout split_s390x_z1_ns.stdout \
3586 split_s390x_z2_ns.stdout split_s390x_z3_ns.stdout \
3587 split_s390x_z4_ns.stdout split_s390x_n1_ns.stdout \
3588 split_s390x_n2_ns.stdout split_s390x_r.stdout
3589 SPLIT_DEFSYMS = --defsym __morestack=0x100 --defsym __morestack_non_split=0x200
3590 split_s390_1_z1.o: split_s390_1_z1.s
3591 $(TEST_AS) -m31 -o $@ $<
3592 split_s390_1_z2.o: split_s390_1_z2.s
3593 $(TEST_AS) -m31 -o $@ $<
3594 split_s390_1_z3.o: split_s390_1_z3.s
3595 $(TEST_AS) -m31 -o $@ $<
3596 split_s390_1_z4.o: split_s390_1_z4.s
3597 $(TEST_AS) -m31 -o $@ $<
3598 split_s390_1_n1.o: split_s390_1_n1.s
3599 $(TEST_AS) -m31 -o $@ $<
3600 split_s390_1_n2.o: split_s390_1_n2.s
3601 $(TEST_AS) -m31 -o $@ $<
3602 split_s390_1_a1.o: split_s390_1_a1.s
3603 $(TEST_AS) -m31 -o $@ $<
3604 split_s390_1_a2.o: split_s390_1_a2.s
3605 $(TEST_AS) -m31 -o $@ $<
3606 split_s390_2_s.o: split_s390_2_s.s
3607 $(TEST_AS) -m31 -o $@ $<
3608 split_s390_2_ns.o: split_s390_2_ns.s
3609 $(TEST_AS) -m31 -o $@ $<
3610 split_s390_z1: split_s390_1_z1.o split_s390_2_s.o ../ld-new
3611 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_z1.o split_s390_2_s.o
3612 split_s390_z1.stdout: split_s390_z1
3613 $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
3614 split_s390_z2: split_s390_1_z2.o split_s390_2_s.o ../ld-new
3615 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_z2.o split_s390_2_s.o
3616 split_s390_z2.stdout: split_s390_z2
3617 $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
3618 split_s390_z3: split_s390_1_z3.o split_s390_2_s.o ../ld-new
3619 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_z3.o split_s390_2_s.o
3620 split_s390_z3.stdout: split_s390_z3
3621 $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
3622 split_s390_z4: split_s390_1_z4.o split_s390_2_s.o ../ld-new
3623 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_z4.o split_s390_2_s.o
3624 split_s390_z4.stdout: split_s390_z4
3625 $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
3626 split_s390_n1: split_s390_1_n1.o split_s390_2_s.o ../ld-new
3627 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_n1.o split_s390_2_s.o
3628 split_s390_n1.stdout: split_s390_n1
3629 $(TEST_OBJDUMP) -d $< > $@
3630 split_s390_n2: split_s390_1_n2.o split_s390_2_s.o ../ld-new
3631 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_n2.o split_s390_2_s.o
3632 split_s390_n2.stdout: split_s390_n2
3633 $(TEST_OBJDUMP) -d $< > $@
3634 split_s390_z1_ns: split_s390_1_z1.o split_s390_2_ns.o ../ld-new
3635 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_z1.o split_s390_2_ns.o
3636 split_s390_z1_ns.stdout: split_s390_z1_ns
3637 $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
3638 split_s390_z2_ns: split_s390_1_z2.o split_s390_2_ns.o ../ld-new
3639 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_z2.o split_s390_2_ns.o
3640 split_s390_z2_ns.stdout: split_s390_z2_ns
3641 $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
3642 split_s390_z3_ns: split_s390_1_z3.o split_s390_2_ns.o ../ld-new
3643 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_z3.o split_s390_2_ns.o
3644 split_s390_z3_ns.stdout: split_s390_z3_ns
3645 $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
3646 split_s390_z4_ns: split_s390_1_z4.o split_s390_2_ns.o ../ld-new
3647 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_z4.o split_s390_2_ns.o
3648 split_s390_z4_ns.stdout: split_s390_z4_ns
3649 $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
3650 split_s390_n1_ns: split_s390_1_n1.o split_s390_2_ns.o ../ld-new
3651 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_n1.o split_s390_2_ns.o
3652 split_s390_n1_ns.stdout: split_s390_n1_ns
3653 $(TEST_OBJDUMP) -d $< > $@
3654 split_s390_n2_ns.stdout: split_s390_1_n2.o split_s390_2_ns.o ../ld-new
3655 ../ld-new $(SPLIT_DEFSYMS) -o split_s390_n2 split_s390_1_n2.o split_s390_2_ns.o > $@ 2>&1 || exit 0
3656 split_s390_a1.stdout: split_s390_1_a1.o split_s390_2_ns.o ../ld-new
3657 ../ld-new $(SPLIT_DEFSYMS) -o split_s390_a1 split_s390_1_a1.o split_s390_2_ns.o > $@ 2>&1 || exit 0
3658 split_s390_a2: split_s390_1_a2.o split_s390_2_ns.o ../ld-new
3659 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_a2.o split_s390_2_ns.o
3660 split_s390_a2.stdout: split_s390_a2
3661 $(TEST_OBJDUMP) -d $< > $@
3662 split_s390_r.stdout: split_s390_1_z1.o split_s390_2_ns.o ../ld-new
3663 ../ld-new -r split_s390_1_z1.o split_s390_2_ns.o -o split_s390_r > $@ 2>&1 || exit 0
3664 split_s390x_1_z1.o: split_s390x_1_z1.s
3665 $(TEST_AS) -m64 -o $@ $<
3666 split_s390x_1_z2.o: split_s390x_1_z2.s
3667 $(TEST_AS) -m64 -o $@ $<
3668 split_s390x_1_z3.o: split_s390x_1_z3.s
3669 $(TEST_AS) -m64 -o $@ $<
3670 split_s390x_1_z4.o: split_s390x_1_z4.s
3671 $(TEST_AS) -m64 -o $@ $<
3672 split_s390x_1_n1.o: split_s390x_1_n1.s
3673 $(TEST_AS) -m64 -o $@ $<
3674 split_s390x_1_n2.o: split_s390x_1_n2.s
3675 $(TEST_AS) -m64 -o $@ $<
3676 split_s390x_1_a1.o: split_s390x_1_a1.s
3677 $(TEST_AS) -m64 -o $@ $<
3678 split_s390x_1_a2.o: split_s390x_1_a2.s
3679 $(TEST_AS) -m64 -o $@ $<
3680 split_s390x_2_s.o: split_s390x_2_s.s
3681 $(TEST_AS) -m64 -o $@ $<
3682 split_s390x_2_ns.o: split_s390x_2_ns.s
3683 $(TEST_AS) -m64 -o $@ $<
3684 split_s390x_z1: split_s390x_1_z1.o split_s390x_2_s.o ../ld-new
3685 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_z1.o split_s390x_2_s.o
3686 split_s390x_z1.stdout: split_s390x_z1
3687 $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
3688 split_s390x_z2: split_s390x_1_z2.o split_s390x_2_s.o ../ld-new
3689 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_z2.o split_s390x_2_s.o
3690 split_s390x_z2.stdout: split_s390x_z2
3691 $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
3692 split_s390x_z3: split_s390x_1_z3.o split_s390x_2_s.o ../ld-new
3693 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_z3.o split_s390x_2_s.o
3694 split_s390x_z3.stdout: split_s390x_z3
3695 $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
3696 split_s390x_z4: split_s390x_1_z4.o split_s390x_2_s.o ../ld-new
3697 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_z4.o split_s390x_2_s.o
3698 split_s390x_z4.stdout: split_s390x_z4
3699 $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
3700 split_s390x_n1: split_s390x_1_n1.o split_s390x_2_s.o ../ld-new
3701 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_n1.o split_s390x_2_s.o
3702 split_s390x_n1.stdout: split_s390x_n1
3703 $(TEST_OBJDUMP) -d $< > $@
3704 split_s390x_n2: split_s390x_1_n2.o split_s390x_2_s.o ../ld-new
3705 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_n2.o split_s390x_2_s.o
3706 split_s390x_n2.stdout: split_s390x_n2
3707 $(TEST_OBJDUMP) -d $< > $@
3708 split_s390x_z1_ns: split_s390x_1_z1.o split_s390x_2_ns.o ../ld-new
3709 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_z1.o split_s390x_2_ns.o
3710 split_s390x_z1_ns.stdout: split_s390x_z1_ns
3711 $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
3712 split_s390x_z2_ns: split_s390x_1_z2.o split_s390x_2_ns.o ../ld-new
3713 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_z2.o split_s390x_2_ns.o
3714 split_s390x_z2_ns.stdout: split_s390x_z2_ns
3715 $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
3716 split_s390x_z3_ns: split_s390x_1_z3.o split_s390x_2_ns.o ../ld-new
3717 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_z3.o split_s390x_2_ns.o
3718 split_s390x_z3_ns.stdout: split_s390x_z3_ns
3719 $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
3720 split_s390x_z4_ns: split_s390x_1_z4.o split_s390x_2_ns.o ../ld-new
3721 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_z4.o split_s390x_2_ns.o
3722 split_s390x_z4_ns.stdout: split_s390x_z4_ns
3723 $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
3724 split_s390x_n1_ns: split_s390x_1_n1.o split_s390x_2_ns.o ../ld-new
3725 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_n1.o split_s390x_2_ns.o
3726 split_s390x_n1_ns.stdout: split_s390x_n1_ns
3727 $(TEST_OBJDUMP) -d $< > $@
3728 split_s390x_n2_ns.stdout: split_s390x_1_n2.o split_s390x_2_ns.o ../ld-new
3729 ../ld-new $(SPLIT_DEFSYMS) -o split_s390x_n2 split_s390x_1_n2.o split_s390x_2_ns.o > $@ 2>&1 || exit 0
3730 split_s390x_a1.stdout: split_s390x_1_a1.o split_s390x_2_ns.o ../ld-new
3731 ../ld-new $(SPLIT_DEFSYMS) -o split_s390x_a1 split_s390x_1_a1.o split_s390x_2_ns.o > $@ 2>&1 || exit 0
3732 split_s390x_a2: split_s390x_1_a2.o split_s390x_2_ns.o ../ld-new
3733 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_a2.o split_s390x_2_ns.o
3734 split_s390x_a2.stdout: split_s390x_a2
3735 $(TEST_OBJDUMP) -d $< > $@
3736 split_s390x_r.stdout: split_s390x_1_z1.o split_s390x_2_ns.o ../ld-new
3737 ../ld-new -r split_s390x_1_z1.o split_s390x_2_ns.o -o split_s390x_r > $@ 2>&1 || exit 0
3738 MOSTLYCLEANFILES += split_s390_z1 split_s390_z2 split_s390_z3 \
3739 split_s390_z4 split_s390_n1 split_s390_n2 split_s390_a1 \
3740 split_s390_a2 split_s390_z1_ns split_s390_z2_ns split_s390_z3_ns \
3741 split_s390_z4_ns split_s390_n1_ns split_s390_n2_ns split_s390_r \
3742 split_s390x_z1 split_s390x_z2 split_s390x_z3 split_s390x_z4 \
3743 split_s390x_n1 split_s390x_n2 split_s390x_a1 split_s390x_a2 \
3744 split_s390x_z1_ns split_s390x_z2_ns split_s390x_z3_ns \
3745 split_s390x_z4_ns split_s390x_n1_ns split_s390x_n2_ns split_s390x_r
3746
3747 endif DEFAULT_TARGET_S390
3748
3749 endif NATIVE_OR_CROSS_LINKER
3750
3751 # Tests for the dwp tool.
3752 # We don't want to rely yet on GCC support for -gsplit-dwarf,
3753 # so we use (for now) test cases in x86 assembly language,
3754 # compiled from the dwp_test_*.cc sources.
3755
3756 if DEFAULT_TARGET_X86_64
3757
3758 dwp_test_main.o: dwp_test_main.s
3759 $(TEST_AS) -o $@ $<
3760 dwp_test_1.o: dwp_test_1.s
3761 $(TEST_AS) -o $@ $<
3762 dwp_test_1b.o: dwp_test_1b.s
3763 $(TEST_AS) -o $@ $<
3764 dwp_test_2.o: dwp_test_2.s
3765 $(TEST_AS) -o $@ $<
3766
3767 dwp_test_main.dwo: dwp_test_main.o
3768 $(TEST_OBJCOPY) --extract-dwo $< $@
3769 dwp_test_1.dwo: dwp_test_1.o
3770 $(TEST_OBJCOPY) --extract-dwo $< $@
3771 dwp_test_1b.dwo: dwp_test_1b.o
3772 $(TEST_OBJCOPY) --extract-dwo $< $@
3773 dwp_test_2.dwo: dwp_test_2.o
3774 $(TEST_OBJCOPY) --extract-dwo $< $@
3775
3776 MOSTLYCLEANFILES += *.dwo *.dwp
3777 check_SCRIPTS += dwp_test_1.sh
3778 check_DATA += dwp_test_1.stdout
3779 dwp_test_1.stdout: dwp_test_1.dwp
3780 $(TEST_READELF) -wi $< > $@
3781 dwp_test_1.dwp: ../dwp dwp_test_main.dwo dwp_test_1.dwo dwp_test_1b.dwo dwp_test_2.dwo
3782 ../dwp -o $@ dwp_test_main.dwo dwp_test_1.dwo dwp_test_1b.dwo dwp_test_2.dwo
3783
3784 check_SCRIPTS += dwp_test_2.sh
3785 check_DATA += dwp_test_2.stdout
3786 dwp_test_2.stdout: dwp_test_2.dwp
3787 $(TEST_READELF) -wi $< > $@
3788 dwp_test_2.dwp: ../dwp dwp_test_2a.dwp dwp_test_2b.dwp
3789 ../dwp -o $@ dwp_test_2a.dwp dwp_test_2b.dwp
3790 dwp_test_2a.dwp: ../dwp dwp_test_main.dwo dwp_test_1.dwo
3791 ../dwp -o $@ dwp_test_main.dwo dwp_test_1.dwo
3792 dwp_test_2b.dwp: ../dwp dwp_test_1b.dwo dwp_test_2.dwo
3793 ../dwp -o $@ dwp_test_1b.dwo dwp_test_2.dwo
3794
3795 endif DEFAULT_TARGET_X86_64