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