avoid unwarranted assumption in gdb.ada/fixed_points/fixed_points.adb
[binutils-gdb.git] / gold / testsuite / Makefile.am
blob768caad276ac0804a1bfb8abbcc424f5135944c9
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 check_PROGRAMS += constructor_test
512 constructor_test_SOURCES = constructor_test.cc
513 constructor_test_DEPENDENCIES = gcctestdir/ld
514 constructor_test_LDADD =
516 if HAVE_STATIC
517 check_PROGRAMS += constructor_static_test
518 constructor_static_test_SOURCES = $(constructor_test_SOURCES)
519 constructor_static_test_DEPENDENCIES = $(constructor_test_DEPENDENCIES)
520 constructor_static_test_LDFLAGS = $(constructor_test_LDFLAGS) -static
521 constructor_static_test_LDADD = $(constructor_test_LDADD)
522 endif
524 check_PROGRAMS += two_file_test
525 check_PROGRAMS += two_file_pic_test
526 two_file_test_SOURCES = \
527         two_file_test_1.cc \
528         two_file_test_1b.cc \
529         two_file_test_2.cc \
530         two_file_test_main.cc \
531         two_file_test.h
532 two_file_test_DEPENDENCIES = gcctestdir/ld
533 two_file_test_LDADD =
535 if HAVE_STATIC
536 check_PROGRAMS += two_file_static_test
537 two_file_static_test_SOURCES = $(two_file_test_SOURCES)
538 two_file_static_test_DEPENDENCIES = $(two_file_test_DEPENDENCIES)
539 two_file_static_test_LDFLAGS = $(two_file_test_LDFLAGS) -static
540 two_file_static_test_LDADD = $(two_file_test_LDADD)
541 endif
543 two_file_pic_test_SOURCES = two_file_test_main.cc
544 two_file_pic_test_DEPENDENCIES = \
545         gcctestdir/ld two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o
546 two_file_pic_test_LDADD = two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o
549 check_PROGRAMS += two_file_shared_1_test
550 check_PROGRAMS += two_file_shared_2_test
551 check_PROGRAMS += two_file_shared_1_pic_2_test
552 check_PROGRAMS += two_file_shared_2_pic_1_test
553 check_PROGRAMS += two_file_same_shared_test
554 check_PROGRAMS += two_file_separate_shared_12_test
555 check_PROGRAMS += two_file_separate_shared_21_test
556 two_file_test_1_pic.o: two_file_test_1.cc
557         $(CXXCOMPILE) -c -fpic -o $@ $<
558 two_file_test_1b_pic.o: two_file_test_1b.cc
559         $(CXXCOMPILE) -c -fpic -o $@ $<
560 two_file_test_2_pic.o: two_file_test_2.cc
561         $(CXXCOMPILE) -c -fpic -o $@ $<
562 two_file_shared_1.so: two_file_test_1_pic.o two_file_test_1b_pic.o gcctestdir/ld
563         $(CXXLINK) -shared two_file_test_1_pic.o two_file_test_1b_pic.o
564 two_file_shared_2.so: two_file_test_2_pic.o gcctestdir/ld
565         $(CXXLINK) -shared two_file_test_2_pic.o
566 two_file_shared.so: two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o gcctestdir/ld
567         $(CXXLINK) -shared two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o
569 two_file_shared_1_test_SOURCES = two_file_test_2.cc two_file_test_main.cc
570 two_file_shared_1_test_DEPENDENCIES = gcctestdir/ld two_file_shared_1.so
571 two_file_shared_1_test_LDFLAGS = -Wl,-R,.
572 two_file_shared_1_test_LDADD = two_file_shared_1.so
574 two_file_shared_2_test_SOURCES = two_file_test_1.cc two_file_test_1b.cc two_file_test_main.cc
575 two_file_shared_2_test_DEPENDENCIES = gcctestdir/ld two_file_shared_2.so
576 two_file_shared_2_test_LDFLAGS = -Wl,-R,.
577 two_file_shared_2_test_LDADD = two_file_shared_2.so
579 two_file_shared_1_pic_2_test_SOURCES = two_file_test_main.cc
580 two_file_shared_1_pic_2_test_DEPENDENCIES = \
581         gcctestdir/ld two_file_shared_2.so two_file_test_1_pic.o two_file_test_1b_pic.o
582 two_file_shared_1_pic_2_test_LDFLAGS = -Wl,-R,.
583 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
585 two_file_shared_2_pic_1_test_SOURCES = two_file_test_main.cc
586 two_file_shared_2_pic_1_test_DEPENDENCIES = \
587         gcctestdir/ld two_file_shared_1.so two_file_test_2_pic.o
588 two_file_shared_2_pic_1_test_LDFLAGS = -Wl,-R,.
589 two_file_shared_2_pic_1_test_LDADD = two_file_test_2_pic.o two_file_shared_1.so
591 two_file_same_shared_test_SOURCES = two_file_test_main.cc
592 two_file_same_shared_test_DEPENDENCIES = gcctestdir/ld two_file_shared.so
593 two_file_same_shared_test_LDFLAGS = -Wl,-R,.
594 two_file_same_shared_test_LDADD = two_file_shared.so
596 two_file_separate_shared_12_test_SOURCES = two_file_test_main.cc
597 two_file_separate_shared_12_test_DEPENDENCIES = \
598         gcctestdir/ld two_file_shared_1.so two_file_shared_2.so
599 two_file_separate_shared_12_test_LDFLAGS = -Wl,-R,.
600 two_file_separate_shared_12_test_LDADD = \
601         two_file_shared_1.so two_file_shared_2.so
603 two_file_separate_shared_21_test_SOURCES = two_file_test_main.cc
604 two_file_separate_shared_21_test_DEPENDENCIES = \
605         gcctestdir/ld two_file_shared_1.so two_file_shared_2.so
606 two_file_separate_shared_21_test_LDFLAGS = -Wl,-R,.
607 two_file_separate_shared_21_test_LDADD = \
608         two_file_shared_2.so two_file_shared_1.so
610 check_PROGRAMS += two_file_relocatable_test
611 two_file_relocatable_test_SOURCES = two_file_test_main.cc
612 two_file_relocatable_test_DEPENDENCIES = \
613         gcctestdir/ld two_file_relocatable.o
614 two_file_relocatable_test_LDFLAGS = -Wl,-R,.
615 two_file_relocatable_test_LDADD = two_file_relocatable.o
616 two_file_relocatable.o: gcctestdir/ld two_file_test_1.o two_file_test_1b.o two_file_test_2.o
617         gcctestdir/ld -r -o $@ two_file_test_1.o two_file_test_1b.o two_file_test_2.o
619 check_PROGRAMS += two_file_pie_test
620 two_file_test_1_pie.o: two_file_test_1.cc
621         $(CXXCOMPILE) -c -fpie -o $@ $<
622 two_file_test_1b_pie.o: two_file_test_1b.cc
623         $(CXXCOMPILE) -c -fpie -o $@ $<
624 two_file_test_2_pie.o: two_file_test_2.cc
625         $(CXXCOMPILE) -c -fpie -o $@ $<
626 two_file_test_main_pie.o: two_file_test_main.cc
627         $(CXXCOMPILE) -c -fpie -o $@ $<
628 two_file_pie_test: two_file_test_1_pie.o two_file_test_1b_pie.o \
629                 two_file_test_2_pie.o two_file_test_main_pie.o gcctestdir/ld
630         $(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
632 check_PROGRAMS += pie_copyrelocs_test
633 pie_copyrelocs_test_SOURCES = pie_copyrelocs_test.cc
634 pie_copyrelocs_test_DEPENDENCIES = gcctestdir/ld pie_copyrelocs_shared_test.so
635 pie_copyrelocs_test_CXXFLAGS = -fno-exceptions -fno-asynchronous-unwind-tables
636 pie_copyrelocs_test_LDFLAGS = -Wl,-R,. -pie
637 pie_copyrelocs_test_LDADD = pie_copyrelocs_shared_test.so
638 pie_copyrelocs_shared_test.o: pie_copyrelocs_shared_test.cc
639         $(CXXCOMPILE) -O2 -fpic -c -o $@ $<
640 pie_copyrelocs_shared_test.so: pie_copyrelocs_shared_test.o gcctestdir/ld
641         $(CXXLINK) -shared pie_copyrelocs_shared_test.o
643 check_PROGRAMS += weak_unresolved_symbols_test
644 weak_unresolved_symbols_test_SOURCES = weak_unresolved_symbols_test.cc
645 weak_unresolved_symbols_test_CXXFLAGS = -fPIE
646 weak_unresolved_symbols_test_LDFLAGS = -pie -Wl,--weak-unresolved-symbols
648 check_SCRIPTS += two_file_shared.sh
649 check_DATA += two_file_shared.dbg
650 MOSTLYCLEANFILES += two_file_shared.dbg
651 two_file_shared.dbg: two_file_shared.so
652         $(TEST_READELF) -w $< >$@ 2>/dev/null
654 # The nonpic tests will fail on platforms which can not put non-PIC
655 # code into shared libraries, so we just don't run them in that case.
656 if FN_PTRS_IN_SO_WITHOUT_PIC
658 check_PROGRAMS += two_file_shared_1_nonpic_test
659 check_PROGRAMS += two_file_shared_2_nonpic_test
660 check_PROGRAMS += two_file_same_shared_nonpic_test
661 check_PROGRAMS += two_file_separate_shared_12_nonpic_test
662 check_PROGRAMS += two_file_separate_shared_21_nonpic_test
663 check_PROGRAMS += two_file_mixed_shared_test
664 check_PROGRAMS += two_file_mixed_2_shared_test
665 two_file_shared_1_nonpic.so: two_file_test_1.o gcctestdir/ld
666         $(CXXLINK) -shared two_file_test_1.o two_file_test_1b.o -Wl,-z,notext
667 two_file_shared_2_nonpic.so: two_file_test_2.o gcctestdir/ld
668         $(CXXLINK) -shared two_file_test_2.o
669 two_file_shared_nonpic.so: two_file_test_1.o two_file_test_1b.o two_file_test_2.o gcctestdir/ld
670         $(CXXLINK) -shared two_file_test_1.o two_file_test_1b.o two_file_test_2.o -Wl,-z,notext
671 two_file_shared_mixed.so: two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2.o gcctestdir/ld
672         $(CXXLINK) -shared two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2.o -Wl,-z,notext
673 two_file_shared_mixed_1.so: two_file_test_1.o two_file_test_1b_pic.o two_file_shared_2.so gcctestdir/ld
674         $(CXXLINK) -shared two_file_test_1.o two_file_test_1b_pic.o two_file_shared_2.so -Wl,-z,notext
676 two_file_shared_1_nonpic_test_SOURCES = \
677         two_file_test_2.cc two_file_test_main.cc
678 two_file_shared_1_nonpic_test_DEPENDENCIES = \
679         gcctestdir/ld two_file_shared_1_nonpic.so
680 two_file_shared_1_nonpic_test_LDFLAGS = -Wl,-R,.
681 two_file_shared_1_nonpic_test_LDADD = two_file_shared_1_nonpic.so
683 two_file_shared_2_nonpic_test_SOURCES = \
684         two_file_test_1.cc two_file_test_1b.cc two_file_test_main.cc
685 two_file_shared_2_nonpic_test_DEPENDENCIES = \
686         gcctestdir/ld two_file_shared_2_nonpic.so
687 two_file_shared_2_nonpic_test_LDFLAGS = -Wl,-R,.
688 two_file_shared_2_nonpic_test_LDADD = two_file_shared_2_nonpic.so
690 two_file_same_shared_nonpic_test_SOURCES = two_file_test_main.cc
691 two_file_same_shared_nonpic_test_DEPENDENCIES = \
692         gcctestdir/ld two_file_shared_nonpic.so
693 two_file_same_shared_nonpic_test_LDFLAGS = -Wl,-R,.
694 two_file_same_shared_nonpic_test_LDADD = two_file_shared_nonpic.so
696 two_file_separate_shared_12_nonpic_test_SOURCES = two_file_test_main.cc
697 two_file_separate_shared_12_nonpic_test_DEPENDENCIES = \
698         gcctestdir/ld two_file_shared_1_nonpic.so two_file_shared_2_nonpic.so
699 two_file_separate_shared_12_nonpic_test_LDFLAGS = -Wl,-R,.
700 two_file_separate_shared_12_nonpic_test_LDADD = \
701         two_file_shared_1_nonpic.so two_file_shared_2_nonpic.so
703 two_file_separate_shared_21_nonpic_test_SOURCES = two_file_test_main.cc
704 two_file_separate_shared_21_nonpic_test_DEPENDENCIES = \
705         gcctestdir/ld two_file_shared_1_nonpic.so two_file_shared_2_nonpic.so
706 two_file_separate_shared_21_nonpic_test_LDFLAGS = -Wl,-R,.
707 two_file_separate_shared_21_nonpic_test_LDADD = \
708         two_file_shared_2_nonpic.so two_file_shared_1_nonpic.so
710 two_file_mixed_shared_test_SOURCES = two_file_test_main.cc
711 two_file_mixed_shared_test_DEPENDENCIES = gcctestdir/ld two_file_shared_mixed.so
712 two_file_mixed_shared_test_LDFLAGS = -Wl,-R,.
713 two_file_mixed_shared_test_LDADD = two_file_shared_mixed.so
715 two_file_mixed_2_shared_test_SOURCES = two_file_test_main.cc
716 two_file_mixed_2_shared_test_DEPENDENCIES = gcctestdir/ld two_file_shared_mixed_1.so two_file_shared_2.so
717 two_file_mixed_2_shared_test_LDFLAGS = -Wl,-R,.
718 two_file_mixed_2_shared_test_LDADD = two_file_shared_mixed_1.so two_file_shared_2.so
720 check_PROGRAMS += two_file_mixed_pie_test
721 two_file_mixed_pie_test: two_file_test_1.o two_file_test_1b_pie.o \
722                 two_file_test_main_pie.o two_file_shared_2.so gcctestdir/ld
723         $(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
725 endif FN_PTRS_IN_SO_WITHOUT_PIC
727 check_PROGRAMS += two_file_strip_test
728 two_file_strip_test: two_file_test
729         $(TEST_STRIP) -o two_file_strip_test two_file_test
731 check_PROGRAMS += two_file_same_shared_strip_test
732 two_file_same_shared_strip_test_SOURCES = two_file_test_main.cc
733 two_file_same_shared_strip_test_DEPENDENCIES = \
734         gcctestdir/ld two_file_shared_strip.so
735 two_file_same_shared_strip_test_LDFLAGS = -Wl,-R.
736 two_file_same_shared_strip_test_LDADD = two_file_shared_strip.so
737 two_file_shared_strip.so: two_file_shared.so
738         $(TEST_STRIP) -S -o two_file_shared_strip.so two_file_shared.so
740 check_PROGRAMS += common_test_1
741 common_test_1_SOURCES = common_test_1.c
742 common_test_1_DEPENDENCIES = gcctestdir/ld
743 common_test_1_LDADD =
744 common_test_1.o: common_test_1.c
745         $(COMPILE) -c $(COMMON_TEST_C_CFLAGS) -o $@ $<
747 check_PROGRAMS += common_test_2
748 common_test_2_SOURCES = common_test_1.c
749 common_test_2_DEPENDENCIES = common_test_2.so common_test_3.so gcctestdir/ld
750 common_test_2_LDFLAGS = -Wl,-R,.
751 common_test_2_LDADD = common_test_2.so common_test_3.so
752 common_test_2.o: common_test_2.c
753         $(COMPILE) -c $(COMMON_TEST_C_CFLAGS) -o $@ $<
754 common_test_2_pic.o: common_test_2.c
755         $(COMPILE) -c -fpic $(COMMON_TEST_C_CFLAGS) -o $@ $<
756 common_test_2.so: common_test_2_pic.o common_test_3.so gcctestdir/ld
757         $(LINK) -shared common_test_2_pic.o common_test_3.so
758 common_test_3.o: common_test_3.c
759         $(COMPILE) -c $(COMMON_TEST_C_CFLAGS) -o $@ $<
760 common_test_3_pic.o: common_test_3.c
761         $(COMPILE) -c -fpic $(COMMON_TEST_C_CFLAGS) -o $@ $<
762 common_test_3.so: common_test_3_pic.o ver_test_2.script gcctestdir/ld
763         $(LINK) -shared common_test_3_pic.o -Wl,--version-script,$(srcdir)/ver_test_2.script
765 check_PROGRAMS += exception_test
766 check_PROGRAMS += exception_shared_1_test
767 check_PROGRAMS += exception_shared_2_test
768 check_PROGRAMS += exception_same_shared_test
769 check_PROGRAMS += exception_separate_shared_12_test
770 check_PROGRAMS += exception_separate_shared_21_test
771 exception_test_1_pic.o: exception_test_1.cc
772         $(CXXCOMPILE) -c -fpic -o $@ $<
773 exception_test_2_pic.o: exception_test_2.cc
774         $(CXXCOMPILE) -c -fpic -o $@ $<
775 exception_shared_1.so: exception_test_1_pic.o gcctestdir/ld
776         $(CXXLINK) -shared exception_test_1_pic.o
777 exception_shared_2.so: exception_test_2_pic.o gcctestdir/ld
778         $(CXXLINK) -shared exception_test_2_pic.o
779 exception_shared.so: exception_test_1_pic.o exception_test_2_pic.o gcctestdir/ld
780         $(CXXLINK) -shared exception_test_1_pic.o exception_test_2_pic.o
782 exception_test_SOURCES = \
783         exception_test_main.cc \
784         exception_test_1.cc \
785         exception_test_2.cc \
786         exception_test.h
787 exception_test_DEPENDENCIES = gcctestdir/ld
788 exception_test_LDADD =
790 if HAVE_STATIC
791 check_PROGRAMS += exception_static_test
792 exception_static_test_SOURCES = $(exception_test_SOURCES)
793 exception_static_test_DEPENDENCIES = $(exception_test_DEPENDENCIES)
794 exception_static_test_LDFLAGS = $(exception_test_LDFLAGS) -static
795 exception_static_test_LDADD = $(exception_test_LDADD)
796 endif
798 exception_shared_1_test_SOURCES = exception_test_2.cc exception_test_main.cc
799 exception_shared_1_test_DEPENDENCIES = gcctestdir/ld exception_shared_1.so
800 exception_shared_1_test_LDFLAGS = -Wl,-R,.
801 exception_shared_1_test_LDADD = exception_shared_1.so
803 exception_shared_2_test_SOURCES = exception_test_1.cc exception_test_main.cc
804 exception_shared_2_test_DEPENDENCIES = gcctestdir/ld exception_shared_2.so
805 exception_shared_2_test_LDFLAGS = -Wl,-R,.
806 exception_shared_2_test_LDADD = exception_shared_2.so
808 exception_same_shared_test_SOURCES = exception_test_main.cc
809 exception_same_shared_test_DEPENDENCIES = gcctestdir/ld exception_shared.so
810 exception_same_shared_test_LDFLAGS = -Wl,-R,.
811 exception_same_shared_test_LDADD = exception_shared.so
813 exception_separate_shared_12_test_SOURCES = exception_test_main.cc
814 exception_separate_shared_12_test_DEPENDENCIES = \
815         gcctestdir/ld exception_shared_1.so exception_shared_2.so
816 exception_separate_shared_12_test_LDFLAGS = -Wl,-R,. -Wl,--no-as-needed
817 exception_separate_shared_12_test_LDADD = \
818         exception_shared_1.so exception_shared_2.so
820 exception_separate_shared_21_test_SOURCES = exception_test_main.cc
821 exception_separate_shared_21_test_DEPENDENCIES = \
822         gcctestdir/ld exception_shared_1.so exception_shared_2.so
823 exception_separate_shared_21_test_LDFLAGS = -Wl,-R,. -Wl,--no-as-needed
824 exception_separate_shared_21_test_LDADD = \
825         exception_shared_2.so exception_shared_1.so
828 check_PROGRAMS += weak_test
829 weak_test_SOURCES = weak_test.cc
830 weak_test_DEPENDENCIES = gcctestdir/ld
831 weak_test_LDADD =
833 check_PROGRAMS += weak_undef_test
834 MOSTLYCLEANFILES += alt/weak_undef_lib.so
835 weak_undef_test_SOURCES = weak_undef_test.cc
836 weak_undef_test_DEPENDENCIES = gcctestdir/ld weak_undef_lib.so alt/weak_undef_lib.so
837 weak_undef_test_LDFLAGS = -Wl,-R,alt
838 weak_undef_test_LDADD = -L . weak_undef_lib.so
839 weak_undef_file1.o: weak_undef_file1.cc
840         $(CXXCOMPILE) -c -fpic -o $@ $<
841 weak_undef_file2.o: weak_undef_file2.cc
842         $(CXXCOMPILE) -c -fpic -o $@ $<
843 weak_undef_lib.so: weak_undef_file1.o gcctestdir/ld
844         $(CXXLINK) -shared weak_undef_file1.o
845 alt/weak_undef_lib.so: weak_undef_file2.o gcctestdir/ld
846         test -d alt || mkdir -p alt
847         $(CXXLINK) -shared weak_undef_file2.o
849 check_PROGRAMS += weak_undef_test_2
850 weak_undef_test_2_SOURCES = weak_undef_test_2.cc
851 weak_undef_test_2_DEPENDENCIES = gcctestdir/ld libweak_undef_2.a
852 weak_undef_test_2_LDFLAGS = -u weak_undef_2
853 weak_undef_test_2_LDADD = -L . -lweak_undef_2
854 MOSTLYCLEANFILES += libweak_undef_2.a
855 libweak_undef_2.a: weak_undef_file3.o weak_undef_file4.o
856         $(TEST_AR) rc $@ $^
857 weak_undef_file3.o: weak_undef_file3.cc
858         $(CXXCOMPILE) -c -o $@ $<
859 weak_undef_file4.o: weak_undef_file4.cc
860         $(CXXCOMPILE) -c -o $@ $<
862 if FN_PTRS_IN_SO_WITHOUT_PIC
863 check_PROGRAMS += weak_undef_nonpic_test
864 MOSTLYCLEANFILES += alt/weak_undef_lib_nonpic.so
865 weak_undef_nonpic_test_SOURCES = weak_undef_test.cc
866 weak_undef_nonpic_test_DEPENDENCIES = gcctestdir/ld weak_undef_lib_nonpic.so alt/weak_undef_lib_nonpic.so
867 weak_undef_nonpic_test_LDFLAGS = -Wl,-R,alt
868 weak_undef_nonpic_test_LDADD = -L . weak_undef_lib_nonpic.so
869 weak_undef_file1_nonpic.o: weak_undef_file1.cc
870         $(CXXCOMPILE) -c -o $@ $<
871 weak_undef_file2_nonpic.o: weak_undef_file2.cc
872         $(CXXCOMPILE) -c -o $@ $<
873 weak_undef_lib_nonpic.so: weak_undef_file1_nonpic.o
874         $(CXXLINK) -shared weak_undef_file1_nonpic.o -Wl,-z,notext
875 alt/weak_undef_lib_nonpic.so: weak_undef_file2_nonpic.o
876         test -d alt || mkdir -p alt
877         $(CXXLINK) -shared weak_undef_file2_nonpic.o -Wl,-z,notext
878 endif FN_PTRS_IN_SO_WITHOUT_PIC
881 check_PROGRAMS += weak_alias_test
882 weak_alias_test_SOURCES = weak_alias_test_main.cc
883 weak_alias_test_DEPENDENCIES = \
884         gcctestdir/ld weak_alias_test_1.so weak_alias_test_2.so \
885         weak_alias_test_3.o weak_alias_test_4.so weak_alias_test_5.so
886 weak_alias_test_LDFLAGS = -Wl,-R,.
887 weak_alias_test_LDADD = \
888         weak_alias_test_1.so weak_alias_test_2.so weak_alias_test_3.o \
889         weak_alias_test_4.so weak_alias_test_5.so
890 weak_alias_test_1_pic.o: weak_alias_test_1.cc
891         $(CXXCOMPILE) -c -fpic -o $@ $<
892 weak_alias_test_1.so: weak_alias_test_1_pic.o gcctestdir/ld
893         $(CXXLINK) -shared weak_alias_test_1_pic.o
894 weak_alias_test_2_pic.o: weak_alias_test_2.cc
895         $(CXXCOMPILE) -c -fpic -o $@ $<
896 weak_alias_test_2.so: weak_alias_test_2_pic.o gcctestdir/ld
897         $(CXXLINK) -shared weak_alias_test_2_pic.o
898 weak_alias_test_3.o: weak_alias_test_3.cc
899         $(CXXCOMPILE) -c -o $@ $<
900 weak_alias_test_4_pic.o: weak_alias_test_4.cc
901         $(CXXCOMPILE) -c -fpic -o $@ $<
902 weak_alias_test_4.so: weak_alias_test_4_pic.o gcctestdir/ld
903         $(CXXLINK) -shared weak_alias_test_4_pic.o
904 weak_alias_test_5_pic.o: weak_alias_test_5.cc
905         $(CXXCOMPILE) -c -fpic -o $@ $<
906 weak_alias_test_5.so: weak_alias_test_5_pic.o $(srcdir)/weak_alias_test.script gcctestdir/ld
907         $(CXXLINK) -shared weak_alias_test_5_pic.o \
908                 -Wl,--version-script,$(srcdir)/weak_alias_test.script
910 check_SCRIPTS += weak_plt.sh
911 check_PROGRAMS += weak_plt
912 check_DATA += weak_plt_shared.so
913 weak_plt_main_pic.o: weak_plt_main.cc
914         $(CXXCOMPILE) -c -fpic -o $@ $<
915 weak_plt: weak_plt_main_pic.o gcctestdir/ld
916         $(CXXLINK) weak_plt_main_pic.o
917 weak_plt_shared_pic.o: weak_plt_shared.cc
918         $(CXXCOMPILE) -c -fpic -o $@ $<
919 weak_plt_shared.so: weak_plt_shared_pic.o gcctestdir/ld
920         $(CXXLINK) -shared weak_plt_shared_pic.o
922 check_PROGRAMS += copy_test
923 copy_test_SOURCES = copy_test.cc
924 copy_test_DEPENDENCIES = gcctestdir/ld copy_test_1.so copy_test_2.so
925 copy_test_LDFLAGS = -Wl,-R,.
926 copy_test_LDADD = copy_test_1.so copy_test_2.so
927 copy_test_1_pic.o: copy_test_1.cc
928         $(CXXCOMPILE) -c -fpic -o $@ $<
929 copy_test_1.so: gcctestdir/ld copy_test_1_pic.o
930         $(CXXLINK) -shared copy_test_1_pic.o
931 copy_test_2_pic.o: copy_test_2.cc
932         $(CXXCOMPILE) -c -fpic -o $@ $<
933 copy_test_2.so: gcctestdir/ld copy_test_2_pic.o
934         $(CXXLINK) -shared copy_test_2_pic.o
936 check_PROGRAMS += copy_test_relro
937 copy_test_relro_SOURCES = copy_test_relro.cc
938 copy_test_relro_DEPENDENCIES = gcctestdir/ld copy_test_relro_1.so
939 copy_test_relro_LDFLAGS = -Wl,-R,. -Wl,-z,relro
940 copy_test_relro_LDADD = copy_test_relro_1.so
941 copy_test_relro_1_pic.o: copy_test_relro_1.cc
942         $(CXXCOMPILE) -c -fpic -o $@ $<
943 copy_test_relro_1.so: gcctestdir/ld copy_test_relro_1_pic.o
944         $(CXXLINK) -shared -Wl,-z,relro copy_test_relro_1_pic.o
946 if !DEFAULT_TARGET_POWERPC
947 check_SCRIPTS += copy_test_protected.sh
948 check_DATA += copy_test_protected.err
949 MOSTLYCLEANFILES += copy_test_protected.err
950 copy_test_protected.err: copy_test_protected.o copy_test_2.so gcctestdir/ld
951         @echo $(CXXLINK) -o copy_test_protected copy_test_protected.o copy_test_2.so -Wl,-R,. "2>$@"
952         @if $(CXXLINK) -o copy_test_protected copy_test_protected.o copy_test_2.so -Wl,-R,. 2>$@; \
953         then \
954           echo 1>&2 "Link of copy_test_protected should have failed"; \
955           rm -f $@; \
956           exit 1; \
957         fi
958 endif
960 if TLS
962 check_PROGRAMS += tls_test
963 check_PROGRAMS += tls_pic_test
964 check_PROGRAMS += tls_pie_test
965 check_PROGRAMS += tls_pie_pic_test
966 check_PROGRAMS += tls_shared_test
967 check_PROGRAMS += tls_shared_ie_test
968 check_PROGRAMS += tls_shared_gd_to_ie_test
969 tls_test_pic.o: tls_test.cc
970         $(CXXCOMPILE) -c -fpic -o $@ $<
971 tls_test_file2_pic.o: tls_test_file2.cc
972         $(CXXCOMPILE) -c -fpic -o $@ $<
973 tls_test_c_pic.o: tls_test_c.c
974         $(COMPILE) -c -fpic $(TLS_TEST_C_CFLAGS) -o $@ $<
975 tls_test_shared.so: tls_test_pic.o tls_test_file2_pic.o tls_test_c_pic.o gcctestdir/ld
976         $(CXXLINK) -shared tls_test_pic.o tls_test_file2_pic.o tls_test_c_pic.o -Wl,-z,defs
977 tls_test_shared2.so: tls_test_file2_pic.o gcctestdir/ld
978         $(CXXLINK) -shared tls_test_file2_pic.o
980 tls_test_pic_ie.o: tls_test.cc
981         $(CXXCOMPILE) -c -fpic -ftls-model=initial-exec -o $@ $<
982 tls_test_file2_pic_ie.o: tls_test_file2.cc
983         $(CXXCOMPILE) -c -fpic -ftls-model=initial-exec -o $@ $<
984 tls_test_c_pic_ie.o: tls_test_c.c
985         $(COMPILE) -c -fpic -ftls-model=initial-exec $(TLS_TEST_C_CFLAGS) -o $@ $<
986 tls_test_ie_shared.so: tls_test_pic_ie.o tls_test_file2_pic_ie.o tls_test_c_pic_ie.o gcctestdir/ld
987         $(CXXLINK) -shared tls_test_pic_ie.o tls_test_file2_pic_ie.o tls_test_c_pic_ie.o
989 tls_test_SOURCES = tls_test.cc tls_test_file2.cc tls_test_main.cc tls_test.h
990 tls_test_DEPENDENCIES = gcctestdir/ld tls_test_c.o
991 tls_test_LDFLAGS = $(THREADFLAGS)
992 tls_test_LDADD = tls_test_c.o $(THREADLIBS)
993 tls_test_c.o: tls_test_c.c
994         $(COMPILE) -c $(TLS_TEST_C_CFLAGS) -o $@ $<
996 tls_pic_test_SOURCES = tls_test_main.cc
997 tls_pic_test_DEPENDENCIES = gcctestdir/ld tls_test_pic.o tls_test_file2_pic.o \
998         tls_test_c_pic.o
999 tls_pic_test_LDFLAGS = $(THREADFLAGS)
1000 tls_pic_test_LDADD = tls_test_pic.o tls_test_file2_pic.o tls_test_c_pic.o \
1001         $(THREADLIBS)
1003 tls_test_main_pie.o: tls_test_main.cc tls_test.h
1004         $(CXXCOMPILE) -c -fpie -o $@ $<
1005 tls_test_pie.o: tls_test.cc tls_test.h
1006         $(CXXCOMPILE) -c -fpie -o $@ $<
1007 tls_test_file2_pie.o: tls_test_file2.cc tls_test.h
1008         $(CXXCOMPILE) -c -fpie -o $@ $<
1009 tls_test_c_pie.o: tls_test_c.c
1010         $(COMPILE) -c -fpic $(TLS_TEST_C_CFLAGS) -o $@ $<
1011 tls_pie_test: tls_test_main_pie.o tls_test_pie.o tls_test_file2_pie.o \
1012                 tls_test_c_pie.o gcctestdir/ld
1013         $(CXXLINK) $(THREADFLAGS) -pie tls_test_main_pie.o tls_test_pie.o tls_test_file2_pie.o tls_test_c_pie.o $(THREADLIBS)
1015 check_SCRIPTS += tls_pie_test.sh
1016 check_DATA += tls_pie_test.stdout
1017 tls_pie_test.stdout: tls_pie_test
1018         $(TEST_READELF) -rW $< > $@ 2>/dev/null
1020 tls_pie_pic_test: tls_test_main_pie.o tls_test_pic.o tls_test_file2_pic.o \
1021                 tls_test_c_pic.o gcctestdir/ld
1022         $(CXXLINK) $(THREADFLAGS) -pie tls_test_main_pie.o tls_test_pic.o tls_test_file2_pic.o tls_test_c_pic.o $(THREADLIBS)
1024 tls_shared_test_SOURCES = tls_test_main.cc
1025 tls_shared_test_DEPENDENCIES = gcctestdir/ld tls_test_shared.so
1026 tls_shared_test_LDFLAGS = -Wl,-R,. $(THREADFLAGS)
1027 tls_shared_test_LDADD = tls_test_shared.so $(THREADLIBS)
1029 tls_shared_ie_test_SOURCES = tls_test_main.cc
1030 tls_shared_ie_test_DEPENDENCIES = gcctestdir/ld tls_test_ie_shared.so
1031 tls_shared_ie_test_LDFLAGS = -Wl,-R,. $(THREADFLAGS)
1032 tls_shared_ie_test_LDADD = tls_test_ie_shared.so $(THREADLIBS)
1034 tls_shared_gd_to_ie_test_SOURCES = tls_test_main.cc
1035 tls_shared_gd_to_ie_test_DEPENDENCIES = gcctestdir/ld tls_test_pic.o \
1036         tls_test_c_pic.o tls_test_shared2.so
1037 tls_shared_gd_to_ie_test_LDFLAGS = -Wl,-R,. $(THREADFLAGS)
1038 tls_shared_gd_to_ie_test_LDADD = tls_test_pic.o tls_test_c_pic.o \
1039         tls_test_shared2.so $(THREADLIBS)
1041 if TLS_GNU2_DIALECT
1043 check_PROGRAMS += tls_shared_gnu2_gd_to_ie_test
1045 tls_test_gnu2.o: tls_test.cc gcctestdir/as
1046         $(CXXCOMPILE) -c -fpic -mtls-dialect=gnu2 -o $@ $<
1047 tls_test_file2_gnu2.o: tls_test_file2.cc gcctestdir/as
1048         $(CXXCOMPILE) -c -fpic -mtls-dialect=gnu2 -o $@ $<
1049 tls_test_c_gnu2.o: tls_test_c.c gcctestdir/as
1050         $(COMPILE) -c -fpic -mtls-dialect=gnu2 $(TLS_TEST_C_CFLAGS) -o $@ $<
1051 tls_test_gnu2_shared2.so: tls_test_file2_gnu2.o gcctestdir/ld
1052         $(CXXLINK) -shared tls_test_file2_gnu2.o
1054 tls_shared_gnu2_gd_to_ie_test_SOURCES = tls_test_main.cc
1055 tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES = gcctestdir/ld tls_test_gnu2.o \
1056         tls_test_c_gnu2.o tls_test_gnu2_shared2.so
1057 tls_shared_gnu2_gd_to_ie_test_LDFLAGS = -Wl,-R,. $(THREADFLAGS)
1058 tls_shared_gnu2_gd_to_ie_test_LDADD = tls_test_gnu2.o tls_test_c_gnu2.o \
1059         tls_test_gnu2_shared2.so $(THREADLIBS)
1061 if TLS_DESCRIPTORS
1063 check_PROGRAMS += tls_shared_gnu2_test
1065 tls_test_gnu2_shared.so: tls_test_gnu2.o tls_test_file2_gnu2.o tls_test_c_gnu2.o gcctestdir/ld
1066         $(CXXLINK) -shared tls_test_gnu2.o tls_test_file2_gnu2.o tls_test_c_gnu2.o
1068 tls_shared_gnu2_test_SOURCES = tls_test_main.cc
1069 tls_shared_gnu2_test_DEPENDENCIES = gcctestdir/ld tls_test_gnu2_shared.so
1070 tls_shared_gnu2_test_LDFLAGS = -Wl,-R,. $(THREADFLAGS)
1071 tls_shared_gnu2_test_LDADD = tls_test_gnu2_shared.so $(THREADLIBS)
1073 endif TLS_DESCRIPTORS
1075 endif TLS_GNU2_DIALECT
1077 if HAVE_STATIC
1078 if STATIC_TLS
1079 check_PROGRAMS += tls_static_test
1080 check_PROGRAMS += tls_static_pic_test
1082 tls_static_test_SOURCES = $(tls_test_SOURCES)
1083 tls_static_test_DEPENDENCIES = $(tls_test_DEPENDENCIES)
1084 tls_static_test_LDFLAGS = $(tls_test_LDFLAGS) -static
1085 tls_static_test_LDADD = $(tls_test_LDADD)
1087 tls_static_pic_test_SOURCES = $(tls_pic_test_SOURCES)
1088 tls_static_pic_test_DEPENDENCIES = $(tls_pic_test_DEPENDENCIES)
1089 tls_static_pic_test_LDFLAGS = $(tls_pic_test_LDFLAGS) -static
1090 tls_static_pic_test_LDADD = $(tls_pic_test_LDADD)
1091 endif
1092 endif
1094 if FN_PTRS_IN_SO_WITHOUT_PIC
1095 check_PROGRAMS += tls_shared_nonpic_test
1096 tls_test_shared_nonpic.so: tls_test.o tls_test_file2.o tls_test_c.o gcctestdir/ld
1097         $(CXXLINK) -shared tls_test.o tls_test_file2.o tls_test_c.o -Wl,-z,notext
1099 tls_shared_nonpic_test_SOURCES = tls_test_main.cc
1100 tls_shared_nonpic_test_DEPENDENCIES = gcctestdir/ld tls_test_shared_nonpic.so
1101 tls_shared_nonpic_test_LDFLAGS = -Wl,-R,. $(THREADFLAGS)
1102 tls_shared_nonpic_test_LDADD = tls_test_shared_nonpic.so $(THREADLIBS)
1103 endif FN_PTRS_IN_SO_WITHOUT_PIC
1105 endif TLS
1107 if DEFAULT_TARGET_X86_64
1109 check_SCRIPTS += x86_64_mov_to_lea.sh
1110 check_DATA += x86_64_mov_to_lea1.stdout x86_64_mov_to_lea2.stdout \
1111         x86_64_mov_to_lea3.stdout x86_64_mov_to_lea4.stdout \
1112         x86_64_mov_to_lea5.stdout x86_64_mov_to_lea6.stdout \
1113         x86_64_mov_to_lea7.stdout x86_64_mov_to_lea8.stdout \
1114         x86_64_mov_to_lea9.stdout x86_64_mov_to_lea10.stdout \
1115         x86_64_mov_to_lea11.stdout x86_64_mov_to_lea12.stdout \
1116         x86_64_mov_to_lea13.stdout x86_64_mov_to_lea14.stdout
1117 MOSTLYCLEANFILES += x86_64_mov_to_lea1 x86_64_mov_to_lea2 \
1118         x86_64_mov_to_lea3 x86_64_mov_to_lea4 x86_64_mov_to_lea5 \
1119         x86_64_mov_to_lea6 x86_64_mov_to_lea7 x86_64_mov_to_lea8 \
1120         x86_64_mov_to_lea9 x86_64_mov_to_lea10 x86_64_mov_to_lea11 \
1121         x86_64_mov_to_lea12 x86_64_mov_to_lea13 x86_64_mov_to_lea14
1123 x86_64_mov_to_lea1.o: x86_64_mov_to_lea1.s
1124         $(TEST_AS) --64 -o $@ $<
1125 x86_64_mov_to_lea2.o: x86_64_mov_to_lea1.s
1126         $(TEST_AS) --x32 -o $@ $<
1127 x86_64_mov_to_lea3.o: x86_64_mov_to_lea2.s
1128         $(TEST_AS) --x32 -o $@ $<
1129 x86_64_mov_to_lea4.o: x86_64_mov_to_lea2.s
1130         $(TEST_AS) --64 -o $@ $<
1131 x86_64_mov_to_lea5.o: x86_64_mov_to_lea3.s
1132         $(TEST_AS) --x32 -mrelax-relocations=yes -o $@ $<
1133 x86_64_mov_to_lea6.o: x86_64_mov_to_lea3.s
1134         $(TEST_AS) --64 -mrelax-relocations=yes -o $@ $<
1135 x86_64_mov_to_lea7.o: x86_64_mov_to_lea4.s
1136         $(TEST_AS) --x32 -o $@ $<
1137 x86_64_mov_to_lea8.o: x86_64_mov_to_lea4.s
1138         $(TEST_AS) --64 -o $@ $<
1139 x86_64_mov_to_lea1: x86_64_mov_to_lea1.o ../ld-new
1140         ../ld-new -Bsymbolic -shared -melf_x86_64 -o $@ $<
1141 x86_64_mov_to_lea2: x86_64_mov_to_lea1.o ../ld-new
1142         ../ld-new -pie -melf_x86_64 -o $@ $<
1143 x86_64_mov_to_lea3: x86_64_mov_to_lea1.o ../ld-new
1144         ../ld-new -melf_x86_64 -o $@ $<
1145 x86_64_mov_to_lea4: x86_64_mov_to_lea2.o ../ld-new
1146         ../ld-new -Bsymbolic -shared -melf32_x86_64 -o $@ $<
1147 x86_64_mov_to_lea5: x86_64_mov_to_lea2.o ../ld-new
1148         ../ld-new -pie -melf32_x86_64 -o $@ $<
1149 x86_64_mov_to_lea6: x86_64_mov_to_lea2.o ../ld-new
1150         ../ld-new -melf32_x86_64 -o $@ $<
1151 x86_64_mov_to_lea7: x86_64_mov_to_lea3.o ../ld-new
1152         ../ld-new -melf32_x86_64 -pie -o $@ $<
1153 x86_64_mov_to_lea8: x86_64_mov_to_lea4.o ../ld-new
1154         ../ld-new -melf_x86_64 -pie -o $@ $<
1155 x86_64_mov_to_lea9: x86_64_mov_to_lea5.o ../ld-new
1156         ../ld-new -melf32_x86_64 -o $@ $<
1157 x86_64_mov_to_lea10: x86_64_mov_to_lea6.o ../ld-new
1158         ../ld-new -melf_x86_64 -o $@ $<
1159 x86_64_mov_to_lea11: x86_64_mov_to_lea2.o ../ld-new
1160         ../ld-new -melf32_x86_64 -shared -o $@ $<
1161 x86_64_mov_to_lea12: x86_64_mov_to_lea1.o ../ld-new
1162         ../ld-new -melf_x86_64 -shared -o $@ $<
1163 x86_64_mov_to_lea13: x86_64_mov_to_lea7.o ../ld-new
1164         ../ld-new -melf32_x86_64 -shared -o $@ $<
1165 x86_64_mov_to_lea14: x86_64_mov_to_lea8.o ../ld-new
1166         ../ld-new -melf_x86_64 -shared -o $@ $<
1167 x86_64_mov_to_lea1.stdout: x86_64_mov_to_lea1
1168         $(TEST_OBJDUMP) -dw $< > $@
1169 x86_64_mov_to_lea2.stdout: x86_64_mov_to_lea2
1170         $(TEST_OBJDUMP) -dw $< > $@
1171 x86_64_mov_to_lea3.stdout: x86_64_mov_to_lea3
1172         $(TEST_OBJDUMP) -dw $< > $@
1173 x86_64_mov_to_lea4.stdout: x86_64_mov_to_lea4
1174         $(TEST_OBJDUMP) -dw $< > $@
1175 x86_64_mov_to_lea5.stdout: x86_64_mov_to_lea5
1176         $(TEST_OBJDUMP) -dw $< > $@
1177 x86_64_mov_to_lea6.stdout: x86_64_mov_to_lea6
1178         $(TEST_OBJDUMP) -dw $< > $@
1179 x86_64_mov_to_lea7.stdout: x86_64_mov_to_lea7
1180         $(TEST_OBJDUMP) -dw $< > $@
1181 x86_64_mov_to_lea8.stdout: x86_64_mov_to_lea8
1182         $(TEST_OBJDUMP) -dw $< > $@
1183 x86_64_mov_to_lea9.stdout: x86_64_mov_to_lea9
1184         $(TEST_OBJDUMP) -dw $< > $@
1185 x86_64_mov_to_lea10.stdout: x86_64_mov_to_lea10
1186         $(TEST_OBJDUMP) -dw $< > $@
1187 x86_64_mov_to_lea11.stdout: x86_64_mov_to_lea11
1188         $(TEST_OBJDUMP) -dw $< > $@
1189 x86_64_mov_to_lea12.stdout: x86_64_mov_to_lea12
1190         $(TEST_OBJDUMP) -dw $< > $@
1191 x86_64_mov_to_lea13.stdout: x86_64_mov_to_lea13
1192         $(TEST_OBJDUMP) -dw $< > $@
1193 x86_64_mov_to_lea14.stdout: x86_64_mov_to_lea14
1194         $(TEST_OBJDUMP) -dw $< > $@
1196 check_SCRIPTS += x86_64_indirect_call_to_direct.sh
1197 check_DATA += x86_64_indirect_call_to_direct1.stdout \
1198         x86_64_indirect_jump_to_direct1.stdout
1199 MOSTLYCLEANFILES += x86_64_indirect_call_to_direct1 \
1200         x86_64_indirect_jump_to_direct1
1202 x86_64_indirect_call_to_direct1.o: x86_64_indirect_call_to_direct1.s
1203         $(TEST_AS) --64 -mrelax-relocations=yes -o $@ $<
1204 x86_64_indirect_call_to_direct1: x86_64_indirect_call_to_direct1.o gcctestdir/ld
1205         gcctestdir/ld -o $@ $<
1206 x86_64_indirect_call_to_direct1.stdout: x86_64_indirect_call_to_direct1
1207         $(TEST_OBJDUMP) -dw $< > $@
1208 x86_64_indirect_jump_to_direct1.o: x86_64_indirect_jump_to_direct1.s
1209         $(TEST_AS) --64 -mrelax-relocations=yes -o $@ $<
1210 x86_64_indirect_jump_to_direct1: x86_64_indirect_jump_to_direct1.o gcctestdir/ld
1211         gcctestdir/ld -o $@ $<
1212 x86_64_indirect_jump_to_direct1.stdout: x86_64_indirect_jump_to_direct1
1213         $(TEST_OBJDUMP) -dw $< > $@
1215 check_SCRIPTS += x86_64_gd_to_le.sh
1216 check_DATA += x86_64_gd_to_le.stdout
1217 MOSTLYCLEANFILES += x86_64_gd_to_le
1219 x86_64_gd_to_le.o: x86_64_gd_to_le.s
1220         $(TEST_AS) --64 -o $@ $<
1221 x86_64_gd_to_le: x86_64_gd_to_le.o gcctestdir/ld
1222         gcctestdir/ld -o $@ $<
1223 x86_64_gd_to_le.stdout: x86_64_gd_to_le
1224         $(TEST_OBJDUMP) -dw $< > $@
1226 check_SCRIPTS += x86_64_overflow_pc32.sh
1227 check_DATA += x86_64_overflow_pc32.err
1228 MOSTLYCLEANFILES += x86_64_overflow_pc32.err
1229 x86_64_overflow_pc32.o: x86_64_overflow_pc32.s
1230         $(TEST_AS) -o $@ $<
1231 x86_64_overflow_pc32.err: x86_64_overflow_pc32.o gcctestdir/ld
1232         @echo gcctestdir/ld -e bar -Tdata=0x81000000 -o x86_64_overflow_pc32 x86_64_overflow_pc32.o "2>$@"
1233         @if gcctestdir/ld -e bar -Tdata=0x81000000 -o x86_64_overflow_pc32 x86_64_overflow_pc32.o 2>$@; \
1234         then \
1235           echo 1>&2 "Link of x86_64_overflow_pc32 should have failed"; \
1236           rm -f $@; \
1237           exit 1; \
1238         fi
1240 check_PROGRAMS += pr17704a_test
1241 pr17704a_test.o: pr17704a_test.s
1242         $(TEST_AS) --64 -o $@ $<
1243 pr17704a_test: pr17704a_test.o gcctestdir/ld
1244         gcctestdir/ld --icf=all -o $@ $<
1246 check_SCRIPTS += x32_overflow_pc32.sh
1247 check_DATA += x32_overflow_pc32.err
1248 MOSTLYCLEANFILES += x32_overflow_pc32.err
1249 x32_overflow_pc32.o: x86_64_overflow_pc32.s
1250         $(TEST_AS) --x32 -o $@ $<
1251 x32_overflow_pc32.err: x32_overflow_pc32.o gcctestdir/ld
1252         @echo gcctestdir/ld -e bar -Tdata=0x81000000 -o x32_overflow_pc32 x32_overflow_pc32.o "2>$@"
1253         @if gcctestdir/ld -e bar -Tdata=0x81000000 -o x32_overflow_pc32 x32_overflow_pc32.o 2>$@; \
1254         then \
1255           echo 1>&2 "Link of x32_overflow_pc32 should have failed"; \
1256           rm -f $@; \
1257           exit 1; \
1258         fi
1260 check_SCRIPTS += pr23016_1.sh
1261 check_DATA += pr23016_1.stdout pr23016_1r.stdout
1262 pr23016_1.stdout: pr23016_1.o
1263         $(TEST_READELF) -rSW $< >$@ 2>/dev/null
1264 pr23016_1.o: pr23016_1a.o pr23016_1b.o gcctestdir/ld
1265         gcctestdir/ld -r -o $@ pr23016_1a.o pr23016_1b.o
1266 pr23016_1r.stdout: pr23016_1r.o
1267         $(TEST_READELF) -rSW $< >$@ 2>/dev/null
1268 pr23016_1r.o: pr23016_1a.o pr23016_1b.o gcctestdir/ld
1269         gcctestdir/ld -r -o $@ pr23016_1b.o pr23016_1a.o
1270 pr23016_1a.o: pr23016_1a.s
1271         $(TEST_AS) -o $@ $<
1272 pr23016_1b.o: pr23016_1b.s
1273         $(TEST_AS) -o $@ $<
1275 check_SCRIPTS += pr23016_2.sh
1276 check_DATA += pr23016_2.stdout
1277 pr23016_2.stdout: pr23016_2.o
1278         $(TEST_READELF) -rW $< >$@ 2>/dev/null
1279 pr23016_2.o: pr23016_2a.o pr23016_2b.o gcctestdir/ld
1280         gcctestdir/ld -r -o $@ pr23016_2a.o pr23016_2b.o
1281 pr23016_2a.o: pr23016_2a.s
1282         $(TEST_AS) -o $@ $<
1283 pr23016_2b.o: pr23016_2b.s
1284         $(TEST_AS) -o $@ $<
1286 endif DEFAULT_TARGET_X86_64
1288 if DEFAULT_TARGET_X86_64_OR_X32
1290 check_PROGRAMS += pr20216a_test
1291 pr20216a_test_SOURCES = pr20216_main.c pr20216_def.c
1292 pr20216a_test_DEPENDENCIES = pr20216_gd.o pr20216_ld.o gcctestdir/ld gcctestdir/as
1293 pr20216a_test_CFLAGS = -fPIE
1294 pr20216a_test_LDFLAGS = -Wl,-R,.
1295 pr20216a_test_LDADD = pr20216_gd.o pr20216_ld.o
1297 check_PROGRAMS += pr20216b_test
1298 pr20216b_test_SOURCES = pr20216_main.c pr20216_def.c
1299 pr20216b_test_DEPENDENCIES = pr20216_gd.o pr20216_ld.o gcctestdir/ld gcctestdir/as
1300 pr20216b_test_CFLAGS = -fPIE
1301 pr20216b_test_LDFLAGS = -pie -Wl,-R,.
1302 pr20216b_test_LDADD = pr20216_gd.o pr20216_ld.o
1304 check_PROGRAMS += pr20216c_test
1305 pr20216c_test_SOURCES = pr20216_main.c pr20216_def.c
1306 pr20216c_test_DEPENDENCIES = pr20216_gd.o pr20216_ld.o gcctestdir/ld gcctestdir/as
1307 pr20216c_test_CFLAGS = -fPIE
1308 pr20216c_test_LDFLAGS = -static -Wl,-R,.
1309 pr20216c_test_LDADD = pr20216_gd.o pr20216_ld.o
1311 check_PROGRAMS += pr20216d_test
1312 pr20216d_test_SOURCES = pr20216_main.c pr20216_def.c
1313 pr20216d_test_DEPENDENCIES = pr20216a.so gcctestdir/ld gcctestdir/as
1314 pr20216d_test_CFLAGS = -fPIE
1315 pr20216d_test_LDFLAGS = -Wl,-R,.
1316 pr20216d_test_LDADD = pr20216a.so
1318 check_PROGRAMS += pr20216e_test
1319 pr20216e_test_SOURCES = pr20216_main.c
1320 pr20216e_test_DEPENDENCIES = pr20216_gd.o pr20216_ld.o pr20216b.so gcctestdir/ld gcctestdir/as
1321 pr20216e_test_CFLAGS = -fPIE
1322 pr20216e_test_LDFLAGS = -Wl,-R,.
1323 pr20216e_test_LDADD = pr20216_gd.o pr20216_ld.o pr20216b.so
1325 MOSTLYCLEANFILES += pr20216a.so pr20216b.so
1327 pr20216a.so: pr20216_gd.o pr20216_ld.o gcctestdir/ld
1328         $(LINK) -shared pr20216_gd.o pr20216_ld.o
1330 pr20216b.so: pr20216_def.o gcctestdir/ld
1331         $(LINK) -shared pr20216_def.o
1333 pr20216_gd.o: pr20216_gd.S gcctestdir/as
1334         $(COMPILE) -c -o $@ $<
1336 pr20216_ld.o: pr20216_ld.S gcctestdir/as
1337         $(COMPILE) -c -o $@ $<
1339 endif DEFAULT_TARGET_X86_64_OR_X32
1341 if DEFAULT_TARGET_I386
1343 check_SCRIPTS += i386_mov_to_lea.sh
1344 check_DATA += i386_mov_to_lea1.stdout i386_mov_to_lea2.stdout \
1345         i386_mov_to_lea3.stdout i386_mov_to_lea4.stdout \
1346         i386_mov_to_lea5.stdout i386_mov_to_lea6.stdout \
1347         i386_mov_to_lea7.stdout i386_mov_to_lea8.stdout
1348 MOSTLYCLEANFILES += i386_mov_to_lea1 i386_mov_to_lea2 i386_mov_to_lea3 \
1349         i386_mov_to_lea4 i386_mov_to_lea5 i386_mov_to_lea6 \
1350         i386_mov_to_lea7 i386_mov_to_lea8
1352 i386_mov_to_lea1.o: i386_mov_to_lea1.s
1353         $(TEST_AS) --32 -o $@ $<
1354 i386_mov_to_lea2.o: i386_mov_to_lea2.s
1355         $(TEST_AS) --32 -o $@ $<
1356 i386_mov_to_lea3.o: i386_mov_to_lea3.s
1357         $(TEST_AS) --32 -o $@ $<
1358 i386_mov_to_lea4.o: i386_mov_to_lea4.s
1359         $(TEST_AS) --32 -o $@ $<
1360 i386_mov_to_lea5.o: i386_mov_to_lea5.s
1361         $(TEST_AS) --32 -o $@ $<
1362 i386_mov_to_lea1: i386_mov_to_lea1.o ../ld-new
1363         ../ld-new -Bsymbolic -shared -melf_i386 -o $@ $<
1364 i386_mov_to_lea2: i386_mov_to_lea1.o ../ld-new
1365         ../ld-new -pie -melf_i386 -o $@ $<
1366 i386_mov_to_lea3: i386_mov_to_lea1.o ../ld-new
1367         ../ld-new -melf_i386 -o $@ $<
1368 i386_mov_to_lea4: i386_mov_to_lea1.o ../ld-new
1369         ../ld-new -melf_i386 -shared -o $@ $<
1370 i386_mov_to_lea5: i386_mov_to_lea2.o ../ld-new
1371         ../ld-new -melf_i386 -shared -o $@ $<
1372 i386_mov_to_lea6: i386_mov_to_lea3.o ../ld-new
1373         ../ld-new -melf_i386 -shared -o $@ $<
1374 i386_mov_to_lea7: i386_mov_to_lea4.o ../ld-new
1375         ../ld-new -melf_i386 -shared -o $@ $<
1376 i386_mov_to_lea8: i386_mov_to_lea5.o ../ld-new
1377         ../ld-new -melf_i386 -shared -o $@ $<
1378 i386_mov_to_lea1.stdout: i386_mov_to_lea1
1379         $(TEST_OBJDUMP) -dw $< > $@
1380 i386_mov_to_lea2.stdout: i386_mov_to_lea2
1381         $(TEST_OBJDUMP) -dw $< > $@
1382 i386_mov_to_lea3.stdout: i386_mov_to_lea3
1383         $(TEST_OBJDUMP) -dw $< > $@
1384 i386_mov_to_lea4.stdout: i386_mov_to_lea4
1385         $(TEST_OBJDUMP) -dw $< > $@
1386 i386_mov_to_lea5.stdout: i386_mov_to_lea5
1387         $(TEST_OBJDUMP) -dw $< > $@
1388 i386_mov_to_lea6.stdout: i386_mov_to_lea6
1389         $(TEST_OBJDUMP) -dw $< > $@
1390 i386_mov_to_lea7.stdout: i386_mov_to_lea7
1391         $(TEST_OBJDUMP) -dw $< > $@
1392 i386_mov_to_lea8.stdout: i386_mov_to_lea8
1393         $(TEST_OBJDUMP) -dw $< > $@
1395 check_PROGRAMS += pr20308a_test
1396 pr20308a_test_SOURCES = pr20308_main.c pr20308_def.c
1397 pr20308a_test_DEPENDENCIES = pr20308_gd.o pr20308_ld.o gcctestdir/ld gcctestdir/as
1398 pr20308a_test_CFLAGS = -fPIE
1399 pr20308a_test_LDFLAGS = -Wl,-R,.
1400 pr20308a_test_LDADD = pr20308_gd.o pr20308_ld.o
1402 check_PROGRAMS += pr20308b_test
1403 pr20308b_test_SOURCES = pr20308_main.c pr20308_def.c
1404 pr20308b_test_DEPENDENCIES = pr20308_gd.o pr20308_ld.o gcctestdir/ld gcctestdir/as
1405 pr20308b_test_CFLAGS = -fPIE
1406 pr20308b_test_LDFLAGS = -pie -Wl,-R,.
1407 pr20308b_test_LDADD = pr20308_gd.o pr20308_ld.o
1409 check_PROGRAMS += pr20308c_test
1410 pr20308c_test_SOURCES = pr20308_main.c pr20308_def.c
1411 pr20308c_test_DEPENDENCIES = pr20308_gd.o pr20308_ld.o gcctestdir/ld gcctestdir/as
1412 pr20308c_test_CFLAGS = -fPIE
1413 pr20308c_test_LDFLAGS = -static -Wl,-R,.
1414 pr20308c_test_LDADD = pr20308_gd.o pr20308_ld.o
1416 check_PROGRAMS += pr20308d_test
1417 pr20308d_test_SOURCES = pr20308_main.c pr20308_def.c
1418 pr20308d_test_DEPENDENCIES = pr20308a.so gcctestdir/ld gcctestdir/as
1419 pr20308d_test_CFLAGS = -fPIE
1420 pr20308d_test_LDFLAGS = -Wl,-R,.
1421 pr20308d_test_LDADD = pr20308a.so
1423 check_PROGRAMS += pr20308e_test
1424 pr20308e_test_SOURCES = pr20308_main.c
1425 pr20308e_test_DEPENDENCIES = pr20308_gd.o pr20308_ld.o pr20308b.so gcctestdir/ld gcctestdir/as
1426 pr20308e_test_CFLAGS = -fPIE
1427 pr20308e_test_LDFLAGS = -Wl,-R,.
1428 pr20308e_test_LDADD = pr20308_gd.o pr20308_ld.o pr20308b.so
1430 MOSTLYCLEANFILES += pr20308a.so pr20308b.so
1432 pr20308a.so: pr20308_gd.o pr20308_ld.o gcctestdir/ld
1433         $(LINK) -shared pr20308_gd.o pr20308_ld.o
1435 pr20308b.so: pr20308_def.o gcctestdir/ld
1436         $(LINK) -shared pr20308_def.o
1438 pr20308_gd.o: pr20308_gd.S gcctestdir/as
1439         $(COMPILE) -c -o $@ $<
1441 pr20308_ld.o: pr20308_ld.S gcctestdir/as
1442         $(COMPILE) -c -o $@ $<
1444 endif DEFAULT_TARGET_I386
1446 check_PROGRAMS += many_sections_test
1447 many_sections_test_SOURCES = many_sections_test.cc
1448 many_sections_test_DEPENDENCIES = gcctestdir/ld
1449 many_sections_test_LDFLAGS = -rdynamic
1450 many_sections_test_LDADD =
1452 BUILT_SOURCES += many_sections_define.h
1453 MOSTLYCLEANFILES += many_sections_define.h
1454 many_sections_define.h:
1455         (for i in `seq 1 70000`; do \
1456            echo "int var_$$i __attribute__((section(\"section_$$i\"))) = $$i;"; \
1457          done) > $@.tmp
1458         mv -f $@.tmp $@
1460 BUILT_SOURCES += many_sections_check.h
1461 MOSTLYCLEANFILES += many_sections_check.h
1462 many_sections_check.h:
1463         (for i in `seq 1 1000 70000`; do \
1464            echo "assert(var_$$i == $$i);"; \
1465          done) > $@.tmp
1466         mv -f $@.tmp $@
1468 check_PROGRAMS += many_sections_r_test
1469 many_sections_r_test.o: many_sections_test.o gcctestdir/ld
1470         gcctestdir/ld -r -o $@ many_sections_test.o
1471 many_sections_r_test: many_sections_r_test.o gcctestdir/ld
1472         $(CXXLINK) many_sections_r_test.o $(LIBS)
1474 check_SCRIPTS += file_in_many_sections_test.sh
1475 check_DATA += file_in_many_sections.stdout
1476 MOSTLYCLEANFILES += file_in_many_sections
1477 file_in_many_sections.o: file_in_many_sections.c many_sections_define.h
1478         $(COMPILE) -c -fdata-sections -o $@ $(srcdir)/file_in_many_sections.c
1479 file_in_many_sections: file_in_many_sections.o gcctestdir/ld
1480         $(LINK) file_in_many_sections.o -Wl,--gc-sections
1481 file_in_many_sections.stdout: file_in_many_sections
1482         $(TEST_READELF) -sW $< > $@
1484 check_PROGRAMS += initpri1
1485 initpri1_SOURCES = initpri1.c
1486 initpri1_DEPENDENCIES = gcctestdir/ld
1487 initpri1_LDADD =
1489 check_PROGRAMS += initpri2
1490 initpri2_SOURCES = initpri2.c
1491 initpri2_DEPENDENCIES = gcctestdir/ld
1492 initpri2_LDFLAGS = -Wl,--ctors-in-init-array
1493 initpri2_LDADD =
1495 check_PROGRAMS += initpri3a
1496 initpri3a_SOURCES = initpri3.c
1497 initpri3a_DEPENDENCIES = gcctestdir/ld
1498 initpri3a_LDADD =
1500 # This test fails on targets not using .ctors and .dtors sections (e.g. ARM
1501 # EABI). Given that gcc is moving towards using .init_array in all cases,
1502 # this test is commented out.  A better fix would be checking whether gcc
1503 # uses .ctors or .init_array sections in configure.
1505 # check_PROGRAMS += initpri3b
1506 # initpri3b_SOURCES = initpri3.c
1507 # initpri3b_DEPENDENCIES = gcctestdir/ld
1508 # initpri3b_LDFLAGS = -Wl,--no-ctors-in-init-array
1509 # initpri3b_LDADD =
1511 # Test --detect-odr-violations
1512 check_SCRIPTS += debug_msg.sh
1514 # Create the data files that debug_msg.sh analyzes.
1515 check_DATA += debug_msg.err
1516 MOSTLYCLEANFILES += debug_msg.err
1517 debug_msg.o: debug_msg.cc
1518         $(CXXCOMPILE) -O0 -g -c -w -o $@ $(srcdir)/debug_msg.cc
1519 odr_violation1.o: odr_violation1.cc
1520         $(CXXCOMPILE) -O0 -g -c -w -o $@ $(srcdir)/odr_violation1.cc
1521 # Compile with different optimization flags to check that rearranged
1522 # instructions don't cause a false positive.
1523 odr_violation2.o: odr_violation2.cc
1524         $(CXXCOMPILE) -O2 -g -c -w -o $@ $(srcdir)/odr_violation2.cc
1525 debug_msg.err: debug_msg.o odr_violation1.o odr_violation2.o gcctestdir/ld
1526         @echo $(CXXLINK) -Wl,--detect-odr-violations -o debug_msg debug_msg.o odr_violation1.o odr_violation2.o "2>$@"
1527         @if $(CXXLINK) -Wl,--detect-odr-violations -o debug_msg debug_msg.o odr_violation1.o odr_violation2.o 2>$@; \
1528         then \
1529           echo 1>&2 "Link of debug_msg should have failed"; \
1530           rm -f $@; \
1531           exit 1; \
1532         fi
1534 # Test error message when a vtable is undefined.
1535 check_SCRIPTS += missing_key_func.sh
1536 check_DATA += missing_key_func.err
1537 MOSTLYCLEANFILES += missing_key_func.err
1538 missing_key_func.o: missing_key_func.cc
1539         $(CXXCOMPILE) -O0 -g -c -o $@ $(srcdir)/missing_key_func.cc
1540 missing_key_func.err: missing_key_func.o gcctestdir/ld
1541         @echo $(CXXLINK) -o missing_key_func missing_key_func.o "2>$@"
1542         @if $(CXXLINK) -o missing_key_func missing_key_func.o 2>$@; \
1543         then \
1544           echo 1>&2 "Link of missing_key_func should have failed"; \
1545           rm -f $@; \
1546           exit 1; \
1547         fi
1549 # Check that --detect-odr-violations works with compressed debug sections.
1550 check_DATA += debug_msg_cdebug.err
1551 MOSTLYCLEANFILES += debug_msg_cdebug.err
1552 debug_msg_cdebug.o: debug_msg.cc gcctestdir/as
1553         $(CXXCOMPILE) -O0 -g -Wa,--compress-debug-sections -c -w -o $@ $(srcdir)/debug_msg.cc
1554 odr_violation1_cdebug.o: odr_violation1.cc gcctestdir/as
1555         $(CXXCOMPILE) -O0 -g -Wa,--compress-debug-sections -c -w -o $@ $(srcdir)/odr_violation1.cc
1556 odr_violation2_cdebug.o: odr_violation2.cc gcctestdir/as
1557         $(CXXCOMPILE) -O2 -g -Wa,--compress-debug-sections -c -w -o $@ $(srcdir)/odr_violation2.cc
1558 debug_msg_cdebug.err: debug_msg_cdebug.o odr_violation1_cdebug.o odr_violation2_cdebug.o gcctestdir/ld
1559         @echo $(CXXLINK) -Wl,--detect-odr-violations -o debug_msg_cdebug debug_msg_cdebug.o odr_violation1_cdebug.o odr_violation2_cdebug.o "2>$@"
1560         @if $(CXXLINK) -Wl,--detect-odr-violations -o debug_msg_cdebug debug_msg_cdebug.o odr_violation1_cdebug.o odr_violation2_cdebug.o 2>$@; \
1561         then \
1562           echo 1>&2 "Link of debug_msg_cdebug should have failed"; \
1563           rm -f $@; \
1564           exit 1; \
1565         fi
1566 check_DATA += debug_msg_cdebug_gabi.err
1567 MOSTLYCLEANFILES += debug_msg_cdebug_gabi.err
1568 debug_msg_cdebug_gabi.o: debug_msg.cc gcctestdir/as
1569         $(CXXCOMPILE) -O0 -g -Wa,--compress-debug-sections=zlib-gabi -c -w -o $@ $(srcdir)/debug_msg.cc
1570 odr_violation1_cdebug_gabi.o: odr_violation1.cc gcctestdir/as
1571         $(CXXCOMPILE) -O0 -g -Wa,--compress-debug-sections=zlib-gabi -c -w -o $@ $(srcdir)/odr_violation1.cc
1572 odr_violation2_cdebug_gabi.o: odr_violation2.cc gcctestdir/as
1573         $(CXXCOMPILE) -O2 -g -Wa,--compress-debug-sections=zlib-gabi -c -w -o $@ $(srcdir)/odr_violation2.cc
1574 debug_msg_cdebug_gabi.err: debug_msg_cdebug_gabi.o odr_violation1_cdebug_gabi.o odr_violation2_cdebug_gabi.o gcctestdir/ld
1575         @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>$@"
1576         @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>$@; \
1577         then \
1578           echo 1>&2 "Link of debug_msg_cdebug_gabi should have failed"; \
1579           rm -f $@; \
1580           exit 1; \
1581         fi
1583 # See if we can also detect problems when we're linking .so's, not .o's.
1584 check_DATA += debug_msg_so.err
1585 MOSTLYCLEANFILES += debug_msg_so.err
1586 debug_msg.so: debug_msg.cc gcctestdir/ld
1587         $(CXXCOMPILE) -O0 -g -shared -fPIC -w -o $@ $(srcdir)/debug_msg.cc
1588 odr_violation1.so: odr_violation1.cc gcctestdir/ld
1589         $(CXXCOMPILE) -O0 -g -shared -fPIC -w -o $@ $(srcdir)/odr_violation1.cc
1590 odr_violation2.so: odr_violation2.cc gcctestdir/ld
1591         $(CXXCOMPILE) -O2 -g -shared -fPIC -w -o $@ $(srcdir)/odr_violation2.cc
1592 debug_msg_so.err: debug_msg.so odr_violation1.so odr_violation2.so gcctestdir/ld
1593         @echo $(CXXLINK_S) -Wl,--detect-odr-violations -o debug_msg_so debug_msg.so odr_violation1.so odr_violation2.so "2>$@"
1594         @if $(CXXLINK_S) -Wl,--detect-odr-violations -o debug_msg_so debug_msg.so odr_violation1.so odr_violation2.so 2>$@; \
1595         then \
1596           echo 1>&2 "Link of debug_msg_so should have failed"; \
1597           rm -f $@; \
1598           exit 1; \
1599         fi
1601 # We also want to make sure we do something reasonable when there's no
1602 # debug info available.  For the best test, we use .so's.
1603 check_DATA += debug_msg_ndebug.err
1604 MOSTLYCLEANFILES += debug_msg_ndebug.err
1605 debug_msg_ndebug.so: debug_msg.cc gcctestdir/ld
1606         $(CXXCOMPILE) -O0 -g0 -shared -fPIC -w -o $@ $(srcdir)/debug_msg.cc
1607 odr_violation1_ndebug.so: odr_violation1.cc gcctestdir/ld
1608         $(CXXCOMPILE) -O0 -g0 -shared -fPIC -w -o $@ $(srcdir)/odr_violation1.cc
1609 odr_violation2_ndebug.so: odr_violation2.cc gcctestdir/ld
1610         $(CXXCOMPILE) -O2 -g0 -shared -fPIC -w -o $@ $(srcdir)/odr_violation2.cc
1611 debug_msg_ndebug.err: debug_msg_ndebug.so odr_violation1_ndebug.so odr_violation2_ndebug.so gcctestdir/ld
1612         @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>$@"
1613         @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>$@; \
1614         then \
1615           echo 1>&2 "Link of debug_msg_ndebug should have failed"; \
1616           rm -f $@; \
1617           exit 1; \
1618         fi
1621 # Similar to --detect-odr-violations: check for undefined symbols in .so's
1622 check_SCRIPTS += undef_symbol.sh
1623 check_DATA += undef_symbol.err
1624 MOSTLYCLEANFILES += undef_symbol.err
1625 undef_symbol.o: undef_symbol.cc
1626         $(CXXCOMPILE) -O0 -g -c -fPIC $<
1627 undef_symbol.so: undef_symbol.o gcctestdir/ld
1628         $(CXXLINK) -shared undef_symbol.o
1629 undef_symbol.err: undef_symbol_main.o undef_symbol.so gcctestdir/ld
1630         @echo $(CXXLINK) -o undef_symbol_test undef_symbol_main.o undef_symbol.so "2>$@"
1631         @if $(CXXLINK) -o undef_symbol_test undef_symbol_main.o undef_symbol.so 2>$@; \
1632         then \
1633           echo 1>&2 "Link of undef_symbol_test should have failed"; \
1634           rm -f $@; \
1635           exit 1; \
1636         fi
1639 # Test -o when emitting to a special file (such as something in /dev).
1640 check_PROGRAMS += flagstest_o_specialfile
1641 flagstest_o_specialfile: flagstest_debug.o gcctestdir/ld
1642         $(CXXLINK) -o /dev/stdout $< 2>&1 | cat > $@
1643         chmod a+x $@
1644         test -s $@
1646 # Test --compress-debug-sections.
1647 check_PROGRAMS += flagstest_compress_debug_sections_none
1648 check_DATA += flagstest_compress_debug_sections_none.stdout
1649 flagstest_compress_debug_sections_none: flagstest_debug.o gcctestdir/ld
1650         $(CXXLINK) -o $@ $< -Wl,--compress-debug-sections=none
1651         test -s $@
1653 # Dump DWARF debug sections.
1654 flagstest_compress_debug_sections_none.stdout: flagstest_compress_debug_sections_none
1655         $(TEST_READELF) -w $< > $@.tmp
1656         mv -f $@.tmp $@
1658 check_PROGRAMS += flagstest_compress_debug_sections
1659 check_DATA += flagstest_compress_debug_sections.stdout \
1660               flagstest_compress_debug_sections.cmp \
1661               flagstest_compress_debug_sections.check
1662 MOSTLYCLEANFILES += flagstest_compress_debug_sections.check \
1663                     flagstest_compress_debug_sections.cmp
1664 flagstest_compress_debug_sections: flagstest_debug.o gcctestdir/ld
1665         $(CXXLINK) -o $@ $< -Wl,--compress-debug-sections=zlib
1666         test -s $@
1668 # Test --compress-debug-sections with --build-id=tree.
1669 check_PROGRAMS += flagstest_compress_debug_sections_and_build_id_tree
1670 flagstest_compress_debug_sections_and_build_id_tree: flagstest_debug.o gcctestdir/ld
1671         $(CXXLINK) -o $@ $< -Wl,--compress-debug-sections=zlib \
1672                 -Wl,--build-id=tree \
1673                 -Wl,--build-id-chunk-size-for-treehash=4096 \
1674                 -Wl,--build-id-min-file-size-for-treehash=0
1675         test -s $@
1677 # Dump compressed DWARF debug sections.
1678 flagstest_compress_debug_sections.stdout: flagstest_compress_debug_sections
1679         $(TEST_READELF) -w $< | sed -e "s/.zdebug_/.debug_/" > $@.tmp
1680         mv -f $@.tmp $@
1682 # Check there are compressed DWARF .debug_* sections.
1683 flagstest_compress_debug_sections.check: flagstest_compress_debug_sections
1684         $(TEST_READELF) -SW $< | egrep ".debug_.* C *" > $@.tmp
1685         mv -f $@.tmp $@
1687 # Compare DWARF debug info.
1688 flagstest_compress_debug_sections.cmp: flagstest_compress_debug_sections.stdout \
1689         flagstest_compress_debug_sections_none.stdout
1690         cmp flagstest_compress_debug_sections.stdout \
1691                 flagstest_compress_debug_sections_none.stdout > $@.tmp
1692         mv -f $@.tmp $@
1694 check_PROGRAMS += flagstest_compress_debug_sections_gnu
1695 check_DATA += flagstest_compress_debug_sections_gnu.stdout \
1696               flagstest_compress_debug_sections_gnu.cmp \
1697               flagstest_compress_debug_sections_gnu.check
1698 MOSTLYCLEANFILES += flagstest_compress_debug_sections_gnu.check \
1699                     flagstest_compress_debug_sections_gnu.cmp
1700 flagstest_compress_debug_sections_gnu: flagstest_debug.o gcctestdir/ld
1701         $(CXXLINK) -o $@ $< -Wl,--compress-debug-sections=zlib-gnu
1702         test -s $@
1704 # Dump compressed DWARF debug sections.
1705 flagstest_compress_debug_sections_gnu.stdout: flagstest_compress_debug_sections_gnu
1706         $(TEST_READELF) -w $< | sed -e "s/.zdebug_/.debug_/" > $@.tmp
1707         mv -f $@.tmp $@
1709 # Check there are compressed DWARF .zdebug_* sections.
1710 flagstest_compress_debug_sections_gnu.check: flagstest_compress_debug_sections_gnu
1711         $(TEST_READELF) -SW $< | grep ".zdebug_" > $@.tmp
1712         mv -f $@.tmp $@
1714 # Compare DWARF debug info.
1715 flagstest_compress_debug_sections_gnu.cmp: flagstest_compress_debug_sections_gnu.stdout \
1716         flagstest_compress_debug_sections_none.stdout
1717         cmp flagstest_compress_debug_sections_gnu.stdout \
1718                 flagstest_compress_debug_sections_none.stdout > $@.tmp
1719         mv -f $@.tmp $@
1721 check_PROGRAMS += flagstest_compress_debug_sections_gabi
1722 check_DATA += flagstest_compress_debug_sections_gabi.stdout \
1723               flagstest_compress_debug_sections_gabi.cmp \
1724               flagstest_compress_debug_sections_gabi.check
1725 MOSTLYCLEANFILES += flagstest_compress_debug_sections_gabi.cmp \
1726                     flagstest_compress_debug_sections_gabi.check
1727 flagstest_compress_debug_sections_gabi: flagstest_debug.o gcctestdir/ld
1728         $(CXXLINK) -o $@ $< -Wl,--compress-debug-sections=zlib-gabi
1729         test -s $@
1731 # Dump compressed DWARF debug sections.
1732 flagstest_compress_debug_sections_gabi.stdout: flagstest_compress_debug_sections_gabi
1733         $(TEST_READELF) -w $< > $@.tmp
1734         mv -f $@.tmp $@
1736 # Check there are compressed DWARF .debug_* sections.
1737 flagstest_compress_debug_sections_gabi.check: flagstest_compress_debug_sections_gabi
1738         $(TEST_READELF) -tW $< | grep "COMPRESSED" > $@.tmp
1739         mv -f $@.tmp $@
1741 # Compare DWARF debug info.
1742 flagstest_compress_debug_sections_gabi.cmp: flagstest_compress_debug_sections_gabi.stdout \
1743         flagstest_compress_debug_sections_none.stdout
1744         cmp flagstest_compress_debug_sections_gabi.stdout \
1745                 flagstest_compress_debug_sections_none.stdout > $@.tmp
1746         mv -f $@.tmp $@
1748 # The specialfile output has a tricky case when we also compress debug
1749 # sections, because it requires output-file resizing.
1750 check_PROGRAMS += flagstest_o_specialfile_and_compress_debug_sections
1751 flagstest_o_specialfile_and_compress_debug_sections: flagstest_debug.o \
1752                 gcctestdir/ld
1753         $(CXXLINK) -o /dev/stdout $< -Wl,--compress-debug-sections=zlib 2>&1 | cat > $@
1754         chmod a+x $@
1755         test -s $@
1757 check_SCRIPTS += pr18689.sh
1758 check_DATA += pr18689.stdout
1759 MOSTLYCLEANFILES += pr18689a.o pr18689b.o
1761 pr18689.stdout: pr18689b.o
1762         $(TEST_READELF) -SW $< > $@
1764 pr18689a.o: pr18689.o ../ld-new
1765         ../ld-new -r -o $@ $<
1767 pr18689b.o: pr18689a.o ../ld-new
1768         ../ld-new -r -o $@ $<
1770 pr18689.o: pr18689.c gcctestdir/as
1771         $(COMPILE) -ggdb3 -g -Wa,--compress-debug-sections=zlib-gabi -c -w -o $@ $(srcdir)/pr18689.c
1773 # Test -TText and -Tdata.
1774 check_PROGRAMS += flagstest_o_ttext_1
1775 flagstest_o_ttext_1: flagstest_debug.o gcctestdir/ld
1776         $(CXXLINK) -o $@ $< -Wl,-Ttext,0x400000 -Wl,-Tdata,0x800000
1778 # This version won't be runnable, because there is no way to put the
1779 # PT_PHDR segment at file offset 0.  We just make sure that we can
1780 # build it without error.
1781 check_DATA += flagstest_o_ttext_2
1782 MOSTLYCLEANFILES += flagstest_o_ttext_2
1783 flagstest_o_ttext_2: flagstest_debug.o gcctestdir/ld
1784         $(CXXLINK) -o $@ $< -Wl,-Ttext,0x400010 -Wl,-Tdata,0x800010
1786 # Test symbol versioning.
1787 check_PROGRAMS += ver_test
1788 ver_test_SOURCES = ver_test_main.cc
1789 ver_test_DEPENDENCIES = gcctestdir/ld ver_test_1.so ver_test_2.so ver_test_4.so
1790 ver_test_LDFLAGS = -Wl,-R,.
1791 ver_test_LDADD = ver_test_1.so ver_test_2.so ver_test_4.so
1792 ver_test_1.so: ver_test_1.o ver_test_2.so ver_test_3.o ver_test_4.so gcctestdir/ld
1793         $(CXXLINK) -shared ver_test_1.o ver_test_2.so ver_test_3.o ver_test_4.so
1794 ver_test_2.so: ver_test_2.o $(srcdir)/ver_test_2.script ver_test_4.so gcctestdir/ld
1795         $(CXXLINK) -shared -Wl,--version-script,$(srcdir)/ver_test_2.script -Wl,-R,. ver_test_2.o ver_test_4.so
1796 ver_test_4.so: ver_test_4.o $(srcdir)/ver_test_4.script gcctestdir/ld
1797         $(CXXLINK) -shared -Wl,--version-script,$(srcdir)/ver_test_4.script ver_test_4.o
1798 ver_test_1.o: ver_test_1.cc
1799         $(CXXCOMPILE) -c -fpic -o $@ $<
1800 ver_test_2.o: ver_test_2.cc
1801         $(CXXCOMPILE) -c -fpic -o $@ $<
1802 ver_test_3.o: ver_test_3.cc
1803         $(CXXCOMPILE) -c -fpic -o $@ $<
1804 ver_test_4.o: ver_test_4.cc
1805         $(CXXCOMPILE) -c -fpic -o $@ $<
1807 check_SCRIPTS += ver_test_1.sh
1808 check_DATA += ver_test_1.syms
1809 ver_test_1.syms: ver_test_1.so
1810         $(TEST_READELF) -s $< >$@ 2>/dev/null
1812 check_PROGRAMS += ver_test_2
1813 ver_test_2_SOURCES = ver_test_main_2.cc
1814 ver_test_2_DEPENDENCIES = gcctestdir/ld ver_test_4.so ver_test_2.so
1815 ver_test_2_LDFLAGS = -Wl,-R,.
1816 ver_test_2_LDADD = ver_test_4.so ver_test_2.so
1818 check_SCRIPTS += ver_test_2.sh
1819 check_DATA += ver_test_2.syms
1820 ver_test_2.syms: ver_test_2
1821         $(TEST_READELF) -s $< >$@ 2>/dev/null
1823 check_SCRIPTS += ver_test_4.sh
1824 check_DATA += ver_test_4.syms
1825 ver_test_4.syms: ver_test_4.so
1826         $(TEST_READELF) -s $< >$@ 2>/dev/null
1828 ver_test_5.so: ver_test_5.o $(srcdir)/ver_test_5.script ver_test_4.so gcctestdir/ld
1829         $(CXXLINK) -shared -Wl,--version-script,$(srcdir)/ver_test_5.script ver_test_5.o ver_test_4.so
1830 ver_test_5.o: ver_test_5.cc
1831         $(CXXCOMPILE) -c -fpic -o $@ $<
1832 check_SCRIPTS += ver_test_5.sh
1833 check_DATA += ver_test_5.syms
1834 ver_test_5.syms: ver_test_5.so
1835         $(TEST_READELF) -s $< >$@ 2>/dev/null
1837 check_PROGRAMS += ver_test_6
1838 ver_test_6_SOURCES = ver_test_6.c
1839 ver_test_6_DEPENDENCIES = gcctestdir/ld ver_test_2.so
1840 ver_test_6_LDFLAGS = -Wl,-R,.
1841 ver_test_6_LDADD = ver_test_2.so
1843 ver_test_7.so: ver_test_4.o $(srcdir)/ver_test_4.script ver_test_7.o gcctestdir/ld
1844         $(CXXLINK) -shared -Wl,--version-script,$(srcdir)/ver_test_4.script ver_test_4.o ver_test_7.o
1845 ver_test_7.o: ver_test_7.cc
1846         $(CXXCOMPILE) -c -fpic -o $@ $<
1847 check_SCRIPTS += ver_test_7.sh
1848 check_DATA += ver_test_7.syms
1849 ver_test_7.syms: ver_test_7.so
1850         $(TEST_READELF) -s $< >$@ 2>/dev/null
1852 check_PROGRAMS += ver_test_8
1853 ver_test_8_SOURCES = two_file_test_main.cc
1854 ver_test_8_DEPENDENCIES = gcctestdir/ld ver_test_8_1.so ver_test_8_2.so
1855 ver_test_8_LDFLAGS = -Wl,-R,.
1856 ver_test_8_LDADD = ver_test_8_1.so ver_test_8_2.so
1857 ver_test_8_1.so: two_file_test_1_pic.o two_file_test_1b_pic.o ver_test_8_2.so gcctestdir/ld
1858         $(CXXLINK) -shared two_file_test_1_pic.o two_file_test_1b_pic.o ver_test_8_2.so
1859 ver_test_8_2.so: two_file_test_2_pic.o $(srcdir)/ver_test_8.script gcctestdir/ld
1860         $(CXXLINK) -shared -Wl,--version-script,$(srcdir)/ver_test_8.script two_file_test_2_pic.o
1862 check_SCRIPTS += ver_test_8.sh
1863 check_DATA += ver_test_8_2.so.syms
1864 ver_test_8_2.so.syms: ver_test_8_2.so
1865         $(TEST_READELF) -s $< >$@ 2>/dev/null
1867 check_PROGRAMS += ver_test_9
1868 ver_test_9_SOURCES = ver_test_main.cc
1869 ver_test_9_DEPENDENCIES = gcctestdir/ld ver_test_9.so
1870 ver_test_9_LDFLAGS = -Wl,-R,.
1871 ver_test_9_LDADD = ver_test_9.so
1872 ver_test_9.so: ver_test_9.o ver_test_4.so ver_test_5.so gcctestdir/ld
1873         $(CXXLINK) -shared -Wl,-R,. ver_test_9.o ver_test_5.so ver_test_4.so
1874 ver_test_9.o: ver_test_9.cc
1875         $(CXXCOMPILE) -c -fpic -o $@ $<
1877 check_SCRIPTS += ver_test_10.sh
1878 check_DATA += ver_test_10.syms
1879 ver_test_10.syms: ver_test_10.so
1880         $(TEST_READELF) -s $< >$@ 2>/dev/null
1881 ver_test_10.so: gcctestdir/ld ver_test_2.o ver_test_10.script
1882         $(CXXLINK) -shared -Wl,--version-script,$(srcdir)/ver_test_10.script ver_test_2.o
1884 check_PROGRAMS += ver_test_11
1885 MOSTLYCLEANFILES += ver_test_11.a
1886 ver_test_11_SOURCES = ver_test_main_2.cc
1887 ver_test_11_DEPENDENCIES = gcctestdir/ld ver_test_11.a
1888 ver_test_11_LDFLAGS = -Wl,-R,.
1889 ver_test_11_LDADD = ver_test_11.a
1890 ver_test_11.a: ver_test_1.o ver_test_2.o ver_test_4.o
1891         $(TEST_AR) rc $@ $^
1893 check_PROGRAMS += ver_test_12
1894 ver_test_12_SOURCES = ver_test_main_2.cc
1895 ver_test_12_DEPENDENCIES = gcctestdir/ld ver_test_12.o
1896 ver_test_12_LDFLAGS = -Wl,-R,.
1897 ver_test_12_LDADD = ver_test_12.o
1898 ver_test_12.o: gcctestdir/ld ver_test_1.o ver_test_2.o ver_test_4.o
1899         gcctestdir/ld -r -o $@ ver_test_1.o ver_test_2.o ver_test_4.o
1901 check_SCRIPTS += ver_test_13.sh
1902 check_DATA += ver_test_13.syms
1903 ver_test_13.syms: ver_test_13.so
1904         $(TEST_READELF) -s $< >$@ 2>/dev/null
1905 ver_test_13.so: gcctestdir/ld ver_test_13.o ver_test_13.script
1906         $(LINK) -shared -Wl,--version-script,$(srcdir)/ver_test_13.script ver_test_13.o
1907 ver_test_13.o: ver_test_13.c
1908         $(COMPILE) -c -fpic -o $@ $<
1910 check_SCRIPTS += ver_test_14.sh
1911 check_DATA += ver_test_14.syms
1912 MOSTLYCLEANFILES += ver_test_14
1913 ver_test_14.syms: ver_test_14
1914         $(TEST_OBJDUMP) -T $< | $(TEST_CXXFILT) >$@
1915 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
1916         $(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
1918 check_SCRIPTS += ver_test_pr23409.sh
1919 check_DATA += ver_test_pr23409.syms
1920 ver_test_pr23409.syms: ver_test_pr23409_1.so
1921         $(TEST_READELF) --dyn-syms -W $< >$@
1922 ver_test_pr23409_1.so: gcctestdir/ld ver_test_1.o $(srcdir)/ver_test_pr23409_1.script ver_test_pr23409_2.so
1923         gcctestdir/ld -shared -o $@ ver_test_1.o ver_test_pr23409_2.so --version-script $(srcdir)/ver_test_pr23409_1.script
1924 ver_test_pr23409_2.so: gcctestdir/ld ver_test_1.o $(srcdir)/ver_test_pr23409_2.script
1925         gcctestdir/ld -shared -o $@ ver_test_1.o --version-script $(srcdir)/ver_test_pr23409_2.script
1927 check_SCRIPTS += weak_as_needed.sh
1928 check_DATA += weak_as_needed.stdout
1929 weak_as_needed.stdout: weak_as_needed_a.so
1930         $(TEST_READELF) -dW --dyn-syms $< >$@
1931 weak_as_needed_a.so: gcctestdir/ld weak_as_needed_a.o weak_as_needed_b.so weak_as_needed_c.so
1932         gcctestdir/ld -shared -rpath . -o $@ weak_as_needed_a.o --as-needed weak_as_needed_b.so weak_as_needed_c.so
1933 weak_as_needed_b.so: gcctestdir/ld weak_as_needed_b.o weak_as_needed_b.script
1934         gcctestdir/ld -shared -rpath . -o $@ --version-script $(srcdir)/weak_as_needed_b.script weak_as_needed_b.o
1935 weak_as_needed_c.so: gcctestdir/ld weak_as_needed_c.o weak_as_needed_c.script
1936         gcctestdir/ld -shared -rpath . -o $@ --version-script $(srcdir)/weak_as_needed_c.script weak_as_needed_c.o
1937 weak_as_needed_a.o: weak_as_needed_a.c
1938         $(COMPILE) -c -fpic -o $@ $<
1939 weak_as_needed_b.o: weak_as_needed_b.c
1940         $(COMPILE) -c -fpic -o $@ $<
1941 weak_as_needed_c.o: weak_as_needed_c.c
1942         $(COMPILE) -c -fpic -o $@ $<
1944 check_PROGRAMS += protected_1
1945 protected_1_SOURCES = \
1946         protected_main_1.cc protected_main_2.cc protected_main_3.cc
1947 protected_1_DEPENDENCIES = gcctestdir/ld protected_1.so
1948 protected_1_LDFLAGS = -Wl,-R,.
1949 protected_1_LDADD = protected_1.so
1951 protected_1.so: gcctestdir/ld protected_1_pic.o protected_2_pic.o protected_3_pic.o
1952         $(CXXLINK) -shared protected_1_pic.o protected_2_pic.o protected_3_pic.o
1953 protected_1_pic.o: protected_1.cc
1954         $(CXXCOMPILE) -c -fpic -o $@ $<
1955 protected_2_pic.o: protected_2.cc
1956         $(CXXCOMPILE) -c -fpic -o $@ $<
1957 protected_3_pic.o: protected_3.cc
1958         $(CXXCOMPILE) -c -fpic -o $@ $<
1960 check_PROGRAMS += protected_2
1961 protected_2_SOURCES = protected_main_1.cc protected_3.cc
1962 protected_2_DEPENDENCIES = gcctestdir/ld protected_1.so
1963 protected_2_LDFLAGS = -Wl,-R,.
1964 protected_2_LDADD = protected_1.so
1966 check_DATA += protected_3.err
1967 MOSTLYCLEANFILES += protected_3.err
1968 protected_4_pic.o: protected_4.cc
1969         $(CXXCOMPILE) -c -fpic -o $@ $<
1970 protected_3.err: protected_4_pic.o gcctestdir/ld
1971         @echo $(CXXLINK) -shared -o protected_4.so protected_4_pic.o "2>$@"
1972         @if $(CXXLINK) -shared -o protected_4.so protected_4_pic.o 2>$@; then \
1973           echo 1>&2 "Link of protected_4.so should have failed"; \
1974           rm -f $@; \
1975           exit 1; \
1976         fi
1978 check_PROGRAMS += relro_test
1979 check_SCRIPTS += relro_test.sh
1980 check_DATA += relro_test.stdout
1981 relro_test_SOURCES = relro_test_main.cc
1982 relro_test_DEPENDENCIES = gcctestdir/ld relro_test.so
1983 relro_test_LDFLAGS = -Wl,-R,.
1984 relro_test_LDADD = relro_test.so
1985 relro_test.so: gcctestdir/ld relro_test_pic.o
1986         $(CXXLINK) -shared -Wl,-z,relro relro_test_pic.o
1987 relro_test_pic.o: relro_test.cc
1988         $(CXXCOMPILE) -c -fpic -o $@ $<
1989 relro_test.stdout: relro_test.so
1990         $(TEST_READELF) -SlW relro_test.so > relro_test.stdout
1992 check_PROGRAMS += relro_now_test
1993 relro_now_test_SOURCES = relro_test_main.cc
1994 relro_now_test_DEPENDENCIES = gcctestdir/ld relro_now_test.so
1995 relro_now_test_LDFLAGS = -Wl,-R,. -Wl,-z,relro -Wl,-z,now
1996 relro_now_test_LDADD = relro_now_test.so
1997 relro_now_test.so: gcctestdir/ld relro_test_pic.o
1998         $(CXXLINK) -shared -Wl,-z,relro -Wl,-z,now relro_test_pic.o
2000 check_PROGRAMS += relro_strip_test
2001 relro_strip_test_SOURCES = relro_test_main.cc
2002 relro_strip_test_DEPENDENCIES = gcctestdir/ld relro_strip_test.so
2003 relro_strip_test_LDFLAGS = -Wl,-R,.
2004 relro_strip_test_LDADD = relro_strip_test.so
2005 relro_strip_test.so: relro_test.so
2006         $(TEST_STRIP) -o $@ $<
2008 check_PROGRAMS += relro_script_test
2009 relro_script_test_SOURCES = relro_test_main.cc
2010 relro_script_test_DEPENDENCIES = gcctestdir/ld relro_script_test.so
2011 relro_script_test_LDFLAGS = -Wl,-R,.
2012 relro_script_test_LDADD = relro_script_test.so
2013 relro_script_test.so: gcctestdir/ld relro_script_test.t relro_test_pic.o
2014         $(CXXLINK) -shared -Wl,-z,relro -Wl,-T,$(srcdir)/relro_script_test.t relro_test_pic.o
2016 check_PROGRAMS += script_test_1
2017 script_test_1_SOURCES = script_test_1a.cc script_test_1b.cc
2018 script_test_1_DEPENDENCIES = gcctestdir/ld script_test_1.t
2019 script_test_1_LDFLAGS = -Wl,-R,. -Wl,-T,$(srcdir)/script_test_1.t
2020 script_test_1_LDADD =
2022 check_PROGRAMS += script_test_2
2023 script_test_2_SOURCES = script_test_2.cc script_test_2a.cc script_test_2b.cc
2024 script_test_2_DEPENDENCIES = gcctestdir/ld script_test_2.t
2025 script_test_2_LDFLAGS = -Wl,-R,. -Wl,-T,$(srcdir)/script_test_2.t
2026 script_test_2_LDADD =
2028 check_PROGRAMS += justsyms
2029 justsyms_SOURCES = justsyms_1.cc
2030 justsyms_DEPENDENCIES = gcctestdir/ld justsyms_2r.o
2031 justsyms_LDFLAGS = -Wl,-R,justsyms_2r.o
2032 justsyms_LDADD =
2033 justsyms_2.o: justsyms_2.cc
2034         $(CXXCOMPILE) -c -o $@ $<
2035 justsyms_2r.o: justsyms_2.o gcctestdir/ld $(srcdir)/justsyms.t
2036         gcctestdir/ld -o $@ -r -T $(srcdir)/justsyms.t justsyms_2.o
2038 check_PROGRAMS += justsyms_exec
2039 justsyms_exec_SOURCES = justsyms_exec.c
2040 justsyms_exec_DEPENDENCIES = gcctestdir/ld justsyms_lib
2041 justsyms_exec_LDFLAGS = -Wl,-R,justsyms_lib
2042 justsyms_exec_LDADD =
2043 MOSTLYCLEANFILES += justsyms_lib
2044 justsyms_lib.o: justsyms_lib.c
2045         $(COMPILE) -c -o $@ $<
2046 justsyms_lib: justsyms_lib.o gcctestdir/ld
2047         gcctestdir/ld -o $@ -z norelro -T $(srcdir)/justsyms_lib.t -Ttext=0x1000200 -Tdata=0x2000000 -e exported_func justsyms_lib.o
2049 check_PROGRAMS += binary_test
2050 MOSTLYCLEANFILES += binary.txt
2051 binary_test_SOURCES = binary_test.cc
2052 binary_test_DEPENDENCIES = gcctestdir/ld binary.txt
2053 binary_test_LDFLAGS = -Wl,--format,binary,binary.txt,--format,elf
2054 binary_test_LDADD =
2055 # Copy the file to the build directory to avoid worrying about the
2056 # full pathname in the generated symbols.
2057 binary.txt: $(srcdir)/binary.in
2058         rm -f $@
2059         $(LN_S) $< $@
2061 check_SCRIPTS += ver_matching_test.sh
2062 check_DATA += ver_matching_test.stdout
2063 MOSTLYCLEANFILES += ver_matching_test.stdout
2064 ver_matching_def.so: ver_matching_def_pic.o $(srcdir)/version_script.map gcctestdir/ld
2065         $(CXXLINK) -O0 -shared ver_matching_def_pic.o -Wl,--version-script=$(srcdir)/version_script.map
2066 ver_matching_def_pic.o: ver_matching_def.cc
2067         $(CXXCOMPILE) -O0 -c -fpic -o $@ $<
2068 ver_matching_test.stdout: ver_matching_def.so
2069         $(TEST_OBJDUMP) -T ver_matching_def.so | $(TEST_CXXFILT) > ver_matching_test.stdout
2071 check_PROGRAMS += script_test_3
2072 check_SCRIPTS += script_test_3.sh
2073 check_DATA += script_test_3.stdout
2074 MOSTLYCLEANFILES += script_test_3.stdout
2075 script_test_3: basic_test.o gcctestdir/ld script_test_3.t
2076         $(CXXLINK) basic_test.o -Wl,-T,$(srcdir)/script_test_3.t
2077 script_test_3.stdout: script_test_3
2078         $(TEST_READELF) -SlW script_test_3 > script_test_3.stdout
2080 check_PROGRAMS += tls_phdrs_script_test
2081 tls_phdrs_script_test_SOURCES = $(tls_test_SOURCES)
2082 tls_phdrs_script_test_DEPENDENCIES = $(tls_test_DEPENDENCIES) $(srcdir)/script_test_3.t
2083 tls_phdrs_script_test_LDFLAGS = $(tls_test_LDFLAGS) -Wl,-T,$(srcdir)/script_test_3.t
2084 tls_phdrs_script_test_LDADD = $(tls_test_LDADD)
2086 check_SCRIPTS += script_test_4.sh
2087 check_DATA += script_test_4.stdout
2088 MOSTLYCLEANFILES += script_test_4
2089 script_test_4: basic_test.o gcctestdir/ld $(srcdir)/script_test_4.t
2090         $(CXXLINK) basic_test.o -Wl,-T,$(srcdir)/script_test_4.t
2091 script_test_4.stdout: script_test_4
2092         $(TEST_READELF) -SlW script_test_4 > script_test_4.stdout
2094 check_PROGRAMS += tls_script_test
2095 tls_script_test_SOURCES = $(tls_test_SOURCES)
2096 tls_script_test_DEPENDENCIES = $(tls_test_DEPENDENCIES) $(srcdir)/script_test_4.t
2097 tls_script_test_LDFLAGS = $(tls_test_LDFLAGS) -Wl,-T,$(srcdir)/script_test_4.t
2098 tls_script_test_LDADD = $(tls_test_LDADD)
2100 check_SCRIPTS += script_test_5.sh
2101 check_DATA += script_test_5.stdout
2102 MOSTLYCLEANFILES += script_test_5
2103 script_test_5: script_test_5.o gcctestdir/ld $(srcdir)/script_test_5.t
2104         $(CXXLINK) script_test_5.o -Wl,-T,$(srcdir)/script_test_5.t
2105 script_test_5.stdout: script_test_5
2106         $(TEST_READELF) -SW script_test_5 > script_test_5.stdout
2108 check_SCRIPTS += script_test_6.sh
2109 check_DATA += script_test_6.stdout
2110 MOSTLYCLEANFILES += script_test_6
2111 script_test_6: basic_test.o gcctestdir/ld $(srcdir)/script_test_6.t
2112         $(CXXLINK) basic_test.o -Wl,-T,$(srcdir)/script_test_6.t \
2113         -Wl,-Ttext=0x10001000 -Wl,-Tdata=0x10200000 -Wl,-Tbss=0x10400000
2114 script_test_6.stdout: script_test_6
2115         $(TEST_READELF) -SlW script_test_6 > script_test_6.stdout
2117 check_SCRIPTS += script_test_7.sh
2118 check_DATA += script_test_7.stdout
2119 MOSTLYCLEANFILES += script_test_7
2120 script_test_7: basic_test.o gcctestdir/ld $(srcdir)/script_test_7.t
2121         $(CXXLINK) basic_test.o -Wl,-T,$(srcdir)/script_test_7.t
2122 script_test_7.stdout: script_test_7
2123         $(TEST_READELF) -SlW script_test_7 > script_test_7.stdout
2125 check_SCRIPTS += script_test_8.sh
2126 check_DATA += script_test_8.stdout
2127 MOSTLYCLEANFILES += script_test_8
2128 script_test_8: basic_test.o gcctestdir/ld $(srcdir)/script_test_7.t
2129         $(CXXLINK) basic_test.o -Wl,-T,$(srcdir)/script_test_7.t \
2130         -Wl,-Ttext=0x20001000 -Wl,-Tdata=0x20200000 -Wl,-Tbss=0x20400000
2131 script_test_8.stdout: script_test_8
2132         $(TEST_READELF) -SlW script_test_8 > script_test_8.stdout
2134 check_SCRIPTS += script_test_9.sh
2135 check_DATA += script_test_9.stdout
2136 MOSTLYCLEANFILES += script_test_9
2137 script_test_9.o: script_test_9.cc
2138         $(CXXCOMPILE) -O0 -c -o $@ $<
2139 script_test_9: gcctestdir/ld $(srcdir)/script_test_9.t script_test_9.o
2140         $(CXXLINK) script_test_9.o -Wl,-T,$(srcdir)/script_test_9.t
2141 script_test_9.stdout: script_test_9
2142         $(TEST_READELF) -lW script_test_9 > script_test_9.stdout
2144 # Test scripts with a relocatable link.
2145 # The -g option is necessary to trigger a bug where a section
2146 # declared in a script file is assigned a non-zero starting address.
2147 check_PROGRAMS += script_test_11
2148 script_test_11: gcctestdir/ld script_test_11_r.o
2149         $(LINK) script_test_11_r.o
2150 script_test_11_r.o: gcctestdir/ld $(srcdir)/script_test_11.t script_test_11a.o script_test_11b.o
2151         gcctestdir/ld -r -o $@ -T $(srcdir)/script_test_11.t script_test_11a.o script_test_11b.o
2152 script_test_11a.o: script_test_11a.c
2153         $(COMPILE) -c -g -o $@ $<
2154 script_test_11b.o: script_test_11b.c
2155         $(COMPILE) -c -g -o $@ $<
2157 # Test difference between "*(a b)" and "*(a) *(b)" in input section spec.
2158 check_PROGRAMS += script_test_12
2159 script_test_12: gcctestdir/ld $(srcdir)/script_test_12.t script_test_12a.o script_test_12b.o
2160         $(LINK) -Wl,-T,$(srcdir)/script_test_12.t script_test_12a.o script_test_12b.o
2162 check_PROGRAMS += script_test_12i
2163 script_test_12i: gcctestdir/ld $(srcdir)/script_test_12i.t script_test_12a.o script_test_12b.o
2164         $(LINK) -Wl,-T,$(srcdir)/script_test_12i.t script_test_12a.o script_test_12b.o
2165 script_test_12a.o: script_test_12a.c
2166         $(COMPILE) -O0 -c -o $@ $<
2167 script_test_12b.o: script_test_12b.c
2168         $(COMPILE) -O0 -c -o $@ $<
2170 # Test for ordering internally created sections with a linker script.
2171 check_SCRIPTS += script_test_13.sh
2172 check_DATA += script_test_13.stdout
2173 MOSTLYCLEANFILES += script_test_13
2174 script_test_13.o: script_test_13.c
2175         $(COMPILE) -O0 -c -fPIC -o $@ $<
2176 script_test_13: $(srcdir)/script_test_13.t script_test_13.o gcctestdir/ld
2177         gcctestdir/ld -shared -o $@ script_test_13.o -T $(srcdir)/script_test_13.t
2178 script_test_13.stdout: script_test_13
2179         $(TEST_READELF) -SW script_test_13 > $@
2181 # Test for SORT_BY_INIT_PRIORITY.
2182 check_SCRIPTS += script_test_14.sh
2183 check_DATA += script_test_14.stdout
2184 MOSTLYCLEANFILES += script_test_14
2185 script_test_14.o: script_test_14.s
2186         $(TEST_AS) -o $@ $<
2187 script_test_14: $(srcdir)/script_test_14.t script_test_14.o gcctestdir/ld
2188         gcctestdir/ld -o $@ script_test_14.o -T $(srcdir)/script_test_14.t
2189 script_test_14.stdout: script_test_14
2190         $(TEST_OBJDUMP) -s script_test_14 > $@
2192 # Test BSS section placement at end of segment.
2193 check_SCRIPTS += script_test_15a.sh
2194 check_DATA += script_test_15a.stdout
2195 MOSTLYCLEANFILES += script_test_15a
2196 script_test_15a: $(srcdir)/script_test_15a.t script_test_15.o gcctestdir/ld
2197         gcctestdir/ld -o $@ script_test_15.o -T $(srcdir)/script_test_15a.t
2198 script_test_15a.stdout: script_test_15a
2199         $(TEST_READELF) -lSW script_test_15a > $@
2201 # Test BSS section placement in middle of segment.
2202 check_SCRIPTS += script_test_15b.sh
2203 check_DATA += script_test_15b.stdout
2204 MOSTLYCLEANFILES += script_test_15b
2205 script_test_15b: $(srcdir)/script_test_15b.t script_test_15.o gcctestdir/ld
2206         gcctestdir/ld -o $@ script_test_15.o -T $(srcdir)/script_test_15b.t
2207 script_test_15b.stdout: script_test_15b
2208         $(TEST_READELF) -lSW script_test_15b > $@
2210 # Test orphan BSS section placement.
2211 check_SCRIPTS += script_test_15c.sh
2212 check_DATA += script_test_15c.stdout
2213 MOSTLYCLEANFILES += script_test_15c
2214 script_test_15c: $(srcdir)/script_test_15c.t script_test_15.o gcctestdir/ld
2215         gcctestdir/ld -o $@ script_test_15.o -T $(srcdir)/script_test_15c.t
2216 script_test_15c.stdout: script_test_15c
2217         $(TEST_READELF) -lSW script_test_15c > $@
2219 # Test --dynamic-list, --dynamic-list-data, --dynamic-list-cpp-new,
2220 # and --dynamic-list-cpp-typeinfo
2222 check_SCRIPTS += dynamic_list.sh
2223 check_DATA += dynamic_list.stdout
2224 MOSTLYCLEANFILES += dynamic_list dynamic_list.stdout
2225 dynamic_list: basic_test.o gcctestdir/ld $(srcdir)/dynamic_list.t
2226         $(CXXLINK) basic_test.o \
2227           -Wl,--dynamic-list $(srcdir)/dynamic_list.t \
2228           -Wl,--dynamic-list-data \
2229           -Wl,--dynamic-list-cpp-new \
2230           -Wl,--dynamic-list-cpp-typeinfo
2231 dynamic_list.stdout: dynamic_list
2232         $(TEST_READELF) -W --dyn-syms dynamic_list > dynamic_list.stdout
2234 check_PROGRAMS += dynamic_list_2
2235 dynamic_list_2_SOURCES = dynamic_list_2.cc
2236 dynamic_list_2_DEPENDENCIES = gcctestdir/ld dynamic_list_lib1.so dynamic_list_lib2.so
2237 dynamic_list_2_LDFLAGS = -L. -Wl,-R,. -Wl,--no-as-needed
2238 dynamic_list_2_LDADD = dynamic_list_lib1.so dynamic_list_lib2.so
2240 dynamic_list_lib1.so: gcctestdir/ld dynamic_list_lib1.o
2241         $(CXXLINK) -shared dynamic_list_lib1.o
2242 dynamic_list_lib1.o: dynamic_list_lib1.cc
2243         $(CXXCOMPILE) -c -fpic -o $@ $<
2245 dynamic_list_lib2.so: gcctestdir/ld dynamic_list_lib2.o $(srcdir)/dynamic_list_2.t
2246         $(CXXLINK) -shared -Wl,-Bsymbolic-functions -Wl,--dynamic-list,$(srcdir)/dynamic_list_2.t dynamic_list_lib2.o
2247 dynamic_list_lib2.o: dynamic_list_lib2.cc
2248         $(CXXCOMPILE) -c -fpic -o $@ $<
2250 check_PROGRAMS += thin_archive_test_1
2251 MOSTLYCLEANFILES += libthin1.a libthin3.a libthinall.a \
2252         alt/thin_archive_test_2.o alt/thin_archive_test_4.o \
2253         alt/libthin2.a alt/libthin4.a
2254 thin_archive_test_1_SOURCES = thin_archive_main.cc
2255 thin_archive_test_1_DEPENDENCIES = gcctestdir/ld libthin1.a alt/libthin2.a
2256 thin_archive_test_1_LDFLAGS = -Lalt
2257 thin_archive_test_1_LDADD = libthin1.a -lthin2
2259 check_PROGRAMS += thin_archive_test_2
2260 thin_archive_test_2_SOURCES = thin_archive_main.cc
2261 thin_archive_test_2_DEPENDENCIES = gcctestdir/ld libthinall.a
2262 thin_archive_test_2_LDFLAGS = -L.
2263 thin_archive_test_2_LDADD = -lthinall
2265 libthin1.a: thin_archive_test_1.o alt/thin_archive_test_2.o
2266         rm -f $@
2267         $(TEST_AR) crT $@ $^
2268 alt/libthin2.a: thin_archive_test_3.o alt/thin_archive_test_4.o
2269         rm -f $@
2270         $(TEST_AR) crT $@ $^
2271 libthin3.a: thin_archive_test_1.o alt/thin_archive_test_4.o
2272         rm -f $@
2273         $(TEST_AR) crT $@ $^
2274 alt/libthin4.a: alt/thin_archive_test_2.o thin_archive_test_3.o
2275         rm -f $@
2276         $(TEST_AR) crT $@ $^
2277 libthinall.a: libthin3.a alt/libthin4.a
2278         rm -f $@
2279         $(TEST_AR) crT $@ $^
2280 alt/thin_archive_test_2.o: thin_archive_test_2.cc
2281         test -d alt || mkdir -p alt
2282         $(CXXCOMPILE) -c -o $@ $<
2283 alt/thin_archive_test_4.o: thin_archive_test_4.cc
2284         test -d alt || mkdir -p alt
2285         $(CXXCOMPILE) -c -o $@ $<
2287 if PLUGINS
2289 check_PROGRAMS += plugin_test_1
2290 check_SCRIPTS += plugin_test_1.sh
2291 check_DATA += plugin_test_1.err
2292 MOSTLYCLEANFILES += plugin_test_1.err
2293 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
2294         $(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
2295 plugin_test_1.err: plugin_test_1
2296         @touch plugin_test_1.err
2298 check_PROGRAMS += plugin_test_2
2299 check_SCRIPTS += plugin_test_2.sh
2300 check_DATA += plugin_test_2.err
2301 MOSTLYCLEANFILES += plugin_test_2.err
2302 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
2303         $(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
2304 plugin_test_2.err: plugin_test_2
2305         @touch plugin_test_2.err
2307 check_PROGRAMS += plugin_test_3
2308 check_SCRIPTS += plugin_test_3.sh
2309 check_DATA += plugin_test_3.err
2310 MOSTLYCLEANFILES += plugin_test_3.err
2311 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
2312         $(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
2313 plugin_test_3.err: plugin_test_3
2314         @touch plugin_test_3.err
2316 check_PROGRAMS += plugin_test_4
2317 check_SCRIPTS += plugin_test_4.sh
2318 check_DATA += plugin_test_4.err
2319 MOSTLYCLEANFILES += plugin_test_4.a plugin_test_4.err
2320 plugin_test_4: two_file_test_main.o plugin_test_4.a gcctestdir/ld plugin_test.so
2321         $(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
2322 plugin_test_4.err: plugin_test_4
2323         @touch plugin_test_4.err
2325 plugin_test_4.a: two_file_test_1.o.syms two_file_test_1b.o.syms two_file_test_2.o.syms
2326         $(TEST_AR) cr $@ $^
2328 check_PROGRAMS += plugin_test_5
2329 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
2330         $(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
2332 check_PROGRAMS += plugin_test_6
2333 check_SCRIPTS += plugin_test_6.sh
2334 check_DATA += plugin_test_6.err
2335 MOSTLYCLEANFILES += plugin_test_6.err
2336 plugin_test_6: plugin_common_test_1.o.syms plugin_common_test_2.o.syms gcctestdir/ld plugin_test.so
2337         $(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
2338 plugin_test_6.err: plugin_test_6
2339         @touch plugin_test_6.err
2341 check_PROGRAMS += plugin_test_7
2342 check_SCRIPTS += plugin_test_7.sh
2343 check_DATA += plugin_test_7.err plugin_test_7.o.syms
2344 MOSTLYCLEANFILES += plugin_test_7.err
2345 plugin_test_7: plugin_test_7_1.o plugin_test_7_1.o.syms plugin_test_7_2.o gcctestdir/ld plugin_test.so
2346         $(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
2347 plugin_test_7.o.syms: plugin_test_7
2348         $(TEST_READELF) -sW $< >$@ 2>/dev/null
2349 plugin_test_7_1.o: plugin_test_7_1.c
2350         $(COMPILE) -DLTO -O0 -c -ffunction-sections -fdata-sections -o $@ $<
2351 plugin_test_7_1_orig.o: plugin_test_7_1.c
2352         $(COMPILE) -O0 -c -ffunction-sections -fdata-sections -o $@ $<
2353 plugin_test_7_1.o.syms: plugin_test_7_1_orig.o
2354         $(TEST_READELF) -sW $< >$@ 2>/dev/null
2355 plugin_test_7_2.o: plugin_test_7_2.c
2356         $(COMPILE) -O0 -c -ffunction-sections -fdata-sections -o $@ $<
2357 plugin_test_7.err: plugin_test_7
2359 # Test plugins with -r.
2360 check_PROGRAMS += plugin_test_8
2361 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
2362         ../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
2363 plugin_test_8: plugin_test_8.o gcctestdir/ld
2364         $(CXXLINK) -Wl,--no-demangle plugin_test_8.o
2366 # Test that symbols known in the IR file but not in the replacement file
2367 # produce an unresolved symbol error.
2368 check_DATA += plugin_test_9.err
2369 MOSTLYCLEANFILES += plugin_test_9.err
2370 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
2371         @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>$@"
2372         @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 \
2373           echo 1>&2 "Link of plugin_test_9 should have failed"; \
2374           rm -f $@; \
2375           exit 1; \
2376         fi
2377 # Make a .syms file that claims to define the symbol _Z4t16av.
2378 two_file_test_1c.o.syms: two_file_test_1.o.syms two_file_test_1c.o
2379         cp two_file_test_1.o.syms $@.tmp
2380         grep "_Z4t16av" two_file_test_1b.o.syms >> $@.tmp
2381         mv -f $@.tmp $@
2382 # Make a copy of two_file_test_1.o, which does not define the symbol _Z4t16av.
2383 MOSTLYCLEANFILES += two_file_test_1c.o
2384 two_file_test_1c.o: two_file_test_1.o
2385         cp two_file_test_1.o $@
2387 # As above, but check COMDAT case, where a non-IR file contains a duplicate
2388 # of a COMDAT group in an IR file.
2389 check_DATA += plugin_test_9b.err
2390 MOSTLYCLEANFILES += plugin_test_9b.err
2391 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
2392         @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>$@"
2393         @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 \
2394           echo 1>&2 "Link of plugin_test_9b should have failed"; \
2395           rm -f $@; \
2396           exit 1; \
2397         fi
2398 # Make a .syms file that claims to define a method in class A in a COMDAT group.
2399 # The real plugin_test_9b_ir.o will be compiled without the -D, and will not
2400 # define any methods in class A.
2401 plugin_test_9b_ir.o.syms: plugin_test_9b_ir_witha.o
2402         $(TEST_READELF) -sW $< >$@ 2>/dev/null
2403 plugin_test_9b_ir_witha.o: plugin_test_9b_ir.cc
2404         $(CXXCOMPILE) -c -DUSE_CLASS_A -o $@ $<
2406 check_PROGRAMS += plugin_test_10
2407 check_SCRIPTS += plugin_test_10.sh
2408 check_DATA += plugin_test_10.sections
2409 MOSTLYCLEANFILES += plugin_test_10.sections
2410 plugin_test_10: plugin_common_test_1.o.syms plugin_common_test_2.o gcctestdir/ld plugin_test.so
2411         $(CXXLINK) -Wl,--no-demangle,--plugin,"./plugin_test.so" plugin_common_test_1.o.syms plugin_common_test_2.o
2412 plugin_test_10.sections: plugin_test_10
2413         $(TEST_READELF) -SW $< >$@ 2>/dev/null
2415 check_PROGRAMS += plugin_test_11
2416 check_SCRIPTS += plugin_test_11.sh
2417 check_DATA += plugin_test_11.err
2418 MOSTLYCLEANFILES += plugin_test_11.err plugin_test_thin.a
2419 PLUGIN_TEST_11_SYMS = two_file_test_1.o.syms two_file_test_1b.o.syms two_file_test_2.o.syms
2420 plugin_test_11: two_file_test_main.o plugin_test_thin.a gcctestdir/ld plugin_test.so $(PLUGIN_TEST_11_SYMS)
2421         $(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
2422 plugin_test_11.err: plugin_test_11
2423         @touch plugin_test_11.err
2424 plugin_test_thin.a: two_file_test_1.o two_file_test_1b.o two_file_test_2.o
2425         rm -f $@
2426         $(TEST_AR) crT $@ $^
2428 check_PROGRAMS += plugin_test_12
2429 check_SCRIPTS += plugin_test_12.sh
2430 check_DATA += plugin_test_12.err
2431 MOSTLYCLEANFILES += plugin_test_12.err
2432 export_dynamic_plugin.o.syms: export_dynamic_plugin.o
2433         $(TEST_READELF) -sW $< >$@ 2>/dev/null
2434 export_dynamic_plugin.o: export_dynamic_plugin.cc
2435         $(CXXCOMPILE) -c -o $@ $<
2436 plugin_test_12: export_dynamic_plugin.o gcctestdir/ld plugin_test.so export_dynamic_plugin.o.syms
2437         $(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
2438 plugin_test_12.err: plugin_test_12
2439         @touch plugin_test_12.err
2441 check_PROGRAMS += plugin_test_wrap_symbols
2442 check_SCRIPTS += plugin_test_wrap_symbols.sh
2443 check_DATA += plugin_test_wrap_symbols.err
2444 MOSTLYCLEANFILES += plugin_test_wrap_symbols.err
2445 plugin_test_wrap_symbols_1.o: plugin_test_wrap_symbols_1.cc
2446         $(CXXCOMPILE) -c -o $@ $<
2447 plugin_test_wrap_symbols_2.o: plugin_test_wrap_symbols_2.cc
2448         $(CXXCOMPILE) -c -o $@ $<
2449 plugin_test_wrap_symbols: plugin_test_wrap_symbols_1.o plugin_test_wrap_symbols_2.o gcctestdir/ld plugin_test.so
2450         $(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
2451 plugin_test_wrap_symbols.err: plugin_test_wrap_symbols
2452         @touch plugin_test_wrap_symbols.err
2454 check_PROGRAMS += plugin_test_start_lib
2455 check_SCRIPTS += plugin_test_start_lib.sh
2456 check_DATA += plugin_test_start_lib.err
2457 MOSTLYCLEANFILES += plugin_test_start_lib.err
2458 plugin_test_start_lib: unused.o plugin_start_lib_test.o plugin_start_lib_test_2.syms gcctestdir/ld plugin_test.so
2459         $(CXXLINK) -Wl,--no-demangle,--plugin,"./plugin_test.so" plugin_start_lib_test.o \
2460                 -Wl,--start-lib plugin_start_lib_test_2.syms -Wl,--end-lib 2>plugin_test_start_lib.err
2461 plugin_test_start_lib.err: plugin_test_start_lib
2462         @touch plugin_test_start_lib.err
2464 check_PROGRAMS += plugin_test_defsym
2465 check_SCRIPTS += plugin_test_defsym.sh
2466 check_DATA += plugin_test_defsym.err
2467 MOSTLYCLEANFILES += plugin_test_defsym.err
2468 plugin_test_defsym.syms: plugin_test_defsym.o
2469         $(TEST_READELF) -sW $< >$@ 2>/dev/null
2470 plugin_test_defsym.o: plugin_test_defsym.c
2471         $(COMPILE) -c -o $@ $<
2472 plugin_test_defsym: plugin_test_defsym.o plugin_test_defsym.syms gcctestdir/ld plugin_test.so
2473         $(CXXLINK) -Wl,--no-demangle,--plugin,"./plugin_test.so" -Wl,--defsym,bar=foo plugin_test_defsym.syms 2>plugin_test_defsym.err
2474 plugin_test_defsym.err: plugin_test_defsym
2475         @touch plugin_test_defsym.err
2477 plugin_start_lib_test_2.syms: plugin_start_lib_test_2.o
2478         $(TEST_READELF) -sW $< >$@ 2>/dev/null
2480 plugin_test.so: plugin_test.o gcctestdir/ld
2481         $(LINK) -shared plugin_test.o
2482 plugin_test.o: plugin_test.c
2483         $(COMPILE) -O0 -c -fpic -o $@ $<
2485 plugin_common_test_1.o: plugin_common_test_1.c
2486         $(COMPILE) -c $(COMMON_TEST_C_CFLAGS) -o $@ $<
2487 plugin_common_test_2.o: plugin_common_test_2.c
2488         $(COMPILE) -c $(COMMON_TEST_C_CFLAGS) -o $@ $<
2490 two_file_test_main.o.syms: two_file_test_main.o
2491         $(TEST_READELF) -sW $< >$@ 2>/dev/null
2492 two_file_test_1.o.syms: two_file_test_1.o
2493         $(TEST_READELF) -sW $< >$@ 2>/dev/null
2494 two_file_test_1b.o.syms: two_file_test_1b.o
2495         $(TEST_READELF) -sW $< >$@ 2>/dev/null
2496 two_file_test_2.o.syms: two_file_test_2.o
2497         $(TEST_READELF) -sW $< >$@ 2>/dev/null
2498 plugin_common_test_1.o.syms: plugin_common_test_1.o
2499         $(TEST_READELF) -sW $< >$@ 2>/dev/null
2500 plugin_common_test_2.o.syms: plugin_common_test_2.o
2501         $(TEST_READELF) -sW $< >$@ 2>/dev/null
2503 empty.o.syms:
2504         @echo "" >$@
2505         @echo "Symbol table" >>$@
2507 if TLS
2509 check_PROGRAMS += plugin_test_tls
2510 check_SCRIPTS += plugin_test_tls.sh
2511 check_DATA += plugin_test_tls.err
2512 MOSTLYCLEANFILES += plugin_test_tls.err
2513 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
2514         $(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
2515 plugin_test_tls.err: plugin_test_tls
2516         @touch plugin_test_tls.err
2518 two_file_test_2_tls.o.syms: two_file_test_2_tls.o
2519         $(TEST_READELF) -sW $< >$@ 2>/dev/null
2521 endif TLS
2523 MOSTLYCLEANFILES += unused.c
2524 unused.o.syms: unused.o
2525         $(TEST_READELF) -sW $< >$@ 2>/dev/null
2526         @echo "     1: 00000000     4 FUNC    GLOBAL DEFAULT    1 UNUSED" >>$@
2527 unused.o: unused.c
2528         $(COMPILE) -c -o $@ $<
2529 unused.c:
2530         @cp /dev/null $@
2532 check_SCRIPTS += plugin_final_layout.sh
2533 check_DATA += plugin_final_layout.stdout plugin_final_layout_readelf.stdout
2534 MOSTLYCLEANFILES += plugin_final_layout
2535 plugin_final_layout.o: plugin_final_layout.cc
2536         $(CXXCOMPILE) -O0 -c -ffunction-sections -fdata-sections -g -o $@ $<
2537 plugin_final_layout: plugin_final_layout.o plugin_section_order.so gcctestdir/ld
2538         $(CXXLINK) -Wl,--plugin,"./plugin_section_order.so" plugin_final_layout.o
2539 plugin_final_layout.stdout: plugin_final_layout
2540         $(TEST_NM) -n --synthetic plugin_final_layout > plugin_final_layout.stdout
2541 plugin_final_layout_readelf.stdout: plugin_final_layout
2542         $(TEST_READELF) -Wl plugin_final_layout > plugin_final_layout_readelf.stdout
2544 plugin_section_order.so: plugin_section_order.o gcctestdir/ld
2545         $(LINK) -shared plugin_section_order.o
2546 plugin_section_order.o: plugin_section_order.c
2547         $(COMPILE) -O0 -c -fpic -o $@ $<
2549 # Uses the plugin_final_layout.sh script above to avoid duplication
2550 check_DATA += plugin_layout_new_file.stdout plugin_layout_new_file_readelf.stdout
2551 MOSTLYCLEANFILES += plugin_layout_new_file
2552 plugin_final_layout.o.syms: plugin_final_layout.o
2553         $(TEST_READELF) -sW $< >$@ 2>/dev/null
2554 plugin_layout_new_file: plugin_final_layout.o.syms plugin_test.so plugin_new_section_layout.so gcctestdir/ld
2555         $(CXXLINK) -Wl,--plugin,"./plugin_test.so"  -Wl,--plugin,"./plugin_new_section_layout.so" plugin_final_layout.o.syms
2556 plugin_layout_new_file.stdout: plugin_layout_new_file
2557         $(TEST_NM) -n --synthetic plugin_layout_new_file > plugin_layout_new_file.stdout
2558 plugin_layout_new_file_readelf.stdout: plugin_layout_new_file
2559         $(TEST_READELF) -Wl plugin_layout_new_file > plugin_layout_new_file_readelf.stdout
2561 plugin_new_section_layout.so: plugin_new_section_layout.o gcctestdir/ld
2562         $(LINK) -shared plugin_new_section_layout.o
2563 plugin_new_section_layout.o: plugin_new_section_layout.c
2564         $(COMPILE) -O0 -c -fpic -o $@ $<
2566 check_SCRIPTS += plugin_layout_with_alignment.sh
2567 check_DATA += plugin_layout_with_alignment.stdout
2568 MOSTLYCLEANFILES += plugin_layout_with_alignment
2569 plugin_layout_with_alignment.o: plugin_layout_with_alignment.c
2570         $(COMPILE) -O0 -c -ffunction-sections -fdata-sections -g -o $@ $<
2571 plugin_layout_with_alignment: plugin_layout_with_alignment.o plugin_section_alignment.so gcctestdir/ld
2572         $(LINK) -Wl,--plugin,"./plugin_section_alignment.so" plugin_layout_with_alignment.o
2573 plugin_layout_with_alignment.stdout: plugin_layout_with_alignment
2574         $(TEST_NM) -n --synthetic plugin_layout_with_alignment > plugin_layout_with_alignment.stdout
2576 plugin_section_alignment.so: plugin_section_alignment.o gcctestdir/ld
2577         $(CXXLINK) -shared plugin_section_alignment.o
2578 plugin_section_alignment.o: plugin_section_alignment.cc
2579         $(CXXCOMPILE) -O0 -c -fpic -o $@ $<
2581 check_SCRIPTS += plugin_pr22868.sh
2582 check_DATA += plugin_pr22868.stdout
2583 MOSTLYCLEANFILES += plugin_pr22868.stdout
2584 plugin_pr22868.stdout: plugin_pr22868.so
2585         $(TEST_READELF) -W --dyn-syms $< >$@ 2>/dev/null
2586 plugin_pr22868.so: plugin_pr22868_a.o.syms plugin_pr22868_b.o.syms plugin_pr22868_b.o plugin_test.so gcctestdir/ld
2587         $(LINK) -shared -Wl,--plugin,"./plugin_test.so" plugin_pr22868_a.o.syms plugin_pr22868_b.o.syms
2588 plugin_pr22868_a.o.syms: plugin_pr22868_a.o
2589         $(TEST_READELF) -sW $< >$@ 2>/dev/null
2590 # Generate the .syms file from an alternate version of the original source
2591 # file, with a "protected" visibility attribute. We'll link with a
2592 # "replacement" object that does not have that attribute.
2593 plugin_pr22868_b.o.syms: plugin_pr22868_b_ir.o
2594         $(TEST_READELF) -sW $< >$@ 2>/dev/null
2595 plugin_pr22868_a.o: plugin_pr22868_a.c
2596         $(COMPILE) -c -fpic -o $@ $<
2597 plugin_pr22868_b_ir.o: plugin_pr22868_b.c
2598         $(COMPILE) -c -DIR -fpic -o $@ $<
2599 plugin_pr22868_b.o: plugin_pr22868_b.c
2600         $(COMPILE) -c -fpic -o $@ $<
2602 check_SCRIPTS += ver_test_pr16504.sh
2603 check_DATA += ver_test_pr16504.stdout
2604 ver_test_pr16504.stdout: ver_test_pr16504.so
2605         $(TEST_READELF) -W --dyn-syms $< >$@ 2>/dev/null
2606 ver_test_pr16504.so: ver_test_pr16504_a.so ver_test_pr16504_b.o.syms ver_test_pr16504_b.script gcctestdir/ld
2607         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
2608 ver_test_pr16504_a.so: ver_test_pr16504_a.o ver_test_pr16504_a.script gcctestdir/ld
2609         gcctestdir/ld -shared -o $@ --version-script $(srcdir)/ver_test_pr16504_a.script ver_test_pr16504_a.o
2610 ver_test_pr16504_a.o: ver_test_pr16504_a.c
2611         $(COMPILE) -c -fpic -o $@ $<
2612 # Filter out the UNDEFs from the symbols file to simulate GCC behavior,
2613 # which does not pass the UNDEF from a .symver directive.
2614 ver_test_pr16504_b.o.syms: ver_test_pr16504_b.o
2615         $(TEST_READELF) -sW $< 2>/dev/null | grep -v "UND" >$@
2616 ver_test_pr16504_b.o: ver_test_pr16504_b.c
2617         $(COMPILE) -c -fpic -o $@ $<
2619 endif PLUGINS
2621 check_PROGRAMS += exclude_libs_test
2622 check_SCRIPTS += exclude_libs_test.sh
2623 check_DATA += exclude_libs_test.syms
2624 MOSTLYCLEANFILES += exclude_libs_test.syms libexclude_libs_test_1.a \
2625         libexclude_libs_test_2.a alt/libexclude_libs_test_3.a
2626 exclude_libs_test_SOURCES = exclude_libs_test.c
2627 exclude_libs_test_DEPENDENCIES = gcctestdir/ld libexclude_libs_test_1.a \
2628         libexclude_libs_test_2.a alt/libexclude_libs_test_3.a
2629 exclude_libs_test_LDFLAGS = -L. -Lalt \
2630         -Wl,--exclude-libs,dummy:libexclude_libs_test_1 \
2631         -Wl,--exclude-libs,libexclude_libs_test_3
2632 exclude_libs_test_LDADD = -lexclude_libs_test_1 -lexclude_libs_test_2 \
2633         alt/libexclude_libs_test_3.a
2634 exclude_libs_test.syms: exclude_libs_test
2635         $(TEST_READELF) -sW $< >$@ 2>/dev/null
2636 libexclude_libs_test_1.a: exclude_libs_test_1.o
2637         $(TEST_AR) rc $@ $^
2638 libexclude_libs_test_2.a: exclude_libs_test_2.o
2639         $(TEST_AR) rc $@ $^
2640 alt/libexclude_libs_test_3.a: exclude_libs_test_3.o
2641         test -d alt || mkdir -p alt
2642         $(TEST_AR) rc $@ $^
2644 check_PROGRAMS += local_labels_test
2645 local_labels_test.o: ver_test_6.c
2646         $(COMPILE) -g -c -Wa,-L -o $@ $<
2647 local_labels_test: local_labels_test.o gcctestdir/ld
2648         $(LINK) local_labels_test.o
2650 check_PROGRAMS += discard_locals_test
2651 check_SCRIPTS += discard_locals_test.sh
2652 check_DATA += discard_locals_test.syms \
2653         discard_locals_relocatable_test1.syms \
2654         discard_locals_relocatable_test2.syms
2655 MOSTLYCLEANFILES += discard_locals_test.syms \
2656         discard_locals_relocatable_test1.syms \
2657         discard_locals_relocatable_test2.syms \
2658         discard_locals_relocatable_test1.out \
2659         discard_locals_relocatable_test2.out
2660 discard_locals_test_SOURCES = discard_locals_test.c
2661 discard_locals_test_LDFLAGS = -Wl,--discard-locals
2662 discard_locals_test.syms: discard_locals_test
2663         $(TEST_READELF) -sW $< >$@ 2>/dev/null
2664 # '-Wa,-L' is required to preserve the local label used for testing.
2665 discard_locals_test.o: discard_locals_test.c
2666         $(COMPILE) -c -Wa,-L -o $@ $<
2668 discard_locals_relocatable_test1.syms: discard_locals_relocatable_test1.out
2669         $(TEST_READELF) -sW $< >$@ 2>/dev/null
2670 discard_locals_relocatable_test.o: discard_locals_relocatable_test.c
2671         $(COMPILE) -c -Wa,-L -fPIC -o $@ $<
2672 discard_locals_relocatable_test1.out: discard_locals_relocatable_test.o ../ld-new
2673         ../ld-new --discard-locals -relocatable -o $@ $<
2675 discard_locals_relocatable_test2.syms: discard_locals_relocatable_test2.out
2676         $(TEST_READELF) -sW $< >$@ 2>/dev/null
2677 discard_locals_relocatable_test2.out: discard_locals_relocatable_test.o ../ld-new
2678         ../ld-new --discard-all -relocatable -o $@ $<
2680 if MCMODEL_MEDIUM
2681 check_PROGRAMS += large
2682 large_SOURCES = large.c
2683 large_CFLAGS = -mcmodel=medium
2684 large_DEPENDENCIES = gcctestdir/ld
2685 large_LDADD =
2686 endif MCMODEL_MEDIUM
2688 # Test that hidden and internal symbols in the main program cannot be
2689 # referenced by a shared library.
2690 check_SCRIPTS += hidden_test.sh
2691 check_DATA += hidden_test.err
2692 MOSTLYCLEANFILES += hidden_test hidden_test.err hidden_test.syms
2693 libhidden.so: hidden_test_1.c gcctestdir/ld
2694         $(COMPILE) -g -shared -fPIC -w -o $@ $(srcdir)/hidden_test_1.c
2695 hidden_test: hidden_test_main.o libhidden.so gcctestdir/ld
2696         $(LINK) -Wl,-R,. hidden_test_main.o libhidden.so 2>hidden_test.err
2697 hidden_test.syms: hidden_test
2698         $(TEST_NM) -D hidden_test > $@
2699 hidden_test.err: hidden_test
2700         @touch hidden_test.err
2702 # Test -retain-symbols-file.
2703 check_SCRIPTS += retain_symbols_file_test.sh
2704 check_DATA += retain_symbols_file_test.stdout
2705 MOSTLYCLEANFILES += retain_symbols_file_test retain_symbols_file_test.in \
2706                     retain_symbols_file_test.stdout
2707 retain_symbols_file_test.so: basic_pic_test.o gcctestdir/ld
2708         echo 'main' > retain_symbols_file_test.in
2709         echo 't1' >> retain_symbols_file_test.in
2710         echo '_ZNK4t20a3getEv' >> retain_symbols_file_test.in
2711         echo '_Z3t18v' >> retain_symbols_file_test.in
2712         echo '__tcf_0' >> retain_symbols_file_test.in
2713         $(CXXLINK) -shared -Wl,-retain-symbols-file,retain_symbols_file_test.in basic_pic_test.o
2714 retain_symbols_file_test.stdout: retain_symbols_file_test.so
2715         $(TEST_NM) -C retain_symbols_file_test.so > $@
2718 # Test that if the output file already exists and is empty,
2719 # it will get execute permission.
2720 check_PROGRAMS += permission_test
2721 permission_test: basic_test.o gcctestdir/ld
2722         umask 022; \
2723         rm -f $@; \
2724         touch $@; \
2725         chmod 600 $@; \
2726         $(CXXLINK) basic_test.o
2728 # Check -l:foo.a
2729 check_PROGRAMS += searched_file_test
2730 MOSTLYCLEANFILES += searched_file_test searched_file_test_lib.o \
2731                     alt/searched_file_test_lib.a
2732 searched_file_test_SOURCES = searched_file_test.cc
2733 searched_file_test_DEPENDENCIES = gcctestdir/ld alt/searched_file_test_lib.a
2734 searched_file_test_LDFLAGS = -Lalt
2735 searched_file_test_LDADD = -l:searched_file_test_lib.a
2736 searched_file_test_lib.o: searched_file_test_lib.cc
2737         $(CXXCOMPILE) -c -o $@ $<
2738 alt/searched_file_test_lib.a: searched_file_test_lib.o
2739         test -d alt || mkdir -p alt
2740         $(TEST_AR) rc $@ $^
2742 # Test that no .gnu.version sections are created when
2743 # symbol versioning is not used.
2744 check_SCRIPTS += no_version_test.sh
2745 check_DATA += no_version_test.stdout
2746 MOSTLYCLEANFILES += libno_version_test.so no_version_test.stdout
2747 # We invoke the linker directly since gcc may include additional objects that
2748 # uses symbol versioning.
2749 libno_version_test.so: no_version_test.o gcctestdir/ld
2750         gcctestdir/ld -shared -o $@ no_version_test.o
2751 no_version_test.o: no_version_test.c
2752         $(COMPILE) -o $@ -c -fPIC $<
2753 no_version_test.stdout: libno_version_test.so
2754         $(TEST_OBJDUMP) -h $< > $@
2756 # Test STT_GNU_IFUNC symbols.
2757 if IFUNC
2759 ifuncmod1.o: ifuncmod1.c
2760         $(COMPILE) -c -fPIC -o $@ $<
2761 ifuncmod1.so: ifuncmod1.o gcctestdir/ld
2762         $(LINK) -shared ifuncmod1.o
2764 ifuncdep1.o: ifuncmod1.c
2765         $(COMPILE) -c -o $@ $<
2767 ifuncmain1pic.o: ifuncmain1.c
2768         $(COMPILE) -c -fPIC -o $@ $<
2769 ifuncmain1pie.o: ifuncmain1.c
2770         $(COMPILE) -c -fPIE -o $@ $<
2772 if HAVE_STATIC
2773 if IFUNC_STATIC
2774 check_PROGRAMS += ifuncmain1static
2775 ifuncmain1static_SOURCES = ifuncmain1.c
2776 ifuncmain1static_DEPENDENCIES = gcctestdir/ld ifuncdep1.o
2777 ifuncmain1static_LDFLAGS = -static
2778 ifuncmain1static_LDADD = ifuncdep1.o
2780 check_PROGRAMS += ifuncmain1picstatic
2781 ifuncmain1picstatic: ifuncmain1pic.o ifuncmod1.o gcctestdir/ld
2782         $(LINK) -static ifuncmain1pic.o ifuncmod1.o
2784 check_SCRIPTS += ifuncmod1.sh
2785 check_DATA += ifuncmod1.so.stderr
2786 ifuncmod1.so.stderr: ifuncmod1.so
2787         $(TEST_READELF) -s $< > /dev/null 2> $@
2788 endif
2789 endif
2791 check_PROGRAMS += ifuncmain1
2792 ifuncmain1_SOURCES = ifuncmain1.c
2793 ifuncmain1_DEPENDENCIES = gcctestdir/ld ifuncmod1.so
2794 ifuncmain1_LDFLAGS = -Wl,-R,.
2795 ifuncmain1_LDADD = ifuncmod1.so
2797 check_PROGRAMS += ifuncmain1pic
2798 ifuncmain1pic: ifuncmain1pic.o ifuncmod1.so gcctestdir/ld
2799         $(LINK) ifuncmain1pic.o ifuncmod1.so -Wl,-R,.
2801 check_PROGRAMS += ifuncmain1vis
2802 ifuncmain1vis_SOURCES = ifuncmain1vis.c
2803 ifuncmain1vis_DEPENDENCIES = gcctestdir/ld ifuncmod1.so
2804 ifuncmain1vis_LDFLAGS = -Wl,-R,.
2805 ifuncmain1vis_LDADD = ifuncmod1.so
2807 check_PROGRAMS += ifuncmain1vispic
2808 ifuncmain1vispic.o: ifuncmain1vis.c
2809         $(COMPILE) -c -fPIC -o $@ $<
2810 ifuncmain1vispic: ifuncmain1vispic.o ifuncmod1.so gcctestdir/ld
2811         $(LINK) ifuncmain1pic.o ifuncmod1.so -Wl,-R,.
2813 check_PROGRAMS += ifuncmain1staticpic
2814 ifuncmain1staticpic: ifuncmain1pic.o ifuncmod1.o gcctestdir/ld
2815         $(LINK) ifuncmain1pic.o ifuncmod1.o
2817 check_PROGRAMS += ifuncmain1pie
2818 ifuncmain1pie: ifuncmain1pie.o ifuncmod1.so gcctestdir/ld
2819         $(LINK) -pie ifuncmain1pie.o ifuncmod1.so -Wl,-R,.
2821 check_PROGRAMS += ifuncmain1vispie
2822 ifuncmain1vispie.o: ifuncmain1vis.c
2823         $(COMPILE) -c -fPIE -o $@ $<
2824 ifuncmain1vispie: ifuncmain1vispie.o ifuncmod1.so gcctestdir/ld
2825         $(LINK) -pie ifuncmain1vispie.o ifuncmod1.so -Wl,-R,.
2827 check_PROGRAMS += ifuncmain1staticpie
2828 ifuncmain1staticpie: ifuncmain1pie.o ifuncmod1.o gcctestdir/ld
2829         $(LINK) -pie ifuncmain1pie.o ifuncmod1.o
2831 ifuncmain2pic.o: ifuncmain2.c
2832         $(COMPILE) -c -fPIC -o $@ $<
2834 ifuncdep2pic.o: ifuncdep2.c
2835         $(COMPILE) -c -fPIC -o $@ $<
2837 if HAVE_STATIC
2838 if IFUNC_STATIC
2839 check_PROGRAMS += ifuncmain2static
2840 ifuncmain2static_SOURCES = ifuncmain2.c ifuncdep2.c
2841 ifuncmain2static_DEPENDENCIES = gcctestdir/ld
2842 ifuncmain2static_LDFLAGS = -static
2843 ifuncmain2static_LDADD =
2845 check_PROGRAMS += ifuncmain2picstatic
2846 ifuncmain2picstatic: ifuncmain2pic.o ifuncdep2pic.o gcctestdir/ld
2847         $(LINK) -static ifuncmain2pic.o ifuncdep2pic.o
2848 endif
2849 endif
2851 check_PROGRAMS += ifuncmain2
2852 ifuncmain2_SOURCES = ifuncmain2.c ifuncdep2.c
2853 ifuncmain2_DEPENDENCIES = gcctestdir/ld
2854 ifuncmain2_LDADD =
2856 check_PROGRAMS += ifuncmain2pic
2857 ifuncmain2pic: ifuncmain2pic.o ifuncdep2pic.o gcctestdir/ld
2858         $(LINK) ifuncmain2pic.o ifuncdep2pic.o
2860 ifuncmod3.o: ifuncmod3.c
2861         $(COMPILE) -c -fPIC -o $@ $<
2862 ifuncmod3.so: ifuncmod3.o gcctestdir/ld
2863         $(LINK) -shared ifuncmod3.o
2865 check_PROGRAMS += ifuncmain3
2866 ifuncmain3_SOURCES = ifuncmain3.c
2867 ifuncmain3_DEPENDENCIES = gcctestdir/ld ifuncmod3.so
2868 ifuncmain3_LDFLAGS = -Wl,--export-dynamic -Wl,-R,.
2869 ifuncmain3_LDADD = -ldl
2871 ifuncmain4pic.o: ifuncmain4.c
2872         $(COMPILE) -c -fPIC -o $@ $<
2874 if HAVE_STATIC
2875 if IFUNC_STATIC
2876 check_PROGRAMS += ifuncmain4static
2877 ifuncmain4static_SOURCES = ifuncmain4.c
2878 ifuncmain4static_DEPENDENCIES = gcctestdir/ld
2879 ifuncmain4static_LDFLAGS = -static
2880 ifuncmain4static_LDADD =
2882 check_PROGRAMS += ifuncmain4picstatic
2883 ifuncmain4picstatic: ifuncmain4pic.o gcctestdir/ld
2884         $(LINK) -static ifuncmain4pic.o
2885 endif
2886 endif
2888 check_PROGRAMS += ifuncmain4
2889 ifuncmain4_SOURCES = ifuncmain4.c
2890 ifuncmain4_DEPENDENCIES = gcctestdir/ld
2891 ifuncmain4_LDADD =
2893 ifuncmain5pic.o: ifuncmain5.c
2894         $(COMPILE) -c -fPIC -o $@ $<
2896 ifuncmain5pie.o: ifuncmain5.c
2897         $(COMPILE) -c -fPIE -o $@ $<
2899 ifuncmod5.o: ifuncmod5.c
2900         $(COMPILE) -c -fPIC -o $@ $<
2901 ifuncmod5.so: ifuncmod5.o gcctestdir/ld
2902         $(LINK) -shared ifuncmod5.o
2904 ifuncdep5.o: ifuncmod5.c
2905         $(COMPILE) -c -o $@ $<
2907 if HAVE_STATIC
2908 if IFUNC_STATIC
2909 check_PROGRAMS += ifuncmain5static
2910 ifuncmain5static_SOURCES = ifuncmain5.c
2911 ifuncmain5static_DEPENDENCIES = gcctestdir/ld ifuncdep5.o
2912 ifuncmain5static_LDFLAGS = -static
2913 ifuncmain5static_LDADD = ifuncdep5.o
2915 check_PROGRAMS += ifuncmain5picstatic
2916 ifuncmain5picstatic: ifuncmain5pic.o ifuncmod5.o gcctestdir/ld
2917         $(LINK) -static ifuncmain5pic.o ifuncmod5.o
2918 endif
2919 endif
2921 check_PROGRAMS += ifuncmain5
2922 ifuncmain5_SOURCES = ifuncmain5.c
2923 ifuncmain5_DEPENDENCIES = gcctestdir/ld ifuncmod5.so
2924 ifuncmain5_LDFLAGS = -Wl,-R,.
2925 ifuncmain5_LDADD = ifuncmod5.so
2927 check_PROGRAMS += ifuncmain5pic
2928 ifuncmain5pic: ifuncmain5pic.o ifuncmod5.so gcctestdir/ld
2929         $(LINK) ifuncmain5pic.o ifuncmod5.so -Wl,-R,.
2931 check_PROGRAMS += ifuncmain5staticpic
2932 ifuncmain5staticpic: ifuncmain5pic.o ifuncmod5.o gcctestdir/ld
2933         $(LINK) ifuncmain5pic.o ifuncmod5.o
2935 check_PROGRAMS += ifuncmain5pie
2936 ifuncmain5pie: ifuncmain5pie.o ifuncmod5.so gcctestdir/ld
2937         $(LINK) -pie ifuncmain5pie.o ifuncmod5.so -Wl,-R,.
2939 ifuncmain6pie.o: ifuncmain6pie.c
2940         $(COMPILE) -c -fPIE -o $@ $<
2942 ifuncmod6.o: ifuncmod6.c
2943         $(COMPILE) -c -fPIC -o $@ $<
2944 ifuncmod6.so: ifuncmod6.o gcctestdir/ld
2945         $(LINK) -shared ifuncmod6.o
2947 check_PROGRAMS += ifuncmain6pie
2948 ifuncmain6pie: ifuncmain6pie.o ifuncmod6.so gcctestdir/ld
2949         $(LINK) -pie ifuncmain6pie.o ifuncmod6.so -Wl,-R,.
2951 ifuncmain7pic.o: ifuncmain7.c
2952         $(COMPILE) -c -fPIC -o $@ $<
2954 ifuncmain7pie.o: ifuncmain7.c
2955         $(COMPILE) -c -fPIE -o $@ $<
2957 if HAVE_STATIC
2958 if IFUNC_STATIC
2959 check_PROGRAMS += ifuncmain7static
2960 ifuncmain7static_SOURCES = ifuncmain7.c
2961 ifuncmain7static_DEPENDENCIES = gcctestdir/ld
2962 ifuncmain7static_LDFLAGS = -static
2963 ifuncmain7static_LDADD =
2965 check_PROGRAMS += ifuncmain7picstatic
2966 ifuncmain7picstatic: ifuncmain7pic.o gcctestdir/ld
2967         $(LINK) -static ifuncmain7pic.o
2968 endif
2969 endif
2971 check_PROGRAMS += ifuncmain7
2972 ifuncmain7_SOURCES = ifuncmain7.c
2973 ifuncmain7_DEPENDENCIES = gcctestdir/ld
2974 ifuncmain7_LDADD =
2976 check_PROGRAMS += ifuncmain7pic
2977 ifuncmain7pic: ifuncmain7pic.o gcctestdir/ld
2978         $(LINK) ifuncmain7pic.o
2980 check_PROGRAMS += ifuncmain7pie
2981 ifuncmain7pie: ifuncmain7pie.o gcctestdir/ld
2982         $(LINK) -pie ifuncmain7pie.o
2984 check_PROGRAMS += ifuncvar
2985 ifuncvar1_pic.o: ifuncvar1.c
2986         $(COMPILE) -c -fPIC -o $@ $<
2987 ifuncvar2_pic.o: ifuncvar2.c
2988         $(COMPILE) -c -fPIC -o $@ $<
2989 ifuncvar.so: ifuncvar1_pic.o ifuncvar2_pic.o gcctestdir/ld
2990         $(LINK) -shared ifuncvar1_pic.o ifuncvar2_pic.o
2991 ifuncvar_SOURCES = ifuncvar3.c
2992 ifuncvar_DEPENDENCIES = gcctestdir/ld ifuncvar.so
2993 ifuncvar_LDFLAGS = -Wl,-R,.
2994 ifuncvar_LDADD = ifuncvar.so
2996 endif IFUNC
2998 # Test that strong reference to a weak symbol in a DSO remains strong.
2999 check_SCRIPTS += strong_ref_weak_def.sh
3000 check_DATA += strong_ref_weak_def.stdout
3001 MOSTLYCLEANFILES += strong_ref_weak_def_1.so strong_ref_weak_def_2.so \
3002         strong_ref_weak_def.stdout
3003 strong_ref_weak_def_2.o: strong_ref_weak_def_2.c
3004         $(COMPILE) -o $@ -c -fPIC $<
3005 strong_ref_weak_def_2.so: strong_ref_weak_def_2.o gcctestdir/ld
3006         gcctestdir/ld -shared -o $@ strong_ref_weak_def_2.o
3007 strong_ref_weak_def_1.o: strong_ref_weak_def_1.c
3008         $(COMPILE) -o $@ -c -fPIC $<
3009 strong_ref_weak_def_1.so: strong_ref_weak_def_1.o strong_ref_weak_def_2.so \
3010         gcctestdir/ld
3011         gcctestdir/ld -shared -o $@ strong_ref_weak_def_1.o \
3012                 strong_ref_weak_def_2.so
3013 strong_ref_weak_def.stdout: strong_ref_weak_def_1.so
3014         $(TEST_READELF) -sWD $< > $@
3016 # Test that a strong weak reference remains strong if there is another
3017 # weak reference in a DSO.
3018 check_SCRIPTS += dyn_weak_ref.sh
3019 check_DATA += dyn_weak_ref.stdout
3020 MOSTLYCLEANFILES += dyn_weak_ref_1.so dyn_weak_ref_2.so \
3021         dyn_weak_ref.stdout
3022 dyn_weak_ref_2.o: dyn_weak_ref_2.c
3023         $(COMPILE) -o $@ -c -fPIC $<
3024 dyn_weak_ref_2.so: dyn_weak_ref_2.o gcctestdir/ld
3025         gcctestdir/ld -shared -o $@ dyn_weak_ref_2.o
3026 dyn_weak_ref_1.o: dyn_weak_ref_1.c
3027         $(COMPILE) -o $@ -c -fPIC $<
3028 # We intentionally put dyn_weak_ref_2.so in front of dyn_weak_ref_1.o
3029 # so that the weak ref there goes to gold's symbol table first.
3030 dyn_weak_ref_1.so: dyn_weak_ref_1.o dyn_weak_ref_2.so gcctestdir/ld
3031         gcctestdir/ld -shared -o $@ dyn_weak_ref_2.so dyn_weak_ref_1.o
3032 dyn_weak_ref.stdout: dyn_weak_ref_1.so
3033         $(TEST_READELF) -sWD $< > $@
3036 # Test that --start-lib and --end-lib function correctly.
3037 check_PROGRAMS += start_lib_test
3038 MOSTLYCLEANFILES += libstart_lib_test.a
3039 start_lib_test: start_lib_test_main.o libstart_lib_test.a start_lib_test_2.o start_lib_test_3.o \
3040         gcctestdir/ld
3041         $(LINK) -o $@ start_lib_test_main.o -L. -lstart_lib_test \
3042                 -Wl,--start-lib start_lib_test_2.o start_lib_test_3.o -Wl,--end-lib
3043 libstart_lib_test.a: start_lib_test_1.o
3044         $(TEST_AR) rc $@ $^
3046 # Test that MEMORY region support works.
3047 check_SCRIPTS += memory_test.sh
3048 check_DATA += memory_test.stdout
3049 MOSTLYCLEANFILES += memory_test.stdout memory_test memory_test.o
3050 memory_test.o: memory_test.s
3051         $(COMPILE) -o $@ -c $<
3052 memory_test: memory_test.o gcctestdir/ld $(srcdir)/memory_test.t
3053         $(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
3054 memory_test.stdout: memory_test
3055         $(TEST_READELF) -lWS $< > $@
3057 # Test INCLUDE directives in linker scripts.
3058 # The binary isn't runnable, so we just check that we can build it without errors.
3059 check_DATA += memory_test_2
3060 MOSTLYCLEANFILES += memory_test_inc_1.t memory_test_inc_2.t memory_test_inc_3.t memory_test_2
3061 memory_test_inc_1.t: $(srcdir)/memory_test_inc_1.t.src
3062         cp $< $@
3063 memory_test_inc_2.t: $(srcdir)/memory_test_inc_2.t.src
3064         cp $< $@
3065 memory_test_inc_3.t: $(srcdir)/memory_test_inc_3.t.src
3066         cp $< $@
3067 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
3068         $(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
3070 if HAVE_PUBNAMES
3072 # Test that --gdb-index functions correctly without gcc-generated pubnames.
3073 check_SCRIPTS += gdb_index_test_1.sh
3074 check_DATA += gdb_index_test_1.stdout
3075 MOSTLYCLEANFILES += gdb_index_test_1.stdout gdb_index_test_1
3076 gdb_index_test.o: gdb_index_test.cc
3077         $(CXXCOMPILE) -O0 -g -gno-pubnames -c -o $@ $<
3078 gdb_index_test_1: gdb_index_test.o gcctestdir/ld
3079         $(CXXLINK) -Wl,--gdb-index $<
3080 gdb_index_test_1.stdout: gdb_index_test_1
3081         $(TEST_READELF) --debug-dump=gdb_index $< > $@
3083 # Test that --gdb-index functions correctly with compressed debug sections.
3084 check_SCRIPTS += gdb_index_test_2.sh
3085 check_DATA += gdb_index_test_2.stdout
3086 MOSTLYCLEANFILES += gdb_index_test_2.stdout gdb_index_test_2 gdb_index_test_2_gabi
3087 gdb_index_test_cdebug.o: gdb_index_test.cc
3088         $(CXXCOMPILE) -O0 -g -Wa,--compress-debug-sections -c -o $@ $<
3089 gdb_index_test_2: gdb_index_test_cdebug.o gcctestdir/ld
3090         $(CXXLINK) -Wl,--gdb-index $<
3091 gdb_index_test_2.stdout: gdb_index_test_2
3092         $(TEST_READELF) --debug-dump=gdb_index $< > $@
3093 check_SCRIPTS += gdb_index_test_2_gabi.sh
3094 check_DATA += gdb_index_test_2_gabi.stdout
3095 MOSTLYCLEANFILES += gdb_index_test_2.stdout gdb_index_test_2
3096 gdb_index_test_cdebug_gabi.o: gdb_index_test.cc
3097         $(CXXCOMPILE) -O0 -g -Wa,--compress-debug-sections=zlib-gabi -c -o $@ $<
3098 gdb_index_test_2_gabi: gdb_index_test_cdebug_gabi.o gcctestdir/ld
3099         $(CXXLINK) -Wl,--gdb-index $<
3100 gdb_index_test_2_gabi.stdout: gdb_index_test_2_gabi
3101         $(TEST_READELF) --debug-dump=gdb_index $< > $@
3103 # Another simple C test (DW_AT_high_pc encoding) for --gdb-index.
3104 check_SCRIPTS += gdb_index_test_3.sh
3105 check_DATA += gdb_index_test_3.stdout
3106 MOSTLYCLEANFILES += gdb_index_test_3.stdout gdb_index_test_3
3107 gdb_index_test_3.o: gdb_index_test_3.c
3108         $(COMPILE) -O0 -g -c -o $@ $<
3109 gdb_index_test_3: gdb_index_test_3.o gcctestdir/ld
3110         $(LINK) -Wl,--gdb-index,--fatal-warnings $<
3111 gdb_index_test_3.stdout: gdb_index_test_3
3112         $(TEST_READELF) --debug-dump=gdb_index $< > $@
3114 # Test that --gdb-index functions correctly with gcc-generated pubnames.
3115 check_SCRIPTS += gdb_index_test_4.sh
3116 check_DATA += gdb_index_test_4.stdout
3117 MOSTLYCLEANFILES += gdb_index_test_4.stdout gdb_index_test_4
3118 gdb_index_test_pub.o: gdb_index_test.cc
3119         $(CXXCOMPILE) -O0 -g -gpubnames -c -o $@ $<
3120 gdb_index_test_4: gdb_index_test_pub.o gcctestdir/ld
3121         $(CXXLINK) -Wl,--gdb-index $<
3122 gdb_index_test_4.stdout: gdb_index_test_4
3123         $(TEST_READELF) --debug-dump=gdb_index $< > $@
3125 endif HAVE_PUBNAMES
3127 # Test that __ehdr_start is defined correctly.
3128 check_PROGRAMS += ehdr_start_test_1
3129 ehdr_start_test_1_SOURCES = ehdr_start_test.cc
3130 ehdr_start_test_1_DEPENDENCIES = gcctestdir/ld
3131 ehdr_start_test_1_CXXFLAGS =
3132 ehdr_start_test_1_LDADD =
3134 # Test that __ehdr_start is defined correctly with a weak reference.
3135 check_PROGRAMS += ehdr_start_test_2
3136 ehdr_start_test_2_SOURCES = ehdr_start_test.cc
3137 ehdr_start_test_2_DEPENDENCIES = gcctestdir/ld
3138 ehdr_start_test_2_CXXFLAGS = -DEHDR_START_WEAK
3139 ehdr_start_test_2_LDADD =
3141 # Test that __ehdr_start is defined correctly when used with a linker script.
3142 check_PROGRAMS += ehdr_start_test_3
3143 ehdr_start_test_3_SOURCES = ehdr_start_test.cc
3144 ehdr_start_test_3_DEPENDENCIES = gcctestdir/ld $(srcdir)/ehdr_start_test.t
3145 ehdr_start_test_3_CXXFLAGS = -DEHDR_START_WEAK
3146 ehdr_start_test_3_LDFLAGS = -Wl,-T,$(srcdir)/ehdr_start_test.t
3147 ehdr_start_test_3_LDADD =
3149 # Test that __ehdr_start is left undefined when the text segment is not
3150 # appropriately aligned.
3151 check_SCRIPTS += ehdr_start_test_4.sh
3152 check_DATA += ehdr_start_test_4.syms
3153 MOSTLYCLEANFILES += ehdr_start_test_4
3154 ehdr_start_test_4.syms: ehdr_start_test_4
3155         $(TEST_NM) ehdr_start_test_4 > $@
3156 ehdr_start_test_4: ehdr_start_test_4.o gcctestdir/ld
3157         $(CXXLINK) -Wl,-Ttext=0x100100 $<
3158 ehdr_start_test_4.o: ehdr_start_test.cc
3159         $(CXXCOMPILE) -c -DEHDR_START_WEAK -o $@ $<
3161 # Test that __ehdr_start is not overridden when supplied by the user.
3162 check_PROGRAMS += ehdr_start_test_5
3163 ehdr_start_test_5_SOURCES = ehdr_start_test.cc ehdr_start_def.cc
3164 ehdr_start_test_5_DEPENDENCIES = gcctestdir/ld
3165 ehdr_start_test_5_CXXFLAGS = -DEHDR_START_USER_DEF
3166 ehdr_start_test_5_LDADD =
3168 # Test that the --defsym option copies the symbol type and visibility.
3169 check_SCRIPTS += defsym_test.sh
3170 check_DATA += defsym_test.syms
3171 MOSTLYCLEANFILES += defsym_test defsym_test.syms
3172 defsym_test.syms: defsym_test
3173         $(TEST_READELF) -sW $< > $@
3174 defsym_test: defsym_test.o gcctestdir/ld
3175         $(LINK) -Wl,--defsym=bar=foo defsym_test.o
3176 defsym_test.o: defsym_test.c
3177         $(COMPILE) -c -o $@ $<
3179 # Test that the -d option (force common allocation) works correctly.
3180 check_PROGRAMS += pr20976
3181 pr20976: pr20976-d.o gcctestdir/ld
3182         $(LINK) pr20976-d.o
3183 pr20976-d.o: pr20976.o gcctestdir/ld
3184         gcctestdir/ld -r -d -o $@ pr20976.o
3186 # End-to-end incremental linking tests.
3187 # Incremental linking is currently supported only on the x86_64 target.
3189 if DEFAULT_TARGET_X86_64
3191 two_file_test_1_v1_ndebug.o: two_file_test_1_v1.cc
3192         $(CXXCOMPILE) -O0 -g0 -fno-exceptions -fno-asynchronous-unwind-tables -c -o $@ $<
3193 two_file_test_1_ndebug.o: two_file_test_1.cc
3194         $(CXXCOMPILE) -O0 -g0 -fno-exceptions -fno-asynchronous-unwind-tables -c -o $@ $<
3195 two_file_test_1b_ndebug.o: two_file_test_1b.cc
3196         $(CXXCOMPILE) -O0 -g0 -c -o $@ $<
3197 two_file_test_2_ndebug.o: two_file_test_2.cc
3198         $(CXXCOMPILE) -O0 -g0 -c -o $@ $<
3199 two_file_test_main_ndebug.o: two_file_test_main.cc
3200         $(CXXCOMPILE) -O0 -g0 -c -o $@ $<
3202 if !CFLAGS_CF_PROTECTION
3203 check_PROGRAMS += incremental_test_2
3204 endif
3205 MOSTLYCLEANFILES += two_file_test_tmp_2.o
3206 incremental_test_2: two_file_test_1_v1_ndebug.o two_file_test_1_ndebug.o two_file_test_1b_ndebug.o \
3207                     two_file_test_2_ndebug.o two_file_test_main_ndebug.o gcctestdir/ld
3208         cp -f two_file_test_1_v1_ndebug.o two_file_test_tmp_2.o
3209         $(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
3210         @sleep 1
3211         cp -f two_file_test_1_ndebug.o two_file_test_tmp_2.o
3212         $(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
3214 if !CFLAGS_CF_PROTECTION
3215 check_PROGRAMS += incremental_test_3
3216 endif
3217 MOSTLYCLEANFILES += two_file_test_tmp_3.o
3218 incremental_test_3: two_file_test_1.o two_file_test_1b_v1.o two_file_test_1b.o \
3219                     two_file_test_2.o two_file_test_main.o gcctestdir/ld
3220         cp -f two_file_test_1b_v1.o two_file_test_tmp_3.o
3221         $(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
3222         @sleep 1
3223         cp -f two_file_test_1b.o two_file_test_tmp_3.o
3224         $(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
3226 if !CFLAGS_CF_PROTECTION
3227 check_PROGRAMS += incremental_test_4
3228 endif
3229 MOSTLYCLEANFILES += incremental_test_4.base two_file_test_tmp_4.o
3230 incremental_test_4: two_file_test_1.o two_file_test_1b.o two_file_test_2_v1.o \
3231                     two_file_test_2.o two_file_test_main.o gcctestdir/ld
3232         cp -f two_file_test_2_v1.o two_file_test_tmp_4.o
3233         $(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
3234         mv -f incremental_test_4 incremental_test_4.base
3235         @sleep 1
3236         cp -f two_file_test_2.o two_file_test_tmp_4.o
3237         $(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
3239 if !CFLAGS_CF_PROTECTION
3240 check_PROGRAMS += incremental_test_5
3241 endif
3242 MOSTLYCLEANFILES += two_file_test_5.a
3243 incremental_test_5: two_file_test_1.o two_file_test_1b_v1.o two_file_test_1b.o \
3244                     two_file_test_2.o two_file_test_main.o gcctestdir/ld
3245         cp -f two_file_test_1b_v1.o two_file_test_tmp_5.o
3246         $(TEST_AR) rc two_file_test_5.a two_file_test_1.o two_file_test_tmp_5.o two_file_test_2.o
3247         $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Wl,-z,norelro,-no-pie two_file_test_main.o two_file_test_5.a
3248         @sleep 1
3249         cp -f two_file_test_1b.o two_file_test_tmp_5.o
3250         $(TEST_AR) rc two_file_test_5.a two_file_test_1.o two_file_test_tmp_5.o two_file_test_2.o
3251         $(CXXLINK) -Wl,--incremental-update -Wl,-z,norelro,-no-pie two_file_test_main.o two_file_test_5.a
3253 # Test the --incremental-unchanged flag with an archive library.
3254 # The second link should not update the library.
3255 check_PROGRAMS += incremental_test_6
3256 MOSTLYCLEANFILES += two_file_test_6.a
3257 incremental_test_6: two_file_test_1.o two_file_test_1b_v1.o two_file_test_1b.o \
3258                     two_file_test_2.o two_file_test_main.o gcctestdir/ld
3259         cp -f two_file_test_1b.o two_file_test_tmp_6.o
3260         $(TEST_AR) rc two_file_test_6.a two_file_test_1.o two_file_test_tmp_6.o two_file_test_2.o
3261         $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Wl,-z,norelro,-no-pie two_file_test_main.o two_file_test_6.a
3262         @sleep 1
3263         cp -f two_file_test_1b_v1.o two_file_test_tmp_6.o
3264         $(TEST_AR) rc two_file_test_6.a two_file_test_1.o two_file_test_tmp_6.o two_file_test_2.o
3265         $(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
3267 if !CFLAGS_CF_PROTECTION
3268 if !GCC9
3269 check_PROGRAMS += incremental_copy_test
3270 endif
3271 endif
3272 incremental_copy_test: copy_test_v1.o copy_test.o copy_test_1.so copy_test_2.so
3273         cp -f copy_test_v1.o copy_test_tmp.o
3274         $(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
3275         @sleep 1
3276         cp -f copy_test.o copy_test_tmp.o
3277         $(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
3279 if !CFLAGS_CF_PROTECTION
3280 check_PROGRAMS += incremental_common_test_1
3281 endif
3282 incremental_common_test_1: common_test_1_v1.o common_test_1_v2.o gcctestdir/ld
3283         cp -f common_test_1_v1.o common_test_1_tmp.o
3284         $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Wl,-z,norelro,-no-pie common_test_1_tmp.o
3285         @sleep 1
3286         cp -f common_test_1_v2.o common_test_1_tmp.o
3287         $(CXXLINK) -Wl,--incremental-update -Wl,-z,norelro,-no-pie common_test_1_tmp.o
3288 common_test_1_v1.o: common_test_1_v1.c
3289         $(COMPILE) -c $(COMMON_TEST_C_CFLAGS) -o $@ $<
3290 common_test_1_v2.o: common_test_1_v2.c
3291         $(COMPILE) -c $(COMMON_TEST_C_CFLAGS) -o $@ $<
3293 if !CFLAGS_CF_PROTECTION
3294 if !GCC9
3295 check_PROGRAMS += incremental_comdat_test_1
3296 endif
3297 endif
3298 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
3299         cp -f incr_comdat_test_2_v1.o incr_comdat_test_1_tmp.o
3300         $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Wl,-z,norelro,-no-pie incr_comdat_test_1.o incr_comdat_test_1_tmp.o
3301         @sleep 1
3302         cp -f incr_comdat_test_2_v2.o incr_comdat_test_1_tmp.o
3303         $(CXXLINK) -Wl,--incremental-update -Wl,-z,norelro,-no-pie incr_comdat_test_1.o incr_comdat_test_1_tmp.o
3304         @sleep 1
3305         cp -f incr_comdat_test_2_v3.o incr_comdat_test_1_tmp.o
3306         $(CXXLINK) -Wl,--incremental-update -Wl,-z,norelro,-no-pie incr_comdat_test_1.o incr_comdat_test_1_tmp.o
3308 endif DEFAULT_TARGET_X86_64
3310 if DEFAULT_TARGET_X86_64
3311 check_PROGRAMS += exception_x86_64_bnd_test
3312 exception_x86_64_bnd_test_SOURCES = exception_test_main.cc
3313 exception_x86_64_bnd_test_DEPENDENCIES = gcctestdir/ld exception_x86_64_bnd_1.o exception_x86_64_bnd_2.o
3314 exception_x86_64_bnd_test_LDFLAGS = $(exception_test_LDFLAGS) -Wl,-z,bndplt
3315 exception_x86_64_bnd_test_LDADD = exception_x86_64_bnd_1.o exception_x86_64_bnd_2.o
3316 exception_x86_64_bnd_1.o: exception_test_1.cc gcctestdir/as
3317         $(CXXCOMPILE) -c -fpic -Wa,-madd-bnd-prefix -o $@ $<
3318 exception_x86_64_bnd_2.o: exception_test_2.cc gcctestdir/as
3319         $(CXXCOMPILE) -c -Wa,-madd-bnd-prefix -o $@ $<
3320 endif DEFAULT_TARGET_X86_64
3322 if DEFAULT_TARGET_X86_64
3323 check_SCRIPTS += gnu_property_test.sh
3324 check_DATA += gnu_property_test.stdout
3325 MOSTLYCLEANFILES += gnu_property_test
3326 gnu_property_test.stdout: gnu_property_test
3327         $(TEST_READELF) -lhSWn $< >$@
3328 gnu_property_test: gcctestdir/ld gnu_property_a.o gnu_property_b.o gnu_property_c.o
3329         gcctestdir/ld --build-id -o $@ gnu_property_a.o gnu_property_b.o gnu_property_c.o
3330 gnu_property_main.o: gnu_property_main.c
3331         $(COMPILE) -c -o $@ $<
3332 gnu_property_a.o: gnu_property_a.S
3333         $(COMPILE) -c -o $@ $<
3334 gnu_property_b.o: gnu_property_b.S
3335         $(COMPILE) -c -o $@ $<
3336 gnu_property_c.o: gnu_property_c.S
3337         $(COMPILE) -c -o $@ $<
3338 endif DEFAULT_TARGET_X86_64
3340 check_PROGRAMS += pr22266
3341 pr22266: pr22266_main.o pr22266_ar.o gcctestdir/ld
3342         $(LINK) pr22266_main.o pr22266_ar.o
3343 pr22266_ar.o: pr22266_a.o gcctestdir/ld
3344         gcctestdir/ld -r -T $(srcdir)/pr22266_script.t -o $@ pr22266_a.o
3346 if DEFAULT_TARGET_AARCH64
3348 check_PROGRAMS += aarch64_pr23870
3349 aarch64_pr23870_SOURCES = aarch64_pr23870_foo.c
3350 aarch64_pr23870_DEPENDENCIES = \
3351         gcctestdir/ld gcctestdir/as aarch64_pr23870_main.o \
3352         aarch64_pr23870_foo.o aarch64_pr23870_bar.so
3353 aarch64_pr23870_LDFLAGS = -Wl,-R,. -L. -Wl,-l:aarch64_pr23870_bar.so
3354 aarch64_pr23870_LDADD = aarch64_pr23870_main.o
3355 aarch64_pr23870_main.o: aarch64_pr23870_main.S
3356         $(COMPILE) -c -o $@ $<
3357 aarch64_pr23870_foo.o: aarch64_pr23870_foo.c
3358         $(COMPILE) -c -o $@ $<
3359 aarch64_pr23870_bar.o: aarch64_pr23870_bar.c
3360         $(COMPILE) -c -fPIC -o $@ $<
3361 aarch64_pr23870_bar.so: aarch64_pr23870_bar.o
3362         $(COMPILE) -shared -o $@ $<
3364 endif DEFAULT_TARGET_AARCH64
3366 endif GCC
3367 endif NATIVE_LINKER
3369 # These tests work with native and cross linkers.
3371 if NATIVE_OR_CROSS_LINKER
3373 # Test script section order.
3374 check_SCRIPTS += script_test_10.sh
3375 check_DATA += script_test_10.stdout
3376 MOSTLYCLEANFILES += script_test_10
3377 script_test_10.o: script_test_10.s
3378         $(TEST_AS) -o $@ $<
3379 script_test_10: $(srcdir)/script_test_10.t script_test_10.o gcctestdir/ld
3380         gcctestdir/ld -o $@ script_test_10.o -T $(srcdir)/script_test_10.t
3381 script_test_10.stdout: script_test_10
3382         $(TEST_READELF) -SW script_test_10 > $@
3384 # These tests work with cross linkers only.
3386 if DEFAULT_TARGET_I386
3388 check_SCRIPTS += split_i386.sh
3389 check_DATA += split_i386_1.stdout split_i386_2.stdout \
3390         split_i386_3.stdout split_i386_4.stdout split_i386_r.stdout
3391 SPLIT_DEFSYMS = --defsym __morestack=0x100 --defsym __morestack_non_split=0x200
3392 split_i386_1.o: split_i386_1.s
3393         $(TEST_AS) -o $@ $<
3394 split_i386_2.o: split_i386_2.s
3395         $(TEST_AS) -o $@ $<
3396 split_i386_3.o: split_i386_3.s
3397         $(TEST_AS) -o $@ $<
3398 split_i386_4.o: split_i386_4.s
3399         $(TEST_AS) -o $@ $<
3400 split_i386_n.o: split_i386_n.s
3401         $(TEST_AS) -o $@ $<
3402 split_i386_1: split_i386_1.o split_i386_n.o ../ld-new
3403         ../ld-new $(SPLIT_DEFSYMS) -o $@ split_i386_1.o split_i386_n.o
3404 split_i386_1.stdout: split_i386_1
3405         $(TEST_OBJDUMP) -d $< > $@
3406 split_i386_2: split_i386_2.o split_i386_n.o ../ld-new
3407         ../ld-new $(SPLIT_DEFSYMS) -o $@ split_i386_2.o split_i386_n.o
3408 split_i386_2.stdout: split_i386_2
3409         $(TEST_OBJDUMP) -d $< > $@
3410 split_i386_3.stdout: split_i386_3.o split_i386_n.o ../ld-new
3411         ../ld-new $(SPLIT_DEFSYMS) -o split_i386_3 split_i386_3.o split_i386_n.o > $@ 2>&1 || exit 0
3412 split_i386_4: split_i386_4.o split_i386_n.o ../ld-new
3413         ../ld-new $(SPLIT_DEFSYMS) -o $@ split_i386_4.o split_i386_n.o
3414 split_i386_4.stdout: split_i386_4
3415         $(TEST_OBJDUMP) -d $< > $@
3416 split_i386_r.stdout: split_i386_1.o split_i386_n.o ../ld-new
3417         ../ld-new -r split_i386_1.o split_i386_n.o -o split_i386_r > $@ 2>&1 || exit 0
3418 MOSTLYCLEANFILES += split_i386_1 split_i386_2 split_i386_3 \
3419         split_i386_4 split_i386_r
3421 endif DEFAULT_TARGET_I386
3423 if DEFAULT_TARGET_X86_64
3425 check_SCRIPTS += split_x86_64.sh
3426 check_DATA += split_x86_64_1.stdout split_x86_64_2.stdout \
3427         split_x86_64_3.stdout split_x86_64_4.stdout split_x86_64_r.stdout
3428 SPLIT_DEFSYMS = --defsym __morestack=0x100 --defsym __morestack_non_split=0x200
3429 split_x86_64_1.o: split_x86_64_1.s
3430         $(TEST_AS) -o $@ $<
3431 split_x86_64_2.o: split_x86_64_2.s
3432         $(TEST_AS) -o $@ $<
3433 split_x86_64_3.o: split_x86_64_3.s
3434         $(TEST_AS) -o $@ $<
3435 split_x86_64_4.o: split_x86_64_4.s
3436         $(TEST_AS) -o $@ $<
3437 split_x86_64_n.o: split_x86_64_n.s
3438         $(TEST_AS) -o $@ $<
3439 split_x86_64_1: split_x86_64_1.o split_x86_64_n.o ../ld-new
3440         ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x86_64_1.o split_x86_64_n.o
3441 split_x86_64_1.stdout: split_x86_64_1
3442         $(TEST_OBJDUMP) -d $< > $@
3443 split_x86_64_2: split_x86_64_2.o split_x86_64_n.o ../ld-new
3444         ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x86_64_2.o split_x86_64_n.o
3445 split_x86_64_2.stdout: split_x86_64_2
3446         $(TEST_OBJDUMP) -d $< > $@
3447 split_x86_64_3.stdout: split_x86_64_3.o split_x86_64_n.o ../ld-new
3448         ../ld-new $(SPLIT_DEFSYMS) -o split_x86_64_3 split_x86_64_3.o split_x86_64_n.o > $@ 2>&1 || exit 0
3449 split_x86_64_4: split_x86_64_4.o split_x86_64_n.o ../ld-new
3450         ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x86_64_4.o split_x86_64_n.o
3451 split_x86_64_4.stdout: split_x86_64_4
3452         $(TEST_OBJDUMP) -d $< > $@
3453 split_x86_64_r.stdout: split_x86_64_1.o split_x86_64_n.o ../ld-new
3454         ../ld-new -r split_x86_64_1.o split_x86_64_n.o -o split_x86_64_r > $@ 2>&1 || exit 0
3455 MOSTLYCLEANFILES += split_x86_64_1 split_x86_64_2 split_x86_64_3 \
3456         split_x86_64_4 split_x86_64_r
3458 check_SCRIPTS += bnd_plt_1.sh
3459 check_DATA += bnd_plt_1.stdout
3460 bnd_plt_1.o: bnd_plt_1.s
3461         $(TEST_AS) --64 -o $@ $<
3462 bnd_plt_1.so: bnd_plt_1.o ../ld-new
3463         ../ld-new -shared -z bndplt bnd_plt_1.o -o $@
3464 bnd_plt_1.stdout: bnd_plt_1.so
3465         $(TEST_OBJDUMP) -dw $< > $@
3467 check_SCRIPTS += bnd_ifunc_1.sh
3468 check_DATA += bnd_ifunc_1.stdout
3469 bnd_ifunc_1.o: bnd_ifunc_1.s
3470         $(TEST_AS) --64 -madd-bnd-prefix -o $@ $<
3471 bnd_ifunc_1.so: bnd_ifunc_1.o ../ld-new
3472         ../ld-new -shared -z bndplt bnd_ifunc_1.o -o $@
3473 bnd_ifunc_1.stdout: bnd_ifunc_1.so
3474         $(TEST_OBJDUMP) -dw $< > $@
3476 check_SCRIPTS += bnd_ifunc_2.sh
3477 check_DATA += bnd_ifunc_2.stdout
3478 bnd_ifunc_2.o: bnd_ifunc_2.s
3479         $(TEST_AS) --64 -madd-bnd-prefix -o $@ $<
3480 bnd_ifunc_2.so: bnd_ifunc_2.o ../ld-new
3481         ../ld-new -shared -z bndplt bnd_ifunc_2.o -o $@
3482 bnd_ifunc_2.stdout: bnd_ifunc_2.so
3483         $(TEST_OBJDUMP) -dw $< > $@
3485 endif DEFAULT_TARGET_X86_64
3487 if DEFAULT_TARGET_X32
3489 check_SCRIPTS += split_x32.sh
3490 check_DATA += split_x32_1.stdout split_x32_2.stdout \
3491         split_x32_3.stdout split_x32_4.stdout split_x32_r.stdout
3492 SPLIT_DEFSYMS = --defsym __morestack=0x100 --defsym __morestack_non_split=0x200
3493 split_x32_1.o: split_x32_1.s
3494         $(TEST_AS) -o $@ $<
3495 split_x32_2.o: split_x32_2.s
3496         $(TEST_AS) -o $@ $<
3497 split_x32_3.o: split_x32_3.s
3498         $(TEST_AS) -o $@ $<
3499 split_x32_4.o: split_x32_4.s
3500         $(TEST_AS) -o $@ $<
3501 split_x32_n.o: split_x32_n.s
3502         $(TEST_AS) -o $@ $<
3503 split_x32_1: split_x32_1.o split_x32_n.o ../ld-new
3504         ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x32_1.o split_x32_n.o
3505 split_x32_1.stdout: split_x32_1
3506         $(TEST_OBJDUMP) -d $< > $@
3507 split_x32_2: split_x32_2.o split_x32_n.o ../ld-new
3508         ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x32_2.o split_x32_n.o
3509 split_x32_2.stdout: split_x32_2
3510         $(TEST_OBJDUMP) -d $< > $@
3511 split_x32_3.stdout: split_x32_3.o split_x32_n.o ../ld-new
3512         ../ld-new $(SPLIT_DEFSYMS) -o split_x32_3 split_x32_3.o split_x32_n.o > $@ 2>&1 || exit 0
3513 split_x32_4: split_x32_4.o split_x32_n.o ../ld-new
3514         ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x32_4.o split_x32_n.o
3515 split_x32_4.stdout: split_x32_4
3516         $(TEST_OBJDUMP) -d $< > $@
3517 split_x32_r.stdout: split_x32_1.o split_x32_n.o ../ld-new
3518         ../ld-new -r split_x32_1.o split_x32_n.o -o split_x32_r > $@ 2>&1 || exit 0
3519 MOSTLYCLEANFILES += split_x32_1 split_x32_2 split_x32_3 \
3520         split_x32_4 split_x32_r
3522 endif DEFAULT_TARGET_X32
3524 if DEFAULT_TARGET_ARM
3526 check_SCRIPTS += arm_abs_global.sh
3527 check_DATA += arm_abs_global.stdout
3528 arm_abs_lib.o: arm_abs_lib.s
3529         $(TEST_AS) -march=armv7-a -o $@ $<
3530 libarm_abs.so: arm_abs_lib.o ../ld-new
3531         ../ld-new -shared -o $@ arm_abs_lib.o
3532 arm_abs_global.o: arm_abs_global.s
3533         $(TEST_AS) -march=armv7-a -o $@ $<
3534 arm_abs_global: arm_abs_global.o libarm_abs.so ../ld-new
3535         ../ld-new -o $@ arm_abs_global.o -L. -larm_abs
3536 arm_abs_global.stdout: arm_abs_global
3537         $(TEST_READELF) -r $< > $@
3539 MOSTLYCLEANFILES += arm_abs_global
3541 check_SCRIPTS += arm_branch_in_range.sh arm_branch_out_of_range.sh
3542 check_DATA += arm_bl_in_range.stdout arm_bl_out_of_range.stdout \
3543         thumb_bl_in_range.stdout thumb_bl_out_of_range.stdout \
3544         thumb2_bl_in_range.stdout thumb2_bl_out_of_range.stdout \
3545         thumb_blx_in_range.stdout thumb_blx_out_of_range.stdout \
3546         thumb2_blx_in_range.stdout thumb2_blx_out_of_range.stdout \
3547         thumb_bl_out_of_range_local.stdout arm_thm_jump11.stdout \
3548         arm_thm_jump8.stdout
3550 arm_bl_in_range.stdout: arm_bl_in_range
3551         $(TEST_OBJDUMP) -D $< > $@
3553 arm_bl_in_range: arm_bl_in_range.o ../ld-new
3554         ../ld-new -T $(srcdir)/arm_branch_range.t -o $@ $<
3556 arm_bl_in_range.o: arm_bl_in_range.s
3557         $(TEST_AS) -o $@ $<
3559 arm_bl_out_of_range.stdout: arm_bl_out_of_range
3560         $(TEST_OBJDUMP) -S $< > $@
3562 arm_bl_out_of_range: arm_bl_out_of_range.o ../ld-new
3563         ../ld-new -T $(srcdir)/arm_branch_range.t -o $@ $<
3565 arm_bl_out_of_range.o: arm_bl_out_of_range.s
3566         $(TEST_AS) -o $@ $<
3568 thumb_bl_in_range.stdout: thumb_bl_in_range
3569         $(TEST_OBJDUMP) -D $< > $@
3571 thumb_bl_in_range: thumb_bl_in_range.o ../ld-new
3572         ../ld-new --no-fix-arm1176 -T $(srcdir)/thumb_branch_range.t -o $@ $<
3574 thumb_bl_in_range.o: thumb_bl_in_range.s
3575         $(TEST_AS) -o $@ -march=armv5te $<
3577 thumb_bl_out_of_range.stdout: thumb_bl_out_of_range
3578         $(TEST_OBJDUMP) -D $< > $@
3580 thumb_bl_out_of_range: thumb_bl_out_of_range.o ../ld-new
3581         ../ld-new --no-fix-arm1176 -T $(srcdir)/thumb_branch_range.t -o $@ $<
3583 thumb_bl_out_of_range.o: thumb_bl_out_of_range.s
3584         $(TEST_AS) -o $@ -march=armv5te $<
3586 thumb2_bl_in_range.stdout: thumb2_bl_in_range
3587         $(TEST_OBJDUMP) -D $< > $@
3589 thumb2_bl_in_range: thumb2_bl_in_range.o ../ld-new
3590         ../ld-new -T $(srcdir)/thumb2_branch_range.t -o $@ $<
3592 thumb2_bl_in_range.o: thumb_bl_in_range.s
3593         $(TEST_AS) -o $@ -march=armv7-a $<
3595 thumb2_bl_out_of_range.stdout: thumb2_bl_out_of_range
3596         $(TEST_OBJDUMP) -D $< > $@
3598 thumb2_bl_out_of_range: thumb2_bl_out_of_range.o ../ld-new
3599         ../ld-new -T $(srcdir)/thumb2_branch_range.t -o $@ $<
3601 thumb2_bl_out_of_range.o: thumb_bl_out_of_range.s
3602         $(TEST_AS) -o $@ -march=armv7-a $<
3604 thumb_blx_in_range.stdout: thumb_blx_in_range
3605         $(TEST_OBJDUMP) -D $< > $@
3607 thumb_blx_in_range: thumb_blx_in_range.o ../ld-new
3608         ../ld-new --no-fix-arm1176 -T $(srcdir)/thumb_branch_range.t -o $@ $<
3610 thumb_blx_in_range.o: thumb_blx_in_range.s
3611         $(TEST_AS) -o $@ -march=armv5te $<
3613 thumb_blx_out_of_range.stdout: thumb_blx_out_of_range
3614         $(TEST_OBJDUMP) -D $< > $@
3616 thumb_blx_out_of_range: thumb_blx_out_of_range.o ../ld-new
3617         ../ld-new --no-fix-arm1176 -T $(srcdir)/thumb_branch_range.t -o $@ $<
3619 thumb_blx_out_of_range.o: thumb_blx_out_of_range.s
3620         $(TEST_AS) -o $@ -march=armv5te $<
3622 thumb2_blx_in_range.stdout: thumb2_blx_in_range
3623         $(TEST_OBJDUMP) -D $< > $@
3625 thumb2_blx_in_range: thumb2_blx_in_range.o ../ld-new
3626         ../ld-new -T $(srcdir)/thumb2_branch_range.t -o $@ $<
3628 thumb2_blx_in_range.o: thumb_blx_in_range.s
3629         $(TEST_AS) -o $@ -march=armv7-a $<
3631 thumb2_blx_out_of_range.stdout: thumb2_blx_out_of_range
3632         $(TEST_OBJDUMP) -D $< > $@
3634 thumb2_blx_out_of_range: thumb2_blx_out_of_range.o ../ld-new
3635         ../ld-new -T $(srcdir)/thumb2_branch_range.t -o $@ $<
3637 thumb2_blx_out_of_range.o: thumb_blx_out_of_range.s
3638         $(TEST_AS) -o $@ -march=armv7-a $<
3640 thumb_bl_out_of_range_local.stdout: thumb_bl_out_of_range_local
3641         $(TEST_OBJDUMP) -D $< > $@
3643 thumb_bl_out_of_range_local: thumb_bl_out_of_range_local.o ../ld-new
3644         ../ld-new --no-fix-arm1176 -T $(srcdir)/thumb_branch_range.t -o $@ $<
3646 thumb_bl_out_of_range_local.o: thumb_bl_out_of_range_local.s
3647         $(TEST_AS) -o $@ -march=armv5te $<
3649 arm_thm_jump11.stdout: arm_thm_jump11
3650         $(TEST_OBJDUMP) -D $< > $@
3652 arm_thm_jump11: arm_thm_jump11.o ../ld-new
3653         ../ld-new -T $(srcdir)/arm_thm_jump11.t -o $@ $<
3655 arm_thm_jump11.o: arm_thm_jump11.s
3656         $(TEST_AS) -o $@ $<
3658 arm_thm_jump8.stdout: arm_thm_jump8
3659         $(TEST_OBJDUMP) -D $< > $@
3661 arm_thm_jump8: arm_thm_jump8.o ../ld-new
3662         ../ld-new -T $(srcdir)/arm_thm_jump8.t -o $@ $<
3664 arm_thm_jump8.o: arm_thm_jump8.s
3665         $(TEST_AS) -o $@ $<
3667 MOSTLYCLEANFILES += arm_bl_in_range arm_bl_out_of_range thumb_bl_in_range \
3668         thumb_bl_out_of_range thumb2_bl_in_range thumb2_bl_out_of_range \
3669         thumb_blx_in_range thumb_blx_out_of_range thumb2_blx_in_range \
3670         thumb2_blx_out_of_range thumb_bl_out_of_range_local arm_thm_jump11 \
3671         arm_thm_jump8
3673 check_SCRIPTS += arm_fix_v4bx.sh
3674 check_DATA += arm_fix_v4bx.stdout arm_fix_v4bx_interworking.stdout \
3675         arm_no_fix_v4bx.stdout
3677 arm_fix_v4bx.stdout: arm_fix_v4bx
3678         $(TEST_OBJDUMP) -D -j.text $< > $@
3680 arm_fix_v4bx: arm_fix_v4bx.o ../ld-new
3681         ../ld-new --no-fix-arm1176 --fix-v4bx -o $@ $<
3683 arm_fix_v4bx.o: arm_fix_v4bx.s
3684         $(TEST_AS) -o $@ $<
3686 arm_fix_v4bx_interworking.stdout: arm_fix_v4bx_interworking
3687         $(TEST_OBJDUMP) -D -j.text $< > $@
3689 arm_fix_v4bx_interworking: arm_fix_v4bx.o ../ld-new
3690         ../ld-new --no-fix-arm1176 --fix-v4bx-interworking -o $@ $<
3692 arm_no_fix_v4bx.stdout: arm_no_fix_v4bx
3693         $(TEST_OBJDUMP) -D -j.text $< > $@
3695 arm_no_fix_v4bx: arm_fix_v4bx.o ../ld-new
3696         ../ld-new --no-fix-arm1176 -o $@ $<
3698 MOSTLYCLEANFILES += arm_fix_v4bx arm_fix_v4bx_interworking arm_no_fix_v4bx
3700 check_SCRIPTS += arm_attr_merge.sh
3701 check_DATA += arm_attr_merge_6.stdout arm_attr_merge_6r.stdout \
3702         arm_attr_merge_7.stdout
3704 arm_attr_merge_6.stdout: arm_attr_merge_6
3705         $(TEST_READELF) -A $< > $@
3707 arm_attr_merge_6: arm_attr_merge_6a.o arm_attr_merge_6b.o ../ld-new
3708         ../ld-new -o $@ arm_attr_merge_6a.o arm_attr_merge_6b.o
3710 arm_attr_merge_6a.o: arm_attr_merge_6a.s
3711         $(TEST_AS) -o $@ $<
3713 arm_attr_merge_6b.o: arm_attr_merge_6b.s
3714         $(TEST_AS) -o $@ $<
3716 arm_attr_merge_6r.stdout: arm_attr_merge_6r
3717         $(TEST_READELF) -A $< > $@
3719 arm_attr_merge_6r: arm_attr_merge_6b.o arm_attr_merge_6a.o ../ld-new
3720         ../ld-new -o $@ arm_attr_merge_6b.o arm_attr_merge_6a.o
3722 arm_attr_merge_7.stdout: arm_attr_merge_7
3723         $(TEST_READELF) -A $< > $@
3725 arm_attr_merge_7: arm_attr_merge_7a.o arm_attr_merge_7b.o ../ld-new
3726         ../ld-new -o $@ arm_attr_merge_7a.o arm_attr_merge_7b.o
3728 arm_attr_merge_7a.o: arm_attr_merge_7a.s
3729         $(TEST_AS) -o $@ $<
3731 arm_attr_merge_7b.o: arm_attr_merge_7b.s
3732         $(TEST_AS) -o $@ $<
3734 MOSTLYCLEANFILES += arm_attr_merge_6 arm_attr_merge_6r arm_attr_merge_7
3736 # ARM1176 workaround test.
3737 check_SCRIPTS += arm_fix_1176.sh
3738 check_DATA += arm_fix_1176_default_v6z.stdout arm_fix_1176_on_v6z.stdout \
3739         arm_fix_1176_off_v6z.stdout arm_fix_1176_default_v5te.stdout \
3740         arm_fix_1176_default_v7a.stdout arm_fix_1176_default_1156t2f_s.stdout
3742 arm_fix_1176_default_v6z.stdout: arm_fix_1176_default_v6z
3743         $(TEST_OBJDUMP) -D -j.foo $< > $@
3745 arm_fix_1176_default_v6z: arm_fix_1176_default_v6z.o ../ld-new
3746         ../ld-new --section-start=.foo=0x2001014 -o $@ $<
3748 arm_fix_1176_default_v6z.o: arm_fix_1176.s
3749         $(TEST_AS) -march=armv6z -o $@ $<
3751 arm_fix_1176_on_v6z.stdout: arm_fix_1176_on_v6z
3752         $(TEST_OBJDUMP) -D -j.foo $< > $@
3754 arm_fix_1176_on_v6z: arm_fix_1176_on_v6z.o ../ld-new
3755         ../ld-new --section-start=.foo=0x2001014 --fix-arm1176 -o $@ $<
3757 arm_fix_1176_on_v6z.o: arm_fix_1176.s
3758         $(TEST_AS) -march=armv6z -o $@ $<
3760 arm_fix_1176_off_v6z.stdout: arm_fix_1176_off_v6z
3761         $(TEST_OBJDUMP) -D -j.foo $< > $@
3763 arm_fix_1176_off_v6z: arm_fix_1176_off_v6z.o ../ld-new
3764         ../ld-new --section-start=.foo=0x2001014 --no-fix-arm1176 -o $@ $<
3766 arm_fix_1176_off_v6z.o: arm_fix_1176.s
3767         $(TEST_AS) -march=armv6z -o $@ $<
3769 arm_fix_1176_default_v5te.stdout: arm_fix_1176_default_v5te
3770         $(TEST_OBJDUMP) -D -j.foo $< > $@
3772 arm_fix_1176_default_v5te: arm_fix_1176_default_v5te.o ../ld-new
3773         ../ld-new --section-start=.foo=0x2001014 -o $@ $<
3775 arm_fix_1176_default_v5te.o: arm_fix_1176.s
3776         $(TEST_AS) -march=armv5te -o $@ $<
3778 arm_fix_1176_default_v7a.stdout: arm_fix_1176_default_v7a
3779         $(TEST_OBJDUMP) -D -j.foo $< > $@
3781 arm_fix_1176_default_v7a: arm_fix_1176_default_v7a.o ../ld-new
3782         ../ld-new --section-start=.foo=0x2001014 -o $@ $<
3784 arm_fix_1176_default_v7a.o: arm_fix_1176.s
3785         $(TEST_AS) -march=armv7-a -o $@ $<
3787 arm_fix_1176_default_1156t2f_s.stdout: arm_fix_1176_default_1156t2f_s
3788         $(TEST_OBJDUMP) -D -j.foo $< > $@
3790 arm_fix_1176_default_1156t2f_s: arm_fix_1176_default_1156t2f_s.o ../ld-new
3791         ../ld-new --section-start=.foo=0x2001014 -o $@ $<
3793 arm_fix_1176_default_1156t2f_s.o: arm_fix_1176.s
3794         $(TEST_AS) -mcpu=arm1156t2f-s -o $@ $<
3796 MOSTLYCLEANFILES += arm_fix_1176_default_v6z arm_fix_1176_on_v6z arm_fix_1176_off_v6z \
3797         arm_fix_1176_default_v5te arm_fix_1176_default_v7a arm_fix_1176_default_1156t2f_s
3799 # Cortex-A8 workaround test.
3801 check_SCRIPTS += arm_cortex_a8.sh
3802 check_DATA += arm_cortex_a8_b_cond.stdout arm_cortex_a8_b.stdout \
3803         arm_cortex_a8_bl.stdout arm_cortex_a8_blx.stdout \
3804         arm_cortex_a8_local.stdout arm_cortex_a8_local_reloc.stdout
3806 arm_cortex_a8_b_cond.stdout: arm_cortex_a8_b_cond
3807         $(TEST_OBJDUMP) -D -j.text $< > $@
3809 arm_cortex_a8_b_cond: arm_cortex_a8_b_cond.o ../ld-new
3810         ../ld-new -o $@ $<
3812 arm_cortex_a8_b_cond.o: arm_cortex_a8_b_cond.s
3813         $(TEST_AS) -o $@ $<
3815 arm_cortex_a8_b.stdout: arm_cortex_a8_b
3816         $(TEST_OBJDUMP) -D -j.text $< > $@
3818 arm_cortex_a8_b: arm_cortex_a8_b.o ../ld-new
3819         ../ld-new --fix-cortex-a8 -o $@ $<
3821 arm_cortex_a8_b.o: arm_cortex_a8_b.s
3822         $(TEST_AS) -o $@ $<
3824 arm_cortex_a8_bl.stdout: arm_cortex_a8_bl
3825         $(TEST_OBJDUMP) -D -j.text $< > $@
3827 arm_cortex_a8_bl: arm_cortex_a8_bl.o ../ld-new
3828         ../ld-new -o $@ $<
3830 arm_cortex_a8_bl.o: arm_cortex_a8_bl.s
3831         $(TEST_AS) -o $@ $<
3833 arm_cortex_a8_blx.stdout: arm_cortex_a8_blx
3834         $(TEST_OBJDUMP) -D -j.text $< > $@
3836 arm_cortex_a8_blx: arm_cortex_a8_blx.o ../ld-new
3837         ../ld-new -o $@ $<
3839 arm_cortex_a8_blx.o: arm_cortex_a8_blx.s
3840         $(TEST_AS) -o $@ $<
3842 arm_cortex_a8_local.stdout: arm_cortex_a8_local
3843         $(TEST_OBJDUMP) -D -j.text $< > $@
3845 arm_cortex_a8_local: arm_cortex_a8_local.o ../ld-new
3846         ../ld-new -o $@ $<
3848 arm_cortex_a8_local.o: arm_cortex_a8_local.s
3849         $(TEST_AS) -o $@ $<
3851 arm_cortex_a8_local_reloc.stdout: arm_cortex_a8_local_reloc
3852         $(TEST_OBJDUMP) -D -j.text $< > $@
3854 arm_cortex_a8_local_reloc: arm_cortex_a8_local_reloc.o ../ld-new
3855         ../ld-new -o $@ $<
3857 arm_cortex_a8_local_reloc.o: arm_cortex_a8_local_reloc.s
3858         $(TEST_AS) -o $@ $<
3860 MOSTLYCLEANFILES += arm_cortex_a8_b_cond arm_cortex_a8_b arm_cortex_a8_bl \
3861         arm_cortex_a8_blx arm_cortex_a8_local arm_cortex_a8_local_reloc
3863 check_SCRIPTS += arm_exidx_test.sh
3864 check_DATA += arm_exidx_test.stdout
3866 arm_exidx_test.stdout: arm_exidx_test.so
3867         $(TEST_READELF) -Sr $< > $@
3869 arm_exidx_test.so: arm_exidx_test.o ../ld-new
3870         ../ld-new -shared -o $@ $<
3872 arm_exidx_test.o: arm_exidx_test.s
3873         $(TEST_AS) -o $@ $<
3875 check_SCRIPTS += pr12826.sh
3876 check_DATA += pr12826.stdout
3878 pr12826.stdout: pr12826.so
3879         $(TEST_READELF) -A $< > $@
3881 pr12826.so: pr12826_1.o pr12826_2.o ../ld-new
3882         ../ld-new -shared -o $@ $<
3884 pr12826_1.o: pr12826_1.s
3885         $(TEST_AS) -o $@ $<
3887 pr12826_2.o: pr12826_2.s
3888         $(TEST_AS) -o $@ $<
3890 check_SCRIPTS += arm_unaligned_reloc.sh
3891 check_DATA += arm_unaligned_reloc.stdout arm_unaligned_reloc_r.stdout
3893 arm_unaligned_reloc.stdout: arm_unaligned_reloc
3894         $(TEST_OBJDUMP) -D $< > $@
3896 arm_unaligned_reloc_r.stdout: arm_unaligned_reloc_r
3897         $(TEST_OBJDUMP) -Dr $< > $@
3899 arm_unaligned_reloc: arm_unaligned_reloc.o ../ld-new
3900         ../ld-new -o $@ $<
3902 arm_unaligned_reloc_r: arm_unaligned_reloc.o ../ld-new
3903         ../ld-new -r -o $@ $<
3905 arm_unaligned_reloc.o: arm_unaligned_reloc.s
3906         $(TEST_AS) -o $@ $<
3908 MOSTLYCLEANFILES += arm_unaligned_reloc arm_unaligned_reloc_r
3910 # Check ARM to ARM farcall veneers
3912 check_SCRIPTS += arm_farcall_arm_arm.sh
3913 check_DATA += arm_farcall_arm_arm.stdout
3915 arm_farcall_arm_arm.stdout: arm_farcall_arm_arm
3916         $(TEST_OBJDUMP) -d $< > $@
3918 arm_farcall_arm_arm: arm_farcall_arm_arm.o ../ld-new
3919         ../ld-new --no-fix-arm1176 --section-start .text=0x1000 --section-start .foo=0x2001020 -o $@ $<
3921 arm_farcall_arm_arm.o: arm_farcall_arm_arm.s
3922         $(TEST_AS) -o $@ $<
3924 MOSTLYCLEANFILES += arm_farcall_arm_arm
3926 # Check ARM to Thumb farcall veneers
3928 check_SCRIPTS += arm_farcall_arm_thumb.sh
3929 check_DATA += arm_farcall_arm_thumb.stdout arm_farcall_arm_thumb_5t.stdout
3931 arm_farcall_arm_thumb.stdout: arm_farcall_arm_thumb
3932         $(TEST_OBJDUMP) -D $< > $@
3934 arm_farcall_arm_thumb: arm_farcall_arm_thumb.o ../ld-new
3935         ../ld-new --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
3937 arm_farcall_arm_thumb.o: arm_farcall_arm_thumb.s
3938         $(TEST_AS) -o $@ $<
3940 arm_farcall_arm_thumb_5t.stdout: arm_farcall_arm_thumb_5t
3941         $(TEST_OBJDUMP) -D $< > $@
3943 arm_farcall_arm_thumb_5t: arm_farcall_arm_thumb_5t.o ../ld-new
3944         ../ld-new --no-fix-arm1176 --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
3946 arm_farcall_arm_thumb_5t.o: arm_farcall_arm_thumb.s
3947         $(TEST_AS) -march=armv5t -o $@ $<
3949 MOSTLYCLEANFILES += arm_farcall_arm_thumb arm_farcall_arm_thumb_5t
3951 # Check Thumb to Thumb farcall veneers
3953 check_SCRIPTS += arm_farcall_thumb_thumb.sh
3954 check_DATA += arm_farcall_thumb_thumb.stdout \
3955               arm_farcall_thumb_thumb_5t.stdout \
3956               arm_farcall_thumb_thumb_7m.stdout \
3957               arm_farcall_thumb_thumb_6m.stdout
3959 arm_farcall_thumb_thumb.stdout: arm_farcall_thumb_thumb
3960         $(TEST_OBJDUMP) -D $< > $@
3962 arm_farcall_thumb_thumb: arm_farcall_thumb_thumb.o ../ld-new
3963         ../ld-new --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
3965 arm_farcall_thumb_thumb.o: arm_farcall_thumb_thumb.s
3966         $(TEST_AS) -march=armv4t -o $@ $<
3968 arm_farcall_thumb_thumb_5t.stdout: arm_farcall_thumb_thumb_5t
3969         $(TEST_OBJDUMP) -D $< > $@
3971 arm_farcall_thumb_thumb_5t: arm_farcall_thumb_thumb_5t.o ../ld-new
3972         ../ld-new --no-fix-arm1176 --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
3974 arm_farcall_thumb_thumb_5t.o: arm_farcall_thumb_thumb.s
3975         $(TEST_AS) -march=armv5t -o $@ $<
3977 arm_farcall_thumb_thumb_7m.stdout: arm_farcall_thumb_thumb_7m
3978         $(TEST_OBJDUMP) -D $< > $@
3980 arm_farcall_thumb_thumb_7m: arm_farcall_thumb_thumb_7m.o ../ld-new
3981         ../ld-new --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
3983 arm_farcall_thumb_thumb_7m.o: arm_farcall_thumb_thumb.s
3984         $(TEST_AS) -march=armv7-m -o $@ $<
3986 arm_farcall_thumb_thumb_6m.stdout: arm_farcall_thumb_thumb_6m
3987         $(TEST_OBJDUMP) -D $< > $@
3989 arm_farcall_thumb_thumb_6m: arm_farcall_thumb_thumb_6m.o ../ld-new
3990         ../ld-new --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
3992 arm_farcall_thumb_thumb_6m.o: arm_farcall_thumb_thumb.s
3993         $(TEST_AS) -march=armv6-m -o $@ $<
3995 MOSTLYCLEANFILES += arm_farcall_thumb_thumb arm_farcall_thumb_thumb_5t \
3996                     arm_farcall_thumb_thumb_7m arm_farcall_thumb_thumb_6m
3998 #Check ARM to ARM farcall veneers in the be8 mode addressing
4000 check_SCRIPTS += arm_farcall_arm_arm_be8.sh
4001 check_DATA += arm_farcall_arm_arm_be8.stdout
4003 arm_farcall_arm_arm_be8.stdout: arm_farcall_arm_arm_be8
4004         $(TEST_OBJDUMP) -D $< > $@
4006 arm_farcall_arm_arm_be8: arm_farcall_arm_arm_be8.o ../ld-new
4007         ../ld-new --no-fix-arm1176 --section-start .text=0x1000 --section-start .foo=0x2001020 -EB --be8 -o $@ $<
4009 arm_farcall_arm_arm_be8.o: arm_farcall_arm_arm.s
4010         $(TEST_AS) -EB -o $@ $<
4012 MOSTLYCLEANFILES += arm_farcall_arm_arm_be8
4014 #Check THUMB  to  THUMB farcall veneers in the be8 mode addressing
4016 check_SCRIPTS += arm_farcall_thumb_thumb_be8.sh
4017 check_DATA += arm_farcall_thumb_thumb_be8.stdout
4019 arm_farcall_thumb_thumb_be8.stdout: arm_farcall_thumb_thumb_be8
4020         $(TEST_OBJDUMP) -D $< > $@
4022 arm_farcall_thumb_thumb_be8: arm_farcall_thumb_thumb_be8.o ../ld-new
4023         ../ld-new --section-start .text=0x1000 --section-start .foo=0x2001014 -EB --be8 -o $@ $<
4025 arm_farcall_thumb_thumb_be8.o: arm_farcall_thumb_thumb.s
4026         $(TEST_AS) -march=armv7-m -EB -o $@ $<
4028 MOSTLYCLEANFILES += arm_farcall_thumb_thumb_be8
4030 # Check Thumb to ARM farcall veneers
4032 check_SCRIPTS += arm_farcall_thumb_arm.sh
4033 check_DATA += arm_farcall_thumb_arm.stdout \
4034               arm_farcall_thumb_arm_5t.stdout
4036 arm_farcall_thumb_arm.stdout: arm_farcall_thumb_arm
4037         $(TEST_OBJDUMP) -D $< > $@
4039 arm_farcall_thumb_arm: arm_farcall_thumb_arm.o ../ld-new
4040         ../ld-new --section-start .text=0x1c01010 --section-start .foo=0x2001014 -o $@ $<
4042 arm_farcall_thumb_arm.o: arm_farcall_thumb_arm.s
4043         $(TEST_AS) -o $@ $<
4045 arm_farcall_thumb_arm_5t.stdout: arm_farcall_thumb_arm_5t
4046         $(TEST_OBJDUMP) -D $< > $@
4048 arm_farcall_thumb_arm_5t: arm_farcall_thumb_arm_5t.o ../ld-new
4049         ../ld-new --no-fix-arm1176 --section-start .text=0x1c01010 --section-start .foo=0x2001014 -o $@ $<
4051 arm_farcall_thumb_arm_5t.o: arm_farcall_thumb_arm.s
4052         $(TEST_AS) -march=armv5t -o $@ $<
4054 MOSTLYCLEANFILES += arm_farcall_thumb_arm arm_farcall_thumb_arm_5t
4056 # Check handling of --target1-abs, --target1-rel and --target2 options
4058 check_SCRIPTS += arm_target1_abs.sh arm_target1_rel.sh \
4059                  arm_target2_rel.sh arm_target2_abs.sh arm_target2_got_rel.sh
4060 check_DATA += arm_target1_abs.stdout arm_target1_rel.stdout \
4061               arm_target2_rel.stdout arm_target2_abs.stdout arm_target2_got_rel.stdout
4063 arm_target1_abs.stdout: arm_target1_abs
4064         $(TEST_OBJDUMP) -s $< > $@
4066 arm_target1_abs: arm_target1.o ../ld-new
4067         ../ld-new --target1-abs --section-start .text=0x8000 -o $@ $<
4069 arm_target1_rel.stdout: arm_target1_rel
4070         $(TEST_OBJDUMP) -s $< > $@
4072 arm_target1_rel: arm_target1.o ../ld-new
4073         ../ld-new --target1-rel --section-start .text=0x8000 -o $@ $<
4075 arm_target1.o: arm_target1.s
4076         $(TEST_AS) -o $@ $<
4078 arm_target2_rel.stdout: arm_target2_rel
4079         $(TEST_OBJDUMP) -s $< > $@
4081 arm_target2_rel: arm_target2.o ../ld-new
4082         ../ld-new --target2=rel --section-start .text=0x8000 -o $@ $<
4084 arm_target2_abs.stdout: arm_target2_abs
4085         $(TEST_OBJDUMP) -s $< > $@
4087 arm_target2_abs: arm_target2.o ../ld-new
4088         ../ld-new --target2=abs --section-start .text=0x8000 -o $@ $<
4090 arm_target2_got_rel.stdout: arm_target2_got_rel
4091         $(TEST_OBJDUMP) -s $< > $@
4093 arm_target2_got_rel: arm_target2.o ../ld-new
4094         ../ld-new --target2=got-rel --section-start .text=0x8000 --section-start .got=0x9000 -o $@ $<
4096 arm_target2.o: arm_target2.s
4097         $(TEST_AS) -o $@ $<
4099 MOSTLYCLEANFILES += arm_target1_abs arm_target1_rel \
4100                     arm_target2_rel arm_target2_abs arm_target2_got_rel
4102 # The test demonstrates why the constructor of a target object should not access options.
4103 check_DATA += arm_target_lazy_init
4104 MOSTLYCLEANFILES += arm_target_lazy_init
4105 arm_target_lazy_init: arm_target_lazy_init.o arm_target_lazy_init.t ../ld-new
4106         ../ld-new -T $(srcdir)/arm_target_lazy_init.t -o $@ $<
4107 arm_target_lazy_init.o: arm_target_lazy_init.s
4108         $(TEST_AS) -EL -o $@ $<
4110 endif DEFAULT_TARGET_ARM
4112 if DEFAULT_TARGET_AARCH64
4114 check_SCRIPTS += aarch64_reloc_none.sh
4115 check_DATA += aarch64_reloc_none.stdout
4116 aarch64_reloc_none.o: aarch64_reloc_none.s
4117         $(TEST_AS) -o $@ $<
4118 aarch64_reloc_none: aarch64_reloc_none.o ../ld-new
4119         ../ld-new -o $@ aarch64_reloc_none.o --gc-sections
4120 aarch64_reloc_none.stdout: aarch64_reloc_none
4121         $(TEST_NM) $< > $@
4123 MOSTLYCLEANFILES += aarch64_reloc_none
4125 check_SCRIPTS += aarch64_relocs.sh
4126 check_DATA += aarch64_relocs.stdout
4127 aarch64_globals.o: aarch64_globals.s
4128         $(TEST_AS) -o $@ $<
4129 aarch64_relocs.o: aarch64_relocs.s
4130         $(TEST_AS) -o $@ $<
4131 aarch64_relocs: aarch64_relocs.o aarch64_globals.o ../ld-new
4132         ../ld-new -o $@ aarch64_relocs.o aarch64_globals.o -e0 --emit-relocs
4133 aarch64_relocs.stdout: aarch64_relocs
4134         $(TEST_OBJDUMP) -dr $< > $@
4136 MOSTLYCLEANFILES += aarch64_relocs
4138 check_SCRIPTS += pr21430.sh
4139 check_DATA += pr21430.stdout
4140 pr21430.o: pr21430.s
4141         $(TEST_AS) -o $@ $<
4142 pr21430: pr21430.o ../ld-new
4143         ../ld-new -o $@ $<
4144 pr21430.stdout: pr21430
4145         $(TEST_NM) -S $< > $@
4147 MOSTLYCLEANFILES += pr21430
4149 check_SCRIPTS += aarch64_tlsdesc.sh
4150 check_DATA += aarch64_tlsdesc.stdout
4151 aarch64_tlsdesc.o: aarch64_tlsdesc.s
4152         $(TEST_AS) -o $@ $<
4153 aarch64_tlsdesc: aarch64_tlsdesc.o $(srcdir)/aarch64_tlsdesc.t ../ld-new
4154         ../ld-new $< -shared -T $(srcdir)/aarch64_tlsdesc.t -o $@
4155 aarch64_tlsdesc.stdout: aarch64_tlsdesc
4156         $(TEST_OBJDUMP) -dR -j.text -j.got.plt $< > $@
4158 MOSTLYCLEANFILES += aarch64_tlsdesc
4160 endif DEFAULT_TARGET_AARCH64
4162 if DEFAULT_TARGET_S390
4164 check_SCRIPTS += split_s390.sh
4165 check_DATA += split_s390_z1.stdout split_s390_z2.stdout split_s390_z3.stdout \
4166         split_s390_z4.stdout split_s390_n1.stdout split_s390_n2.stdout \
4167         split_s390_a1.stdout split_s390_a2.stdout split_s390_z1_ns.stdout \
4168         split_s390_z2_ns.stdout split_s390_z3_ns.stdout split_s390_z4_ns.stdout \
4169         split_s390_n1_ns.stdout split_s390_n2_ns.stdout split_s390_r.stdout \
4170         split_s390x_z1.stdout split_s390x_z2.stdout split_s390x_z3.stdout \
4171         split_s390x_z4.stdout split_s390x_n1.stdout split_s390x_n2.stdout \
4172         split_s390x_a1.stdout split_s390x_a2.stdout split_s390x_z1_ns.stdout \
4173         split_s390x_z2_ns.stdout split_s390x_z3_ns.stdout \
4174         split_s390x_z4_ns.stdout split_s390x_n1_ns.stdout \
4175         split_s390x_n2_ns.stdout split_s390x_r.stdout
4176 SPLIT_DEFSYMS = --defsym __morestack=0x100 --defsym __morestack_non_split=0x200
4177 split_s390_1_z1.o: split_s390_1_z1.s
4178         $(TEST_AS) -m31 -o $@ $<
4179 split_s390_1_z2.o: split_s390_1_z2.s
4180         $(TEST_AS) -m31 -o $@ $<
4181 split_s390_1_z3.o: split_s390_1_z3.s
4182         $(TEST_AS) -m31 -o $@ $<
4183 split_s390_1_z4.o: split_s390_1_z4.s
4184         $(TEST_AS) -m31 -o $@ $<
4185 split_s390_1_n1.o: split_s390_1_n1.s
4186         $(TEST_AS) -m31 -o $@ $<
4187 split_s390_1_n2.o: split_s390_1_n2.s
4188         $(TEST_AS) -m31 -o $@ $<
4189 split_s390_1_a1.o: split_s390_1_a1.s
4190         $(TEST_AS) -m31 -o $@ $<
4191 split_s390_1_a2.o: split_s390_1_a2.s
4192         $(TEST_AS) -m31 -o $@ $<
4193 split_s390_2_s.o: split_s390_2_s.s
4194         $(TEST_AS) -m31 -o $@ $<
4195 split_s390_2_ns.o: split_s390_2_ns.s
4196         $(TEST_AS) -m31 -o $@ $<
4197 split_s390_z1: split_s390_1_z1.o split_s390_2_s.o ../ld-new
4198         ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_z1.o split_s390_2_s.o
4199 split_s390_z1.stdout: split_s390_z1
4200         $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
4201 split_s390_z2: split_s390_1_z2.o split_s390_2_s.o ../ld-new
4202         ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_z2.o split_s390_2_s.o
4203 split_s390_z2.stdout: split_s390_z2
4204         $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
4205 split_s390_z3: split_s390_1_z3.o split_s390_2_s.o ../ld-new
4206         ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_z3.o split_s390_2_s.o
4207 split_s390_z3.stdout: split_s390_z3
4208         $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
4209 split_s390_z4: split_s390_1_z4.o split_s390_2_s.o ../ld-new
4210         ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_z4.o split_s390_2_s.o
4211 split_s390_z4.stdout: split_s390_z4
4212         $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
4213 split_s390_n1: split_s390_1_n1.o split_s390_2_s.o ../ld-new
4214         ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_n1.o split_s390_2_s.o
4215 split_s390_n1.stdout: split_s390_n1
4216         $(TEST_OBJDUMP) -d $< > $@
4217 split_s390_n2: split_s390_1_n2.o split_s390_2_s.o ../ld-new
4218         ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_n2.o split_s390_2_s.o
4219 split_s390_n2.stdout: split_s390_n2
4220         $(TEST_OBJDUMP) -d $< > $@
4221 split_s390_z1_ns: split_s390_1_z1.o split_s390_2_ns.o ../ld-new
4222         ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_z1.o split_s390_2_ns.o
4223 split_s390_z1_ns.stdout: split_s390_z1_ns
4224         $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
4225 split_s390_z2_ns: split_s390_1_z2.o split_s390_2_ns.o ../ld-new
4226         ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_z2.o split_s390_2_ns.o
4227 split_s390_z2_ns.stdout: split_s390_z2_ns
4228         $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
4229 split_s390_z3_ns: split_s390_1_z3.o split_s390_2_ns.o ../ld-new
4230         ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_z3.o split_s390_2_ns.o
4231 split_s390_z3_ns.stdout: split_s390_z3_ns
4232         $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
4233 split_s390_z4_ns: split_s390_1_z4.o split_s390_2_ns.o ../ld-new
4234         ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_z4.o split_s390_2_ns.o
4235 split_s390_z4_ns.stdout: split_s390_z4_ns
4236         $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
4237 split_s390_n1_ns: split_s390_1_n1.o split_s390_2_ns.o ../ld-new
4238         ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_n1.o split_s390_2_ns.o
4239 split_s390_n1_ns.stdout: split_s390_n1_ns
4240         $(TEST_OBJDUMP) -d $< > $@
4241 split_s390_n2_ns.stdout: split_s390_1_n2.o split_s390_2_ns.o ../ld-new
4242         ../ld-new $(SPLIT_DEFSYMS) -o split_s390_n2 split_s390_1_n2.o split_s390_2_ns.o > $@ 2>&1 || exit 0
4243 split_s390_a1.stdout: split_s390_1_a1.o split_s390_2_ns.o ../ld-new
4244         ../ld-new $(SPLIT_DEFSYMS) -o split_s390_a1 split_s390_1_a1.o split_s390_2_ns.o > $@ 2>&1 || exit 0
4245 split_s390_a2: split_s390_1_a2.o split_s390_2_ns.o ../ld-new
4246         ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_a2.o split_s390_2_ns.o
4247 split_s390_a2.stdout: split_s390_a2
4248         $(TEST_OBJDUMP) -d $< > $@
4249 split_s390_r.stdout: split_s390_1_z1.o split_s390_2_ns.o ../ld-new
4250         ../ld-new -r split_s390_1_z1.o split_s390_2_ns.o -o split_s390_r > $@ 2>&1 || exit 0
4251 split_s390x_1_z1.o: split_s390x_1_z1.s
4252         $(TEST_AS) -m64 -o $@ $<
4253 split_s390x_1_z2.o: split_s390x_1_z2.s
4254         $(TEST_AS) -m64 -o $@ $<
4255 split_s390x_1_z3.o: split_s390x_1_z3.s
4256         $(TEST_AS) -m64 -o $@ $<
4257 split_s390x_1_z4.o: split_s390x_1_z4.s
4258         $(TEST_AS) -m64 -o $@ $<
4259 split_s390x_1_n1.o: split_s390x_1_n1.s
4260         $(TEST_AS) -m64 -o $@ $<
4261 split_s390x_1_n2.o: split_s390x_1_n2.s
4262         $(TEST_AS) -m64 -o $@ $<
4263 split_s390x_1_a1.o: split_s390x_1_a1.s
4264         $(TEST_AS) -m64 -o $@ $<
4265 split_s390x_1_a2.o: split_s390x_1_a2.s
4266         $(TEST_AS) -m64 -o $@ $<
4267 split_s390x_2_s.o: split_s390x_2_s.s
4268         $(TEST_AS) -m64 -o $@ $<
4269 split_s390x_2_ns.o: split_s390x_2_ns.s
4270         $(TEST_AS) -m64 -o $@ $<
4271 split_s390x_z1: split_s390x_1_z1.o split_s390x_2_s.o ../ld-new
4272         ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_z1.o split_s390x_2_s.o
4273 split_s390x_z1.stdout: split_s390x_z1
4274         $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
4275 split_s390x_z2: split_s390x_1_z2.o split_s390x_2_s.o ../ld-new
4276         ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_z2.o split_s390x_2_s.o
4277 split_s390x_z2.stdout: split_s390x_z2
4278         $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
4279 split_s390x_z3: split_s390x_1_z3.o split_s390x_2_s.o ../ld-new
4280         ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_z3.o split_s390x_2_s.o
4281 split_s390x_z3.stdout: split_s390x_z3
4282         $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
4283 split_s390x_z4: split_s390x_1_z4.o split_s390x_2_s.o ../ld-new
4284         ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_z4.o split_s390x_2_s.o
4285 split_s390x_z4.stdout: split_s390x_z4
4286         $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
4287 split_s390x_n1: split_s390x_1_n1.o split_s390x_2_s.o ../ld-new
4288         ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_n1.o split_s390x_2_s.o
4289 split_s390x_n1.stdout: split_s390x_n1
4290         $(TEST_OBJDUMP) -d $< > $@
4291 split_s390x_n2: split_s390x_1_n2.o split_s390x_2_s.o ../ld-new
4292         ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_n2.o split_s390x_2_s.o
4293 split_s390x_n2.stdout: split_s390x_n2
4294         $(TEST_OBJDUMP) -d $< > $@
4295 split_s390x_z1_ns: split_s390x_1_z1.o split_s390x_2_ns.o ../ld-new
4296         ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_z1.o split_s390x_2_ns.o
4297 split_s390x_z1_ns.stdout: split_s390x_z1_ns
4298         $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
4299 split_s390x_z2_ns: split_s390x_1_z2.o split_s390x_2_ns.o ../ld-new
4300         ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_z2.o split_s390x_2_ns.o
4301 split_s390x_z2_ns.stdout: split_s390x_z2_ns
4302         $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
4303 split_s390x_z3_ns: split_s390x_1_z3.o split_s390x_2_ns.o ../ld-new
4304         ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_z3.o split_s390x_2_ns.o
4305 split_s390x_z3_ns.stdout: split_s390x_z3_ns
4306         $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
4307 split_s390x_z4_ns: split_s390x_1_z4.o split_s390x_2_ns.o ../ld-new
4308         ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_z4.o split_s390x_2_ns.o
4309 split_s390x_z4_ns.stdout: split_s390x_z4_ns
4310         $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
4311 split_s390x_n1_ns: split_s390x_1_n1.o split_s390x_2_ns.o ../ld-new
4312         ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_n1.o split_s390x_2_ns.o
4313 split_s390x_n1_ns.stdout: split_s390x_n1_ns
4314         $(TEST_OBJDUMP) -d $< > $@
4315 split_s390x_n2_ns.stdout: split_s390x_1_n2.o split_s390x_2_ns.o ../ld-new
4316         ../ld-new $(SPLIT_DEFSYMS) -o split_s390x_n2 split_s390x_1_n2.o split_s390x_2_ns.o > $@ 2>&1 || exit 0
4317 split_s390x_a1.stdout: split_s390x_1_a1.o split_s390x_2_ns.o ../ld-new
4318         ../ld-new $(SPLIT_DEFSYMS) -o split_s390x_a1 split_s390x_1_a1.o split_s390x_2_ns.o > $@ 2>&1 || exit 0
4319 split_s390x_a2: split_s390x_1_a2.o split_s390x_2_ns.o ../ld-new
4320         ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_a2.o split_s390x_2_ns.o
4321 split_s390x_a2.stdout: split_s390x_a2
4322         $(TEST_OBJDUMP) -d $< > $@
4323 split_s390x_r.stdout: split_s390x_1_z1.o split_s390x_2_ns.o ../ld-new
4324         ../ld-new -r split_s390x_1_z1.o split_s390x_2_ns.o -o split_s390x_r > $@ 2>&1 || exit 0
4325 MOSTLYCLEANFILES += split_s390_z1 split_s390_z2 split_s390_z3 \
4326         split_s390_z4 split_s390_n1 split_s390_n2 split_s390_a1 \
4327         split_s390_a2 split_s390_z1_ns split_s390_z2_ns split_s390_z3_ns \
4328         split_s390_z4_ns split_s390_n1_ns split_s390_n2_ns split_s390_r \
4329         split_s390x_z1 split_s390x_z2 split_s390x_z3 split_s390x_z4 \
4330         split_s390x_n1 split_s390x_n2 split_s390x_a1 split_s390x_a2 \
4331         split_s390x_z1_ns split_s390x_z2_ns split_s390x_z3_ns \
4332         split_s390x_z4_ns split_s390x_n1_ns split_s390x_n2_ns split_s390x_r
4334 endif DEFAULT_TARGET_S390
4336 endif NATIVE_OR_CROSS_LINKER
4338 # Tests for the dwp tool.
4339 # We don't want to rely yet on GCC support for -gsplit-dwarf,
4340 # so we use (for now) test cases in x86 assembly language,
4341 # compiled from the dwp_test_*.cc sources.
4343 if DEFAULT_TARGET_X86_64
4345 dwp_test_main.o: dwp_test_main.s
4346         $(TEST_AS) -o $@ $<
4347 dwp_test_1.o: dwp_test_1.s
4348         $(TEST_AS) -o $@ $<
4349 dwp_test_1b.o: dwp_test_1b.s
4350         $(TEST_AS) -o $@ $<
4351 dwp_test_2.o: dwp_test_2.s
4352         $(TEST_AS) -o $@ $<
4354 dwp_test_main.dwo: dwp_test_main.o
4355         $(TEST_OBJCOPY) --extract-dwo $< $@
4356 dwp_test_1.dwo: dwp_test_1.o
4357         $(TEST_OBJCOPY) --extract-dwo $< $@
4358 dwp_test_1b.dwo: dwp_test_1b.o
4359         $(TEST_OBJCOPY) --extract-dwo $< $@
4360 dwp_test_2.dwo: dwp_test_2.o
4361         $(TEST_OBJCOPY) --extract-dwo $< $@
4363 MOSTLYCLEANFILES += *.dwo *.dwp
4364 check_SCRIPTS += dwp_test_1.sh
4365 check_DATA += dwp_test_1.stdout
4366 dwp_test_1.stdout: dwp_test_1.dwp
4367         $(TEST_READELF) -wi $< > $@
4368 dwp_test_1.dwp: ../dwp dwp_test_main.dwo dwp_test_1.dwo dwp_test_1b.dwo dwp_test_2.dwo
4369         ../dwp -o $@ dwp_test_main.dwo dwp_test_1.dwo dwp_test_1b.dwo dwp_test_2.dwo
4371 check_SCRIPTS += dwp_test_2.sh
4372 check_DATA += dwp_test_2.stdout
4373 dwp_test_2.stdout: dwp_test_2.dwp
4374         $(TEST_READELF) -wi $< > $@
4375 dwp_test_2.dwp: ../dwp dwp_test_2a.dwp dwp_test_2b.dwp
4376         ../dwp -o $@ dwp_test_2a.dwp dwp_test_2b.dwp
4377 dwp_test_2a.dwp: ../dwp dwp_test_main.dwo dwp_test_1.dwo
4378         ../dwp -o $@ dwp_test_main.dwo dwp_test_1.dwo
4379 dwp_test_2b.dwp: ../dwp dwp_test_1b.dwo dwp_test_2.dwo
4380         ../dwp -o $@ dwp_test_1b.dwo dwp_test_2.dwo
4382 endif DEFAULT_TARGET_X86_64