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