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