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