Move uinteger_pow gdb/valarith.c to gdb/utils.c and make it public
[binutils-gdb.git] / gold / testsuite / Makefile.am
blob3bfba9feb64afc04a1a55e97c880e1193355ca58
1 # Process this file with automake to generate Makefile.in
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.
7 # Ignore warning about AM_PROG_CC_C_O due to large_CFLAGS
8 AUTOMAKE_OPTIONS = foreign -Wno-portability
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
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)
21 AM_CPPFLAGS = \
22         -I$(srcdir) -I$(srcdir)/.. -I$(srcdir)/../../include \
23         -I$(srcdir)/../../elfcpp -I.. \
24         -DLOCALEDIR="\"$(datadir)/locale\"" \
25         @INCINTL@
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
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 differ in newer automake used by gold, but note the
36 # addition of OPT_NO_PLUGINS and use of CC and CXX in LINK1 and CXXLINK1.
37 COMPILE1 = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
38         $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
39 LINK1 = $(CC) $(AM_CFLAGS) $(CFLAGS) $(OPT_NO_PLUGINS) \
40         $(AM_LDFLAGS) $(LDFLAGS) -o $@
41 CXXCOMPILE1 = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
42         $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
43 CXXLINK1 = $(CXX) $(AM_CXXFLAGS) $(CXXFLAGS) $(OPT_NO_PLUGINS) \
44         $(AM_LDFLAGS) $(LDFLAGS) -o $@
46 # Put our -B option before any other -B that might be in $CC or $CXX
47 editcc = -e 's/\([^ ]*\)\(.*\)/\1 -Bgcctestdir\/\2/'
49 # Strip out -Wp,-D_FORTIFY_SOURCE=, which is irrelevant for the gold
50 # testsuite and incompatible with -O0 used in gold tests.
51 editcc1 = -e 's/-Wp,-D_FORTIFY_SOURCE=[0-9][0-9]*//'
53 CCLD = `echo $(CC) | sed $(editcc)`
54 CXXLD = `echo $(CXX) | sed $(editcc)`
55 COMPILE = `echo $(COMPILE1) | sed $(editcc) $(editcc1)`
56 LINK = `echo $(LINK1) | sed $(editcc) $(editcc1)`
57 CXXCOMPILE = `echo $(CXXCOMPILE1) | sed $(editcc) $(editcc1)`
58 CXXLINK = `echo $(CXXLINK1) | sed $(editcc) $(editcc1)`
60 # Strip out -static-libgcc and -static-libstdc++ options, for tests
61 # that must have these libraries linked dynamically.  The -shared-libgcc
62 # option does not work correctly, and there is no -shared-libstdc++ option.
63 # (See GCC PR 55781 and PR 55782.)
64 editcc2 = -e 's/-static-lib\(gcc\|stdc++\) *//g'
65 CXXLINK_S = `echo $(CXXLINK1) | sed $(editcc) $(editcc1) $(editcc2)`
67 TEST_READELF = $(top_builddir)/../binutils/readelf
68 TEST_OBJDUMP = $(top_builddir)/../binutils/objdump
69 TEST_OBJCOPY = $(top_builddir)/../binutils/objcopy
70 TEST_CXXFILT = $(top_builddir)/../binutils/cxxfilt
71 TEST_STRIP = $(top_builddir)/../binutils/strip-new
72 TEST_AR = $(top_builddir)/../binutils/ar
73 TEST_NM = $(top_builddir)/../binutils/nm-new
74 TEST_AS = $(top_builddir)/../gas/as-new
76 if PLUGINS
77 LIBDL = -ldl
78 endif
80 if THREADS
81 THREADFLAGS = @PTHREAD_CFLAGS@
82 THREADLIBS = @PTHREAD_LIBS@
83 endif
85 if OMP_SUPPORT
86 TLS_TEST_C_CFLAGS = -fopenmp
87 endif
89 # Since GCC 10 defaults to -fno-common, add -fcommon to common tests to
90 # force common behavior.
91 COMMON_TEST_C_CFLAGS = -fcommon
93 # 'make clean' is good about deleting some intermediate files (such as
94 # .o's), but not all of them (such as .so's and .err files).  We
95 # improve on that here.  automake-1.9 info docs say "mostlyclean" is
96 # the right choice for files 'make' builds that people rebuild.
97 MOSTLYCLEANFILES = *.so *.syms *.stdout *.stderr
99 # Export make variables to the shell scripts so that they can see
100 # (for example) DEFAULT_TARGET.
101 .EXPORT_ALL_VARIABLES:
103 # We will add to these later, for each individual test.  Note
104 # that we add each test under check_SCRIPTS or check_PROGRAMS;
105 # the TESTS variable is automatically populated from these.
106 check_SCRIPTS =
107 check_DATA =
108 check_PROGRAMS =
109 BUILT_SOURCES =
111 TESTS = $(check_SCRIPTS) $(check_PROGRAMS)
113 # ---------------------------------------------------------------------
114 # These tests test the internals of gold (unittests).
116 # Infrastucture needed for the unittests
117 check_LIBRARIES = libgoldtest.a
118 libgoldtest_a_SOURCES = test.cc testmain.cc testfile.cc
120 DEPENDENCIES = \
121         libgoldtest.a ../libgold.a ../../libiberty/libiberty.a $(LIBINTL_DEP)
123 # The unittests themselves
124 if NATIVE_OR_CROSS_LINKER
125 if GCC
127 # Infrastucture needed for the unittests: a directory where the linker
128 # is named 'ld'.  This is because the -B flag appends 'ld' to its arg.
129 gcctestdir/ld: ../ld-new gcctestdir/collect-ld
130         test -d gcctestdir || mkdir -p gcctestdir
131         rm -f $@
132         $(LN_S) $(abs_top_builddir)/ld-new $@
134 # Needed when using uninstalled compiler
135 gcctestdir/collect-ld: ../ld-new
136         test -d gcctestdir || mkdir -p gcctestdir
137         rm -f $@
138         $(LN_S) $(abs_top_builddir)/ld-new $@
140 # Some tests require the latest features of an in-tree assembler.
141 gcctestdir/as: $(TEST_AS)
142         test -d gcctestdir || mkdir -p gcctestdir
143         rm -f $@
144         $(LN_S) $(abs_top_builddir)/../gas/as-new $@
146 endif GCC
148 check_PROGRAMS += object_unittest
149 object_unittest_SOURCES = object_unittest.cc
150 object_unittest_LDFLAGS = $(THREADFLAGS)
151 object_unittest_LDADD = libgoldtest.a ../libgold.a ../../libiberty/libiberty.a $(LIBINTL) \
152         $(THREADLIBS) $(LIBDL) $(ZLIB)
154 check_PROGRAMS += binary_unittest
155 binary_unittest_SOURCES = binary_unittest.cc
156 binary_unittest_LDFLAGS = $(THREADFLAGS)
157 binary_unittest_LDADD = libgoldtest.a ../libgold.a ../../libiberty/libiberty.a $(LIBINTL) \
158         $(THREADLIBS) $(LIBDL) $(ZLIB)
160 check_PROGRAMS += leb128_unittest
161 leb128_unittest_SOURCES = leb128_unittest.cc
162 leb128_unittest_LDFLAGS = $(THREADFLAGS)
163 leb128_unittest_LDADD = libgoldtest.a ../libgold.a ../../libiberty/libiberty.a $(LIBINTL) \
164         $(THREADLIBS) $(LIBDL) $(ZLIB)
166 check_PROGRAMS += overflow_unittest
167 overflow_unittest_SOURCES = overflow_unittest.cc
168 overflow_unittest_LDFLAGS = $(THREADFLAGS)
169 overflow_unittest_LDADD = libgoldtest.a ../libgold.a ../../libiberty/libiberty.a $(LIBINTL) \
170         $(THREADLIBS) $(LIBDL) $(ZLIB)
171 overflow_unittest.o: overflow_unittest.cc
172         $(CXXCOMPILE) -O3 -c -o $@ $<
174 endif NATIVE_OR_CROSS_LINKER
176 # ---------------------------------------------------------------------
177 # These tests test the output of gold (end-to-end tests).  In
178 # particular, they make sure that gold can link "difficult" object
179 # files, and the resulting object files run correctly.  These can only
180 # run if we've built ld-new for the native architecture (that is,
181 # we're not cross-compiling it), since we run ld-new as part of these
182 # tests.  We use the gcc-specific flag '-B' to use our linker instead
183 # of the default linker, which is why we only run our tests under gcc.
185 if NATIVE_LINKER
186 if GCC
188 # Test empty command line error conditions.
189 check_SCRIPTS += empty_command_line_test.sh
190 empty_command_line_test.sh: gcctestdir/ld
192 # Each of these .o's is a useful, small complete program.  They're
193 # particularly useful for making sure ld-new's flags do what they're
194 # supposed to (hence their names), but are used for many tests that
195 # don't actually involve analyzing input data.
196 flagstest_debug.o: constructor_test.cc
197         $(CXXCOMPILE) -O0 -g -c -o $@ $<
198 flagstest_ndebug.o: constructor_test.cc
199         $(CXXCOMPILE) -O0 -c -o $@ $<
201 check_SCRIPTS += incremental_test.sh
202 check_DATA += incremental_test.stdout
203 MOSTLYCLEANFILES += incremental_test incremental_test.cmdline
204 incremental_test_1.o: incremental_test_1.c
205         $(COMPILE) -O0 -c -ffunction-sections -g -o $@ $<
206 incremental_test_2.o: incremental_test_2.c
207         $(COMPILE) -O0 -c -ffunction-sections -g -o $@ $<
208 incremental_test: incremental_test_1.o incremental_test_2.o gcctestdir/ld
209         $(LINK) -Wl,--incremental-full -Wl,-z,norelro,-no-pie incremental_test_1.o incremental_test_2.o -Wl,-debug 2> incremental_test.cmdline
210 incremental_test.stdout: incremental_test ../incremental-dump
211         ../incremental-dump incremental_test > $@
213 check_SCRIPTS += gc_comdat_test.sh
214 check_DATA += gc_comdat_test.stdout
215 MOSTLYCLEANFILES += gc_comdat_test
216 gc_comdat_test_1.o: gc_comdat_test_1.cc
217         $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
218 gc_comdat_test_2.o: gc_comdat_test_2.cc
219         $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
220 gc_comdat_test: gc_comdat_test_1.o gc_comdat_test_2.o gcctestdir/ld
221         $(CXXLINK) -Wl,--gc-sections gc_comdat_test_1.o gc_comdat_test_2.o
222 gc_comdat_test.stdout: gc_comdat_test
223         $(TEST_NM) -C gc_comdat_test > gc_comdat_test.stdout
225 check_SCRIPTS += gc_tls_test.sh
226 check_DATA += gc_tls_test.stdout
227 MOSTLYCLEANFILES += gc_tls_test
228 gc_tls_test.o: gc_tls_test.cc
229         $(CXXCOMPILE) -O0 -c -g -o $@ $<
230 gc_tls_test:gc_tls_test.o gcctestdir/ld
231         $(CXXLINK) -Wl,--gc-sections gc_tls_test.o
232 gc_tls_test.stdout: gc_tls_test
233         $(TEST_NM) -C gc_tls_test > gc_tls_test.stdout
235 check_SCRIPTS += gc_orphan_section_test.sh
236 check_DATA += gc_orphan_section_test.stdout
237 MOSTLYCLEANFILES += gc_orphan_section_test
238 gc_orphan_section_test.o: gc_orphan_section_test.cc
239         $(CXXCOMPILE) -O0 -c -g -o $@ $<
240 gc_orphan_section_test:gc_orphan_section_test.o gcctestdir/ld
241         $(CXXLINK) -Wl,--gc-sections gc_orphan_section_test.o
242 gc_orphan_section_test.stdout: gc_orphan_section_test
243         $(TEST_NM) gc_orphan_section_test > gc_orphan_section_test.stdout
245 check_SCRIPTS += pr14265.sh
246 check_DATA += pr14265.stdout
247 MOSTLYCLEANFILES += pr14265
248 pr14265.o: pr14265.c
249         $(COMPILE) -O0 -c -o $@ $<
250 pr14265: pr14265.o gcctestdir/ld $(srcdir)/pr14265.t
251         $(LINK) -Wl,--gc-sections -Wl,-T,$(srcdir)/pr14265.t -o $@ $<
252 pr14265.stdout: pr14265
253         $(TEST_NM) --format=bsd --numeric-sort $< > $@
255 check_SCRIPTS += pr20717.sh
256 check_DATA += pr20717.stdout
257 MOSTLYCLEANFILES += pr20717
258 pr20717.o: pr20717.c
259         $(COMPILE) -O0 -ffunction-sections -c -o $@ $<
260 pr20717: pr20717.o gcctestdir/ld $(srcdir)/pr20717.t
261         $(LINK) -Wl,--gc-sections -Wl,-T,$(srcdir)/pr20717.t -o $@ $<
262 pr20717.stdout: pr20717
263         $(TEST_NM) $< > $@
265 check_SCRIPTS += gc_dynamic_list_test.sh
266 check_DATA += gc_dynamic_list_test.stdout
267 MOSTLYCLEANFILES += gc_dynamic_list_test
268 gc_dynamic_list_test.o: gc_dynamic_list_test.c
269         $(COMPILE) -c -ffunction-sections -o $@ $<
270 gc_dynamic_list_test: gc_dynamic_list_test.o gcctestdir/ld $(srcdir)/gc_dynamic_list_test.t
271         $(LINK) -Wl,--gc-sections -Wl,--dynamic-list,$(srcdir)/gc_dynamic_list_test.t gc_dynamic_list_test.o
272 gc_dynamic_list_test.stdout: gc_dynamic_list_test
273         $(TEST_NM) gc_dynamic_list_test > $@
275 check_SCRIPTS += icf_test.sh
276 check_DATA += icf_test.map
277 MOSTLYCLEANFILES += icf_test icf_test.map
278 icf_test.o: icf_test.cc
279         $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
280 icf_test: icf_test.o gcctestdir/ld
281         $(CXXLINK) -o icf_test -Wl,--icf=all,-Map,icf_test.map icf_test.o
282 icf_test.map: icf_test
283         @touch icf_test.map
285 check_SCRIPTS += icf_test_pr21066.sh
286 check_DATA += icf_test_pr21066.map
287 MOSTLYCLEANFILES += icf_test_pr21066 icf_test_pr21066.map
288 icf_test_pr21066.o: icf_test_pr21066.cc
289         $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
290 icf_test_pr21066: icf_test_pr21066.o gcctestdir/ld
291         $(CXXLINK) -o icf_test_pr21066 -Bgcctestdir/ -Wl,--icf=all,-Map,icf_test_pr21066.map icf_test_pr21066.o
292 icf_test_pr21066.map: icf_test_pr21066
293         @touch icf_test_pr21066.map
295 check_SCRIPTS += icf_keep_unique_test.sh
296 check_DATA += icf_keep_unique_test.stdout
297 MOSTLYCLEANFILES += icf_keep_unique_test
298 icf_keep_unique_test.o: icf_keep_unique_test.cc
299         $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
300 icf_keep_unique_test: icf_keep_unique_test.o gcctestdir/ld
301         $(CXXLINK) -Wl,--icf=all -Wl,--keep-unique,_Z11unique_funcv icf_keep_unique_test.o
302 icf_keep_unique_test.stdout: icf_keep_unique_test
303         $(TEST_NM) -C $< > $@
305 check_SCRIPTS += icf_safe_test.sh
306 check_DATA += icf_safe_test_1.stdout icf_safe_test_2.stdout icf_safe_test.map
307 MOSTLYCLEANFILES += icf_safe_test icf_safe_test.map
308 icf_safe_test.o: icf_safe_test.cc
309         $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
310 icf_safe_test: icf_safe_test.o gcctestdir/ld
311         $(CXXLINK) -o icf_safe_test -Wl,--icf=safe,-Map,icf_safe_test.map icf_safe_test.o
312 icf_safe_test.map: icf_safe_test
313         @touch icf_safe_test.map
314 icf_safe_test_1.stdout: icf_safe_test
315         $(TEST_NM) $< > $@
316 icf_safe_test_2.stdout: icf_safe_test
317         $(TEST_READELF) -h $< > $@
319 check_SCRIPTS += icf_safe_pie_test.sh
320 check_DATA += icf_safe_pie_test_1.stdout icf_safe_pie_test_2.stdout icf_safe_pie_test.map
321 MOSTLYCLEANFILES += icf_safe_pie_test icf_safe_pie_test.map
322 icf_safe_pie_test.o: icf_safe_test.cc
323         $(CXXCOMPILE) -O0 -c -ffunction-sections -fPIE -g -o $@ $<
324 icf_safe_pie_test: icf_safe_pie_test.o gcctestdir/ld
325         $(CXXLINK) -o icf_safe_pie_test -Wl,--icf=safe,-Map,icf_safe_pie_test.map icf_safe_pie_test.o -pie
326 icf_safe_pie_test.map: icf_safe_pie_test
327         @touch icf_safe_pie_test.map
328 icf_safe_pie_test_1.stdout: icf_safe_pie_test
329         $(TEST_NM) $< > $@
330 icf_safe_pie_test_2.stdout: icf_safe_pie_test
331         $(TEST_READELF) -h $< > $@
333 check_SCRIPTS += icf_safe_so_test.sh
334 check_DATA += icf_safe_so_test_1.stdout icf_safe_so_test_2.stdout icf_safe_so_test.map
335 MOSTLYCLEANFILES += icf_safe_so_test icf_safe_so_test.map
336 icf_safe_so_test.o: icf_safe_so_test.cc
337         $(CXXCOMPILE) -O0 -c -ffunction-sections -fPIC -g -o $@ $<
338 icf_safe_so_test: icf_safe_so_test.o gcctestdir/ld
339         $(CXXLINK) -o icf_safe_so_test -Wl,--icf=safe,-Map,icf_safe_so_test.map icf_safe_so_test.o -fPIC -shared
340 icf_safe_so_test.map:
341         @touch icf_safe_so_test.map
342 icf_safe_so_test_1.stdout: icf_safe_so_test
343         $(TEST_NM) $< > $@
344 icf_safe_so_test_2.stdout: icf_safe_so_test
345         $(TEST_READELF) -h $< > $@
347 check_SCRIPTS += final_layout.sh
348 check_DATA += final_layout.stdout
349 MOSTLYCLEANFILES += final_layout final_layout_sequence.txt final_layout_script.lds
350 final_layout.o: final_layout.cc
351         $(CXXCOMPILE) -O0 -c -ffunction-sections -fdata-sections -g -o $@ $<
352 final_layout_sequence.txt:
353         (echo "*_Z3barv*" && echo ".text._Z3bazv" && echo "*_Z3foov*" && echo "*global_varb*" && echo "*global_vara*" && echo "*global_varc*") > final_layout_sequence.txt
354 final_layout_script.lds:
355         (echo "SECTIONS { .text : { *(.text*) } .got : { *(.got .toc) } .sbss : { *(.sbss*) } .bss : { *(.bss*) } }") > final_layout_script.lds
356 final_layout: final_layout.o final_layout_sequence.txt final_layout_script.lds gcctestdir/ld
357         $(CXXLINK) -Wl,--section-ordering-file,final_layout_sequence.txt -Wl,-T,final_layout_script.lds final_layout.o
358 final_layout.stdout: final_layout
359         $(TEST_NM) -n --synthetic final_layout > final_layout.stdout
361 check_SCRIPTS += text_section_grouping.sh
362 check_DATA += text_section_grouping.stdout text_section_no_grouping.stdout
363 MOSTLYCLEANFILES += text_section_grouping text_section_no_grouping
364 text_section_grouping.o: text_section_grouping.cc
365         $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
366 text_section_grouping: text_section_grouping.o gcctestdir/ld
367         $(CXXLINK) text_section_grouping.o
368 text_section_no_grouping: text_section_grouping.o gcctestdir/ld
369         $(CXXLINK) -Wl,--no-text-reorder text_section_grouping.o
370 text_section_grouping.stdout: text_section_grouping
371         $(TEST_NM) -n --synthetic text_section_grouping > text_section_grouping.stdout
372 text_section_no_grouping.stdout: text_section_no_grouping
373         $(TEST_NM) -n --synthetic text_section_no_grouping > text_section_no_grouping.stdout
375 check_SCRIPTS += section_sorting_name.sh
376 check_DATA += section_sorting_name.stdout
377 MOSTLYCLEANFILES += section_sorting_name
378 section_sorting_name.o: section_sorting_name.cc
379         $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
380 section_sorting_name: section_sorting_name.o gcctestdir/ld
381         $(CXXLINK) -Wl,--sort-section=name section_sorting_name.o
382 section_sorting_name.stdout: section_sorting_name
383         $(TEST_NM) -n --synthetic section_sorting_name > section_sorting_name.stdout
385 check_SCRIPTS += text_unlikely_segment.sh
386 check_DATA += text_unlikely_segment_readelf.stdout
387 MOSTLYCLEANFILES += text_unlikely_segment
388 text_unlikely_segment.o: text_unlikely_segment.cc
389         $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
390 text_unlikely_segment: text_unlikely_segment.o gcctestdir/ld
391         $(CXXLINK) -Wl,-z,text-unlikely-segment text_unlikely_segment.o
392 text_unlikely_segment_readelf.stdout: text_unlikely_segment
393         $(TEST_READELF) -Wl $< >$@
395 check_SCRIPTS += keep_text_section_prefix.sh
396 check_DATA += keep_text_section_prefix_readelf.stdout keep_text_section_prefix_nm.stdout
397 MOSTLYCLEANFILES += keep_text_section_prefix
398 keep_text_section_prefix.o: keep_text_section_prefix.cc
399         $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
400 keep_text_section_prefix: keep_text_section_prefix.o gcctestdir/ld
401         $(CXXLINK) -Wl,-z,keep-text-section-prefix keep_text_section_prefix.o
402 keep_text_section_prefix_readelf.stdout: keep_text_section_prefix
403         $(TEST_READELF) -Wl $< >$@
404 keep_text_section_prefix_nm.stdout: keep_text_section_prefix
405         $(TEST_NM) -n --synthetic $< >$@
407 check_PROGRAMS += icf_virtual_function_folding_test
408 MOSTLYCLEANFILES += icf_virtual_function_folding_test icf_virtual_function_folding_test.map
409 icf_virtual_function_folding_test.o: icf_virtual_function_folding_test.cc
410         $(CXXCOMPILE) -O0 -c -ffunction-sections -fPIE -g -o $@ $<
411 icf_virtual_function_folding_test: icf_virtual_function_folding_test.o gcctestdir/ld
412         $(CXXLINK) -Wl,--icf=all icf_virtual_function_folding_test.o -pie
414 check_SCRIPTS += icf_preemptible_functions_test.sh
415 check_DATA += icf_preemptible_functions_test.stdout
416 MOSTLYCLEANFILES += icf_preemptible_functions_test
417 icf_preemptible_functions_test.o: icf_preemptible_functions_test.cc
418         $(CXXCOMPILE) -O0 -c -ffunction-sections -fPIC -g -o $@ $<
419 icf_preemptible_functions_test: icf_preemptible_functions_test.o gcctestdir/ld
420         $(CXXLINK) -Wl,--icf=all icf_preemptible_functions_test.o -fPIC -shared
421 icf_preemptible_functions_test.stdout: icf_preemptible_functions_test
422         $(TEST_NM) icf_preemptible_functions_test > icf_preemptible_functions_test.stdout
424 check_SCRIPTS += icf_string_merge_test.sh
425 check_DATA += icf_string_merge_test.stdout
426 MOSTLYCLEANFILES += icf_string_merge_test
427 icf_string_merge_test.o: icf_string_merge_test.cc
428         $(CXXCOMPILE) -O0 -c -ffunction-sections -fPIC -g -o $@ $<
429 icf_string_merge_test: icf_string_merge_test.o gcctestdir/ld
430         $(CXXLINK) -Wl,--icf=all icf_string_merge_test.o
431 icf_string_merge_test.stdout: icf_string_merge_test
432         $(TEST_NM) icf_string_merge_test > icf_string_merge_test.stdout
434 check_SCRIPTS += icf_sht_rel_addend_test.sh
435 check_DATA += icf_sht_rel_addend_test.stdout
436 MOSTLYCLEANFILES += icf_sht_rel_addend_test
437 icf_sht_rel_addend_test_1.o: icf_sht_rel_addend_test_1.cc
438         $(CXXCOMPILE) -O0 -c -ffunction-sections -fPIC -g -o $@ $<
439 icf_sht_rel_addend_test_2.o: icf_sht_rel_addend_test_2.cc
440         $(CXXCOMPILE) -O0 -c -ffunction-sections -fPIC -g -o $@ $<
441 icf_sht_rel_addend_test: icf_sht_rel_addend_test_1.o icf_sht_rel_addend_test_2.o gcctestdir/ld
442         $(CXXLINK) -Wl,--icf=all icf_sht_rel_addend_test_1.o icf_sht_rel_addend_test_2.o
443 icf_sht_rel_addend_test.stdout: icf_sht_rel_addend_test
444         $(TEST_NM) icf_sht_rel_addend_test > icf_sht_rel_addend_test.stdout
446 check_PROGRAMS += large_symbol_alignment
447 large_symbol_alignment_SOURCES = large_symbol_alignment.cc
448 large_symbol_alignment_DEPENDENCIES = gcctestdir/ld
449 large_symbol_alignment_LDADD =
451 check_SCRIPTS += merge_string_literals.sh
452 check_DATA += merge_string_literals.stdout
453 MOSTLYCLEANFILES += merge_string_literals
454 merge_string_literals_1.o: merge_string_literals_1.cc
455         $(CXXCOMPILE) -O2 -c -fPIC -g -o $@ $<
456 merge_string_literals_2.o: merge_string_literals_2.cc
457         $(CXXCOMPILE) -O2 -c -fPIC -g -o $@ $<
458 merge_string_literals: merge_string_literals_1.o merge_string_literals_2.o gcctestdir/ld
459         $(CXXLINK) merge_string_literals_1.o merge_string_literals_2.o -O2 -shared -nostdlib
460 merge_string_literals.stdout: merge_string_literals
461         $(TEST_OBJDUMP) -s -j.rodata merge_string_literals > merge_string_literals.stdout
463 check_PROGRAMS += basic_test
464 check_PROGRAMS += basic_pic_test
465 basic_test.o: basic_test.cc
466         $(CXXCOMPILE) -O0 -c -o $@ $<
467 basic_test: basic_test.o gcctestdir/ld
468         $(CXXLINK) basic_test.o
470 check_PROGRAMS += eh_test
471 eh_test_a.o: eh_test_a.cc
472         $(CXXCOMPILE) -O0 -c -o $@ $<
473 eh_test_b.o: eh_test_b.cc
474         $(CXXCOMPILE) -O0 -c -o $@ $<
475 eh_test: eh_test_a.o eh_test_b.o gcctestdir/ld
476         $(CXXLINK_S) eh_test_a.o eh_test_b.o
478 check_SCRIPTS += eh_test_2.sh
479 check_DATA += eh_test_2.sects
480 MOSTLYCLEANFILES += eh_test_2 eh_test_2.sects
481 eh_test_r.o: eh_test_a.o eh_test_b.o gcctestdir/ld
482         gcctestdir/ld -r -o $@ eh_test_a.o eh_test_b.o
483 eh_test_2: eh_test_r.o gcctestdir/ld
484         $(CXXLINK_S) -Wl,--eh-frame-hdr eh_test_r.o
485 eh_test_2.sects: eh_test_2
486         $(TEST_READELF) -SW $< >$@ 2>/dev/null
488 if HAVE_STATIC
489 check_PROGRAMS += basic_static_test
490 basic_static_test: basic_test.o gcctestdir/ld
491         $(CXXLINK) -static basic_test.o
492 endif
494 basic_pic_test.o: basic_test.cc
495         $(CXXCOMPILE) -O0 -c -fpic -o $@ $<
496 basic_pic_test: basic_pic_test.o gcctestdir/ld
497         $(CXXLINK) basic_pic_test.o
499 if HAVE_STATIC
500 check_PROGRAMS += basic_static_pic_test
501 basic_static_pic_test: basic_pic_test.o gcctestdir/ld
502         $(CXXLINK) -static basic_pic_test.o
503 endif
505 check_PROGRAMS += basic_pie_test
506 basic_pie_test.o: basic_test.cc
507         $(CXXCOMPILE) -O0 -c -fpie -o $@ $<
508 basic_pie_test: basic_pie_test.o gcctestdir/ld
509         $(CXXLINK) -pie basic_pie_test.o
511 if THREADS
512 check_PROGRAMS += basic_threads_test
513 basic_threads_test: basic_test.o gcctestdir/ld
514         $(CXXLINK) -Wl,--threads basic_test.o
515 endif
517 check_PROGRAMS += constructor_test
518 constructor_test_SOURCES = constructor_test.cc
519 constructor_test_DEPENDENCIES = gcctestdir/ld
520 constructor_test_LDADD =
522 if HAVE_STATIC
523 check_PROGRAMS += constructor_static_test
524 constructor_static_test_SOURCES = $(constructor_test_SOURCES)
525 constructor_static_test_DEPENDENCIES = $(constructor_test_DEPENDENCIES)
526 constructor_static_test_LDFLAGS = $(constructor_test_LDFLAGS) -static
527 constructor_static_test_LDADD = $(constructor_test_LDADD)
528 endif
530 check_PROGRAMS += two_file_test
531 check_PROGRAMS += two_file_pic_test
532 two_file_test_SOURCES = \
533         two_file_test_1.cc \
534         two_file_test_1b.cc \
535         two_file_test_2.cc \
536         two_file_test_main.cc \
537         two_file_test.h
538 two_file_test_DEPENDENCIES = gcctestdir/ld
539 two_file_test_LDADD =
541 if HAVE_STATIC
542 check_PROGRAMS += two_file_static_test
543 two_file_static_test_SOURCES = $(two_file_test_SOURCES)
544 two_file_static_test_DEPENDENCIES = $(two_file_test_DEPENDENCIES)
545 two_file_static_test_LDFLAGS = $(two_file_test_LDFLAGS) -static
546 two_file_static_test_LDADD = $(two_file_test_LDADD)
547 endif
549 two_file_pic_test_SOURCES = two_file_test_main.cc
550 two_file_pic_test_DEPENDENCIES = \
551         gcctestdir/ld two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o
552 two_file_pic_test_LDADD = two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o
555 check_PROGRAMS += two_file_shared_1_test
556 check_PROGRAMS += two_file_shared_2_test
557 check_PROGRAMS += two_file_shared_1_pic_2_test
558 check_PROGRAMS += two_file_shared_2_pic_1_test
559 check_PROGRAMS += two_file_same_shared_test
560 check_PROGRAMS += two_file_separate_shared_12_test
561 check_PROGRAMS += two_file_separate_shared_21_test
562 two_file_test_1_pic.o: two_file_test_1.cc
563         $(CXXCOMPILE) -c -fpic -o $@ $<
564 two_file_test_1b_pic.o: two_file_test_1b.cc
565         $(CXXCOMPILE) -c -fpic -o $@ $<
566 two_file_test_2_pic.o: two_file_test_2.cc
567         $(CXXCOMPILE) -c -fpic -o $@ $<
568 two_file_shared_1.so: two_file_test_1_pic.o two_file_test_1b_pic.o gcctestdir/ld
569         $(CXXLINK) -shared two_file_test_1_pic.o two_file_test_1b_pic.o
570 two_file_shared_2.so: two_file_test_2_pic.o gcctestdir/ld
571         $(CXXLINK) -shared two_file_test_2_pic.o
572 two_file_shared.so: two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o gcctestdir/ld
573         $(CXXLINK) -shared two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o
575 two_file_shared_1_test_SOURCES = two_file_test_2.cc two_file_test_main.cc
576 two_file_shared_1_test_DEPENDENCIES = gcctestdir/ld two_file_shared_1.so
577 two_file_shared_1_test_LDFLAGS = -Wl,-R,.
578 two_file_shared_1_test_LDADD = two_file_shared_1.so
580 two_file_shared_2_test_SOURCES = two_file_test_1.cc two_file_test_1b.cc two_file_test_main.cc
581 two_file_shared_2_test_DEPENDENCIES = gcctestdir/ld two_file_shared_2.so
582 two_file_shared_2_test_LDFLAGS = -Wl,-R,.
583 two_file_shared_2_test_LDADD = two_file_shared_2.so
585 two_file_shared_1_pic_2_test_SOURCES = two_file_test_main.cc
586 two_file_shared_1_pic_2_test_DEPENDENCIES = \
587         gcctestdir/ld two_file_shared_2.so two_file_test_1_pic.o two_file_test_1b_pic.o
588 two_file_shared_1_pic_2_test_LDFLAGS = -Wl,-R,.
589 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
591 two_file_shared_2_pic_1_test_SOURCES = two_file_test_main.cc
592 two_file_shared_2_pic_1_test_DEPENDENCIES = \
593         gcctestdir/ld two_file_shared_1.so two_file_test_2_pic.o
594 two_file_shared_2_pic_1_test_LDFLAGS = -Wl,-R,.
595 two_file_shared_2_pic_1_test_LDADD = two_file_test_2_pic.o two_file_shared_1.so
597 two_file_same_shared_test_SOURCES = two_file_test_main.cc
598 two_file_same_shared_test_DEPENDENCIES = gcctestdir/ld two_file_shared.so
599 two_file_same_shared_test_LDFLAGS = -Wl,-R,.
600 two_file_same_shared_test_LDADD = two_file_shared.so
602 two_file_separate_shared_12_test_SOURCES = two_file_test_main.cc
603 two_file_separate_shared_12_test_DEPENDENCIES = \
604         gcctestdir/ld two_file_shared_1.so two_file_shared_2.so
605 two_file_separate_shared_12_test_LDFLAGS = -Wl,-R,.
606 two_file_separate_shared_12_test_LDADD = \
607         two_file_shared_1.so two_file_shared_2.so
609 two_file_separate_shared_21_test_SOURCES = two_file_test_main.cc
610 two_file_separate_shared_21_test_DEPENDENCIES = \
611         gcctestdir/ld two_file_shared_1.so two_file_shared_2.so
612 two_file_separate_shared_21_test_LDFLAGS = -Wl,-R,.
613 two_file_separate_shared_21_test_LDADD = \
614         two_file_shared_2.so two_file_shared_1.so
616 check_PROGRAMS += two_file_relocatable_test
617 two_file_relocatable_test_SOURCES = two_file_test_main.cc
618 two_file_relocatable_test_DEPENDENCIES = \
619         gcctestdir/ld two_file_relocatable.o
620 two_file_relocatable_test_LDFLAGS = -Wl,-R,.
621 two_file_relocatable_test_LDADD = two_file_relocatable.o
622 two_file_relocatable.o: gcctestdir/ld two_file_test_1.o two_file_test_1b.o two_file_test_2.o
623         gcctestdir/ld -r -o $@ two_file_test_1.o two_file_test_1b.o two_file_test_2.o
625 check_PROGRAMS += two_file_pie_test
626 two_file_test_1_pie.o: two_file_test_1.cc
627         $(CXXCOMPILE) -c -fpie -o $@ $<
628 two_file_test_1b_pie.o: two_file_test_1b.cc
629         $(CXXCOMPILE) -c -fpie -o $@ $<
630 two_file_test_2_pie.o: two_file_test_2.cc
631         $(CXXCOMPILE) -c -fpie -o $@ $<
632 two_file_test_main_pie.o: two_file_test_main.cc
633         $(CXXCOMPILE) -c -fpie -o $@ $<
634 two_file_pie_test: two_file_test_1_pie.o two_file_test_1b_pie.o \
635                 two_file_test_2_pie.o two_file_test_main_pie.o gcctestdir/ld
636         $(CXXLINK) -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
638 check_PROGRAMS += pie_copyrelocs_test
639 pie_copyrelocs_test_SOURCES = pie_copyrelocs_test.cc
640 pie_copyrelocs_test_DEPENDENCIES = gcctestdir/ld pie_copyrelocs_shared_test.so
641 pie_copyrelocs_test_CXXFLAGS = -fno-exceptions -fno-asynchronous-unwind-tables
642 pie_copyrelocs_test_LDFLAGS = -Wl,-R,. -pie
643 pie_copyrelocs_test_LDADD = pie_copyrelocs_shared_test.so
644 pie_copyrelocs_shared_test.o: pie_copyrelocs_shared_test.cc
645         $(CXXCOMPILE) -O2 -fpic -c -o $@ $<
646 pie_copyrelocs_shared_test.so: pie_copyrelocs_shared_test.o gcctestdir/ld
647         $(CXXLINK) -shared pie_copyrelocs_shared_test.o
649 check_PROGRAMS += weak_unresolved_symbols_test
650 weak_unresolved_symbols_test_SOURCES = weak_unresolved_symbols_test.cc
651 weak_unresolved_symbols_test_CXXFLAGS = -fPIE
652 weak_unresolved_symbols_test_LDFLAGS = -pie -Wl,--weak-unresolved-symbols
654 check_SCRIPTS += two_file_shared.sh
655 check_DATA += two_file_shared.dbg
656 MOSTLYCLEANFILES += two_file_shared.dbg
657 two_file_shared.dbg: two_file_shared.so
658         $(TEST_READELF) -w $< >$@ 2>/dev/null
660 # The nonpic tests will fail on platforms which can not put non-PIC
661 # code into shared libraries, so we just don't run them in that case.
662 if FN_PTRS_IN_SO_WITHOUT_PIC
664 check_PROGRAMS += two_file_shared_1_nonpic_test
665 check_PROGRAMS += two_file_shared_2_nonpic_test
666 check_PROGRAMS += two_file_same_shared_nonpic_test
667 check_PROGRAMS += two_file_separate_shared_12_nonpic_test
668 check_PROGRAMS += two_file_separate_shared_21_nonpic_test
669 check_PROGRAMS += two_file_mixed_shared_test
670 check_PROGRAMS += two_file_mixed_2_shared_test
671 two_file_shared_1_nonpic.so: two_file_test_1.o gcctestdir/ld
672         $(CXXLINK) -shared two_file_test_1.o two_file_test_1b.o -Wl,-z,notext
673 two_file_shared_2_nonpic.so: two_file_test_2.o gcctestdir/ld
674         $(CXXLINK) -shared two_file_test_2.o
675 two_file_shared_nonpic.so: two_file_test_1.o two_file_test_1b.o two_file_test_2.o gcctestdir/ld
676         $(CXXLINK) -shared two_file_test_1.o two_file_test_1b.o two_file_test_2.o -Wl,-z,notext
677 two_file_shared_mixed.so: two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2.o gcctestdir/ld
678         $(CXXLINK) -shared two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2.o -Wl,-z,notext
679 two_file_shared_mixed_1.so: two_file_test_1.o two_file_test_1b_pic.o two_file_shared_2.so gcctestdir/ld
680         $(CXXLINK) -shared two_file_test_1.o two_file_test_1b_pic.o two_file_shared_2.so -Wl,-z,notext
682 two_file_shared_1_nonpic_test_SOURCES = \
683         two_file_test_2.cc two_file_test_main.cc
684 two_file_shared_1_nonpic_test_DEPENDENCIES = \
685         gcctestdir/ld two_file_shared_1_nonpic.so
686 two_file_shared_1_nonpic_test_LDFLAGS = -Wl,-R,.
687 two_file_shared_1_nonpic_test_LDADD = two_file_shared_1_nonpic.so
689 two_file_shared_2_nonpic_test_SOURCES = \
690         two_file_test_1.cc two_file_test_1b.cc two_file_test_main.cc
691 two_file_shared_2_nonpic_test_DEPENDENCIES = \
692         gcctestdir/ld two_file_shared_2_nonpic.so
693 two_file_shared_2_nonpic_test_LDFLAGS = -Wl,-R,.
694 two_file_shared_2_nonpic_test_LDADD = two_file_shared_2_nonpic.so
696 two_file_same_shared_nonpic_test_SOURCES = two_file_test_main.cc
697 two_file_same_shared_nonpic_test_DEPENDENCIES = \
698         gcctestdir/ld two_file_shared_nonpic.so
699 two_file_same_shared_nonpic_test_LDFLAGS = -Wl,-R,.
700 two_file_same_shared_nonpic_test_LDADD = two_file_shared_nonpic.so
702 two_file_separate_shared_12_nonpic_test_SOURCES = two_file_test_main.cc
703 two_file_separate_shared_12_nonpic_test_DEPENDENCIES = \
704         gcctestdir/ld two_file_shared_1_nonpic.so two_file_shared_2_nonpic.so
705 two_file_separate_shared_12_nonpic_test_LDFLAGS = -Wl,-R,.
706 two_file_separate_shared_12_nonpic_test_LDADD = \
707         two_file_shared_1_nonpic.so two_file_shared_2_nonpic.so
709 two_file_separate_shared_21_nonpic_test_SOURCES = two_file_test_main.cc
710 two_file_separate_shared_21_nonpic_test_DEPENDENCIES = \
711         gcctestdir/ld two_file_shared_1_nonpic.so two_file_shared_2_nonpic.so
712 two_file_separate_shared_21_nonpic_test_LDFLAGS = -Wl,-R,.
713 two_file_separate_shared_21_nonpic_test_LDADD = \
714         two_file_shared_2_nonpic.so two_file_shared_1_nonpic.so
716 two_file_mixed_shared_test_SOURCES = two_file_test_main.cc
717 two_file_mixed_shared_test_DEPENDENCIES = gcctestdir/ld two_file_shared_mixed.so
718 two_file_mixed_shared_test_LDFLAGS = -Wl,-R,.
719 two_file_mixed_shared_test_LDADD = two_file_shared_mixed.so
721 two_file_mixed_2_shared_test_SOURCES = two_file_test_main.cc
722 two_file_mixed_2_shared_test_DEPENDENCIES = gcctestdir/ld two_file_shared_mixed_1.so two_file_shared_2.so
723 two_file_mixed_2_shared_test_LDFLAGS = -Wl,-R,.
724 two_file_mixed_2_shared_test_LDADD = two_file_shared_mixed_1.so two_file_shared_2.so
726 check_PROGRAMS += two_file_mixed_pie_test
727 two_file_mixed_pie_test: two_file_test_1.o two_file_test_1b_pie.o \
728                 two_file_test_main_pie.o two_file_shared_2.so gcctestdir/ld
729         $(CXXLINK) -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
731 endif FN_PTRS_IN_SO_WITHOUT_PIC
733 check_PROGRAMS += two_file_strip_test
734 two_file_strip_test: two_file_test
735         $(TEST_STRIP) -o two_file_strip_test two_file_test
737 check_PROGRAMS += two_file_same_shared_strip_test
738 two_file_same_shared_strip_test_SOURCES = two_file_test_main.cc
739 two_file_same_shared_strip_test_DEPENDENCIES = \
740         gcctestdir/ld two_file_shared_strip.so
741 two_file_same_shared_strip_test_LDFLAGS = -Wl,-R.
742 two_file_same_shared_strip_test_LDADD = two_file_shared_strip.so
743 two_file_shared_strip.so: two_file_shared.so
744         $(TEST_STRIP) -S -o two_file_shared_strip.so two_file_shared.so
746 check_PROGRAMS += common_test_1
747 common_test_1_SOURCES = common_test_1.c
748 common_test_1_DEPENDENCIES = gcctestdir/ld
749 common_test_1_LDADD =
750 common_test_1.o: common_test_1.c
751         $(COMPILE) -c $(COMMON_TEST_C_CFLAGS) -o $@ $<
753 check_PROGRAMS += common_test_2
754 common_test_2_SOURCES = common_test_1.c
755 common_test_2_DEPENDENCIES = common_test_2.so common_test_3.so gcctestdir/ld
756 common_test_2_LDFLAGS = -Wl,-R,.
757 common_test_2_LDADD = common_test_2.so common_test_3.so
758 common_test_2.o: common_test_2.c
759         $(COMPILE) -c $(COMMON_TEST_C_CFLAGS) -o $@ $<
760 common_test_2_pic.o: common_test_2.c
761         $(COMPILE) -c -fpic $(COMMON_TEST_C_CFLAGS) -o $@ $<
762 common_test_2.so: common_test_2_pic.o common_test_3.so gcctestdir/ld
763         $(LINK) -shared common_test_2_pic.o common_test_3.so
764 common_test_3.o: common_test_3.c
765         $(COMPILE) -c $(COMMON_TEST_C_CFLAGS) -o $@ $<
766 common_test_3_pic.o: common_test_3.c
767         $(COMPILE) -c -fpic $(COMMON_TEST_C_CFLAGS) -o $@ $<
768 common_test_3.so: common_test_3_pic.o ver_test_2.script gcctestdir/ld
769         $(LINK) -shared common_test_3_pic.o -Wl,--version-script,$(srcdir)/ver_test_2.script
771 check_PROGRAMS += exception_test
772 check_PROGRAMS += exception_shared_1_test
773 check_PROGRAMS += exception_shared_2_test
774 check_PROGRAMS += exception_same_shared_test
775 check_PROGRAMS += exception_separate_shared_12_test
776 check_PROGRAMS += exception_separate_shared_21_test
777 exception_test_1_pic.o: exception_test_1.cc
778         $(CXXCOMPILE) -c -fpic -o $@ $<
779 exception_test_2_pic.o: exception_test_2.cc
780         $(CXXCOMPILE) -c -fpic -o $@ $<
781 exception_shared_1.so: exception_test_1_pic.o gcctestdir/ld
782         $(CXXLINK) -shared exception_test_1_pic.o
783 exception_shared_2.so: exception_test_2_pic.o gcctestdir/ld
784         $(CXXLINK) -shared exception_test_2_pic.o
785 exception_shared.so: exception_test_1_pic.o exception_test_2_pic.o gcctestdir/ld
786         $(CXXLINK) -shared exception_test_1_pic.o exception_test_2_pic.o
788 exception_test_SOURCES = \
789         exception_test_main.cc \
790         exception_test_1.cc \
791         exception_test_2.cc \
792         exception_test.h
793 exception_test_DEPENDENCIES = gcctestdir/ld
794 exception_test_LDADD =
796 if HAVE_STATIC
797 check_PROGRAMS += exception_static_test
798 exception_static_test_SOURCES = $(exception_test_SOURCES)
799 exception_static_test_DEPENDENCIES = $(exception_test_DEPENDENCIES)
800 exception_static_test_LDFLAGS = $(exception_test_LDFLAGS) -static
801 exception_static_test_LDADD = $(exception_test_LDADD)
802 endif
804 exception_shared_1_test_SOURCES = exception_test_2.cc exception_test_main.cc
805 exception_shared_1_test_DEPENDENCIES = gcctestdir/ld exception_shared_1.so
806 exception_shared_1_test_LDFLAGS = -Wl,-R,.
807 exception_shared_1_test_LDADD = exception_shared_1.so
809 exception_shared_2_test_SOURCES = exception_test_1.cc exception_test_main.cc
810 exception_shared_2_test_DEPENDENCIES = gcctestdir/ld exception_shared_2.so
811 exception_shared_2_test_LDFLAGS = -Wl,-R,.
812 exception_shared_2_test_LDADD = exception_shared_2.so
814 exception_same_shared_test_SOURCES = exception_test_main.cc
815 exception_same_shared_test_DEPENDENCIES = gcctestdir/ld exception_shared.so
816 exception_same_shared_test_LDFLAGS = -Wl,-R,.
817 exception_same_shared_test_LDADD = exception_shared.so
819 exception_separate_shared_12_test_SOURCES = exception_test_main.cc
820 exception_separate_shared_12_test_DEPENDENCIES = \
821         gcctestdir/ld exception_shared_1.so exception_shared_2.so
822 exception_separate_shared_12_test_LDFLAGS = -Wl,-R,. -Wl,--no-as-needed
823 exception_separate_shared_12_test_LDADD = \
824         exception_shared_1.so exception_shared_2.so
826 exception_separate_shared_21_test_SOURCES = exception_test_main.cc
827 exception_separate_shared_21_test_DEPENDENCIES = \
828         gcctestdir/ld exception_shared_1.so exception_shared_2.so
829 exception_separate_shared_21_test_LDFLAGS = -Wl,-R,. -Wl,--no-as-needed
830 exception_separate_shared_21_test_LDADD = \
831         exception_shared_2.so exception_shared_1.so
834 check_PROGRAMS += weak_test
835 weak_test_SOURCES = weak_test.cc
836 weak_test_DEPENDENCIES = gcctestdir/ld
837 weak_test_LDADD =
839 check_PROGRAMS += weak_undef_test
840 MOSTLYCLEANFILES += alt/weak_undef_lib.so
841 weak_undef_test_SOURCES = weak_undef_test.cc
842 weak_undef_test_DEPENDENCIES = gcctestdir/ld weak_undef_lib.so alt/weak_undef_lib.so
843 weak_undef_test_LDFLAGS = -Wl,-R,alt
844 weak_undef_test_LDADD = -L . weak_undef_lib.so
845 weak_undef_file1.o: weak_undef_file1.cc
846         $(CXXCOMPILE) -c -fpic -o $@ $<
847 weak_undef_file2.o: weak_undef_file2.cc
848         $(CXXCOMPILE) -c -fpic -o $@ $<
849 weak_undef_lib.so: weak_undef_file1.o gcctestdir/ld
850         $(CXXLINK) -shared weak_undef_file1.o
851 alt/weak_undef_lib.so: weak_undef_file2.o gcctestdir/ld
852         test -d alt || mkdir -p alt
853         $(CXXLINK) -shared weak_undef_file2.o
855 check_PROGRAMS += weak_undef_test_2
856 weak_undef_test_2_SOURCES = weak_undef_test_2.cc
857 weak_undef_test_2_DEPENDENCIES = gcctestdir/ld libweak_undef_2.a
858 weak_undef_test_2_LDFLAGS = -u weak_undef_2
859 weak_undef_test_2_LDADD = -L . -lweak_undef_2
860 MOSTLYCLEANFILES += libweak_undef_2.a
861 libweak_undef_2.a: weak_undef_file3.o weak_undef_file4.o
862         $(TEST_AR) rc $@ $^
863 weak_undef_file3.o: weak_undef_file3.cc
864         $(CXXCOMPILE) -c -o $@ $<
865 weak_undef_file4.o: weak_undef_file4.cc
866         $(CXXCOMPILE) -c -o $@ $<
868 if FN_PTRS_IN_SO_WITHOUT_PIC
869 check_PROGRAMS += weak_undef_nonpic_test
870 MOSTLYCLEANFILES += alt/weak_undef_lib_nonpic.so
871 weak_undef_nonpic_test_SOURCES = weak_undef_test.cc
872 weak_undef_nonpic_test_DEPENDENCIES = gcctestdir/ld weak_undef_lib_nonpic.so alt/weak_undef_lib_nonpic.so
873 weak_undef_nonpic_test_LDFLAGS = -Wl,-R,alt
874 weak_undef_nonpic_test_LDADD = -L . weak_undef_lib_nonpic.so
875 weak_undef_file1_nonpic.o: weak_undef_file1.cc
876         $(CXXCOMPILE) -c -o $@ $<
877 weak_undef_file2_nonpic.o: weak_undef_file2.cc
878         $(CXXCOMPILE) -c -o $@ $<
879 weak_undef_lib_nonpic.so: weak_undef_file1_nonpic.o
880         $(CXXLINK) -shared weak_undef_file1_nonpic.o -Wl,-z,notext
881 alt/weak_undef_lib_nonpic.so: weak_undef_file2_nonpic.o
882         test -d alt || mkdir -p alt
883         $(CXXLINK) -shared weak_undef_file2_nonpic.o -Wl,-z,notext
884 endif FN_PTRS_IN_SO_WITHOUT_PIC
887 check_PROGRAMS += weak_alias_test
888 weak_alias_test_SOURCES = weak_alias_test_main.cc
889 weak_alias_test_DEPENDENCIES = \
890         gcctestdir/ld weak_alias_test_1.so weak_alias_test_2.so \
891         weak_alias_test_3.o weak_alias_test_4.so weak_alias_test_5.so
892 weak_alias_test_LDFLAGS = -Wl,-R,.
893 weak_alias_test_LDADD = \
894         weak_alias_test_1.so weak_alias_test_2.so weak_alias_test_3.o \
895         weak_alias_test_4.so weak_alias_test_5.so
896 weak_alias_test_1_pic.o: weak_alias_test_1.cc
897         $(CXXCOMPILE) -c -fpic -o $@ $<
898 weak_alias_test_1.so: weak_alias_test_1_pic.o gcctestdir/ld
899         $(CXXLINK) -shared weak_alias_test_1_pic.o
900 weak_alias_test_2_pic.o: weak_alias_test_2.cc
901         $(CXXCOMPILE) -c -fpic -o $@ $<
902 weak_alias_test_2.so: weak_alias_test_2_pic.o gcctestdir/ld
903         $(CXXLINK) -shared weak_alias_test_2_pic.o
904 weak_alias_test_3.o: weak_alias_test_3.cc
905         $(CXXCOMPILE) -c -o $@ $<
906 weak_alias_test_4_pic.o: weak_alias_test_4.cc
907         $(CXXCOMPILE) -c -fpic -o $@ $<
908 weak_alias_test_4.so: weak_alias_test_4_pic.o gcctestdir/ld
909         $(CXXLINK) -shared weak_alias_test_4_pic.o
910 weak_alias_test_5_pic.o: weak_alias_test_5.cc
911         $(CXXCOMPILE) -c -fpic -o $@ $<
912 weak_alias_test_5.so: weak_alias_test_5_pic.o $(srcdir)/weak_alias_test.script gcctestdir/ld
913         $(CXXLINK) -shared weak_alias_test_5_pic.o \
914                 -Wl,--version-script,$(srcdir)/weak_alias_test.script
916 check_SCRIPTS += weak_plt.sh
917 check_PROGRAMS += weak_plt
918 check_DATA += weak_plt_shared.so
919 weak_plt_main_pic.o: weak_plt_main.cc
920         $(CXXCOMPILE) -c -fpic -o $@ $<
921 weak_plt: weak_plt_main_pic.o gcctestdir/ld
922         $(CXXLINK) weak_plt_main_pic.o
923 weak_plt_shared_pic.o: weak_plt_shared.cc
924         $(CXXCOMPILE) -c -fpic -o $@ $<
925 weak_plt_shared.so: weak_plt_shared_pic.o gcctestdir/ld
926         $(CXXLINK) -shared weak_plt_shared_pic.o
928 check_PROGRAMS += copy_test
929 copy_test_SOURCES = copy_test.cc
930 copy_test_DEPENDENCIES = gcctestdir/ld copy_test_1.so copy_test_2.so
931 copy_test_LDFLAGS = -Wl,-R,.
932 copy_test_LDADD = copy_test_1.so copy_test_2.so
933 copy_test_1_pic.o: copy_test_1.cc
934         $(CXXCOMPILE) -c -fpic -o $@ $<
935 copy_test_1.so: gcctestdir/ld copy_test_1_pic.o
936         $(CXXLINK) -shared copy_test_1_pic.o
937 copy_test_2_pic.o: copy_test_2.cc
938         $(CXXCOMPILE) -c -fpic -o $@ $<
939 copy_test_2.so: gcctestdir/ld copy_test_2_pic.o
940         $(CXXLINK) -shared copy_test_2_pic.o
942 check_PROGRAMS += copy_test_relro
943 copy_test_relro_SOURCES = copy_test_relro.cc
944 copy_test_relro_DEPENDENCIES = gcctestdir/ld copy_test_relro_1.so
945 copy_test_relro_LDFLAGS = -Wl,-R,. -Wl,-z,relro
946 copy_test_relro_LDADD = copy_test_relro_1.so
947 copy_test_relro_1_pic.o: copy_test_relro_1.cc
948         $(CXXCOMPILE) -c -fpic -o $@ $<
949 copy_test_relro_1.so: gcctestdir/ld copy_test_relro_1_pic.o
950         $(CXXLINK) -shared -Wl,-z,relro copy_test_relro_1_pic.o
952 if !DEFAULT_TARGET_POWERPC
953 check_SCRIPTS += copy_test_protected.sh
954 check_DATA += copy_test_protected.err
955 MOSTLYCLEANFILES += copy_test_protected.err
956 copy_test_protected.err: copy_test_protected.o copy_test_2.so gcctestdir/ld
957         @echo $(CXXLINK) -o copy_test_protected copy_test_protected.o copy_test_2.so -Wl,-R,. "2>$@"
958         @if $(CXXLINK) -o copy_test_protected copy_test_protected.o copy_test_2.so -Wl,-R,. 2>$@; \
959         then \
960           echo 1>&2 "Link of copy_test_protected should have failed"; \
961           rm -f $@; \
962           exit 1; \
963         fi
964 endif
966 if TLS
968 check_PROGRAMS += tls_test
969 check_PROGRAMS += tls_pic_test
970 check_PROGRAMS += tls_pie_test
971 check_PROGRAMS += tls_pie_pic_test
972 check_PROGRAMS += tls_shared_test
973 check_PROGRAMS += tls_shared_ie_test
974 check_PROGRAMS += tls_shared_gd_to_ie_test
975 tls_test_pic.o: tls_test.cc
976         $(CXXCOMPILE) -c -fpic -o $@ $<
977 tls_test_file2_pic.o: tls_test_file2.cc
978         $(CXXCOMPILE) -c -fpic -o $@ $<
979 tls_test_c_pic.o: tls_test_c.c
980         $(COMPILE) -c -fpic $(TLS_TEST_C_CFLAGS) -o $@ $<
981 tls_test_shared.so: tls_test_pic.o tls_test_file2_pic.o tls_test_c_pic.o gcctestdir/ld
982         $(CXXLINK) -shared tls_test_pic.o tls_test_file2_pic.o tls_test_c_pic.o -Wl,-z,defs
983 tls_test_shared2.so: tls_test_file2_pic.o gcctestdir/ld
984         $(CXXLINK) -shared tls_test_file2_pic.o
986 tls_test_pic_ie.o: tls_test.cc
987         $(CXXCOMPILE) -c -fpic -ftls-model=initial-exec -o $@ $<
988 tls_test_file2_pic_ie.o: tls_test_file2.cc
989         $(CXXCOMPILE) -c -fpic -ftls-model=initial-exec -o $@ $<
990 tls_test_c_pic_ie.o: tls_test_c.c
991         $(COMPILE) -c -fpic -ftls-model=initial-exec $(TLS_TEST_C_CFLAGS) -o $@ $<
992 tls_test_ie_shared.so: tls_test_pic_ie.o tls_test_file2_pic_ie.o tls_test_c_pic_ie.o gcctestdir/ld
993         $(CXXLINK) -shared tls_test_pic_ie.o tls_test_file2_pic_ie.o tls_test_c_pic_ie.o
995 tls_test_SOURCES = tls_test.cc tls_test_file2.cc tls_test_main.cc tls_test.h
996 tls_test_DEPENDENCIES = gcctestdir/ld tls_test_c.o
997 tls_test_LDFLAGS = $(THREADFLAGS)
998 tls_test_LDADD = tls_test_c.o $(THREADLIBS)
999 tls_test_c.o: tls_test_c.c
1000         $(COMPILE) -c $(TLS_TEST_C_CFLAGS) -o $@ $<
1002 tls_pic_test_SOURCES = tls_test_main.cc
1003 tls_pic_test_DEPENDENCIES = gcctestdir/ld tls_test_pic.o tls_test_file2_pic.o \
1004         tls_test_c_pic.o
1005 tls_pic_test_LDFLAGS = $(THREADFLAGS)
1006 tls_pic_test_LDADD = tls_test_pic.o tls_test_file2_pic.o tls_test_c_pic.o \
1007         $(THREADLIBS)
1009 tls_test_main_pie.o: tls_test_main.cc tls_test.h
1010         $(CXXCOMPILE) -c -fpie -o $@ $<
1011 tls_test_pie.o: tls_test.cc tls_test.h
1012         $(CXXCOMPILE) -c -fpie -o $@ $<
1013 tls_test_file2_pie.o: tls_test_file2.cc tls_test.h
1014         $(CXXCOMPILE) -c -fpie -o $@ $<
1015 tls_test_c_pie.o: tls_test_c.c
1016         $(COMPILE) -c -fpic $(TLS_TEST_C_CFLAGS) -o $@ $<
1017 tls_pie_test: tls_test_main_pie.o tls_test_pie.o tls_test_file2_pie.o \
1018                 tls_test_c_pie.o gcctestdir/ld
1019         $(CXXLINK) $(THREADFLAGS) -pie tls_test_main_pie.o tls_test_pie.o tls_test_file2_pie.o tls_test_c_pie.o $(THREADLIBS)
1021 check_SCRIPTS += tls_pie_test.sh
1022 check_DATA += tls_pie_test.stdout
1023 tls_pie_test.stdout: tls_pie_test
1024         $(TEST_READELF) -rW $< > $@ 2>/dev/null
1026 tls_pie_pic_test: tls_test_main_pie.o tls_test_pic.o tls_test_file2_pic.o \
1027                 tls_test_c_pic.o gcctestdir/ld
1028         $(CXXLINK) $(THREADFLAGS) -pie tls_test_main_pie.o tls_test_pic.o tls_test_file2_pic.o tls_test_c_pic.o $(THREADLIBS)
1030 tls_shared_test_SOURCES = tls_test_main.cc
1031 tls_shared_test_DEPENDENCIES = gcctestdir/ld tls_test_shared.so
1032 tls_shared_test_LDFLAGS = -Wl,-R,. $(THREADFLAGS)
1033 tls_shared_test_LDADD = tls_test_shared.so $(THREADLIBS)
1035 tls_shared_ie_test_SOURCES = tls_test_main.cc
1036 tls_shared_ie_test_DEPENDENCIES = gcctestdir/ld tls_test_ie_shared.so
1037 tls_shared_ie_test_LDFLAGS = -Wl,-R,. $(THREADFLAGS)
1038 tls_shared_ie_test_LDADD = tls_test_ie_shared.so $(THREADLIBS)
1040 tls_shared_gd_to_ie_test_SOURCES = tls_test_main.cc
1041 tls_shared_gd_to_ie_test_DEPENDENCIES = gcctestdir/ld tls_test_pic.o \
1042         tls_test_c_pic.o tls_test_shared2.so
1043 tls_shared_gd_to_ie_test_LDFLAGS = -Wl,-R,. $(THREADFLAGS)
1044 tls_shared_gd_to_ie_test_LDADD = tls_test_pic.o tls_test_c_pic.o \
1045         tls_test_shared2.so $(THREADLIBS)
1047 if TLS_GNU2_DIALECT
1049 check_PROGRAMS += tls_shared_gnu2_gd_to_ie_test
1051 tls_test_gnu2.o: tls_test.cc gcctestdir/as
1052         $(CXXCOMPILE) -c -fpic -mtls-dialect=gnu2 -o $@ $<
1053 tls_test_file2_gnu2.o: tls_test_file2.cc gcctestdir/as
1054         $(CXXCOMPILE) -c -fpic -mtls-dialect=gnu2 -o $@ $<
1055 tls_test_c_gnu2.o: tls_test_c.c gcctestdir/as
1056         $(COMPILE) -c -fpic -mtls-dialect=gnu2 $(TLS_TEST_C_CFLAGS) -o $@ $<
1057 tls_test_gnu2_shared2.so: tls_test_file2_gnu2.o gcctestdir/ld
1058         $(CXXLINK) -shared tls_test_file2_gnu2.o
1060 tls_shared_gnu2_gd_to_ie_test_SOURCES = tls_test_main.cc
1061 tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES = gcctestdir/ld tls_test_gnu2.o \
1062         tls_test_c_gnu2.o tls_test_gnu2_shared2.so
1063 tls_shared_gnu2_gd_to_ie_test_LDFLAGS = -Wl,-R,. $(THREADFLAGS)
1064 tls_shared_gnu2_gd_to_ie_test_LDADD = tls_test_gnu2.o tls_test_c_gnu2.o \
1065         tls_test_gnu2_shared2.so $(THREADLIBS)
1067 if TLS_DESCRIPTORS
1069 check_PROGRAMS += tls_shared_gnu2_test
1071 tls_test_gnu2_shared.so: tls_test_gnu2.o tls_test_file2_gnu2.o tls_test_c_gnu2.o gcctestdir/ld
1072         $(CXXLINK) -shared tls_test_gnu2.o tls_test_file2_gnu2.o tls_test_c_gnu2.o
1074 tls_shared_gnu2_test_SOURCES = tls_test_main.cc
1075 tls_shared_gnu2_test_DEPENDENCIES = gcctestdir/ld tls_test_gnu2_shared.so
1076 tls_shared_gnu2_test_LDFLAGS = -Wl,-R,. $(THREADFLAGS)
1077 tls_shared_gnu2_test_LDADD = tls_test_gnu2_shared.so $(THREADLIBS)
1079 endif TLS_DESCRIPTORS
1081 endif TLS_GNU2_DIALECT
1083 if HAVE_STATIC
1084 if STATIC_TLS
1085 check_PROGRAMS += tls_static_test
1086 check_PROGRAMS += tls_static_pic_test
1088 tls_static_test_SOURCES = $(tls_test_SOURCES)
1089 tls_static_test_DEPENDENCIES = $(tls_test_DEPENDENCIES)
1090 tls_static_test_LDFLAGS = $(tls_test_LDFLAGS) -static
1091 tls_static_test_LDADD = $(tls_test_LDADD)
1093 tls_static_pic_test_SOURCES = $(tls_pic_test_SOURCES)
1094 tls_static_pic_test_DEPENDENCIES = $(tls_pic_test_DEPENDENCIES)
1095 tls_static_pic_test_LDFLAGS = $(tls_pic_test_LDFLAGS) -static
1096 tls_static_pic_test_LDADD = $(tls_pic_test_LDADD)
1097 endif
1098 endif
1100 if FN_PTRS_IN_SO_WITHOUT_PIC
1101 check_PROGRAMS += tls_shared_nonpic_test
1102 tls_test_shared_nonpic.so: tls_test.o tls_test_file2.o tls_test_c.o gcctestdir/ld
1103         $(CXXLINK) -shared tls_test.o tls_test_file2.o tls_test_c.o -Wl,-z,notext
1105 tls_shared_nonpic_test_SOURCES = tls_test_main.cc
1106 tls_shared_nonpic_test_DEPENDENCIES = gcctestdir/ld tls_test_shared_nonpic.so
1107 tls_shared_nonpic_test_LDFLAGS = -Wl,-R,. $(THREADFLAGS)
1108 tls_shared_nonpic_test_LDADD = tls_test_shared_nonpic.so $(THREADLIBS)
1109 endif FN_PTRS_IN_SO_WITHOUT_PIC
1111 endif TLS
1113 if DEFAULT_TARGET_X86_64
1115 check_SCRIPTS += x86_64_mov_to_lea.sh
1116 check_DATA += x86_64_mov_to_lea1.stdout x86_64_mov_to_lea2.stdout \
1117         x86_64_mov_to_lea3.stdout x86_64_mov_to_lea4.stdout \
1118         x86_64_mov_to_lea5.stdout x86_64_mov_to_lea6.stdout \
1119         x86_64_mov_to_lea7.stdout x86_64_mov_to_lea8.stdout \
1120         x86_64_mov_to_lea9.stdout x86_64_mov_to_lea10.stdout \
1121         x86_64_mov_to_lea11.stdout x86_64_mov_to_lea12.stdout \
1122         x86_64_mov_to_lea13.stdout x86_64_mov_to_lea14.stdout
1123 MOSTLYCLEANFILES += x86_64_mov_to_lea1 x86_64_mov_to_lea2 \
1124         x86_64_mov_to_lea3 x86_64_mov_to_lea4 x86_64_mov_to_lea5 \
1125         x86_64_mov_to_lea6 x86_64_mov_to_lea7 x86_64_mov_to_lea8 \
1126         x86_64_mov_to_lea9 x86_64_mov_to_lea10 x86_64_mov_to_lea11 \
1127         x86_64_mov_to_lea12 x86_64_mov_to_lea13 x86_64_mov_to_lea14
1129 x86_64_mov_to_lea1.o: x86_64_mov_to_lea1.s
1130         $(TEST_AS) --64 -o $@ $<
1131 x86_64_mov_to_lea2.o: x86_64_mov_to_lea1.s
1132         $(TEST_AS) --x32 -o $@ $<
1133 x86_64_mov_to_lea3.o: x86_64_mov_to_lea2.s
1134         $(TEST_AS) --x32 -o $@ $<
1135 x86_64_mov_to_lea4.o: x86_64_mov_to_lea2.s
1136         $(TEST_AS) --64 -o $@ $<
1137 x86_64_mov_to_lea5.o: x86_64_mov_to_lea3.s
1138         $(TEST_AS) --x32 -mrelax-relocations=yes -o $@ $<
1139 x86_64_mov_to_lea6.o: x86_64_mov_to_lea3.s
1140         $(TEST_AS) --64 -mrelax-relocations=yes -o $@ $<
1141 x86_64_mov_to_lea7.o: x86_64_mov_to_lea4.s
1142         $(TEST_AS) --x32 -o $@ $<
1143 x86_64_mov_to_lea8.o: x86_64_mov_to_lea4.s
1144         $(TEST_AS) --64 -o $@ $<
1145 x86_64_mov_to_lea1: x86_64_mov_to_lea1.o ../ld-new
1146         ../ld-new -Bsymbolic -shared -melf_x86_64 -o $@ $<
1147 x86_64_mov_to_lea2: x86_64_mov_to_lea1.o ../ld-new
1148         ../ld-new -pie -melf_x86_64 -o $@ $<
1149 x86_64_mov_to_lea3: x86_64_mov_to_lea1.o ../ld-new
1150         ../ld-new -melf_x86_64 -o $@ $<
1151 x86_64_mov_to_lea4: x86_64_mov_to_lea2.o ../ld-new
1152         ../ld-new -Bsymbolic -shared -melf32_x86_64 -o $@ $<
1153 x86_64_mov_to_lea5: x86_64_mov_to_lea2.o ../ld-new
1154         ../ld-new -pie -melf32_x86_64 -o $@ $<
1155 x86_64_mov_to_lea6: x86_64_mov_to_lea2.o ../ld-new
1156         ../ld-new -melf32_x86_64 -o $@ $<
1157 x86_64_mov_to_lea7: x86_64_mov_to_lea3.o ../ld-new
1158         ../ld-new -melf32_x86_64 -pie -o $@ $<
1159 x86_64_mov_to_lea8: x86_64_mov_to_lea4.o ../ld-new
1160         ../ld-new -melf_x86_64 -pie -o $@ $<
1161 x86_64_mov_to_lea9: x86_64_mov_to_lea5.o ../ld-new
1162         ../ld-new -melf32_x86_64 -o $@ $<
1163 x86_64_mov_to_lea10: x86_64_mov_to_lea6.o ../ld-new
1164         ../ld-new -melf_x86_64 -o $@ $<
1165 x86_64_mov_to_lea11: x86_64_mov_to_lea2.o ../ld-new
1166         ../ld-new -melf32_x86_64 -shared -o $@ $<
1167 x86_64_mov_to_lea12: x86_64_mov_to_lea1.o ../ld-new
1168         ../ld-new -melf_x86_64 -shared -o $@ $<
1169 x86_64_mov_to_lea13: x86_64_mov_to_lea7.o ../ld-new
1170         ../ld-new -melf32_x86_64 -shared -o $@ $<
1171 x86_64_mov_to_lea14: x86_64_mov_to_lea8.o ../ld-new
1172         ../ld-new -melf_x86_64 -shared -o $@ $<
1173 x86_64_mov_to_lea1.stdout: x86_64_mov_to_lea1
1174         $(TEST_OBJDUMP) -dw $< > $@
1175 x86_64_mov_to_lea2.stdout: x86_64_mov_to_lea2
1176         $(TEST_OBJDUMP) -dw $< > $@
1177 x86_64_mov_to_lea3.stdout: x86_64_mov_to_lea3
1178         $(TEST_OBJDUMP) -dw $< > $@
1179 x86_64_mov_to_lea4.stdout: x86_64_mov_to_lea4
1180         $(TEST_OBJDUMP) -dw $< > $@
1181 x86_64_mov_to_lea5.stdout: x86_64_mov_to_lea5
1182         $(TEST_OBJDUMP) -dw $< > $@
1183 x86_64_mov_to_lea6.stdout: x86_64_mov_to_lea6
1184         $(TEST_OBJDUMP) -dw $< > $@
1185 x86_64_mov_to_lea7.stdout: x86_64_mov_to_lea7
1186         $(TEST_OBJDUMP) -dw $< > $@
1187 x86_64_mov_to_lea8.stdout: x86_64_mov_to_lea8
1188         $(TEST_OBJDUMP) -dw $< > $@
1189 x86_64_mov_to_lea9.stdout: x86_64_mov_to_lea9
1190         $(TEST_OBJDUMP) -dw $< > $@
1191 x86_64_mov_to_lea10.stdout: x86_64_mov_to_lea10
1192         $(TEST_OBJDUMP) -dw $< > $@
1193 x86_64_mov_to_lea11.stdout: x86_64_mov_to_lea11
1194         $(TEST_OBJDUMP) -dw $< > $@
1195 x86_64_mov_to_lea12.stdout: x86_64_mov_to_lea12
1196         $(TEST_OBJDUMP) -dw $< > $@
1197 x86_64_mov_to_lea13.stdout: x86_64_mov_to_lea13
1198         $(TEST_OBJDUMP) -dw $< > $@
1199 x86_64_mov_to_lea14.stdout: x86_64_mov_to_lea14
1200         $(TEST_OBJDUMP) -dw $< > $@
1202 check_SCRIPTS += x86_64_indirect_call_to_direct.sh
1203 check_DATA += x86_64_indirect_call_to_direct1.stdout \
1204         x86_64_indirect_jump_to_direct1.stdout
1205 MOSTLYCLEANFILES += x86_64_indirect_call_to_direct1 \
1206         x86_64_indirect_jump_to_direct1
1208 x86_64_indirect_call_to_direct1.o: x86_64_indirect_call_to_direct1.s
1209         $(TEST_AS) --64 -mrelax-relocations=yes -o $@ $<
1210 x86_64_indirect_call_to_direct1: x86_64_indirect_call_to_direct1.o gcctestdir/ld
1211         gcctestdir/ld -o $@ $<
1212 x86_64_indirect_call_to_direct1.stdout: x86_64_indirect_call_to_direct1
1213         $(TEST_OBJDUMP) -dw $< > $@
1214 x86_64_indirect_jump_to_direct1.o: x86_64_indirect_jump_to_direct1.s
1215         $(TEST_AS) --64 -mrelax-relocations=yes -o $@ $<
1216 x86_64_indirect_jump_to_direct1: x86_64_indirect_jump_to_direct1.o gcctestdir/ld
1217         gcctestdir/ld -o $@ $<
1218 x86_64_indirect_jump_to_direct1.stdout: x86_64_indirect_jump_to_direct1
1219         $(TEST_OBJDUMP) -dw $< > $@
1221 check_SCRIPTS += x86_64_gd_to_le.sh
1222 check_DATA += x86_64_gd_to_le.stdout
1223 MOSTLYCLEANFILES += x86_64_gd_to_le
1225 x86_64_gd_to_le.o: x86_64_gd_to_le.s
1226         $(TEST_AS) --64 -o $@ $<
1227 x86_64_gd_to_le: x86_64_gd_to_le.o gcctestdir/ld
1228         gcctestdir/ld -o $@ $<
1229 x86_64_gd_to_le.stdout: x86_64_gd_to_le
1230         $(TEST_OBJDUMP) -dw $< > $@
1232 check_SCRIPTS += x86_64_overflow_pc32.sh
1233 check_DATA += x86_64_overflow_pc32.err
1234 MOSTLYCLEANFILES += x86_64_overflow_pc32.err
1235 x86_64_overflow_pc32.o: x86_64_overflow_pc32.s
1236         $(TEST_AS) -o $@ $<
1237 x86_64_overflow_pc32.err: x86_64_overflow_pc32.o gcctestdir/ld
1238         @echo gcctestdir/ld -e bar -Tdata=0x81000000 -o x86_64_overflow_pc32 x86_64_overflow_pc32.o "2>$@"
1239         @if gcctestdir/ld -e bar -Tdata=0x81000000 -o x86_64_overflow_pc32 x86_64_overflow_pc32.o 2>$@; \
1240         then \
1241           echo 1>&2 "Link of x86_64_overflow_pc32 should have failed"; \
1242           rm -f $@; \
1243           exit 1; \
1244         fi
1246 check_PROGRAMS += pr17704a_test
1247 pr17704a_test.o: pr17704a_test.s
1248         $(TEST_AS) --64 -o $@ $<
1249 pr17704a_test: pr17704a_test.o gcctestdir/ld
1250         gcctestdir/ld --icf=all -o $@ $<
1252 check_SCRIPTS += x32_overflow_pc32.sh
1253 check_DATA += x32_overflow_pc32.err
1254 MOSTLYCLEANFILES += x32_overflow_pc32.err
1255 x32_overflow_pc32.o: x86_64_overflow_pc32.s
1256         $(TEST_AS) --x32 -o $@ $<
1257 x32_overflow_pc32.err: x32_overflow_pc32.o gcctestdir/ld
1258         @echo gcctestdir/ld -e bar -Tdata=0x81000000 -o x32_overflow_pc32 x32_overflow_pc32.o "2>$@"
1259         @if gcctestdir/ld -e bar -Tdata=0x81000000 -o x32_overflow_pc32 x32_overflow_pc32.o 2>$@; \
1260         then \
1261           echo 1>&2 "Link of x32_overflow_pc32 should have failed"; \
1262           rm -f $@; \
1263           exit 1; \
1264         fi
1266 check_SCRIPTS += pr23016_1.sh
1267 check_DATA += pr23016_1.stdout pr23016_1r.stdout
1268 pr23016_1.stdout: pr23016_1.o
1269         $(TEST_READELF) -rSW $< >$@ 2>/dev/null
1270 pr23016_1.o: pr23016_1a.o pr23016_1b.o gcctestdir/ld
1271         gcctestdir/ld -r -o $@ pr23016_1a.o pr23016_1b.o
1272 pr23016_1r.stdout: pr23016_1r.o
1273         $(TEST_READELF) -rSW $< >$@ 2>/dev/null
1274 pr23016_1r.o: pr23016_1a.o pr23016_1b.o gcctestdir/ld
1275         gcctestdir/ld -r -o $@ pr23016_1b.o pr23016_1a.o
1276 pr23016_1a.o: pr23016_1a.s
1277         $(TEST_AS) -o $@ $<
1278 pr23016_1b.o: pr23016_1b.s
1279         $(TEST_AS) -o $@ $<
1281 check_SCRIPTS += pr23016_2.sh
1282 check_DATA += pr23016_2.stdout
1283 pr23016_2.stdout: pr23016_2.o
1284         $(TEST_READELF) -rW $< >$@ 2>/dev/null
1285 pr23016_2.o: pr23016_2a.o pr23016_2b.o gcctestdir/ld
1286         gcctestdir/ld -r -o $@ pr23016_2a.o pr23016_2b.o
1287 pr23016_2a.o: pr23016_2a.s
1288         $(TEST_AS) -o $@ $<
1289 pr23016_2b.o: pr23016_2b.s
1290         $(TEST_AS) -o $@ $<
1292 endif DEFAULT_TARGET_X86_64
1294 if DEFAULT_TARGET_X86_64_OR_X32
1296 check_PROGRAMS += pr20216a_test
1297 pr20216a_test_SOURCES = pr20216_main.c pr20216_def.c
1298 pr20216a_test_DEPENDENCIES = pr20216_gd.o pr20216_ld.o gcctestdir/ld gcctestdir/as
1299 pr20216a_test_CFLAGS = -fPIE
1300 pr20216a_test_LDFLAGS = -Wl,-R,.
1301 pr20216a_test_LDADD = pr20216_gd.o pr20216_ld.o
1303 check_PROGRAMS += pr20216b_test
1304 pr20216b_test_SOURCES = pr20216_main.c pr20216_def.c
1305 pr20216b_test_DEPENDENCIES = pr20216_gd.o pr20216_ld.o gcctestdir/ld gcctestdir/as
1306 pr20216b_test_CFLAGS = -fPIE
1307 pr20216b_test_LDFLAGS = -pie -Wl,-R,.
1308 pr20216b_test_LDADD = pr20216_gd.o pr20216_ld.o
1310 check_PROGRAMS += pr20216c_test
1311 pr20216c_test_SOURCES = pr20216_main.c pr20216_def.c
1312 pr20216c_test_DEPENDENCIES = pr20216_gd.o pr20216_ld.o gcctestdir/ld gcctestdir/as
1313 pr20216c_test_CFLAGS = -fPIE
1314 pr20216c_test_LDFLAGS = -static -Wl,-R,.
1315 pr20216c_test_LDADD = pr20216_gd.o pr20216_ld.o
1317 check_PROGRAMS += pr20216d_test
1318 pr20216d_test_SOURCES = pr20216_main.c pr20216_def.c
1319 pr20216d_test_DEPENDENCIES = pr20216a.so gcctestdir/ld gcctestdir/as
1320 pr20216d_test_CFLAGS = -fPIE
1321 pr20216d_test_LDFLAGS = -Wl,-R,.
1322 pr20216d_test_LDADD = pr20216a.so
1324 check_PROGRAMS += pr20216e_test
1325 pr20216e_test_SOURCES = pr20216_main.c
1326 pr20216e_test_DEPENDENCIES = pr20216_gd.o pr20216_ld.o pr20216b.so gcctestdir/ld gcctestdir/as
1327 pr20216e_test_CFLAGS = -fPIE
1328 pr20216e_test_LDFLAGS = -Wl,-R,.
1329 pr20216e_test_LDADD = pr20216_gd.o pr20216_ld.o pr20216b.so
1331 MOSTLYCLEANFILES += pr20216a.so pr20216b.so
1333 pr20216a.so: pr20216_gd.o pr20216_ld.o gcctestdir/ld
1334         $(LINK) -shared pr20216_gd.o pr20216_ld.o
1336 pr20216b.so: pr20216_def.o gcctestdir/ld
1337         $(LINK) -shared pr20216_def.o
1339 pr20216_gd.o: pr20216_gd.S gcctestdir/as
1340         $(COMPILE) -c -o $@ $<
1342 pr20216_ld.o: pr20216_ld.S gcctestdir/as
1343         $(COMPILE) -c -o $@ $<
1345 endif DEFAULT_TARGET_X86_64_OR_X32
1347 if DEFAULT_TARGET_I386
1349 check_SCRIPTS += i386_mov_to_lea.sh
1350 check_DATA += i386_mov_to_lea1.stdout i386_mov_to_lea2.stdout \
1351         i386_mov_to_lea3.stdout i386_mov_to_lea4.stdout \
1352         i386_mov_to_lea5.stdout i386_mov_to_lea6.stdout \
1353         i386_mov_to_lea7.stdout i386_mov_to_lea8.stdout
1354 MOSTLYCLEANFILES += i386_mov_to_lea1 i386_mov_to_lea2 i386_mov_to_lea3 \
1355         i386_mov_to_lea4 i386_mov_to_lea5 i386_mov_to_lea6 \
1356         i386_mov_to_lea7 i386_mov_to_lea8
1358 i386_mov_to_lea1.o: i386_mov_to_lea1.s
1359         $(TEST_AS) --32 -o $@ $<
1360 i386_mov_to_lea2.o: i386_mov_to_lea2.s
1361         $(TEST_AS) --32 -o $@ $<
1362 i386_mov_to_lea3.o: i386_mov_to_lea3.s
1363         $(TEST_AS) --32 -o $@ $<
1364 i386_mov_to_lea4.o: i386_mov_to_lea4.s
1365         $(TEST_AS) --32 -o $@ $<
1366 i386_mov_to_lea5.o: i386_mov_to_lea5.s
1367         $(TEST_AS) --32 -o $@ $<
1368 i386_mov_to_lea1: i386_mov_to_lea1.o ../ld-new
1369         ../ld-new -Bsymbolic -shared -melf_i386 -o $@ $<
1370 i386_mov_to_lea2: i386_mov_to_lea1.o ../ld-new
1371         ../ld-new -pie -melf_i386 -o $@ $<
1372 i386_mov_to_lea3: i386_mov_to_lea1.o ../ld-new
1373         ../ld-new -melf_i386 -o $@ $<
1374 i386_mov_to_lea4: i386_mov_to_lea1.o ../ld-new
1375         ../ld-new -melf_i386 -shared -o $@ $<
1376 i386_mov_to_lea5: i386_mov_to_lea2.o ../ld-new
1377         ../ld-new -melf_i386 -shared -o $@ $<
1378 i386_mov_to_lea6: i386_mov_to_lea3.o ../ld-new
1379         ../ld-new -melf_i386 -shared -o $@ $<
1380 i386_mov_to_lea7: i386_mov_to_lea4.o ../ld-new
1381         ../ld-new -melf_i386 -shared -o $@ $<
1382 i386_mov_to_lea8: i386_mov_to_lea5.o ../ld-new
1383         ../ld-new -melf_i386 -shared -o $@ $<
1384 i386_mov_to_lea1.stdout: i386_mov_to_lea1
1385         $(TEST_OBJDUMP) -dw $< > $@
1386 i386_mov_to_lea2.stdout: i386_mov_to_lea2
1387         $(TEST_OBJDUMP) -dw $< > $@
1388 i386_mov_to_lea3.stdout: i386_mov_to_lea3
1389         $(TEST_OBJDUMP) -dw $< > $@
1390 i386_mov_to_lea4.stdout: i386_mov_to_lea4
1391         $(TEST_OBJDUMP) -dw $< > $@
1392 i386_mov_to_lea5.stdout: i386_mov_to_lea5
1393         $(TEST_OBJDUMP) -dw $< > $@
1394 i386_mov_to_lea6.stdout: i386_mov_to_lea6
1395         $(TEST_OBJDUMP) -dw $< > $@
1396 i386_mov_to_lea7.stdout: i386_mov_to_lea7
1397         $(TEST_OBJDUMP) -dw $< > $@
1398 i386_mov_to_lea8.stdout: i386_mov_to_lea8
1399         $(TEST_OBJDUMP) -dw $< > $@
1401 check_PROGRAMS += pr20308a_test
1402 pr20308a_test_SOURCES = pr20308_main.c pr20308_def.c
1403 pr20308a_test_DEPENDENCIES = pr20308_gd.o pr20308_ld.o gcctestdir/ld gcctestdir/as
1404 pr20308a_test_CFLAGS = -fPIE
1405 pr20308a_test_LDFLAGS = -Wl,-R,.
1406 pr20308a_test_LDADD = pr20308_gd.o pr20308_ld.o
1408 check_PROGRAMS += pr20308b_test
1409 pr20308b_test_SOURCES = pr20308_main.c pr20308_def.c
1410 pr20308b_test_DEPENDENCIES = pr20308_gd.o pr20308_ld.o gcctestdir/ld gcctestdir/as
1411 pr20308b_test_CFLAGS = -fPIE
1412 pr20308b_test_LDFLAGS = -pie -Wl,-R,.
1413 pr20308b_test_LDADD = pr20308_gd.o pr20308_ld.o
1415 check_PROGRAMS += pr20308c_test
1416 pr20308c_test_SOURCES = pr20308_main.c pr20308_def.c
1417 pr20308c_test_DEPENDENCIES = pr20308_gd.o pr20308_ld.o gcctestdir/ld gcctestdir/as
1418 pr20308c_test_CFLAGS = -fPIE
1419 pr20308c_test_LDFLAGS = -static -Wl,-R,.
1420 pr20308c_test_LDADD = pr20308_gd.o pr20308_ld.o
1422 check_PROGRAMS += pr20308d_test
1423 pr20308d_test_SOURCES = pr20308_main.c pr20308_def.c
1424 pr20308d_test_DEPENDENCIES = pr20308a.so gcctestdir/ld gcctestdir/as
1425 pr20308d_test_CFLAGS = -fPIE
1426 pr20308d_test_LDFLAGS = -Wl,-R,.
1427 pr20308d_test_LDADD = pr20308a.so
1429 check_PROGRAMS += pr20308e_test
1430 pr20308e_test_SOURCES = pr20308_main.c
1431 pr20308e_test_DEPENDENCIES = pr20308_gd.o pr20308_ld.o pr20308b.so gcctestdir/ld gcctestdir/as
1432 pr20308e_test_CFLAGS = -fPIE
1433 pr20308e_test_LDFLAGS = -Wl,-R,.
1434 pr20308e_test_LDADD = pr20308_gd.o pr20308_ld.o pr20308b.so
1436 MOSTLYCLEANFILES += pr20308a.so pr20308b.so
1438 pr20308a.so: pr20308_gd.o pr20308_ld.o gcctestdir/ld
1439         $(LINK) -shared pr20308_gd.o pr20308_ld.o
1441 pr20308b.so: pr20308_def.o gcctestdir/ld
1442         $(LINK) -shared pr20308_def.o
1444 pr20308_gd.o: pr20308_gd.S gcctestdir/as
1445         $(COMPILE) -c -o $@ $<
1447 pr20308_ld.o: pr20308_ld.S gcctestdir/as
1448         $(COMPILE) -c -o $@ $<
1450 endif DEFAULT_TARGET_I386
1452 check_PROGRAMS += many_sections_test
1453 many_sections_test_SOURCES = many_sections_test.cc
1454 many_sections_test_DEPENDENCIES = gcctestdir/ld
1455 many_sections_test_LDFLAGS = -rdynamic
1456 many_sections_test_LDADD =
1458 BUILT_SOURCES += many_sections_define.h
1459 MOSTLYCLEANFILES += many_sections_define.h
1460 many_sections_define.h:
1461         (for i in `seq 1 70000`; do \
1462            echo "int var_$$i __attribute__((section(\"section_$$i\"))) = $$i;"; \
1463          done) > $@.tmp
1464         mv -f $@.tmp $@
1466 BUILT_SOURCES += many_sections_check.h
1467 MOSTLYCLEANFILES += many_sections_check.h
1468 many_sections_check.h:
1469         (for i in `seq 1 1000 70000`; do \
1470            echo "assert(var_$$i == $$i);"; \
1471          done) > $@.tmp
1472         mv -f $@.tmp $@
1474 check_PROGRAMS += many_sections_r_test
1475 many_sections_r_test.o: many_sections_test.o gcctestdir/ld
1476         gcctestdir/ld -r -o $@ many_sections_test.o
1477 many_sections_r_test: many_sections_r_test.o gcctestdir/ld
1478         $(CXXLINK) many_sections_r_test.o $(LIBS)
1480 check_SCRIPTS += file_in_many_sections_test.sh
1481 check_DATA += file_in_many_sections.stdout
1482 MOSTLYCLEANFILES += file_in_many_sections
1483 file_in_many_sections.o: file_in_many_sections.c many_sections_define.h
1484         $(COMPILE) -c -fdata-sections -o $@ $(srcdir)/file_in_many_sections.c
1485 file_in_many_sections: file_in_many_sections.o gcctestdir/ld
1486         $(LINK) file_in_many_sections.o -Wl,--gc-sections
1487 file_in_many_sections.stdout: file_in_many_sections
1488         $(TEST_READELF) -sW $< > $@
1490 check_PROGRAMS += initpri1
1491 initpri1_SOURCES = initpri1.c
1492 initpri1_DEPENDENCIES = gcctestdir/ld
1493 initpri1_LDADD =
1495 check_PROGRAMS += initpri2
1496 initpri2_SOURCES = initpri2.c
1497 initpri2_DEPENDENCIES = gcctestdir/ld
1498 initpri2_LDFLAGS = -Wl,--ctors-in-init-array
1499 initpri2_LDADD =
1501 check_PROGRAMS += initpri3a
1502 initpri3a_SOURCES = initpri3.c
1503 initpri3a_DEPENDENCIES = gcctestdir/ld
1504 initpri3a_LDADD =
1506 # This test fails on targets not using .ctors and .dtors sections (e.g. ARM
1507 # EABI). Given that gcc is moving towards using .init_array in all cases,
1508 # this test is commented out.  A better fix would be checking whether gcc
1509 # uses .ctors or .init_array sections in configure.
1511 # check_PROGRAMS += initpri3b
1512 # initpri3b_SOURCES = initpri3.c
1513 # initpri3b_DEPENDENCIES = gcctestdir/ld
1514 # initpri3b_LDFLAGS = -Wl,--no-ctors-in-init-array
1515 # initpri3b_LDADD =
1517 # Test --detect-odr-violations
1518 check_SCRIPTS += debug_msg.sh
1520 # Create the data files that debug_msg.sh analyzes.
1521 check_DATA += debug_msg.err
1522 MOSTLYCLEANFILES += debug_msg.err
1523 debug_msg.o: debug_msg.cc
1524         $(CXXCOMPILE) -O0 -g -c -w -o $@ $(srcdir)/debug_msg.cc
1525 odr_violation1.o: odr_violation1.cc
1526         $(CXXCOMPILE) -O0 -g -c -w -o $@ $(srcdir)/odr_violation1.cc
1527 # Compile with different optimization flags to check that rearranged
1528 # instructions don't cause a false positive.
1529 odr_violation2.o: odr_violation2.cc
1530         $(CXXCOMPILE) -O2 -g -c -w -o $@ $(srcdir)/odr_violation2.cc
1531 debug_msg.err: debug_msg.o odr_violation1.o odr_violation2.o gcctestdir/ld
1532         @echo $(CXXLINK) -Wl,--detect-odr-violations -o debug_msg debug_msg.o odr_violation1.o odr_violation2.o "2>$@"
1533         @if $(CXXLINK) -Wl,--detect-odr-violations -o debug_msg debug_msg.o odr_violation1.o odr_violation2.o 2>$@; \
1534         then \
1535           echo 1>&2 "Link of debug_msg should have failed"; \
1536           rm -f $@; \
1537           exit 1; \
1538         fi
1540 # Test error message when a vtable is undefined.
1541 check_SCRIPTS += missing_key_func.sh
1542 check_DATA += missing_key_func.err
1543 MOSTLYCLEANFILES += missing_key_func.err
1544 missing_key_func.o: missing_key_func.cc
1545         $(CXXCOMPILE) -O0 -g -c -o $@ $(srcdir)/missing_key_func.cc
1546 missing_key_func.err: missing_key_func.o gcctestdir/ld
1547         @echo $(CXXLINK) -o missing_key_func missing_key_func.o "2>$@"
1548         @if $(CXXLINK) -o missing_key_func missing_key_func.o 2>$@; \
1549         then \
1550           echo 1>&2 "Link of missing_key_func should have failed"; \
1551           rm -f $@; \
1552           exit 1; \
1553         fi
1555 # Check that --detect-odr-violations works with compressed debug sections.
1556 check_DATA += debug_msg_cdebug.err
1557 MOSTLYCLEANFILES += debug_msg_cdebug.err
1558 debug_msg_cdebug.o: debug_msg.cc gcctestdir/as
1559         $(CXXCOMPILE) -O0 -g -Wa,--compress-debug-sections -c -w -o $@ $(srcdir)/debug_msg.cc
1560 odr_violation1_cdebug.o: odr_violation1.cc gcctestdir/as
1561         $(CXXCOMPILE) -O0 -g -Wa,--compress-debug-sections -c -w -o $@ $(srcdir)/odr_violation1.cc
1562 odr_violation2_cdebug.o: odr_violation2.cc gcctestdir/as
1563         $(CXXCOMPILE) -O2 -g -Wa,--compress-debug-sections -c -w -o $@ $(srcdir)/odr_violation2.cc
1564 debug_msg_cdebug.err: debug_msg_cdebug.o odr_violation1_cdebug.o odr_violation2_cdebug.o gcctestdir/ld
1565         @echo $(CXXLINK) -Wl,--detect-odr-violations -o debug_msg_cdebug debug_msg_cdebug.o odr_violation1_cdebug.o odr_violation2_cdebug.o "2>$@"
1566         @if $(CXXLINK) -Wl,--detect-odr-violations -o debug_msg_cdebug debug_msg_cdebug.o odr_violation1_cdebug.o odr_violation2_cdebug.o 2>$@; \
1567         then \
1568           echo 1>&2 "Link of debug_msg_cdebug should have failed"; \
1569           rm -f $@; \
1570           exit 1; \
1571         fi
1572 check_DATA += debug_msg_cdebug_gabi.err
1573 MOSTLYCLEANFILES += debug_msg_cdebug_gabi.err
1574 debug_msg_cdebug_gabi.o: debug_msg.cc gcctestdir/as
1575         $(CXXCOMPILE) -O0 -g -Wa,--compress-debug-sections=zlib-gabi -c -w -o $@ $(srcdir)/debug_msg.cc
1576 odr_violation1_cdebug_gabi.o: odr_violation1.cc gcctestdir/as
1577         $(CXXCOMPILE) -O0 -g -Wa,--compress-debug-sections=zlib-gabi -c -w -o $@ $(srcdir)/odr_violation1.cc
1578 odr_violation2_cdebug_gabi.o: odr_violation2.cc gcctestdir/as
1579         $(CXXCOMPILE) -O2 -g -Wa,--compress-debug-sections=zlib-gabi -c -w -o $@ $(srcdir)/odr_violation2.cc
1580 debug_msg_cdebug_gabi.err: debug_msg_cdebug_gabi.o odr_violation1_cdebug_gabi.o odr_violation2_cdebug_gabi.o gcctestdir/ld
1581         @echo $(CXXLINK) -Wl,--detect-odr-violations -o debug_msg_cdebug debug_msg_cdebug_gabi.o odr_violation1_cdebug_gabi.o odr_violation2_cdebug_gabi.o "2>$@"
1582         @if $(CXXLINK) -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>$@; \
1583         then \
1584           echo 1>&2 "Link of debug_msg_cdebug_gabi should have failed"; \
1585           rm -f $@; \
1586           exit 1; \
1587         fi
1589 # See if we can also detect problems when we're linking .so's, not .o's.
1590 check_DATA += debug_msg_so.err
1591 MOSTLYCLEANFILES += debug_msg_so.err
1592 debug_msg.so: debug_msg.cc gcctestdir/ld
1593         $(CXXCOMPILE) -O0 -g -shared -fPIC -w -o $@ $(srcdir)/debug_msg.cc
1594 odr_violation1.so: odr_violation1.cc gcctestdir/ld
1595         $(CXXCOMPILE) -O0 -g -shared -fPIC -w -o $@ $(srcdir)/odr_violation1.cc
1596 odr_violation2.so: odr_violation2.cc gcctestdir/ld
1597         $(CXXCOMPILE) -O2 -g -shared -fPIC -w -o $@ $(srcdir)/odr_violation2.cc
1598 debug_msg_so.err: debug_msg.so odr_violation1.so odr_violation2.so gcctestdir/ld
1599         @echo $(CXXLINK_S) -Wl,--detect-odr-violations -o debug_msg_so debug_msg.so odr_violation1.so odr_violation2.so "2>$@"
1600         @if $(CXXLINK_S) -Wl,--detect-odr-violations -o debug_msg_so debug_msg.so odr_violation1.so odr_violation2.so 2>$@; \
1601         then \
1602           echo 1>&2 "Link of debug_msg_so should have failed"; \
1603           rm -f $@; \
1604           exit 1; \
1605         fi
1607 # We also want to make sure we do something reasonable when there's no
1608 # debug info available.  For the best test, we use .so's.
1609 check_DATA += debug_msg_ndebug.err
1610 MOSTLYCLEANFILES += debug_msg_ndebug.err
1611 debug_msg_ndebug.so: debug_msg.cc gcctestdir/ld
1612         $(CXXCOMPILE) -O0 -g0 -shared -fPIC -w -o $@ $(srcdir)/debug_msg.cc
1613 odr_violation1_ndebug.so: odr_violation1.cc gcctestdir/ld
1614         $(CXXCOMPILE) -O0 -g0 -shared -fPIC -w -o $@ $(srcdir)/odr_violation1.cc
1615 odr_violation2_ndebug.so: odr_violation2.cc gcctestdir/ld
1616         $(CXXCOMPILE) -O2 -g0 -shared -fPIC -w -o $@ $(srcdir)/odr_violation2.cc
1617 debug_msg_ndebug.err: debug_msg_ndebug.so odr_violation1_ndebug.so odr_violation2_ndebug.so gcctestdir/ld
1618         @echo $(CXXLINK_S) -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>$@"
1619         @if $(CXXLINK_S) -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>$@; \
1620         then \
1621           echo 1>&2 "Link of debug_msg_ndebug should have failed"; \
1622           rm -f $@; \
1623           exit 1; \
1624         fi
1627 # Similar to --detect-odr-violations: check for undefined symbols in .so's
1628 check_SCRIPTS += undef_symbol.sh
1629 check_DATA += undef_symbol.err
1630 MOSTLYCLEANFILES += undef_symbol.err
1631 undef_symbol.o: undef_symbol.cc
1632         $(CXXCOMPILE) -O0 -g -c -fPIC $<
1633 undef_symbol.so: undef_symbol.o gcctestdir/ld
1634         $(CXXLINK) -shared undef_symbol.o
1635 undef_symbol.err: undef_symbol_main.o undef_symbol.so gcctestdir/ld
1636         @echo $(CXXLINK) -o undef_symbol_test undef_symbol_main.o undef_symbol.so "2>$@"
1637         @if $(CXXLINK) -o undef_symbol_test undef_symbol_main.o undef_symbol.so 2>$@; \
1638         then \
1639           echo 1>&2 "Link of undef_symbol_test should have failed"; \
1640           rm -f $@; \
1641           exit 1; \
1642         fi
1645 # Test -o when emitting to a special file (such as something in /dev).
1646 check_PROGRAMS += flagstest_o_specialfile
1647 flagstest_o_specialfile: flagstest_debug.o gcctestdir/ld
1648         $(CXXLINK) -o /dev/stdout $< 2>&1 | cat > $@
1649         chmod a+x $@
1650         test -s $@
1652 # Test --compress-debug-sections.
1653 check_PROGRAMS += flagstest_compress_debug_sections_none
1654 check_DATA += flagstest_compress_debug_sections_none.stdout
1655 flagstest_compress_debug_sections_none: flagstest_debug.o gcctestdir/ld
1656         $(CXXLINK) -o $@ $< -Wl,--compress-debug-sections=none
1657         test -s $@
1659 # Dump DWARF debug sections.
1660 flagstest_compress_debug_sections_none.stdout: flagstest_compress_debug_sections_none
1661         $(TEST_READELF) -w $< > $@.tmp
1662         mv -f $@.tmp $@
1664 check_PROGRAMS += flagstest_compress_debug_sections
1665 check_DATA += flagstest_compress_debug_sections.stdout \
1666               flagstest_compress_debug_sections.cmp \
1667               flagstest_compress_debug_sections.check
1668 MOSTLYCLEANFILES += flagstest_compress_debug_sections.check \
1669                     flagstest_compress_debug_sections.cmp
1670 flagstest_compress_debug_sections: flagstest_debug.o gcctestdir/ld
1671         $(CXXLINK) -o $@ $< -Wl,--compress-debug-sections=zlib
1672         test -s $@
1674 # Test --compress-debug-sections with --build-id=tree.
1675 check_PROGRAMS += flagstest_compress_debug_sections_and_build_id_tree
1676 flagstest_compress_debug_sections_and_build_id_tree: flagstest_debug.o gcctestdir/ld
1677         $(CXXLINK) -o $@ $< -Wl,--compress-debug-sections=zlib \
1678                 -Wl,--build-id=tree \
1679                 -Wl,--build-id-chunk-size-for-treehash=4096 \
1680                 -Wl,--build-id-min-file-size-for-treehash=0
1681         test -s $@
1683 # Dump compressed DWARF debug sections.
1684 flagstest_compress_debug_sections.stdout: flagstest_compress_debug_sections
1685         $(TEST_READELF) -w $< | sed -e "s/.zdebug_/.debug_/" > $@.tmp
1686         mv -f $@.tmp $@
1688 # Check there are compressed DWARF .debug_* sections.
1689 flagstest_compress_debug_sections.check: flagstest_compress_debug_sections
1690         $(TEST_READELF) -SW $< | egrep ".debug_.* C *" > $@.tmp
1691         mv -f $@.tmp $@
1693 # Compare DWARF debug info.
1694 flagstest_compress_debug_sections.cmp: flagstest_compress_debug_sections.stdout \
1695         flagstest_compress_debug_sections_none.stdout
1696         cmp flagstest_compress_debug_sections.stdout \
1697                 flagstest_compress_debug_sections_none.stdout > $@.tmp
1698         mv -f $@.tmp $@
1700 check_PROGRAMS += flagstest_compress_debug_sections_gnu
1701 check_DATA += flagstest_compress_debug_sections_gnu.stdout \
1702               flagstest_compress_debug_sections_gnu.cmp \
1703               flagstest_compress_debug_sections_gnu.check
1704 MOSTLYCLEANFILES += flagstest_compress_debug_sections_gnu.check \
1705                     flagstest_compress_debug_sections_gnu.cmp
1706 flagstest_compress_debug_sections_gnu: flagstest_debug.o gcctestdir/ld
1707         $(CXXLINK) -o $@ $< -Wl,--compress-debug-sections=zlib-gnu
1708         test -s $@
1710 # Dump compressed DWARF debug sections.
1711 flagstest_compress_debug_sections_gnu.stdout: flagstest_compress_debug_sections_gnu
1712         $(TEST_READELF) -w $< | sed -e "s/.zdebug_/.debug_/" > $@.tmp
1713         mv -f $@.tmp $@
1715 # Check there are compressed DWARF .zdebug_* sections.
1716 flagstest_compress_debug_sections_gnu.check: flagstest_compress_debug_sections_gnu
1717         $(TEST_READELF) -SW $< | grep ".zdebug_" > $@.tmp
1718         mv -f $@.tmp $@
1720 # Compare DWARF debug info.
1721 flagstest_compress_debug_sections_gnu.cmp: flagstest_compress_debug_sections_gnu.stdout \
1722         flagstest_compress_debug_sections_none.stdout
1723         cmp flagstest_compress_debug_sections_gnu.stdout \
1724                 flagstest_compress_debug_sections_none.stdout > $@.tmp
1725         mv -f $@.tmp $@
1727 check_PROGRAMS += flagstest_compress_debug_sections_gabi
1728 check_DATA += flagstest_compress_debug_sections_gabi.stdout \
1729               flagstest_compress_debug_sections_gabi.cmp \
1730               flagstest_compress_debug_sections_gabi.check
1731 MOSTLYCLEANFILES += flagstest_compress_debug_sections_gabi.cmp \
1732                     flagstest_compress_debug_sections_gabi.check
1733 flagstest_compress_debug_sections_gabi: flagstest_debug.o gcctestdir/ld
1734         $(CXXLINK) -o $@ $< -Wl,--compress-debug-sections=zlib-gabi
1735         test -s $@
1737 # Dump compressed DWARF debug sections.
1738 flagstest_compress_debug_sections_gabi.stdout: flagstest_compress_debug_sections_gabi
1739         $(TEST_READELF) -w $< > $@.tmp
1740         mv -f $@.tmp $@
1742 # Check there are compressed DWARF .debug_* sections.
1743 flagstest_compress_debug_sections_gabi.check: flagstest_compress_debug_sections_gabi
1744         $(TEST_READELF) -tW $< | grep "COMPRESSED" > $@.tmp
1745         mv -f $@.tmp $@
1747 # Compare DWARF debug info.
1748 flagstest_compress_debug_sections_gabi.cmp: flagstest_compress_debug_sections_gabi.stdout \
1749         flagstest_compress_debug_sections_none.stdout
1750         cmp flagstest_compress_debug_sections_gabi.stdout \
1751                 flagstest_compress_debug_sections_none.stdout > $@.tmp
1752         mv -f $@.tmp $@
1754 # The specialfile output has a tricky case when we also compress debug
1755 # sections, because it requires output-file resizing.
1756 check_PROGRAMS += flagstest_o_specialfile_and_compress_debug_sections
1757 flagstest_o_specialfile_and_compress_debug_sections: flagstest_debug.o \
1758                 gcctestdir/ld
1759         $(CXXLINK) -o /dev/stdout $< -Wl,--compress-debug-sections=zlib 2>&1 | cat > $@
1760         chmod a+x $@
1761         test -s $@
1763 check_SCRIPTS += pr18689.sh
1764 check_DATA += pr18689.stdout
1765 MOSTLYCLEANFILES += pr18689a.o pr18689b.o
1767 pr18689.stdout: pr18689b.o
1768         $(TEST_READELF) -SW $< > $@
1770 pr18689a.o: pr18689.o ../ld-new
1771         ../ld-new -r -o $@ $<
1773 pr18689b.o: pr18689a.o ../ld-new
1774         ../ld-new -r -o $@ $<
1776 pr18689.o: pr18689.c gcctestdir/as
1777         $(COMPILE) -ggdb3 -g -Wa,--compress-debug-sections=zlib-gabi -c -w -o $@ $(srcdir)/pr18689.c
1779 # Test -TText and -Tdata.
1780 check_PROGRAMS += flagstest_o_ttext_1
1781 flagstest_o_ttext_1: flagstest_debug.o gcctestdir/ld
1782         $(CXXLINK) -o $@ $< -Wl,-Ttext,0x400000 -Wl,-Tdata,0x800000
1784 # This version won't be runnable, because there is no way to put the
1785 # PT_PHDR segment at file offset 0.  We just make sure that we can
1786 # build it without error.
1787 check_DATA += flagstest_o_ttext_2
1788 MOSTLYCLEANFILES += flagstest_o_ttext_2
1789 flagstest_o_ttext_2: flagstest_debug.o gcctestdir/ld
1790         $(CXXLINK) -o $@ $< -Wl,-Ttext,0x400010 -Wl,-Tdata,0x800010
1792 # Test symbol versioning.
1793 check_PROGRAMS += ver_test
1794 ver_test_SOURCES = ver_test_main.cc
1795 ver_test_DEPENDENCIES = gcctestdir/ld ver_test_1.so ver_test_2.so ver_test_4.so
1796 ver_test_LDFLAGS = -Wl,-R,.
1797 ver_test_LDADD = ver_test_1.so ver_test_2.so ver_test_4.so
1798 ver_test_1.so: ver_test_1.o ver_test_2.so ver_test_3.o ver_test_4.so gcctestdir/ld
1799         $(CXXLINK) -shared ver_test_1.o ver_test_2.so ver_test_3.o ver_test_4.so
1800 ver_test_2.so: ver_test_2.o $(srcdir)/ver_test_2.script ver_test_4.so gcctestdir/ld
1801         $(CXXLINK) -shared -Wl,--version-script,$(srcdir)/ver_test_2.script -Wl,-R,. ver_test_2.o ver_test_4.so
1802 ver_test_4.so: ver_test_4.o $(srcdir)/ver_test_4.script gcctestdir/ld
1803         $(CXXLINK) -shared -Wl,--version-script,$(srcdir)/ver_test_4.script ver_test_4.o
1804 ver_test_1.o: ver_test_1.cc
1805         $(CXXCOMPILE) -c -fpic -o $@ $<
1806 ver_test_2.o: ver_test_2.cc
1807         $(CXXCOMPILE) -c -fpic -o $@ $<
1808 ver_test_3.o: ver_test_3.cc
1809         $(CXXCOMPILE) -c -fpic -o $@ $<
1810 ver_test_4.o: ver_test_4.cc
1811         $(CXXCOMPILE) -c -fpic -o $@ $<
1813 check_SCRIPTS += ver_test_1.sh
1814 check_DATA += ver_test_1.syms
1815 ver_test_1.syms: ver_test_1.so
1816         $(TEST_READELF) -s $< >$@ 2>/dev/null
1818 check_PROGRAMS += ver_test_2
1819 ver_test_2_SOURCES = ver_test_main_2.cc
1820 ver_test_2_DEPENDENCIES = gcctestdir/ld ver_test_4.so ver_test_2.so
1821 ver_test_2_LDFLAGS = -Wl,-R,.
1822 ver_test_2_LDADD = ver_test_4.so ver_test_2.so
1824 check_SCRIPTS += ver_test_2.sh
1825 check_DATA += ver_test_2.syms
1826 ver_test_2.syms: ver_test_2
1827         $(TEST_READELF) -s $< >$@ 2>/dev/null
1829 check_SCRIPTS += ver_test_4.sh
1830 check_DATA += ver_test_4.syms
1831 ver_test_4.syms: ver_test_4.so
1832         $(TEST_READELF) -s $< >$@ 2>/dev/null
1834 ver_test_5.so: ver_test_5.o $(srcdir)/ver_test_5.script ver_test_4.so gcctestdir/ld
1835         $(CXXLINK) -shared -Wl,--version-script,$(srcdir)/ver_test_5.script ver_test_5.o ver_test_4.so
1836 ver_test_5.o: ver_test_5.cc
1837         $(CXXCOMPILE) -c -fpic -o $@ $<
1838 check_SCRIPTS += ver_test_5.sh
1839 check_DATA += ver_test_5.syms
1840 ver_test_5.syms: ver_test_5.so
1841         $(TEST_READELF) -s $< >$@ 2>/dev/null
1843 check_PROGRAMS += ver_test_6
1844 ver_test_6_SOURCES = ver_test_6.c
1845 ver_test_6_DEPENDENCIES = gcctestdir/ld ver_test_2.so
1846 ver_test_6_LDFLAGS = -Wl,-R,.
1847 ver_test_6_LDADD = ver_test_2.so
1849 ver_test_7.so: ver_test_4.o $(srcdir)/ver_test_4.script ver_test_7.o gcctestdir/ld
1850         $(CXXLINK) -shared -Wl,--version-script,$(srcdir)/ver_test_4.script ver_test_4.o ver_test_7.o
1851 ver_test_7.o: ver_test_7.cc
1852         $(CXXCOMPILE) -c -fpic -o $@ $<
1853 check_SCRIPTS += ver_test_7.sh
1854 check_DATA += ver_test_7.syms
1855 ver_test_7.syms: ver_test_7.so
1856         $(TEST_READELF) -s $< >$@ 2>/dev/null
1858 check_PROGRAMS += ver_test_8
1859 ver_test_8_SOURCES = two_file_test_main.cc
1860 ver_test_8_DEPENDENCIES = gcctestdir/ld ver_test_8_1.so ver_test_8_2.so
1861 ver_test_8_LDFLAGS = -Wl,-R,.
1862 ver_test_8_LDADD = ver_test_8_1.so ver_test_8_2.so
1863 ver_test_8_1.so: two_file_test_1_pic.o two_file_test_1b_pic.o ver_test_8_2.so gcctestdir/ld
1864         $(CXXLINK) -shared two_file_test_1_pic.o two_file_test_1b_pic.o ver_test_8_2.so
1865 ver_test_8_2.so: two_file_test_2_pic.o $(srcdir)/ver_test_8.script gcctestdir/ld
1866         $(CXXLINK) -shared -Wl,--version-script,$(srcdir)/ver_test_8.script two_file_test_2_pic.o
1868 check_SCRIPTS += ver_test_8.sh
1869 check_DATA += ver_test_8_2.so.syms
1870 ver_test_8_2.so.syms: ver_test_8_2.so
1871         $(TEST_READELF) -s $< >$@ 2>/dev/null
1873 check_PROGRAMS += ver_test_9
1874 ver_test_9_SOURCES = ver_test_main.cc
1875 ver_test_9_DEPENDENCIES = gcctestdir/ld ver_test_9.so
1876 ver_test_9_LDFLAGS = -Wl,-R,.
1877 ver_test_9_LDADD = ver_test_9.so
1878 ver_test_9.so: ver_test_9.o ver_test_4.so ver_test_5.so gcctestdir/ld
1879         $(CXXLINK) -shared -Wl,-R,. ver_test_9.o ver_test_5.so ver_test_4.so
1880 ver_test_9.o: ver_test_9.cc
1881         $(CXXCOMPILE) -c -fpic -o $@ $<
1883 check_SCRIPTS += ver_test_10.sh
1884 check_DATA += ver_test_10.syms
1885 ver_test_10.syms: ver_test_10.so
1886         $(TEST_READELF) -s $< >$@ 2>/dev/null
1887 ver_test_10.so: gcctestdir/ld ver_test_2.o ver_test_10.script
1888         $(CXXLINK) -shared -Wl,--version-script,$(srcdir)/ver_test_10.script ver_test_2.o
1890 check_PROGRAMS += ver_test_11
1891 MOSTLYCLEANFILES += ver_test_11.a
1892 ver_test_11_SOURCES = ver_test_main_2.cc
1893 ver_test_11_DEPENDENCIES = gcctestdir/ld ver_test_11.a
1894 ver_test_11_LDFLAGS = -Wl,-R,.
1895 ver_test_11_LDADD = ver_test_11.a
1896 ver_test_11.a: ver_test_1.o ver_test_2.o ver_test_4.o
1897         $(TEST_AR) rc $@ $^
1899 check_PROGRAMS += ver_test_12
1900 ver_test_12_SOURCES = ver_test_main_2.cc
1901 ver_test_12_DEPENDENCIES = gcctestdir/ld ver_test_12.o
1902 ver_test_12_LDFLAGS = -Wl,-R,.
1903 ver_test_12_LDADD = ver_test_12.o
1904 ver_test_12.o: gcctestdir/ld ver_test_1.o ver_test_2.o ver_test_4.o
1905         gcctestdir/ld -r -o $@ ver_test_1.o ver_test_2.o ver_test_4.o
1907 check_SCRIPTS += ver_test_13.sh
1908 check_DATA += ver_test_13.syms
1909 ver_test_13.syms: ver_test_13.so
1910         $(TEST_READELF) -s $< >$@ 2>/dev/null
1911 ver_test_13.so: gcctestdir/ld ver_test_13.o ver_test_13.script
1912         $(LINK) -shared -Wl,--version-script,$(srcdir)/ver_test_13.script ver_test_13.o
1913 ver_test_13.o: ver_test_13.c
1914         $(COMPILE) -c -fpic -o $@ $<
1916 check_SCRIPTS += ver_test_14.sh
1917 check_DATA += ver_test_14.syms
1918 MOSTLYCLEANFILES += ver_test_14
1919 ver_test_14.syms: ver_test_14
1920         $(TEST_OBJDUMP) -T $< | $(TEST_CXXFILT) >$@
1921 ver_test_14: gcctestdir/ld ver_test_main.o ver_test_1.so ver_test_2.so ver_test_4.so ver_test_14.script
1922         $(CXXLINK) -Wl,--version-script,$(srcdir)/ver_test_14.script -Wl,-E -Wl,-R,. ver_test_main.o ver_test_1.so ver_test_2.so ver_test_4.so
1924 check_SCRIPTS += ver_test_pr23409.sh
1925 check_DATA += ver_test_pr23409.syms
1926 ver_test_pr23409.syms: ver_test_pr23409_1.so
1927         $(TEST_READELF) --dyn-syms -W $< >$@
1928 ver_test_pr23409_1.so: gcctestdir/ld ver_test_1.o $(srcdir)/ver_test_pr23409_1.script ver_test_pr23409_2.so
1929         gcctestdir/ld -shared -o $@ ver_test_1.o ver_test_pr23409_2.so --version-script $(srcdir)/ver_test_pr23409_1.script
1930 ver_test_pr23409_2.so: gcctestdir/ld ver_test_1.o $(srcdir)/ver_test_pr23409_2.script
1931         gcctestdir/ld -shared -o $@ ver_test_1.o --version-script $(srcdir)/ver_test_pr23409_2.script
1933 check_SCRIPTS += weak_as_needed.sh
1934 check_DATA += weak_as_needed.stdout
1935 weak_as_needed.stdout: weak_as_needed_a.so
1936         $(TEST_READELF) -dW --dyn-syms $< >$@
1937 weak_as_needed_a.so: gcctestdir/ld weak_as_needed_a.o weak_as_needed_b.so weak_as_needed_c.so
1938         gcctestdir/ld -shared -rpath . -o $@ weak_as_needed_a.o --as-needed weak_as_needed_b.so weak_as_needed_c.so
1939 weak_as_needed_b.so: gcctestdir/ld weak_as_needed_b.o weak_as_needed_b.script
1940         gcctestdir/ld -shared -rpath . -o $@ --version-script $(srcdir)/weak_as_needed_b.script weak_as_needed_b.o
1941 weak_as_needed_c.so: gcctestdir/ld weak_as_needed_c.o weak_as_needed_c.script
1942         gcctestdir/ld -shared -rpath . -o $@ --version-script $(srcdir)/weak_as_needed_c.script weak_as_needed_c.o
1943 weak_as_needed_a.o: weak_as_needed_a.c
1944         $(COMPILE) -c -fpic -o $@ $<
1945 weak_as_needed_b.o: weak_as_needed_b.c
1946         $(COMPILE) -c -fpic -o $@ $<
1947 weak_as_needed_c.o: weak_as_needed_c.c
1948         $(COMPILE) -c -fpic -o $@ $<
1950 check_PROGRAMS += protected_1
1951 protected_1_SOURCES = \
1952         protected_main_1.cc protected_main_2.cc protected_main_3.cc
1953 protected_1_DEPENDENCIES = gcctestdir/ld protected_1.so
1954 protected_1_LDFLAGS = -Wl,-R,.
1955 protected_1_LDADD = protected_1.so
1957 protected_1.so: gcctestdir/ld protected_1_pic.o protected_2_pic.o protected_3_pic.o
1958         $(CXXLINK) -shared protected_1_pic.o protected_2_pic.o protected_3_pic.o
1959 protected_1_pic.o: protected_1.cc
1960         $(CXXCOMPILE) -c -fpic -o $@ $<
1961 protected_2_pic.o: protected_2.cc
1962         $(CXXCOMPILE) -c -fpic -o $@ $<
1963 protected_3_pic.o: protected_3.cc
1964         $(CXXCOMPILE) -c -fpic -o $@ $<
1966 check_PROGRAMS += protected_2
1967 protected_2_SOURCES = protected_main_1.cc protected_3.cc
1968 protected_2_DEPENDENCIES = gcctestdir/ld protected_1.so
1969 protected_2_LDFLAGS = -Wl,-R,.
1970 protected_2_LDADD = protected_1.so
1972 check_DATA += protected_3.err
1973 MOSTLYCLEANFILES += protected_3.err
1974 protected_4_pic.o: protected_4.cc
1975         $(CXXCOMPILE) -c -fpic -o $@ $<
1976 protected_3.err: protected_4_pic.o gcctestdir/ld
1977         @echo $(CXXLINK) -shared -o protected_4.so protected_4_pic.o "2>$@"
1978         @if $(CXXLINK) -shared -o protected_4.so protected_4_pic.o 2>$@; then \
1979           echo 1>&2 "Link of protected_4.so should have failed"; \
1980           rm -f $@; \
1981           exit 1; \
1982         fi
1984 check_PROGRAMS += relro_test
1985 check_SCRIPTS += relro_test.sh
1986 check_DATA += relro_test.stdout
1987 relro_test_SOURCES = relro_test_main.cc
1988 relro_test_DEPENDENCIES = gcctestdir/ld relro_test.so
1989 relro_test_LDFLAGS = -Wl,-R,.
1990 relro_test_LDADD = relro_test.so
1991 relro_test.so: gcctestdir/ld relro_test_pic.o
1992         $(CXXLINK) -shared -Wl,-z,relro relro_test_pic.o
1993 relro_test_pic.o: relro_test.cc
1994         $(CXXCOMPILE) -c -fpic -o $@ $<
1995 relro_test.stdout: relro_test.so
1996         $(TEST_READELF) -SlW relro_test.so > relro_test.stdout
1998 check_PROGRAMS += relro_now_test
1999 relro_now_test_SOURCES = relro_test_main.cc
2000 relro_now_test_DEPENDENCIES = gcctestdir/ld relro_now_test.so
2001 relro_now_test_LDFLAGS = -Wl,-R,. -Wl,-z,relro -Wl,-z,now
2002 relro_now_test_LDADD = relro_now_test.so
2003 relro_now_test.so: gcctestdir/ld relro_test_pic.o
2004         $(CXXLINK) -shared -Wl,-z,relro -Wl,-z,now relro_test_pic.o
2006 check_PROGRAMS += relro_strip_test
2007 relro_strip_test_SOURCES = relro_test_main.cc
2008 relro_strip_test_DEPENDENCIES = gcctestdir/ld relro_strip_test.so
2009 relro_strip_test_LDFLAGS = -Wl,-R,.
2010 relro_strip_test_LDADD = relro_strip_test.so
2011 relro_strip_test.so: relro_test.so
2012         $(TEST_STRIP) -o $@ $<
2014 check_PROGRAMS += relro_script_test
2015 relro_script_test_SOURCES = relro_test_main.cc
2016 relro_script_test_DEPENDENCIES = gcctestdir/ld relro_script_test.so
2017 relro_script_test_LDFLAGS = -Wl,-R,.
2018 relro_script_test_LDADD = relro_script_test.so
2019 relro_script_test.so: gcctestdir/ld relro_script_test.t relro_test_pic.o
2020         $(CXXLINK) -shared -Wl,-z,relro -Wl,-T,$(srcdir)/relro_script_test.t relro_test_pic.o
2022 check_PROGRAMS += script_test_1
2023 script_test_1_SOURCES = script_test_1a.cc script_test_1b.cc
2024 script_test_1_DEPENDENCIES = gcctestdir/ld script_test_1.t
2025 script_test_1_LDFLAGS = -Wl,-R,. -Wl,-T,$(srcdir)/script_test_1.t
2026 script_test_1_LDADD =
2028 check_PROGRAMS += script_test_2
2029 script_test_2_SOURCES = script_test_2.cc script_test_2a.cc script_test_2b.cc
2030 script_test_2_DEPENDENCIES = gcctestdir/ld script_test_2.t
2031 script_test_2_LDFLAGS = -Wl,-R,. -Wl,-T,$(srcdir)/script_test_2.t
2032 script_test_2_LDADD =
2034 check_PROGRAMS += justsyms
2035 justsyms_SOURCES = justsyms_1.cc
2036 justsyms_DEPENDENCIES = gcctestdir/ld justsyms_2r.o
2037 justsyms_LDFLAGS = -Wl,-R,justsyms_2r.o
2038 justsyms_LDADD =
2039 justsyms_2.o: justsyms_2.cc
2040         $(CXXCOMPILE) -c -o $@ $<
2041 justsyms_2r.o: justsyms_2.o gcctestdir/ld $(srcdir)/justsyms.t
2042         gcctestdir/ld -o $@ -r -T $(srcdir)/justsyms.t justsyms_2.o
2044 check_PROGRAMS += justsyms_exec
2045 justsyms_exec_SOURCES = justsyms_exec.c
2046 justsyms_exec_DEPENDENCIES = gcctestdir/ld justsyms_lib
2047 justsyms_exec_LDFLAGS = -Wl,-R,justsyms_lib
2048 justsyms_exec_LDADD =
2049 MOSTLYCLEANFILES += justsyms_lib
2050 justsyms_lib.o: justsyms_lib.c
2051         $(COMPILE) -c -o $@ $<
2052 justsyms_lib: justsyms_lib.o gcctestdir/ld
2053         gcctestdir/ld -o $@ -z norelro -T $(srcdir)/justsyms_lib.t -Ttext=0x1000200 -Tdata=0x2000000 -e exported_func justsyms_lib.o
2055 check_PROGRAMS += binary_test
2056 MOSTLYCLEANFILES += binary.txt
2057 binary_test_SOURCES = binary_test.cc
2058 binary_test_DEPENDENCIES = gcctestdir/ld binary.txt
2059 binary_test_LDFLAGS = -Wl,--format,binary,binary.txt,--format,elf
2060 binary_test_LDADD =
2061 # Copy the file to the build directory to avoid worrying about the
2062 # full pathname in the generated symbols.
2063 binary.txt: $(srcdir)/binary.in
2064         rm -f $@
2065         $(LN_S) $< $@
2067 check_SCRIPTS += ver_matching_test.sh
2068 check_DATA += ver_matching_test.stdout
2069 MOSTLYCLEANFILES += ver_matching_test.stdout
2070 ver_matching_def.so: ver_matching_def_pic.o $(srcdir)/version_script.map gcctestdir/ld
2071         $(CXXLINK) -O0 -shared ver_matching_def_pic.o -Wl,--version-script=$(srcdir)/version_script.map
2072 ver_matching_def_pic.o: ver_matching_def.cc
2073         $(CXXCOMPILE) -O0 -c -fpic -o $@ $<
2074 ver_matching_test.stdout: ver_matching_def.so
2075         $(TEST_OBJDUMP) -T ver_matching_def.so | $(TEST_CXXFILT) > ver_matching_test.stdout
2077 check_PROGRAMS += script_test_3
2078 check_SCRIPTS += script_test_3.sh
2079 check_DATA += script_test_3.stdout
2080 MOSTLYCLEANFILES += script_test_3.stdout
2081 script_test_3: basic_test.o gcctestdir/ld script_test_3.t
2082         $(CXXLINK) basic_test.o -Wl,-T,$(srcdir)/script_test_3.t
2083 script_test_3.stdout: script_test_3
2084         $(TEST_READELF) -SlW script_test_3 > script_test_3.stdout
2086 check_PROGRAMS += tls_phdrs_script_test
2087 tls_phdrs_script_test_SOURCES = $(tls_test_SOURCES)
2088 tls_phdrs_script_test_DEPENDENCIES = $(tls_test_DEPENDENCIES) $(srcdir)/script_test_3.t
2089 tls_phdrs_script_test_LDFLAGS = $(tls_test_LDFLAGS) -Wl,-T,$(srcdir)/script_test_3.t
2090 tls_phdrs_script_test_LDADD = $(tls_test_LDADD)
2092 check_SCRIPTS += script_test_4.sh
2093 check_DATA += script_test_4.stdout
2094 MOSTLYCLEANFILES += script_test_4
2095 script_test_4: basic_test.o gcctestdir/ld $(srcdir)/script_test_4.t
2096         $(CXXLINK) basic_test.o -Wl,-T,$(srcdir)/script_test_4.t
2097 script_test_4.stdout: script_test_4
2098         $(TEST_READELF) -SlW script_test_4 > script_test_4.stdout
2100 check_PROGRAMS += tls_script_test
2101 tls_script_test_SOURCES = $(tls_test_SOURCES)
2102 tls_script_test_DEPENDENCIES = $(tls_test_DEPENDENCIES) $(srcdir)/script_test_4.t
2103 tls_script_test_LDFLAGS = $(tls_test_LDFLAGS) -Wl,-T,$(srcdir)/script_test_4.t
2104 tls_script_test_LDADD = $(tls_test_LDADD)
2106 check_SCRIPTS += script_test_5.sh
2107 check_DATA += script_test_5.stdout
2108 MOSTLYCLEANFILES += script_test_5
2109 script_test_5: script_test_5.o gcctestdir/ld $(srcdir)/script_test_5.t
2110         $(CXXLINK) script_test_5.o -Wl,-T,$(srcdir)/script_test_5.t
2111 script_test_5.stdout: script_test_5
2112         $(TEST_READELF) -SW script_test_5 > script_test_5.stdout
2114 check_SCRIPTS += script_test_6.sh
2115 check_DATA += script_test_6.stdout
2116 MOSTLYCLEANFILES += script_test_6
2117 script_test_6: basic_test.o gcctestdir/ld $(srcdir)/script_test_6.t
2118         $(CXXLINK) basic_test.o -Wl,-T,$(srcdir)/script_test_6.t \
2119         -Wl,-Ttext=0x10001000 -Wl,-Tdata=0x10200000 -Wl,-Tbss=0x10400000
2120 script_test_6.stdout: script_test_6
2121         $(TEST_READELF) -SlW script_test_6 > script_test_6.stdout
2123 check_SCRIPTS += script_test_7.sh
2124 check_DATA += script_test_7.stdout
2125 MOSTLYCLEANFILES += script_test_7
2126 script_test_7: basic_test.o gcctestdir/ld $(srcdir)/script_test_7.t
2127         $(CXXLINK) basic_test.o -Wl,-T,$(srcdir)/script_test_7.t
2128 script_test_7.stdout: script_test_7
2129         $(TEST_READELF) -SlW script_test_7 > script_test_7.stdout
2131 check_SCRIPTS += script_test_8.sh
2132 check_DATA += script_test_8.stdout
2133 MOSTLYCLEANFILES += script_test_8
2134 script_test_8: basic_test.o gcctestdir/ld $(srcdir)/script_test_7.t
2135         $(CXXLINK) basic_test.o -Wl,-T,$(srcdir)/script_test_7.t \
2136         -Wl,-Ttext=0x20001000 -Wl,-Tdata=0x20200000 -Wl,-Tbss=0x20400000
2137 script_test_8.stdout: script_test_8
2138         $(TEST_READELF) -SlW script_test_8 > script_test_8.stdout
2140 check_SCRIPTS += script_test_9.sh
2141 check_DATA += script_test_9.stdout
2142 MOSTLYCLEANFILES += script_test_9
2143 script_test_9.o: script_test_9.cc
2144         $(CXXCOMPILE) -O0 -c -o $@ $<
2145 script_test_9: gcctestdir/ld $(srcdir)/script_test_9.t script_test_9.o
2146         $(CXXLINK) script_test_9.o -Wl,-T,$(srcdir)/script_test_9.t
2147 script_test_9.stdout: script_test_9
2148         $(TEST_READELF) -lW script_test_9 > script_test_9.stdout
2150 # Test scripts with a relocatable link.
2151 # The -g option is necessary to trigger a bug where a section
2152 # declared in a script file is assigned a non-zero starting address.
2153 check_PROGRAMS += script_test_11
2154 script_test_11: gcctestdir/ld script_test_11_r.o
2155         $(LINK) script_test_11_r.o
2156 script_test_11_r.o: gcctestdir/ld $(srcdir)/script_test_11.t script_test_11a.o script_test_11b.o
2157         gcctestdir/ld -r -o $@ -T $(srcdir)/script_test_11.t script_test_11a.o script_test_11b.o
2158 script_test_11a.o: script_test_11a.c
2159         $(COMPILE) -c -g -o $@ $<
2160 script_test_11b.o: script_test_11b.c
2161         $(COMPILE) -c -g -o $@ $<
2163 # Test difference between "*(a b)" and "*(a) *(b)" in input section spec.
2164 check_PROGRAMS += script_test_12
2165 script_test_12: gcctestdir/ld $(srcdir)/script_test_12.t script_test_12a.o script_test_12b.o
2166         $(LINK) -Wl,-T,$(srcdir)/script_test_12.t script_test_12a.o script_test_12b.o
2168 check_PROGRAMS += script_test_12i
2169 script_test_12i: gcctestdir/ld $(srcdir)/script_test_12i.t script_test_12a.o script_test_12b.o
2170         $(LINK) -Wl,-T,$(srcdir)/script_test_12i.t script_test_12a.o script_test_12b.o
2171 script_test_12a.o: script_test_12a.c
2172         $(COMPILE) -O0 -c -o $@ $<
2173 script_test_12b.o: script_test_12b.c
2174         $(COMPILE) -O0 -c -o $@ $<
2176 # Test for ordering internally created sections with a linker script.
2177 check_SCRIPTS += script_test_13.sh
2178 check_DATA += script_test_13.stdout
2179 MOSTLYCLEANFILES += script_test_13
2180 script_test_13.o: script_test_13.c
2181         $(COMPILE) -O0 -c -fPIC -o $@ $<
2182 script_test_13: $(srcdir)/script_test_13.t script_test_13.o gcctestdir/ld
2183         gcctestdir/ld -shared -o $@ script_test_13.o -T $(srcdir)/script_test_13.t
2184 script_test_13.stdout: script_test_13
2185         $(TEST_READELF) -SW script_test_13 > $@
2187 # Test for SORT_BY_INIT_PRIORITY.
2188 check_SCRIPTS += script_test_14.sh
2189 check_DATA += script_test_14.stdout
2190 MOSTLYCLEANFILES += script_test_14
2191 script_test_14.o: script_test_14.s
2192         $(TEST_AS) -o $@ $<
2193 script_test_14: $(srcdir)/script_test_14.t script_test_14.o gcctestdir/ld
2194         gcctestdir/ld -o $@ script_test_14.o -T $(srcdir)/script_test_14.t
2195 script_test_14.stdout: script_test_14
2196         $(TEST_OBJDUMP) -s script_test_14 > $@
2198 # Test BSS section placement at end of segment.
2199 check_SCRIPTS += script_test_15a.sh
2200 check_DATA += script_test_15a.stdout
2201 MOSTLYCLEANFILES += script_test_15a
2202 script_test_15a: $(srcdir)/script_test_15a.t script_test_15.o gcctestdir/ld
2203         gcctestdir/ld -o $@ script_test_15.o -T $(srcdir)/script_test_15a.t
2204 script_test_15a.stdout: script_test_15a
2205         $(TEST_READELF) -lSW script_test_15a > $@
2207 # Test BSS section placement in middle of segment.
2208 check_SCRIPTS += script_test_15b.sh
2209 check_DATA += script_test_15b.stdout
2210 MOSTLYCLEANFILES += script_test_15b
2211 script_test_15b: $(srcdir)/script_test_15b.t script_test_15.o gcctestdir/ld
2212         gcctestdir/ld -o $@ script_test_15.o -T $(srcdir)/script_test_15b.t
2213 script_test_15b.stdout: script_test_15b
2214         $(TEST_READELF) -lSW script_test_15b > $@
2216 # Test orphan BSS section placement.
2217 check_SCRIPTS += script_test_15c.sh
2218 check_DATA += script_test_15c.stdout
2219 MOSTLYCLEANFILES += script_test_15c
2220 script_test_15c: $(srcdir)/script_test_15c.t script_test_15.o gcctestdir/ld
2221         gcctestdir/ld -o $@ script_test_15.o -T $(srcdir)/script_test_15c.t
2222 script_test_15c.stdout: script_test_15c
2223         $(TEST_READELF) -lSW script_test_15c > $@
2225 # Test --dynamic-list, --dynamic-list-data, --dynamic-list-cpp-new,
2226 # and --dynamic-list-cpp-typeinfo
2228 check_SCRIPTS += dynamic_list.sh
2229 check_DATA += dynamic_list.stdout
2230 MOSTLYCLEANFILES += dynamic_list dynamic_list.stdout
2231 dynamic_list: basic_test.o gcctestdir/ld $(srcdir)/dynamic_list.t
2232         $(CXXLINK) basic_test.o \
2233           -Wl,--dynamic-list $(srcdir)/dynamic_list.t \
2234           -Wl,--dynamic-list-data \
2235           -Wl,--dynamic-list-cpp-new \
2236           -Wl,--dynamic-list-cpp-typeinfo
2237 dynamic_list.stdout: dynamic_list
2238         $(TEST_READELF) -W --dyn-syms dynamic_list > dynamic_list.stdout
2240 check_PROGRAMS += dynamic_list_2
2241 dynamic_list_2_SOURCES = dynamic_list_2.cc
2242 dynamic_list_2_DEPENDENCIES = gcctestdir/ld dynamic_list_lib1.so dynamic_list_lib2.so
2243 dynamic_list_2_LDFLAGS = -L. -Wl,-R,. -Wl,--no-as-needed
2244 dynamic_list_2_LDADD = dynamic_list_lib1.so dynamic_list_lib2.so
2246 dynamic_list_lib1.so: gcctestdir/ld dynamic_list_lib1.o
2247         $(CXXLINK) -shared dynamic_list_lib1.o
2248 dynamic_list_lib1.o: dynamic_list_lib1.cc
2249         $(CXXCOMPILE) -c -fpic -o $@ $<
2251 dynamic_list_lib2.so: gcctestdir/ld dynamic_list_lib2.o $(srcdir)/dynamic_list_2.t
2252         $(CXXLINK) -shared -Wl,-Bsymbolic-functions -Wl,--dynamic-list,$(srcdir)/dynamic_list_2.t dynamic_list_lib2.o
2253 dynamic_list_lib2.o: dynamic_list_lib2.cc
2254         $(CXXCOMPILE) -c -fpic -o $@ $<
2256 check_PROGRAMS += thin_archive_test_1
2257 MOSTLYCLEANFILES += libthin1.a libthin3.a libthinall.a \
2258         alt/thin_archive_test_2.o alt/thin_archive_test_4.o \
2259         alt/libthin2.a alt/libthin4.a
2260 thin_archive_test_1_SOURCES = thin_archive_main.cc
2261 thin_archive_test_1_DEPENDENCIES = gcctestdir/ld libthin1.a alt/libthin2.a
2262 thin_archive_test_1_LDFLAGS = -Lalt
2263 thin_archive_test_1_LDADD = libthin1.a -lthin2
2265 check_PROGRAMS += thin_archive_test_2
2266 thin_archive_test_2_SOURCES = thin_archive_main.cc
2267 thin_archive_test_2_DEPENDENCIES = gcctestdir/ld libthinall.a
2268 thin_archive_test_2_LDFLAGS = -L.
2269 thin_archive_test_2_LDADD = -lthinall
2271 libthin1.a: thin_archive_test_1.o alt/thin_archive_test_2.o
2272         rm -f $@
2273         $(TEST_AR) crT $@ $^
2274 alt/libthin2.a: thin_archive_test_3.o alt/thin_archive_test_4.o
2275         rm -f $@
2276         $(TEST_AR) crT $@ $^
2277 libthin3.a: thin_archive_test_1.o alt/thin_archive_test_4.o
2278         rm -f $@
2279         $(TEST_AR) crT $@ $^
2280 alt/libthin4.a: alt/thin_archive_test_2.o thin_archive_test_3.o
2281         rm -f $@
2282         $(TEST_AR) crT $@ $^
2283 libthinall.a: libthin3.a alt/libthin4.a
2284         rm -f $@
2285         $(TEST_AR) crT $@ $^
2286 alt/thin_archive_test_2.o: thin_archive_test_2.cc
2287         test -d alt || mkdir -p alt
2288         $(CXXCOMPILE) -c -o $@ $<
2289 alt/thin_archive_test_4.o: thin_archive_test_4.cc
2290         test -d alt || mkdir -p alt
2291         $(CXXCOMPILE) -c -o $@ $<
2293 if PLUGINS
2295 check_PROGRAMS += plugin_test_1
2296 check_SCRIPTS += plugin_test_1.sh
2297 check_DATA += plugin_test_1.err
2298 MOSTLYCLEANFILES += plugin_test_1.err
2299 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
2300         $(CXXLINK) -Wl,--no-demangle,--emit-relocs,--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
2301 plugin_test_1.err: plugin_test_1
2302         @touch plugin_test_1.err
2304 check_PROGRAMS += plugin_test_2
2305 check_SCRIPTS += plugin_test_2.sh
2306 check_DATA += plugin_test_2.err
2307 MOSTLYCLEANFILES += plugin_test_2.err
2308 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
2309         $(CXXLINK) -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
2310 plugin_test_2.err: plugin_test_2
2311         @touch plugin_test_2.err
2313 check_PROGRAMS += plugin_test_3
2314 check_SCRIPTS += plugin_test_3.sh
2315 check_DATA += plugin_test_3.err
2316 MOSTLYCLEANFILES += plugin_test_3.err
2317 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
2318         $(CXXLINK) -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
2319 plugin_test_3.err: plugin_test_3
2320         @touch plugin_test_3.err
2322 check_PROGRAMS += plugin_test_4
2323 check_SCRIPTS += plugin_test_4.sh
2324 check_DATA += plugin_test_4.err
2325 MOSTLYCLEANFILES += plugin_test_4.a plugin_test_4.err
2326 plugin_test_4: two_file_test_main.o plugin_test_4.a gcctestdir/ld plugin_test.so
2327         $(CXXLINK) -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
2328 plugin_test_4.err: plugin_test_4
2329         @touch plugin_test_4.err
2331 plugin_test_4.a: two_file_test_1.o.syms two_file_test_1b.o.syms two_file_test_2.o.syms
2332         $(TEST_AR) cr $@ $^
2334 check_PROGRAMS += plugin_test_5
2335 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
2336         $(CXXLINK) -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
2338 check_PROGRAMS += plugin_test_6
2339 check_SCRIPTS += plugin_test_6.sh
2340 check_DATA += plugin_test_6.err
2341 MOSTLYCLEANFILES += plugin_test_6.err
2342 plugin_test_6: plugin_common_test_1.o.syms plugin_common_test_2.o.syms gcctestdir/ld plugin_test.so
2343         $(CXXLINK) -Wl,--no-demangle,--plugin,"./plugin_test.so" plugin_common_test_1.o.syms plugin_common_test_2.o.syms 2>plugin_test_6.err
2344 plugin_test_6.err: plugin_test_6
2345         @touch plugin_test_6.err
2347 check_PROGRAMS += plugin_test_7
2348 check_SCRIPTS += plugin_test_7.sh
2349 check_DATA += plugin_test_7.err plugin_test_7.o.syms
2350 MOSTLYCLEANFILES += plugin_test_7.err
2351 plugin_test_7: plugin_test_7_1.o plugin_test_7_1.o.syms plugin_test_7_2.o gcctestdir/ld plugin_test.so
2352         $(LINK) -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
2353 plugin_test_7.o.syms: plugin_test_7
2354         $(TEST_READELF) -sW $< >$@ 2>/dev/null
2355 plugin_test_7_1.o: plugin_test_7_1.c
2356         $(COMPILE) -DLTO -O0 -c -ffunction-sections -fdata-sections -o $@ $<
2357 plugin_test_7_1_orig.o: plugin_test_7_1.c
2358         $(COMPILE) -O0 -c -ffunction-sections -fdata-sections -o $@ $<
2359 plugin_test_7_1.o.syms: plugin_test_7_1_orig.o
2360         $(TEST_READELF) -sW $< >$@ 2>/dev/null
2361 plugin_test_7_2.o: plugin_test_7_2.c
2362         $(COMPILE) -O0 -c -ffunction-sections -fdata-sections -o $@ $<
2363 plugin_test_7.err: plugin_test_7
2365 # Test plugins with -r.
2366 check_PROGRAMS += plugin_test_8
2367 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
2368         ../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
2369 plugin_test_8: plugin_test_8.o gcctestdir/ld
2370         $(CXXLINK) -Wl,--no-demangle plugin_test_8.o
2372 # Test that symbols known in the IR file but not in the replacement file
2373 # produce an unresolved symbol error.
2374 check_DATA += plugin_test_9.err
2375 MOSTLYCLEANFILES += plugin_test_9.err
2376 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
2377         @echo $(CXXLINK) -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>$@"
2378         @if $(CXXLINK) -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 \
2379           echo 1>&2 "Link of plugin_test_9 should have failed"; \
2380           rm -f $@; \
2381           exit 1; \
2382         fi
2383 # Make a .syms file that claims to define the symbol _Z4t16av.
2384 two_file_test_1c.o.syms: two_file_test_1.o.syms two_file_test_1c.o
2385         cp two_file_test_1.o.syms $@.tmp
2386         grep "_Z4t16av" two_file_test_1b.o.syms >> $@.tmp
2387         mv -f $@.tmp $@
2388 # Make a copy of two_file_test_1.o, which does not define the symbol _Z4t16av.
2389 MOSTLYCLEANFILES += two_file_test_1c.o
2390 two_file_test_1c.o: two_file_test_1.o
2391         cp two_file_test_1.o $@
2393 # As above, but check COMDAT case, where a non-IR file contains a duplicate
2394 # of a COMDAT group in an IR file.
2395 check_DATA += plugin_test_9b.err
2396 MOSTLYCLEANFILES += plugin_test_9b.err
2397 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
2398         @echo $(CXXLINK) -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>$@"
2399         @if $(CXXLINK) -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 \
2400           echo 1>&2 "Link of plugin_test_9b should have failed"; \
2401           rm -f $@; \
2402           exit 1; \
2403         fi
2404 # Make a .syms file that claims to define a method in class A in a COMDAT group.
2405 # The real plugin_test_9b_ir.o will be compiled without the -D, and will not
2406 # define any methods in class A.
2407 plugin_test_9b_ir.o.syms: plugin_test_9b_ir_witha.o
2408         $(TEST_READELF) -sW $< >$@ 2>/dev/null
2409 plugin_test_9b_ir_witha.o: plugin_test_9b_ir.cc
2410         $(CXXCOMPILE) -c -DUSE_CLASS_A -o $@ $<
2412 check_PROGRAMS += plugin_test_10
2413 check_SCRIPTS += plugin_test_10.sh
2414 check_DATA += plugin_test_10.sections
2415 MOSTLYCLEANFILES += plugin_test_10.sections
2416 plugin_test_10: plugin_common_test_1.o.syms plugin_common_test_2.o gcctestdir/ld plugin_test.so
2417         $(CXXLINK) -Wl,--no-demangle,--plugin,"./plugin_test.so" plugin_common_test_1.o.syms plugin_common_test_2.o
2418 plugin_test_10.sections: plugin_test_10
2419         $(TEST_READELF) -SW $< >$@ 2>/dev/null
2421 check_PROGRAMS += plugin_test_11
2422 check_SCRIPTS += plugin_test_11.sh
2423 check_DATA += plugin_test_11.err
2424 MOSTLYCLEANFILES += plugin_test_11.err plugin_test_thin.a
2425 PLUGIN_TEST_11_SYMS = two_file_test_1.o.syms two_file_test_1b.o.syms two_file_test_2.o.syms
2426 plugin_test_11: two_file_test_main.o plugin_test_thin.a gcctestdir/ld plugin_test.so $(PLUGIN_TEST_11_SYMS)
2427         $(CXXLINK) -Wl,--no-demangle,--plugin,"./plugin_test.so",--plugin-opt,"_Z4f13iv" two_file_test_main.o plugin_test_thin.a 2>plugin_test_11.err
2428 plugin_test_11.err: plugin_test_11
2429         @touch plugin_test_11.err
2430 plugin_test_thin.a: two_file_test_1.o two_file_test_1b.o two_file_test_2.o
2431         rm -f $@
2432         $(TEST_AR) crT $@ $^
2434 check_PROGRAMS += plugin_test_12
2435 check_SCRIPTS += plugin_test_12.sh
2436 check_DATA += plugin_test_12.err
2437 MOSTLYCLEANFILES += plugin_test_12.err
2438 export_dynamic_plugin.o.syms: export_dynamic_plugin.o
2439         $(TEST_READELF) -sW $< >$@ 2>/dev/null
2440 export_dynamic_plugin.o: export_dynamic_plugin.cc
2441         $(CXXCOMPILE) -c -o $@ $<
2442 plugin_test_12: export_dynamic_plugin.o gcctestdir/ld plugin_test.so export_dynamic_plugin.o.syms
2443         $(CXXLINK) -Wl,--no-demangle,--plugin,"./plugin_test.so",--plugin-opt,"_Z3foov" -Wl,--export-dynamic-symbol,"_Z3foov" export_dynamic_plugin.o.syms 2>plugin_test_12.err
2444 plugin_test_12.err: plugin_test_12
2445         @touch plugin_test_12.err
2447 check_PROGRAMS += plugin_test_wrap_symbols
2448 check_SCRIPTS += plugin_test_wrap_symbols.sh
2449 check_DATA += plugin_test_wrap_symbols.err
2450 MOSTLYCLEANFILES += plugin_test_wrap_symbols.err
2451 plugin_test_wrap_symbols_1.o: plugin_test_wrap_symbols_1.cc
2452         $(CXXCOMPILE) -c -o $@ $<
2453 plugin_test_wrap_symbols_2.o: plugin_test_wrap_symbols_2.cc
2454         $(CXXCOMPILE) -c -o $@ $<
2455 plugin_test_wrap_symbols: plugin_test_wrap_symbols_1.o plugin_test_wrap_symbols_2.o gcctestdir/ld plugin_test.so
2456         $(CXXLINK) -Wl,--plugin,"./plugin_test.so" -Wl,--wrap=hello,--wrap=jello plugin_test_wrap_symbols_1.o plugin_test_wrap_symbols_2.o 2>plugin_test_wrap_symbols.err
2457 plugin_test_wrap_symbols.err: plugin_test_wrap_symbols
2458         @touch plugin_test_wrap_symbols.err
2460 check_PROGRAMS += plugin_test_start_lib
2461 check_SCRIPTS += plugin_test_start_lib.sh
2462 check_DATA += plugin_test_start_lib.err
2463 MOSTLYCLEANFILES += plugin_test_start_lib.err
2464 plugin_test_start_lib: unused.o plugin_start_lib_test.o plugin_start_lib_test_2.syms gcctestdir/ld plugin_test.so
2465         $(CXXLINK) -Wl,--no-demangle,--plugin,"./plugin_test.so" plugin_start_lib_test.o \
2466                 -Wl,--start-lib plugin_start_lib_test_2.syms -Wl,--end-lib 2>plugin_test_start_lib.err
2467 plugin_test_start_lib.err: plugin_test_start_lib
2468         @touch plugin_test_start_lib.err
2470 check_PROGRAMS += plugin_test_defsym
2471 check_SCRIPTS += plugin_test_defsym.sh
2472 check_DATA += plugin_test_defsym.err
2473 MOSTLYCLEANFILES += plugin_test_defsym.err
2474 plugin_test_defsym.syms: plugin_test_defsym.o
2475         $(TEST_READELF) -sW $< >$@ 2>/dev/null
2476 plugin_test_defsym.o: plugin_test_defsym.c
2477         $(COMPILE) -c -o $@ $<
2478 plugin_test_defsym: plugin_test_defsym.o plugin_test_defsym.syms gcctestdir/ld plugin_test.so
2479         $(CXXLINK) -Wl,--no-demangle,--plugin,"./plugin_test.so" -Wl,--defsym,bar=foo plugin_test_defsym.syms 2>plugin_test_defsym.err
2480 plugin_test_defsym.err: plugin_test_defsym
2481         @touch plugin_test_defsym.err
2483 plugin_start_lib_test_2.syms: plugin_start_lib_test_2.o
2484         $(TEST_READELF) -sW $< >$@ 2>/dev/null
2486 plugin_test.so: plugin_test.o gcctestdir/ld
2487         $(LINK) -shared plugin_test.o
2488 plugin_test.o: plugin_test.c
2489         $(COMPILE) -O0 -c -fpic -o $@ $<
2491 plugin_common_test_1.o: plugin_common_test_1.c
2492         $(COMPILE) -c $(COMMON_TEST_C_CFLAGS) -o $@ $<
2493 plugin_common_test_2.o: plugin_common_test_2.c
2494         $(COMPILE) -c $(COMMON_TEST_C_CFLAGS) -o $@ $<
2496 two_file_test_main.o.syms: two_file_test_main.o
2497         $(TEST_READELF) -sW $< >$@ 2>/dev/null
2498 two_file_test_1.o.syms: two_file_test_1.o
2499         $(TEST_READELF) -sW $< >$@ 2>/dev/null
2500 two_file_test_1b.o.syms: two_file_test_1b.o
2501         $(TEST_READELF) -sW $< >$@ 2>/dev/null
2502 two_file_test_2.o.syms: two_file_test_2.o
2503         $(TEST_READELF) -sW $< >$@ 2>/dev/null
2504 plugin_common_test_1.o.syms: plugin_common_test_1.o
2505         $(TEST_READELF) -sW $< >$@ 2>/dev/null
2506 plugin_common_test_2.o.syms: plugin_common_test_2.o
2507         $(TEST_READELF) -sW $< >$@ 2>/dev/null
2509 empty.o.syms:
2510         @echo "" >$@
2511         @echo "Symbol table" >>$@
2513 if TLS
2515 check_PROGRAMS += plugin_test_tls
2516 check_SCRIPTS += plugin_test_tls.sh
2517 check_DATA += plugin_test_tls.err
2518 MOSTLYCLEANFILES += plugin_test_tls.err
2519 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
2520         $(CXXLINK) -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
2521 plugin_test_tls.err: plugin_test_tls
2522         @touch plugin_test_tls.err
2524 two_file_test_2_tls.o.syms: two_file_test_2_tls.o
2525         $(TEST_READELF) -sW $< >$@ 2>/dev/null
2527 endif TLS
2529 MOSTLYCLEANFILES += unused.c
2530 unused.o.syms: unused.o
2531         $(TEST_READELF) -sW $< >$@ 2>/dev/null
2532         @echo "     1: 00000000     4 FUNC    GLOBAL DEFAULT    1 UNUSED" >>$@
2533 unused.o: unused.c
2534         $(COMPILE) -c -o $@ $<
2535 unused.c:
2536         @cp /dev/null $@
2538 check_SCRIPTS += plugin_final_layout.sh
2539 check_DATA += plugin_final_layout.stdout plugin_final_layout_readelf.stdout
2540 MOSTLYCLEANFILES += plugin_final_layout
2541 plugin_final_layout.o: plugin_final_layout.cc
2542         $(CXXCOMPILE) -O0 -c -ffunction-sections -fdata-sections -g -o $@ $<
2543 plugin_final_layout: plugin_final_layout.o plugin_section_order.so gcctestdir/ld
2544         $(CXXLINK) -Wl,--plugin,"./plugin_section_order.so" plugin_final_layout.o
2545 plugin_final_layout.stdout: plugin_final_layout
2546         $(TEST_NM) -n --synthetic plugin_final_layout > plugin_final_layout.stdout
2547 plugin_final_layout_readelf.stdout: plugin_final_layout
2548         $(TEST_READELF) -Wl plugin_final_layout > plugin_final_layout_readelf.stdout
2550 plugin_section_order.so: plugin_section_order.o gcctestdir/ld
2551         $(LINK) -shared plugin_section_order.o
2552 plugin_section_order.o: plugin_section_order.c
2553         $(COMPILE) -O0 -c -fpic -o $@ $<
2555 # Uses the plugin_final_layout.sh script above to avoid duplication
2556 check_DATA += plugin_layout_new_file.stdout plugin_layout_new_file_readelf.stdout
2557 MOSTLYCLEANFILES += plugin_layout_new_file
2558 plugin_final_layout.o.syms: plugin_final_layout.o
2559         $(TEST_READELF) -sW $< >$@ 2>/dev/null
2560 plugin_layout_new_file: plugin_final_layout.o.syms plugin_test.so plugin_new_section_layout.so gcctestdir/ld
2561         $(CXXLINK) -Wl,--plugin,"./plugin_test.so"  -Wl,--plugin,"./plugin_new_section_layout.so" plugin_final_layout.o.syms
2562 plugin_layout_new_file.stdout: plugin_layout_new_file
2563         $(TEST_NM) -n --synthetic plugin_layout_new_file > plugin_layout_new_file.stdout
2564 plugin_layout_new_file_readelf.stdout: plugin_layout_new_file
2565         $(TEST_READELF) -Wl plugin_layout_new_file > plugin_layout_new_file_readelf.stdout
2567 plugin_new_section_layout.so: plugin_new_section_layout.o gcctestdir/ld
2568         $(LINK) -shared plugin_new_section_layout.o
2569 plugin_new_section_layout.o: plugin_new_section_layout.c
2570         $(COMPILE) -O0 -c -fpic -o $@ $<
2572 check_SCRIPTS += plugin_layout_with_alignment.sh
2573 check_DATA += plugin_layout_with_alignment.stdout
2574 MOSTLYCLEANFILES += plugin_layout_with_alignment
2575 plugin_layout_with_alignment.o: plugin_layout_with_alignment.c
2576         $(COMPILE) -O0 -c -ffunction-sections -fdata-sections -g -o $@ $<
2577 plugin_layout_with_alignment: plugin_layout_with_alignment.o plugin_section_alignment.so gcctestdir/ld
2578         $(LINK) -Wl,--plugin,"./plugin_section_alignment.so" plugin_layout_with_alignment.o
2579 plugin_layout_with_alignment.stdout: plugin_layout_with_alignment
2580         $(TEST_NM) -n --synthetic plugin_layout_with_alignment > plugin_layout_with_alignment.stdout
2582 plugin_section_alignment.so: plugin_section_alignment.o gcctestdir/ld
2583         $(CXXLINK) -shared plugin_section_alignment.o
2584 plugin_section_alignment.o: plugin_section_alignment.cc
2585         $(CXXCOMPILE) -O0 -c -fpic -o $@ $<
2587 check_SCRIPTS += plugin_pr22868.sh
2588 check_DATA += plugin_pr22868.stdout
2589 MOSTLYCLEANFILES += plugin_pr22868.stdout
2590 plugin_pr22868.stdout: plugin_pr22868.so
2591         $(TEST_READELF) -W --dyn-syms $< >$@ 2>/dev/null
2592 plugin_pr22868.so: plugin_pr22868_a.o.syms plugin_pr22868_b.o.syms plugin_pr22868_b.o plugin_test.so gcctestdir/ld
2593         $(LINK) -shared -Wl,--plugin,"./plugin_test.so" plugin_pr22868_a.o.syms plugin_pr22868_b.o.syms
2594 plugin_pr22868_a.o.syms: plugin_pr22868_a.o
2595         $(TEST_READELF) -sW $< >$@ 2>/dev/null
2596 # Generate the .syms file from an alternate version of the original source
2597 # file, with a "protected" visibility attribute. We'll link with a
2598 # "replacement" object that does not have that attribute.
2599 plugin_pr22868_b.o.syms: plugin_pr22868_b_ir.o
2600         $(TEST_READELF) -sW $< >$@ 2>/dev/null
2601 plugin_pr22868_a.o: plugin_pr22868_a.c
2602         $(COMPILE) -c -fpic -o $@ $<
2603 plugin_pr22868_b_ir.o: plugin_pr22868_b.c
2604         $(COMPILE) -c -DIR -fpic -o $@ $<
2605 plugin_pr22868_b.o: plugin_pr22868_b.c
2606         $(COMPILE) -c -fpic -o $@ $<
2608 check_SCRIPTS += ver_test_pr16504.sh
2609 check_DATA += ver_test_pr16504.stdout
2610 ver_test_pr16504.stdout: ver_test_pr16504.so
2611         $(TEST_READELF) -W --dyn-syms $< >$@ 2>/dev/null
2612 ver_test_pr16504.so: ver_test_pr16504_a.so ver_test_pr16504_b.o.syms ver_test_pr16504_b.script gcctestdir/ld
2613         gcctestdir/ld -shared -o $@ --plugin ./plugin_test.so --version-script $(srcdir)/ver_test_pr16504_b.script ver_test_pr16504_b.o.syms ver_test_pr16504_a.so
2614 ver_test_pr16504_a.so: ver_test_pr16504_a.o ver_test_pr16504_a.script gcctestdir/ld
2615         gcctestdir/ld -shared -o $@ --version-script $(srcdir)/ver_test_pr16504_a.script ver_test_pr16504_a.o
2616 ver_test_pr16504_a.o: ver_test_pr16504_a.c
2617         $(COMPILE) -c -fpic -o $@ $<
2618 # Filter out the UNDEFs from the symbols file to simulate GCC behavior,
2619 # which does not pass the UNDEF from a .symver directive.
2620 ver_test_pr16504_b.o.syms: ver_test_pr16504_b.o
2621         $(TEST_READELF) -sW $< 2>/dev/null | grep -v "UND" >$@
2622 ver_test_pr16504_b.o: ver_test_pr16504_b.c
2623         $(COMPILE) -c -fpic -o $@ $<
2625 endif PLUGINS
2627 check_PROGRAMS += exclude_libs_test
2628 check_SCRIPTS += exclude_libs_test.sh
2629 check_DATA += exclude_libs_test.syms
2630 MOSTLYCLEANFILES += exclude_libs_test.syms libexclude_libs_test_1.a \
2631         libexclude_libs_test_2.a alt/libexclude_libs_test_3.a
2632 exclude_libs_test_SOURCES = exclude_libs_test.c
2633 exclude_libs_test_DEPENDENCIES = gcctestdir/ld libexclude_libs_test_1.a \
2634         libexclude_libs_test_2.a alt/libexclude_libs_test_3.a
2635 exclude_libs_test_LDFLAGS = -L. -Lalt \
2636         -Wl,--exclude-libs,dummy:libexclude_libs_test_1 \
2637         -Wl,--exclude-libs,libexclude_libs_test_3
2638 exclude_libs_test_LDADD = -lexclude_libs_test_1 -lexclude_libs_test_2 \
2639         alt/libexclude_libs_test_3.a
2640 exclude_libs_test.syms: exclude_libs_test
2641         $(TEST_READELF) -sW $< >$@ 2>/dev/null
2642 libexclude_libs_test_1.a: exclude_libs_test_1.o
2643         $(TEST_AR) rc $@ $^
2644 libexclude_libs_test_2.a: exclude_libs_test_2.o
2645         $(TEST_AR) rc $@ $^
2646 alt/libexclude_libs_test_3.a: exclude_libs_test_3.o
2647         test -d alt || mkdir -p alt
2648         $(TEST_AR) rc $@ $^
2650 check_PROGRAMS += local_labels_test
2651 local_labels_test.o: ver_test_6.c
2652         $(COMPILE) -g -c -Wa,-L -o $@ $<
2653 local_labels_test: local_labels_test.o gcctestdir/ld
2654         $(LINK) local_labels_test.o
2656 check_PROGRAMS += discard_locals_test
2657 check_SCRIPTS += discard_locals_test.sh
2658 check_DATA += discard_locals_test.syms \
2659         discard_locals_relocatable_test1.syms \
2660         discard_locals_relocatable_test2.syms
2661 MOSTLYCLEANFILES += discard_locals_test.syms \
2662         discard_locals_relocatable_test1.syms \
2663         discard_locals_relocatable_test2.syms \
2664         discard_locals_relocatable_test1.out \
2665         discard_locals_relocatable_test2.out
2666 discard_locals_test_SOURCES = discard_locals_test.c
2667 discard_locals_test_LDFLAGS = -Wl,--discard-locals
2668 discard_locals_test.syms: discard_locals_test
2669         $(TEST_READELF) -sW $< >$@ 2>/dev/null
2670 # '-Wa,-L' is required to preserve the local label used for testing.
2671 discard_locals_test.o: discard_locals_test.c
2672         $(COMPILE) -c -Wa,-L -o $@ $<
2674 discard_locals_relocatable_test1.syms: discard_locals_relocatable_test1.out
2675         $(TEST_READELF) -sW $< >$@ 2>/dev/null
2676 discard_locals_relocatable_test.o: discard_locals_relocatable_test.c
2677         $(COMPILE) -c -Wa,-L -fPIC -o $@ $<
2678 discard_locals_relocatable_test1.out: discard_locals_relocatable_test.o ../ld-new
2679         ../ld-new --discard-locals -relocatable -o $@ $<
2681 discard_locals_relocatable_test2.syms: discard_locals_relocatable_test2.out
2682         $(TEST_READELF) -sW $< >$@ 2>/dev/null
2683 discard_locals_relocatable_test2.out: discard_locals_relocatable_test.o ../ld-new
2684         ../ld-new --discard-all -relocatable -o $@ $<
2686 if MCMODEL_MEDIUM
2687 check_PROGRAMS += large
2688 large_SOURCES = large.c
2689 large_CFLAGS = -mcmodel=medium
2690 large_DEPENDENCIES = gcctestdir/ld
2691 large_LDADD =
2692 endif MCMODEL_MEDIUM
2694 # Test that hidden and internal symbols in the main program cannot be
2695 # referenced by a shared library.
2696 check_SCRIPTS += hidden_test.sh
2697 check_DATA += hidden_test.err
2698 MOSTLYCLEANFILES += hidden_test hidden_test.err hidden_test.syms
2699 libhidden.so: hidden_test_1.c gcctestdir/ld
2700         $(COMPILE) -g -shared -fPIC -w -o $@ $(srcdir)/hidden_test_1.c
2701 hidden_test: hidden_test_main.o libhidden.so gcctestdir/ld
2702         $(LINK) -Wl,-R,. hidden_test_main.o libhidden.so 2>hidden_test.err
2703 hidden_test.syms: hidden_test
2704         $(TEST_NM) -D hidden_test > $@
2705 hidden_test.err: hidden_test
2706         @touch hidden_test.err
2708 # Test -retain-symbols-file.
2709 check_SCRIPTS += retain_symbols_file_test.sh
2710 check_DATA += retain_symbols_file_test.stdout
2711 MOSTLYCLEANFILES += retain_symbols_file_test retain_symbols_file_test.in \
2712                     retain_symbols_file_test.stdout
2713 retain_symbols_file_test.so: basic_pic_test.o gcctestdir/ld
2714         echo 'main' > retain_symbols_file_test.in
2715         echo 't1' >> retain_symbols_file_test.in
2716         echo '_ZNK4t20a3getEv' >> retain_symbols_file_test.in
2717         echo '_Z3t18v' >> retain_symbols_file_test.in
2718         echo '__tcf_0' >> retain_symbols_file_test.in
2719         $(CXXLINK) -shared -Wl,-retain-symbols-file,retain_symbols_file_test.in basic_pic_test.o
2720 retain_symbols_file_test.stdout: retain_symbols_file_test.so
2721         $(TEST_NM) -C retain_symbols_file_test.so > $@
2724 # Test that if the output file already exists and is empty,
2725 # it will get execute permission.
2726 check_PROGRAMS += permission_test
2727 permission_test: basic_test.o gcctestdir/ld
2728         umask 022; \
2729         rm -f $@; \
2730         touch $@; \
2731         chmod 600 $@; \
2732         $(CXXLINK) basic_test.o
2734 # Check -l:foo.a
2735 check_PROGRAMS += searched_file_test
2736 MOSTLYCLEANFILES += searched_file_test searched_file_test_lib.o \
2737                     alt/searched_file_test_lib.a
2738 searched_file_test_SOURCES = searched_file_test.cc
2739 searched_file_test_DEPENDENCIES = gcctestdir/ld alt/searched_file_test_lib.a
2740 searched_file_test_LDFLAGS = -Lalt
2741 searched_file_test_LDADD = -l:searched_file_test_lib.a
2742 searched_file_test_lib.o: searched_file_test_lib.cc
2743         $(CXXCOMPILE) -c -o $@ $<
2744 alt/searched_file_test_lib.a: searched_file_test_lib.o
2745         test -d alt || mkdir -p alt
2746         $(TEST_AR) rc $@ $^
2748 # Test that no .gnu.version sections are created when
2749 # symbol versioning is not used.
2750 check_SCRIPTS += no_version_test.sh
2751 check_DATA += no_version_test.stdout
2752 MOSTLYCLEANFILES += libno_version_test.so no_version_test.stdout
2753 # We invoke the linker directly since gcc may include additional objects that
2754 # uses symbol versioning.
2755 libno_version_test.so: no_version_test.o gcctestdir/ld
2756         gcctestdir/ld -shared -o $@ no_version_test.o
2757 no_version_test.o: no_version_test.c
2758         $(COMPILE) -o $@ -c -fPIC $<
2759 no_version_test.stdout: libno_version_test.so
2760         $(TEST_OBJDUMP) -h $< > $@
2762 # Test STT_GNU_IFUNC symbols.
2763 if IFUNC
2765 ifuncmod1.o: ifuncmod1.c
2766         $(COMPILE) -c -fPIC -o $@ $<
2767 ifuncmod1.so: ifuncmod1.o gcctestdir/ld
2768         $(LINK) -shared ifuncmod1.o
2770 ifuncdep1.o: ifuncmod1.c
2771         $(COMPILE) -c -o $@ $<
2773 ifuncmain1pic.o: ifuncmain1.c
2774         $(COMPILE) -c -fPIC -o $@ $<
2775 ifuncmain1pie.o: ifuncmain1.c
2776         $(COMPILE) -c -fPIE -o $@ $<
2778 if HAVE_STATIC
2779 if IFUNC_STATIC
2780 check_PROGRAMS += ifuncmain1static
2781 ifuncmain1static_SOURCES = ifuncmain1.c
2782 ifuncmain1static_DEPENDENCIES = gcctestdir/ld ifuncdep1.o
2783 ifuncmain1static_LDFLAGS = -static
2784 ifuncmain1static_LDADD = ifuncdep1.o
2786 check_PROGRAMS += ifuncmain1picstatic
2787 ifuncmain1picstatic: ifuncmain1pic.o ifuncmod1.o gcctestdir/ld
2788         $(LINK) -static ifuncmain1pic.o ifuncmod1.o
2790 check_SCRIPTS += ifuncmod1.sh
2791 check_DATA += ifuncmod1.so.stderr
2792 ifuncmod1.so.stderr: ifuncmod1.so
2793         $(TEST_READELF) -s $< > /dev/null 2> $@
2794 endif
2795 endif
2797 check_PROGRAMS += ifuncmain1
2798 ifuncmain1_SOURCES = ifuncmain1.c
2799 ifuncmain1_DEPENDENCIES = gcctestdir/ld ifuncmod1.so
2800 ifuncmain1_LDFLAGS = -Wl,-R,.
2801 ifuncmain1_LDADD = ifuncmod1.so
2803 check_PROGRAMS += ifuncmain1pic
2804 ifuncmain1pic: ifuncmain1pic.o ifuncmod1.so gcctestdir/ld
2805         $(LINK) ifuncmain1pic.o ifuncmod1.so -Wl,-R,.
2807 check_PROGRAMS += ifuncmain1vis
2808 ifuncmain1vis_SOURCES = ifuncmain1vis.c
2809 ifuncmain1vis_DEPENDENCIES = gcctestdir/ld ifuncmod1.so
2810 ifuncmain1vis_LDFLAGS = -Wl,-R,.
2811 ifuncmain1vis_LDADD = ifuncmod1.so
2813 check_PROGRAMS += ifuncmain1vispic
2814 ifuncmain1vispic.o: ifuncmain1vis.c
2815         $(COMPILE) -c -fPIC -o $@ $<
2816 ifuncmain1vispic: ifuncmain1vispic.o ifuncmod1.so gcctestdir/ld
2817         $(LINK) ifuncmain1pic.o ifuncmod1.so -Wl,-R,.
2819 check_PROGRAMS += ifuncmain1staticpic
2820 ifuncmain1staticpic: ifuncmain1pic.o ifuncmod1.o gcctestdir/ld
2821         $(LINK) ifuncmain1pic.o ifuncmod1.o
2823 check_PROGRAMS += ifuncmain1pie
2824 ifuncmain1pie: ifuncmain1pie.o ifuncmod1.so gcctestdir/ld
2825         $(LINK) -pie ifuncmain1pie.o ifuncmod1.so -Wl,-R,.
2827 check_PROGRAMS += ifuncmain1vispie
2828 ifuncmain1vispie.o: ifuncmain1vis.c
2829         $(COMPILE) -c -fPIE -o $@ $<
2830 ifuncmain1vispie: ifuncmain1vispie.o ifuncmod1.so gcctestdir/ld
2831         $(LINK) -pie ifuncmain1vispie.o ifuncmod1.so -Wl,-R,.
2833 check_PROGRAMS += ifuncmain1staticpie
2834 ifuncmain1staticpie: ifuncmain1pie.o ifuncmod1.o gcctestdir/ld
2835         $(LINK) -pie ifuncmain1pie.o ifuncmod1.o
2837 ifuncmain2pic.o: ifuncmain2.c
2838         $(COMPILE) -c -fPIC -o $@ $<
2840 ifuncdep2pic.o: ifuncdep2.c
2841         $(COMPILE) -c -fPIC -o $@ $<
2843 if HAVE_STATIC
2844 if IFUNC_STATIC
2845 check_PROGRAMS += ifuncmain2static
2846 ifuncmain2static_SOURCES = ifuncmain2.c ifuncdep2.c
2847 ifuncmain2static_DEPENDENCIES = gcctestdir/ld
2848 ifuncmain2static_LDFLAGS = -static
2849 ifuncmain2static_LDADD =
2851 check_PROGRAMS += ifuncmain2picstatic
2852 ifuncmain2picstatic: ifuncmain2pic.o ifuncdep2pic.o gcctestdir/ld
2853         $(LINK) -static ifuncmain2pic.o ifuncdep2pic.o
2854 endif
2855 endif
2857 check_PROGRAMS += ifuncmain2
2858 ifuncmain2_SOURCES = ifuncmain2.c ifuncdep2.c
2859 ifuncmain2_DEPENDENCIES = gcctestdir/ld
2860 ifuncmain2_LDADD =
2862 check_PROGRAMS += ifuncmain2pic
2863 ifuncmain2pic: ifuncmain2pic.o ifuncdep2pic.o gcctestdir/ld
2864         $(LINK) ifuncmain2pic.o ifuncdep2pic.o
2866 ifuncmod3.o: ifuncmod3.c
2867         $(COMPILE) -c -fPIC -o $@ $<
2868 ifuncmod3.so: ifuncmod3.o gcctestdir/ld
2869         $(LINK) -shared ifuncmod3.o
2871 check_PROGRAMS += ifuncmain3
2872 ifuncmain3_SOURCES = ifuncmain3.c
2873 ifuncmain3_DEPENDENCIES = gcctestdir/ld ifuncmod3.so
2874 ifuncmain3_LDFLAGS = -Wl,--export-dynamic -Wl,-R,.
2875 ifuncmain3_LDADD = -ldl
2877 ifuncmain4pic.o: ifuncmain4.c
2878         $(COMPILE) -c -fPIC -o $@ $<
2880 if HAVE_STATIC
2881 if IFUNC_STATIC
2882 check_PROGRAMS += ifuncmain4static
2883 ifuncmain4static_SOURCES = ifuncmain4.c
2884 ifuncmain4static_DEPENDENCIES = gcctestdir/ld
2885 ifuncmain4static_LDFLAGS = -static
2886 ifuncmain4static_LDADD =
2888 check_PROGRAMS += ifuncmain4picstatic
2889 ifuncmain4picstatic: ifuncmain4pic.o gcctestdir/ld
2890         $(LINK) -static ifuncmain4pic.o
2891 endif
2892 endif
2894 check_PROGRAMS += ifuncmain4
2895 ifuncmain4_SOURCES = ifuncmain4.c
2896 ifuncmain4_DEPENDENCIES = gcctestdir/ld
2897 ifuncmain4_LDADD =
2899 ifuncmain5pic.o: ifuncmain5.c
2900         $(COMPILE) -c -fPIC -o $@ $<
2902 ifuncmain5pie.o: ifuncmain5.c
2903         $(COMPILE) -c -fPIE -o $@ $<
2905 ifuncmod5.o: ifuncmod5.c
2906         $(COMPILE) -c -fPIC -o $@ $<
2907 ifuncmod5.so: ifuncmod5.o gcctestdir/ld
2908         $(LINK) -shared ifuncmod5.o
2910 ifuncdep5.o: ifuncmod5.c
2911         $(COMPILE) -c -o $@ $<
2913 if HAVE_STATIC
2914 if IFUNC_STATIC
2915 check_PROGRAMS += ifuncmain5static
2916 ifuncmain5static_SOURCES = ifuncmain5.c
2917 ifuncmain5static_DEPENDENCIES = gcctestdir/ld ifuncdep5.o
2918 ifuncmain5static_LDFLAGS = -static
2919 ifuncmain5static_LDADD = ifuncdep5.o
2921 check_PROGRAMS += ifuncmain5picstatic
2922 ifuncmain5picstatic: ifuncmain5pic.o ifuncmod5.o gcctestdir/ld
2923         $(LINK) -static ifuncmain5pic.o ifuncmod5.o
2924 endif
2925 endif
2927 check_PROGRAMS += ifuncmain5
2928 ifuncmain5_SOURCES = ifuncmain5.c
2929 ifuncmain5_DEPENDENCIES = gcctestdir/ld ifuncmod5.so
2930 ifuncmain5_LDFLAGS = -Wl,-R,.
2931 ifuncmain5_LDADD = ifuncmod5.so
2933 check_PROGRAMS += ifuncmain5pic
2934 ifuncmain5pic: ifuncmain5pic.o ifuncmod5.so gcctestdir/ld
2935         $(LINK) ifuncmain5pic.o ifuncmod5.so -Wl,-R,.
2937 check_PROGRAMS += ifuncmain5staticpic
2938 ifuncmain5staticpic: ifuncmain5pic.o ifuncmod5.o gcctestdir/ld
2939         $(LINK) ifuncmain5pic.o ifuncmod5.o
2941 check_PROGRAMS += ifuncmain5pie
2942 ifuncmain5pie: ifuncmain5pie.o ifuncmod5.so gcctestdir/ld
2943         $(LINK) -pie ifuncmain5pie.o ifuncmod5.so -Wl,-R,.
2945 ifuncmain6pie.o: ifuncmain6pie.c
2946         $(COMPILE) -c -fPIE -o $@ $<
2948 ifuncmod6.o: ifuncmod6.c
2949         $(COMPILE) -c -fPIC -o $@ $<
2950 ifuncmod6.so: ifuncmod6.o gcctestdir/ld
2951         $(LINK) -shared ifuncmod6.o
2953 check_PROGRAMS += ifuncmain6pie
2954 ifuncmain6pie: ifuncmain6pie.o ifuncmod6.so gcctestdir/ld
2955         $(LINK) -pie ifuncmain6pie.o ifuncmod6.so -Wl,-R,.
2957 ifuncmain7pic.o: ifuncmain7.c
2958         $(COMPILE) -c -fPIC -o $@ $<
2960 ifuncmain7pie.o: ifuncmain7.c
2961         $(COMPILE) -c -fPIE -o $@ $<
2963 if HAVE_STATIC
2964 if IFUNC_STATIC
2965 check_PROGRAMS += ifuncmain7static
2966 ifuncmain7static_SOURCES = ifuncmain7.c
2967 ifuncmain7static_DEPENDENCIES = gcctestdir/ld
2968 ifuncmain7static_LDFLAGS = -static
2969 ifuncmain7static_LDADD =
2971 check_PROGRAMS += ifuncmain7picstatic
2972 ifuncmain7picstatic: ifuncmain7pic.o gcctestdir/ld
2973         $(LINK) -static ifuncmain7pic.o
2974 endif
2975 endif
2977 check_PROGRAMS += ifuncmain7
2978 ifuncmain7_SOURCES = ifuncmain7.c
2979 ifuncmain7_DEPENDENCIES = gcctestdir/ld
2980 ifuncmain7_LDADD =
2982 check_PROGRAMS += ifuncmain7pic
2983 ifuncmain7pic: ifuncmain7pic.o gcctestdir/ld
2984         $(LINK) ifuncmain7pic.o
2986 check_PROGRAMS += ifuncmain7pie
2987 ifuncmain7pie: ifuncmain7pie.o gcctestdir/ld
2988         $(LINK) -pie ifuncmain7pie.o
2990 check_PROGRAMS += ifuncvar
2991 ifuncvar1_pic.o: ifuncvar1.c
2992         $(COMPILE) -c -fPIC -o $@ $<
2993 ifuncvar2_pic.o: ifuncvar2.c
2994         $(COMPILE) -c -fPIC -o $@ $<
2995 ifuncvar.so: ifuncvar1_pic.o ifuncvar2_pic.o gcctestdir/ld
2996         $(LINK) -shared ifuncvar1_pic.o ifuncvar2_pic.o
2997 ifuncvar_SOURCES = ifuncvar3.c
2998 ifuncvar_DEPENDENCIES = gcctestdir/ld ifuncvar.so
2999 ifuncvar_LDFLAGS = -Wl,-R,.
3000 ifuncvar_LDADD = ifuncvar.so
3002 endif IFUNC
3004 # Test that strong reference to a weak symbol in a DSO remains strong.
3005 check_SCRIPTS += strong_ref_weak_def.sh
3006 check_DATA += strong_ref_weak_def.stdout
3007 MOSTLYCLEANFILES += strong_ref_weak_def_1.so strong_ref_weak_def_2.so \
3008         strong_ref_weak_def.stdout
3009 strong_ref_weak_def_2.o: strong_ref_weak_def_2.c
3010         $(COMPILE) -o $@ -c -fPIC $<
3011 strong_ref_weak_def_2.so: strong_ref_weak_def_2.o gcctestdir/ld
3012         gcctestdir/ld -shared -o $@ strong_ref_weak_def_2.o
3013 strong_ref_weak_def_1.o: strong_ref_weak_def_1.c
3014         $(COMPILE) -o $@ -c -fPIC $<
3015 strong_ref_weak_def_1.so: strong_ref_weak_def_1.o strong_ref_weak_def_2.so \
3016         gcctestdir/ld
3017         gcctestdir/ld -shared -o $@ strong_ref_weak_def_1.o \
3018                 strong_ref_weak_def_2.so
3019 strong_ref_weak_def.stdout: strong_ref_weak_def_1.so
3020         $(TEST_READELF) -sWD $< > $@
3022 # Test that a strong weak reference remains strong if there is another
3023 # weak reference in a DSO.
3024 check_SCRIPTS += dyn_weak_ref.sh
3025 check_DATA += dyn_weak_ref.stdout
3026 MOSTLYCLEANFILES += dyn_weak_ref_1.so dyn_weak_ref_2.so \
3027         dyn_weak_ref.stdout
3028 dyn_weak_ref_2.o: dyn_weak_ref_2.c
3029         $(COMPILE) -o $@ -c -fPIC $<
3030 dyn_weak_ref_2.so: dyn_weak_ref_2.o gcctestdir/ld
3031         gcctestdir/ld -shared -o $@ dyn_weak_ref_2.o
3032 dyn_weak_ref_1.o: dyn_weak_ref_1.c
3033         $(COMPILE) -o $@ -c -fPIC $<
3034 # We intentionally put dyn_weak_ref_2.so in front of dyn_weak_ref_1.o
3035 # so that the weak ref there goes to gold's symbol table first.
3036 dyn_weak_ref_1.so: dyn_weak_ref_1.o dyn_weak_ref_2.so gcctestdir/ld
3037         gcctestdir/ld -shared -o $@ dyn_weak_ref_2.so dyn_weak_ref_1.o
3038 dyn_weak_ref.stdout: dyn_weak_ref_1.so
3039         $(TEST_READELF) -sWD $< > $@
3042 # Test that --start-lib and --end-lib function correctly.
3043 check_PROGRAMS += start_lib_test
3044 MOSTLYCLEANFILES += libstart_lib_test.a
3045 start_lib_test: start_lib_test_main.o libstart_lib_test.a start_lib_test_2.o start_lib_test_3.o \
3046         gcctestdir/ld
3047         $(LINK) -o $@ start_lib_test_main.o -L. -lstart_lib_test \
3048                 -Wl,--start-lib start_lib_test_2.o start_lib_test_3.o -Wl,--end-lib
3049 libstart_lib_test.a: start_lib_test_1.o
3050         $(TEST_AR) rc $@ $^
3052 # Test that MEMORY region support works.
3053 check_SCRIPTS += memory_test.sh
3054 check_DATA += memory_test.stdout
3055 MOSTLYCLEANFILES += memory_test.stdout memory_test memory_test.o
3056 memory_test.o: memory_test.s
3057         $(COMPILE) -o $@ -c $<
3058 memory_test: memory_test.o gcctestdir/ld $(srcdir)/memory_test.t
3059         $(LINK) -nostartfiles -nostdlib -Wl,-z,max-page-size=0x1000 -Wl,-z,common-page-size=0x1000 -Wl,-T,$(srcdir)/memory_test.t -o $@ memory_test.o
3060 memory_test.stdout: memory_test
3061         $(TEST_READELF) -lWS $< > $@
3063 # Test INCLUDE directives in linker scripts.
3064 # The binary isn't runnable, so we just check that we can build it without errors.
3065 check_DATA += memory_test_2
3066 MOSTLYCLEANFILES += memory_test_inc_1.t memory_test_inc_2.t memory_test_inc_3.t memory_test_2
3067 memory_test_inc_1.t: $(srcdir)/memory_test_inc_1.t.src
3068         cp $< $@
3069 memory_test_inc_2.t: $(srcdir)/memory_test_inc_2.t.src
3070         cp $< $@
3071 memory_test_inc_3.t: $(srcdir)/memory_test_inc_3.t.src
3072         cp $< $@
3073 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
3074         $(LINK) -nostartfiles -nostdlib -Wl,-z,max-page-size=0x1000 -Wl,-z,common-page-size=0x1000 -Wl,-T,$(srcdir)/memory_test.t -o $@ memory_test.o
3076 if HAVE_PUBNAMES
3078 # Test that --gdb-index functions correctly without gcc-generated pubnames.
3079 check_SCRIPTS += gdb_index_test_1.sh
3080 check_DATA += gdb_index_test_1.stdout
3081 MOSTLYCLEANFILES += gdb_index_test_1.stdout gdb_index_test_1
3082 gdb_index_test.o: gdb_index_test.cc
3083         $(CXXCOMPILE) -O0 -g -gno-pubnames -c -o $@ $<
3084 gdb_index_test_1: gdb_index_test.o gcctestdir/ld
3085         $(CXXLINK) -Wl,--gdb-index $<
3086 gdb_index_test_1.stdout: gdb_index_test_1
3087         $(TEST_READELF) --debug-dump=gdb_index $< > $@
3089 # Test that --gdb-index functions correctly with compressed debug sections.
3090 check_SCRIPTS += gdb_index_test_2.sh
3091 check_DATA += gdb_index_test_2.stdout
3092 MOSTLYCLEANFILES += gdb_index_test_2.stdout gdb_index_test_2 gdb_index_test_2_gabi
3093 gdb_index_test_cdebug.o: gdb_index_test.cc
3094         $(CXXCOMPILE) -O0 -g -Wa,--compress-debug-sections -c -o $@ $<
3095 gdb_index_test_2: gdb_index_test_cdebug.o gcctestdir/ld
3096         $(CXXLINK) -Wl,--gdb-index $<
3097 gdb_index_test_2.stdout: gdb_index_test_2
3098         $(TEST_READELF) --debug-dump=gdb_index $< > $@
3099 check_SCRIPTS += gdb_index_test_2_gabi.sh
3100 check_DATA += gdb_index_test_2_gabi.stdout
3101 MOSTLYCLEANFILES += gdb_index_test_2.stdout gdb_index_test_2
3102 gdb_index_test_cdebug_gabi.o: gdb_index_test.cc
3103         $(CXXCOMPILE) -O0 -g -Wa,--compress-debug-sections=zlib-gabi -c -o $@ $<
3104 gdb_index_test_2_gabi: gdb_index_test_cdebug_gabi.o gcctestdir/ld
3105         $(CXXLINK) -Wl,--gdb-index $<
3106 gdb_index_test_2_gabi.stdout: gdb_index_test_2_gabi
3107         $(TEST_READELF) --debug-dump=gdb_index $< > $@
3109 # Another simple C test (DW_AT_high_pc encoding) for --gdb-index.
3110 check_SCRIPTS += gdb_index_test_3.sh
3111 check_DATA += gdb_index_test_3.stdout
3112 MOSTLYCLEANFILES += gdb_index_test_3.stdout gdb_index_test_3
3113 gdb_index_test_3.o: gdb_index_test_3.c
3114         $(COMPILE) -O0 -g -c -o $@ $<
3115 gdb_index_test_3: gdb_index_test_3.o gcctestdir/ld
3116         $(LINK) -Wl,--gdb-index,--fatal-warnings $<
3117 gdb_index_test_3.stdout: gdb_index_test_3
3118         $(TEST_READELF) --debug-dump=gdb_index $< > $@
3120 # Test that --gdb-index functions correctly with gcc-generated pubnames.
3121 check_SCRIPTS += gdb_index_test_4.sh
3122 check_DATA += gdb_index_test_4.stdout
3123 MOSTLYCLEANFILES += gdb_index_test_4.stdout gdb_index_test_4
3124 gdb_index_test_pub.o: gdb_index_test.cc
3125         $(CXXCOMPILE) -O0 -g -gpubnames -c -o $@ $<
3126 gdb_index_test_4: gdb_index_test_pub.o gcctestdir/ld
3127         $(CXXLINK) -Wl,--gdb-index $<
3128 gdb_index_test_4.stdout: gdb_index_test_4
3129         $(TEST_READELF) --debug-dump=gdb_index $< > $@
3131 endif HAVE_PUBNAMES
3133 # Test that __ehdr_start is defined correctly.
3134 check_PROGRAMS += ehdr_start_test_1
3135 ehdr_start_test_1_SOURCES = ehdr_start_test.cc
3136 ehdr_start_test_1_DEPENDENCIES = gcctestdir/ld
3137 ehdr_start_test_1_CXXFLAGS =
3138 ehdr_start_test_1_LDADD =
3140 # Test that __ehdr_start is defined correctly with a weak reference.
3141 check_PROGRAMS += ehdr_start_test_2
3142 ehdr_start_test_2_SOURCES = ehdr_start_test.cc
3143 ehdr_start_test_2_DEPENDENCIES = gcctestdir/ld
3144 ehdr_start_test_2_CXXFLAGS = -DEHDR_START_WEAK
3145 ehdr_start_test_2_LDADD =
3147 # Test that __ehdr_start is defined correctly when used with a linker script.
3148 check_PROGRAMS += ehdr_start_test_3
3149 ehdr_start_test_3_SOURCES = ehdr_start_test.cc
3150 ehdr_start_test_3_DEPENDENCIES = gcctestdir/ld $(srcdir)/ehdr_start_test.t
3151 ehdr_start_test_3_CXXFLAGS = -DEHDR_START_WEAK
3152 ehdr_start_test_3_LDFLAGS = -Wl,-T,$(srcdir)/ehdr_start_test.t
3153 ehdr_start_test_3_LDADD =
3155 # Test that __ehdr_start is left undefined when the text segment is not
3156 # appropriately aligned.
3157 check_SCRIPTS += ehdr_start_test_4.sh
3158 check_DATA += ehdr_start_test_4.syms
3159 MOSTLYCLEANFILES += ehdr_start_test_4
3160 ehdr_start_test_4.syms: ehdr_start_test_4
3161         $(TEST_NM) ehdr_start_test_4 > $@
3162 ehdr_start_test_4: ehdr_start_test_4.o gcctestdir/ld
3163         $(CXXLINK) -Wl,-Ttext=0x100100 $<
3164 ehdr_start_test_4.o: ehdr_start_test.cc
3165         $(CXXCOMPILE) -c -DEHDR_START_WEAK -o $@ $<
3167 # Test that __ehdr_start is not overridden when supplied by the user.
3168 check_PROGRAMS += ehdr_start_test_5
3169 ehdr_start_test_5_SOURCES = ehdr_start_test.cc ehdr_start_def.cc
3170 ehdr_start_test_5_DEPENDENCIES = gcctestdir/ld
3171 ehdr_start_test_5_CXXFLAGS = -DEHDR_START_USER_DEF
3172 ehdr_start_test_5_LDADD =
3174 # Test that the --defsym option copies the symbol type and visibility.
3175 check_SCRIPTS += defsym_test.sh
3176 check_DATA += defsym_test.syms
3177 MOSTLYCLEANFILES += defsym_test defsym_test.syms
3178 defsym_test.syms: defsym_test
3179         $(TEST_READELF) -sW $< > $@
3180 defsym_test: defsym_test.o gcctestdir/ld
3181         $(LINK) -Wl,--defsym=bar=foo defsym_test.o
3182 defsym_test.o: defsym_test.c
3183         $(COMPILE) -c -o $@ $<
3185 # Test that the -d option (force common allocation) works correctly.
3186 check_PROGRAMS += pr20976
3187 pr20976: pr20976-d.o gcctestdir/ld
3188         $(LINK) pr20976-d.o
3189 pr20976-d.o: pr20976.o gcctestdir/ld
3190         gcctestdir/ld -r -d -o $@ pr20976.o
3192 # End-to-end incremental linking tests.
3193 # Incremental linking is currently supported only on the x86_64 target.
3195 if DEFAULT_TARGET_X86_64
3197 two_file_test_1_v1_ndebug.o: two_file_test_1_v1.cc
3198         $(CXXCOMPILE) -O0 -g0 -fno-exceptions -fno-asynchronous-unwind-tables -c -o $@ $<
3199 two_file_test_1_ndebug.o: two_file_test_1.cc
3200         $(CXXCOMPILE) -O0 -g0 -fno-exceptions -fno-asynchronous-unwind-tables -c -o $@ $<
3201 two_file_test_1b_ndebug.o: two_file_test_1b.cc
3202         $(CXXCOMPILE) -O0 -g0 -c -o $@ $<
3203 two_file_test_2_ndebug.o: two_file_test_2.cc
3204         $(CXXCOMPILE) -O0 -g0 -c -o $@ $<
3205 two_file_test_main_ndebug.o: two_file_test_main.cc
3206         $(CXXCOMPILE) -O0 -g0 -c -o $@ $<
3208 if !CFLAGS_CF_PROTECTION
3209 check_PROGRAMS += incremental_test_2
3210 endif
3211 MOSTLYCLEANFILES += two_file_test_tmp_2.o
3212 incremental_test_2: two_file_test_1_v1_ndebug.o two_file_test_1_ndebug.o two_file_test_1b_ndebug.o \
3213                     two_file_test_2_ndebug.o two_file_test_main_ndebug.o gcctestdir/ld
3214         cp -f two_file_test_1_v1_ndebug.o two_file_test_tmp_2.o
3215         $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Wl,-z,norelro,-no-pie two_file_test_tmp_2.o two_file_test_1b_ndebug.o two_file_test_2_ndebug.o two_file_test_main_ndebug.o
3216         @sleep 1
3217         cp -f two_file_test_1_ndebug.o two_file_test_tmp_2.o
3218         $(CXXLINK) -Wl,--incremental-update -Wl,-z,norelro,-no-pie two_file_test_tmp_2.o two_file_test_1b_ndebug.o two_file_test_2_ndebug.o two_file_test_main_ndebug.o
3220 if !CFLAGS_CF_PROTECTION
3221 check_PROGRAMS += incremental_test_3
3222 endif
3223 MOSTLYCLEANFILES += two_file_test_tmp_3.o
3224 incremental_test_3: two_file_test_1.o two_file_test_1b_v1.o two_file_test_1b.o \
3225                     two_file_test_2.o two_file_test_main.o gcctestdir/ld
3226         cp -f two_file_test_1b_v1.o two_file_test_tmp_3.o
3227         $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Wl,-z,norelro,-no-pie two_file_test_1.o two_file_test_tmp_3.o two_file_test_2.o two_file_test_main.o
3228         @sleep 1
3229         cp -f two_file_test_1b.o two_file_test_tmp_3.o
3230         $(CXXLINK) -Wl,--incremental-update -Wl,-z,norelro,-no-pie two_file_test_1.o two_file_test_tmp_3.o two_file_test_2.o two_file_test_main.o
3232 if !CFLAGS_CF_PROTECTION
3233 check_PROGRAMS += incremental_test_4
3234 endif
3235 MOSTLYCLEANFILES += incremental_test_4.base two_file_test_tmp_4.o
3236 incremental_test_4: two_file_test_1.o two_file_test_1b.o two_file_test_2_v1.o \
3237                     two_file_test_2.o two_file_test_main.o gcctestdir/ld
3238         cp -f two_file_test_2_v1.o two_file_test_tmp_4.o
3239         $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Wl,-z,norelro,-no-pie two_file_test_1.o two_file_test_1b.o two_file_test_tmp_4.o two_file_test_main.o
3240         mv -f incremental_test_4 incremental_test_4.base
3241         @sleep 1
3242         cp -f two_file_test_2.o two_file_test_tmp_4.o
3243         $(CXXLINK) -Wl,--incremental-update,--incremental-base=incremental_test_4.base -Wl,-z,norelro,-no-pie two_file_test_1.o two_file_test_1b.o two_file_test_tmp_4.o two_file_test_main.o
3245 if !CFLAGS_CF_PROTECTION
3246 check_PROGRAMS += incremental_test_5
3247 endif
3248 MOSTLYCLEANFILES += two_file_test_5.a
3249 incremental_test_5: two_file_test_1.o two_file_test_1b_v1.o two_file_test_1b.o \
3250                     two_file_test_2.o two_file_test_main.o gcctestdir/ld
3251         cp -f two_file_test_1b_v1.o two_file_test_tmp_5.o
3252         $(TEST_AR) rc two_file_test_5.a two_file_test_1.o two_file_test_tmp_5.o two_file_test_2.o
3253         $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Wl,-z,norelro,-no-pie two_file_test_main.o two_file_test_5.a
3254         @sleep 1
3255         cp -f two_file_test_1b.o two_file_test_tmp_5.o
3256         $(TEST_AR) rc two_file_test_5.a two_file_test_1.o two_file_test_tmp_5.o two_file_test_2.o
3257         $(CXXLINK) -Wl,--incremental-update -Wl,-z,norelro,-no-pie two_file_test_main.o two_file_test_5.a
3259 # Test the --incremental-unchanged flag with an archive library.
3260 # The second link should not update the library.
3261 check_PROGRAMS += incremental_test_6
3262 MOSTLYCLEANFILES += two_file_test_6.a
3263 incremental_test_6: two_file_test_1.o two_file_test_1b_v1.o two_file_test_1b.o \
3264                     two_file_test_2.o two_file_test_main.o gcctestdir/ld
3265         cp -f two_file_test_1b.o two_file_test_tmp_6.o
3266         $(TEST_AR) rc two_file_test_6.a two_file_test_1.o two_file_test_tmp_6.o two_file_test_2.o
3267         $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Wl,-z,norelro,-no-pie two_file_test_main.o two_file_test_6.a
3268         @sleep 1
3269         cp -f two_file_test_1b_v1.o two_file_test_tmp_6.o
3270         $(TEST_AR) rc two_file_test_6.a two_file_test_1.o two_file_test_tmp_6.o two_file_test_2.o
3271         $(CXXLINK) -Wl,--incremental-update -Wl,-z,norelro,-no-pie two_file_test_main.o -Wl,--incremental-unchanged two_file_test_6.a -Wl,--incremental-unknown
3273 if !CFLAGS_CF_PROTECTION
3274 if !GCC9
3275 check_PROGRAMS += incremental_copy_test
3276 endif
3277 endif
3278 incremental_copy_test: copy_test_v1.o copy_test.o copy_test_1.so copy_test_2.so
3279         cp -f copy_test_v1.o copy_test_tmp.o
3280         $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Wl,-z,norelro,-no-pie -Wl,-R,. -Wl,--no-as-needed copy_test_tmp.o copy_test_1.so copy_test_2.so
3281         @sleep 1
3282         cp -f copy_test.o copy_test_tmp.o
3283         $(CXXLINK) -Wl,--incremental-update -Wl,-z,norelro,-no-pie -Wl,-R,. -Wl,--no-as-needed copy_test_tmp.o copy_test_1.so copy_test_2.so
3285 if !CFLAGS_CF_PROTECTION
3286 check_PROGRAMS += incremental_common_test_1
3287 endif
3288 incremental_common_test_1: common_test_1_v1.o common_test_1_v2.o gcctestdir/ld
3289         cp -f common_test_1_v1.o common_test_1_tmp.o
3290         $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Wl,-z,norelro,-no-pie common_test_1_tmp.o
3291         @sleep 1
3292         cp -f common_test_1_v2.o common_test_1_tmp.o
3293         $(CXXLINK) -Wl,--incremental-update -Wl,-z,norelro,-no-pie common_test_1_tmp.o
3294 common_test_1_v1.o: common_test_1_v1.c
3295         $(COMPILE) -c $(COMMON_TEST_C_CFLAGS) -o $@ $<
3296 common_test_1_v2.o: common_test_1_v2.c
3297         $(COMPILE) -c $(COMMON_TEST_C_CFLAGS) -o $@ $<
3299 if !CFLAGS_CF_PROTECTION
3300 if !GCC9
3301 check_PROGRAMS += incremental_comdat_test_1
3302 endif
3303 endif
3304 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
3305         cp -f incr_comdat_test_2_v1.o incr_comdat_test_1_tmp.o
3306         $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Wl,-z,norelro,-no-pie incr_comdat_test_1.o incr_comdat_test_1_tmp.o
3307         @sleep 1
3308         cp -f incr_comdat_test_2_v2.o incr_comdat_test_1_tmp.o
3309         $(CXXLINK) -Wl,--incremental-update -Wl,-z,norelro,-no-pie incr_comdat_test_1.o incr_comdat_test_1_tmp.o
3310         @sleep 1
3311         cp -f incr_comdat_test_2_v3.o incr_comdat_test_1_tmp.o
3312         $(CXXLINK) -Wl,--incremental-update -Wl,-z,norelro,-no-pie incr_comdat_test_1.o incr_comdat_test_1_tmp.o
3314 endif DEFAULT_TARGET_X86_64
3316 if DEFAULT_TARGET_X86_64
3317 check_PROGRAMS += exception_x86_64_bnd_test
3318 exception_x86_64_bnd_test_SOURCES = exception_test_main.cc
3319 exception_x86_64_bnd_test_DEPENDENCIES = gcctestdir/ld exception_x86_64_bnd_1.o exception_x86_64_bnd_2.o
3320 exception_x86_64_bnd_test_LDFLAGS = $(exception_test_LDFLAGS) -Wl,-z,bndplt
3321 exception_x86_64_bnd_test_LDADD = exception_x86_64_bnd_1.o exception_x86_64_bnd_2.o
3322 exception_x86_64_bnd_1.o: exception_test_1.cc gcctestdir/as
3323         $(CXXCOMPILE) -c -fpic -Wa,-madd-bnd-prefix -o $@ $<
3324 exception_x86_64_bnd_2.o: exception_test_2.cc gcctestdir/as
3325         $(CXXCOMPILE) -c -Wa,-madd-bnd-prefix -o $@ $<
3326 endif DEFAULT_TARGET_X86_64
3328 if DEFAULT_TARGET_X86_64
3329 check_SCRIPTS += gnu_property_test.sh
3330 check_DATA += gnu_property_test.stdout
3331 MOSTLYCLEANFILES += gnu_property_test
3332 gnu_property_test.stdout: gnu_property_test
3333         $(TEST_READELF) -lhSWn $< >$@
3334 gnu_property_test: gcctestdir/ld gnu_property_a.o gnu_property_b.o gnu_property_c.o
3335         gcctestdir/ld --build-id -o $@ gnu_property_a.o gnu_property_b.o gnu_property_c.o
3336 gnu_property_main.o: gnu_property_main.c
3337         $(COMPILE) -c -o $@ $<
3338 gnu_property_a.o: gnu_property_a.S
3339         $(COMPILE) -c -o $@ $<
3340 gnu_property_b.o: gnu_property_b.S
3341         $(COMPILE) -c -o $@ $<
3342 gnu_property_c.o: gnu_property_c.S
3343         $(COMPILE) -c -o $@ $<
3344 endif DEFAULT_TARGET_X86_64
3346 check_PROGRAMS += pr22266
3347 pr22266: pr22266_main.o pr22266_ar.o gcctestdir/ld
3348         $(LINK) pr22266_main.o pr22266_ar.o
3349 pr22266_ar.o: pr22266_a.o gcctestdir/ld
3350         gcctestdir/ld -r -T $(srcdir)/pr22266_script.t -o $@ pr22266_a.o
3352 if DEFAULT_TARGET_AARCH64
3354 check_PROGRAMS += aarch64_pr23870
3355 aarch64_pr23870_SOURCES = aarch64_pr23870_foo.c
3356 aarch64_pr23870_DEPENDENCIES = \
3357         gcctestdir/ld gcctestdir/as aarch64_pr23870_main.o \
3358         aarch64_pr23870_foo.o aarch64_pr23870_bar.so
3359 aarch64_pr23870_LDFLAGS = -Wl,-R,. -L. -Wl,-l:aarch64_pr23870_bar.so
3360 aarch64_pr23870_LDADD = aarch64_pr23870_main.o
3361 aarch64_pr23870_main.o: aarch64_pr23870_main.S
3362         $(COMPILE) -c -o $@ $<
3363 aarch64_pr23870_foo.o: aarch64_pr23870_foo.c
3364         $(COMPILE) -c -o $@ $<
3365 aarch64_pr23870_bar.o: aarch64_pr23870_bar.c
3366         $(COMPILE) -c -fPIC -o $@ $<
3367 aarch64_pr23870_bar.so: aarch64_pr23870_bar.o
3368         $(COMPILE) -shared -o $@ $<
3370 endif DEFAULT_TARGET_AARCH64
3372 endif GCC
3373 endif NATIVE_LINKER
3375 # These tests work with native and cross linkers.
3377 if NATIVE_OR_CROSS_LINKER
3379 # Test script section order.
3380 check_SCRIPTS += script_test_10.sh
3381 check_DATA += script_test_10.stdout
3382 MOSTLYCLEANFILES += script_test_10
3383 script_test_10.o: script_test_10.s
3384         $(TEST_AS) -o $@ $<
3385 script_test_10: $(srcdir)/script_test_10.t script_test_10.o gcctestdir/ld
3386         gcctestdir/ld -o $@ script_test_10.o -T $(srcdir)/script_test_10.t
3387 script_test_10.stdout: script_test_10
3388         $(TEST_READELF) -SW script_test_10 > $@
3390 # These tests work with cross linkers only.
3392 if DEFAULT_TARGET_I386
3394 check_SCRIPTS += split_i386.sh
3395 check_DATA += split_i386_1.stdout split_i386_2.stdout \
3396         split_i386_3.stdout split_i386_4.stdout split_i386_r.stdout
3397 SPLIT_DEFSYMS = --defsym __morestack=0x100 --defsym __morestack_non_split=0x200
3398 split_i386_1.o: split_i386_1.s
3399         $(TEST_AS) -o $@ $<
3400 split_i386_2.o: split_i386_2.s
3401         $(TEST_AS) -o $@ $<
3402 split_i386_3.o: split_i386_3.s
3403         $(TEST_AS) -o $@ $<
3404 split_i386_4.o: split_i386_4.s
3405         $(TEST_AS) -o $@ $<
3406 split_i386_n.o: split_i386_n.s
3407         $(TEST_AS) -o $@ $<
3408 split_i386_1: split_i386_1.o split_i386_n.o ../ld-new
3409         ../ld-new $(SPLIT_DEFSYMS) -o $@ split_i386_1.o split_i386_n.o
3410 split_i386_1.stdout: split_i386_1
3411         $(TEST_OBJDUMP) -d $< > $@
3412 split_i386_2: split_i386_2.o split_i386_n.o ../ld-new
3413         ../ld-new $(SPLIT_DEFSYMS) -o $@ split_i386_2.o split_i386_n.o
3414 split_i386_2.stdout: split_i386_2
3415         $(TEST_OBJDUMP) -d $< > $@
3416 split_i386_3.stdout: split_i386_3.o split_i386_n.o ../ld-new
3417         ../ld-new $(SPLIT_DEFSYMS) -o split_i386_3 split_i386_3.o split_i386_n.o > $@ 2>&1 || exit 0
3418 split_i386_4: split_i386_4.o split_i386_n.o ../ld-new
3419         ../ld-new $(SPLIT_DEFSYMS) -o $@ split_i386_4.o split_i386_n.o
3420 split_i386_4.stdout: split_i386_4
3421         $(TEST_OBJDUMP) -d $< > $@
3422 split_i386_r.stdout: split_i386_1.o split_i386_n.o ../ld-new
3423         ../ld-new -r split_i386_1.o split_i386_n.o -o split_i386_r > $@ 2>&1 || exit 0
3424 MOSTLYCLEANFILES += split_i386_1 split_i386_2 split_i386_3 \
3425         split_i386_4 split_i386_r
3427 endif DEFAULT_TARGET_I386
3429 if DEFAULT_TARGET_X86_64
3431 check_SCRIPTS += split_x86_64.sh
3432 check_DATA += split_x86_64_1.stdout split_x86_64_2.stdout \
3433         split_x86_64_3.stdout split_x86_64_4.stdout split_x86_64_r.stdout
3434 SPLIT_DEFSYMS = --defsym __morestack=0x100 --defsym __morestack_non_split=0x200
3435 split_x86_64_1.o: split_x86_64_1.s
3436         $(TEST_AS) -o $@ $<
3437 split_x86_64_2.o: split_x86_64_2.s
3438         $(TEST_AS) -o $@ $<
3439 split_x86_64_3.o: split_x86_64_3.s
3440         $(TEST_AS) -o $@ $<
3441 split_x86_64_4.o: split_x86_64_4.s
3442         $(TEST_AS) -o $@ $<
3443 split_x86_64_n.o: split_x86_64_n.s
3444         $(TEST_AS) -o $@ $<
3445 split_x86_64_1: split_x86_64_1.o split_x86_64_n.o ../ld-new
3446         ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x86_64_1.o split_x86_64_n.o
3447 split_x86_64_1.stdout: split_x86_64_1
3448         $(TEST_OBJDUMP) -d $< > $@
3449 split_x86_64_2: split_x86_64_2.o split_x86_64_n.o ../ld-new
3450         ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x86_64_2.o split_x86_64_n.o
3451 split_x86_64_2.stdout: split_x86_64_2
3452         $(TEST_OBJDUMP) -d $< > $@
3453 split_x86_64_3.stdout: split_x86_64_3.o split_x86_64_n.o ../ld-new
3454         ../ld-new $(SPLIT_DEFSYMS) -o split_x86_64_3 split_x86_64_3.o split_x86_64_n.o > $@ 2>&1 || exit 0
3455 split_x86_64_4: split_x86_64_4.o split_x86_64_n.o ../ld-new
3456         ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x86_64_4.o split_x86_64_n.o
3457 split_x86_64_4.stdout: split_x86_64_4
3458         $(TEST_OBJDUMP) -d $< > $@
3459 split_x86_64_r.stdout: split_x86_64_1.o split_x86_64_n.o ../ld-new
3460         ../ld-new -r split_x86_64_1.o split_x86_64_n.o -o split_x86_64_r > $@ 2>&1 || exit 0
3461 MOSTLYCLEANFILES += split_x86_64_1 split_x86_64_2 split_x86_64_3 \
3462         split_x86_64_4 split_x86_64_r
3464 check_SCRIPTS += bnd_plt_1.sh
3465 check_DATA += bnd_plt_1.stdout
3466 bnd_plt_1.o: bnd_plt_1.s
3467         $(TEST_AS) --64 -o $@ $<
3468 bnd_plt_1.so: bnd_plt_1.o ../ld-new
3469         ../ld-new -shared -z bndplt bnd_plt_1.o -o $@
3470 bnd_plt_1.stdout: bnd_plt_1.so
3471         $(TEST_OBJDUMP) -dw $< > $@
3473 check_SCRIPTS += bnd_ifunc_1.sh
3474 check_DATA += bnd_ifunc_1.stdout
3475 bnd_ifunc_1.o: bnd_ifunc_1.s
3476         $(TEST_AS) --64 -madd-bnd-prefix -o $@ $<
3477 bnd_ifunc_1.so: bnd_ifunc_1.o ../ld-new
3478         ../ld-new -shared -z bndplt bnd_ifunc_1.o -o $@
3479 bnd_ifunc_1.stdout: bnd_ifunc_1.so
3480         $(TEST_OBJDUMP) -dw $< > $@
3482 check_SCRIPTS += bnd_ifunc_2.sh
3483 check_DATA += bnd_ifunc_2.stdout
3484 bnd_ifunc_2.o: bnd_ifunc_2.s
3485         $(TEST_AS) --64 -madd-bnd-prefix -o $@ $<
3486 bnd_ifunc_2.so: bnd_ifunc_2.o ../ld-new
3487         ../ld-new -shared -z bndplt bnd_ifunc_2.o -o $@
3488 bnd_ifunc_2.stdout: bnd_ifunc_2.so
3489         $(TEST_OBJDUMP) -dw $< > $@
3491 endif DEFAULT_TARGET_X86_64
3493 if DEFAULT_TARGET_X32
3495 check_SCRIPTS += split_x32.sh
3496 check_DATA += split_x32_1.stdout split_x32_2.stdout \
3497         split_x32_3.stdout split_x32_4.stdout split_x32_r.stdout
3498 SPLIT_DEFSYMS = --defsym __morestack=0x100 --defsym __morestack_non_split=0x200
3499 split_x32_1.o: split_x32_1.s
3500         $(TEST_AS) -o $@ $<
3501 split_x32_2.o: split_x32_2.s
3502         $(TEST_AS) -o $@ $<
3503 split_x32_3.o: split_x32_3.s
3504         $(TEST_AS) -o $@ $<
3505 split_x32_4.o: split_x32_4.s
3506         $(TEST_AS) -o $@ $<
3507 split_x32_n.o: split_x32_n.s
3508         $(TEST_AS) -o $@ $<
3509 split_x32_1: split_x32_1.o split_x32_n.o ../ld-new
3510         ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x32_1.o split_x32_n.o
3511 split_x32_1.stdout: split_x32_1
3512         $(TEST_OBJDUMP) -d $< > $@
3513 split_x32_2: split_x32_2.o split_x32_n.o ../ld-new
3514         ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x32_2.o split_x32_n.o
3515 split_x32_2.stdout: split_x32_2
3516         $(TEST_OBJDUMP) -d $< > $@
3517 split_x32_3.stdout: split_x32_3.o split_x32_n.o ../ld-new
3518         ../ld-new $(SPLIT_DEFSYMS) -o split_x32_3 split_x32_3.o split_x32_n.o > $@ 2>&1 || exit 0
3519 split_x32_4: split_x32_4.o split_x32_n.o ../ld-new
3520         ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x32_4.o split_x32_n.o
3521 split_x32_4.stdout: split_x32_4
3522         $(TEST_OBJDUMP) -d $< > $@
3523 split_x32_r.stdout: split_x32_1.o split_x32_n.o ../ld-new
3524         ../ld-new -r split_x32_1.o split_x32_n.o -o split_x32_r > $@ 2>&1 || exit 0
3525 MOSTLYCLEANFILES += split_x32_1 split_x32_2 split_x32_3 \
3526         split_x32_4 split_x32_r
3528 endif DEFAULT_TARGET_X32
3530 if DEFAULT_TARGET_ARM
3532 check_SCRIPTS += arm_abs_global.sh
3533 check_DATA += arm_abs_global.stdout
3534 arm_abs_lib.o: arm_abs_lib.s
3535         $(TEST_AS) -march=armv7-a -o $@ $<
3536 libarm_abs.so: arm_abs_lib.o ../ld-new
3537         ../ld-new -shared -o $@ arm_abs_lib.o
3538 arm_abs_global.o: arm_abs_global.s
3539         $(TEST_AS) -march=armv7-a -o $@ $<
3540 arm_abs_global: arm_abs_global.o libarm_abs.so ../ld-new
3541         ../ld-new -o $@ arm_abs_global.o -L. -larm_abs
3542 arm_abs_global.stdout: arm_abs_global
3543         $(TEST_READELF) -r $< > $@
3545 MOSTLYCLEANFILES += arm_abs_global
3547 check_SCRIPTS += arm_branch_in_range.sh arm_branch_out_of_range.sh
3548 check_DATA += arm_bl_in_range.stdout arm_bl_out_of_range.stdout \
3549         thumb_bl_in_range.stdout thumb_bl_out_of_range.stdout \
3550         thumb2_bl_in_range.stdout thumb2_bl_out_of_range.stdout \
3551         thumb_blx_in_range.stdout thumb_blx_out_of_range.stdout \
3552         thumb2_blx_in_range.stdout thumb2_blx_out_of_range.stdout \
3553         thumb_bl_out_of_range_local.stdout arm_thm_jump11.stdout \
3554         arm_thm_jump8.stdout
3556 arm_bl_in_range.stdout: arm_bl_in_range
3557         $(TEST_OBJDUMP) -D $< > $@
3559 arm_bl_in_range: arm_bl_in_range.o ../ld-new
3560         ../ld-new -T $(srcdir)/arm_branch_range.t -o $@ $<
3562 arm_bl_in_range.o: arm_bl_in_range.s
3563         $(TEST_AS) -o $@ $<
3565 arm_bl_out_of_range.stdout: arm_bl_out_of_range
3566         $(TEST_OBJDUMP) -S $< > $@
3568 arm_bl_out_of_range: arm_bl_out_of_range.o ../ld-new
3569         ../ld-new -T $(srcdir)/arm_branch_range.t -o $@ $<
3571 arm_bl_out_of_range.o: arm_bl_out_of_range.s
3572         $(TEST_AS) -o $@ $<
3574 thumb_bl_in_range.stdout: thumb_bl_in_range
3575         $(TEST_OBJDUMP) -D $< > $@
3577 thumb_bl_in_range: thumb_bl_in_range.o ../ld-new
3578         ../ld-new --no-fix-arm1176 -T $(srcdir)/thumb_branch_range.t -o $@ $<
3580 thumb_bl_in_range.o: thumb_bl_in_range.s
3581         $(TEST_AS) -o $@ -march=armv5te $<
3583 thumb_bl_out_of_range.stdout: thumb_bl_out_of_range
3584         $(TEST_OBJDUMP) -D $< > $@
3586 thumb_bl_out_of_range: thumb_bl_out_of_range.o ../ld-new
3587         ../ld-new --no-fix-arm1176 -T $(srcdir)/thumb_branch_range.t -o $@ $<
3589 thumb_bl_out_of_range.o: thumb_bl_out_of_range.s
3590         $(TEST_AS) -o $@ -march=armv5te $<
3592 thumb2_bl_in_range.stdout: thumb2_bl_in_range
3593         $(TEST_OBJDUMP) -D $< > $@
3595 thumb2_bl_in_range: thumb2_bl_in_range.o ../ld-new
3596         ../ld-new -T $(srcdir)/thumb2_branch_range.t -o $@ $<
3598 thumb2_bl_in_range.o: thumb_bl_in_range.s
3599         $(TEST_AS) -o $@ -march=armv7-a $<
3601 thumb2_bl_out_of_range.stdout: thumb2_bl_out_of_range
3602         $(TEST_OBJDUMP) -D $< > $@
3604 thumb2_bl_out_of_range: thumb2_bl_out_of_range.o ../ld-new
3605         ../ld-new -T $(srcdir)/thumb2_branch_range.t -o $@ $<
3607 thumb2_bl_out_of_range.o: thumb_bl_out_of_range.s
3608         $(TEST_AS) -o $@ -march=armv7-a $<
3610 thumb_blx_in_range.stdout: thumb_blx_in_range
3611         $(TEST_OBJDUMP) -D $< > $@
3613 thumb_blx_in_range: thumb_blx_in_range.o ../ld-new
3614         ../ld-new --no-fix-arm1176 -T $(srcdir)/thumb_branch_range.t -o $@ $<
3616 thumb_blx_in_range.o: thumb_blx_in_range.s
3617         $(TEST_AS) -o $@ -march=armv5te $<
3619 thumb_blx_out_of_range.stdout: thumb_blx_out_of_range
3620         $(TEST_OBJDUMP) -D $< > $@
3622 thumb_blx_out_of_range: thumb_blx_out_of_range.o ../ld-new
3623         ../ld-new --no-fix-arm1176 -T $(srcdir)/thumb_branch_range.t -o $@ $<
3625 thumb_blx_out_of_range.o: thumb_blx_out_of_range.s
3626         $(TEST_AS) -o $@ -march=armv5te $<
3628 thumb2_blx_in_range.stdout: thumb2_blx_in_range
3629         $(TEST_OBJDUMP) -D $< > $@
3631 thumb2_blx_in_range: thumb2_blx_in_range.o ../ld-new
3632         ../ld-new -T $(srcdir)/thumb2_branch_range.t -o $@ $<
3634 thumb2_blx_in_range.o: thumb_blx_in_range.s
3635         $(TEST_AS) -o $@ -march=armv7-a $<
3637 thumb2_blx_out_of_range.stdout: thumb2_blx_out_of_range
3638         $(TEST_OBJDUMP) -D $< > $@
3640 thumb2_blx_out_of_range: thumb2_blx_out_of_range.o ../ld-new
3641         ../ld-new -T $(srcdir)/thumb2_branch_range.t -o $@ $<
3643 thumb2_blx_out_of_range.o: thumb_blx_out_of_range.s
3644         $(TEST_AS) -o $@ -march=armv7-a $<
3646 thumb_bl_out_of_range_local.stdout: thumb_bl_out_of_range_local
3647         $(TEST_OBJDUMP) -D $< > $@
3649 thumb_bl_out_of_range_local: thumb_bl_out_of_range_local.o ../ld-new
3650         ../ld-new --no-fix-arm1176 -T $(srcdir)/thumb_branch_range.t -o $@ $<
3652 thumb_bl_out_of_range_local.o: thumb_bl_out_of_range_local.s
3653         $(TEST_AS) -o $@ -march=armv5te $<
3655 arm_thm_jump11.stdout: arm_thm_jump11
3656         $(TEST_OBJDUMP) -D $< > $@
3658 arm_thm_jump11: arm_thm_jump11.o ../ld-new
3659         ../ld-new -T $(srcdir)/arm_thm_jump11.t -o $@ $<
3661 arm_thm_jump11.o: arm_thm_jump11.s
3662         $(TEST_AS) -o $@ $<
3664 arm_thm_jump8.stdout: arm_thm_jump8
3665         $(TEST_OBJDUMP) -D $< > $@
3667 arm_thm_jump8: arm_thm_jump8.o ../ld-new
3668         ../ld-new -T $(srcdir)/arm_thm_jump8.t -o $@ $<
3670 arm_thm_jump8.o: arm_thm_jump8.s
3671         $(TEST_AS) -o $@ $<
3673 MOSTLYCLEANFILES += arm_bl_in_range arm_bl_out_of_range thumb_bl_in_range \
3674         thumb_bl_out_of_range thumb2_bl_in_range thumb2_bl_out_of_range \
3675         thumb_blx_in_range thumb_blx_out_of_range thumb2_blx_in_range \
3676         thumb2_blx_out_of_range thumb_bl_out_of_range_local arm_thm_jump11 \
3677         arm_thm_jump8
3679 check_SCRIPTS += arm_fix_v4bx.sh
3680 check_DATA += arm_fix_v4bx.stdout arm_fix_v4bx_interworking.stdout \
3681         arm_no_fix_v4bx.stdout
3683 arm_fix_v4bx.stdout: arm_fix_v4bx
3684         $(TEST_OBJDUMP) -D -j.text $< > $@
3686 arm_fix_v4bx: arm_fix_v4bx.o ../ld-new
3687         ../ld-new --no-fix-arm1176 --fix-v4bx -o $@ $<
3689 arm_fix_v4bx.o: arm_fix_v4bx.s
3690         $(TEST_AS) -o $@ $<
3692 arm_fix_v4bx_interworking.stdout: arm_fix_v4bx_interworking
3693         $(TEST_OBJDUMP) -D -j.text $< > $@
3695 arm_fix_v4bx_interworking: arm_fix_v4bx.o ../ld-new
3696         ../ld-new --no-fix-arm1176 --fix-v4bx-interworking -o $@ $<
3698 arm_no_fix_v4bx.stdout: arm_no_fix_v4bx
3699         $(TEST_OBJDUMP) -D -j.text $< > $@
3701 arm_no_fix_v4bx: arm_fix_v4bx.o ../ld-new
3702         ../ld-new --no-fix-arm1176 -o $@ $<
3704 MOSTLYCLEANFILES += arm_fix_v4bx arm_fix_v4bx_interworking arm_no_fix_v4bx
3706 check_SCRIPTS += arm_attr_merge.sh
3707 check_DATA += arm_attr_merge_6.stdout arm_attr_merge_6r.stdout \
3708         arm_attr_merge_7.stdout
3710 arm_attr_merge_6.stdout: arm_attr_merge_6
3711         $(TEST_READELF) -A $< > $@
3713 arm_attr_merge_6: arm_attr_merge_6a.o arm_attr_merge_6b.o ../ld-new
3714         ../ld-new -o $@ arm_attr_merge_6a.o arm_attr_merge_6b.o
3716 arm_attr_merge_6a.o: arm_attr_merge_6a.s
3717         $(TEST_AS) -o $@ $<
3719 arm_attr_merge_6b.o: arm_attr_merge_6b.s
3720         $(TEST_AS) -o $@ $<
3722 arm_attr_merge_6r.stdout: arm_attr_merge_6r
3723         $(TEST_READELF) -A $< > $@
3725 arm_attr_merge_6r: arm_attr_merge_6b.o arm_attr_merge_6a.o ../ld-new
3726         ../ld-new -o $@ arm_attr_merge_6b.o arm_attr_merge_6a.o
3728 arm_attr_merge_7.stdout: arm_attr_merge_7
3729         $(TEST_READELF) -A $< > $@
3731 arm_attr_merge_7: arm_attr_merge_7a.o arm_attr_merge_7b.o ../ld-new
3732         ../ld-new -o $@ arm_attr_merge_7a.o arm_attr_merge_7b.o
3734 arm_attr_merge_7a.o: arm_attr_merge_7a.s
3735         $(TEST_AS) -o $@ $<
3737 arm_attr_merge_7b.o: arm_attr_merge_7b.s
3738         $(TEST_AS) -o $@ $<
3740 MOSTLYCLEANFILES += arm_attr_merge_6 arm_attr_merge_6r arm_attr_merge_7
3742 # ARM1176 workaround test.
3743 check_SCRIPTS += arm_fix_1176.sh
3744 check_DATA += arm_fix_1176_default_v6z.stdout arm_fix_1176_on_v6z.stdout \
3745         arm_fix_1176_off_v6z.stdout arm_fix_1176_default_v5te.stdout \
3746         arm_fix_1176_default_v7a.stdout arm_fix_1176_default_1156t2f_s.stdout
3748 arm_fix_1176_default_v6z.stdout: arm_fix_1176_default_v6z
3749         $(TEST_OBJDUMP) -D -j.foo $< > $@
3751 arm_fix_1176_default_v6z: arm_fix_1176_default_v6z.o ../ld-new
3752         ../ld-new --section-start=.foo=0x2001014 -o $@ $<
3754 arm_fix_1176_default_v6z.o: arm_fix_1176.s
3755         $(TEST_AS) -march=armv6z -o $@ $<
3757 arm_fix_1176_on_v6z.stdout: arm_fix_1176_on_v6z
3758         $(TEST_OBJDUMP) -D -j.foo $< > $@
3760 arm_fix_1176_on_v6z: arm_fix_1176_on_v6z.o ../ld-new
3761         ../ld-new --section-start=.foo=0x2001014 --fix-arm1176 -o $@ $<
3763 arm_fix_1176_on_v6z.o: arm_fix_1176.s
3764         $(TEST_AS) -march=armv6z -o $@ $<
3766 arm_fix_1176_off_v6z.stdout: arm_fix_1176_off_v6z
3767         $(TEST_OBJDUMP) -D -j.foo $< > $@
3769 arm_fix_1176_off_v6z: arm_fix_1176_off_v6z.o ../ld-new
3770         ../ld-new --section-start=.foo=0x2001014 --no-fix-arm1176 -o $@ $<
3772 arm_fix_1176_off_v6z.o: arm_fix_1176.s
3773         $(TEST_AS) -march=armv6z -o $@ $<
3775 arm_fix_1176_default_v5te.stdout: arm_fix_1176_default_v5te
3776         $(TEST_OBJDUMP) -D -j.foo $< > $@
3778 arm_fix_1176_default_v5te: arm_fix_1176_default_v5te.o ../ld-new
3779         ../ld-new --section-start=.foo=0x2001014 -o $@ $<
3781 arm_fix_1176_default_v5te.o: arm_fix_1176.s
3782         $(TEST_AS) -march=armv5te -o $@ $<
3784 arm_fix_1176_default_v7a.stdout: arm_fix_1176_default_v7a
3785         $(TEST_OBJDUMP) -D -j.foo $< > $@
3787 arm_fix_1176_default_v7a: arm_fix_1176_default_v7a.o ../ld-new
3788         ../ld-new --section-start=.foo=0x2001014 -o $@ $<
3790 arm_fix_1176_default_v7a.o: arm_fix_1176.s
3791         $(TEST_AS) -march=armv7-a -o $@ $<
3793 arm_fix_1176_default_1156t2f_s.stdout: arm_fix_1176_default_1156t2f_s
3794         $(TEST_OBJDUMP) -D -j.foo $< > $@
3796 arm_fix_1176_default_1156t2f_s: arm_fix_1176_default_1156t2f_s.o ../ld-new
3797         ../ld-new --section-start=.foo=0x2001014 -o $@ $<
3799 arm_fix_1176_default_1156t2f_s.o: arm_fix_1176.s
3800         $(TEST_AS) -mcpu=arm1156t2f-s -o $@ $<
3802 MOSTLYCLEANFILES += arm_fix_1176_default_v6z arm_fix_1176_on_v6z arm_fix_1176_off_v6z \
3803         arm_fix_1176_default_v5te arm_fix_1176_default_v7a arm_fix_1176_default_1156t2f_s
3805 # Cortex-A8 workaround test.
3807 check_SCRIPTS += arm_cortex_a8.sh
3808 check_DATA += arm_cortex_a8_b_cond.stdout arm_cortex_a8_b.stdout \
3809         arm_cortex_a8_bl.stdout arm_cortex_a8_blx.stdout \
3810         arm_cortex_a8_local.stdout arm_cortex_a8_local_reloc.stdout
3812 arm_cortex_a8_b_cond.stdout: arm_cortex_a8_b_cond
3813         $(TEST_OBJDUMP) -D -j.text $< > $@
3815 arm_cortex_a8_b_cond: arm_cortex_a8_b_cond.o ../ld-new
3816         ../ld-new -o $@ $<
3818 arm_cortex_a8_b_cond.o: arm_cortex_a8_b_cond.s
3819         $(TEST_AS) -o $@ $<
3821 arm_cortex_a8_b.stdout: arm_cortex_a8_b
3822         $(TEST_OBJDUMP) -D -j.text $< > $@
3824 arm_cortex_a8_b: arm_cortex_a8_b.o ../ld-new
3825         ../ld-new --fix-cortex-a8 -o $@ $<
3827 arm_cortex_a8_b.o: arm_cortex_a8_b.s
3828         $(TEST_AS) -o $@ $<
3830 arm_cortex_a8_bl.stdout: arm_cortex_a8_bl
3831         $(TEST_OBJDUMP) -D -j.text $< > $@
3833 arm_cortex_a8_bl: arm_cortex_a8_bl.o ../ld-new
3834         ../ld-new -o $@ $<
3836 arm_cortex_a8_bl.o: arm_cortex_a8_bl.s
3837         $(TEST_AS) -o $@ $<
3839 arm_cortex_a8_blx.stdout: arm_cortex_a8_blx
3840         $(TEST_OBJDUMP) -D -j.text $< > $@
3842 arm_cortex_a8_blx: arm_cortex_a8_blx.o ../ld-new
3843         ../ld-new -o $@ $<
3845 arm_cortex_a8_blx.o: arm_cortex_a8_blx.s
3846         $(TEST_AS) -o $@ $<
3848 arm_cortex_a8_local.stdout: arm_cortex_a8_local
3849         $(TEST_OBJDUMP) -D -j.text $< > $@
3851 arm_cortex_a8_local: arm_cortex_a8_local.o ../ld-new
3852         ../ld-new -o $@ $<
3854 arm_cortex_a8_local.o: arm_cortex_a8_local.s
3855         $(TEST_AS) -o $@ $<
3857 arm_cortex_a8_local_reloc.stdout: arm_cortex_a8_local_reloc
3858         $(TEST_OBJDUMP) -D -j.text $< > $@
3860 arm_cortex_a8_local_reloc: arm_cortex_a8_local_reloc.o ../ld-new
3861         ../ld-new -o $@ $<
3863 arm_cortex_a8_local_reloc.o: arm_cortex_a8_local_reloc.s
3864         $(TEST_AS) -o $@ $<
3866 MOSTLYCLEANFILES += arm_cortex_a8_b_cond arm_cortex_a8_b arm_cortex_a8_bl \
3867         arm_cortex_a8_blx arm_cortex_a8_local arm_cortex_a8_local_reloc
3869 check_SCRIPTS += arm_exidx_test.sh
3870 check_DATA += arm_exidx_test.stdout
3872 arm_exidx_test.stdout: arm_exidx_test.so
3873         $(TEST_READELF) -Sr $< > $@
3875 arm_exidx_test.so: arm_exidx_test.o ../ld-new
3876         ../ld-new -shared -o $@ $<
3878 arm_exidx_test.o: arm_exidx_test.s
3879         $(TEST_AS) -o $@ $<
3881 check_SCRIPTS += pr12826.sh
3882 check_DATA += pr12826.stdout
3884 pr12826.stdout: pr12826.so
3885         $(TEST_READELF) -A $< > $@
3887 pr12826.so: pr12826_1.o pr12826_2.o ../ld-new
3888         ../ld-new -shared -o $@ $<
3890 pr12826_1.o: pr12826_1.s
3891         $(TEST_AS) -o $@ $<
3893 pr12826_2.o: pr12826_2.s
3894         $(TEST_AS) -o $@ $<
3896 check_SCRIPTS += arm_unaligned_reloc.sh
3897 check_DATA += arm_unaligned_reloc.stdout arm_unaligned_reloc_r.stdout
3899 arm_unaligned_reloc.stdout: arm_unaligned_reloc
3900         $(TEST_OBJDUMP) -D $< > $@
3902 arm_unaligned_reloc_r.stdout: arm_unaligned_reloc_r
3903         $(TEST_OBJDUMP) -Dr $< > $@
3905 arm_unaligned_reloc: arm_unaligned_reloc.o ../ld-new
3906         ../ld-new -o $@ $<
3908 arm_unaligned_reloc_r: arm_unaligned_reloc.o ../ld-new
3909         ../ld-new -r -o $@ $<
3911 arm_unaligned_reloc.o: arm_unaligned_reloc.s
3912         $(TEST_AS) -o $@ $<
3914 MOSTLYCLEANFILES += arm_unaligned_reloc arm_unaligned_reloc_r
3916 # Check ARM to ARM farcall veneers
3918 check_SCRIPTS += arm_farcall_arm_arm.sh
3919 check_DATA += arm_farcall_arm_arm.stdout
3921 arm_farcall_arm_arm.stdout: arm_farcall_arm_arm
3922         $(TEST_OBJDUMP) -d $< > $@
3924 arm_farcall_arm_arm: arm_farcall_arm_arm.o ../ld-new
3925         ../ld-new --no-fix-arm1176 --section-start .text=0x1000 --section-start .foo=0x2001020 -o $@ $<
3927 arm_farcall_arm_arm.o: arm_farcall_arm_arm.s
3928         $(TEST_AS) -o $@ $<
3930 MOSTLYCLEANFILES += arm_farcall_arm_arm
3932 # Check ARM to Thumb farcall veneers
3934 check_SCRIPTS += arm_farcall_arm_thumb.sh
3935 check_DATA += arm_farcall_arm_thumb.stdout arm_farcall_arm_thumb_5t.stdout
3937 arm_farcall_arm_thumb.stdout: arm_farcall_arm_thumb
3938         $(TEST_OBJDUMP) -D $< > $@
3940 arm_farcall_arm_thumb: arm_farcall_arm_thumb.o ../ld-new
3941         ../ld-new --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
3943 arm_farcall_arm_thumb.o: arm_farcall_arm_thumb.s
3944         $(TEST_AS) -o $@ $<
3946 arm_farcall_arm_thumb_5t.stdout: arm_farcall_arm_thumb_5t
3947         $(TEST_OBJDUMP) -D $< > $@
3949 arm_farcall_arm_thumb_5t: arm_farcall_arm_thumb_5t.o ../ld-new
3950         ../ld-new --no-fix-arm1176 --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
3952 arm_farcall_arm_thumb_5t.o: arm_farcall_arm_thumb.s
3953         $(TEST_AS) -march=armv5t -o $@ $<
3955 MOSTLYCLEANFILES += arm_farcall_arm_thumb arm_farcall_arm_thumb_5t
3957 # Check Thumb to Thumb farcall veneers
3959 check_SCRIPTS += arm_farcall_thumb_thumb.sh
3960 check_DATA += arm_farcall_thumb_thumb.stdout \
3961               arm_farcall_thumb_thumb_5t.stdout \
3962               arm_farcall_thumb_thumb_7m.stdout \
3963               arm_farcall_thumb_thumb_6m.stdout
3965 arm_farcall_thumb_thumb.stdout: arm_farcall_thumb_thumb
3966         $(TEST_OBJDUMP) -D $< > $@
3968 arm_farcall_thumb_thumb: arm_farcall_thumb_thumb.o ../ld-new
3969         ../ld-new --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
3971 arm_farcall_thumb_thumb.o: arm_farcall_thumb_thumb.s
3972         $(TEST_AS) -march=armv4t -o $@ $<
3974 arm_farcall_thumb_thumb_5t.stdout: arm_farcall_thumb_thumb_5t
3975         $(TEST_OBJDUMP) -D $< > $@
3977 arm_farcall_thumb_thumb_5t: arm_farcall_thumb_thumb_5t.o ../ld-new
3978         ../ld-new --no-fix-arm1176 --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
3980 arm_farcall_thumb_thumb_5t.o: arm_farcall_thumb_thumb.s
3981         $(TEST_AS) -march=armv5t -o $@ $<
3983 arm_farcall_thumb_thumb_7m.stdout: arm_farcall_thumb_thumb_7m
3984         $(TEST_OBJDUMP) -D $< > $@
3986 arm_farcall_thumb_thumb_7m: arm_farcall_thumb_thumb_7m.o ../ld-new
3987         ../ld-new --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
3989 arm_farcall_thumb_thumb_7m.o: arm_farcall_thumb_thumb.s
3990         $(TEST_AS) -march=armv7-m -o $@ $<
3992 arm_farcall_thumb_thumb_6m.stdout: arm_farcall_thumb_thumb_6m
3993         $(TEST_OBJDUMP) -D $< > $@
3995 arm_farcall_thumb_thumb_6m: arm_farcall_thumb_thumb_6m.o ../ld-new
3996         ../ld-new --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
3998 arm_farcall_thumb_thumb_6m.o: arm_farcall_thumb_thumb.s
3999         $(TEST_AS) -march=armv6-m -o $@ $<
4001 MOSTLYCLEANFILES += arm_farcall_thumb_thumb arm_farcall_thumb_thumb_5t \
4002                     arm_farcall_thumb_thumb_7m arm_farcall_thumb_thumb_6m
4004 #Check ARM to ARM farcall veneers in the be8 mode addressing
4006 check_SCRIPTS += arm_farcall_arm_arm_be8.sh
4007 check_DATA += arm_farcall_arm_arm_be8.stdout
4009 arm_farcall_arm_arm_be8.stdout: arm_farcall_arm_arm_be8
4010         $(TEST_OBJDUMP) -D $< > $@
4012 arm_farcall_arm_arm_be8: arm_farcall_arm_arm_be8.o ../ld-new
4013         ../ld-new --no-fix-arm1176 --section-start .text=0x1000 --section-start .foo=0x2001020 -EB --be8 -o $@ $<
4015 arm_farcall_arm_arm_be8.o: arm_farcall_arm_arm.s
4016         $(TEST_AS) -EB -o $@ $<
4018 MOSTLYCLEANFILES += arm_farcall_arm_arm_be8
4020 #Check THUMB  to  THUMB farcall veneers in the be8 mode addressing
4022 check_SCRIPTS += arm_farcall_thumb_thumb_be8.sh
4023 check_DATA += arm_farcall_thumb_thumb_be8.stdout
4025 arm_farcall_thumb_thumb_be8.stdout: arm_farcall_thumb_thumb_be8
4026         $(TEST_OBJDUMP) -D $< > $@
4028 arm_farcall_thumb_thumb_be8: arm_farcall_thumb_thumb_be8.o ../ld-new
4029         ../ld-new --section-start .text=0x1000 --section-start .foo=0x2001014 -EB --be8 -o $@ $<
4031 arm_farcall_thumb_thumb_be8.o: arm_farcall_thumb_thumb.s
4032         $(TEST_AS) -march=armv7-m -EB -o $@ $<
4034 MOSTLYCLEANFILES += arm_farcall_thumb_thumb_be8
4036 # Check Thumb to ARM farcall veneers
4038 check_SCRIPTS += arm_farcall_thumb_arm.sh
4039 check_DATA += arm_farcall_thumb_arm.stdout \
4040               arm_farcall_thumb_arm_5t.stdout
4042 arm_farcall_thumb_arm.stdout: arm_farcall_thumb_arm
4043         $(TEST_OBJDUMP) -D $< > $@
4045 arm_farcall_thumb_arm: arm_farcall_thumb_arm.o ../ld-new
4046         ../ld-new --section-start .text=0x1c01010 --section-start .foo=0x2001014 -o $@ $<
4048 arm_farcall_thumb_arm.o: arm_farcall_thumb_arm.s
4049         $(TEST_AS) -o $@ $<
4051 arm_farcall_thumb_arm_5t.stdout: arm_farcall_thumb_arm_5t
4052         $(TEST_OBJDUMP) -D $< > $@
4054 arm_farcall_thumb_arm_5t: arm_farcall_thumb_arm_5t.o ../ld-new
4055         ../ld-new --no-fix-arm1176 --section-start .text=0x1c01010 --section-start .foo=0x2001014 -o $@ $<
4057 arm_farcall_thumb_arm_5t.o: arm_farcall_thumb_arm.s
4058         $(TEST_AS) -march=armv5t -o $@ $<
4060 MOSTLYCLEANFILES += arm_farcall_thumb_arm arm_farcall_thumb_arm_5t
4062 # Check handling of --target1-abs, --target1-rel and --target2 options
4064 check_SCRIPTS += arm_target1_abs.sh arm_target1_rel.sh \
4065                  arm_target2_rel.sh arm_target2_abs.sh arm_target2_got_rel.sh
4066 check_DATA += arm_target1_abs.stdout arm_target1_rel.stdout \
4067               arm_target2_rel.stdout arm_target2_abs.stdout arm_target2_got_rel.stdout
4069 arm_target1_abs.stdout: arm_target1_abs
4070         $(TEST_OBJDUMP) -s $< > $@
4072 arm_target1_abs: arm_target1.o ../ld-new
4073         ../ld-new --target1-abs --section-start .text=0x8000 -o $@ $<
4075 arm_target1_rel.stdout: arm_target1_rel
4076         $(TEST_OBJDUMP) -s $< > $@
4078 arm_target1_rel: arm_target1.o ../ld-new
4079         ../ld-new --target1-rel --section-start .text=0x8000 -o $@ $<
4081 arm_target1.o: arm_target1.s
4082         $(TEST_AS) -o $@ $<
4084 arm_target2_rel.stdout: arm_target2_rel
4085         $(TEST_OBJDUMP) -s $< > $@
4087 arm_target2_rel: arm_target2.o ../ld-new
4088         ../ld-new --target2=rel --section-start .text=0x8000 -o $@ $<
4090 arm_target2_abs.stdout: arm_target2_abs
4091         $(TEST_OBJDUMP) -s $< > $@
4093 arm_target2_abs: arm_target2.o ../ld-new
4094         ../ld-new --target2=abs --section-start .text=0x8000 -o $@ $<
4096 arm_target2_got_rel.stdout: arm_target2_got_rel
4097         $(TEST_OBJDUMP) -s $< > $@
4099 arm_target2_got_rel: arm_target2.o ../ld-new
4100         ../ld-new --target2=got-rel --section-start .text=0x8000 --section-start .got=0x9000 -o $@ $<
4102 arm_target2.o: arm_target2.s
4103         $(TEST_AS) -o $@ $<
4105 MOSTLYCLEANFILES += arm_target1_abs arm_target1_rel \
4106                     arm_target2_rel arm_target2_abs arm_target2_got_rel
4108 # The test demonstrates why the constructor of a target object should not access options.
4109 check_DATA += arm_target_lazy_init
4110 MOSTLYCLEANFILES += arm_target_lazy_init
4111 arm_target_lazy_init: arm_target_lazy_init.o arm_target_lazy_init.t ../ld-new
4112         ../ld-new -T $(srcdir)/arm_target_lazy_init.t -o $@ $<
4113 arm_target_lazy_init.o: arm_target_lazy_init.s
4114         $(TEST_AS) -EL -o $@ $<
4116 endif DEFAULT_TARGET_ARM
4118 if DEFAULT_TARGET_AARCH64
4120 check_SCRIPTS += aarch64_reloc_none.sh
4121 check_DATA += aarch64_reloc_none.stdout
4122 aarch64_reloc_none.o: aarch64_reloc_none.s
4123         $(TEST_AS) -o $@ $<
4124 aarch64_reloc_none: aarch64_reloc_none.o ../ld-new
4125         ../ld-new -o $@ aarch64_reloc_none.o --gc-sections
4126 aarch64_reloc_none.stdout: aarch64_reloc_none
4127         $(TEST_NM) $< > $@
4129 MOSTLYCLEANFILES += aarch64_reloc_none
4131 check_SCRIPTS += aarch64_relocs.sh
4132 check_DATA += aarch64_relocs.stdout
4133 aarch64_globals.o: aarch64_globals.s
4134         $(TEST_AS) -o $@ $<
4135 aarch64_relocs.o: aarch64_relocs.s
4136         $(TEST_AS) -o $@ $<
4137 aarch64_relocs: aarch64_relocs.o aarch64_globals.o ../ld-new
4138         ../ld-new -o $@ aarch64_relocs.o aarch64_globals.o -e0 --emit-relocs
4139 aarch64_relocs.stdout: aarch64_relocs
4140         $(TEST_OBJDUMP) -dr $< > $@
4142 MOSTLYCLEANFILES += aarch64_relocs
4144 check_SCRIPTS += pr21430.sh
4145 check_DATA += pr21430.stdout
4146 pr21430.o: pr21430.s
4147         $(TEST_AS) -o $@ $<
4148 pr21430: pr21430.o ../ld-new
4149         ../ld-new -o $@ $<
4150 pr21430.stdout: pr21430
4151         $(TEST_NM) -S $< > $@
4153 MOSTLYCLEANFILES += pr21430
4155 check_SCRIPTS += aarch64_tlsdesc.sh
4156 check_DATA += aarch64_tlsdesc.stdout
4157 aarch64_tlsdesc.o: aarch64_tlsdesc.s
4158         $(TEST_AS) -o $@ $<
4159 aarch64_tlsdesc: aarch64_tlsdesc.o $(srcdir)/aarch64_tlsdesc.t ../ld-new
4160         ../ld-new $< -shared -T $(srcdir)/aarch64_tlsdesc.t -o $@
4161 aarch64_tlsdesc.stdout: aarch64_tlsdesc
4162         $(TEST_OBJDUMP) -dR -j.text -j.got.plt $< > $@
4164 MOSTLYCLEANFILES += aarch64_tlsdesc
4166 endif DEFAULT_TARGET_AARCH64
4168 if DEFAULT_TARGET_S390
4170 check_SCRIPTS += split_s390.sh
4171 check_DATA += split_s390_z1.stdout split_s390_z2.stdout split_s390_z3.stdout \
4172         split_s390_z4.stdout split_s390_n1.stdout split_s390_n2.stdout \
4173         split_s390_a1.stdout split_s390_a2.stdout split_s390_z1_ns.stdout \
4174         split_s390_z2_ns.stdout split_s390_z3_ns.stdout split_s390_z4_ns.stdout \
4175         split_s390_n1_ns.stdout split_s390_n2_ns.stdout split_s390_r.stdout \
4176         split_s390x_z1.stdout split_s390x_z2.stdout split_s390x_z3.stdout \
4177         split_s390x_z4.stdout split_s390x_n1.stdout split_s390x_n2.stdout \
4178         split_s390x_a1.stdout split_s390x_a2.stdout split_s390x_z1_ns.stdout \
4179         split_s390x_z2_ns.stdout split_s390x_z3_ns.stdout \
4180         split_s390x_z4_ns.stdout split_s390x_n1_ns.stdout \
4181         split_s390x_n2_ns.stdout split_s390x_r.stdout
4182 SPLIT_DEFSYMS = --defsym __morestack=0x100 --defsym __morestack_non_split=0x200
4183 split_s390_1_z1.o: split_s390_1_z1.s
4184         $(TEST_AS) -m31 -o $@ $<
4185 split_s390_1_z2.o: split_s390_1_z2.s
4186         $(TEST_AS) -m31 -o $@ $<
4187 split_s390_1_z3.o: split_s390_1_z3.s
4188         $(TEST_AS) -m31 -o $@ $<
4189 split_s390_1_z4.o: split_s390_1_z4.s
4190         $(TEST_AS) -m31 -o $@ $<
4191 split_s390_1_n1.o: split_s390_1_n1.s
4192         $(TEST_AS) -m31 -o $@ $<
4193 split_s390_1_n2.o: split_s390_1_n2.s
4194         $(TEST_AS) -m31 -o $@ $<
4195 split_s390_1_a1.o: split_s390_1_a1.s
4196         $(TEST_AS) -m31 -o $@ $<
4197 split_s390_1_a2.o: split_s390_1_a2.s
4198         $(TEST_AS) -m31 -o $@ $<
4199 split_s390_2_s.o: split_s390_2_s.s
4200         $(TEST_AS) -m31 -o $@ $<
4201 split_s390_2_ns.o: split_s390_2_ns.s
4202         $(TEST_AS) -m31 -o $@ $<
4203 split_s390_z1: split_s390_1_z1.o split_s390_2_s.o ../ld-new
4204         ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_z1.o split_s390_2_s.o
4205 split_s390_z1.stdout: split_s390_z1
4206         $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
4207 split_s390_z2: split_s390_1_z2.o split_s390_2_s.o ../ld-new
4208         ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_z2.o split_s390_2_s.o
4209 split_s390_z2.stdout: split_s390_z2
4210         $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
4211 split_s390_z3: split_s390_1_z3.o split_s390_2_s.o ../ld-new
4212         ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_z3.o split_s390_2_s.o
4213 split_s390_z3.stdout: split_s390_z3
4214         $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
4215 split_s390_z4: split_s390_1_z4.o split_s390_2_s.o ../ld-new
4216         ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_z4.o split_s390_2_s.o
4217 split_s390_z4.stdout: split_s390_z4
4218         $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
4219 split_s390_n1: split_s390_1_n1.o split_s390_2_s.o ../ld-new
4220         ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_n1.o split_s390_2_s.o
4221 split_s390_n1.stdout: split_s390_n1
4222         $(TEST_OBJDUMP) -d $< > $@
4223 split_s390_n2: split_s390_1_n2.o split_s390_2_s.o ../ld-new
4224         ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_n2.o split_s390_2_s.o
4225 split_s390_n2.stdout: split_s390_n2
4226         $(TEST_OBJDUMP) -d $< > $@
4227 split_s390_z1_ns: split_s390_1_z1.o split_s390_2_ns.o ../ld-new
4228         ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_z1.o split_s390_2_ns.o
4229 split_s390_z1_ns.stdout: split_s390_z1_ns
4230         $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
4231 split_s390_z2_ns: split_s390_1_z2.o split_s390_2_ns.o ../ld-new
4232         ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_z2.o split_s390_2_ns.o
4233 split_s390_z2_ns.stdout: split_s390_z2_ns
4234         $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
4235 split_s390_z3_ns: split_s390_1_z3.o split_s390_2_ns.o ../ld-new
4236         ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_z3.o split_s390_2_ns.o
4237 split_s390_z3_ns.stdout: split_s390_z3_ns
4238         $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
4239 split_s390_z4_ns: split_s390_1_z4.o split_s390_2_ns.o ../ld-new
4240         ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_z4.o split_s390_2_ns.o
4241 split_s390_z4_ns.stdout: split_s390_z4_ns
4242         $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
4243 split_s390_n1_ns: split_s390_1_n1.o split_s390_2_ns.o ../ld-new
4244         ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_n1.o split_s390_2_ns.o
4245 split_s390_n1_ns.stdout: split_s390_n1_ns
4246         $(TEST_OBJDUMP) -d $< > $@
4247 split_s390_n2_ns.stdout: split_s390_1_n2.o split_s390_2_ns.o ../ld-new
4248         ../ld-new $(SPLIT_DEFSYMS) -o split_s390_n2 split_s390_1_n2.o split_s390_2_ns.o > $@ 2>&1 || exit 0
4249 split_s390_a1.stdout: split_s390_1_a1.o split_s390_2_ns.o ../ld-new
4250         ../ld-new $(SPLIT_DEFSYMS) -o split_s390_a1 split_s390_1_a1.o split_s390_2_ns.o > $@ 2>&1 || exit 0
4251 split_s390_a2: split_s390_1_a2.o split_s390_2_ns.o ../ld-new
4252         ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_a2.o split_s390_2_ns.o
4253 split_s390_a2.stdout: split_s390_a2
4254         $(TEST_OBJDUMP) -d $< > $@
4255 split_s390_r.stdout: split_s390_1_z1.o split_s390_2_ns.o ../ld-new
4256         ../ld-new -r split_s390_1_z1.o split_s390_2_ns.o -o split_s390_r > $@ 2>&1 || exit 0
4257 split_s390x_1_z1.o: split_s390x_1_z1.s
4258         $(TEST_AS) -m64 -o $@ $<
4259 split_s390x_1_z2.o: split_s390x_1_z2.s
4260         $(TEST_AS) -m64 -o $@ $<
4261 split_s390x_1_z3.o: split_s390x_1_z3.s
4262         $(TEST_AS) -m64 -o $@ $<
4263 split_s390x_1_z4.o: split_s390x_1_z4.s
4264         $(TEST_AS) -m64 -o $@ $<
4265 split_s390x_1_n1.o: split_s390x_1_n1.s
4266         $(TEST_AS) -m64 -o $@ $<
4267 split_s390x_1_n2.o: split_s390x_1_n2.s
4268         $(TEST_AS) -m64 -o $@ $<
4269 split_s390x_1_a1.o: split_s390x_1_a1.s
4270         $(TEST_AS) -m64 -o $@ $<
4271 split_s390x_1_a2.o: split_s390x_1_a2.s
4272         $(TEST_AS) -m64 -o $@ $<
4273 split_s390x_2_s.o: split_s390x_2_s.s
4274         $(TEST_AS) -m64 -o $@ $<
4275 split_s390x_2_ns.o: split_s390x_2_ns.s
4276         $(TEST_AS) -m64 -o $@ $<
4277 split_s390x_z1: split_s390x_1_z1.o split_s390x_2_s.o ../ld-new
4278         ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_z1.o split_s390x_2_s.o
4279 split_s390x_z1.stdout: split_s390x_z1
4280         $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
4281 split_s390x_z2: split_s390x_1_z2.o split_s390x_2_s.o ../ld-new
4282         ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_z2.o split_s390x_2_s.o
4283 split_s390x_z2.stdout: split_s390x_z2
4284         $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
4285 split_s390x_z3: split_s390x_1_z3.o split_s390x_2_s.o ../ld-new
4286         ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_z3.o split_s390x_2_s.o
4287 split_s390x_z3.stdout: split_s390x_z3
4288         $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
4289 split_s390x_z4: split_s390x_1_z4.o split_s390x_2_s.o ../ld-new
4290         ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_z4.o split_s390x_2_s.o
4291 split_s390x_z4.stdout: split_s390x_z4
4292         $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
4293 split_s390x_n1: split_s390x_1_n1.o split_s390x_2_s.o ../ld-new
4294         ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_n1.o split_s390x_2_s.o
4295 split_s390x_n1.stdout: split_s390x_n1
4296         $(TEST_OBJDUMP) -d $< > $@
4297 split_s390x_n2: split_s390x_1_n2.o split_s390x_2_s.o ../ld-new
4298         ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_n2.o split_s390x_2_s.o
4299 split_s390x_n2.stdout: split_s390x_n2
4300         $(TEST_OBJDUMP) -d $< > $@
4301 split_s390x_z1_ns: split_s390x_1_z1.o split_s390x_2_ns.o ../ld-new
4302         ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_z1.o split_s390x_2_ns.o
4303 split_s390x_z1_ns.stdout: split_s390x_z1_ns
4304         $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
4305 split_s390x_z2_ns: split_s390x_1_z2.o split_s390x_2_ns.o ../ld-new
4306         ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_z2.o split_s390x_2_ns.o
4307 split_s390x_z2_ns.stdout: split_s390x_z2_ns
4308         $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
4309 split_s390x_z3_ns: split_s390x_1_z3.o split_s390x_2_ns.o ../ld-new
4310         ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_z3.o split_s390x_2_ns.o
4311 split_s390x_z3_ns.stdout: split_s390x_z3_ns
4312         $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
4313 split_s390x_z4_ns: split_s390x_1_z4.o split_s390x_2_ns.o ../ld-new
4314         ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_z4.o split_s390x_2_ns.o
4315 split_s390x_z4_ns.stdout: split_s390x_z4_ns
4316         $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
4317 split_s390x_n1_ns: split_s390x_1_n1.o split_s390x_2_ns.o ../ld-new
4318         ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_n1.o split_s390x_2_ns.o
4319 split_s390x_n1_ns.stdout: split_s390x_n1_ns
4320         $(TEST_OBJDUMP) -d $< > $@
4321 split_s390x_n2_ns.stdout: split_s390x_1_n2.o split_s390x_2_ns.o ../ld-new
4322         ../ld-new $(SPLIT_DEFSYMS) -o split_s390x_n2 split_s390x_1_n2.o split_s390x_2_ns.o > $@ 2>&1 || exit 0
4323 split_s390x_a1.stdout: split_s390x_1_a1.o split_s390x_2_ns.o ../ld-new
4324         ../ld-new $(SPLIT_DEFSYMS) -o split_s390x_a1 split_s390x_1_a1.o split_s390x_2_ns.o > $@ 2>&1 || exit 0
4325 split_s390x_a2: split_s390x_1_a2.o split_s390x_2_ns.o ../ld-new
4326         ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_a2.o split_s390x_2_ns.o
4327 split_s390x_a2.stdout: split_s390x_a2
4328         $(TEST_OBJDUMP) -d $< > $@
4329 split_s390x_r.stdout: split_s390x_1_z1.o split_s390x_2_ns.o ../ld-new
4330         ../ld-new -r split_s390x_1_z1.o split_s390x_2_ns.o -o split_s390x_r > $@ 2>&1 || exit 0
4331 MOSTLYCLEANFILES += split_s390_z1 split_s390_z2 split_s390_z3 \
4332         split_s390_z4 split_s390_n1 split_s390_n2 split_s390_a1 \
4333         split_s390_a2 split_s390_z1_ns split_s390_z2_ns split_s390_z3_ns \
4334         split_s390_z4_ns split_s390_n1_ns split_s390_n2_ns split_s390_r \
4335         split_s390x_z1 split_s390x_z2 split_s390x_z3 split_s390x_z4 \
4336         split_s390x_n1 split_s390x_n2 split_s390x_a1 split_s390x_a2 \
4337         split_s390x_z1_ns split_s390x_z2_ns split_s390x_z3_ns \
4338         split_s390x_z4_ns split_s390x_n1_ns split_s390x_n2_ns split_s390x_r
4340 endif DEFAULT_TARGET_S390
4342 endif NATIVE_OR_CROSS_LINKER
4344 # Tests for the dwp tool.
4345 # We don't want to rely yet on GCC support for -gsplit-dwarf,
4346 # so we use (for now) test cases in x86 assembly language,
4347 # compiled from the dwp_test_*.cc sources.
4349 if DEFAULT_TARGET_X86_64
4351 dwp_test_main.o: dwp_test_main.s
4352         $(TEST_AS) -o $@ $<
4353 dwp_test_1.o: dwp_test_1.s
4354         $(TEST_AS) -o $@ $<
4355 dwp_test_1b.o: dwp_test_1b.s
4356         $(TEST_AS) -o $@ $<
4357 dwp_test_2.o: dwp_test_2.s
4358         $(TEST_AS) -o $@ $<
4360 dwp_test_main.dwo: dwp_test_main.o
4361         $(TEST_OBJCOPY) --extract-dwo $< $@
4362 dwp_test_1.dwo: dwp_test_1.o
4363         $(TEST_OBJCOPY) --extract-dwo $< $@
4364 dwp_test_1b.dwo: dwp_test_1b.o
4365         $(TEST_OBJCOPY) --extract-dwo $< $@
4366 dwp_test_2.dwo: dwp_test_2.o
4367         $(TEST_OBJCOPY) --extract-dwo $< $@
4369 MOSTLYCLEANFILES += *.dwo *.dwp
4370 check_SCRIPTS += dwp_test_1.sh
4371 check_DATA += dwp_test_1.stdout
4372 dwp_test_1.stdout: dwp_test_1.dwp
4373         $(TEST_READELF) -wi $< > $@
4374 dwp_test_1.dwp: ../dwp dwp_test_main.dwo dwp_test_1.dwo dwp_test_1b.dwo dwp_test_2.dwo
4375         ../dwp -o $@ dwp_test_main.dwo dwp_test_1.dwo dwp_test_1b.dwo dwp_test_2.dwo
4377 check_SCRIPTS += dwp_test_2.sh
4378 check_DATA += dwp_test_2.stdout
4379 dwp_test_2.stdout: dwp_test_2.dwp
4380         $(TEST_READELF) -wi $< > $@
4381 dwp_test_2.dwp: ../dwp dwp_test_2a.dwp dwp_test_2b.dwp
4382         ../dwp -o $@ dwp_test_2a.dwp dwp_test_2b.dwp
4383 dwp_test_2a.dwp: ../dwp dwp_test_main.dwo dwp_test_1.dwo
4384         ../dwp -o $@ dwp_test_main.dwo dwp_test_1.dwo
4385 dwp_test_2b.dwp: ../dwp dwp_test_1b.dwo dwp_test_2.dwo
4386         ../dwp -o $@ dwp_test_1b.dwo dwp_test_2.dwo
4388 endif DEFAULT_TARGET_X86_64