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