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)
22 -I$(srcdir) -I$(srcdir)/.. -I$(srcdir)/../../include \
23 -I$(srcdir)/../../elfcpp -I.. \
24 -DLOCALEDIR="\"$(datadir)/locale\"" \
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
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
81 THREADFLAGS = @PTHREAD_CFLAGS@
82 THREADLIBS = @PTHREAD_LIBS@
86 TLS_TEST_C_CFLAGS = -fopenmp
89 # 'make clean' is good about deleting some intermediate files (such as
90 # .o's), but not all of them (such as .so's and .err files). We
91 # improve on that here. automake-1.9 info docs say "mostlyclean" is
92 # the right choice for files 'make' builds that people rebuild.
93 MOSTLYCLEANFILES = *.so *.syms *.stdout *.stderr
95 # Export make variables to the shell scripts so that they can see
96 # (for example) DEFAULT_TARGET.
97 .EXPORT_ALL_VARIABLES:
99 # We will add to these later, for each individual test. Note
100 # that we add each test under check_SCRIPTS or check_PROGRAMS;
101 # the TESTS variable is automatically populated from these.
107 TESTS = $(check_SCRIPTS) $(check_PROGRAMS)
109 # ---------------------------------------------------------------------
110 # These tests test the internals of gold (unittests).
112 # Infrastucture needed for the unittests
113 check_LIBRARIES = libgoldtest.a
114 libgoldtest_a_SOURCES = test.cc testmain.cc testfile.cc
117 libgoldtest.a ../libgold.a ../../libiberty/libiberty.a $(LIBINTL_DEP)
119 # The unittests themselves
120 if NATIVE_OR_CROSS_LINKER
123 # Infrastucture needed for the unittests: a directory where the linker
124 # is named 'ld'. This is because the -B flag appends 'ld' to its arg.
125 gcctestdir/ld: ../ld-new gcctestdir/collect-ld
126 test -d gcctestdir || mkdir -p gcctestdir
128 $(LN_S) $(abs_top_builddir)/ld-new $@
130 # Needed when using uninstalled compiler
131 gcctestdir/collect-ld: ../ld-new
132 test -d gcctestdir || mkdir -p gcctestdir
134 $(LN_S) $(abs_top_builddir)/ld-new $@
136 # Some tests require the latest features of an in-tree assembler.
137 gcctestdir/as: $(TEST_AS)
138 test -d gcctestdir || mkdir -p gcctestdir
140 $(LN_S) $(abs_top_builddir)/../gas/as-new $@
144 check_PROGRAMS += object_unittest
145 object_unittest_SOURCES = object_unittest.cc
146 object_unittest_LDFLAGS = $(THREADFLAGS)
147 object_unittest_LDADD = libgoldtest.a ../libgold.a ../../libiberty/libiberty.a $(LIBINTL) \
148 $(THREADLIBS) $(LIBDL) $(ZLIB)
150 check_PROGRAMS += binary_unittest
151 binary_unittest_SOURCES = binary_unittest.cc
152 binary_unittest_LDFLAGS = $(THREADFLAGS)
153 binary_unittest_LDADD = libgoldtest.a ../libgold.a ../../libiberty/libiberty.a $(LIBINTL) \
154 $(THREADLIBS) $(LIBDL) $(ZLIB)
156 check_PROGRAMS += leb128_unittest
157 leb128_unittest_SOURCES = leb128_unittest.cc
158 leb128_unittest_LDFLAGS = $(THREADFLAGS)
159 leb128_unittest_LDADD = libgoldtest.a ../libgold.a ../../libiberty/libiberty.a $(LIBINTL) \
160 $(THREADLIBS) $(LIBDL) $(ZLIB)
162 check_PROGRAMS += overflow_unittest
163 overflow_unittest_SOURCES = overflow_unittest.cc
164 overflow_unittest_LDFLAGS = $(THREADFLAGS)
165 overflow_unittest_LDADD = libgoldtest.a ../libgold.a ../../libiberty/libiberty.a $(LIBINTL) \
166 $(THREADLIBS) $(LIBDL) $(ZLIB)
167 overflow_unittest.o: overflow_unittest.cc
168 $(CXXCOMPILE) -O3 -c -o $@ $<
170 endif NATIVE_OR_CROSS_LINKER
172 # ---------------------------------------------------------------------
173 # These tests test the output of gold (end-to-end tests). In
174 # particular, they make sure that gold can link "difficult" object
175 # files, and the resulting object files run correctly. These can only
176 # run if we've built ld-new for the native architecture (that is,
177 # we're not cross-compiling it), since we run ld-new as part of these
178 # tests. We use the gcc-specific flag '-B' to use our linker instead
179 # of the default linker, which is why we only run our tests under gcc.
184 # Test empty command line error conditions.
185 check_SCRIPTS += empty_command_line_test.sh
186 empty_command_line_test.sh: gcctestdir/ld
188 # Each of these .o's is a useful, small complete program. They're
189 # particularly useful for making sure ld-new's flags do what they're
190 # supposed to (hence their names), but are used for many tests that
191 # don't actually involve analyzing input data.
192 flagstest_debug.o: constructor_test.cc
193 $(CXXCOMPILE) -O0 -g -c -o $@ $<
194 flagstest_ndebug.o: constructor_test.cc
195 $(CXXCOMPILE) -O0 -c -o $@ $<
197 check_SCRIPTS += incremental_test.sh
198 check_DATA += incremental_test.stdout
199 MOSTLYCLEANFILES += incremental_test incremental_test.cmdline
200 incremental_test_1.o: incremental_test_1.c
201 $(COMPILE) -O0 -c -ffunction-sections -g -o $@ $<
202 incremental_test_2.o: incremental_test_2.c
203 $(COMPILE) -O0 -c -ffunction-sections -g -o $@ $<
204 incremental_test: incremental_test_1.o incremental_test_2.o gcctestdir/ld
205 $(LINK) -Wl,--incremental-full -Wl,-z,norelro,-no-pie incremental_test_1.o incremental_test_2.o -Wl,-debug 2> incremental_test.cmdline
206 incremental_test.stdout: incremental_test ../incremental-dump
207 ../incremental-dump incremental_test > $@
209 check_SCRIPTS += gc_comdat_test.sh
210 check_DATA += gc_comdat_test.stdout
211 MOSTLYCLEANFILES += gc_comdat_test
212 gc_comdat_test_1.o: gc_comdat_test_1.cc
213 $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
214 gc_comdat_test_2.o: gc_comdat_test_2.cc
215 $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
216 gc_comdat_test: gc_comdat_test_1.o gc_comdat_test_2.o gcctestdir/ld
217 $(CXXLINK) -Wl,--gc-sections gc_comdat_test_1.o gc_comdat_test_2.o
218 gc_comdat_test.stdout: gc_comdat_test
219 $(TEST_NM) -C gc_comdat_test > gc_comdat_test.stdout
221 check_SCRIPTS += gc_tls_test.sh
222 check_DATA += gc_tls_test.stdout
223 MOSTLYCLEANFILES += gc_tls_test
224 gc_tls_test.o: gc_tls_test.cc
225 $(CXXCOMPILE) -O0 -c -g -o $@ $<
226 gc_tls_test:gc_tls_test.o gcctestdir/ld
227 $(CXXLINK) -Wl,--gc-sections gc_tls_test.o
228 gc_tls_test.stdout: gc_tls_test
229 $(TEST_NM) -C gc_tls_test > gc_tls_test.stdout
231 check_SCRIPTS += gc_orphan_section_test.sh
232 check_DATA += gc_orphan_section_test.stdout
233 MOSTLYCLEANFILES += gc_orphan_section_test
234 gc_orphan_section_test.o: gc_orphan_section_test.cc
235 $(CXXCOMPILE) -O0 -c -g -o $@ $<
236 gc_orphan_section_test:gc_orphan_section_test.o gcctestdir/ld
237 $(CXXLINK) -Wl,--gc-sections gc_orphan_section_test.o
238 gc_orphan_section_test.stdout: gc_orphan_section_test
239 $(TEST_NM) gc_orphan_section_test > gc_orphan_section_test.stdout
241 check_SCRIPTS += pr14265.sh
242 check_DATA += pr14265.stdout
243 MOSTLYCLEANFILES += pr14265
245 $(COMPILE) -O0 -c -o $@ $<
246 pr14265: pr14265.o gcctestdir/ld $(srcdir)/pr14265.t
247 $(LINK) -Wl,--gc-sections -Wl,-T,$(srcdir)/pr14265.t -o $@ $<
248 pr14265.stdout: pr14265
249 $(TEST_NM) --format=bsd --numeric-sort $< > $@
251 check_SCRIPTS += pr20717.sh
252 check_DATA += pr20717.stdout
253 MOSTLYCLEANFILES += pr20717
255 $(COMPILE) -O0 -ffunction-sections -c -o $@ $<
256 pr20717: pr20717.o gcctestdir/ld $(srcdir)/pr20717.t
257 $(LINK) -Wl,--gc-sections -Wl,-T,$(srcdir)/pr20717.t -o $@ $<
258 pr20717.stdout: pr20717
261 check_SCRIPTS += gc_dynamic_list_test.sh
262 check_DATA += gc_dynamic_list_test.stdout
263 MOSTLYCLEANFILES += gc_dynamic_list_test
264 gc_dynamic_list_test.o: gc_dynamic_list_test.c
265 $(COMPILE) -c -ffunction-sections -o $@ $<
266 gc_dynamic_list_test: gc_dynamic_list_test.o gcctestdir/ld $(srcdir)/gc_dynamic_list_test.t
267 $(LINK) -Wl,--gc-sections -Wl,--dynamic-list,$(srcdir)/gc_dynamic_list_test.t gc_dynamic_list_test.o
268 gc_dynamic_list_test.stdout: gc_dynamic_list_test
269 $(TEST_NM) gc_dynamic_list_test > $@
271 check_SCRIPTS += icf_test.sh
272 check_DATA += icf_test.map
273 MOSTLYCLEANFILES += icf_test icf_test.map
274 icf_test.o: icf_test.cc
275 $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
276 icf_test: icf_test.o gcctestdir/ld
277 $(CXXLINK) -o icf_test -Wl,--icf=all,-Map,icf_test.map icf_test.o
278 icf_test.map: icf_test
281 check_SCRIPTS += icf_keep_unique_test.sh
282 check_DATA += icf_keep_unique_test.stdout
283 MOSTLYCLEANFILES += icf_keep_unique_test
284 icf_keep_unique_test.o: icf_keep_unique_test.cc
285 $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
286 icf_keep_unique_test: icf_keep_unique_test.o gcctestdir/ld
287 $(CXXLINK) -Wl,--icf=all -Wl,--keep-unique,_Z11unique_funcv icf_keep_unique_test.o
288 icf_keep_unique_test.stdout: icf_keep_unique_test
289 $(TEST_NM) -C $< > $@
291 check_SCRIPTS += icf_safe_test.sh
292 check_DATA += icf_safe_test_1.stdout icf_safe_test_2.stdout icf_safe_test.map
293 MOSTLYCLEANFILES += icf_safe_test icf_safe_test.map
294 icf_safe_test.o: icf_safe_test.cc
295 $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
296 icf_safe_test: icf_safe_test.o gcctestdir/ld
297 $(CXXLINK) -o icf_safe_test -Wl,--icf=safe,-Map,icf_safe_test.map icf_safe_test.o
298 icf_safe_test.map: icf_safe_test
299 @touch icf_safe_test.map
300 icf_safe_test_1.stdout: icf_safe_test
302 icf_safe_test_2.stdout: icf_safe_test
303 $(TEST_READELF) -h $< > $@
305 check_SCRIPTS += icf_safe_pie_test.sh
306 check_DATA += icf_safe_pie_test_1.stdout icf_safe_pie_test_2.stdout icf_safe_pie_test.map
307 MOSTLYCLEANFILES += icf_safe_pie_test icf_safe_pie_test.map
308 icf_safe_pie_test.o: icf_safe_test.cc
309 $(CXXCOMPILE) -O0 -c -ffunction-sections -fPIE -g -o $@ $<
310 icf_safe_pie_test: icf_safe_pie_test.o gcctestdir/ld
311 $(CXXLINK) -o icf_safe_pie_test -Wl,--icf=safe,-Map,icf_safe_pie_test.map icf_safe_pie_test.o -pie
312 icf_safe_pie_test.map: icf_safe_pie_test
313 @touch icf_safe_pie_test.map
314 icf_safe_pie_test_1.stdout: icf_safe_pie_test
316 icf_safe_pie_test_2.stdout: icf_safe_pie_test
317 $(TEST_READELF) -h $< > $@
319 check_SCRIPTS += icf_safe_so_test.sh
320 check_DATA += icf_safe_so_test_1.stdout icf_safe_so_test_2.stdout icf_safe_so_test.map
321 MOSTLYCLEANFILES += icf_safe_so_test icf_safe_so_test.map
322 icf_safe_so_test.o: icf_safe_so_test.cc
323 $(CXXCOMPILE) -O0 -c -ffunction-sections -fPIC -g -o $@ $<
324 icf_safe_so_test: icf_safe_so_test.o gcctestdir/ld
325 $(CXXLINK) -o icf_safe_so_test -Wl,--icf=safe,-Map,icf_safe_so_test.map icf_safe_so_test.o -fPIC -shared
326 icf_safe_so_test.map:
327 @touch icf_safe_so_test.map
328 icf_safe_so_test_1.stdout: icf_safe_so_test
330 icf_safe_so_test_2.stdout: icf_safe_so_test
331 $(TEST_READELF) -h $< > $@
333 check_SCRIPTS += final_layout.sh
334 check_DATA += final_layout.stdout
335 MOSTLYCLEANFILES += final_layout final_layout_sequence.txt final_layout_script.lds
336 final_layout.o: final_layout.cc
337 $(CXXCOMPILE) -O0 -c -ffunction-sections -fdata-sections -g -o $@ $<
338 final_layout_sequence.txt:
339 (echo "*_Z3barv*" && echo ".text._Z3bazv" && echo "*_Z3foov*" && echo "*global_varb*" && echo "*global_vara*" && echo "*global_varc*") > final_layout_sequence.txt
340 final_layout_script.lds:
341 (echo "SECTIONS { .text : { *(.text*) } .got : { *(.got .toc) } .sbss : { *(.sbss*) } .bss : { *(.bss*) } }") > final_layout_script.lds
342 final_layout: final_layout.o final_layout_sequence.txt final_layout_script.lds gcctestdir/ld
343 $(CXXLINK) -Wl,--section-ordering-file,final_layout_sequence.txt -Wl,-T,final_layout_script.lds final_layout.o
344 final_layout.stdout: final_layout
345 $(TEST_NM) -n --synthetic final_layout > final_layout.stdout
347 check_SCRIPTS += text_section_grouping.sh
348 check_DATA += text_section_grouping.stdout text_section_no_grouping.stdout
349 MOSTLYCLEANFILES += text_section_grouping text_section_no_grouping
350 text_section_grouping.o: text_section_grouping.cc
351 $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
352 text_section_grouping: text_section_grouping.o gcctestdir/ld
353 $(CXXLINK) text_section_grouping.o
354 text_section_no_grouping: text_section_grouping.o gcctestdir/ld
355 $(CXXLINK) -Wl,--no-text-reorder text_section_grouping.o
356 text_section_grouping.stdout: text_section_grouping
357 $(TEST_NM) -n --synthetic text_section_grouping > text_section_grouping.stdout
358 text_section_no_grouping.stdout: text_section_no_grouping
359 $(TEST_NM) -n --synthetic text_section_no_grouping > text_section_no_grouping.stdout
361 check_SCRIPTS += section_sorting_name.sh
362 check_DATA += section_sorting_name.stdout
363 MOSTLYCLEANFILES += section_sorting_name
364 section_sorting_name.o: section_sorting_name.cc
365 $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
366 section_sorting_name: section_sorting_name.o gcctestdir/ld
367 $(CXXLINK) -Wl,--sort-section=name section_sorting_name.o
368 section_sorting_name.stdout: section_sorting_name
369 $(TEST_NM) -n --synthetic section_sorting_name > section_sorting_name.stdout
371 check_SCRIPTS += text_unlikely_segment.sh
372 check_DATA += text_unlikely_segment_readelf.stdout
373 MOSTLYCLEANFILES += text_unlikely_segment
374 text_unlikely_segment.o: text_unlikely_segment.cc
375 $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
376 text_unlikely_segment: text_unlikely_segment.o gcctestdir/ld
377 $(CXXLINK) -Wl,-z,text-unlikely-segment text_unlikely_segment.o
378 text_unlikely_segment_readelf.stdout: text_unlikely_segment
379 $(TEST_READELF) -Wl $< >$@
381 check_SCRIPTS += keep_text_section_prefix.sh
382 check_DATA += keep_text_section_prefix_readelf.stdout keep_text_section_prefix_nm.stdout
383 MOSTLYCLEANFILES += keep_text_section_prefix
384 keep_text_section_prefix.o: keep_text_section_prefix.cc
385 $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
386 keep_text_section_prefix: keep_text_section_prefix.o gcctestdir/ld
387 $(CXXLINK) -Wl,-z,keep-text-section-prefix keep_text_section_prefix.o
388 keep_text_section_prefix_readelf.stdout: keep_text_section_prefix
389 $(TEST_READELF) -Wl $< >$@
390 keep_text_section_prefix_nm.stdout: keep_text_section_prefix
393 check_PROGRAMS += icf_virtual_function_folding_test
394 MOSTLYCLEANFILES += icf_virtual_function_folding_test icf_virtual_function_folding_test.map
395 icf_virtual_function_folding_test.o: icf_virtual_function_folding_test.cc
396 $(CXXCOMPILE) -O0 -c -ffunction-sections -fPIE -g -o $@ $<
397 icf_virtual_function_folding_test: icf_virtual_function_folding_test.o gcctestdir/ld
398 $(CXXLINK) -Wl,--icf=all icf_virtual_function_folding_test.o -pie
400 check_SCRIPTS += icf_preemptible_functions_test.sh
401 check_DATA += icf_preemptible_functions_test.stdout
402 MOSTLYCLEANFILES += icf_preemptible_functions_test
403 icf_preemptible_functions_test.o: icf_preemptible_functions_test.cc
404 $(CXXCOMPILE) -O0 -c -ffunction-sections -fPIC -g -o $@ $<
405 icf_preemptible_functions_test: icf_preemptible_functions_test.o gcctestdir/ld
406 $(CXXLINK) -Wl,--icf=all icf_preemptible_functions_test.o -fPIC -shared
407 icf_preemptible_functions_test.stdout: icf_preemptible_functions_test
408 $(TEST_NM) icf_preemptible_functions_test > icf_preemptible_functions_test.stdout
410 check_SCRIPTS += icf_string_merge_test.sh
411 check_DATA += icf_string_merge_test.stdout
412 MOSTLYCLEANFILES += icf_string_merge_test
413 icf_string_merge_test.o: icf_string_merge_test.cc
414 $(CXXCOMPILE) -O0 -c -ffunction-sections -fPIC -g -o $@ $<
415 icf_string_merge_test: icf_string_merge_test.o gcctestdir/ld
416 $(CXXLINK) -Wl,--icf=all icf_string_merge_test.o
417 icf_string_merge_test.stdout: icf_string_merge_test
418 $(TEST_NM) icf_string_merge_test > icf_string_merge_test.stdout
420 check_SCRIPTS += icf_sht_rel_addend_test.sh
421 check_DATA += icf_sht_rel_addend_test.stdout
422 MOSTLYCLEANFILES += icf_sht_rel_addend_test
423 icf_sht_rel_addend_test_1.o: icf_sht_rel_addend_test_1.cc
424 $(CXXCOMPILE) -O0 -c -ffunction-sections -fPIC -g -o $@ $<
425 icf_sht_rel_addend_test_2.o: icf_sht_rel_addend_test_2.cc
426 $(CXXCOMPILE) -O0 -c -ffunction-sections -fPIC -g -o $@ $<
427 icf_sht_rel_addend_test: icf_sht_rel_addend_test_1.o icf_sht_rel_addend_test_2.o gcctestdir/ld
428 $(CXXLINK) -Wl,--icf=all icf_sht_rel_addend_test_1.o icf_sht_rel_addend_test_2.o
429 icf_sht_rel_addend_test.stdout: icf_sht_rel_addend_test
430 $(TEST_NM) icf_sht_rel_addend_test > icf_sht_rel_addend_test.stdout
432 check_PROGRAMS += large_symbol_alignment
433 large_symbol_alignment_SOURCES = large_symbol_alignment.cc
434 large_symbol_alignment_DEPENDENCIES = gcctestdir/ld
435 large_symbol_alignment_LDADD =
437 check_SCRIPTS += merge_string_literals.sh
438 check_DATA += merge_string_literals.stdout
439 MOSTLYCLEANFILES += merge_string_literals
440 merge_string_literals_1.o: merge_string_literals_1.cc
441 $(CXXCOMPILE) -O2 -c -fPIC -g -o $@ $<
442 merge_string_literals_2.o: merge_string_literals_2.cc
443 $(CXXCOMPILE) -O2 -c -fPIC -g -o $@ $<
444 merge_string_literals: merge_string_literals_1.o merge_string_literals_2.o gcctestdir/ld
445 $(CXXLINK) merge_string_literals_1.o merge_string_literals_2.o -O2 -shared -nostdlib
446 merge_string_literals.stdout: merge_string_literals
447 $(TEST_OBJDUMP) -s -j.rodata merge_string_literals > merge_string_literals.stdout
449 check_PROGRAMS += basic_test
450 check_PROGRAMS += basic_pic_test
451 basic_test.o: basic_test.cc
452 $(CXXCOMPILE) -O0 -c -o $@ $<
453 basic_test: basic_test.o gcctestdir/ld
454 $(CXXLINK) basic_test.o
456 check_PROGRAMS += eh_test
457 eh_test_a.o: eh_test_a.cc
458 $(CXXCOMPILE) -O0 -c -o $@ $<
459 eh_test_b.o: eh_test_b.cc
460 $(CXXCOMPILE) -O0 -c -o $@ $<
461 eh_test: eh_test_a.o eh_test_b.o gcctestdir/ld
462 $(CXXLINK_S) eh_test_a.o eh_test_b.o
464 check_SCRIPTS += eh_test_2.sh
465 check_DATA += eh_test_2.sects
466 MOSTLYCLEANFILES += eh_test_2 eh_test_2.sects
467 eh_test_r.o: eh_test_a.o eh_test_b.o gcctestdir/ld
468 gcctestdir/ld -r -o $@ eh_test_a.o eh_test_b.o
469 eh_test_2: eh_test_r.o gcctestdir/ld
470 $(CXXLINK_S) -Wl,--eh-frame-hdr eh_test_r.o
471 eh_test_2.sects: eh_test_2
472 $(TEST_READELF) -SW $< >$@ 2>/dev/null
475 check_PROGRAMS += basic_static_test
476 basic_static_test: basic_test.o gcctestdir/ld
477 $(CXXLINK) -static basic_test.o
480 basic_pic_test.o: basic_test.cc
481 $(CXXCOMPILE) -O0 -c -fpic -o $@ $<
482 basic_pic_test: basic_pic_test.o gcctestdir/ld
483 $(CXXLINK) basic_pic_test.o
486 check_PROGRAMS += basic_static_pic_test
487 basic_static_pic_test: basic_pic_test.o gcctestdir/ld
488 $(CXXLINK) -static basic_pic_test.o
491 check_PROGRAMS += basic_pie_test
492 basic_pie_test.o: basic_test.cc
493 $(CXXCOMPILE) -O0 -c -fpie -o $@ $<
494 basic_pie_test: basic_pie_test.o gcctestdir/ld
495 $(CXXLINK) -pie basic_pie_test.o
497 check_PROGRAMS += constructor_test
498 constructor_test_SOURCES = constructor_test.cc
499 constructor_test_DEPENDENCIES = gcctestdir/ld
500 constructor_test_LDADD =
503 check_PROGRAMS += constructor_static_test
504 constructor_static_test_SOURCES = $(constructor_test_SOURCES)
505 constructor_static_test_DEPENDENCIES = $(constructor_test_DEPENDENCIES)
506 constructor_static_test_LDFLAGS = $(constructor_test_LDFLAGS) -static
507 constructor_static_test_LDADD = $(constructor_test_LDADD)
510 check_PROGRAMS += two_file_test
511 check_PROGRAMS += two_file_pic_test
512 two_file_test_SOURCES = \
514 two_file_test_1b.cc \
516 two_file_test_main.cc \
518 two_file_test_DEPENDENCIES = gcctestdir/ld
519 two_file_test_LDADD =
522 check_PROGRAMS += two_file_static_test
523 two_file_static_test_SOURCES = $(two_file_test_SOURCES)
524 two_file_static_test_DEPENDENCIES = $(two_file_test_DEPENDENCIES)
525 two_file_static_test_LDFLAGS = $(two_file_test_LDFLAGS) -static
526 two_file_static_test_LDADD = $(two_file_test_LDADD)
529 two_file_pic_test_SOURCES = two_file_test_main.cc
530 two_file_pic_test_DEPENDENCIES = \
531 gcctestdir/ld two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o
532 two_file_pic_test_LDADD = two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o
535 check_PROGRAMS += two_file_shared_1_test
536 check_PROGRAMS += two_file_shared_2_test
537 check_PROGRAMS += two_file_shared_1_pic_2_test
538 check_PROGRAMS += two_file_shared_2_pic_1_test
539 check_PROGRAMS += two_file_same_shared_test
540 check_PROGRAMS += two_file_separate_shared_12_test
541 check_PROGRAMS += two_file_separate_shared_21_test
542 two_file_test_1_pic.o: two_file_test_1.cc
543 $(CXXCOMPILE) -c -fpic -o $@ $<
544 two_file_test_1b_pic.o: two_file_test_1b.cc
545 $(CXXCOMPILE) -c -fpic -o $@ $<
546 two_file_test_2_pic.o: two_file_test_2.cc
547 $(CXXCOMPILE) -c -fpic -o $@ $<
548 two_file_shared_1.so: two_file_test_1_pic.o two_file_test_1b_pic.o gcctestdir/ld
549 $(CXXLINK) -shared two_file_test_1_pic.o two_file_test_1b_pic.o
550 two_file_shared_2.so: two_file_test_2_pic.o gcctestdir/ld
551 $(CXXLINK) -shared two_file_test_2_pic.o
552 two_file_shared.so: two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o gcctestdir/ld
553 $(CXXLINK) -shared two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o
555 two_file_shared_1_test_SOURCES = two_file_test_2.cc two_file_test_main.cc
556 two_file_shared_1_test_DEPENDENCIES = gcctestdir/ld two_file_shared_1.so
557 two_file_shared_1_test_LDFLAGS = -Wl,-R,.
558 two_file_shared_1_test_LDADD = two_file_shared_1.so
560 two_file_shared_2_test_SOURCES = two_file_test_1.cc two_file_test_1b.cc two_file_test_main.cc
561 two_file_shared_2_test_DEPENDENCIES = gcctestdir/ld two_file_shared_2.so
562 two_file_shared_2_test_LDFLAGS = -Wl,-R,.
563 two_file_shared_2_test_LDADD = two_file_shared_2.so
565 two_file_shared_1_pic_2_test_SOURCES = two_file_test_main.cc
566 two_file_shared_1_pic_2_test_DEPENDENCIES = \
567 gcctestdir/ld two_file_shared_2.so two_file_test_1_pic.o two_file_test_1b_pic.o
568 two_file_shared_1_pic_2_test_LDFLAGS = -Wl,-R,.
569 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
571 two_file_shared_2_pic_1_test_SOURCES = two_file_test_main.cc
572 two_file_shared_2_pic_1_test_DEPENDENCIES = \
573 gcctestdir/ld two_file_shared_1.so two_file_test_2_pic.o
574 two_file_shared_2_pic_1_test_LDFLAGS = -Wl,-R,.
575 two_file_shared_2_pic_1_test_LDADD = two_file_test_2_pic.o two_file_shared_1.so
577 two_file_same_shared_test_SOURCES = two_file_test_main.cc
578 two_file_same_shared_test_DEPENDENCIES = gcctestdir/ld two_file_shared.so
579 two_file_same_shared_test_LDFLAGS = -Wl,-R,.
580 two_file_same_shared_test_LDADD = two_file_shared.so
582 two_file_separate_shared_12_test_SOURCES = two_file_test_main.cc
583 two_file_separate_shared_12_test_DEPENDENCIES = \
584 gcctestdir/ld two_file_shared_1.so two_file_shared_2.so
585 two_file_separate_shared_12_test_LDFLAGS = -Wl,-R,.
586 two_file_separate_shared_12_test_LDADD = \
587 two_file_shared_1.so two_file_shared_2.so
589 two_file_separate_shared_21_test_SOURCES = two_file_test_main.cc
590 two_file_separate_shared_21_test_DEPENDENCIES = \
591 gcctestdir/ld two_file_shared_1.so two_file_shared_2.so
592 two_file_separate_shared_21_test_LDFLAGS = -Wl,-R,.
593 two_file_separate_shared_21_test_LDADD = \
594 two_file_shared_2.so two_file_shared_1.so
596 check_PROGRAMS += two_file_relocatable_test
597 two_file_relocatable_test_SOURCES = two_file_test_main.cc
598 two_file_relocatable_test_DEPENDENCIES = \
599 gcctestdir/ld two_file_relocatable.o
600 two_file_relocatable_test_LDFLAGS = -Wl,-R,.
601 two_file_relocatable_test_LDADD = two_file_relocatable.o
602 two_file_relocatable.o: gcctestdir/ld two_file_test_1.o two_file_test_1b.o two_file_test_2.o
603 gcctestdir/ld -r -o $@ two_file_test_1.o two_file_test_1b.o two_file_test_2.o
605 check_PROGRAMS += two_file_pie_test
606 two_file_test_1_pie.o: two_file_test_1.cc
607 $(CXXCOMPILE) -c -fpie -o $@ $<
608 two_file_test_1b_pie.o: two_file_test_1b.cc
609 $(CXXCOMPILE) -c -fpie -o $@ $<
610 two_file_test_2_pie.o: two_file_test_2.cc
611 $(CXXCOMPILE) -c -fpie -o $@ $<
612 two_file_test_main_pie.o: two_file_test_main.cc
613 $(CXXCOMPILE) -c -fpie -o $@ $<
614 two_file_pie_test: two_file_test_1_pie.o two_file_test_1b_pie.o \
615 two_file_test_2_pie.o two_file_test_main_pie.o gcctestdir/ld
616 $(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
618 check_PROGRAMS += pie_copyrelocs_test
619 pie_copyrelocs_test_SOURCES = pie_copyrelocs_test.cc
620 pie_copyrelocs_test_DEPENDENCIES = gcctestdir/ld pie_copyrelocs_shared_test.so
621 pie_copyrelocs_test_CXXFLAGS = -fno-exceptions -fno-asynchronous-unwind-tables
622 pie_copyrelocs_test_LDFLAGS = -Wl,-R,. -pie
623 pie_copyrelocs_test_LDADD = pie_copyrelocs_shared_test.so
624 pie_copyrelocs_shared_test.o: pie_copyrelocs_shared_test.cc
625 $(CXXCOMPILE) -O2 -fpic -c -o $@ $<
626 pie_copyrelocs_shared_test.so: pie_copyrelocs_shared_test.o gcctestdir/ld
627 $(CXXLINK) -shared pie_copyrelocs_shared_test.o
629 check_PROGRAMS += weak_unresolved_symbols_test
630 weak_unresolved_symbols_test_SOURCES = weak_unresolved_symbols_test.cc
631 weak_unresolved_symbols_test_CXXFLAGS = -fPIE
632 weak_unresolved_symbols_test_LDFLAGS = -pie -Wl,--weak-unresolved-symbols
634 check_SCRIPTS += two_file_shared.sh
635 check_DATA += two_file_shared.dbg
636 MOSTLYCLEANFILES += two_file_shared.dbg
637 two_file_shared.dbg: two_file_shared.so
638 $(TEST_READELF) -w $< >$@ 2>/dev/null
640 # The nonpic tests will fail on platforms which can not put non-PIC
641 # code into shared libraries, so we just don't run them in that case.
642 if FN_PTRS_IN_SO_WITHOUT_PIC
644 check_PROGRAMS += two_file_shared_1_nonpic_test
645 check_PROGRAMS += two_file_shared_2_nonpic_test
646 check_PROGRAMS += two_file_same_shared_nonpic_test
647 check_PROGRAMS += two_file_separate_shared_12_nonpic_test
648 check_PROGRAMS += two_file_separate_shared_21_nonpic_test
649 check_PROGRAMS += two_file_mixed_shared_test
650 check_PROGRAMS += two_file_mixed_2_shared_test
651 two_file_shared_1_nonpic.so: two_file_test_1.o gcctestdir/ld
652 $(CXXLINK) -shared two_file_test_1.o two_file_test_1b.o -Wl,-z,notext
653 two_file_shared_2_nonpic.so: two_file_test_2.o gcctestdir/ld
654 $(CXXLINK) -shared two_file_test_2.o
655 two_file_shared_nonpic.so: two_file_test_1.o two_file_test_1b.o two_file_test_2.o gcctestdir/ld
656 $(CXXLINK) -shared two_file_test_1.o two_file_test_1b.o two_file_test_2.o -Wl,-z,notext
657 two_file_shared_mixed.so: two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2.o gcctestdir/ld
658 $(CXXLINK) -shared two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2.o -Wl,-z,notext
659 two_file_shared_mixed_1.so: two_file_test_1.o two_file_test_1b_pic.o two_file_shared_2.so gcctestdir/ld
660 $(CXXLINK) -shared two_file_test_1.o two_file_test_1b_pic.o two_file_shared_2.so -Wl,-z,notext
662 two_file_shared_1_nonpic_test_SOURCES = \
663 two_file_test_2.cc two_file_test_main.cc
664 two_file_shared_1_nonpic_test_DEPENDENCIES = \
665 gcctestdir/ld two_file_shared_1_nonpic.so
666 two_file_shared_1_nonpic_test_LDFLAGS = -Wl,-R,.
667 two_file_shared_1_nonpic_test_LDADD = two_file_shared_1_nonpic.so
669 two_file_shared_2_nonpic_test_SOURCES = \
670 two_file_test_1.cc two_file_test_1b.cc two_file_test_main.cc
671 two_file_shared_2_nonpic_test_DEPENDENCIES = \
672 gcctestdir/ld two_file_shared_2_nonpic.so
673 two_file_shared_2_nonpic_test_LDFLAGS = -Wl,-R,.
674 two_file_shared_2_nonpic_test_LDADD = two_file_shared_2_nonpic.so
676 two_file_same_shared_nonpic_test_SOURCES = two_file_test_main.cc
677 two_file_same_shared_nonpic_test_DEPENDENCIES = \
678 gcctestdir/ld two_file_shared_nonpic.so
679 two_file_same_shared_nonpic_test_LDFLAGS = -Wl,-R,.
680 two_file_same_shared_nonpic_test_LDADD = two_file_shared_nonpic.so
682 two_file_separate_shared_12_nonpic_test_SOURCES = two_file_test_main.cc
683 two_file_separate_shared_12_nonpic_test_DEPENDENCIES = \
684 gcctestdir/ld two_file_shared_1_nonpic.so two_file_shared_2_nonpic.so
685 two_file_separate_shared_12_nonpic_test_LDFLAGS = -Wl,-R,.
686 two_file_separate_shared_12_nonpic_test_LDADD = \
687 two_file_shared_1_nonpic.so two_file_shared_2_nonpic.so
689 two_file_separate_shared_21_nonpic_test_SOURCES = two_file_test_main.cc
690 two_file_separate_shared_21_nonpic_test_DEPENDENCIES = \
691 gcctestdir/ld two_file_shared_1_nonpic.so two_file_shared_2_nonpic.so
692 two_file_separate_shared_21_nonpic_test_LDFLAGS = -Wl,-R,.
693 two_file_separate_shared_21_nonpic_test_LDADD = \
694 two_file_shared_2_nonpic.so two_file_shared_1_nonpic.so
696 two_file_mixed_shared_test_SOURCES = two_file_test_main.cc
697 two_file_mixed_shared_test_DEPENDENCIES = gcctestdir/ld two_file_shared_mixed.so
698 two_file_mixed_shared_test_LDFLAGS = -Wl,-R,.
699 two_file_mixed_shared_test_LDADD = two_file_shared_mixed.so
701 two_file_mixed_2_shared_test_SOURCES = two_file_test_main.cc
702 two_file_mixed_2_shared_test_DEPENDENCIES = gcctestdir/ld two_file_shared_mixed_1.so two_file_shared_2.so
703 two_file_mixed_2_shared_test_LDFLAGS = -Wl,-R,.
704 two_file_mixed_2_shared_test_LDADD = two_file_shared_mixed_1.so two_file_shared_2.so
706 check_PROGRAMS += two_file_mixed_pie_test
707 two_file_mixed_pie_test: two_file_test_1.o two_file_test_1b_pie.o \
708 two_file_test_main_pie.o two_file_shared_2.so gcctestdir/ld
709 $(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
711 endif FN_PTRS_IN_SO_WITHOUT_PIC
713 check_PROGRAMS += two_file_strip_test
714 two_file_strip_test: two_file_test
715 $(TEST_STRIP) -o two_file_strip_test two_file_test
717 check_PROGRAMS += two_file_same_shared_strip_test
718 two_file_same_shared_strip_test_SOURCES = two_file_test_main.cc
719 two_file_same_shared_strip_test_DEPENDENCIES = \
720 gcctestdir/ld two_file_shared_strip.so
721 two_file_same_shared_strip_test_LDFLAGS = -Wl,-R.
722 two_file_same_shared_strip_test_LDADD = two_file_shared_strip.so
723 two_file_shared_strip.so: two_file_shared.so
724 $(TEST_STRIP) -S -o two_file_shared_strip.so two_file_shared.so
726 check_PROGRAMS += common_test_1
727 common_test_1_SOURCES = common_test_1.c
728 common_test_1_DEPENDENCIES = gcctestdir/ld
729 common_test_1_LDADD =
731 check_PROGRAMS += common_test_2
732 common_test_2_SOURCES = common_test_1.c
733 common_test_2_DEPENDENCIES = common_test_2.so common_test_3.so gcctestdir/ld
734 common_test_2_LDFLAGS = -Wl,-R,.
735 common_test_2_LDADD = common_test_2.so common_test_3.so
736 common_test_2_pic.o: common_test_2.c
737 $(COMPILE) -c -fpic -o $@ $<
738 common_test_2.so: common_test_2_pic.o common_test_3.so gcctestdir/ld
739 $(LINK) -shared common_test_2_pic.o common_test_3.so
740 common_test_3_pic.o: common_test_3.c
741 $(COMPILE) -c -fpic -o $@ $<
742 common_test_3.so: common_test_3_pic.o ver_test_2.script gcctestdir/ld
743 $(LINK) -shared common_test_3_pic.o -Wl,--version-script,$(srcdir)/ver_test_2.script
745 check_PROGRAMS += exception_test
746 check_PROGRAMS += exception_shared_1_test
747 check_PROGRAMS += exception_shared_2_test
748 check_PROGRAMS += exception_same_shared_test
749 check_PROGRAMS += exception_separate_shared_12_test
750 check_PROGRAMS += exception_separate_shared_21_test
751 exception_test_1_pic.o: exception_test_1.cc
752 $(CXXCOMPILE) -c -fpic -o $@ $<
753 exception_test_2_pic.o: exception_test_2.cc
754 $(CXXCOMPILE) -c -fpic -o $@ $<
755 exception_shared_1.so: exception_test_1_pic.o gcctestdir/ld
756 $(CXXLINK) -shared exception_test_1_pic.o
757 exception_shared_2.so: exception_test_2_pic.o gcctestdir/ld
758 $(CXXLINK) -shared exception_test_2_pic.o
759 exception_shared.so: exception_test_1_pic.o exception_test_2_pic.o gcctestdir/ld
760 $(CXXLINK) -shared exception_test_1_pic.o exception_test_2_pic.o
762 exception_test_SOURCES = \
763 exception_test_main.cc \
764 exception_test_1.cc \
765 exception_test_2.cc \
767 exception_test_DEPENDENCIES = gcctestdir/ld
768 exception_test_LDADD =
771 check_PROGRAMS += exception_static_test
772 exception_static_test_SOURCES = $(exception_test_SOURCES)
773 exception_static_test_DEPENDENCIES = $(exception_test_DEPENDENCIES)
774 exception_static_test_LDFLAGS = $(exception_test_LDFLAGS) -static
775 exception_static_test_LDADD = $(exception_test_LDADD)
778 exception_shared_1_test_SOURCES = exception_test_2.cc exception_test_main.cc
779 exception_shared_1_test_DEPENDENCIES = gcctestdir/ld exception_shared_1.so
780 exception_shared_1_test_LDFLAGS = -Wl,-R,.
781 exception_shared_1_test_LDADD = exception_shared_1.so
783 exception_shared_2_test_SOURCES = exception_test_1.cc exception_test_main.cc
784 exception_shared_2_test_DEPENDENCIES = gcctestdir/ld exception_shared_2.so
785 exception_shared_2_test_LDFLAGS = -Wl,-R,.
786 exception_shared_2_test_LDADD = exception_shared_2.so
788 exception_same_shared_test_SOURCES = exception_test_main.cc
789 exception_same_shared_test_DEPENDENCIES = gcctestdir/ld exception_shared.so
790 exception_same_shared_test_LDFLAGS = -Wl,-R,.
791 exception_same_shared_test_LDADD = exception_shared.so
793 exception_separate_shared_12_test_SOURCES = exception_test_main.cc
794 exception_separate_shared_12_test_DEPENDENCIES = \
795 gcctestdir/ld exception_shared_1.so exception_shared_2.so
796 exception_separate_shared_12_test_LDFLAGS = -Wl,-R,. -Wl,--no-as-needed
797 exception_separate_shared_12_test_LDADD = \
798 exception_shared_1.so exception_shared_2.so
800 exception_separate_shared_21_test_SOURCES = exception_test_main.cc
801 exception_separate_shared_21_test_DEPENDENCIES = \
802 gcctestdir/ld exception_shared_1.so exception_shared_2.so
803 exception_separate_shared_21_test_LDFLAGS = -Wl,-R,. -Wl,--no-as-needed
804 exception_separate_shared_21_test_LDADD = \
805 exception_shared_2.so exception_shared_1.so
808 check_PROGRAMS += weak_test
809 weak_test_SOURCES = weak_test.cc
810 weak_test_DEPENDENCIES = gcctestdir/ld
813 check_PROGRAMS += weak_undef_test
814 MOSTLYCLEANFILES += alt/weak_undef_lib.so
815 weak_undef_test_SOURCES = weak_undef_test.cc
816 weak_undef_test_DEPENDENCIES = gcctestdir/ld weak_undef_lib.so alt/weak_undef_lib.so
817 weak_undef_test_LDFLAGS = -Wl,-R,alt
818 weak_undef_test_LDADD = -L . weak_undef_lib.so
819 weak_undef_file1.o: weak_undef_file1.cc
820 $(CXXCOMPILE) -c -fpic -o $@ $<
821 weak_undef_file2.o: weak_undef_file2.cc
822 $(CXXCOMPILE) -c -fpic -o $@ $<
823 weak_undef_lib.so: weak_undef_file1.o gcctestdir/ld
824 $(CXXLINK) -shared weak_undef_file1.o
825 alt/weak_undef_lib.so: weak_undef_file2.o gcctestdir/ld
826 test -d alt || mkdir -p alt
827 $(CXXLINK) -shared weak_undef_file2.o
829 check_PROGRAMS += weak_undef_test_2
830 weak_undef_test_2_SOURCES = weak_undef_test_2.cc
831 weak_undef_test_2_DEPENDENCIES = gcctestdir/ld libweak_undef_2.a
832 weak_undef_test_2_LDFLAGS = -u weak_undef_2
833 weak_undef_test_2_LDADD = -L . -lweak_undef_2
834 MOSTLYCLEANFILES += libweak_undef_2.a
835 libweak_undef_2.a: weak_undef_file3.o weak_undef_file4.o
837 weak_undef_file3.o: weak_undef_file3.cc
838 $(CXXCOMPILE) -c -o $@ $<
839 weak_undef_file4.o: weak_undef_file4.cc
840 $(CXXCOMPILE) -c -o $@ $<
842 if FN_PTRS_IN_SO_WITHOUT_PIC
843 check_PROGRAMS += weak_undef_nonpic_test
844 MOSTLYCLEANFILES += alt/weak_undef_lib_nonpic.so
845 weak_undef_nonpic_test_SOURCES = weak_undef_test.cc
846 weak_undef_nonpic_test_DEPENDENCIES = gcctestdir/ld weak_undef_lib_nonpic.so alt/weak_undef_lib_nonpic.so
847 weak_undef_nonpic_test_LDFLAGS = -Wl,-R,alt
848 weak_undef_nonpic_test_LDADD = -L . weak_undef_lib_nonpic.so
849 weak_undef_file1_nonpic.o: weak_undef_file1.cc
850 $(CXXCOMPILE) -c -o $@ $<
851 weak_undef_file2_nonpic.o: weak_undef_file2.cc
852 $(CXXCOMPILE) -c -o $@ $<
853 weak_undef_lib_nonpic.so: weak_undef_file1_nonpic.o
854 $(CXXLINK) -shared weak_undef_file1_nonpic.o -Wl,-z,notext
855 alt/weak_undef_lib_nonpic.so: weak_undef_file2_nonpic.o
856 test -d alt || mkdir -p alt
857 $(CXXLINK) -shared weak_undef_file2_nonpic.o -Wl,-z,notext
858 endif FN_PTRS_IN_SO_WITHOUT_PIC
861 check_PROGRAMS += weak_alias_test
862 weak_alias_test_SOURCES = weak_alias_test_main.cc
863 weak_alias_test_DEPENDENCIES = \
864 gcctestdir/ld weak_alias_test_1.so weak_alias_test_2.so \
865 weak_alias_test_3.o weak_alias_test_4.so weak_alias_test_5.so
866 weak_alias_test_LDFLAGS = -Wl,-R,.
867 weak_alias_test_LDADD = \
868 weak_alias_test_1.so weak_alias_test_2.so weak_alias_test_3.o \
869 weak_alias_test_4.so weak_alias_test_5.so
870 weak_alias_test_1_pic.o: weak_alias_test_1.cc
871 $(CXXCOMPILE) -c -fpic -o $@ $<
872 weak_alias_test_1.so: weak_alias_test_1_pic.o gcctestdir/ld
873 $(CXXLINK) -shared weak_alias_test_1_pic.o
874 weak_alias_test_2_pic.o: weak_alias_test_2.cc
875 $(CXXCOMPILE) -c -fpic -o $@ $<
876 weak_alias_test_2.so: weak_alias_test_2_pic.o gcctestdir/ld
877 $(CXXLINK) -shared weak_alias_test_2_pic.o
878 weak_alias_test_3.o: weak_alias_test_3.cc
879 $(CXXCOMPILE) -c -o $@ $<
880 weak_alias_test_4_pic.o: weak_alias_test_4.cc
881 $(CXXCOMPILE) -c -fpic -o $@ $<
882 weak_alias_test_4.so: weak_alias_test_4_pic.o gcctestdir/ld
883 $(CXXLINK) -shared weak_alias_test_4_pic.o
884 weak_alias_test_5_pic.o: weak_alias_test_5.cc
885 $(CXXCOMPILE) -c -fpic -o $@ $<
886 weak_alias_test_5.so: weak_alias_test_5_pic.o $(srcdir)/weak_alias_test.script gcctestdir/ld
887 $(CXXLINK) -shared weak_alias_test_5_pic.o \
888 -Wl,--version-script,$(srcdir)/weak_alias_test.script
890 check_SCRIPTS += weak_plt.sh
891 check_PROGRAMS += weak_plt
892 check_DATA += weak_plt_shared.so
893 weak_plt_main_pic.o: weak_plt_main.cc
894 $(CXXCOMPILE) -c -fpic -o $@ $<
895 weak_plt: weak_plt_main_pic.o gcctestdir/ld
896 $(CXXLINK) weak_plt_main_pic.o
897 weak_plt_shared_pic.o: weak_plt_shared.cc
898 $(CXXCOMPILE) -c -fpic -o $@ $<
899 weak_plt_shared.so: weak_plt_shared_pic.o gcctestdir/ld
900 $(CXXLINK) -shared weak_plt_shared_pic.o
902 check_PROGRAMS += copy_test
903 copy_test_SOURCES = copy_test.cc
904 copy_test_DEPENDENCIES = gcctestdir/ld copy_test_1.so copy_test_2.so
905 copy_test_LDFLAGS = -Wl,-R,.
906 copy_test_LDADD = copy_test_1.so copy_test_2.so
907 copy_test_1_pic.o: copy_test_1.cc
908 $(CXXCOMPILE) -c -fpic -o $@ $<
909 copy_test_1.so: gcctestdir/ld copy_test_1_pic.o
910 $(CXXLINK) -shared copy_test_1_pic.o
911 copy_test_2_pic.o: copy_test_2.cc
912 $(CXXCOMPILE) -c -fpic -o $@ $<
913 copy_test_2.so: gcctestdir/ld copy_test_2_pic.o
914 $(CXXLINK) -shared copy_test_2_pic.o
916 check_PROGRAMS += copy_test_relro
917 copy_test_relro_SOURCES = copy_test_relro.cc
918 copy_test_relro_DEPENDENCIES = gcctestdir/ld copy_test_relro_1.so
919 copy_test_relro_LDFLAGS = -Wl,-R,. -Wl,-z,relro
920 copy_test_relro_LDADD = copy_test_relro_1.so
921 copy_test_relro_1_pic.o: copy_test_relro_1.cc
922 $(CXXCOMPILE) -c -fpic -o $@ $<
923 copy_test_relro_1.so: gcctestdir/ld copy_test_relro_1_pic.o
924 $(CXXLINK) -shared -Wl,-z,relro copy_test_relro_1_pic.o
926 if !DEFAULT_TARGET_POWERPC
927 check_SCRIPTS += copy_test_protected.sh
928 check_DATA += copy_test_protected.err
929 MOSTLYCLEANFILES += copy_test_protected.err
930 copy_test_protected.err: copy_test_protected.o copy_test_2.so gcctestdir/ld
931 @echo $(CXXLINK) -o copy_test_protected copy_test_protected.o copy_test_2.so -Wl,-R,. "2>$@"
932 @if $(CXXLINK) -o copy_test_protected copy_test_protected.o copy_test_2.so -Wl,-R,. 2>$@; \
934 echo 1>&2 "Link of copy_test_protected should have failed"; \
942 check_PROGRAMS += tls_test
943 check_PROGRAMS += tls_pic_test
944 check_PROGRAMS += tls_pie_test
945 check_PROGRAMS += tls_pie_pic_test
946 check_PROGRAMS += tls_shared_test
947 check_PROGRAMS += tls_shared_ie_test
948 check_PROGRAMS += tls_shared_gd_to_ie_test
949 tls_test_pic.o: tls_test.cc
950 $(CXXCOMPILE) -c -fpic -o $@ $<
951 tls_test_file2_pic.o: tls_test_file2.cc
952 $(CXXCOMPILE) -c -fpic -o $@ $<
953 tls_test_c_pic.o: tls_test_c.c
954 $(COMPILE) -c -fpic $(TLS_TEST_C_CFLAGS) -o $@ $<
955 tls_test_shared.so: tls_test_pic.o tls_test_file2_pic.o tls_test_c_pic.o gcctestdir/ld
956 $(CXXLINK) -shared tls_test_pic.o tls_test_file2_pic.o tls_test_c_pic.o -Wl,-z,defs
957 tls_test_shared2.so: tls_test_file2_pic.o gcctestdir/ld
958 $(CXXLINK) -shared tls_test_file2_pic.o
960 tls_test_pic_ie.o: tls_test.cc
961 $(CXXCOMPILE) -c -fpic -ftls-model=initial-exec -o $@ $<
962 tls_test_file2_pic_ie.o: tls_test_file2.cc
963 $(CXXCOMPILE) -c -fpic -ftls-model=initial-exec -o $@ $<
964 tls_test_c_pic_ie.o: tls_test_c.c
965 $(COMPILE) -c -fpic -ftls-model=initial-exec $(TLS_TEST_C_CFLAGS) -o $@ $<
966 tls_test_ie_shared.so: tls_test_pic_ie.o tls_test_file2_pic_ie.o tls_test_c_pic_ie.o gcctestdir/ld
967 $(CXXLINK) -shared tls_test_pic_ie.o tls_test_file2_pic_ie.o tls_test_c_pic_ie.o
969 tls_test_SOURCES = tls_test.cc tls_test_file2.cc tls_test_main.cc tls_test.h
970 tls_test_DEPENDENCIES = gcctestdir/ld tls_test_c.o
971 tls_test_LDFLAGS = $(THREADFLAGS)
972 tls_test_LDADD = tls_test_c.o $(THREADLIBS)
973 tls_test_c.o: tls_test_c.c
974 $(COMPILE) -c $(TLS_TEST_C_CFLAGS) -o $@ $<
976 tls_pic_test_SOURCES = tls_test_main.cc
977 tls_pic_test_DEPENDENCIES = gcctestdir/ld tls_test_pic.o tls_test_file2_pic.o \
979 tls_pic_test_LDFLAGS = $(THREADFLAGS)
980 tls_pic_test_LDADD = tls_test_pic.o tls_test_file2_pic.o tls_test_c_pic.o \
983 tls_test_main_pie.o: tls_test_main.cc tls_test.h
984 $(CXXCOMPILE) -c -fpie -o $@ $<
985 tls_test_pie.o: tls_test.cc tls_test.h
986 $(CXXCOMPILE) -c -fpie -o $@ $<
987 tls_test_file2_pie.o: tls_test_file2.cc tls_test.h
988 $(CXXCOMPILE) -c -fpie -o $@ $<
989 tls_test_c_pie.o: tls_test_c.c
990 $(COMPILE) -c -fpic $(TLS_TEST_C_CFLAGS) -o $@ $<
991 tls_pie_test: tls_test_main_pie.o tls_test_pie.o tls_test_file2_pie.o \
992 tls_test_c_pie.o gcctestdir/ld
993 $(CXXLINK) $(THREADFLAGS) -pie tls_test_main_pie.o tls_test_pie.o tls_test_file2_pie.o tls_test_c_pie.o $(THREADLIBS)
995 check_SCRIPTS += tls_pie_test.sh
996 check_DATA += tls_pie_test.stdout
997 tls_pie_test.stdout: tls_pie_test
998 $(TEST_READELF) -rW $< > $@ 2>/dev/null
1000 tls_pie_pic_test: tls_test_main_pie.o tls_test_pic.o tls_test_file2_pic.o \
1001 tls_test_c_pic.o gcctestdir/ld
1002 $(CXXLINK) $(THREADFLAGS) -pie tls_test_main_pie.o tls_test_pic.o tls_test_file2_pic.o tls_test_c_pic.o $(THREADLIBS)
1004 tls_shared_test_SOURCES = tls_test_main.cc
1005 tls_shared_test_DEPENDENCIES = gcctestdir/ld tls_test_shared.so
1006 tls_shared_test_LDFLAGS = -Wl,-R,. $(THREADFLAGS)
1007 tls_shared_test_LDADD = tls_test_shared.so $(THREADLIBS)
1009 tls_shared_ie_test_SOURCES = tls_test_main.cc
1010 tls_shared_ie_test_DEPENDENCIES = gcctestdir/ld tls_test_ie_shared.so
1011 tls_shared_ie_test_LDFLAGS = -Wl,-R,. $(THREADFLAGS)
1012 tls_shared_ie_test_LDADD = tls_test_ie_shared.so $(THREADLIBS)
1014 tls_shared_gd_to_ie_test_SOURCES = tls_test_main.cc
1015 tls_shared_gd_to_ie_test_DEPENDENCIES = gcctestdir/ld tls_test_pic.o \
1016 tls_test_c_pic.o tls_test_shared2.so
1017 tls_shared_gd_to_ie_test_LDFLAGS = -Wl,-R,. $(THREADFLAGS)
1018 tls_shared_gd_to_ie_test_LDADD = tls_test_pic.o tls_test_c_pic.o \
1019 tls_test_shared2.so $(THREADLIBS)
1023 check_PROGRAMS += tls_shared_gnu2_gd_to_ie_test
1025 tls_test_gnu2.o: tls_test.cc
1026 $(CXXCOMPILE) -c -fpic -mtls-dialect=gnu2 -o $@ $<
1027 tls_test_file2_gnu2.o: tls_test_file2.cc
1028 $(CXXCOMPILE) -c -fpic -mtls-dialect=gnu2 -o $@ $<
1029 tls_test_c_gnu2.o: tls_test_c.c
1030 $(COMPILE) -c -fpic -mtls-dialect=gnu2 $(TLS_TEST_C_CFLAGS) -o $@ $<
1031 tls_test_gnu2_shared2.so: tls_test_file2_gnu2.o gcctestdir/ld
1032 $(CXXLINK) -shared tls_test_file2_gnu2.o
1034 tls_shared_gnu2_gd_to_ie_test_SOURCES = tls_test_main.cc
1035 tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES = gcctestdir/ld tls_test_gnu2.o \
1036 tls_test_c_gnu2.o tls_test_gnu2_shared2.so
1037 tls_shared_gnu2_gd_to_ie_test_LDFLAGS = -Wl,-R,. $(THREADFLAGS)
1038 tls_shared_gnu2_gd_to_ie_test_LDADD = tls_test_gnu2.o tls_test_c_gnu2.o \
1039 tls_test_gnu2_shared2.so $(THREADLIBS)
1043 check_PROGRAMS += tls_shared_gnu2_test
1045 tls_test_gnu2_shared.so: tls_test_gnu2.o tls_test_file2_gnu2.o tls_test_c_gnu2.o gcctestdir/ld
1046 $(CXXLINK) -shared tls_test_gnu2.o tls_test_file2_gnu2.o tls_test_c_gnu2.o
1048 tls_shared_gnu2_test_SOURCES = tls_test_main.cc
1049 tls_shared_gnu2_test_DEPENDENCIES = gcctestdir/ld tls_test_gnu2_shared.so
1050 tls_shared_gnu2_test_LDFLAGS = -Wl,-R,. $(THREADFLAGS)
1051 tls_shared_gnu2_test_LDADD = tls_test_gnu2_shared.so $(THREADLIBS)
1053 endif TLS_DESCRIPTORS
1055 endif TLS_GNU2_DIALECT
1059 check_PROGRAMS += tls_static_test
1060 check_PROGRAMS += tls_static_pic_test
1062 tls_static_test_SOURCES = $(tls_test_SOURCES)
1063 tls_static_test_DEPENDENCIES = $(tls_test_DEPENDENCIES)
1064 tls_static_test_LDFLAGS = $(tls_test_LDFLAGS) -static
1065 tls_static_test_LDADD = $(tls_test_LDADD)
1067 tls_static_pic_test_SOURCES = $(tls_pic_test_SOURCES)
1068 tls_static_pic_test_DEPENDENCIES = $(tls_pic_test_DEPENDENCIES)
1069 tls_static_pic_test_LDFLAGS = $(tls_pic_test_LDFLAGS) -static
1070 tls_static_pic_test_LDADD = $(tls_pic_test_LDADD)
1074 if FN_PTRS_IN_SO_WITHOUT_PIC
1075 check_PROGRAMS += tls_shared_nonpic_test
1076 tls_test_shared_nonpic.so: tls_test.o tls_test_file2.o tls_test_c.o gcctestdir/ld
1077 $(CXXLINK) -shared tls_test.o tls_test_file2.o tls_test_c.o -Wl,-z,notext
1079 tls_shared_nonpic_test_SOURCES = tls_test_main.cc
1080 tls_shared_nonpic_test_DEPENDENCIES = gcctestdir/ld tls_test_shared_nonpic.so
1081 tls_shared_nonpic_test_LDFLAGS = -Wl,-R,. $(THREADFLAGS)
1082 tls_shared_nonpic_test_LDADD = tls_test_shared_nonpic.so $(THREADLIBS)
1083 endif FN_PTRS_IN_SO_WITHOUT_PIC
1087 if DEFAULT_TARGET_X86_64
1089 check_SCRIPTS += x86_64_mov_to_lea.sh
1090 check_DATA += x86_64_mov_to_lea1.stdout x86_64_mov_to_lea2.stdout \
1091 x86_64_mov_to_lea3.stdout x86_64_mov_to_lea4.stdout \
1092 x86_64_mov_to_lea5.stdout x86_64_mov_to_lea6.stdout \
1093 x86_64_mov_to_lea7.stdout x86_64_mov_to_lea8.stdout \
1094 x86_64_mov_to_lea9.stdout x86_64_mov_to_lea10.stdout \
1095 x86_64_mov_to_lea11.stdout x86_64_mov_to_lea12.stdout \
1096 x86_64_mov_to_lea13.stdout x86_64_mov_to_lea14.stdout
1097 MOSTLYCLEANFILES += x86_64_mov_to_lea1 x86_64_mov_to_lea2 \
1098 x86_64_mov_to_lea3 x86_64_mov_to_lea4 x86_64_mov_to_lea5 \
1099 x86_64_mov_to_lea6 x86_64_mov_to_lea7 x86_64_mov_to_lea8 \
1100 x86_64_mov_to_lea9 x86_64_mov_to_lea10 x86_64_mov_to_lea11 \
1101 x86_64_mov_to_lea12 x86_64_mov_to_lea13 x86_64_mov_to_lea14
1103 x86_64_mov_to_lea1.o: x86_64_mov_to_lea1.s
1104 $(TEST_AS) --64 -o $@ $<
1105 x86_64_mov_to_lea2.o: x86_64_mov_to_lea1.s
1106 $(TEST_AS) --x32 -o $@ $<
1107 x86_64_mov_to_lea3.o: x86_64_mov_to_lea2.s
1108 $(TEST_AS) --x32 -o $@ $<
1109 x86_64_mov_to_lea4.o: x86_64_mov_to_lea2.s
1110 $(TEST_AS) --64 -o $@ $<
1111 x86_64_mov_to_lea5.o: x86_64_mov_to_lea3.s
1112 $(TEST_AS) --x32 -mrelax-relocations=yes -o $@ $<
1113 x86_64_mov_to_lea6.o: x86_64_mov_to_lea3.s
1114 $(TEST_AS) --64 -mrelax-relocations=yes -o $@ $<
1115 x86_64_mov_to_lea7.o: x86_64_mov_to_lea4.s
1116 $(TEST_AS) --x32 -o $@ $<
1117 x86_64_mov_to_lea8.o: x86_64_mov_to_lea4.s
1118 $(TEST_AS) --64 -o $@ $<
1119 x86_64_mov_to_lea1: x86_64_mov_to_lea1.o ../ld-new
1120 ../ld-new -Bsymbolic -shared -melf_x86_64 -o $@ $<
1121 x86_64_mov_to_lea2: x86_64_mov_to_lea1.o ../ld-new
1122 ../ld-new -pie -melf_x86_64 -o $@ $<
1123 x86_64_mov_to_lea3: x86_64_mov_to_lea1.o ../ld-new
1124 ../ld-new -melf_x86_64 -o $@ $<
1125 x86_64_mov_to_lea4: x86_64_mov_to_lea2.o ../ld-new
1126 ../ld-new -Bsymbolic -shared -melf32_x86_64 -o $@ $<
1127 x86_64_mov_to_lea5: x86_64_mov_to_lea2.o ../ld-new
1128 ../ld-new -pie -melf32_x86_64 -o $@ $<
1129 x86_64_mov_to_lea6: x86_64_mov_to_lea2.o ../ld-new
1130 ../ld-new -melf32_x86_64 -o $@ $<
1131 x86_64_mov_to_lea7: x86_64_mov_to_lea3.o ../ld-new
1132 ../ld-new -melf32_x86_64 -pie -o $@ $<
1133 x86_64_mov_to_lea8: x86_64_mov_to_lea4.o ../ld-new
1134 ../ld-new -melf_x86_64 -pie -o $@ $<
1135 x86_64_mov_to_lea9: x86_64_mov_to_lea5.o ../ld-new
1136 ../ld-new -melf32_x86_64 -o $@ $<
1137 x86_64_mov_to_lea10: x86_64_mov_to_lea6.o ../ld-new
1138 ../ld-new -melf_x86_64 -o $@ $<
1139 x86_64_mov_to_lea11: x86_64_mov_to_lea2.o ../ld-new
1140 ../ld-new -melf32_x86_64 -shared -o $@ $<
1141 x86_64_mov_to_lea12: x86_64_mov_to_lea1.o ../ld-new
1142 ../ld-new -melf_x86_64 -shared -o $@ $<
1143 x86_64_mov_to_lea13: x86_64_mov_to_lea7.o ../ld-new
1144 ../ld-new -melf32_x86_64 -shared -o $@ $<
1145 x86_64_mov_to_lea14: x86_64_mov_to_lea8.o ../ld-new
1146 ../ld-new -melf_x86_64 -shared -o $@ $<
1147 x86_64_mov_to_lea1.stdout: x86_64_mov_to_lea1
1148 $(TEST_OBJDUMP) -dw $< > $@
1149 x86_64_mov_to_lea2.stdout: x86_64_mov_to_lea2
1150 $(TEST_OBJDUMP) -dw $< > $@
1151 x86_64_mov_to_lea3.stdout: x86_64_mov_to_lea3
1152 $(TEST_OBJDUMP) -dw $< > $@
1153 x86_64_mov_to_lea4.stdout: x86_64_mov_to_lea4
1154 $(TEST_OBJDUMP) -dw $< > $@
1155 x86_64_mov_to_lea5.stdout: x86_64_mov_to_lea5
1156 $(TEST_OBJDUMP) -dw $< > $@
1157 x86_64_mov_to_lea6.stdout: x86_64_mov_to_lea6
1158 $(TEST_OBJDUMP) -dw $< > $@
1159 x86_64_mov_to_lea7.stdout: x86_64_mov_to_lea7
1160 $(TEST_OBJDUMP) -dw $< > $@
1161 x86_64_mov_to_lea8.stdout: x86_64_mov_to_lea8
1162 $(TEST_OBJDUMP) -dw $< > $@
1163 x86_64_mov_to_lea9.stdout: x86_64_mov_to_lea9
1164 $(TEST_OBJDUMP) -dw $< > $@
1165 x86_64_mov_to_lea10.stdout: x86_64_mov_to_lea10
1166 $(TEST_OBJDUMP) -dw $< > $@
1167 x86_64_mov_to_lea11.stdout: x86_64_mov_to_lea11
1168 $(TEST_OBJDUMP) -dw $< > $@
1169 x86_64_mov_to_lea12.stdout: x86_64_mov_to_lea12
1170 $(TEST_OBJDUMP) -dw $< > $@
1171 x86_64_mov_to_lea13.stdout: x86_64_mov_to_lea13
1172 $(TEST_OBJDUMP) -dw $< > $@
1173 x86_64_mov_to_lea14.stdout: x86_64_mov_to_lea14
1174 $(TEST_OBJDUMP) -dw $< > $@
1176 check_SCRIPTS += x86_64_indirect_call_to_direct.sh
1177 check_DATA += x86_64_indirect_call_to_direct1.stdout \
1178 x86_64_indirect_jump_to_direct1.stdout
1179 MOSTLYCLEANFILES += x86_64_indirect_call_to_direct1 \
1180 x86_64_indirect_jump_to_direct1
1182 x86_64_indirect_call_to_direct1.o: x86_64_indirect_call_to_direct1.s
1183 $(TEST_AS) --64 -mrelax-relocations=yes -o $@ $<
1184 x86_64_indirect_call_to_direct1: x86_64_indirect_call_to_direct1.o gcctestdir/ld
1185 gcctestdir/ld -o $@ $<
1186 x86_64_indirect_call_to_direct1.stdout: x86_64_indirect_call_to_direct1
1187 $(TEST_OBJDUMP) -dw $< > $@
1188 x86_64_indirect_jump_to_direct1.o: x86_64_indirect_jump_to_direct1.s
1189 $(TEST_AS) --64 -mrelax-relocations=yes -o $@ $<
1190 x86_64_indirect_jump_to_direct1: x86_64_indirect_jump_to_direct1.o gcctestdir/ld
1191 gcctestdir/ld -o $@ $<
1192 x86_64_indirect_jump_to_direct1.stdout: x86_64_indirect_jump_to_direct1
1193 $(TEST_OBJDUMP) -dw $< > $@
1195 check_SCRIPTS += x86_64_overflow_pc32.sh
1196 check_DATA += x86_64_overflow_pc32.err
1197 MOSTLYCLEANFILES += x86_64_overflow_pc32.err
1198 x86_64_overflow_pc32.o: x86_64_overflow_pc32.s
1200 x86_64_overflow_pc32.err: x86_64_overflow_pc32.o gcctestdir/ld
1201 @echo gcctestdir/ld -e bar -Tdata=0x81000000 -o x86_64_overflow_pc32 x86_64_overflow_pc32.o "2>$@"
1202 @if gcctestdir/ld -e bar -Tdata=0x81000000 -o x86_64_overflow_pc32 x86_64_overflow_pc32.o 2>$@; \
1204 echo 1>&2 "Link of x86_64_overflow_pc32 should have failed"; \
1209 check_PROGRAMS += pr17704a_test
1210 pr17704a_test.o: pr17704a_test.s
1211 $(TEST_AS) --64 -o $@ $<
1212 pr17704a_test: pr17704a_test.o gcctestdir/ld
1213 gcctestdir/ld --icf=all -o $@ $<
1215 check_SCRIPTS += x32_overflow_pc32.sh
1216 check_DATA += x32_overflow_pc32.err
1217 MOSTLYCLEANFILES += x32_overflow_pc32.err
1218 x32_overflow_pc32.o: x86_64_overflow_pc32.s
1219 $(TEST_AS) --x32 -o $@ $<
1220 x32_overflow_pc32.err: x32_overflow_pc32.o gcctestdir/ld
1221 @echo gcctestdir/ld -e bar -Tdata=0x81000000 -o x32_overflow_pc32 x32_overflow_pc32.o "2>$@"
1222 @if gcctestdir/ld -e bar -Tdata=0x81000000 -o x32_overflow_pc32 x32_overflow_pc32.o 2>$@; \
1224 echo 1>&2 "Link of x32_overflow_pc32 should have failed"; \
1229 check_SCRIPTS += pr23016_1.sh
1230 check_DATA += pr23016_1.stdout pr23016_1r.stdout
1231 pr23016_1.stdout: pr23016_1.o
1232 $(TEST_READELF) -rSW $< >$@ 2>/dev/null
1233 pr23016_1.o: pr23016_1a.o pr23016_1b.o gcctestdir/ld
1234 gcctestdir/ld -r -o $@ pr23016_1a.o pr23016_1b.o
1235 pr23016_1r.stdout: pr23016_1r.o
1236 $(TEST_READELF) -rSW $< >$@ 2>/dev/null
1237 pr23016_1r.o: pr23016_1a.o pr23016_1b.o gcctestdir/ld
1238 gcctestdir/ld -r -o $@ pr23016_1b.o pr23016_1a.o
1239 pr23016_1a.o: pr23016_1a.s
1241 pr23016_1b.o: pr23016_1b.s
1244 check_SCRIPTS += pr23016_2.sh
1245 check_DATA += pr23016_2.stdout
1246 pr23016_2.stdout: pr23016_2.o
1247 $(TEST_READELF) -rW $< >$@ 2>/dev/null
1248 pr23016_2.o: pr23016_2a.o pr23016_2b.o gcctestdir/ld
1249 gcctestdir/ld -r -o $@ pr23016_2a.o pr23016_2b.o
1250 pr23016_2a.o: pr23016_2a.s
1252 pr23016_2b.o: pr23016_2b.s
1255 endif DEFAULT_TARGET_X86_64
1257 if DEFAULT_TARGET_X86_64_OR_X32
1259 check_PROGRAMS += pr20216a_test
1260 pr20216a_test_SOURCES = pr20216_main.c pr20216_def.c
1261 pr20216a_test_DEPENDENCIES = pr20216_gd.o pr20216_ld.o gcctestdir/ld gcctestdir/as
1262 pr20216a_test_CFLAGS = -fPIE
1263 pr20216a_test_LDFLAGS = -Wl,-R,.
1264 pr20216a_test_LDADD = pr20216_gd.o pr20216_ld.o
1266 check_PROGRAMS += pr20216b_test
1267 pr20216b_test_SOURCES = pr20216_main.c pr20216_def.c
1268 pr20216b_test_DEPENDENCIES = pr20216_gd.o pr20216_ld.o gcctestdir/ld gcctestdir/as
1269 pr20216b_test_CFLAGS = -fPIE
1270 pr20216b_test_LDFLAGS = -pie -Wl,-R,.
1271 pr20216b_test_LDADD = pr20216_gd.o pr20216_ld.o
1273 check_PROGRAMS += pr20216c_test
1274 pr20216c_test_SOURCES = pr20216_main.c pr20216_def.c
1275 pr20216c_test_DEPENDENCIES = pr20216_gd.o pr20216_ld.o gcctestdir/ld gcctestdir/as
1276 pr20216c_test_CFLAGS = -fPIE
1277 pr20216c_test_LDFLAGS = -static -Wl,-R,.
1278 pr20216c_test_LDADD = pr20216_gd.o pr20216_ld.o
1280 check_PROGRAMS += pr20216d_test
1281 pr20216d_test_SOURCES = pr20216_main.c pr20216_def.c
1282 pr20216d_test_DEPENDENCIES = pr20216a.so gcctestdir/ld gcctestdir/as
1283 pr20216d_test_CFLAGS = -fPIE
1284 pr20216d_test_LDFLAGS = -Wl,-R,.
1285 pr20216d_test_LDADD = pr20216a.so
1287 check_PROGRAMS += pr20216e_test
1288 pr20216e_test_SOURCES = pr20216_main.c
1289 pr20216e_test_DEPENDENCIES = pr20216_gd.o pr20216_ld.o pr20216b.so gcctestdir/ld gcctestdir/as
1290 pr20216e_test_CFLAGS = -fPIE
1291 pr20216e_test_LDFLAGS = -Wl,-R,.
1292 pr20216e_test_LDADD = pr20216_gd.o pr20216_ld.o pr20216b.so
1294 MOSTLYCLEANFILES += pr20216a.so pr20216b.so
1296 pr20216a.so: pr20216_gd.o pr20216_ld.o gcctestdir/ld
1297 $(LINK) -shared pr20216_gd.o pr20216_ld.o
1299 pr20216b.so: pr20216_def.o gcctestdir/ld
1300 $(LINK) -shared pr20216_def.o
1302 pr20216_gd.o: pr20216_gd.S gcctestdir/as
1303 $(COMPILE) -c -o $@ $<
1305 pr20216_ld.o: pr20216_ld.S gcctestdir/as
1306 $(COMPILE) -c -o $@ $<
1308 endif DEFAULT_TARGET_X86_64_OR_X32
1310 if DEFAULT_TARGET_I386
1312 check_SCRIPTS += i386_mov_to_lea.sh
1313 check_DATA += i386_mov_to_lea1.stdout i386_mov_to_lea2.stdout \
1314 i386_mov_to_lea3.stdout i386_mov_to_lea4.stdout \
1315 i386_mov_to_lea5.stdout i386_mov_to_lea6.stdout \
1316 i386_mov_to_lea7.stdout i386_mov_to_lea8.stdout
1317 MOSTLYCLEANFILES += i386_mov_to_lea1 i386_mov_to_lea2 i386_mov_to_lea3 \
1318 i386_mov_to_lea4 i386_mov_to_lea5 i386_mov_to_lea6 \
1319 i386_mov_to_lea7 i386_mov_to_lea8
1321 i386_mov_to_lea1.o: i386_mov_to_lea1.s
1322 $(TEST_AS) --32 -o $@ $<
1323 i386_mov_to_lea2.o: i386_mov_to_lea2.s
1324 $(TEST_AS) --32 -o $@ $<
1325 i386_mov_to_lea3.o: i386_mov_to_lea3.s
1326 $(TEST_AS) --32 -o $@ $<
1327 i386_mov_to_lea4.o: i386_mov_to_lea4.s
1328 $(TEST_AS) --32 -o $@ $<
1329 i386_mov_to_lea5.o: i386_mov_to_lea5.s
1330 $(TEST_AS) --32 -o $@ $<
1331 i386_mov_to_lea1: i386_mov_to_lea1.o ../ld-new
1332 ../ld-new -Bsymbolic -shared -melf_i386 -o $@ $<
1333 i386_mov_to_lea2: i386_mov_to_lea1.o ../ld-new
1334 ../ld-new -pie -melf_i386 -o $@ $<
1335 i386_mov_to_lea3: i386_mov_to_lea1.o ../ld-new
1336 ../ld-new -melf_i386 -o $@ $<
1337 i386_mov_to_lea4: i386_mov_to_lea1.o ../ld-new
1338 ../ld-new -melf_i386 -shared -o $@ $<
1339 i386_mov_to_lea5: i386_mov_to_lea2.o ../ld-new
1340 ../ld-new -melf_i386 -shared -o $@ $<
1341 i386_mov_to_lea6: i386_mov_to_lea3.o ../ld-new
1342 ../ld-new -melf_i386 -shared -o $@ $<
1343 i386_mov_to_lea7: i386_mov_to_lea4.o ../ld-new
1344 ../ld-new -melf_i386 -shared -o $@ $<
1345 i386_mov_to_lea8: i386_mov_to_lea5.o ../ld-new
1346 ../ld-new -melf_i386 -shared -o $@ $<
1347 i386_mov_to_lea1.stdout: i386_mov_to_lea1
1348 $(TEST_OBJDUMP) -dw $< > $@
1349 i386_mov_to_lea2.stdout: i386_mov_to_lea2
1350 $(TEST_OBJDUMP) -dw $< > $@
1351 i386_mov_to_lea3.stdout: i386_mov_to_lea3
1352 $(TEST_OBJDUMP) -dw $< > $@
1353 i386_mov_to_lea4.stdout: i386_mov_to_lea4
1354 $(TEST_OBJDUMP) -dw $< > $@
1355 i386_mov_to_lea5.stdout: i386_mov_to_lea5
1356 $(TEST_OBJDUMP) -dw $< > $@
1357 i386_mov_to_lea6.stdout: i386_mov_to_lea6
1358 $(TEST_OBJDUMP) -dw $< > $@
1359 i386_mov_to_lea7.stdout: i386_mov_to_lea7
1360 $(TEST_OBJDUMP) -dw $< > $@
1361 i386_mov_to_lea8.stdout: i386_mov_to_lea8
1362 $(TEST_OBJDUMP) -dw $< > $@
1364 check_PROGRAMS += pr20308a_test
1365 pr20308a_test_SOURCES = pr20308_main.c pr20308_def.c
1366 pr20308a_test_DEPENDENCIES = pr20308_gd.o pr20308_ld.o gcctestdir/ld gcctestdir/as
1367 pr20308a_test_CFLAGS = -fPIE
1368 pr20308a_test_LDFLAGS = -Wl,-R,.
1369 pr20308a_test_LDADD = pr20308_gd.o pr20308_ld.o
1371 check_PROGRAMS += pr20308b_test
1372 pr20308b_test_SOURCES = pr20308_main.c pr20308_def.c
1373 pr20308b_test_DEPENDENCIES = pr20308_gd.o pr20308_ld.o gcctestdir/ld gcctestdir/as
1374 pr20308b_test_CFLAGS = -fPIE
1375 pr20308b_test_LDFLAGS = -pie -Wl,-R,.
1376 pr20308b_test_LDADD = pr20308_gd.o pr20308_ld.o
1378 check_PROGRAMS += pr20308c_test
1379 pr20308c_test_SOURCES = pr20308_main.c pr20308_def.c
1380 pr20308c_test_DEPENDENCIES = pr20308_gd.o pr20308_ld.o gcctestdir/ld gcctestdir/as
1381 pr20308c_test_CFLAGS = -fPIE
1382 pr20308c_test_LDFLAGS = -static -Wl,-R,.
1383 pr20308c_test_LDADD = pr20308_gd.o pr20308_ld.o
1385 check_PROGRAMS += pr20308d_test
1386 pr20308d_test_SOURCES = pr20308_main.c pr20308_def.c
1387 pr20308d_test_DEPENDENCIES = pr20308a.so gcctestdir/ld gcctestdir/as
1388 pr20308d_test_CFLAGS = -fPIE
1389 pr20308d_test_LDFLAGS = -Wl,-R,.
1390 pr20308d_test_LDADD = pr20308a.so
1392 check_PROGRAMS += pr20308e_test
1393 pr20308e_test_SOURCES = pr20308_main.c
1394 pr20308e_test_DEPENDENCIES = pr20308_gd.o pr20308_ld.o pr20308b.so gcctestdir/ld gcctestdir/as
1395 pr20308e_test_CFLAGS = -fPIE
1396 pr20308e_test_LDFLAGS = -Wl,-R,.
1397 pr20308e_test_LDADD = pr20308_gd.o pr20308_ld.o pr20308b.so
1399 MOSTLYCLEANFILES += pr20308a.so pr20308b.so
1401 pr20308a.so: pr20308_gd.o pr20308_ld.o gcctestdir/ld
1402 $(LINK) -shared pr20308_gd.o pr20308_ld.o
1404 pr20308b.so: pr20308_def.o gcctestdir/ld
1405 $(LINK) -shared pr20308_def.o
1407 pr20308_gd.o: pr20308_gd.S gcctestdir/as
1408 $(COMPILE) -c -o $@ $<
1410 pr20308_ld.o: pr20308_ld.S gcctestdir/as
1411 $(COMPILE) -c -o $@ $<
1413 endif DEFAULT_TARGET_I386
1415 check_PROGRAMS += many_sections_test
1416 many_sections_test_SOURCES = many_sections_test.cc
1417 many_sections_test_DEPENDENCIES = gcctestdir/ld
1418 many_sections_test_LDFLAGS = -rdynamic
1419 many_sections_test_LDADD =
1421 BUILT_SOURCES += many_sections_define.h
1422 MOSTLYCLEANFILES += many_sections_define.h
1423 many_sections_define.h:
1424 (for i in `seq 1 70000`; do \
1425 echo "int var_$$i __attribute__((section(\"section_$$i\"))) = $$i;"; \
1429 BUILT_SOURCES += many_sections_check.h
1430 MOSTLYCLEANFILES += many_sections_check.h
1431 many_sections_check.h:
1432 (for i in `seq 1 1000 70000`; do \
1433 echo "assert(var_$$i == $$i);"; \
1437 check_PROGRAMS += many_sections_r_test
1438 many_sections_r_test.o: many_sections_test.o gcctestdir/ld
1439 gcctestdir/ld -r -o $@ many_sections_test.o
1440 many_sections_r_test: many_sections_r_test.o gcctestdir/ld
1441 $(CXXLINK) many_sections_r_test.o $(LIBS)
1443 check_SCRIPTS += file_in_many_sections_test.sh
1444 check_DATA += file_in_many_sections.stdout
1445 MOSTLYCLEANFILES += file_in_many_sections
1446 file_in_many_sections.o: file_in_many_sections.c many_sections_define.h
1447 $(COMPILE) -c -fdata-sections -o $@ $(srcdir)/file_in_many_sections.c
1448 file_in_many_sections: file_in_many_sections.o gcctestdir/ld
1449 $(LINK) file_in_many_sections.o -Wl,--gc-sections
1450 file_in_many_sections.stdout: file_in_many_sections
1451 $(TEST_READELF) -s $< > $@
1453 check_PROGRAMS += initpri1
1454 initpri1_SOURCES = initpri1.c
1455 initpri1_DEPENDENCIES = gcctestdir/ld
1458 check_PROGRAMS += initpri2
1459 initpri2_SOURCES = initpri2.c
1460 initpri2_DEPENDENCIES = gcctestdir/ld
1461 initpri2_LDFLAGS = -Wl,--ctors-in-init-array
1464 check_PROGRAMS += initpri3a
1465 initpri3a_SOURCES = initpri3.c
1466 initpri3a_DEPENDENCIES = gcctestdir/ld
1469 # This test fails on targets not using .ctors and .dtors sections (e.g. ARM
1470 # EABI). Given that gcc is moving towards using .init_array in all cases,
1471 # this test is commented out. A better fix would be checking whether gcc
1472 # uses .ctors or .init_array sections in configure.
1474 # check_PROGRAMS += initpri3b
1475 # initpri3b_SOURCES = initpri3.c
1476 # initpri3b_DEPENDENCIES = gcctestdir/ld
1477 # initpri3b_LDFLAGS = -Wl,--no-ctors-in-init-array
1480 # Test --detect-odr-violations
1481 check_SCRIPTS += debug_msg.sh
1483 # Create the data files that debug_msg.sh analyzes.
1484 check_DATA += debug_msg.err
1485 MOSTLYCLEANFILES += debug_msg.err
1486 debug_msg.o: debug_msg.cc
1487 $(CXXCOMPILE) -O0 -g -c -w -o $@ $(srcdir)/debug_msg.cc
1488 odr_violation1.o: odr_violation1.cc
1489 $(CXXCOMPILE) -O0 -g -c -w -o $@ $(srcdir)/odr_violation1.cc
1490 # Compile with different optimization flags to check that rearranged
1491 # instructions don't cause a false positive.
1492 odr_violation2.o: odr_violation2.cc
1493 $(CXXCOMPILE) -O2 -g -c -w -o $@ $(srcdir)/odr_violation2.cc
1494 debug_msg.err: debug_msg.o odr_violation1.o odr_violation2.o gcctestdir/ld
1495 @echo $(CXXLINK) -Wl,--detect-odr-violations -o debug_msg debug_msg.o odr_violation1.o odr_violation2.o "2>$@"
1496 @if $(CXXLINK) -Wl,--detect-odr-violations -o debug_msg debug_msg.o odr_violation1.o odr_violation2.o 2>$@; \
1498 echo 1>&2 "Link of debug_msg should have failed"; \
1503 # Test error message when a vtable is undefined.
1504 check_SCRIPTS += missing_key_func.sh
1505 check_DATA += missing_key_func.err
1506 MOSTLYCLEANFILES += missing_key_func.err
1507 missing_key_func.o: missing_key_func.cc
1508 $(CXXCOMPILE) -O0 -g -c -o $@ $(srcdir)/missing_key_func.cc
1509 missing_key_func.err: missing_key_func.o gcctestdir/ld
1510 @echo $(CXXLINK) -o missing_key_func missing_key_func.o "2>$@"
1511 @if $(CXXLINK) -o missing_key_func missing_key_func.o 2>$@; \
1513 echo 1>&2 "Link of missing_key_func should have failed"; \
1518 # Check that --detect-odr-violations works with compressed debug sections.
1519 check_DATA += debug_msg_cdebug.err
1520 MOSTLYCLEANFILES += debug_msg_cdebug.err
1521 debug_msg_cdebug.o: debug_msg.cc gcctestdir/as
1522 $(CXXCOMPILE) -O0 -g -Wa,--compress-debug-sections -c -w -o $@ $(srcdir)/debug_msg.cc
1523 odr_violation1_cdebug.o: odr_violation1.cc gcctestdir/as
1524 $(CXXCOMPILE) -O0 -g -Wa,--compress-debug-sections -c -w -o $@ $(srcdir)/odr_violation1.cc
1525 odr_violation2_cdebug.o: odr_violation2.cc gcctestdir/as
1526 $(CXXCOMPILE) -O2 -g -Wa,--compress-debug-sections -c -w -o $@ $(srcdir)/odr_violation2.cc
1527 debug_msg_cdebug.err: debug_msg_cdebug.o odr_violation1_cdebug.o odr_violation2_cdebug.o gcctestdir/ld
1528 @echo $(CXXLINK) -Wl,--detect-odr-violations -o debug_msg_cdebug debug_msg_cdebug.o odr_violation1_cdebug.o odr_violation2_cdebug.o "2>$@"
1529 @if $(CXXLINK) -Wl,--detect-odr-violations -o debug_msg_cdebug debug_msg_cdebug.o odr_violation1_cdebug.o odr_violation2_cdebug.o 2>$@; \
1531 echo 1>&2 "Link of debug_msg_cdebug should have failed"; \
1535 check_DATA += debug_msg_cdebug_gabi.err
1536 MOSTLYCLEANFILES += debug_msg_cdebug_gabi.err
1537 debug_msg_cdebug_gabi.o: debug_msg.cc gcctestdir/as
1538 $(CXXCOMPILE) -O0 -g -Wa,--compress-debug-sections=zlib-gabi -c -w -o $@ $(srcdir)/debug_msg.cc
1539 odr_violation1_cdebug_gabi.o: odr_violation1.cc gcctestdir/as
1540 $(CXXCOMPILE) -O0 -g -Wa,--compress-debug-sections=zlib-gabi -c -w -o $@ $(srcdir)/odr_violation1.cc
1541 odr_violation2_cdebug_gabi.o: odr_violation2.cc gcctestdir/as
1542 $(CXXCOMPILE) -O2 -g -Wa,--compress-debug-sections=zlib-gabi -c -w -o $@ $(srcdir)/odr_violation2.cc
1543 debug_msg_cdebug_gabi.err: debug_msg_cdebug_gabi.o odr_violation1_cdebug_gabi.o odr_violation2_cdebug_gabi.o gcctestdir/ld
1544 @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>$@"
1545 @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>$@; \
1547 echo 1>&2 "Link of debug_msg_cdebug_gabi should have failed"; \
1552 # See if we can also detect problems when we're linking .so's, not .o's.
1553 check_DATA += debug_msg_so.err
1554 MOSTLYCLEANFILES += debug_msg_so.err
1555 debug_msg.so: debug_msg.cc gcctestdir/ld
1556 $(CXXCOMPILE) -O0 -g -shared -fPIC -w -o $@ $(srcdir)/debug_msg.cc
1557 odr_violation1.so: odr_violation1.cc gcctestdir/ld
1558 $(CXXCOMPILE) -O0 -g -shared -fPIC -w -o $@ $(srcdir)/odr_violation1.cc
1559 odr_violation2.so: odr_violation2.cc gcctestdir/ld
1560 $(CXXCOMPILE) -O2 -g -shared -fPIC -w -o $@ $(srcdir)/odr_violation2.cc
1561 debug_msg_so.err: debug_msg.so odr_violation1.so odr_violation2.so gcctestdir/ld
1562 @echo $(CXXLINK_S) -Wl,--detect-odr-violations -o debug_msg_so debug_msg.so odr_violation1.so odr_violation2.so "2>$@"
1563 @if $(CXXLINK_S) -Wl,--detect-odr-violations -o debug_msg_so debug_msg.so odr_violation1.so odr_violation2.so 2>$@; \
1565 echo 1>&2 "Link of debug_msg_so should have failed"; \
1570 # We also want to make sure we do something reasonable when there's no
1571 # debug info available. For the best test, we use .so's.
1572 check_DATA += debug_msg_ndebug.err
1573 MOSTLYCLEANFILES += debug_msg_ndebug.err
1574 debug_msg_ndebug.so: debug_msg.cc gcctestdir/ld
1575 $(CXXCOMPILE) -O0 -g0 -shared -fPIC -w -o $@ $(srcdir)/debug_msg.cc
1576 odr_violation1_ndebug.so: odr_violation1.cc gcctestdir/ld
1577 $(CXXCOMPILE) -O0 -g0 -shared -fPIC -w -o $@ $(srcdir)/odr_violation1.cc
1578 odr_violation2_ndebug.so: odr_violation2.cc gcctestdir/ld
1579 $(CXXCOMPILE) -O2 -g0 -shared -fPIC -w -o $@ $(srcdir)/odr_violation2.cc
1580 debug_msg_ndebug.err: debug_msg_ndebug.so odr_violation1_ndebug.so odr_violation2_ndebug.so gcctestdir/ld
1581 @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>$@"
1582 @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>$@; \
1584 echo 1>&2 "Link of debug_msg_ndebug should have failed"; \
1590 # Similar to --detect-odr-violations: check for undefined symbols in .so's
1591 check_SCRIPTS += undef_symbol.sh
1592 check_DATA += undef_symbol.err
1593 MOSTLYCLEANFILES += undef_symbol.err
1594 undef_symbol.o: undef_symbol.cc
1595 $(CXXCOMPILE) -O0 -g -c -fPIC $<
1596 undef_symbol.so: undef_symbol.o gcctestdir/ld
1597 $(CXXLINK) -shared undef_symbol.o
1598 undef_symbol.err: undef_symbol_main.o undef_symbol.so gcctestdir/ld
1599 @echo $(CXXLINK) -o undef_symbol_test undef_symbol_main.o undef_symbol.so "2>$@"
1600 @if $(CXXLINK) -o undef_symbol_test undef_symbol_main.o undef_symbol.so 2>$@; \
1602 echo 1>&2 "Link of undef_symbol_test should have failed"; \
1608 # Test -o when emitting to a special file (such as something in /dev).
1609 check_PROGRAMS += flagstest_o_specialfile
1610 flagstest_o_specialfile: flagstest_debug.o gcctestdir/ld
1611 $(CXXLINK) -o /dev/stdout $< 2>&1 | cat > $@
1615 # Test --compress-debug-sections.
1616 check_PROGRAMS += flagstest_compress_debug_sections_none
1617 check_DATA += flagstest_compress_debug_sections_none.stdout
1618 flagstest_compress_debug_sections_none: flagstest_debug.o gcctestdir/ld
1619 $(CXXLINK) -o $@ $< -Wl,--compress-debug-sections=none
1622 # Dump DWARF debug sections.
1623 flagstest_compress_debug_sections_none.stdout: flagstest_compress_debug_sections_none
1624 $(TEST_READELF) -w $< > $@.tmp
1627 check_PROGRAMS += flagstest_compress_debug_sections
1628 check_DATA += flagstest_compress_debug_sections.stdout \
1629 flagstest_compress_debug_sections.cmp \
1630 flagstest_compress_debug_sections.check
1631 MOSTLYCLEANFILES += flagstest_compress_debug_sections.check \
1632 flagstest_compress_debug_sections.cmp
1633 flagstest_compress_debug_sections: flagstest_debug.o gcctestdir/ld
1634 $(CXXLINK) -o $@ $< -Wl,--compress-debug-sections=zlib
1637 # Test --compress-debug-sections with --build-id=tree.
1638 check_PROGRAMS += flagstest_compress_debug_sections_and_build_id_tree
1639 flagstest_compress_debug_sections_and_build_id_tree: flagstest_debug.o gcctestdir/ld
1640 $(CXXLINK) -o $@ $< -Wl,--compress-debug-sections=zlib \
1641 -Wl,--build-id=tree \
1642 -Wl,--build-id-chunk-size-for-treehash=4096 \
1643 -Wl,--build-id-min-file-size-for-treehash=0
1646 # Dump compressed DWARF debug sections.
1647 flagstest_compress_debug_sections.stdout: flagstest_compress_debug_sections
1648 $(TEST_READELF) -w $< | sed -e "s/.zdebug_/.debug_/" > $@.tmp
1651 # Check there are compressed DWARF .debug_* sections.
1652 flagstest_compress_debug_sections.check: flagstest_compress_debug_sections
1653 $(TEST_READELF) -SW $< | egrep ".debug_.* C *" > $@.tmp
1656 # Compare DWARF debug info.
1657 flagstest_compress_debug_sections.cmp: flagstest_compress_debug_sections.stdout \
1658 flagstest_compress_debug_sections_none.stdout
1659 cmp flagstest_compress_debug_sections.stdout \
1660 flagstest_compress_debug_sections_none.stdout > $@.tmp
1663 check_PROGRAMS += flagstest_compress_debug_sections_gnu
1664 check_DATA += flagstest_compress_debug_sections_gnu.stdout \
1665 flagstest_compress_debug_sections_gnu.cmp \
1666 flagstest_compress_debug_sections_gnu.check
1667 MOSTLYCLEANFILES += flagstest_compress_debug_sections_gnu.check \
1668 flagstest_compress_debug_sections_gnu.cmp
1669 flagstest_compress_debug_sections_gnu: flagstest_debug.o gcctestdir/ld
1670 $(CXXLINK) -o $@ $< -Wl,--compress-debug-sections=zlib-gnu
1673 # Dump compressed DWARF debug sections.
1674 flagstest_compress_debug_sections_gnu.stdout: flagstest_compress_debug_sections_gnu
1675 $(TEST_READELF) -w $< | sed -e "s/.zdebug_/.debug_/" > $@.tmp
1678 # Check there are compressed DWARF .zdebug_* sections.
1679 flagstest_compress_debug_sections_gnu.check: flagstest_compress_debug_sections_gnu
1680 $(TEST_READELF) -SW $< | grep ".zdebug_" > $@.tmp
1683 # Compare DWARF debug info.
1684 flagstest_compress_debug_sections_gnu.cmp: flagstest_compress_debug_sections_gnu.stdout \
1685 flagstest_compress_debug_sections_none.stdout
1686 cmp flagstest_compress_debug_sections_gnu.stdout \
1687 flagstest_compress_debug_sections_none.stdout > $@.tmp
1690 check_PROGRAMS += flagstest_compress_debug_sections_gabi
1691 check_DATA += flagstest_compress_debug_sections_gabi.stdout \
1692 flagstest_compress_debug_sections_gabi.cmp \
1693 flagstest_compress_debug_sections_gabi.check
1694 MOSTLYCLEANFILES += flagstest_compress_debug_sections_gabi.cmp \
1695 flagstest_compress_debug_sections_gabi.check
1696 flagstest_compress_debug_sections_gabi: flagstest_debug.o gcctestdir/ld
1697 $(CXXLINK) -o $@ $< -Wl,--compress-debug-sections=zlib-gabi
1700 # Dump compressed DWARF debug sections.
1701 flagstest_compress_debug_sections_gabi.stdout: flagstest_compress_debug_sections_gabi
1702 $(TEST_READELF) -w $< > $@.tmp
1705 # Check there are compressed DWARF .debug_* sections.
1706 flagstest_compress_debug_sections_gabi.check: flagstest_compress_debug_sections_gabi
1707 $(TEST_READELF) -tW $< | grep "COMPRESSED" > $@.tmp
1710 # Compare DWARF debug info.
1711 flagstest_compress_debug_sections_gabi.cmp: flagstest_compress_debug_sections_gabi.stdout \
1712 flagstest_compress_debug_sections_none.stdout
1713 cmp flagstest_compress_debug_sections_gabi.stdout \
1714 flagstest_compress_debug_sections_none.stdout > $@.tmp
1717 # The specialfile output has a tricky case when we also compress debug
1718 # sections, because it requires output-file resizing.
1719 check_PROGRAMS += flagstest_o_specialfile_and_compress_debug_sections
1720 flagstest_o_specialfile_and_compress_debug_sections: flagstest_debug.o \
1722 $(CXXLINK) -o /dev/stdout $< -Wl,--compress-debug-sections=zlib 2>&1 | cat > $@
1726 check_SCRIPTS += pr18689.sh
1727 check_DATA += pr18689.stdout
1728 MOSTLYCLEANFILES += pr18689a.o pr18689b.o
1730 pr18689.stdout: pr18689b.o
1731 $(TEST_READELF) -SW $< > $@
1733 pr18689a.o: pr18689.o ../ld-new
1734 ../ld-new -r -o $@ $<
1736 pr18689b.o: pr18689a.o ../ld-new
1737 ../ld-new -r -o $@ $<
1739 pr18689.o: pr18689.c gcctestdir/as
1740 $(COMPILE) -ggdb3 -g -Wa,--compress-debug-sections=zlib-gabi -c -w -o $@ $(srcdir)/pr18689.c
1742 # Test -TText and -Tdata.
1743 check_PROGRAMS += flagstest_o_ttext_1
1744 flagstest_o_ttext_1: flagstest_debug.o gcctestdir/ld
1745 $(CXXLINK) -o $@ $< -Wl,-Ttext,0x400000 -Wl,-Tdata,0x800000
1747 # This version won't be runnable, because there is no way to put the
1748 # PT_PHDR segment at file offset 0. We just make sure that we can
1749 # build it without error.
1750 check_DATA += flagstest_o_ttext_2
1751 MOSTLYCLEANFILES += flagstest_o_ttext_2
1752 flagstest_o_ttext_2: flagstest_debug.o gcctestdir/ld
1753 $(CXXLINK) -o $@ $< -Wl,-Ttext,0x400010 -Wl,-Tdata,0x800010
1755 # Test symbol versioning.
1756 check_PROGRAMS += ver_test
1757 ver_test_SOURCES = ver_test_main.cc
1758 ver_test_DEPENDENCIES = gcctestdir/ld ver_test_1.so ver_test_2.so ver_test_4.so
1759 ver_test_LDFLAGS = -Wl,-R,.
1760 ver_test_LDADD = ver_test_1.so ver_test_2.so ver_test_4.so
1761 ver_test_1.so: ver_test_1.o ver_test_2.so ver_test_3.o ver_test_4.so gcctestdir/ld
1762 $(CXXLINK) -shared ver_test_1.o ver_test_2.so ver_test_3.o ver_test_4.so
1763 ver_test_2.so: ver_test_2.o $(srcdir)/ver_test_2.script ver_test_4.so gcctestdir/ld
1764 $(CXXLINK) -shared -Wl,--version-script,$(srcdir)/ver_test_2.script -Wl,-R,. ver_test_2.o ver_test_4.so
1765 ver_test_4.so: ver_test_4.o $(srcdir)/ver_test_4.script gcctestdir/ld
1766 $(CXXLINK) -shared -Wl,--version-script,$(srcdir)/ver_test_4.script ver_test_4.o
1767 ver_test_1.o: ver_test_1.cc
1768 $(CXXCOMPILE) -c -fpic -o $@ $<
1769 ver_test_2.o: ver_test_2.cc
1770 $(CXXCOMPILE) -c -fpic -o $@ $<
1771 ver_test_3.o: ver_test_3.cc
1772 $(CXXCOMPILE) -c -fpic -o $@ $<
1773 ver_test_4.o: ver_test_4.cc
1774 $(CXXCOMPILE) -c -fpic -o $@ $<
1776 check_SCRIPTS += ver_test_1.sh
1777 check_DATA += ver_test_1.syms
1778 ver_test_1.syms: ver_test_1.so
1779 $(TEST_READELF) -s $< >$@ 2>/dev/null
1781 check_PROGRAMS += ver_test_2
1782 ver_test_2_SOURCES = ver_test_main_2.cc
1783 ver_test_2_DEPENDENCIES = gcctestdir/ld ver_test_4.so ver_test_2.so
1784 ver_test_2_LDFLAGS = -Wl,-R,.
1785 ver_test_2_LDADD = ver_test_4.so ver_test_2.so
1787 check_SCRIPTS += ver_test_2.sh
1788 check_DATA += ver_test_2.syms
1789 ver_test_2.syms: ver_test_2
1790 $(TEST_READELF) -s $< >$@ 2>/dev/null
1792 check_SCRIPTS += ver_test_4.sh
1793 check_DATA += ver_test_4.syms
1794 ver_test_4.syms: ver_test_4.so
1795 $(TEST_READELF) -s $< >$@ 2>/dev/null
1797 ver_test_5.so: ver_test_5.o $(srcdir)/ver_test_5.script ver_test_4.so gcctestdir/ld
1798 $(CXXLINK) -shared -Wl,--version-script,$(srcdir)/ver_test_5.script ver_test_5.o ver_test_4.so
1799 ver_test_5.o: ver_test_5.cc
1800 $(CXXCOMPILE) -c -fpic -o $@ $<
1801 check_SCRIPTS += ver_test_5.sh
1802 check_DATA += ver_test_5.syms
1803 ver_test_5.syms: ver_test_5.so
1804 $(TEST_READELF) -s $< >$@ 2>/dev/null
1806 check_PROGRAMS += ver_test_6
1807 ver_test_6_SOURCES = ver_test_6.c
1808 ver_test_6_DEPENDENCIES = gcctestdir/ld ver_test_2.so
1809 ver_test_6_LDFLAGS = -Wl,-R,.
1810 ver_test_6_LDADD = ver_test_2.so
1812 ver_test_7.so: ver_test_4.o $(srcdir)/ver_test_4.script ver_test_7.o gcctestdir/ld
1813 $(CXXLINK) -shared -Wl,--version-script,$(srcdir)/ver_test_4.script ver_test_4.o ver_test_7.o
1814 ver_test_7.o: ver_test_7.cc
1815 $(CXXCOMPILE) -c -fpic -o $@ $<
1816 check_SCRIPTS += ver_test_7.sh
1817 check_DATA += ver_test_7.syms
1818 ver_test_7.syms: ver_test_7.so
1819 $(TEST_READELF) -s $< >$@ 2>/dev/null
1821 check_PROGRAMS += ver_test_8
1822 ver_test_8_SOURCES = two_file_test_main.cc
1823 ver_test_8_DEPENDENCIES = gcctestdir/ld ver_test_8_1.so ver_test_8_2.so
1824 ver_test_8_LDFLAGS = -Wl,-R,.
1825 ver_test_8_LDADD = ver_test_8_1.so ver_test_8_2.so
1826 ver_test_8_1.so: two_file_test_1_pic.o two_file_test_1b_pic.o ver_test_8_2.so gcctestdir/ld
1827 $(CXXLINK) -shared two_file_test_1_pic.o two_file_test_1b_pic.o ver_test_8_2.so
1828 ver_test_8_2.so: two_file_test_2_pic.o $(srcdir)/ver_test_8.script gcctestdir/ld
1829 $(CXXLINK) -shared -Wl,--version-script,$(srcdir)/ver_test_8.script two_file_test_2_pic.o
1831 check_SCRIPTS += ver_test_8.sh
1832 check_DATA += ver_test_8_2.so.syms
1833 ver_test_8_2.so.syms: ver_test_8_2.so
1834 $(TEST_READELF) -s $< >$@ 2>/dev/null
1836 check_PROGRAMS += ver_test_9
1837 ver_test_9_SOURCES = ver_test_main.cc
1838 ver_test_9_DEPENDENCIES = gcctestdir/ld ver_test_9.so
1839 ver_test_9_LDFLAGS = -Wl,-R,.
1840 ver_test_9_LDADD = ver_test_9.so
1841 ver_test_9.so: ver_test_9.o ver_test_4.so ver_test_5.so gcctestdir/ld
1842 $(CXXLINK) -shared -Wl,-R,. ver_test_9.o ver_test_5.so ver_test_4.so
1843 ver_test_9.o: ver_test_9.cc
1844 $(CXXCOMPILE) -c -fpic -o $@ $<
1846 check_SCRIPTS += ver_test_10.sh
1847 check_DATA += ver_test_10.syms
1848 ver_test_10.syms: ver_test_10.so
1849 $(TEST_READELF) -s $< >$@ 2>/dev/null
1850 ver_test_10.so: gcctestdir/ld ver_test_2.o ver_test_10.script
1851 $(CXXLINK) -shared -Wl,--version-script,$(srcdir)/ver_test_10.script ver_test_2.o
1853 check_PROGRAMS += ver_test_11
1854 MOSTLYCLEANFILES += ver_test_11.a
1855 ver_test_11_SOURCES = ver_test_main_2.cc
1856 ver_test_11_DEPENDENCIES = gcctestdir/ld ver_test_11.a
1857 ver_test_11_LDFLAGS = -Wl,-R,.
1858 ver_test_11_LDADD = ver_test_11.a
1859 ver_test_11.a: ver_test_1.o ver_test_2.o ver_test_4.o
1862 check_PROGRAMS += ver_test_12
1863 ver_test_12_SOURCES = ver_test_main_2.cc
1864 ver_test_12_DEPENDENCIES = gcctestdir/ld ver_test_12.o
1865 ver_test_12_LDFLAGS = -Wl,-R,.
1866 ver_test_12_LDADD = ver_test_12.o
1867 ver_test_12.o: gcctestdir/ld ver_test_1.o ver_test_2.o ver_test_4.o
1868 gcctestdir/ld -r -o $@ ver_test_1.o ver_test_2.o ver_test_4.o
1870 check_SCRIPTS += ver_test_13.sh
1871 check_DATA += ver_test_13.syms
1872 ver_test_13.syms: ver_test_13.so
1873 $(TEST_READELF) -s $< >$@ 2>/dev/null
1874 ver_test_13.so: gcctestdir/ld ver_test_13.o ver_test_13.script
1875 $(LINK) -shared -Wl,--version-script,$(srcdir)/ver_test_13.script ver_test_13.o
1876 ver_test_13.o: ver_test_13.c
1877 $(COMPILE) -c -fpic -o $@ $<
1879 check_SCRIPTS += ver_test_14.sh
1880 check_DATA += ver_test_14.syms
1881 MOSTLYCLEANFILES += ver_test_14
1882 ver_test_14.syms: ver_test_14
1883 $(TEST_OBJDUMP) -T $< | $(TEST_CXXFILT) >$@
1884 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
1885 $(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
1887 check_SCRIPTS += ver_test_pr23409.sh
1888 check_DATA += ver_test_pr23409.syms
1889 ver_test_pr23409.syms: ver_test_pr23409_1.so
1890 $(TEST_READELF) --dyn-syms -W $< >$@
1891 ver_test_pr23409_1.so: gcctestdir/ld ver_test_1.o $(srcdir)/ver_test_pr23409_1.script ver_test_pr23409_2.so
1892 gcctestdir/ld -shared -o $@ ver_test_1.o ver_test_pr23409_2.so --version-script $(srcdir)/ver_test_pr23409_1.script
1893 ver_test_pr23409_2.so: gcctestdir/ld ver_test_1.o $(srcdir)/ver_test_pr23409_2.script
1894 gcctestdir/ld -shared -o $@ ver_test_1.o --version-script $(srcdir)/ver_test_pr23409_2.script
1896 check_SCRIPTS += weak_as_needed.sh
1897 check_DATA += weak_as_needed.stdout
1898 weak_as_needed.stdout: weak_as_needed_a.so
1899 $(TEST_READELF) -dW --dyn-syms $< >$@
1900 weak_as_needed_a.so: gcctestdir/ld weak_as_needed_a.o weak_as_needed_b.so weak_as_needed_c.so
1901 gcctestdir/ld -shared -rpath . -o $@ weak_as_needed_a.o --as-needed weak_as_needed_b.so weak_as_needed_c.so
1902 weak_as_needed_b.so: gcctestdir/ld weak_as_needed_b.o weak_as_needed_b.script
1903 gcctestdir/ld -shared -rpath . -o $@ --version-script $(srcdir)/weak_as_needed_b.script weak_as_needed_b.o
1904 weak_as_needed_c.so: gcctestdir/ld weak_as_needed_c.o weak_as_needed_c.script
1905 gcctestdir/ld -shared -rpath . -o $@ --version-script $(srcdir)/weak_as_needed_c.script weak_as_needed_c.o
1906 weak_as_needed_a.o: weak_as_needed_a.c
1907 $(COMPILE) -c -fpic -o $@ $<
1908 weak_as_needed_b.o: weak_as_needed_b.c
1909 $(COMPILE) -c -fpic -o $@ $<
1910 weak_as_needed_c.o: weak_as_needed_c.c
1911 $(COMPILE) -c -fpic -o $@ $<
1913 check_PROGRAMS += protected_1
1914 protected_1_SOURCES = \
1915 protected_main_1.cc protected_main_2.cc protected_main_3.cc
1916 protected_1_DEPENDENCIES = gcctestdir/ld protected_1.so
1917 protected_1_LDFLAGS = -Wl,-R,.
1918 protected_1_LDADD = protected_1.so
1920 protected_1.so: gcctestdir/ld protected_1_pic.o protected_2_pic.o protected_3_pic.o
1921 $(CXXLINK) -shared protected_1_pic.o protected_2_pic.o protected_3_pic.o
1922 protected_1_pic.o: protected_1.cc
1923 $(CXXCOMPILE) -c -fpic -o $@ $<
1924 protected_2_pic.o: protected_2.cc
1925 $(CXXCOMPILE) -c -fpic -o $@ $<
1926 protected_3_pic.o: protected_3.cc
1927 $(CXXCOMPILE) -c -fpic -o $@ $<
1929 check_PROGRAMS += protected_2
1930 protected_2_SOURCES = protected_main_1.cc protected_3.cc
1931 protected_2_DEPENDENCIES = gcctestdir/ld protected_1.so
1932 protected_2_LDFLAGS = -Wl,-R,.
1933 protected_2_LDADD = protected_1.so
1935 check_DATA += protected_3.err
1936 MOSTLYCLEANFILES += protected_3.err
1937 protected_4_pic.o: protected_4.cc
1938 $(CXXCOMPILE) -c -fpic -o $@ $<
1939 protected_3.err: protected_4_pic.o gcctestdir/ld
1940 @echo $(CXXLINK) -shared -o protected_4.so protected_4_pic.o "2>$@"
1941 @if $(CXXLINK) -shared -o protected_4.so protected_4_pic.o 2>$@; then \
1942 echo 1>&2 "Link of protected_4.so should have failed"; \
1947 check_PROGRAMS += relro_test
1948 check_SCRIPTS += relro_test.sh
1949 check_DATA += relro_test.stdout
1950 relro_test_SOURCES = relro_test_main.cc
1951 relro_test_DEPENDENCIES = gcctestdir/ld relro_test.so
1952 relro_test_LDFLAGS = -Wl,-R,.
1953 relro_test_LDADD = relro_test.so
1954 relro_test.so: gcctestdir/ld relro_test_pic.o
1955 $(CXXLINK) -shared -Wl,-z,relro relro_test_pic.o
1956 relro_test_pic.o: relro_test.cc
1957 $(CXXCOMPILE) -c -fpic -o $@ $<
1958 relro_test.stdout: relro_test.so
1959 $(TEST_READELF) -SlW relro_test.so > relro_test.stdout
1961 check_PROGRAMS += relro_now_test
1962 relro_now_test_SOURCES = relro_test_main.cc
1963 relro_now_test_DEPENDENCIES = gcctestdir/ld relro_now_test.so
1964 relro_now_test_LDFLAGS = -Wl,-R,. -Wl,-z,relro -Wl,-z,now
1965 relro_now_test_LDADD = relro_now_test.so
1966 relro_now_test.so: gcctestdir/ld relro_test_pic.o
1967 $(CXXLINK) -shared -Wl,-z,relro -Wl,-z,now relro_test_pic.o
1969 check_PROGRAMS += relro_strip_test
1970 relro_strip_test_SOURCES = relro_test_main.cc
1971 relro_strip_test_DEPENDENCIES = gcctestdir/ld relro_strip_test.so
1972 relro_strip_test_LDFLAGS = -Wl,-R,.
1973 relro_strip_test_LDADD = relro_strip_test.so
1974 relro_strip_test.so: relro_test.so
1975 $(TEST_STRIP) -o $@ $<
1977 check_PROGRAMS += relro_script_test
1978 relro_script_test_SOURCES = relro_test_main.cc
1979 relro_script_test_DEPENDENCIES = gcctestdir/ld relro_script_test.so
1980 relro_script_test_LDFLAGS = -Wl,-R,.
1981 relro_script_test_LDADD = relro_script_test.so
1982 relro_script_test.so: gcctestdir/ld relro_script_test.t relro_test_pic.o
1983 $(CXXLINK) -shared -Wl,-z,relro -Wl,-T,$(srcdir)/relro_script_test.t relro_test_pic.o
1985 check_PROGRAMS += script_test_1
1986 script_test_1_SOURCES = script_test_1a.cc script_test_1b.cc
1987 script_test_1_DEPENDENCIES = gcctestdir/ld script_test_1.t
1988 script_test_1_LDFLAGS = -Wl,-R,. -Wl,-T,$(srcdir)/script_test_1.t
1989 script_test_1_LDADD =
1991 check_PROGRAMS += script_test_2
1992 script_test_2_SOURCES = script_test_2.cc script_test_2a.cc script_test_2b.cc
1993 script_test_2_DEPENDENCIES = gcctestdir/ld script_test_2.t
1994 script_test_2_LDFLAGS = -Wl,-R,. -Wl,-T,$(srcdir)/script_test_2.t
1995 script_test_2_LDADD =
1997 check_PROGRAMS += justsyms
1998 justsyms_SOURCES = justsyms_1.cc
1999 justsyms_DEPENDENCIES = gcctestdir/ld justsyms_2r.o
2000 justsyms_LDFLAGS = -Wl,-R,justsyms_2r.o
2002 justsyms_2.o: justsyms_2.cc
2003 $(CXXCOMPILE) -c -o $@ $<
2004 justsyms_2r.o: justsyms_2.o gcctestdir/ld $(srcdir)/justsyms.t
2005 gcctestdir/ld -o $@ -r -T $(srcdir)/justsyms.t justsyms_2.o
2007 check_PROGRAMS += justsyms_exec
2008 justsyms_exec_SOURCES = justsyms_exec.c
2009 justsyms_exec_DEPENDENCIES = gcctestdir/ld justsyms_lib
2010 justsyms_exec_LDFLAGS = -Wl,-R,justsyms_lib
2011 justsyms_exec_LDADD =
2012 MOSTLYCLEANFILES += justsyms_lib
2013 justsyms_lib.o: justsyms_lib.c
2014 $(COMPILE) -c -o $@ $<
2015 justsyms_lib: justsyms_lib.o gcctestdir/ld
2016 gcctestdir/ld -o $@ -z norelro -Ttext=0x1000200 -Tdata=0x2000000 -e exported_func justsyms_lib.o
2018 check_PROGRAMS += binary_test
2019 MOSTLYCLEANFILES += binary.txt
2020 binary_test_SOURCES = binary_test.cc
2021 binary_test_DEPENDENCIES = gcctestdir/ld binary.txt
2022 binary_test_LDFLAGS = -Wl,--format,binary,binary.txt,--format,elf
2024 # Copy the file to the build directory to avoid worrying about the
2025 # full pathname in the generated symbols.
2026 binary.txt: $(srcdir)/binary.in
2030 check_SCRIPTS += ver_matching_test.sh
2031 check_DATA += ver_matching_test.stdout
2032 MOSTLYCLEANFILES += ver_matching_test.stdout
2033 ver_matching_def.so: ver_matching_def_pic.o $(srcdir)/version_script.map gcctestdir/ld
2034 $(CXXLINK) -O0 -shared ver_matching_def_pic.o -Wl,--version-script=$(srcdir)/version_script.map
2035 ver_matching_def_pic.o: ver_matching_def.cc
2036 $(CXXCOMPILE) -O0 -c -fpic -o $@ $<
2037 ver_matching_test.stdout: ver_matching_def.so
2038 $(TEST_OBJDUMP) -T ver_matching_def.so | $(TEST_CXXFILT) > ver_matching_test.stdout
2040 check_PROGRAMS += script_test_3
2041 check_SCRIPTS += script_test_3.sh
2042 check_DATA += script_test_3.stdout
2043 MOSTLYCLEANFILES += script_test_3.stdout
2044 script_test_3: basic_test.o gcctestdir/ld script_test_3.t
2045 $(CXXLINK) basic_test.o -Wl,-T,$(srcdir)/script_test_3.t
2046 script_test_3.stdout: script_test_3
2047 $(TEST_READELF) -SlW script_test_3 > script_test_3.stdout
2049 check_PROGRAMS += tls_phdrs_script_test
2050 tls_phdrs_script_test_SOURCES = $(tls_test_SOURCES)
2051 tls_phdrs_script_test_DEPENDENCIES = $(tls_test_DEPENDENCIES) $(srcdir)/script_test_3.t
2052 tls_phdrs_script_test_LDFLAGS = $(tls_test_LDFLAGS) -Wl,-T,$(srcdir)/script_test_3.t
2053 tls_phdrs_script_test_LDADD = $(tls_test_LDADD)
2055 check_SCRIPTS += script_test_4.sh
2056 check_DATA += script_test_4.stdout
2057 MOSTLYCLEANFILES += script_test_4
2058 script_test_4: basic_test.o gcctestdir/ld $(srcdir)/script_test_4.t
2059 $(CXXLINK) basic_test.o -Wl,-T,$(srcdir)/script_test_4.t
2060 script_test_4.stdout: script_test_4
2061 $(TEST_READELF) -SlW script_test_4 > script_test_4.stdout
2063 check_PROGRAMS += tls_script_test
2064 tls_script_test_SOURCES = $(tls_test_SOURCES)
2065 tls_script_test_DEPENDENCIES = $(tls_test_DEPENDENCIES) $(srcdir)/script_test_4.t
2066 tls_script_test_LDFLAGS = $(tls_test_LDFLAGS) -Wl,-T,$(srcdir)/script_test_4.t
2067 tls_script_test_LDADD = $(tls_test_LDADD)
2069 check_SCRIPTS += script_test_5.sh
2070 check_DATA += script_test_5.stdout
2071 MOSTLYCLEANFILES += script_test_5
2072 script_test_5: script_test_5.o gcctestdir/ld $(srcdir)/script_test_5.t
2073 $(CXXLINK) script_test_5.o -Wl,-T,$(srcdir)/script_test_5.t
2074 script_test_5.stdout: script_test_5
2075 $(TEST_READELF) -SW script_test_5 > script_test_5.stdout
2077 check_SCRIPTS += script_test_6.sh
2078 check_DATA += script_test_6.stdout
2079 MOSTLYCLEANFILES += script_test_6
2080 script_test_6: basic_test.o gcctestdir/ld $(srcdir)/script_test_6.t
2081 $(CXXLINK) basic_test.o -Wl,-T,$(srcdir)/script_test_6.t \
2082 -Wl,-Ttext=0x10001000 -Wl,-Tdata=0x10200000 -Wl,-Tbss=0x10400000
2083 script_test_6.stdout: script_test_6
2084 $(TEST_READELF) -SlW script_test_6 > script_test_6.stdout
2086 check_SCRIPTS += script_test_7.sh
2087 check_DATA += script_test_7.stdout
2088 MOSTLYCLEANFILES += script_test_7
2089 script_test_7: basic_test.o gcctestdir/ld $(srcdir)/script_test_7.t
2090 $(CXXLINK) basic_test.o -Wl,-T,$(srcdir)/script_test_7.t
2091 script_test_7.stdout: script_test_7
2092 $(TEST_READELF) -SlW script_test_7 > script_test_7.stdout
2094 check_SCRIPTS += script_test_8.sh
2095 check_DATA += script_test_8.stdout
2096 MOSTLYCLEANFILES += script_test_8
2097 script_test_8: basic_test.o gcctestdir/ld $(srcdir)/script_test_7.t
2098 $(CXXLINK) basic_test.o -Wl,-T,$(srcdir)/script_test_7.t \
2099 -Wl,-Ttext=0x20001000 -Wl,-Tdata=0x20200000 -Wl,-Tbss=0x20400000
2100 script_test_8.stdout: script_test_8
2101 $(TEST_READELF) -SlW script_test_8 > script_test_8.stdout
2103 check_SCRIPTS += script_test_9.sh
2104 check_DATA += script_test_9.stdout
2105 MOSTLYCLEANFILES += script_test_9
2106 script_test_9.o: script_test_9.cc
2107 $(CXXCOMPILE) -O0 -c -o $@ $<
2108 script_test_9: gcctestdir/ld $(srcdir)/script_test_9.t script_test_9.o
2109 $(CXXLINK) script_test_9.o -Wl,-T,$(srcdir)/script_test_9.t
2110 script_test_9.stdout: script_test_9
2111 $(TEST_READELF) -lW script_test_9 > script_test_9.stdout
2113 # Test scripts with a relocatable link.
2114 # The -g option is necessary to trigger a bug where a section
2115 # declared in a script file is assigned a non-zero starting address.
2116 check_PROGRAMS += script_test_11
2117 script_test_11: gcctestdir/ld script_test_11_r.o
2118 $(LINK) script_test_11_r.o
2119 script_test_11_r.o: gcctestdir/ld $(srcdir)/script_test_11.t script_test_11a.o script_test_11b.o
2120 gcctestdir/ld -r -o $@ -T $(srcdir)/script_test_11.t script_test_11a.o script_test_11b.o
2121 script_test_11a.o: script_test_11a.c
2122 $(COMPILE) -c -g -o $@ $<
2123 script_test_11b.o: script_test_11b.c
2124 $(COMPILE) -c -g -o $@ $<
2126 # Test difference between "*(a b)" and "*(a) *(b)" in input section spec.
2127 check_PROGRAMS += script_test_12
2128 script_test_12: gcctestdir/ld $(srcdir)/script_test_12.t script_test_12a.o script_test_12b.o
2129 $(LINK) -Wl,-T,$(srcdir)/script_test_12.t script_test_12a.o script_test_12b.o
2131 check_PROGRAMS += script_test_12i
2132 script_test_12i: gcctestdir/ld $(srcdir)/script_test_12i.t script_test_12a.o script_test_12b.o
2133 $(LINK) -Wl,-T,$(srcdir)/script_test_12i.t script_test_12a.o script_test_12b.o
2134 script_test_12a.o: script_test_12a.c
2135 $(COMPILE) -O0 -c -o $@ $<
2136 script_test_12b.o: script_test_12b.c
2137 $(COMPILE) -O0 -c -o $@ $<
2139 # Test for ordering internally created sections with a linker script.
2140 check_SCRIPTS += script_test_13.sh
2141 check_DATA += script_test_13.stdout
2142 MOSTLYCLEANFILES += script_test_13
2143 script_test_13.o: script_test_13.c
2144 $(COMPILE) -O0 -c -fPIC -o $@ $<
2145 script_test_13: $(srcdir)/script_test_13.t script_test_13.o gcctestdir/ld
2146 gcctestdir/ld -shared -o $@ script_test_13.o -T $(srcdir)/script_test_13.t
2147 script_test_13.stdout: script_test_13
2148 $(TEST_READELF) -SW script_test_13 > $@
2150 # Test for SORT_BY_INIT_PRIORITY.
2151 check_SCRIPTS += script_test_14.sh
2152 check_DATA += script_test_14.stdout
2153 MOSTLYCLEANFILES += script_test_14
2154 script_test_14.o: script_test_14.s
2156 script_test_14: $(srcdir)/script_test_14.t script_test_14.o gcctestdir/ld
2157 gcctestdir/ld -o $@ script_test_14.o -T $(srcdir)/script_test_14.t
2158 script_test_14.stdout: script_test_14
2159 $(TEST_OBJDUMP) -s script_test_14 > $@
2161 # Test BSS section placement at end of segment.
2162 check_SCRIPTS += script_test_15a.sh
2163 check_DATA += script_test_15a.stdout
2164 MOSTLYCLEANFILES += script_test_15a
2165 script_test_15a: $(srcdir)/script_test_15a.t script_test_15.o gcctestdir/ld
2166 gcctestdir/ld -o $@ script_test_15.o -T $(srcdir)/script_test_15a.t
2167 script_test_15a.stdout: script_test_15a
2168 $(TEST_READELF) -lSW script_test_15a > $@
2170 # Test BSS section placement in middle of segment.
2171 check_SCRIPTS += script_test_15b.sh
2172 check_DATA += script_test_15b.stdout
2173 MOSTLYCLEANFILES += script_test_15b
2174 script_test_15b: $(srcdir)/script_test_15b.t script_test_15.o gcctestdir/ld
2175 gcctestdir/ld -o $@ script_test_15.o -T $(srcdir)/script_test_15b.t
2176 script_test_15b.stdout: script_test_15b
2177 $(TEST_READELF) -lSW script_test_15b > $@
2179 # Test orphan BSS section placement.
2180 check_SCRIPTS += script_test_15c.sh
2181 check_DATA += script_test_15c.stdout
2182 MOSTLYCLEANFILES += script_test_15c
2183 script_test_15c: $(srcdir)/script_test_15c.t script_test_15.o gcctestdir/ld
2184 gcctestdir/ld -o $@ script_test_15.o -T $(srcdir)/script_test_15c.t
2185 script_test_15c.stdout: script_test_15c
2186 $(TEST_READELF) -lSW script_test_15c > $@
2188 # Test --dynamic-list, --dynamic-list-data, --dynamic-list-cpp-new,
2189 # and --dynamic-list-cpp-typeinfo
2191 check_SCRIPTS += dynamic_list.sh
2192 check_DATA += dynamic_list.stdout
2193 MOSTLYCLEANFILES += dynamic_list dynamic_list.stdout
2194 dynamic_list: basic_test.o gcctestdir/ld $(srcdir)/dynamic_list.t
2195 $(CXXLINK) basic_test.o \
2196 -Wl,--dynamic-list $(srcdir)/dynamic_list.t \
2197 -Wl,--dynamic-list-data \
2198 -Wl,--dynamic-list-cpp-new \
2199 -Wl,--dynamic-list-cpp-typeinfo
2200 dynamic_list.stdout: dynamic_list
2201 $(TEST_READELF) -W --dyn-syms dynamic_list > dynamic_list.stdout
2203 check_PROGRAMS += dynamic_list_2
2204 dynamic_list_2_SOURCES = dynamic_list_2.cc
2205 dynamic_list_2_DEPENDENCIES = gcctestdir/ld dynamic_list_lib1.so dynamic_list_lib2.so
2206 dynamic_list_2_LDFLAGS = -L. -Wl,-R,. -Wl,--no-as-needed
2207 dynamic_list_2_LDADD = dynamic_list_lib1.so dynamic_list_lib2.so
2209 dynamic_list_lib1.so: gcctestdir/ld dynamic_list_lib1.o
2210 $(CXXLINK) -shared dynamic_list_lib1.o
2211 dynamic_list_lib1.o: dynamic_list_lib1.cc
2212 $(CXXCOMPILE) -c -fpic -o $@ $<
2214 dynamic_list_lib2.so: gcctestdir/ld dynamic_list_lib2.o $(srcdir)/dynamic_list_2.t
2215 $(CXXLINK) -shared -Wl,-Bsymbolic-functions -Wl,--dynamic-list,$(srcdir)/dynamic_list_2.t dynamic_list_lib2.o
2216 dynamic_list_lib2.o: dynamic_list_lib2.cc
2217 $(CXXCOMPILE) -c -fpic -o $@ $<
2219 check_PROGRAMS += thin_archive_test_1
2220 MOSTLYCLEANFILES += libthin1.a libthin3.a libthinall.a \
2221 alt/thin_archive_test_2.o alt/thin_archive_test_4.o \
2222 alt/libthin2.a alt/libthin4.a
2223 thin_archive_test_1_SOURCES = thin_archive_main.cc
2224 thin_archive_test_1_DEPENDENCIES = gcctestdir/ld libthin1.a alt/libthin2.a
2225 thin_archive_test_1_LDFLAGS = -Lalt
2226 thin_archive_test_1_LDADD = libthin1.a -lthin2
2228 check_PROGRAMS += thin_archive_test_2
2229 thin_archive_test_2_SOURCES = thin_archive_main.cc
2230 thin_archive_test_2_DEPENDENCIES = gcctestdir/ld libthinall.a
2231 thin_archive_test_2_LDFLAGS = -L.
2232 thin_archive_test_2_LDADD = -lthinall
2234 libthin1.a: thin_archive_test_1.o alt/thin_archive_test_2.o
2236 $(TEST_AR) crT $@ $^
2237 alt/libthin2.a: thin_archive_test_3.o alt/thin_archive_test_4.o
2239 $(TEST_AR) crT $@ $^
2240 libthin3.a: thin_archive_test_1.o alt/thin_archive_test_4.o
2242 $(TEST_AR) crT $@ $^
2243 alt/libthin4.a: alt/thin_archive_test_2.o thin_archive_test_3.o
2245 $(TEST_AR) crT $@ $^
2246 libthinall.a: libthin3.a alt/libthin4.a
2248 $(TEST_AR) crT $@ $^
2249 alt/thin_archive_test_2.o: thin_archive_test_2.cc
2250 test -d alt || mkdir -p alt
2251 $(CXXCOMPILE) -c -o $@ $<
2252 alt/thin_archive_test_4.o: thin_archive_test_4.cc
2253 test -d alt || mkdir -p alt
2254 $(CXXCOMPILE) -c -o $@ $<
2258 check_PROGRAMS += plugin_test_1
2259 check_SCRIPTS += plugin_test_1.sh
2260 check_DATA += plugin_test_1.err
2261 MOSTLYCLEANFILES += plugin_test_1.err
2262 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
2263 $(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
2264 plugin_test_1.err: plugin_test_1
2265 @touch plugin_test_1.err
2267 check_PROGRAMS += plugin_test_2
2268 check_SCRIPTS += plugin_test_2.sh
2269 check_DATA += plugin_test_2.err
2270 MOSTLYCLEANFILES += plugin_test_2.err
2271 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
2272 $(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
2273 plugin_test_2.err: plugin_test_2
2274 @touch plugin_test_2.err
2276 check_PROGRAMS += plugin_test_3
2277 check_SCRIPTS += plugin_test_3.sh
2278 check_DATA += plugin_test_3.err
2279 MOSTLYCLEANFILES += plugin_test_3.err
2280 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
2281 $(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
2282 plugin_test_3.err: plugin_test_3
2283 @touch plugin_test_3.err
2285 check_PROGRAMS += plugin_test_4
2286 check_SCRIPTS += plugin_test_4.sh
2287 check_DATA += plugin_test_4.err
2288 MOSTLYCLEANFILES += plugin_test_4.a plugin_test_4.err
2289 plugin_test_4: two_file_test_main.o plugin_test_4.a gcctestdir/ld plugin_test.so
2290 $(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
2291 plugin_test_4.err: plugin_test_4
2292 @touch plugin_test_4.err
2294 plugin_test_4.a: two_file_test_1.o.syms two_file_test_1b.o.syms two_file_test_2.o.syms
2297 check_PROGRAMS += plugin_test_5
2298 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
2299 $(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
2301 check_PROGRAMS += plugin_test_6
2302 check_SCRIPTS += plugin_test_6.sh
2303 check_DATA += plugin_test_6.err
2304 MOSTLYCLEANFILES += plugin_test_6.err
2305 plugin_test_6: plugin_common_test_1.o.syms plugin_common_test_2.o.syms gcctestdir/ld plugin_test.so
2306 $(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
2307 plugin_test_6.err: plugin_test_6
2308 @touch plugin_test_6.err
2310 check_PROGRAMS += plugin_test_7
2311 check_SCRIPTS += plugin_test_7.sh
2312 check_DATA += plugin_test_7.err plugin_test_7.o.syms
2313 MOSTLYCLEANFILES += plugin_test_7.err
2314 plugin_test_7: plugin_test_7_1.o plugin_test_7_1.o.syms plugin_test_7_2.o gcctestdir/ld plugin_test.so
2315 $(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
2316 plugin_test_7.o.syms: plugin_test_7
2317 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2318 plugin_test_7_1.o: plugin_test_7_1.c
2319 $(COMPILE) -DLTO -O0 -c -ffunction-sections -fdata-sections -o $@ $<
2320 plugin_test_7_1_orig.o: plugin_test_7_1.c
2321 $(COMPILE) -O0 -c -ffunction-sections -fdata-sections -o $@ $<
2322 plugin_test_7_1.o.syms: plugin_test_7_1_orig.o
2323 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2324 plugin_test_7_2.o: plugin_test_7_2.c
2325 $(COMPILE) -O0 -c -ffunction-sections -fdata-sections -o $@ $<
2326 plugin_test_7.err: plugin_test_7
2328 # Test plugins with -r.
2329 check_PROGRAMS += plugin_test_8
2330 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
2331 ../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
2332 plugin_test_8: plugin_test_8.o gcctestdir/ld
2333 $(CXXLINK) -Wl,--no-demangle plugin_test_8.o
2335 # Test that symbols known in the IR file but not in the replacement file
2336 # produce an unresolved symbol error.
2337 check_DATA += plugin_test_9.err
2338 MOSTLYCLEANFILES += plugin_test_9.err
2339 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
2340 @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>$@"
2341 @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 \
2342 echo 1>&2 "Link of plugin_test_9 should have failed"; \
2346 # Make a .syms file that claims to define the symbol _Z4t16av.
2347 two_file_test_1c.o.syms: two_file_test_1.o.syms two_file_test_1c.o
2348 cp two_file_test_1.o.syms $@.tmp
2349 grep "_Z4t16av" two_file_test_1b.o.syms >> $@.tmp
2351 # Make a copy of two_file_test_1.o, which does not define the symbol _Z4t16av.
2352 MOSTLYCLEANFILES += two_file_test_1c.o
2353 two_file_test_1c.o: two_file_test_1.o
2354 cp two_file_test_1.o $@
2356 # As above, but check COMDAT case, where a non-IR file contains a duplicate
2357 # of a COMDAT group in an IR file.
2358 check_DATA += plugin_test_9b.err
2359 MOSTLYCLEANFILES += plugin_test_9b.err
2360 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
2361 @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>$@"
2362 @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 \
2363 echo 1>&2 "Link of plugin_test_9b should have failed"; \
2367 # Make a .syms file that claims to define a method in class A in a COMDAT group.
2368 # The real plugin_test_9b_ir.o will be compiled without the -D, and will not
2369 # define any methods in class A.
2370 plugin_test_9b_ir.o.syms: plugin_test_9b_ir_witha.o
2371 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2372 plugin_test_9b_ir_witha.o: plugin_test_9b_ir.cc
2373 $(CXXCOMPILE) -c -DUSE_CLASS_A -o $@ $<
2375 check_PROGRAMS += plugin_test_10
2376 check_SCRIPTS += plugin_test_10.sh
2377 check_DATA += plugin_test_10.sections
2378 MOSTLYCLEANFILES += plugin_test_10.sections
2379 plugin_test_10: plugin_common_test_1.o.syms plugin_common_test_2.o gcctestdir/ld plugin_test.so
2380 $(CXXLINK) -Wl,--no-demangle,--plugin,"./plugin_test.so" plugin_common_test_1.o.syms plugin_common_test_2.o
2381 plugin_test_10.sections: plugin_test_10
2382 $(TEST_READELF) -SW $< >$@ 2>/dev/null
2384 check_PROGRAMS += plugin_test_11
2385 check_SCRIPTS += plugin_test_11.sh
2386 check_DATA += plugin_test_11.err
2387 MOSTLYCLEANFILES += plugin_test_11.err plugin_test_thin.a
2388 PLUGIN_TEST_11_SYMS = two_file_test_1.o.syms two_file_test_1b.o.syms two_file_test_2.o.syms
2389 plugin_test_11: two_file_test_main.o plugin_test_thin.a gcctestdir/ld plugin_test.so $(PLUGIN_TEST_11_SYMS)
2390 $(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
2391 plugin_test_11.err: plugin_test_11
2392 @touch plugin_test_11.err
2393 plugin_test_thin.a: two_file_test_1.o two_file_test_1b.o two_file_test_2.o
2395 $(TEST_AR) crT $@ $^
2397 check_PROGRAMS += plugin_test_12
2398 check_SCRIPTS += plugin_test_12.sh
2399 check_DATA += plugin_test_12.err
2400 MOSTLYCLEANFILES += plugin_test_12.err
2401 export_dynamic_plugin.o.syms: export_dynamic_plugin.o
2402 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2403 export_dynamic_plugin.o: export_dynamic_plugin.cc
2404 $(COMPILE) -c -o $@ $<
2405 plugin_test_12: export_dynamic_plugin.o gcctestdir/ld plugin_test.so export_dynamic_plugin.o.syms
2406 $(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
2407 plugin_test_12.err: plugin_test_12
2408 @touch plugin_test_12.err
2410 check_PROGRAMS += plugin_test_wrap_symbols
2411 check_SCRIPTS += plugin_test_wrap_symbols.sh
2412 check_DATA += plugin_test_wrap_symbols.err
2413 MOSTLYCLEANFILES += plugin_test_wrap_symbols.err
2414 plugin_test_wrap_symbols_1.o: plugin_test_wrap_symbols_1.cc
2415 $(COMPILE) -c -o $@ $<
2416 plugin_test_wrap_symbols_2.o: plugin_test_wrap_symbols_2.cc
2417 $(COMPILE) -c -o $@ $<
2418 plugin_test_wrap_symbols: plugin_test_wrap_symbols_1.o plugin_test_wrap_symbols_2.o gcctestdir/ld plugin_test.so
2419 $(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
2420 plugin_test_wrap_symbols.err: plugin_test_wrap_symbols
2421 @touch plugin_test_wrap_symbols.err
2423 check_PROGRAMS += plugin_test_start_lib
2424 check_SCRIPTS += plugin_test_start_lib.sh
2425 check_DATA += plugin_test_start_lib.err
2426 MOSTLYCLEANFILES += plugin_test_start_lib.err
2427 plugin_test_start_lib: unused.o plugin_start_lib_test.o plugin_start_lib_test_2.syms gcctestdir/ld plugin_test.so
2428 $(CXXLINK) -Wl,--no-demangle,--plugin,"./plugin_test.so" plugin_start_lib_test.o \
2429 -Wl,--start-lib plugin_start_lib_test_2.syms -Wl,--end-lib 2>plugin_test_start_lib.err
2430 plugin_test_start_lib.err: plugin_test_start_lib
2431 @touch plugin_test_start_lib.err
2433 check_PROGRAMS += plugin_test_defsym
2434 check_SCRIPTS += plugin_test_defsym.sh
2435 check_DATA += plugin_test_defsym.err
2436 MOSTLYCLEANFILES += plugin_test_defsym.err
2437 plugin_test_defsym.syms: plugin_test_defsym.o
2438 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2439 plugin_test_defsym.o: plugin_test_defsym.c
2440 $(COMPILE) -c -o $@ $<
2441 plugin_test_defsym: plugin_test_defsym.o plugin_test_defsym.syms gcctestdir/ld plugin_test.so
2442 $(CXXLINK) -Wl,--no-demangle,--plugin,"./plugin_test.so" -Wl,--defsym,bar=foo plugin_test_defsym.syms 2>plugin_test_defsym.err
2443 plugin_test_defsym.err: plugin_test_defsym
2444 @touch plugin_test_defsym.err
2446 plugin_start_lib_test_2.syms: plugin_start_lib_test_2.o
2447 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2449 plugin_test.so: plugin_test.o gcctestdir/ld
2450 $(LINK) -shared plugin_test.o
2451 plugin_test.o: plugin_test.c
2452 $(COMPILE) -O0 -c -fpic -o $@ $<
2454 two_file_test_main.o.syms: two_file_test_main.o
2455 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2456 two_file_test_1.o.syms: two_file_test_1.o
2457 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2458 two_file_test_1b.o.syms: two_file_test_1b.o
2459 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2460 two_file_test_2.o.syms: two_file_test_2.o
2461 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2462 plugin_common_test_1.o.syms: plugin_common_test_1.o
2463 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2464 plugin_common_test_2.o.syms: plugin_common_test_2.o
2465 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2469 @echo "Symbol table" >>$@
2473 check_PROGRAMS += plugin_test_tls
2474 check_SCRIPTS += plugin_test_tls.sh
2475 check_DATA += plugin_test_tls.err
2476 MOSTLYCLEANFILES += plugin_test_tls.err
2477 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
2478 $(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
2479 plugin_test_tls.err: plugin_test_tls
2480 @touch plugin_test_tls.err
2482 two_file_test_2_tls.o.syms: two_file_test_2_tls.o
2483 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2487 MOSTLYCLEANFILES += unused.c
2488 unused.o.syms: unused.o
2489 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2490 @echo " 1: 00000000 4 FUNC GLOBAL DEFAULT 1 UNUSED" >>$@
2492 $(COMPILE) -c -o $@ $<
2496 check_SCRIPTS += plugin_final_layout.sh
2497 check_DATA += plugin_final_layout.stdout plugin_final_layout_readelf.stdout
2498 MOSTLYCLEANFILES += plugin_final_layout
2499 plugin_final_layout.o: plugin_final_layout.cc
2500 $(CXXCOMPILE) -O0 -c -ffunction-sections -fdata-sections -g -o $@ $<
2501 plugin_final_layout: plugin_final_layout.o plugin_section_order.so gcctestdir/ld
2502 $(CXXLINK) -Wl,--plugin,"./plugin_section_order.so" plugin_final_layout.o
2503 plugin_final_layout.stdout: plugin_final_layout
2504 $(TEST_NM) -n --synthetic plugin_final_layout > plugin_final_layout.stdout
2505 plugin_final_layout_readelf.stdout: plugin_final_layout
2506 $(TEST_READELF) -Wl plugin_final_layout > plugin_final_layout_readelf.stdout
2508 plugin_section_order.so: plugin_section_order.o gcctestdir/ld
2509 $(LINK) -shared plugin_section_order.o
2510 plugin_section_order.o: plugin_section_order.c
2511 $(COMPILE) -O0 -c -fpic -o $@ $<
2513 # Uses the plugin_final_layout.sh script above to avoid duplication
2514 check_DATA += plugin_layout_new_file.stdout plugin_layout_new_file_readelf.stdout
2515 MOSTLYCLEANFILES += plugin_layout_new_file
2516 plugin_final_layout.o.syms: plugin_final_layout.o
2517 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2518 plugin_layout_new_file: plugin_final_layout.o.syms plugin_test.so plugin_new_section_layout.so gcctestdir/ld
2519 $(CXXLINK) -Wl,--plugin,"./plugin_test.so" -Wl,--plugin,"./plugin_new_section_layout.so" plugin_final_layout.o.syms
2520 plugin_layout_new_file.stdout: plugin_layout_new_file
2521 $(TEST_NM) -n --synthetic plugin_layout_new_file > plugin_layout_new_file.stdout
2522 plugin_layout_new_file_readelf.stdout: plugin_layout_new_file
2523 $(TEST_READELF) -Wl plugin_layout_new_file > plugin_layout_new_file_readelf.stdout
2525 plugin_new_section_layout.so: plugin_new_section_layout.o gcctestdir/ld
2526 $(LINK) -shared plugin_new_section_layout.o
2527 plugin_new_section_layout.o: plugin_new_section_layout.c
2528 $(COMPILE) -O0 -c -fpic -o $@ $<
2530 check_SCRIPTS += plugin_layout_with_alignment.sh
2531 check_DATA += plugin_layout_with_alignment.stdout
2532 MOSTLYCLEANFILES += plugin_layout_with_alignment
2533 plugin_layout_with_alignment.o: plugin_layout_with_alignment.c
2534 $(COMPILE) -O0 -c -ffunction-sections -fdata-sections -g -o $@ $<
2535 plugin_layout_with_alignment: plugin_layout_with_alignment.o plugin_section_alignment.so gcctestdir/ld
2536 $(LINK) -Wl,--plugin,"./plugin_section_alignment.so" plugin_layout_with_alignment.o
2537 plugin_layout_with_alignment.stdout: plugin_layout_with_alignment
2538 $(TEST_NM) -n --synthetic plugin_layout_with_alignment > plugin_layout_with_alignment.stdout
2540 plugin_section_alignment.so: plugin_section_alignment.o gcctestdir/ld
2541 $(CXXLINK) -shared plugin_section_alignment.o
2542 plugin_section_alignment.o: plugin_section_alignment.cc
2543 $(CXXCOMPILE) -O0 -c -fpic -o $@ $<
2545 check_SCRIPTS += plugin_pr22868.sh
2546 check_DATA += plugin_pr22868.stdout
2547 MOSTLYCLEANFILES += plugin_pr22868.stdout
2548 plugin_pr22868.stdout: plugin_pr22868.so
2549 $(TEST_READELF) -W --dyn-syms $< >$@ 2>/dev/null
2550 plugin_pr22868.so: plugin_pr22868_a.o.syms plugin_pr22868_b.o.syms plugin_pr22868_b.o plugin_test.so gcctestdir/ld
2551 $(LINK) -shared -Wl,--plugin,"./plugin_test.so" plugin_pr22868_a.o.syms plugin_pr22868_b.o.syms
2552 plugin_pr22868_a.o.syms: plugin_pr22868_a.o
2553 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2554 # Generate the .syms file from an alternate version of the original source
2555 # file, with a "protected" visibility attribute. We'll link with a
2556 # "replacement" object that does not have that attribute.
2557 plugin_pr22868_b.o.syms: plugin_pr22868_b_ir.o
2558 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2559 plugin_pr22868_a.o: plugin_pr22868_a.c
2560 $(COMPILE) -c -fpic -o $@ $<
2561 plugin_pr22868_b_ir.o: plugin_pr22868_b.c
2562 $(COMPILE) -c -DIR -fpic -o $@ $<
2563 plugin_pr22868_b.o: plugin_pr22868_b.c
2564 $(COMPILE) -c -fpic -o $@ $<
2566 check_SCRIPTS += ver_test_pr16504.sh
2567 check_DATA += ver_test_pr16504.stdout
2568 ver_test_pr16504.stdout: ver_test_pr16504.so
2569 $(TEST_READELF) -W --dyn-syms $< >$@ 2>/dev/null
2570 ver_test_pr16504.so: ver_test_pr16504_a.so ver_test_pr16504_b.o.syms ver_test_pr16504_b.script gcctestdir/ld
2571 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
2572 ver_test_pr16504_a.so: ver_test_pr16504_a.o ver_test_pr16504_a.script gcctestdir/ld
2573 gcctestdir/ld -shared -o $@ --version-script $(srcdir)/ver_test_pr16504_a.script ver_test_pr16504_a.o
2574 ver_test_pr16504_a.o: ver_test_pr16504_a.c
2575 $(COMPILE) -c -fpic -o $@ $<
2576 # Filter out the UNDEFs from the symbols file to simulate GCC behavior,
2577 # which does not pass the UNDEF from a .symver directive.
2578 ver_test_pr16504_b.o.syms: ver_test_pr16504_b.o
2579 $(TEST_READELF) -sW $< 2>/dev/null | grep -v "UND" >$@
2580 ver_test_pr16504_b.o: ver_test_pr16504_b.c
2581 $(COMPILE) -c -fpic -o $@ $<
2585 check_PROGRAMS += exclude_libs_test
2586 check_SCRIPTS += exclude_libs_test.sh
2587 check_DATA += exclude_libs_test.syms
2588 MOSTLYCLEANFILES += exclude_libs_test.syms libexclude_libs_test_1.a \
2589 libexclude_libs_test_2.a alt/libexclude_libs_test_3.a
2590 exclude_libs_test_SOURCES = exclude_libs_test.c
2591 exclude_libs_test_DEPENDENCIES = gcctestdir/ld libexclude_libs_test_1.a \
2592 libexclude_libs_test_2.a alt/libexclude_libs_test_3.a
2593 exclude_libs_test_LDFLAGS = -L. -Lalt \
2594 -Wl,--exclude-libs,dummy:libexclude_libs_test_1 \
2595 -Wl,--exclude-libs,libexclude_libs_test_3
2596 exclude_libs_test_LDADD = -lexclude_libs_test_1 -lexclude_libs_test_2 \
2597 alt/libexclude_libs_test_3.a
2598 exclude_libs_test.syms: exclude_libs_test
2599 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2600 libexclude_libs_test_1.a: exclude_libs_test_1.o
2602 libexclude_libs_test_2.a: exclude_libs_test_2.o
2604 alt/libexclude_libs_test_3.a: exclude_libs_test_3.o
2605 test -d alt || mkdir -p alt
2608 check_PROGRAMS += local_labels_test
2609 local_labels_test.o: ver_test_6.c
2610 $(COMPILE) -g -c -Wa,-L -o $@ $<
2611 local_labels_test: local_labels_test.o gcctestdir/ld
2612 $(LINK) local_labels_test.o
2614 check_PROGRAMS += discard_locals_test
2615 check_SCRIPTS += discard_locals_test.sh
2616 check_DATA += discard_locals_test.syms \
2617 discard_locals_relocatable_test1.syms \
2618 discard_locals_relocatable_test2.syms
2619 MOSTLYCLEANFILES += discard_locals_test.syms \
2620 discard_locals_relocatable_test1.syms \
2621 discard_locals_relocatable_test2.syms \
2622 discard_locals_relocatable_test1.out \
2623 discard_locals_relocatable_test2.out
2624 discard_locals_test_SOURCES = discard_locals_test.c
2625 discard_locals_test_LDFLAGS = -Wl,--discard-locals
2626 discard_locals_test.syms: discard_locals_test
2627 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2628 # '-Wa,-L' is required to preserve the local label used for testing.
2629 discard_locals_test.o: discard_locals_test.c
2630 $(COMPILE) -c -Wa,-L -o $@ $<
2632 discard_locals_relocatable_test1.syms: discard_locals_relocatable_test1.out
2633 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2634 discard_locals_relocatable_test.o: discard_locals_relocatable_test.c
2635 $(COMPILE) -c -Wa,-L -fPIC -o $@ $<
2636 discard_locals_relocatable_test1.out: discard_locals_relocatable_test.o ../ld-new
2637 ../ld-new --discard-locals -relocatable -o $@ $<
2639 discard_locals_relocatable_test2.syms: discard_locals_relocatable_test2.out
2640 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2641 discard_locals_relocatable_test2.out: discard_locals_relocatable_test.o ../ld-new
2642 ../ld-new --discard-all -relocatable -o $@ $<
2645 check_PROGRAMS += large
2646 large_SOURCES = large.c
2647 large_CFLAGS = -mcmodel=medium
2648 large_DEPENDENCIES = gcctestdir/ld
2650 endif MCMODEL_MEDIUM
2652 # Test that hidden and internal symbols in the main program cannot be
2653 # referenced by a shared library.
2654 check_SCRIPTS += hidden_test.sh
2655 check_DATA += hidden_test.err
2656 MOSTLYCLEANFILES += hidden_test hidden_test.err hidden_test.syms
2657 libhidden.so: hidden_test_1.c gcctestdir/ld
2658 $(COMPILE) -g -shared -fPIC -w -o $@ $(srcdir)/hidden_test_1.c
2659 hidden_test: hidden_test_main.o libhidden.so gcctestdir/ld
2660 $(LINK) -Wl,-R,. hidden_test_main.o libhidden.so 2>hidden_test.err
2661 hidden_test.syms: hidden_test
2662 $(TEST_NM) -D hidden_test > $@
2663 hidden_test.err: hidden_test
2664 @touch hidden_test.err
2666 # Test -retain-symbols-file.
2667 check_SCRIPTS += retain_symbols_file_test.sh
2668 check_DATA += retain_symbols_file_test.stdout
2669 MOSTLYCLEANFILES += retain_symbols_file_test retain_symbols_file_test.in \
2670 retain_symbols_file_test.stdout
2671 retain_symbols_file_test.so: basic_pic_test.o gcctestdir/ld
2672 echo 'main' > retain_symbols_file_test.in
2673 echo 't1' >> retain_symbols_file_test.in
2674 echo '_ZNK4t20a3getEv' >> retain_symbols_file_test.in
2675 echo '_Z3t18v' >> retain_symbols_file_test.in
2676 echo '__tcf_0' >> retain_symbols_file_test.in
2677 $(CXXLINK) -shared -Wl,-retain-symbols-file,retain_symbols_file_test.in basic_pic_test.o
2678 retain_symbols_file_test.stdout: retain_symbols_file_test.so
2679 $(TEST_NM) -C retain_symbols_file_test.so > $@
2682 # Test that if the output file already exists and is empty,
2683 # it will get execute permission.
2684 check_PROGRAMS += permission_test
2685 permission_test: basic_test.o gcctestdir/ld
2690 $(CXXLINK) basic_test.o
2693 check_PROGRAMS += searched_file_test
2694 MOSTLYCLEANFILES += searched_file_test searched_file_test_lib.o \
2695 alt/searched_file_test_lib.a
2696 searched_file_test_SOURCES = searched_file_test.cc
2697 searched_file_test_DEPENDENCIES = gcctestdir/ld alt/searched_file_test_lib.a
2698 searched_file_test_LDFLAGS = -Lalt
2699 searched_file_test_LDADD = -l:searched_file_test_lib.a
2700 searched_file_test_lib.o: searched_file_test_lib.cc
2701 $(CXXCOMPILE) -c -o $@ $<
2702 alt/searched_file_test_lib.a: searched_file_test_lib.o
2703 test -d alt || mkdir -p alt
2706 # Test that no .gnu.version sections are created when
2707 # symbol versioning is not used.
2708 check_SCRIPTS += no_version_test.sh
2709 check_DATA += no_version_test.stdout
2710 MOSTLYCLEANFILES += libno_version_test.so no_version_test.stdout
2711 # We invoke the linker directly since gcc may include additional objects that
2712 # uses symbol versioning.
2713 libno_version_test.so: no_version_test.o gcctestdir/ld
2714 gcctestdir/ld -shared -o $@ no_version_test.o
2715 no_version_test.o: no_version_test.c
2716 $(COMPILE) -o $@ -c -fPIC $<
2717 no_version_test.stdout: libno_version_test.so
2718 $(TEST_OBJDUMP) -h $< > $@
2720 # Test STT_GNU_IFUNC symbols.
2723 ifuncmod1.o: ifuncmod1.c
2724 $(COMPILE) -c -fPIC -o $@ $<
2725 ifuncmod1.so: ifuncmod1.o gcctestdir/ld
2726 $(LINK) -shared ifuncmod1.o
2728 ifuncdep1.o: ifuncmod1.c
2729 $(COMPILE) -c -o $@ $<
2731 ifuncmain1pic.o: ifuncmain1.c
2732 $(COMPILE) -c -fPIC -o $@ $<
2733 ifuncmain1pie.o: ifuncmain1.c
2734 $(COMPILE) -c -fPIE -o $@ $<
2738 check_PROGRAMS += ifuncmain1static
2739 ifuncmain1static_SOURCES = ifuncmain1.c
2740 ifuncmain1static_DEPENDENCIES = gcctestdir/ld ifuncdep1.o
2741 ifuncmain1static_LDFLAGS = -static
2742 ifuncmain1static_LDADD = ifuncdep1.o
2744 check_PROGRAMS += ifuncmain1picstatic
2745 ifuncmain1picstatic: ifuncmain1pic.o ifuncmod1.o gcctestdir/ld
2746 $(LINK) -static ifuncmain1pic.o ifuncmod1.o
2748 check_SCRIPTS += ifuncmod1.sh
2749 check_DATA += ifuncmod1.so.stderr
2750 ifuncmod1.so.stderr: ifuncmod1.so
2751 $(TEST_READELF) -s $< > /dev/null 2> $@
2755 check_PROGRAMS += ifuncmain1
2756 ifuncmain1_SOURCES = ifuncmain1.c
2757 ifuncmain1_DEPENDENCIES = gcctestdir/ld ifuncmod1.so
2758 ifuncmain1_LDFLAGS = -Wl,-R,.
2759 ifuncmain1_LDADD = ifuncmod1.so
2761 check_PROGRAMS += ifuncmain1pic
2762 ifuncmain1pic: ifuncmain1pic.o ifuncmod1.so gcctestdir/ld
2763 $(LINK) ifuncmain1pic.o ifuncmod1.so -Wl,-R,.
2765 check_PROGRAMS += ifuncmain1vis
2766 ifuncmain1vis_SOURCES = ifuncmain1vis.c
2767 ifuncmain1vis_DEPENDENCIES = gcctestdir/ld ifuncmod1.so
2768 ifuncmain1vis_LDFLAGS = -Wl,-R,.
2769 ifuncmain1vis_LDADD = ifuncmod1.so
2771 check_PROGRAMS += ifuncmain1vispic
2772 ifuncmain1vispic.o: ifuncmain1vis.c
2773 $(COMPILE) -c -fPIC -o $@ $<
2774 ifuncmain1vispic: ifuncmain1vispic.o ifuncmod1.so gcctestdir/ld
2775 $(LINK) ifuncmain1pic.o ifuncmod1.so -Wl,-R,.
2777 check_PROGRAMS += ifuncmain1staticpic
2778 ifuncmain1staticpic: ifuncmain1pic.o ifuncmod1.o gcctestdir/ld
2779 $(LINK) ifuncmain1pic.o ifuncmod1.o
2781 check_PROGRAMS += ifuncmain1pie
2782 ifuncmain1pie: ifuncmain1pie.o ifuncmod1.so gcctestdir/ld
2783 $(LINK) -pie ifuncmain1pie.o ifuncmod1.so -Wl,-R,.
2785 check_PROGRAMS += ifuncmain1vispie
2786 ifuncmain1vispie.o: ifuncmain1vis.c
2787 $(COMPILE) -c -fPIE -o $@ $<
2788 ifuncmain1vispie: ifuncmain1vispie.o ifuncmod1.so gcctestdir/ld
2789 $(LINK) -pie ifuncmain1vispie.o ifuncmod1.so -Wl,-R,.
2791 check_PROGRAMS += ifuncmain1staticpie
2792 ifuncmain1staticpie: ifuncmain1pie.o ifuncmod1.o gcctestdir/ld
2793 $(LINK) -pie ifuncmain1pie.o ifuncmod1.o
2795 ifuncmain2pic.o: ifuncmain2.c
2796 $(COMPILE) -c -fPIC -o $@ $<
2798 ifuncdep2pic.o: ifuncdep2.c
2799 $(COMPILE) -c -fPIC -o $@ $<
2803 check_PROGRAMS += ifuncmain2static
2804 ifuncmain2static_SOURCES = ifuncmain2.c ifuncdep2.c
2805 ifuncmain2static_DEPENDENCIES = gcctestdir/ld
2806 ifuncmain2static_LDFLAGS = -static
2807 ifuncmain2static_LDADD =
2809 check_PROGRAMS += ifuncmain2picstatic
2810 ifuncmain2picstatic: ifuncmain2pic.o ifuncdep2pic.o gcctestdir/ld
2811 $(LINK) -static ifuncmain2pic.o ifuncdep2pic.o
2815 check_PROGRAMS += ifuncmain2
2816 ifuncmain2_SOURCES = ifuncmain2.c ifuncdep2.c
2817 ifuncmain2_DEPENDENCIES = gcctestdir/ld
2820 check_PROGRAMS += ifuncmain2pic
2821 ifuncmain2pic: ifuncmain2pic.o ifuncdep2pic.o gcctestdir/ld
2822 $(LINK) ifuncmain2pic.o ifuncdep2pic.o
2824 ifuncmod3.o: ifuncmod3.c
2825 $(COMPILE) -c -fPIC -o $@ $<
2826 ifuncmod3.so: ifuncmod3.o gcctestdir/ld
2827 $(LINK) -shared ifuncmod3.o
2829 check_PROGRAMS += ifuncmain3
2830 ifuncmain3_SOURCES = ifuncmain3.c
2831 ifuncmain3_DEPENDENCIES = gcctestdir/ld ifuncmod3.so
2832 ifuncmain3_LDFLAGS = -Wl,--export-dynamic -Wl,-R,.
2833 ifuncmain3_LDADD = -ldl
2835 ifuncmain4pic.o: ifuncmain4.c
2836 $(COMPILE) -c -fPIC -o $@ $<
2840 check_PROGRAMS += ifuncmain4static
2841 ifuncmain4static_SOURCES = ifuncmain4.c
2842 ifuncmain4static_DEPENDENCIES = gcctestdir/ld
2843 ifuncmain4static_LDFLAGS = -static
2844 ifuncmain4static_LDADD =
2846 check_PROGRAMS += ifuncmain4picstatic
2847 ifuncmain4picstatic: ifuncmain4pic.o gcctestdir/ld
2848 $(LINK) -static ifuncmain4pic.o
2852 check_PROGRAMS += ifuncmain4
2853 ifuncmain4_SOURCES = ifuncmain4.c
2854 ifuncmain4_DEPENDENCIES = gcctestdir/ld
2857 ifuncmain5pic.o: ifuncmain5.c
2858 $(COMPILE) -c -fPIC -o $@ $<
2860 ifuncmain5pie.o: ifuncmain5.c
2861 $(COMPILE) -c -fPIE -o $@ $<
2863 ifuncmod5.o: ifuncmod5.c
2864 $(COMPILE) -c -fPIC -o $@ $<
2865 ifuncmod5.so: ifuncmod5.o gcctestdir/ld
2866 $(LINK) -shared ifuncmod5.o
2868 ifuncdep5.o: ifuncmod5.c
2869 $(COMPILE) -c -o $@ $<
2873 check_PROGRAMS += ifuncmain5static
2874 ifuncmain5static_SOURCES = ifuncmain5.c
2875 ifuncmain5static_DEPENDENCIES = gcctestdir/ld ifuncdep5.o
2876 ifuncmain5static_LDFLAGS = -static
2877 ifuncmain5static_LDADD = ifuncdep5.o
2879 check_PROGRAMS += ifuncmain5picstatic
2880 ifuncmain5picstatic: ifuncmain5pic.o ifuncmod5.o gcctestdir/ld
2881 $(LINK) -static ifuncmain5pic.o ifuncmod5.o
2885 check_PROGRAMS += ifuncmain5
2886 ifuncmain5_SOURCES = ifuncmain5.c
2887 ifuncmain5_DEPENDENCIES = gcctestdir/ld ifuncmod5.so
2888 ifuncmain5_LDFLAGS = -Wl,-R,.
2889 ifuncmain5_LDADD = ifuncmod5.so
2891 check_PROGRAMS += ifuncmain5pic
2892 ifuncmain5pic: ifuncmain5pic.o ifuncmod5.so gcctestdir/ld
2893 $(LINK) ifuncmain5pic.o ifuncmod5.so -Wl,-R,.
2895 check_PROGRAMS += ifuncmain5staticpic
2896 ifuncmain5staticpic: ifuncmain5pic.o ifuncmod5.o gcctestdir/ld
2897 $(LINK) ifuncmain5pic.o ifuncmod5.o
2899 check_PROGRAMS += ifuncmain5pie
2900 ifuncmain5pie: ifuncmain5pie.o ifuncmod5.so gcctestdir/ld
2901 $(LINK) -pie ifuncmain5pie.o ifuncmod5.so -Wl,-R,.
2903 ifuncmain6pie.o: ifuncmain6pie.c
2904 $(COMPILE) -c -fPIE -o $@ $<
2906 ifuncmod6.o: ifuncmod6.c
2907 $(COMPILE) -c -fPIC -o $@ $<
2908 ifuncmod6.so: ifuncmod6.o gcctestdir/ld
2909 $(LINK) -shared ifuncmod6.o
2911 check_PROGRAMS += ifuncmain6pie
2912 ifuncmain6pie: ifuncmain6pie.o ifuncmod6.so gcctestdir/ld
2913 $(LINK) -pie ifuncmain6pie.o ifuncmod6.so -Wl,-R,.
2915 ifuncmain7pic.o: ifuncmain7.c
2916 $(COMPILE) -c -fPIC -o $@ $<
2918 ifuncmain7pie.o: ifuncmain7.c
2919 $(COMPILE) -c -fPIE -o $@ $<
2923 check_PROGRAMS += ifuncmain7static
2924 ifuncmain7static_SOURCES = ifuncmain7.c
2925 ifuncmain7static_DEPENDENCIES = gcctestdir/ld
2926 ifuncmain7static_LDFLAGS = -static
2927 ifuncmain7static_LDADD =
2929 check_PROGRAMS += ifuncmain7picstatic
2930 ifuncmain7picstatic: ifuncmain7pic.o gcctestdir/ld
2931 $(LINK) -static ifuncmain7pic.o
2935 check_PROGRAMS += ifuncmain7
2936 ifuncmain7_SOURCES = ifuncmain7.c
2937 ifuncmain7_DEPENDENCIES = gcctestdir/ld
2940 check_PROGRAMS += ifuncmain7pic
2941 ifuncmain7pic: ifuncmain7pic.o gcctestdir/ld
2942 $(LINK) ifuncmain7pic.o
2944 check_PROGRAMS += ifuncmain7pie
2945 ifuncmain7pie: ifuncmain7pie.o gcctestdir/ld
2946 $(LINK) -pie ifuncmain7pie.o
2948 check_PROGRAMS += ifuncvar
2949 ifuncvar1_pic.o: ifuncvar1.c
2950 $(COMPILE) -c -fPIC -o $@ $<
2951 ifuncvar2_pic.o: ifuncvar2.c
2952 $(COMPILE) -c -fPIC -o $@ $<
2953 ifuncvar.so: ifuncvar1_pic.o ifuncvar2_pic.o gcctestdir/ld
2954 $(LINK) -shared ifuncvar1_pic.o ifuncvar2_pic.o
2955 ifuncvar_SOURCES = ifuncvar3.c
2956 ifuncvar_DEPENDENCIES = gcctestdir/ld ifuncvar.so
2957 ifuncvar_LDFLAGS = -Wl,-R,.
2958 ifuncvar_LDADD = ifuncvar.so
2962 # Test that strong reference to a weak symbol in a DSO remains strong.
2963 check_SCRIPTS += strong_ref_weak_def.sh
2964 check_DATA += strong_ref_weak_def.stdout
2965 MOSTLYCLEANFILES += strong_ref_weak_def_1.so strong_ref_weak_def_2.so \
2966 strong_ref_weak_def.stdout
2967 strong_ref_weak_def_2.o: strong_ref_weak_def_2.c
2968 $(COMPILE) -o $@ -c -fPIC $<
2969 strong_ref_weak_def_2.so: strong_ref_weak_def_2.o gcctestdir/ld
2970 gcctestdir/ld -shared -o $@ strong_ref_weak_def_2.o
2971 strong_ref_weak_def_1.o: strong_ref_weak_def_1.c
2972 $(COMPILE) -o $@ -c -fPIC $<
2973 strong_ref_weak_def_1.so: strong_ref_weak_def_1.o strong_ref_weak_def_2.so \
2975 gcctestdir/ld -shared -o $@ strong_ref_weak_def_1.o \
2976 strong_ref_weak_def_2.so
2977 strong_ref_weak_def.stdout: strong_ref_weak_def_1.so
2978 $(TEST_READELF) -sWD $< > $@
2980 # Test that a strong weak reference remains strong if there is another
2981 # weak reference in a DSO.
2982 check_SCRIPTS += dyn_weak_ref.sh
2983 check_DATA += dyn_weak_ref.stdout
2984 MOSTLYCLEANFILES += dyn_weak_ref_1.so dyn_weak_ref_2.so \
2986 dyn_weak_ref_2.o: dyn_weak_ref_2.c
2987 $(COMPILE) -o $@ -c -fPIC $<
2988 dyn_weak_ref_2.so: dyn_weak_ref_2.o gcctestdir/ld
2989 gcctestdir/ld -shared -o $@ dyn_weak_ref_2.o
2990 dyn_weak_ref_1.o: dyn_weak_ref_1.c
2991 $(COMPILE) -o $@ -c -fPIC $<
2992 # We intentionally put dyn_weak_ref_2.so in front of dyn_weak_ref_1.o
2993 # so that the weak ref there goes to gold's symbol table first.
2994 dyn_weak_ref_1.so: dyn_weak_ref_1.o dyn_weak_ref_2.so gcctestdir/ld
2995 gcctestdir/ld -shared -o $@ dyn_weak_ref_2.so dyn_weak_ref_1.o
2996 dyn_weak_ref.stdout: dyn_weak_ref_1.so
2997 $(TEST_READELF) -sWD $< > $@
3000 # Test that --start-lib and --end-lib function correctly.
3001 check_PROGRAMS += start_lib_test
3002 MOSTLYCLEANFILES += libstart_lib_test.a
3003 start_lib_test: start_lib_test_main.o libstart_lib_test.a start_lib_test_2.o start_lib_test_3.o \
3005 $(LINK) -o $@ start_lib_test_main.o -L. -lstart_lib_test \
3006 -Wl,--start-lib start_lib_test_2.o start_lib_test_3.o -Wl,--end-lib
3007 libstart_lib_test.a: start_lib_test_1.o
3010 # Test that MEMORY region support works.
3011 check_SCRIPTS += memory_test.sh
3012 check_DATA += memory_test.stdout
3013 MOSTLYCLEANFILES += memory_test.stdout memory_test memory_test.o
3014 memory_test.o: memory_test.s
3015 $(COMPILE) -o $@ -c $<
3016 memory_test: memory_test.o gcctestdir/ld $(srcdir)/memory_test.t
3017 $(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
3018 memory_test.stdout: memory_test
3019 $(TEST_READELF) -lWS $< > $@
3021 # Test INCLUDE directives in linker scripts.
3022 # The binary isn't runnable, so we just check that we can build it without errors.
3023 check_DATA += memory_test_2
3024 MOSTLYCLEANFILES += memory_test_inc_1.t memory_test_inc_2.t memory_test_inc_3.t memory_test_2
3025 memory_test_inc_1.t: $(srcdir)/memory_test_inc_1.t.src
3027 memory_test_inc_2.t: $(srcdir)/memory_test_inc_2.t.src
3029 memory_test_inc_3.t: $(srcdir)/memory_test_inc_3.t.src
3031 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
3032 $(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
3036 # Test that --gdb-index functions correctly without gcc-generated pubnames.
3037 check_SCRIPTS += gdb_index_test_1.sh
3038 check_DATA += gdb_index_test_1.stdout
3039 MOSTLYCLEANFILES += gdb_index_test_1.stdout gdb_index_test_1
3040 gdb_index_test.o: gdb_index_test.cc
3041 $(CXXCOMPILE) -O0 -g -gno-pubnames -c -o $@ $<
3042 gdb_index_test_1: gdb_index_test.o gcctestdir/ld
3043 $(CXXLINK) -Wl,--gdb-index $<
3044 gdb_index_test_1.stdout: gdb_index_test_1
3045 $(TEST_READELF) --debug-dump=gdb_index $< > $@
3047 # Test that --gdb-index functions correctly with compressed debug sections.
3048 check_SCRIPTS += gdb_index_test_2.sh
3049 check_DATA += gdb_index_test_2.stdout
3050 MOSTLYCLEANFILES += gdb_index_test_2.stdout gdb_index_test_2 gdb_index_test_2_gabi
3051 gdb_index_test_cdebug.o: gdb_index_test.cc
3052 $(CXXCOMPILE) -O0 -g -Wa,--compress-debug-sections -c -o $@ $<
3053 gdb_index_test_2: gdb_index_test_cdebug.o gcctestdir/ld
3054 $(CXXLINK) -Wl,--gdb-index $<
3055 gdb_index_test_2.stdout: gdb_index_test_2
3056 $(TEST_READELF) --debug-dump=gdb_index $< > $@
3057 check_SCRIPTS += gdb_index_test_2_gabi.sh
3058 check_DATA += gdb_index_test_2_gabi.stdout
3059 MOSTLYCLEANFILES += gdb_index_test_2.stdout gdb_index_test_2
3060 gdb_index_test_cdebug_gabi.o: gdb_index_test.cc
3061 $(CXXCOMPILE) -O0 -g -Wa,--compress-debug-sections=zlib-gabi -c -o $@ $<
3062 gdb_index_test_2_gabi: gdb_index_test_cdebug_gabi.o gcctestdir/ld
3063 $(CXXLINK) -Wl,--gdb-index $<
3064 gdb_index_test_2_gabi.stdout: gdb_index_test_2_gabi
3065 $(TEST_READELF) --debug-dump=gdb_index $< > $@
3067 # Another simple C test (DW_AT_high_pc encoding) for --gdb-index.
3068 check_SCRIPTS += gdb_index_test_3.sh
3069 check_DATA += gdb_index_test_3.stdout
3070 MOSTLYCLEANFILES += gdb_index_test_3.stdout gdb_index_test_3
3071 gdb_index_test_3.o: gdb_index_test_3.c
3072 $(COMPILE) -O0 -g -c -o $@ $<
3073 gdb_index_test_3: gdb_index_test_3.o gcctestdir/ld
3074 $(LINK) -Wl,--gdb-index,--fatal-warnings $<
3075 gdb_index_test_3.stdout: gdb_index_test_3
3076 $(TEST_READELF) --debug-dump=gdb_index $< > $@
3078 # Test that --gdb-index functions correctly with gcc-generated pubnames.
3079 check_SCRIPTS += gdb_index_test_4.sh
3080 check_DATA += gdb_index_test_4.stdout
3081 MOSTLYCLEANFILES += gdb_index_test_4.stdout gdb_index_test_4
3082 gdb_index_test_pub.o: gdb_index_test.cc
3083 $(CXXCOMPILE) -O0 -g -gpubnames -c -o $@ $<
3084 gdb_index_test_4: gdb_index_test_pub.o gcctestdir/ld
3085 $(CXXLINK) -Wl,--gdb-index $<
3086 gdb_index_test_4.stdout: gdb_index_test_4
3087 $(TEST_READELF) --debug-dump=gdb_index $< > $@
3091 # Test that __ehdr_start is defined correctly.
3092 check_PROGRAMS += ehdr_start_test_1
3093 ehdr_start_test_1_SOURCES = ehdr_start_test.cc
3094 ehdr_start_test_1_DEPENDENCIES = gcctestdir/ld
3095 ehdr_start_test_1_CXXFLAGS =
3096 ehdr_start_test_1_LDADD =
3098 # Test that __ehdr_start is defined correctly with a weak reference.
3099 check_PROGRAMS += ehdr_start_test_2
3100 ehdr_start_test_2_SOURCES = ehdr_start_test.cc
3101 ehdr_start_test_2_DEPENDENCIES = gcctestdir/ld
3102 ehdr_start_test_2_CXXFLAGS = -DEHDR_START_WEAK
3103 ehdr_start_test_2_LDADD =
3105 # Test that __ehdr_start is defined correctly when used with a linker script.
3106 check_PROGRAMS += ehdr_start_test_3
3107 ehdr_start_test_3_SOURCES = ehdr_start_test.cc
3108 ehdr_start_test_3_DEPENDENCIES = gcctestdir/ld $(srcdir)/ehdr_start_test.t
3109 ehdr_start_test_3_CXXFLAGS = -DEHDR_START_WEAK
3110 ehdr_start_test_3_LDFLAGS = -Wl,-T,$(srcdir)/ehdr_start_test.t
3111 ehdr_start_test_3_LDADD =
3113 # Test that __ehdr_start is left undefined when the text segment is not
3114 # appropriately aligned.
3115 check_SCRIPTS += ehdr_start_test_4.sh
3116 check_DATA += ehdr_start_test_4.syms
3117 MOSTLYCLEANFILES += ehdr_start_test_4
3118 ehdr_start_test_4.syms: ehdr_start_test_4
3119 $(TEST_NM) ehdr_start_test_4 > $@
3120 ehdr_start_test_4: ehdr_start_test_4.o gcctestdir/ld
3121 $(CXXLINK) -Wl,-Ttext=0x100100 $<
3122 ehdr_start_test_4.o: ehdr_start_test.cc
3123 $(CXXCOMPILE) -c -DEHDR_START_WEAK -o $@ $<
3125 # Test that __ehdr_start is not overridden when supplied by the user.
3126 check_PROGRAMS += ehdr_start_test_5
3127 ehdr_start_test_5_SOURCES = ehdr_start_test.cc ehdr_start_def.cc
3128 ehdr_start_test_5_DEPENDENCIES = gcctestdir/ld
3129 ehdr_start_test_5_CXXFLAGS = -DEHDR_START_USER_DEF
3130 ehdr_start_test_5_LDADD =
3132 # Test that the --defsym option copies the symbol type and visibility.
3133 check_SCRIPTS += defsym_test.sh
3134 check_DATA += defsym_test.syms
3135 MOSTLYCLEANFILES += defsym_test defsym_test.syms
3136 defsym_test.syms: defsym_test
3137 $(TEST_READELF) -sW $< > $@
3138 defsym_test: defsym_test.o gcctestdir/ld
3139 $(LINK) -Wl,--defsym=bar=foo defsym_test.o
3140 defsym_test.o: defsym_test.c
3141 $(COMPILE) -c -o $@ $<
3143 # Test that the -d option (force common allocation) works correctly.
3144 check_PROGRAMS += pr20976
3145 pr20976: pr20976-d.o gcctestdir/ld
3147 pr20976-d.o: pr20976.o gcctestdir/ld
3148 gcctestdir/ld -r -d -o $@ pr20976.o
3150 # End-to-end incremental linking tests.
3151 # Incremental linking is currently supported only on the x86_64 target.
3153 if DEFAULT_TARGET_X86_64
3155 two_file_test_1_v1_ndebug.o: two_file_test_1_v1.cc
3156 $(CXXCOMPILE) -O0 -g0 -fno-exceptions -fno-asynchronous-unwind-tables -c -o $@ $<
3157 two_file_test_1_ndebug.o: two_file_test_1.cc
3158 $(CXXCOMPILE) -O0 -g0 -fno-exceptions -fno-asynchronous-unwind-tables -c -o $@ $<
3159 two_file_test_1b_ndebug.o: two_file_test_1b.cc
3160 $(CXXCOMPILE) -O0 -g0 -c -o $@ $<
3161 two_file_test_2_ndebug.o: two_file_test_2.cc
3162 $(CXXCOMPILE) -O0 -g0 -c -o $@ $<
3163 two_file_test_main_ndebug.o: two_file_test_main.cc
3164 $(CXXCOMPILE) -O0 -g0 -c -o $@ $<
3166 check_PROGRAMS += incremental_test_2
3167 MOSTLYCLEANFILES += two_file_test_tmp_2.o
3168 incremental_test_2: two_file_test_1_v1_ndebug.o two_file_test_1_ndebug.o two_file_test_1b_ndebug.o \
3169 two_file_test_2_ndebug.o two_file_test_main_ndebug.o gcctestdir/ld
3170 cp -f two_file_test_1_v1_ndebug.o two_file_test_tmp_2.o
3171 $(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
3173 cp -f two_file_test_1_ndebug.o two_file_test_tmp_2.o
3174 $(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
3176 check_PROGRAMS += incremental_test_3
3177 MOSTLYCLEANFILES += two_file_test_tmp_3.o
3178 incremental_test_3: two_file_test_1.o two_file_test_1b_v1.o two_file_test_1b.o \
3179 two_file_test_2.o two_file_test_main.o gcctestdir/ld
3180 cp -f two_file_test_1b_v1.o two_file_test_tmp_3.o
3181 $(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
3183 cp -f two_file_test_1b.o two_file_test_tmp_3.o
3184 $(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
3186 check_PROGRAMS += incremental_test_4
3187 MOSTLYCLEANFILES += incremental_test_4.base two_file_test_tmp_4.o
3188 incremental_test_4: two_file_test_1.o two_file_test_1b.o two_file_test_2_v1.o \
3189 two_file_test_2.o two_file_test_main.o gcctestdir/ld
3190 cp -f two_file_test_2_v1.o two_file_test_tmp_4.o
3191 $(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
3192 mv -f incremental_test_4 incremental_test_4.base
3194 cp -f two_file_test_2.o two_file_test_tmp_4.o
3195 $(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
3197 check_PROGRAMS += incremental_test_5
3198 MOSTLYCLEANFILES += two_file_test_5.a
3199 incremental_test_5: two_file_test_1.o two_file_test_1b_v1.o two_file_test_1b.o \
3200 two_file_test_2.o two_file_test_main.o gcctestdir/ld
3201 cp -f two_file_test_1b_v1.o two_file_test_tmp_5.o
3202 $(TEST_AR) rc two_file_test_5.a two_file_test_1.o two_file_test_tmp_5.o two_file_test_2.o
3203 $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Wl,-z,norelro,-no-pie two_file_test_main.o two_file_test_5.a
3205 cp -f two_file_test_1b.o two_file_test_tmp_5.o
3206 $(TEST_AR) rc two_file_test_5.a two_file_test_1.o two_file_test_tmp_5.o two_file_test_2.o
3207 $(CXXLINK) -Wl,--incremental-update -Wl,-z,norelro,-no-pie two_file_test_main.o two_file_test_5.a
3209 # Test the --incremental-unchanged flag with an archive library.
3210 # The second link should not update the library.
3211 check_PROGRAMS += incremental_test_6
3212 MOSTLYCLEANFILES += two_file_test_6.a
3213 incremental_test_6: two_file_test_1.o two_file_test_1b_v1.o two_file_test_1b.o \
3214 two_file_test_2.o two_file_test_main.o gcctestdir/ld
3215 cp -f two_file_test_1b.o two_file_test_tmp_6.o
3216 $(TEST_AR) rc two_file_test_6.a two_file_test_1.o two_file_test_tmp_6.o two_file_test_2.o
3217 $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Wl,-z,norelro,-no-pie two_file_test_main.o two_file_test_6.a
3219 cp -f two_file_test_1b_v1.o two_file_test_tmp_6.o
3220 $(TEST_AR) rc two_file_test_6.a two_file_test_1.o two_file_test_tmp_6.o two_file_test_2.o
3221 $(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
3223 check_PROGRAMS += incremental_copy_test
3224 incremental_copy_test: copy_test_v1.o copy_test.o copy_test_1.so copy_test_2.so
3225 cp -f copy_test_v1.o copy_test_tmp.o
3226 $(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
3228 cp -f copy_test.o copy_test_tmp.o
3229 $(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
3231 check_PROGRAMS += incremental_common_test_1
3232 incremental_common_test_1: common_test_1_v1.o common_test_1_v2.o gcctestdir/ld
3233 cp -f common_test_1_v1.o common_test_1_tmp.o
3234 $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Wl,-z,norelro,-no-pie common_test_1_tmp.o
3236 cp -f common_test_1_v2.o common_test_1_tmp.o
3237 $(CXXLINK) -Wl,--incremental-update -Wl,-z,norelro,-no-pie common_test_1_tmp.o
3239 check_PROGRAMS += incremental_comdat_test_1
3240 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
3241 cp -f incr_comdat_test_2_v1.o incr_comdat_test_1_tmp.o
3242 $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Wl,-z,norelro,-no-pie incr_comdat_test_1.o incr_comdat_test_1_tmp.o
3244 cp -f incr_comdat_test_2_v2.o incr_comdat_test_1_tmp.o
3245 $(CXXLINK) -Wl,--incremental-update -Wl,-z,norelro,-no-pie incr_comdat_test_1.o incr_comdat_test_1_tmp.o
3247 cp -f incr_comdat_test_2_v3.o incr_comdat_test_1_tmp.o
3248 $(CXXLINK) -Wl,--incremental-update -Wl,-z,norelro,-no-pie incr_comdat_test_1.o incr_comdat_test_1_tmp.o
3250 endif DEFAULT_TARGET_X86_64
3252 if DEFAULT_TARGET_X86_64
3253 check_PROGRAMS += exception_x86_64_bnd_test
3254 exception_x86_64_bnd_test_SOURCES = exception_test_main.cc
3255 exception_x86_64_bnd_test_DEPENDENCIES = gcctestdir/ld exception_x86_64_bnd_1.o exception_x86_64_bnd_2.o
3256 exception_x86_64_bnd_test_LDFLAGS = $(exception_test_LDFLAGS) -Wl,-z,bndplt
3257 exception_x86_64_bnd_test_LDADD = exception_x86_64_bnd_1.o exception_x86_64_bnd_2.o
3258 exception_x86_64_bnd_1.o: exception_test_1.cc gcctestdir/as
3259 $(CXXCOMPILE) -c -fpic -Wa,-madd-bnd-prefix -o $@ $<
3260 exception_x86_64_bnd_2.o: exception_test_2.cc gcctestdir/as
3261 $(CXXCOMPILE) -c -Wa,-madd-bnd-prefix -o $@ $<
3262 endif DEFAULT_TARGET_X86_64
3264 if DEFAULT_TARGET_X86_64
3265 check_SCRIPTS += gnu_property_test.sh
3266 check_DATA += gnu_property_test.stdout
3267 MOSTLYCLEANFILES += gnu_property_test
3268 gnu_property_test.stdout: gnu_property_test
3269 $(TEST_READELF) -n $< >$@
3270 gnu_property_test: gcctestdir/ld gnu_property_a.o gnu_property_b.o gnu_property_c.o
3271 gcctestdir/ld -o $@ gnu_property_a.o gnu_property_b.o gnu_property_c.o
3272 gnu_property_main.o: gnu_property_main.c
3273 $(COMPILE) -c -o $@ $<
3274 gnu_property_a.o: gnu_property_a.S
3275 $(COMPILE) -c -o $@ $<
3276 gnu_property_b.o: gnu_property_b.S
3277 $(COMPILE) -c -o $@ $<
3278 gnu_property_c.o: gnu_property_c.S
3279 $(COMPILE) -c -o $@ $<
3280 endif DEFAULT_TARGET_X86_64
3282 check_PROGRAMS += pr22266
3283 pr22266: pr22266_main.o pr22266_ar.o gcctestdir/ld
3284 $(LINK) pr22266_main.o pr22266_ar.o
3285 pr22266_ar.o: pr22266_a.o gcctestdir/ld
3286 gcctestdir/ld -r -T $(srcdir)/pr22266_script.t -o $@ pr22266_a.o
3291 # These tests work with native and cross linkers.
3293 if NATIVE_OR_CROSS_LINKER
3295 # Test script section order.
3296 check_SCRIPTS += script_test_10.sh
3297 check_DATA += script_test_10.stdout
3298 MOSTLYCLEANFILES += script_test_10
3299 script_test_10.o: script_test_10.s
3301 script_test_10: $(srcdir)/script_test_10.t script_test_10.o gcctestdir/ld
3302 gcctestdir/ld -o $@ script_test_10.o -T $(srcdir)/script_test_10.t
3303 script_test_10.stdout: script_test_10
3304 $(TEST_READELF) -SW script_test_10 > $@
3306 # These tests work with cross linkers only.
3308 if DEFAULT_TARGET_I386
3310 check_SCRIPTS += split_i386.sh
3311 check_DATA += split_i386_1.stdout split_i386_2.stdout \
3312 split_i386_3.stdout split_i386_4.stdout split_i386_r.stdout
3313 SPLIT_DEFSYMS = --defsym __morestack=0x100 --defsym __morestack_non_split=0x200
3314 split_i386_1.o: split_i386_1.s
3316 split_i386_2.o: split_i386_2.s
3318 split_i386_3.o: split_i386_3.s
3320 split_i386_4.o: split_i386_4.s
3322 split_i386_n.o: split_i386_n.s
3324 split_i386_1: split_i386_1.o split_i386_n.o ../ld-new
3325 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_i386_1.o split_i386_n.o
3326 split_i386_1.stdout: split_i386_1
3327 $(TEST_OBJDUMP) -d $< > $@
3328 split_i386_2: split_i386_2.o split_i386_n.o ../ld-new
3329 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_i386_2.o split_i386_n.o
3330 split_i386_2.stdout: split_i386_2
3331 $(TEST_OBJDUMP) -d $< > $@
3332 split_i386_3.stdout: split_i386_3.o split_i386_n.o ../ld-new
3333 ../ld-new $(SPLIT_DEFSYMS) -o split_i386_3 split_i386_3.o split_i386_n.o > $@ 2>&1 || exit 0
3334 split_i386_4: split_i386_4.o split_i386_n.o ../ld-new
3335 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_i386_4.o split_i386_n.o
3336 split_i386_4.stdout: split_i386_4
3337 $(TEST_OBJDUMP) -d $< > $@
3338 split_i386_r.stdout: split_i386_1.o split_i386_n.o ../ld-new
3339 ../ld-new -r split_i386_1.o split_i386_n.o -o split_i386_r > $@ 2>&1 || exit 0
3340 MOSTLYCLEANFILES += split_i386_1 split_i386_2 split_i386_3 \
3341 split_i386_4 split_i386_r
3343 endif DEFAULT_TARGET_I386
3345 if DEFAULT_TARGET_X86_64
3347 check_SCRIPTS += split_x86_64.sh
3348 check_DATA += split_x86_64_1.stdout split_x86_64_2.stdout \
3349 split_x86_64_3.stdout split_x86_64_4.stdout split_x86_64_r.stdout
3350 SPLIT_DEFSYMS = --defsym __morestack=0x100 --defsym __morestack_non_split=0x200
3351 split_x86_64_1.o: split_x86_64_1.s
3353 split_x86_64_2.o: split_x86_64_2.s
3355 split_x86_64_3.o: split_x86_64_3.s
3357 split_x86_64_4.o: split_x86_64_4.s
3359 split_x86_64_n.o: split_x86_64_n.s
3361 split_x86_64_1: split_x86_64_1.o split_x86_64_n.o ../ld-new
3362 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x86_64_1.o split_x86_64_n.o
3363 split_x86_64_1.stdout: split_x86_64_1
3364 $(TEST_OBJDUMP) -d $< > $@
3365 split_x86_64_2: split_x86_64_2.o split_x86_64_n.o ../ld-new
3366 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x86_64_2.o split_x86_64_n.o
3367 split_x86_64_2.stdout: split_x86_64_2
3368 $(TEST_OBJDUMP) -d $< > $@
3369 split_x86_64_3.stdout: split_x86_64_3.o split_x86_64_n.o ../ld-new
3370 ../ld-new $(SPLIT_DEFSYMS) -o split_x86_64_3 split_x86_64_3.o split_x86_64_n.o > $@ 2>&1 || exit 0
3371 split_x86_64_4: split_x86_64_4.o split_x86_64_n.o ../ld-new
3372 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x86_64_4.o split_x86_64_n.o
3373 split_x86_64_4.stdout: split_x86_64_4
3374 $(TEST_OBJDUMP) -d $< > $@
3375 split_x86_64_r.stdout: split_x86_64_1.o split_x86_64_n.o ../ld-new
3376 ../ld-new -r split_x86_64_1.o split_x86_64_n.o -o split_x86_64_r > $@ 2>&1 || exit 0
3377 MOSTLYCLEANFILES += split_x86_64_1 split_x86_64_2 split_x86_64_3 \
3378 split_x86_64_4 split_x86_64_r
3380 check_SCRIPTS += bnd_plt_1.sh
3381 check_DATA += bnd_plt_1.stdout
3382 bnd_plt_1.o: bnd_plt_1.s
3383 $(TEST_AS) --64 -o $@ $<
3384 bnd_plt_1.so: bnd_plt_1.o ../ld-new
3385 ../ld-new -shared -z bndplt bnd_plt_1.o -o $@
3386 bnd_plt_1.stdout: bnd_plt_1.so
3387 $(TEST_OBJDUMP) -dw $< > $@
3389 check_SCRIPTS += bnd_ifunc_1.sh
3390 check_DATA += bnd_ifunc_1.stdout
3391 bnd_ifunc_1.o: bnd_ifunc_1.s
3392 $(TEST_AS) --64 -madd-bnd-prefix -o $@ $<
3393 bnd_ifunc_1.so: bnd_ifunc_1.o ../ld-new
3394 ../ld-new -shared -z bndplt bnd_ifunc_1.o -o $@
3395 bnd_ifunc_1.stdout: bnd_ifunc_1.so
3396 $(TEST_OBJDUMP) -dw $< > $@
3398 check_SCRIPTS += bnd_ifunc_2.sh
3399 check_DATA += bnd_ifunc_2.stdout
3400 bnd_ifunc_2.o: bnd_ifunc_2.s
3401 $(TEST_AS) --64 -madd-bnd-prefix -o $@ $<
3402 bnd_ifunc_2.so: bnd_ifunc_2.o ../ld-new
3403 ../ld-new -shared -z bndplt bnd_ifunc_2.o -o $@
3404 bnd_ifunc_2.stdout: bnd_ifunc_2.so
3405 $(TEST_OBJDUMP) -dw $< > $@
3407 endif DEFAULT_TARGET_X86_64
3409 if DEFAULT_TARGET_X32
3411 check_SCRIPTS += split_x32.sh
3412 check_DATA += split_x32_1.stdout split_x32_2.stdout \
3413 split_x32_3.stdout split_x32_4.stdout split_x32_r.stdout
3414 SPLIT_DEFSYMS = --defsym __morestack=0x100 --defsym __morestack_non_split=0x200
3415 split_x32_1.o: split_x32_1.s
3417 split_x32_2.o: split_x32_2.s
3419 split_x32_3.o: split_x32_3.s
3421 split_x32_4.o: split_x32_4.s
3423 split_x32_n.o: split_x32_n.s
3425 split_x32_1: split_x32_1.o split_x32_n.o ../ld-new
3426 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x32_1.o split_x32_n.o
3427 split_x32_1.stdout: split_x32_1
3428 $(TEST_OBJDUMP) -d $< > $@
3429 split_x32_2: split_x32_2.o split_x32_n.o ../ld-new
3430 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x32_2.o split_x32_n.o
3431 split_x32_2.stdout: split_x32_2
3432 $(TEST_OBJDUMP) -d $< > $@
3433 split_x32_3.stdout: split_x32_3.o split_x32_n.o ../ld-new
3434 ../ld-new $(SPLIT_DEFSYMS) -o split_x32_3 split_x32_3.o split_x32_n.o > $@ 2>&1 || exit 0
3435 split_x32_4: split_x32_4.o split_x32_n.o ../ld-new
3436 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x32_4.o split_x32_n.o
3437 split_x32_4.stdout: split_x32_4
3438 $(TEST_OBJDUMP) -d $< > $@
3439 split_x32_r.stdout: split_x32_1.o split_x32_n.o ../ld-new
3440 ../ld-new -r split_x32_1.o split_x32_n.o -o split_x32_r > $@ 2>&1 || exit 0
3441 MOSTLYCLEANFILES += split_x32_1 split_x32_2 split_x32_3 \
3442 split_x32_4 split_x32_r
3444 endif DEFAULT_TARGET_X32
3446 if DEFAULT_TARGET_ARM
3448 check_SCRIPTS += arm_abs_global.sh
3449 check_DATA += arm_abs_global.stdout
3450 arm_abs_lib.o: arm_abs_lib.s
3451 $(TEST_AS) -march=armv7-a -o $@ $<
3452 libarm_abs.so: arm_abs_lib.o ../ld-new
3453 ../ld-new -shared -o $@ arm_abs_lib.o
3454 arm_abs_global.o: arm_abs_global.s
3455 $(TEST_AS) -march=armv7-a -o $@ $<
3456 arm_abs_global: arm_abs_global.o libarm_abs.so ../ld-new
3457 ../ld-new -o $@ arm_abs_global.o -L. -larm_abs
3458 arm_abs_global.stdout: arm_abs_global
3459 $(TEST_READELF) -r $< > $@
3461 MOSTLYCLEANFILES += arm_abs_global
3463 check_SCRIPTS += arm_branch_in_range.sh arm_branch_out_of_range.sh
3464 check_DATA += arm_bl_in_range.stdout arm_bl_out_of_range.stdout \
3465 thumb_bl_in_range.stdout thumb_bl_out_of_range.stdout \
3466 thumb2_bl_in_range.stdout thumb2_bl_out_of_range.stdout \
3467 thumb_blx_in_range.stdout thumb_blx_out_of_range.stdout \
3468 thumb2_blx_in_range.stdout thumb2_blx_out_of_range.stdout \
3469 thumb_bl_out_of_range_local.stdout arm_thm_jump11.stdout \
3470 arm_thm_jump8.stdout
3472 arm_bl_in_range.stdout: arm_bl_in_range
3473 $(TEST_OBJDUMP) -D $< > $@
3475 arm_bl_in_range: arm_bl_in_range.o ../ld-new
3476 ../ld-new -T $(srcdir)/arm_branch_range.t -o $@ $<
3478 arm_bl_in_range.o: arm_bl_in_range.s
3481 arm_bl_out_of_range.stdout: arm_bl_out_of_range
3482 $(TEST_OBJDUMP) -S $< > $@
3484 arm_bl_out_of_range: arm_bl_out_of_range.o ../ld-new
3485 ../ld-new -T $(srcdir)/arm_branch_range.t -o $@ $<
3487 arm_bl_out_of_range.o: arm_bl_out_of_range.s
3490 thumb_bl_in_range.stdout: thumb_bl_in_range
3491 $(TEST_OBJDUMP) -D $< > $@
3493 thumb_bl_in_range: thumb_bl_in_range.o ../ld-new
3494 ../ld-new --no-fix-arm1176 -T $(srcdir)/thumb_branch_range.t -o $@ $<
3496 thumb_bl_in_range.o: thumb_bl_in_range.s
3497 $(TEST_AS) -o $@ -march=armv5te $<
3499 thumb_bl_out_of_range.stdout: thumb_bl_out_of_range
3500 $(TEST_OBJDUMP) -D $< > $@
3502 thumb_bl_out_of_range: thumb_bl_out_of_range.o ../ld-new
3503 ../ld-new --no-fix-arm1176 -T $(srcdir)/thumb_branch_range.t -o $@ $<
3505 thumb_bl_out_of_range.o: thumb_bl_out_of_range.s
3506 $(TEST_AS) -o $@ -march=armv5te $<
3508 thumb2_bl_in_range.stdout: thumb2_bl_in_range
3509 $(TEST_OBJDUMP) -D $< > $@
3511 thumb2_bl_in_range: thumb2_bl_in_range.o ../ld-new
3512 ../ld-new -T $(srcdir)/thumb2_branch_range.t -o $@ $<
3514 thumb2_bl_in_range.o: thumb_bl_in_range.s
3515 $(TEST_AS) -o $@ -march=armv7-a $<
3517 thumb2_bl_out_of_range.stdout: thumb2_bl_out_of_range
3518 $(TEST_OBJDUMP) -D $< > $@
3520 thumb2_bl_out_of_range: thumb2_bl_out_of_range.o ../ld-new
3521 ../ld-new -T $(srcdir)/thumb2_branch_range.t -o $@ $<
3523 thumb2_bl_out_of_range.o: thumb_bl_out_of_range.s
3524 $(TEST_AS) -o $@ -march=armv7-a $<
3526 thumb_blx_in_range.stdout: thumb_blx_in_range
3527 $(TEST_OBJDUMP) -D $< > $@
3529 thumb_blx_in_range: thumb_blx_in_range.o ../ld-new
3530 ../ld-new --no-fix-arm1176 -T $(srcdir)/thumb_branch_range.t -o $@ $<
3532 thumb_blx_in_range.o: thumb_blx_in_range.s
3533 $(TEST_AS) -o $@ -march=armv5te $<
3535 thumb_blx_out_of_range.stdout: thumb_blx_out_of_range
3536 $(TEST_OBJDUMP) -D $< > $@
3538 thumb_blx_out_of_range: thumb_blx_out_of_range.o ../ld-new
3539 ../ld-new --no-fix-arm1176 -T $(srcdir)/thumb_branch_range.t -o $@ $<
3541 thumb_blx_out_of_range.o: thumb_blx_out_of_range.s
3542 $(TEST_AS) -o $@ -march=armv5te $<
3544 thumb2_blx_in_range.stdout: thumb2_blx_in_range
3545 $(TEST_OBJDUMP) -D $< > $@
3547 thumb2_blx_in_range: thumb2_blx_in_range.o ../ld-new
3548 ../ld-new -T $(srcdir)/thumb2_branch_range.t -o $@ $<
3550 thumb2_blx_in_range.o: thumb_blx_in_range.s
3551 $(TEST_AS) -o $@ -march=armv7-a $<
3553 thumb2_blx_out_of_range.stdout: thumb2_blx_out_of_range
3554 $(TEST_OBJDUMP) -D $< > $@
3556 thumb2_blx_out_of_range: thumb2_blx_out_of_range.o ../ld-new
3557 ../ld-new -T $(srcdir)/thumb2_branch_range.t -o $@ $<
3559 thumb2_blx_out_of_range.o: thumb_blx_out_of_range.s
3560 $(TEST_AS) -o $@ -march=armv7-a $<
3562 thumb_bl_out_of_range_local.stdout: thumb_bl_out_of_range_local
3563 $(TEST_OBJDUMP) -D $< > $@
3565 thumb_bl_out_of_range_local: thumb_bl_out_of_range_local.o ../ld-new
3566 ../ld-new --no-fix-arm1176 -T $(srcdir)/thumb_branch_range.t -o $@ $<
3568 thumb_bl_out_of_range_local.o: thumb_bl_out_of_range_local.s
3569 $(TEST_AS) -o $@ -march=armv5te $<
3571 arm_thm_jump11.stdout: arm_thm_jump11
3572 $(TEST_OBJDUMP) -D $< > $@
3574 arm_thm_jump11: arm_thm_jump11.o ../ld-new
3575 ../ld-new -T $(srcdir)/arm_thm_jump11.t -o $@ $<
3577 arm_thm_jump11.o: arm_thm_jump11.s
3580 arm_thm_jump8.stdout: arm_thm_jump8
3581 $(TEST_OBJDUMP) -D $< > $@
3583 arm_thm_jump8: arm_thm_jump8.o ../ld-new
3584 ../ld-new -T $(srcdir)/arm_thm_jump8.t -o $@ $<
3586 arm_thm_jump8.o: arm_thm_jump8.s
3589 MOSTLYCLEANFILES += arm_bl_in_range arm_bl_out_of_range thumb_bl_in_range \
3590 thumb_bl_out_of_range thumb2_bl_in_range thumb2_bl_out_of_range \
3591 thumb_blx_in_range thumb_blx_out_of_range thumb2_blx_in_range \
3592 thumb2_blx_out_of_range thumb_bl_out_of_range_local arm_thm_jump11 \
3595 check_SCRIPTS += arm_fix_v4bx.sh
3596 check_DATA += arm_fix_v4bx.stdout arm_fix_v4bx_interworking.stdout \
3597 arm_no_fix_v4bx.stdout
3599 arm_fix_v4bx.stdout: arm_fix_v4bx
3600 $(TEST_OBJDUMP) -D -j.text $< > $@
3602 arm_fix_v4bx: arm_fix_v4bx.o ../ld-new
3603 ../ld-new --no-fix-arm1176 --fix-v4bx -o $@ $<
3605 arm_fix_v4bx.o: arm_fix_v4bx.s
3608 arm_fix_v4bx_interworking.stdout: arm_fix_v4bx_interworking
3609 $(TEST_OBJDUMP) -D -j.text $< > $@
3611 arm_fix_v4bx_interworking: arm_fix_v4bx.o ../ld-new
3612 ../ld-new --no-fix-arm1176 --fix-v4bx-interworking -o $@ $<
3614 arm_no_fix_v4bx.stdout: arm_no_fix_v4bx
3615 $(TEST_OBJDUMP) -D -j.text $< > $@
3617 arm_no_fix_v4bx: arm_fix_v4bx.o ../ld-new
3618 ../ld-new --no-fix-arm1176 -o $@ $<
3620 MOSTLYCLEANFILES += arm_fix_v4bx arm_fix_v4bx_interworking arm_no_fix_v4bx
3622 check_SCRIPTS += arm_attr_merge.sh
3623 check_DATA += arm_attr_merge_6.stdout arm_attr_merge_6r.stdout \
3624 arm_attr_merge_7.stdout
3626 arm_attr_merge_6.stdout: arm_attr_merge_6
3627 $(TEST_READELF) -A $< > $@
3629 arm_attr_merge_6: arm_attr_merge_6a.o arm_attr_merge_6b.o ../ld-new
3630 ../ld-new -o $@ arm_attr_merge_6a.o arm_attr_merge_6b.o
3632 arm_attr_merge_6a.o: arm_attr_merge_6a.s
3635 arm_attr_merge_6b.o: arm_attr_merge_6b.s
3638 arm_attr_merge_6r.stdout: arm_attr_merge_6r
3639 $(TEST_READELF) -A $< > $@
3641 arm_attr_merge_6r: arm_attr_merge_6b.o arm_attr_merge_6a.o ../ld-new
3642 ../ld-new -o $@ arm_attr_merge_6b.o arm_attr_merge_6a.o
3644 arm_attr_merge_7.stdout: arm_attr_merge_7
3645 $(TEST_READELF) -A $< > $@
3647 arm_attr_merge_7: arm_attr_merge_7a.o arm_attr_merge_7b.o ../ld-new
3648 ../ld-new -o $@ arm_attr_merge_7a.o arm_attr_merge_7b.o
3650 arm_attr_merge_7a.o: arm_attr_merge_7a.s
3653 arm_attr_merge_7b.o: arm_attr_merge_7b.s
3656 MOSTLYCLEANFILES += arm_attr_merge_6 arm_attr_merge_6r arm_attr_merge_7
3658 # ARM1176 workaround test.
3659 check_SCRIPTS += arm_fix_1176.sh
3660 check_DATA += arm_fix_1176_default_v6z.stdout arm_fix_1176_on_v6z.stdout \
3661 arm_fix_1176_off_v6z.stdout arm_fix_1176_default_v5te.stdout \
3662 arm_fix_1176_default_v7a.stdout arm_fix_1176_default_1156t2f_s.stdout
3664 arm_fix_1176_default_v6z.stdout: arm_fix_1176_default_v6z
3665 $(TEST_OBJDUMP) -D -j.foo $< > $@
3667 arm_fix_1176_default_v6z: arm_fix_1176_default_v6z.o ../ld-new
3668 ../ld-new --section-start=.foo=0x2001014 -o $@ $<
3670 arm_fix_1176_default_v6z.o: arm_fix_1176.s
3671 $(TEST_AS) -march=armv6z -o $@ $<
3673 arm_fix_1176_on_v6z.stdout: arm_fix_1176_on_v6z
3674 $(TEST_OBJDUMP) -D -j.foo $< > $@
3676 arm_fix_1176_on_v6z: arm_fix_1176_on_v6z.o ../ld-new
3677 ../ld-new --section-start=.foo=0x2001014 --fix-arm1176 -o $@ $<
3679 arm_fix_1176_on_v6z.o: arm_fix_1176.s
3680 $(TEST_AS) -march=armv6z -o $@ $<
3682 arm_fix_1176_off_v6z.stdout: arm_fix_1176_off_v6z
3683 $(TEST_OBJDUMP) -D -j.foo $< > $@
3685 arm_fix_1176_off_v6z: arm_fix_1176_off_v6z.o ../ld-new
3686 ../ld-new --section-start=.foo=0x2001014 --no-fix-arm1176 -o $@ $<
3688 arm_fix_1176_off_v6z.o: arm_fix_1176.s
3689 $(TEST_AS) -march=armv6z -o $@ $<
3691 arm_fix_1176_default_v5te.stdout: arm_fix_1176_default_v5te
3692 $(TEST_OBJDUMP) -D -j.foo $< > $@
3694 arm_fix_1176_default_v5te: arm_fix_1176_default_v5te.o ../ld-new
3695 ../ld-new --section-start=.foo=0x2001014 -o $@ $<
3697 arm_fix_1176_default_v5te.o: arm_fix_1176.s
3698 $(TEST_AS) -march=armv5te -o $@ $<
3700 arm_fix_1176_default_v7a.stdout: arm_fix_1176_default_v7a
3701 $(TEST_OBJDUMP) -D -j.foo $< > $@
3703 arm_fix_1176_default_v7a: arm_fix_1176_default_v7a.o ../ld-new
3704 ../ld-new --section-start=.foo=0x2001014 -o $@ $<
3706 arm_fix_1176_default_v7a.o: arm_fix_1176.s
3707 $(TEST_AS) -march=armv7-a -o $@ $<
3709 arm_fix_1176_default_1156t2f_s.stdout: arm_fix_1176_default_1156t2f_s
3710 $(TEST_OBJDUMP) -D -j.foo $< > $@
3712 arm_fix_1176_default_1156t2f_s: arm_fix_1176_default_1156t2f_s.o ../ld-new
3713 ../ld-new --section-start=.foo=0x2001014 -o $@ $<
3715 arm_fix_1176_default_1156t2f_s.o: arm_fix_1176.s
3716 $(TEST_AS) -mcpu=arm1156t2f-s -o $@ $<
3718 MOSTLYCLEANFILES += arm_fix_1176_default_v6z arm_fix_1176_on_v6z arm_fix_1176_off_v6z \
3719 arm_fix_1176_default_v5te arm_fix_1176_default_v7a arm_fix_1176_default_1156t2f_s
3721 # Cortex-A8 workaround test.
3723 check_SCRIPTS += arm_cortex_a8.sh
3724 check_DATA += arm_cortex_a8_b_cond.stdout arm_cortex_a8_b.stdout \
3725 arm_cortex_a8_bl.stdout arm_cortex_a8_blx.stdout \
3726 arm_cortex_a8_local.stdout arm_cortex_a8_local_reloc.stdout
3728 arm_cortex_a8_b_cond.stdout: arm_cortex_a8_b_cond
3729 $(TEST_OBJDUMP) -D -j.text $< > $@
3731 arm_cortex_a8_b_cond: arm_cortex_a8_b_cond.o ../ld-new
3734 arm_cortex_a8_b_cond.o: arm_cortex_a8_b_cond.s
3737 arm_cortex_a8_b.stdout: arm_cortex_a8_b
3738 $(TEST_OBJDUMP) -D -j.text $< > $@
3740 arm_cortex_a8_b: arm_cortex_a8_b.o ../ld-new
3741 ../ld-new --fix-cortex-a8 -o $@ $<
3743 arm_cortex_a8_b.o: arm_cortex_a8_b.s
3746 arm_cortex_a8_bl.stdout: arm_cortex_a8_bl
3747 $(TEST_OBJDUMP) -D -j.text $< > $@
3749 arm_cortex_a8_bl: arm_cortex_a8_bl.o ../ld-new
3752 arm_cortex_a8_bl.o: arm_cortex_a8_bl.s
3755 arm_cortex_a8_blx.stdout: arm_cortex_a8_blx
3756 $(TEST_OBJDUMP) -D -j.text $< > $@
3758 arm_cortex_a8_blx: arm_cortex_a8_blx.o ../ld-new
3761 arm_cortex_a8_blx.o: arm_cortex_a8_blx.s
3764 arm_cortex_a8_local.stdout: arm_cortex_a8_local
3765 $(TEST_OBJDUMP) -D -j.text $< > $@
3767 arm_cortex_a8_local: arm_cortex_a8_local.o ../ld-new
3770 arm_cortex_a8_local.o: arm_cortex_a8_local.s
3773 arm_cortex_a8_local_reloc.stdout: arm_cortex_a8_local_reloc
3774 $(TEST_OBJDUMP) -D -j.text $< > $@
3776 arm_cortex_a8_local_reloc: arm_cortex_a8_local_reloc.o ../ld-new
3779 arm_cortex_a8_local_reloc.o: arm_cortex_a8_local_reloc.s
3782 MOSTLYCLEANFILES += arm_cortex_a8_b_cond arm_cortex_a8_b arm_cortex_a8_bl \
3783 arm_cortex_a8_blx arm_cortex_a8_local arm_cortex_a8_local_reloc
3785 check_SCRIPTS += arm_exidx_test.sh
3786 check_DATA += arm_exidx_test.stdout
3788 arm_exidx_test.stdout: arm_exidx_test.so
3789 $(TEST_READELF) -Sr $< > $@
3791 arm_exidx_test.so: arm_exidx_test.o ../ld-new
3792 ../ld-new -shared -o $@ $<
3794 arm_exidx_test.o: arm_exidx_test.s
3797 check_SCRIPTS += pr12826.sh
3798 check_DATA += pr12826.stdout
3800 pr12826.stdout: pr12826.so
3801 $(TEST_READELF) -A $< > $@
3803 pr12826.so: pr12826_1.o pr12826_2.o ../ld-new
3804 ../ld-new -shared -o $@ $<
3806 pr12826_1.o: pr12826_1.s
3809 pr12826_2.o: pr12826_2.s
3812 check_SCRIPTS += arm_unaligned_reloc.sh
3813 check_DATA += arm_unaligned_reloc.stdout arm_unaligned_reloc_r.stdout
3815 arm_unaligned_reloc.stdout: arm_unaligned_reloc
3816 $(TEST_OBJDUMP) -D $< > $@
3818 arm_unaligned_reloc_r.stdout: arm_unaligned_reloc_r
3819 $(TEST_OBJDUMP) -Dr $< > $@
3821 arm_unaligned_reloc: arm_unaligned_reloc.o ../ld-new
3824 arm_unaligned_reloc_r: arm_unaligned_reloc.o ../ld-new
3825 ../ld-new -r -o $@ $<
3827 arm_unaligned_reloc.o: arm_unaligned_reloc.s
3830 MOSTLYCLEANFILES += arm_unaligned_reloc arm_unaligned_reloc_r
3832 # Check ARM to ARM farcall veneers
3834 check_SCRIPTS += arm_farcall_arm_arm.sh
3835 check_DATA += arm_farcall_arm_arm.stdout
3837 arm_farcall_arm_arm.stdout: arm_farcall_arm_arm
3838 $(TEST_OBJDUMP) -d $< > $@
3840 arm_farcall_arm_arm: arm_farcall_arm_arm.o ../ld-new
3841 ../ld-new --no-fix-arm1176 --section-start .text=0x1000 --section-start .foo=0x2001020 -o $@ $<
3843 arm_farcall_arm_arm.o: arm_farcall_arm_arm.s
3846 MOSTLYCLEANFILES += arm_farcall_arm_arm
3848 # Check ARM to Thumb farcall veneers
3850 check_SCRIPTS += arm_farcall_arm_thumb.sh
3851 check_DATA += arm_farcall_arm_thumb.stdout arm_farcall_arm_thumb_5t.stdout
3853 arm_farcall_arm_thumb.stdout: arm_farcall_arm_thumb
3854 $(TEST_OBJDUMP) -D $< > $@
3856 arm_farcall_arm_thumb: arm_farcall_arm_thumb.o ../ld-new
3857 ../ld-new --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
3859 arm_farcall_arm_thumb.o: arm_farcall_arm_thumb.s
3862 arm_farcall_arm_thumb_5t.stdout: arm_farcall_arm_thumb_5t
3863 $(TEST_OBJDUMP) -D $< > $@
3865 arm_farcall_arm_thumb_5t: arm_farcall_arm_thumb_5t.o ../ld-new
3866 ../ld-new --no-fix-arm1176 --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
3868 arm_farcall_arm_thumb_5t.o: arm_farcall_arm_thumb.s
3869 $(TEST_AS) -march=armv5t -o $@ $<
3871 MOSTLYCLEANFILES += arm_farcall_arm_thumb arm_farcall_arm_thumb_5t
3873 # Check Thumb to Thumb farcall veneers
3875 check_SCRIPTS += arm_farcall_thumb_thumb.sh
3876 check_DATA += arm_farcall_thumb_thumb.stdout \
3877 arm_farcall_thumb_thumb_5t.stdout \
3878 arm_farcall_thumb_thumb_7m.stdout \
3879 arm_farcall_thumb_thumb_6m.stdout
3881 arm_farcall_thumb_thumb.stdout: arm_farcall_thumb_thumb
3882 $(TEST_OBJDUMP) -D $< > $@
3884 arm_farcall_thumb_thumb: arm_farcall_thumb_thumb.o ../ld-new
3885 ../ld-new --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
3887 arm_farcall_thumb_thumb.o: arm_farcall_thumb_thumb.s
3888 $(TEST_AS) -march=armv4t -o $@ $<
3890 arm_farcall_thumb_thumb_5t.stdout: arm_farcall_thumb_thumb_5t
3891 $(TEST_OBJDUMP) -D $< > $@
3893 arm_farcall_thumb_thumb_5t: arm_farcall_thumb_thumb_5t.o ../ld-new
3894 ../ld-new --no-fix-arm1176 --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
3896 arm_farcall_thumb_thumb_5t.o: arm_farcall_thumb_thumb.s
3897 $(TEST_AS) -march=armv5t -o $@ $<
3899 arm_farcall_thumb_thumb_7m.stdout: arm_farcall_thumb_thumb_7m
3900 $(TEST_OBJDUMP) -D $< > $@
3902 arm_farcall_thumb_thumb_7m: arm_farcall_thumb_thumb_7m.o ../ld-new
3903 ../ld-new --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
3905 arm_farcall_thumb_thumb_7m.o: arm_farcall_thumb_thumb.s
3906 $(TEST_AS) -march=armv7-m -o $@ $<
3908 arm_farcall_thumb_thumb_6m.stdout: arm_farcall_thumb_thumb_6m
3909 $(TEST_OBJDUMP) -D $< > $@
3911 arm_farcall_thumb_thumb_6m: arm_farcall_thumb_thumb_6m.o ../ld-new
3912 ../ld-new --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
3914 arm_farcall_thumb_thumb_6m.o: arm_farcall_thumb_thumb.s
3915 $(TEST_AS) -march=armv6-m -o $@ $<
3917 MOSTLYCLEANFILES += arm_farcall_thumb_thumb arm_farcall_thumb_thumb_5t \
3918 arm_farcall_thumb_thumb_7m arm_farcall_thumb_thumb_6m
3920 #Check ARM to ARM farcall veneers in the be8 mode addressing
3922 check_SCRIPTS += arm_farcall_arm_arm_be8.sh
3923 check_DATA += arm_farcall_arm_arm_be8.stdout
3925 arm_farcall_arm_arm_be8.stdout: arm_farcall_arm_arm_be8
3926 $(TEST_OBJDUMP) -D $< > $@
3928 arm_farcall_arm_arm_be8: arm_farcall_arm_arm_be8.o ../ld-new
3929 ../ld-new --no-fix-arm1176 --section-start .text=0x1000 --section-start .foo=0x2001020 -EB --be8 -o $@ $<
3931 arm_farcall_arm_arm_be8.o: arm_farcall_arm_arm.s
3932 $(TEST_AS) -EB -o $@ $<
3934 MOSTLYCLEANFILES += arm_farcall_arm_arm_be8
3936 #Check THUMB to THUMB farcall veneers in the be8 mode addressing
3938 check_SCRIPTS += arm_farcall_thumb_thumb_be8.sh
3939 check_DATA += arm_farcall_thumb_thumb_be8.stdout
3941 arm_farcall_thumb_thumb_be8.stdout: arm_farcall_thumb_thumb_be8
3942 $(TEST_OBJDUMP) -D $< > $@
3944 arm_farcall_thumb_thumb_be8: arm_farcall_thumb_thumb_be8.o ../ld-new
3945 ../ld-new --section-start .text=0x1000 --section-start .foo=0x2001014 -EB --be8 -o $@ $<
3947 arm_farcall_thumb_thumb_be8.o: arm_farcall_thumb_thumb.s
3948 $(TEST_AS) -march=armv7-m -EB -o $@ $<
3950 MOSTLYCLEANFILES += arm_farcall_thumb_thumb_be8
3952 # Check Thumb to ARM farcall veneers
3954 check_SCRIPTS += arm_farcall_thumb_arm.sh
3955 check_DATA += arm_farcall_thumb_arm.stdout \
3956 arm_farcall_thumb_arm_5t.stdout
3958 arm_farcall_thumb_arm.stdout: arm_farcall_thumb_arm
3959 $(TEST_OBJDUMP) -D $< > $@
3961 arm_farcall_thumb_arm: arm_farcall_thumb_arm.o ../ld-new
3962 ../ld-new --section-start .text=0x1c01010 --section-start .foo=0x2001014 -o $@ $<
3964 arm_farcall_thumb_arm.o: arm_farcall_thumb_arm.s
3967 arm_farcall_thumb_arm_5t.stdout: arm_farcall_thumb_arm_5t
3968 $(TEST_OBJDUMP) -D $< > $@
3970 arm_farcall_thumb_arm_5t: arm_farcall_thumb_arm_5t.o ../ld-new
3971 ../ld-new --no-fix-arm1176 --section-start .text=0x1c01010 --section-start .foo=0x2001014 -o $@ $<
3973 arm_farcall_thumb_arm_5t.o: arm_farcall_thumb_arm.s
3974 $(TEST_AS) -march=armv5t -o $@ $<
3976 MOSTLYCLEANFILES += arm_farcall_thumb_arm arm_farcall_thumb_arm_5t
3978 # Check handling of --target1-abs, --target1-rel and --target2 options
3980 check_SCRIPTS += arm_target1_abs.sh arm_target1_rel.sh \
3981 arm_target2_rel.sh arm_target2_abs.sh arm_target2_got_rel.sh
3982 check_DATA += arm_target1_abs.stdout arm_target1_rel.stdout \
3983 arm_target2_rel.stdout arm_target2_abs.stdout arm_target2_got_rel.stdout
3985 arm_target1_abs.stdout: arm_target1_abs
3986 $(TEST_OBJDUMP) -s $< > $@
3988 arm_target1_abs: arm_target1.o ../ld-new
3989 ../ld-new --target1-abs --section-start .text=0x8000 -o $@ $<
3991 arm_target1_rel.stdout: arm_target1_rel
3992 $(TEST_OBJDUMP) -s $< > $@
3994 arm_target1_rel: arm_target1.o ../ld-new
3995 ../ld-new --target1-rel --section-start .text=0x8000 -o $@ $<
3997 arm_target1.o: arm_target1.s
4000 arm_target2_rel.stdout: arm_target2_rel
4001 $(TEST_OBJDUMP) -s $< > $@
4003 arm_target2_rel: arm_target2.o ../ld-new
4004 ../ld-new --target2=rel --section-start .text=0x8000 -o $@ $<
4006 arm_target2_abs.stdout: arm_target2_abs
4007 $(TEST_OBJDUMP) -s $< > $@
4009 arm_target2_abs: arm_target2.o ../ld-new
4010 ../ld-new --target2=abs --section-start .text=0x8000 -o $@ $<
4012 arm_target2_got_rel.stdout: arm_target2_got_rel
4013 $(TEST_OBJDUMP) -s $< > $@
4015 arm_target2_got_rel: arm_target2.o ../ld-new
4016 ../ld-new --target2=got-rel --section-start .text=0x8000 --section-start .got=0x9000 -o $@ $<
4018 arm_target2.o: arm_target2.s
4021 MOSTLYCLEANFILES += arm_target1_abs arm_target1_rel \
4022 arm_target2_rel arm_target2_abs arm_target2_got_rel
4024 # The test demonstrates why the constructor of a target object should not access options.
4025 check_DATA += arm_target_lazy_init
4026 MOSTLYCLEANFILES += arm_target_lazy_init
4027 arm_target_lazy_init: arm_target_lazy_init.o arm_target_lazy_init.t ../ld-new
4028 ../ld-new -T $(srcdir)/arm_target_lazy_init.t -o $@ $<
4029 arm_target_lazy_init.o: arm_target_lazy_init.s
4030 $(TEST_AS) -EL -o $@ $<
4032 endif DEFAULT_TARGET_ARM
4034 if DEFAULT_TARGET_AARCH64
4036 check_SCRIPTS += aarch64_reloc_none.sh
4037 check_DATA += aarch64_reloc_none.stdout
4038 aarch64_reloc_none.o: aarch64_reloc_none.s
4040 aarch64_reloc_none: aarch64_reloc_none.o ../ld-new
4041 ../ld-new -o $@ aarch64_reloc_none.o --gc-sections
4042 aarch64_reloc_none.stdout: aarch64_reloc_none
4045 MOSTLYCLEANFILES += aarch64_reloc_none
4047 check_SCRIPTS += aarch64_relocs.sh
4048 check_DATA += aarch64_relocs.stdout
4049 aarch64_globals.o: aarch64_globals.s
4051 aarch64_relocs.o: aarch64_relocs.s
4053 aarch64_relocs: aarch64_relocs.o aarch64_globals.o ../ld-new
4054 ../ld-new -o $@ aarch64_relocs.o aarch64_globals.o -e0 --emit-relocs
4055 aarch64_relocs.stdout: aarch64_relocs
4056 $(TEST_OBJDUMP) -dr $< > $@
4058 MOSTLYCLEANFILES += aarch64_relocs
4060 check_SCRIPTS += pr21430.sh
4061 check_DATA += pr21430.stdout
4062 pr21430.o: pr21430.s
4064 pr21430: pr21430.o ../ld-new
4066 pr21430.stdout: pr21430
4067 $(TEST_NM) -S $< > $@
4069 MOSTLYCLEANFILES += pr21430
4071 check_SCRIPTS += aarch64_tlsdesc.sh
4072 check_DATA += aarch64_tlsdesc.stdout
4073 aarch64_tlsdesc.o: aarch64_tlsdesc.s
4075 aarch64_tlsdesc: aarch64_tlsdesc.o $(srcdir)/aarch64_tlsdesc.t ../ld-new
4076 ../ld-new $< -shared -T $(srcdir)/aarch64_tlsdesc.t -o $@
4077 aarch64_tlsdesc.stdout: aarch64_tlsdesc
4078 $(TEST_OBJDUMP) -dR -j.text -j.got.plt $< > $@
4080 MOSTLYCLEANFILES += aarch64_tlsdesc
4082 endif DEFAULT_TARGET_AARCH64
4084 if DEFAULT_TARGET_S390
4086 check_SCRIPTS += split_s390.sh
4087 check_DATA += split_s390_z1.stdout split_s390_z2.stdout split_s390_z3.stdout \
4088 split_s390_z4.stdout split_s390_n1.stdout split_s390_n2.stdout \
4089 split_s390_a1.stdout split_s390_a2.stdout split_s390_z1_ns.stdout \
4090 split_s390_z2_ns.stdout split_s390_z3_ns.stdout split_s390_z4_ns.stdout \
4091 split_s390_n1_ns.stdout split_s390_n2_ns.stdout split_s390_r.stdout \
4092 split_s390x_z1.stdout split_s390x_z2.stdout split_s390x_z3.stdout \
4093 split_s390x_z4.stdout split_s390x_n1.stdout split_s390x_n2.stdout \
4094 split_s390x_a1.stdout split_s390x_a2.stdout split_s390x_z1_ns.stdout \
4095 split_s390x_z2_ns.stdout split_s390x_z3_ns.stdout \
4096 split_s390x_z4_ns.stdout split_s390x_n1_ns.stdout \
4097 split_s390x_n2_ns.stdout split_s390x_r.stdout
4098 SPLIT_DEFSYMS = --defsym __morestack=0x100 --defsym __morestack_non_split=0x200
4099 split_s390_1_z1.o: split_s390_1_z1.s
4100 $(TEST_AS) -m31 -o $@ $<
4101 split_s390_1_z2.o: split_s390_1_z2.s
4102 $(TEST_AS) -m31 -o $@ $<
4103 split_s390_1_z3.o: split_s390_1_z3.s
4104 $(TEST_AS) -m31 -o $@ $<
4105 split_s390_1_z4.o: split_s390_1_z4.s
4106 $(TEST_AS) -m31 -o $@ $<
4107 split_s390_1_n1.o: split_s390_1_n1.s
4108 $(TEST_AS) -m31 -o $@ $<
4109 split_s390_1_n2.o: split_s390_1_n2.s
4110 $(TEST_AS) -m31 -o $@ $<
4111 split_s390_1_a1.o: split_s390_1_a1.s
4112 $(TEST_AS) -m31 -o $@ $<
4113 split_s390_1_a2.o: split_s390_1_a2.s
4114 $(TEST_AS) -m31 -o $@ $<
4115 split_s390_2_s.o: split_s390_2_s.s
4116 $(TEST_AS) -m31 -o $@ $<
4117 split_s390_2_ns.o: split_s390_2_ns.s
4118 $(TEST_AS) -m31 -o $@ $<
4119 split_s390_z1: split_s390_1_z1.o split_s390_2_s.o ../ld-new
4120 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_z1.o split_s390_2_s.o
4121 split_s390_z1.stdout: split_s390_z1
4122 $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
4123 split_s390_z2: split_s390_1_z2.o split_s390_2_s.o ../ld-new
4124 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_z2.o split_s390_2_s.o
4125 split_s390_z2.stdout: split_s390_z2
4126 $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
4127 split_s390_z3: split_s390_1_z3.o split_s390_2_s.o ../ld-new
4128 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_z3.o split_s390_2_s.o
4129 split_s390_z3.stdout: split_s390_z3
4130 $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
4131 split_s390_z4: split_s390_1_z4.o split_s390_2_s.o ../ld-new
4132 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_z4.o split_s390_2_s.o
4133 split_s390_z4.stdout: split_s390_z4
4134 $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
4135 split_s390_n1: split_s390_1_n1.o split_s390_2_s.o ../ld-new
4136 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_n1.o split_s390_2_s.o
4137 split_s390_n1.stdout: split_s390_n1
4138 $(TEST_OBJDUMP) -d $< > $@
4139 split_s390_n2: split_s390_1_n2.o split_s390_2_s.o ../ld-new
4140 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_n2.o split_s390_2_s.o
4141 split_s390_n2.stdout: split_s390_n2
4142 $(TEST_OBJDUMP) -d $< > $@
4143 split_s390_z1_ns: split_s390_1_z1.o split_s390_2_ns.o ../ld-new
4144 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_z1.o split_s390_2_ns.o
4145 split_s390_z1_ns.stdout: split_s390_z1_ns
4146 $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
4147 split_s390_z2_ns: split_s390_1_z2.o split_s390_2_ns.o ../ld-new
4148 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_z2.o split_s390_2_ns.o
4149 split_s390_z2_ns.stdout: split_s390_z2_ns
4150 $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
4151 split_s390_z3_ns: split_s390_1_z3.o split_s390_2_ns.o ../ld-new
4152 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_z3.o split_s390_2_ns.o
4153 split_s390_z3_ns.stdout: split_s390_z3_ns
4154 $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
4155 split_s390_z4_ns: split_s390_1_z4.o split_s390_2_ns.o ../ld-new
4156 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_z4.o split_s390_2_ns.o
4157 split_s390_z4_ns.stdout: split_s390_z4_ns
4158 $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
4159 split_s390_n1_ns: split_s390_1_n1.o split_s390_2_ns.o ../ld-new
4160 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_n1.o split_s390_2_ns.o
4161 split_s390_n1_ns.stdout: split_s390_n1_ns
4162 $(TEST_OBJDUMP) -d $< > $@
4163 split_s390_n2_ns.stdout: split_s390_1_n2.o split_s390_2_ns.o ../ld-new
4164 ../ld-new $(SPLIT_DEFSYMS) -o split_s390_n2 split_s390_1_n2.o split_s390_2_ns.o > $@ 2>&1 || exit 0
4165 split_s390_a1.stdout: split_s390_1_a1.o split_s390_2_ns.o ../ld-new
4166 ../ld-new $(SPLIT_DEFSYMS) -o split_s390_a1 split_s390_1_a1.o split_s390_2_ns.o > $@ 2>&1 || exit 0
4167 split_s390_a2: split_s390_1_a2.o split_s390_2_ns.o ../ld-new
4168 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_a2.o split_s390_2_ns.o
4169 split_s390_a2.stdout: split_s390_a2
4170 $(TEST_OBJDUMP) -d $< > $@
4171 split_s390_r.stdout: split_s390_1_z1.o split_s390_2_ns.o ../ld-new
4172 ../ld-new -r split_s390_1_z1.o split_s390_2_ns.o -o split_s390_r > $@ 2>&1 || exit 0
4173 split_s390x_1_z1.o: split_s390x_1_z1.s
4174 $(TEST_AS) -m64 -o $@ $<
4175 split_s390x_1_z2.o: split_s390x_1_z2.s
4176 $(TEST_AS) -m64 -o $@ $<
4177 split_s390x_1_z3.o: split_s390x_1_z3.s
4178 $(TEST_AS) -m64 -o $@ $<
4179 split_s390x_1_z4.o: split_s390x_1_z4.s
4180 $(TEST_AS) -m64 -o $@ $<
4181 split_s390x_1_n1.o: split_s390x_1_n1.s
4182 $(TEST_AS) -m64 -o $@ $<
4183 split_s390x_1_n2.o: split_s390x_1_n2.s
4184 $(TEST_AS) -m64 -o $@ $<
4185 split_s390x_1_a1.o: split_s390x_1_a1.s
4186 $(TEST_AS) -m64 -o $@ $<
4187 split_s390x_1_a2.o: split_s390x_1_a2.s
4188 $(TEST_AS) -m64 -o $@ $<
4189 split_s390x_2_s.o: split_s390x_2_s.s
4190 $(TEST_AS) -m64 -o $@ $<
4191 split_s390x_2_ns.o: split_s390x_2_ns.s
4192 $(TEST_AS) -m64 -o $@ $<
4193 split_s390x_z1: split_s390x_1_z1.o split_s390x_2_s.o ../ld-new
4194 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_z1.o split_s390x_2_s.o
4195 split_s390x_z1.stdout: split_s390x_z1
4196 $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
4197 split_s390x_z2: split_s390x_1_z2.o split_s390x_2_s.o ../ld-new
4198 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_z2.o split_s390x_2_s.o
4199 split_s390x_z2.stdout: split_s390x_z2
4200 $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
4201 split_s390x_z3: split_s390x_1_z3.o split_s390x_2_s.o ../ld-new
4202 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_z3.o split_s390x_2_s.o
4203 split_s390x_z3.stdout: split_s390x_z3
4204 $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
4205 split_s390x_z4: split_s390x_1_z4.o split_s390x_2_s.o ../ld-new
4206 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_z4.o split_s390x_2_s.o
4207 split_s390x_z4.stdout: split_s390x_z4
4208 $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
4209 split_s390x_n1: split_s390x_1_n1.o split_s390x_2_s.o ../ld-new
4210 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_n1.o split_s390x_2_s.o
4211 split_s390x_n1.stdout: split_s390x_n1
4212 $(TEST_OBJDUMP) -d $< > $@
4213 split_s390x_n2: split_s390x_1_n2.o split_s390x_2_s.o ../ld-new
4214 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_n2.o split_s390x_2_s.o
4215 split_s390x_n2.stdout: split_s390x_n2
4216 $(TEST_OBJDUMP) -d $< > $@
4217 split_s390x_z1_ns: split_s390x_1_z1.o split_s390x_2_ns.o ../ld-new
4218 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_z1.o split_s390x_2_ns.o
4219 split_s390x_z1_ns.stdout: split_s390x_z1_ns
4220 $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
4221 split_s390x_z2_ns: split_s390x_1_z2.o split_s390x_2_ns.o ../ld-new
4222 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_z2.o split_s390x_2_ns.o
4223 split_s390x_z2_ns.stdout: split_s390x_z2_ns
4224 $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
4225 split_s390x_z3_ns: split_s390x_1_z3.o split_s390x_2_ns.o ../ld-new
4226 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_z3.o split_s390x_2_ns.o
4227 split_s390x_z3_ns.stdout: split_s390x_z3_ns
4228 $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
4229 split_s390x_z4_ns: split_s390x_1_z4.o split_s390x_2_ns.o ../ld-new
4230 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_z4.o split_s390x_2_ns.o
4231 split_s390x_z4_ns.stdout: split_s390x_z4_ns
4232 $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
4233 split_s390x_n1_ns: split_s390x_1_n1.o split_s390x_2_ns.o ../ld-new
4234 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_n1.o split_s390x_2_ns.o
4235 split_s390x_n1_ns.stdout: split_s390x_n1_ns
4236 $(TEST_OBJDUMP) -d $< > $@
4237 split_s390x_n2_ns.stdout: split_s390x_1_n2.o split_s390x_2_ns.o ../ld-new
4238 ../ld-new $(SPLIT_DEFSYMS) -o split_s390x_n2 split_s390x_1_n2.o split_s390x_2_ns.o > $@ 2>&1 || exit 0
4239 split_s390x_a1.stdout: split_s390x_1_a1.o split_s390x_2_ns.o ../ld-new
4240 ../ld-new $(SPLIT_DEFSYMS) -o split_s390x_a1 split_s390x_1_a1.o split_s390x_2_ns.o > $@ 2>&1 || exit 0
4241 split_s390x_a2: split_s390x_1_a2.o split_s390x_2_ns.o ../ld-new
4242 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_a2.o split_s390x_2_ns.o
4243 split_s390x_a2.stdout: split_s390x_a2
4244 $(TEST_OBJDUMP) -d $< > $@
4245 split_s390x_r.stdout: split_s390x_1_z1.o split_s390x_2_ns.o ../ld-new
4246 ../ld-new -r split_s390x_1_z1.o split_s390x_2_ns.o -o split_s390x_r > $@ 2>&1 || exit 0
4247 MOSTLYCLEANFILES += split_s390_z1 split_s390_z2 split_s390_z3 \
4248 split_s390_z4 split_s390_n1 split_s390_n2 split_s390_a1 \
4249 split_s390_a2 split_s390_z1_ns split_s390_z2_ns split_s390_z3_ns \
4250 split_s390_z4_ns split_s390_n1_ns split_s390_n2_ns split_s390_r \
4251 split_s390x_z1 split_s390x_z2 split_s390x_z3 split_s390x_z4 \
4252 split_s390x_n1 split_s390x_n2 split_s390x_a1 split_s390x_a2 \
4253 split_s390x_z1_ns split_s390x_z2_ns split_s390x_z3_ns \
4254 split_s390x_z4_ns split_s390x_n1_ns split_s390x_n2_ns split_s390x_r
4256 endif DEFAULT_TARGET_S390
4258 endif NATIVE_OR_CROSS_LINKER
4260 # Tests for the dwp tool.
4261 # We don't want to rely yet on GCC support for -gsplit-dwarf,
4262 # so we use (for now) test cases in x86 assembly language,
4263 # compiled from the dwp_test_*.cc sources.
4265 if DEFAULT_TARGET_X86_64
4267 dwp_test_main.o: dwp_test_main.s
4269 dwp_test_1.o: dwp_test_1.s
4271 dwp_test_1b.o: dwp_test_1b.s
4273 dwp_test_2.o: dwp_test_2.s
4276 dwp_test_main.dwo: dwp_test_main.o
4277 $(TEST_OBJCOPY) --extract-dwo $< $@
4278 dwp_test_1.dwo: dwp_test_1.o
4279 $(TEST_OBJCOPY) --extract-dwo $< $@
4280 dwp_test_1b.dwo: dwp_test_1b.o
4281 $(TEST_OBJCOPY) --extract-dwo $< $@
4282 dwp_test_2.dwo: dwp_test_2.o
4283 $(TEST_OBJCOPY) --extract-dwo $< $@
4285 MOSTLYCLEANFILES += *.dwo *.dwp
4286 check_SCRIPTS += dwp_test_1.sh
4287 check_DATA += dwp_test_1.stdout
4288 dwp_test_1.stdout: dwp_test_1.dwp
4289 $(TEST_READELF) -wi $< > $@
4290 dwp_test_1.dwp: ../dwp dwp_test_main.dwo dwp_test_1.dwo dwp_test_1b.dwo dwp_test_2.dwo
4291 ../dwp -o $@ dwp_test_main.dwo dwp_test_1.dwo dwp_test_1b.dwo dwp_test_2.dwo
4293 check_SCRIPTS += dwp_test_2.sh
4294 check_DATA += dwp_test_2.stdout
4295 dwp_test_2.stdout: dwp_test_2.dwp
4296 $(TEST_READELF) -wi $< > $@
4297 dwp_test_2.dwp: ../dwp dwp_test_2a.dwp dwp_test_2b.dwp
4298 ../dwp -o $@ dwp_test_2a.dwp dwp_test_2b.dwp
4299 dwp_test_2a.dwp: ../dwp dwp_test_main.dwo dwp_test_1.dwo
4300 ../dwp -o $@ dwp_test_main.dwo dwp_test_1.dwo
4301 dwp_test_2b.dwp: ../dwp dwp_test_1b.dwo dwp_test_2.dwo
4302 ../dwp -o $@ dwp_test_1b.dwo dwp_test_2.dwo
4304 endif DEFAULT_TARGET_X86_64