fbdc147446e906bec6885f470bc61ad13a9faa32
[deliverable/binutils-gdb.git] / gold / testsuite / Makefile.am
1 # Process this file with automake to generate Makefile.in
2
3 # As far as I can tell automake testing support assumes that the build
4 # system and the host system are the same. So these tests will not
5 # work when building with a cross-compiler.
6
7 # Ignore warning about AM_PROG_CC_C_O due to large_CFLAGS
8 AUTOMAKE_OPTIONS = foreign -Wno-portability
9
10 # This is where we get zlib from. zlib is in ../../zlib unless we were
11 # configured with --with-system-zlib, in which case ../../zlib either
12 # doesn't exist or not configured.
13 ZLIB = -L../../zlib -lz
14
15 # The two_file_test tests -fmerge-constants, so we simply always turn
16 # it on. For compilers that do not support the command-line option,
17 # we assume they just always emit SHF_MERGE sections unconditionally.
18 AM_CFLAGS = $(WARN_CFLAGS) $(LFS_CFLAGS) $(MERGE_CONSTANTS_FLAG)
19 AM_CXXFLAGS = $(WARN_CXXFLAGS) $(LFS_CFLAGS) $(MERGE_CONSTANTS_FLAG)
20
21 AM_CPPFLAGS = \
22 -I$(srcdir) -I$(srcdir)/.. -I$(srcdir)/../../include \
23 -I$(srcdir)/../../elfcpp -I.. \
24 -DLOCALEDIR="\"$(datadir)/locale\"" \
25 @INCINTL@
26
27 # Some versions of GCC now automatically enable linker plugins,
28 # but we want to run our tests without GCC's plugins.
29 if HAVE_NO_USE_LINKER_PLUGIN
30 OPT_NO_PLUGINS = -fno-use-linker-plugin
31 endif
32
33 # COMPILE1, LINK1, CXXCOMPILE1, CXXLINK1 are renamed from COMPILE, LINK,
34 # CXXCOMPILE and CXXLINK generated by automake 1.11.1. FIXME: they should
35 # be updated if they are different from automake used by gold.
36 COMPILE1 = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
37 $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
38 LINK1 = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(OPT_NO_PLUGINS) \
39 $(AM_LDFLAGS) $(LDFLAGS) -o $@
40 CXXCOMPILE1 = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
41 $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
42 CXXLINK1 = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(OPT_NO_PLUGINS) \
43 $(AM_LDFLAGS) $(LDFLAGS) -o $@
44
45 # Strip out -Wp,-D_FORTIFY_SOURCE=, which is irrelevant for the gold
46 # testsuite and incompatible with -O0 used in gold tests, from
47 # COMPILE, LINK, CXXCOMPILE and CXXLINK.
48 COMPILE = `echo $(COMPILE1) | sed -e 's/-Wp,-D_FORTIFY_SOURCE=[0-9[0-9]]*//'`
49 LINK = `echo $(LINK1) | sed -e 's/-Wp,-D_FORTIFY_SOURCE=[0-9][0-9]*//'`
50 CXXCOMPILE = `echo $(CXXCOMPILE1) | sed -e 's/-Wp,-D_FORTIFY_SOURCE=[0-9][0-9]*//'`
51 CXXLINK = `echo $(CXXLINK1) | sed -e 's/-Wp,-D_FORTIFY_SOURCE=[0-9][0-9]*//'`
52
53 # Strip out -static-libgcc and -static-libstdc++ options, for tests
54 # that must have these libraries linked dynamically. The -shared-libgcc
55 # option does not work correctly, and there is no -shared-libstdc++ option.
56 # (See GCC PR 55781 and PR 55782.)
57 CXXLINK_S = `echo $(CXXLINK1) | sed -e 's/-static-lib\\(gcc\\|stdc++\\)//g'`
58
59 TEST_READELF = $(top_builddir)/../binutils/readelf
60 TEST_OBJDUMP = $(top_builddir)/../binutils/objdump
61 TEST_OBJCOPY = $(top_builddir)/../binutils/objcopy
62 TEST_CXXFILT = $(top_builddir)/../binutils/cxxfilt
63 TEST_STRIP = $(top_builddir)/../binutils/strip-new
64 TEST_AR = $(top_builddir)/../binutils/ar
65 TEST_NM = $(top_builddir)/../binutils/nm-new
66 TEST_AS = $(top_builddir)/../gas/as-new
67
68 if PLUGINS
69 LIBDL = -ldl
70 endif
71
72 if THREADS
73 THREADSLIB = -lpthread
74 endif
75
76 if OMP_SUPPORT
77 TLS_TEST_C_CFLAGS = -fopenmp
78 endif
79
80 # 'make clean' is good about deleting some intermediate files (such as
81 # .o's), but not all of them (such as .so's and .err files). We
82 # improve on that here. automake-1.9 info docs say "mostlyclean" is
83 # the right choice for files 'make' builds that people rebuild.
84 MOSTLYCLEANFILES = *.so *.syms *.stdout
85
86 # Export make variables to the shell scripts so that they can see
87 # (for example) DEFAULT_TARGET.
88 .EXPORT_ALL_VARIABLES:
89
90 # We will add to these later, for each individual test. Note
91 # that we add each test under check_SCRIPTS or check_PROGRAMS;
92 # the TESTS variable is automatically populated from these.
93 check_SCRIPTS =
94 check_DATA =
95 check_PROGRAMS =
96 BUILT_SOURCES =
97
98 TESTS = $(check_SCRIPTS) $(check_PROGRAMS)
99
100 # ---------------------------------------------------------------------
101 # These tests test the internals of gold (unittests).
102
103 # Infrastucture needed for the unittests
104 check_LIBRARIES = libgoldtest.a
105 libgoldtest_a_SOURCES = test.cc testmain.cc testfile.cc
106
107 DEPENDENCIES = \
108 libgoldtest.a ../libgold.a ../../libiberty/libiberty.a $(LIBINTL_DEP)
109 LDADD = libgoldtest.a ../libgold.a ../../libiberty/libiberty.a $(LIBINTL) \
110 $(THREADSLIB) $(LIBDL) $(ZLIB)
111
112
113 # The unittests themselves
114 if NATIVE_OR_CROSS_LINKER
115 if GCC
116
117 # Infrastucture needed for the unittests: a directory where the linker
118 # is named 'ld'. This is because the -B flag appends 'ld' to its arg.
119 gcctestdir/ld: ../ld-new
120 test -d gcctestdir || mkdir -p gcctestdir
121 rm -f gcctestdir/ld
122 (cd gcctestdir && $(LN_S) ../../ld-new ld)
123
124 # Some tests require the latest features of an in-tree assembler.
125 gcctestdir/as: $(TEST_AS)
126 test -d gcctestdir || mkdir -p gcctestdir
127 rm -f gcctestdir/as
128 (cd gcctestdir && $(LN_S) $(abs_top_builddir)/../gas/as-new as)
129
130 endif GCC
131
132 check_PROGRAMS += object_unittest
133 object_unittest_SOURCES = object_unittest.cc
134
135 check_PROGRAMS += binary_unittest
136 binary_unittest_SOURCES = binary_unittest.cc
137
138 check_PROGRAMS += leb128_unittest
139 leb128_unittest_SOURCES = leb128_unittest.cc
140
141 check_PROGRAMS += overflow_unittest
142 overflow_unittest_SOURCES = overflow_unittest.cc
143 overflow_unittest.o: overflow_unittest.cc
144 $(CXXCOMPILE) -O3 -c -o $@ $<
145
146 endif NATIVE_OR_CROSS_LINKER
147
148 # ---------------------------------------------------------------------
149 # These tests test the output of gold (end-to-end tests). In
150 # particular, they make sure that gold can link "difficult" object
151 # files, and the resulting object files run correctly. These can only
152 # run if we've built ld-new for the native architecture (that is,
153 # we're not cross-compiling it), since we run ld-new as part of these
154 # tests. We use the gcc-specific flag '-B' to use our linker instead
155 # of the default linker, which is why we only run our tests under gcc.
156
157 if NATIVE_LINKER
158 if GCC
159
160 # Each of these .o's is a useful, small complete program. They're
161 # particularly useful for making sure ld-new's flags do what they're
162 # supposed to (hence their names), but are used for many tests that
163 # don't actually involve analyzing input data.
164 flagstest_debug.o: constructor_test.cc
165 $(CXXCOMPILE) -O0 -g -c -o $@ $<
166 flagstest_ndebug.o: constructor_test.cc
167 $(CXXCOMPILE) -O0 -c -o $@ $<
168
169 check_SCRIPTS += incremental_test.sh
170 check_DATA += incremental_test.stdout
171 MOSTLYCLEANFILES += incremental_test incremental_test.cmdline
172 incremental_test_1.o: incremental_test_1.c
173 $(COMPILE) -O0 -c -ffunction-sections -g -o $@ $<
174 incremental_test_2.o: incremental_test_2.c
175 $(COMPILE) -O0 -c -ffunction-sections -g -o $@ $<
176 incremental_test: incremental_test_1.o incremental_test_2.o gcctestdir/ld
177 $(LINK) -Bgcctestdir/ -Wl,--incremental-full -Wl,-z,norelro incremental_test_1.o incremental_test_2.o -Wl,-debug 2> incremental_test.cmdline
178 incremental_test.stdout: incremental_test ../incremental-dump
179 ../incremental-dump incremental_test > $@
180
181 check_SCRIPTS += gc_comdat_test.sh
182 check_DATA += gc_comdat_test.stdout
183 MOSTLYCLEANFILES += gc_comdat_test
184 gc_comdat_test_1.o: gc_comdat_test_1.cc
185 $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
186 gc_comdat_test_2.o: gc_comdat_test_2.cc
187 $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
188 gc_comdat_test: gc_comdat_test_1.o gc_comdat_test_2.o gcctestdir/ld
189 $(CXXLINK) -Bgcctestdir/ -Wl,--gc-sections gc_comdat_test_1.o gc_comdat_test_2.o
190 gc_comdat_test.stdout: gc_comdat_test
191 $(TEST_NM) -C gc_comdat_test > gc_comdat_test.stdout
192
193 check_SCRIPTS += gc_tls_test.sh
194 check_DATA += gc_tls_test.stdout
195 MOSTLYCLEANFILES += gc_tls_test
196 gc_tls_test.o: gc_tls_test.cc
197 $(CXXCOMPILE) -O0 -c -g -o $@ $<
198 gc_tls_test:gc_tls_test.o gcctestdir/ld
199 $(CXXLINK) -Bgcctestdir/ -Wl,--gc-sections gc_tls_test.o
200 gc_tls_test.stdout: gc_tls_test
201 $(TEST_NM) -C gc_tls_test > gc_tls_test.stdout
202
203 check_SCRIPTS += gc_orphan_section_test.sh
204 check_DATA += gc_orphan_section_test.stdout
205 MOSTLYCLEANFILES += gc_orphan_section_test
206 gc_orphan_section_test.o: gc_orphan_section_test.cc
207 $(CXXCOMPILE) -O0 -c -g -o $@ $<
208 gc_orphan_section_test:gc_orphan_section_test.o gcctestdir/ld
209 $(CXXLINK) -Bgcctestdir/ -Wl,--gc-sections gc_orphan_section_test.o
210 gc_orphan_section_test.stdout: gc_orphan_section_test
211 $(TEST_NM) gc_orphan_section_test > gc_orphan_section_test.stdout
212
213 check_SCRIPTS += pr14265.sh
214 check_DATA += pr14265.stdout
215 MOSTLYCLEANFILES += pr14265
216 pr14265.o: pr14265.c
217 $(COMPILE) -O0 -c -o $@ $<
218 pr14265: pr14265.o gcctestdir/ld $(srcdir)/pr14265.t
219 $(LINK) -Bgcctestdir/ -Wl,--gc-sections -Wl,-T,$(srcdir)/pr14265.t -o $@ $<
220 pr14265.stdout: pr14265
221 $(TEST_NM) --format=bsd --numeric-sort $< > $@
222
223 check_SCRIPTS += pr20717.sh
224 check_DATA += pr20717.stdout
225 MOSTLYCLEANFILES += pr20717
226 pr20717.o: pr20717.c
227 $(COMPILE) -O0 -ffunction-sections -c -o $@ $<
228 pr20717: pr20717.o gcctestdir/ld $(srcdir)/pr20717.t
229 $(LINK) -Bgcctestdir/ -Wl,--gc-sections -Wl,-T,$(srcdir)/pr20717.t -o $@ $<
230 pr20717.stdout: pr20717
231 $(TEST_NM) $< > $@
232
233 check_SCRIPTS += gc_dynamic_list_test.sh
234 check_DATA += gc_dynamic_list_test.stdout
235 MOSTLYCLEANFILES += gc_dynamic_list_test
236 gc_dynamic_list_test.o: gc_dynamic_list_test.c
237 $(COMPILE) -c -ffunction-sections -o $@ $<
238 gc_dynamic_list_test: gc_dynamic_list_test.o gcctestdir/ld $(srcdir)/gc_dynamic_list_test.t
239 $(LINK) -Bgcctestdir/ -Wl,--gc-sections -Wl,--dynamic-list,$(srcdir)/gc_dynamic_list_test.t gc_dynamic_list_test.o
240 gc_dynamic_list_test.stdout: gc_dynamic_list_test
241 $(TEST_NM) gc_dynamic_list_test > $@
242
243 check_SCRIPTS += icf_test.sh
244 check_DATA += icf_test.map
245 MOSTLYCLEANFILES += icf_test icf_test.map
246 icf_test.o: icf_test.cc
247 $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
248 icf_test: icf_test.o gcctestdir/ld
249 $(CXXLINK) -o icf_test -Bgcctestdir/ -Wl,--icf=all,-Map,icf_test.map icf_test.o
250 icf_test.map: icf_test
251 @touch icf_test.map
252
253 check_SCRIPTS += icf_keep_unique_test.sh
254 check_DATA += icf_keep_unique_test.stdout
255 MOSTLYCLEANFILES += icf_keep_unique_test
256 icf_keep_unique_test.o: icf_keep_unique_test.cc
257 $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
258 icf_keep_unique_test: icf_keep_unique_test.o gcctestdir/ld
259 $(CXXLINK) -Bgcctestdir/ -Wl,--icf=all -Wl,--keep-unique,_Z11unique_funcv icf_keep_unique_test.o
260 icf_keep_unique_test.stdout: icf_keep_unique_test
261 $(TEST_NM) -C $< > $@
262
263 check_SCRIPTS += icf_safe_test.sh
264 check_DATA += icf_safe_test_1.stdout icf_safe_test_2.stdout icf_safe_test.map
265 MOSTLYCLEANFILES += icf_safe_test icf_safe_test.map
266 icf_safe_test.o: icf_safe_test.cc
267 $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
268 icf_safe_test: icf_safe_test.o gcctestdir/ld
269 $(CXXLINK) -o icf_safe_test -Bgcctestdir/ -Wl,--icf=safe,-Map,icf_safe_test.map icf_safe_test.o
270 icf_safe_test.map: icf_safe_test
271 @touch icf_safe_test.map
272 icf_safe_test_1.stdout: icf_safe_test
273 $(TEST_NM) $< > $@
274 icf_safe_test_2.stdout: icf_safe_test
275 $(TEST_READELF) -h $< > $@
276
277 check_SCRIPTS += icf_safe_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 gcctestdir/ld
769 $(CXXLINK) -Bgcctestdir/ -shared weak_undef_file1.o
770 alt/weak_undef_lib.so: weak_undef_file2.o gcctestdir/ld
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 ../ld-new
1055 ../ld-new -Bsymbolic -shared -melf_x86_64 -o $@ $<
1056 x86_64_mov_to_lea2: x86_64_mov_to_lea1.o ../ld-new
1057 ../ld-new -pie -melf_x86_64 -o $@ $<
1058 x86_64_mov_to_lea3: x86_64_mov_to_lea1.o ../ld-new
1059 ../ld-new -melf_x86_64 -o $@ $<
1060 x86_64_mov_to_lea4: x86_64_mov_to_lea2.o ../ld-new
1061 ../ld-new -Bsymbolic -shared -melf32_x86_64 -o $@ $<
1062 x86_64_mov_to_lea5: x86_64_mov_to_lea2.o ../ld-new
1063 ../ld-new -pie -melf32_x86_64 -o $@ $<
1064 x86_64_mov_to_lea6: x86_64_mov_to_lea2.o ../ld-new
1065 ../ld-new -melf32_x86_64 -o $@ $<
1066 x86_64_mov_to_lea7: x86_64_mov_to_lea3.o ../ld-new
1067 ../ld-new -melf32_x86_64 -pie -o $@ $<
1068 x86_64_mov_to_lea8: x86_64_mov_to_lea4.o ../ld-new
1069 ../ld-new -melf_x86_64 -pie -o $@ $<
1070 x86_64_mov_to_lea9: x86_64_mov_to_lea5.o ../ld-new
1071 ../ld-new -melf32_x86_64 -o $@ $<
1072 x86_64_mov_to_lea10: x86_64_mov_to_lea6.o ../ld-new
1073 ../ld-new -melf_x86_64 -o $@ $<
1074 x86_64_mov_to_lea11: x86_64_mov_to_lea2.o ../ld-new
1075 ../ld-new -melf32_x86_64 -shared -o $@ $<
1076 x86_64_mov_to_lea12: x86_64_mov_to_lea1.o ../ld-new
1077 ../ld-new -melf_x86_64 -shared -o $@ $<
1078 x86_64_mov_to_lea13: x86_64_mov_to_lea7.o ../ld-new
1079 ../ld-new -melf32_x86_64 -shared -o $@ $<
1080 x86_64_mov_to_lea14: x86_64_mov_to_lea8.o ../ld-new
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 ../ld-new
1241 ../ld-new -Bsymbolic -shared -melf_i386 -o $@ $<
1242 i386_mov_to_lea2: i386_mov_to_lea1.o ../ld-new
1243 ../ld-new -pie -melf_i386 -o $@ $<
1244 i386_mov_to_lea3: i386_mov_to_lea1.o ../ld-new
1245 ../ld-new -melf_i386 -o $@ $<
1246 i386_mov_to_lea4: i386_mov_to_lea1.o ../ld-new
1247 ../ld-new -melf_i386 -shared -o $@ $<
1248 i386_mov_to_lea5: i386_mov_to_lea2.o ../ld-new
1249 ../ld-new -melf_i386 -shared -o $@ $<
1250 i386_mov_to_lea6: i386_mov_to_lea3.o ../ld-new
1251 ../ld-new -melf_i386 -shared -o $@ $<
1252 i386_mov_to_lea7: i386_mov_to_lea4.o ../ld-new
1253 ../ld-new -melf_i386 -shared -o $@ $<
1254 i386_mov_to_lea8: i386_mov_to_lea5.o ../ld-new
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_SCRIPTS += ver_test_8.sh
1743 check_DATA += ver_test_8_2.so.syms
1744 ver_test_8_2.so.syms: ver_test_8_2.so
1745 $(TEST_READELF) -s $< >$@ 2>/dev/null
1746
1747 check_PROGRAMS += ver_test_9
1748 ver_test_9_SOURCES = ver_test_main.cc
1749 ver_test_9_DEPENDENCIES = gcctestdir/ld ver_test_9.so
1750 ver_test_9_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1751 ver_test_9_LDADD = ver_test_9.so
1752 ver_test_9.so: ver_test_9.o ver_test_4.so ver_test_5.so gcctestdir/ld
1753 $(CXXLINK) -Bgcctestdir/ -shared -Wl,-R,. ver_test_9.o ver_test_5.so ver_test_4.so
1754 ver_test_9.o: ver_test_9.cc
1755 $(CXXCOMPILE) -c -fpic -o $@ $<
1756
1757 check_SCRIPTS += ver_test_10.sh
1758 check_DATA += ver_test_10.syms
1759 ver_test_10.syms: ver_test_10.so
1760 $(TEST_READELF) -s $< >$@ 2>/dev/null
1761 ver_test_10.so: gcctestdir/ld ver_test_2.o ver_test_10.script
1762 $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_10.script ver_test_2.o
1763
1764 check_PROGRAMS += ver_test_11
1765 MOSTLYCLEANFILES += ver_test_11.a
1766 ver_test_11_SOURCES = ver_test_main_2.cc
1767 ver_test_11_DEPENDENCIES = gcctestdir/ld ver_test_11.a
1768 ver_test_11_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1769 ver_test_11_LDADD = ver_test_11.a
1770 ver_test_11.a: ver_test_1.o ver_test_2.o ver_test_4.o
1771 $(TEST_AR) rc $@ $^
1772
1773 check_PROGRAMS += ver_test_12
1774 ver_test_12_SOURCES = ver_test_main_2.cc
1775 ver_test_12_DEPENDENCIES = gcctestdir/ld ver_test_12.o
1776 ver_test_12_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1777 ver_test_12_LDADD = ver_test_12.o
1778 ver_test_12.o: gcctestdir/ld ver_test_1.o ver_test_2.o ver_test_4.o
1779 gcctestdir/ld -r -o $@ ver_test_1.o ver_test_2.o ver_test_4.o
1780
1781 check_SCRIPTS += ver_test_13.sh
1782 check_DATA += ver_test_13.syms
1783 ver_test_13.syms: ver_test_13.so
1784 $(TEST_READELF) -s $< >$@ 2>/dev/null
1785 ver_test_13.so: gcctestdir/ld ver_test_13.o ver_test_13.script
1786 $(LINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_13.script ver_test_13.o
1787 ver_test_13.o: ver_test_13.c
1788 $(COMPILE) -c -fpic -o $@ $<
1789
1790 check_PROGRAMS += protected_1
1791 protected_1_SOURCES = \
1792 protected_main_1.cc protected_main_2.cc protected_main_3.cc
1793 protected_1_DEPENDENCIES = gcctestdir/ld protected_1.so
1794 protected_1_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1795 protected_1_LDADD = protected_1.so
1796
1797 protected_1.so: gcctestdir/ld protected_1_pic.o protected_2_pic.o protected_3_pic.o
1798 $(CXXLINK) -Bgcctestdir/ -shared protected_1_pic.o protected_2_pic.o protected_3_pic.o
1799 protected_1_pic.o: protected_1.cc
1800 $(CXXCOMPILE) -c -fpic -o $@ $<
1801 protected_2_pic.o: protected_2.cc
1802 $(CXXCOMPILE) -c -fpic -o $@ $<
1803 protected_3_pic.o: protected_3.cc
1804 $(CXXCOMPILE) -c -fpic -o $@ $<
1805
1806 check_PROGRAMS += protected_2
1807 protected_2_SOURCES = protected_main_1.cc protected_3.cc
1808 protected_2_DEPENDENCIES = gcctestdir/ld protected_1.so
1809 protected_2_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1810 protected_2_LDADD = protected_1.so
1811
1812 check_DATA += protected_3.err
1813 MOSTLYCLEANFILES += protected_3.err
1814 protected_4_pic.o: protected_4.cc
1815 $(CXXCOMPILE) -c -fpic -o $@ $<
1816 protected_3.err: protected_4_pic.o gcctestdir/ld
1817 @echo $(CXXLINK) -Bgcctestdir/ -shared -o protected_4.so protected_4_pic.o "2>$@"
1818 @if $(CXXLINK) -Bgcctestdir/ -shared -o protected_4.so protected_4_pic.o 2>$@; then \
1819 echo 1>&2 "Link of protected_4.so should have failed"; \
1820 rm -f $@; \
1821 exit 1; \
1822 fi
1823
1824 check_PROGRAMS += relro_test
1825 check_SCRIPTS += relro_test.sh
1826 check_DATA += relro_test.stdout
1827 relro_test_SOURCES = relro_test_main.cc
1828 relro_test_DEPENDENCIES = gcctestdir/ld relro_test.so
1829 relro_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1830 relro_test_LDADD = relro_test.so
1831 relro_test.so: gcctestdir/ld relro_test_pic.o
1832 $(CXXLINK) -Bgcctestdir/ -shared -Wl,-z,relro relro_test_pic.o
1833 relro_test_pic.o: relro_test.cc
1834 $(CXXCOMPILE) -c -fpic -o $@ $<
1835 relro_test.stdout: relro_test.so
1836 $(TEST_READELF) -SlW relro_test.so > relro_test.stdout
1837
1838 check_PROGRAMS += relro_now_test
1839 relro_now_test_SOURCES = relro_test_main.cc
1840 relro_now_test_DEPENDENCIES = gcctestdir/ld relro_now_test.so
1841 relro_now_test_LDFLAGS = -Bgcctestdir -Wl,-R,. -Wl,-z,relro -Wl,-z,now
1842 relro_now_test_LDADD = relro_now_test.so
1843 relro_now_test.so: gcctestdir/ld relro_test_pic.o
1844 $(CXXLINK) -Bgcctestdir/ -shared -Wl,-z,relro -Wl,-z,now relro_test_pic.o
1845
1846 check_PROGRAMS += relro_strip_test
1847 relro_strip_test_SOURCES = relro_test_main.cc
1848 relro_strip_test_DEPENDENCIES = gcctestdir/ld relro_strip_test.so
1849 relro_strip_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1850 relro_strip_test_LDADD = relro_strip_test.so
1851 relro_strip_test.so: relro_test.so
1852 $(TEST_STRIP) -o $@ $<
1853
1854 check_PROGRAMS += relro_script_test
1855 relro_script_test_SOURCES = relro_test_main.cc
1856 relro_script_test_DEPENDENCIES = gcctestdir/ld relro_script_test.so
1857 relro_script_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1858 relro_script_test_LDADD = relro_script_test.so
1859 relro_script_test.so: gcctestdir/ld relro_script_test.t relro_test_pic.o
1860 $(CXXLINK) -Bgcctestdir/ -shared -Wl,-z,relro -Wl,-T,$(srcdir)/relro_script_test.t relro_test_pic.o
1861
1862 check_PROGRAMS += script_test_1
1863 script_test_1_SOURCES = script_test_1a.cc script_test_1b.cc
1864 script_test_1_DEPENDENCIES = gcctestdir/ld script_test_1.t
1865 script_test_1_LDFLAGS = -Bgcctestdir/ -Wl,-R,. -Wl,-T,$(srcdir)/script_test_1.t
1866 script_test_1_LDADD =
1867
1868 check_PROGRAMS += script_test_2
1869 script_test_2_SOURCES = script_test_2.cc script_test_2a.cc script_test_2b.cc
1870 script_test_2_DEPENDENCIES = gcctestdir/ld script_test_2.t
1871 script_test_2_LDFLAGS = -Bgcctestdir/ -Wl,-R,. -Wl,-T,$(srcdir)/script_test_2.t
1872 script_test_2_LDADD =
1873
1874 check_PROGRAMS += justsyms
1875 justsyms_SOURCES = justsyms_1.cc
1876 justsyms_DEPENDENCIES = gcctestdir/ld justsyms_2r.o
1877 justsyms_LDFLAGS = -Bgcctestdir/ -Wl,-R,justsyms_2r.o
1878 justsyms_LDADD =
1879 justsyms_2.o: justsyms_2.cc
1880 $(CXXCOMPILE) -c -o $@ $<
1881 justsyms_2r.o: justsyms_2.o gcctestdir/ld $(srcdir)/justsyms.t
1882 gcctestdir/ld -o $@ -r -T $(srcdir)/justsyms.t justsyms_2.o
1883
1884 check_PROGRAMS += justsyms_exec
1885 justsyms_exec_SOURCES = justsyms_exec.c
1886 justsyms_exec_DEPENDENCIES = gcctestdir/ld justsyms_lib
1887 justsyms_exec_LDFLAGS = -Bgcctestdir/ -Wl,-R,justsyms_lib
1888 justsyms_exec_LDADD =
1889 MOSTLYCLEANFILES += justsyms_lib
1890 justsyms_lib.o: justsyms_lib.c
1891 $(COMPILE) -c -o $@ $<
1892 justsyms_lib: justsyms_lib.o gcctestdir/ld
1893 gcctestdir/ld -o $@ -Ttext=0x1000200 -Tdata=0x2000000 -e exported_func justsyms_lib.o
1894
1895 check_PROGRAMS += binary_test
1896 MOSTLYCLEANFILES += binary.txt
1897 binary_test_SOURCES = binary_test.cc
1898 binary_test_DEPENDENCIES = gcctestdir/ld binary.txt
1899 binary_test_LDFLAGS = -Bgcctestdir/ -Wl,--format,binary,binary.txt,--format,elf
1900 binary_test_LDADD =
1901 # Copy the file to the build directory to avoid worrying about the
1902 # full pathname in the generated symbols.
1903 binary.txt: $(srcdir)/binary.in
1904 rm -f $@
1905 $(LN_S) $< $@
1906
1907 check_SCRIPTS += ver_matching_test.sh
1908 check_DATA += ver_matching_test.stdout
1909 MOSTLYCLEANFILES += ver_matching_test.stdout
1910 ver_matching_def.so: ver_matching_def_pic.o $(srcdir)/version_script.map gcctestdir/ld
1911 $(CXXLINK) -O0 -Bgcctestdir/ -shared ver_matching_def_pic.o -Wl,--version-script=$(srcdir)/version_script.map
1912 ver_matching_def_pic.o: ver_matching_def.cc
1913 $(CXXCOMPILE) -O0 -c -fpic -o $@ $<
1914 ver_matching_test.stdout: ver_matching_def.so
1915 $(TEST_OBJDUMP) -T ver_matching_def.so | $(TEST_CXXFILT) > ver_matching_test.stdout
1916
1917 check_PROGRAMS += script_test_3
1918 check_SCRIPTS += script_test_3.sh
1919 check_DATA += script_test_3.stdout
1920 MOSTLYCLEANFILES += script_test_3.stdout
1921 script_test_3: basic_test.o gcctestdir/ld script_test_3.t
1922 $(CXXLINK) -Bgcctestdir/ basic_test.o -Wl,-T,$(srcdir)/script_test_3.t
1923 script_test_3.stdout: script_test_3
1924 $(TEST_READELF) -SlW script_test_3 > script_test_3.stdout
1925
1926 check_PROGRAMS += tls_phdrs_script_test
1927 tls_phdrs_script_test_SOURCES = $(tls_test_SOURCES)
1928 tls_phdrs_script_test_DEPENDENCIES = $(tls_test_DEPENDENCIES) $(srcdir)/script_test_3.t
1929 tls_phdrs_script_test_LDFLAGS = $(tls_test_LDFLAGS) -Wl,-T,$(srcdir)/script_test_3.t
1930 tls_phdrs_script_test_LDADD = $(tls_test_LDADD)
1931
1932 check_SCRIPTS += script_test_4.sh
1933 check_DATA += script_test_4.stdout
1934 MOSTLYCLEANFILES += script_test_4
1935 script_test_4: basic_test.o gcctestdir/ld $(srcdir)/script_test_4.t
1936 $(CXXLINK) -Bgcctestdir/ basic_test.o -Wl,-T,$(srcdir)/script_test_4.t
1937 script_test_4.stdout: script_test_4
1938 $(TEST_READELF) -SlW script_test_4 > script_test_4.stdout
1939
1940 check_PROGRAMS += tls_script_test
1941 tls_script_test_SOURCES = $(tls_test_SOURCES)
1942 tls_script_test_DEPENDENCIES = $(tls_test_DEPENDENCIES) $(srcdir)/script_test_4.t
1943 tls_script_test_LDFLAGS = $(tls_test_LDFLAGS) -Wl,-T,$(srcdir)/script_test_4.t
1944 tls_script_test_LDADD = $(tls_test_LDADD)
1945
1946 check_SCRIPTS += script_test_5.sh
1947 check_DATA += script_test_5.stdout
1948 MOSTLYCLEANFILES += script_test_5
1949 script_test_5: script_test_5.o gcctestdir/ld $(srcdir)/script_test_5.t
1950 $(CXXLINK) -Bgcctestdir/ script_test_5.o -Wl,-T,$(srcdir)/script_test_5.t
1951 script_test_5.stdout: script_test_5
1952 $(TEST_READELF) -SW script_test_5 > script_test_5.stdout
1953
1954 check_SCRIPTS += script_test_6.sh
1955 check_DATA += script_test_6.stdout
1956 MOSTLYCLEANFILES += script_test_6
1957 script_test_6: basic_test.o gcctestdir/ld $(srcdir)/script_test_6.t
1958 $(CXXLINK) -Bgcctestdir/ basic_test.o -Wl,-T,$(srcdir)/script_test_6.t \
1959 -Wl,-Ttext=0x10001000 -Wl,-Tdata=0x10200000 -Wl,-Tbss=0x10400000
1960 script_test_6.stdout: script_test_6
1961 $(TEST_READELF) -SlW script_test_6 > script_test_6.stdout
1962
1963 check_SCRIPTS += script_test_7.sh
1964 check_DATA += script_test_7.stdout
1965 MOSTLYCLEANFILES += script_test_7
1966 script_test_7: basic_test.o gcctestdir/ld $(srcdir)/script_test_7.t
1967 $(CXXLINK) -Bgcctestdir/ basic_test.o -Wl,-T,$(srcdir)/script_test_7.t
1968 script_test_7.stdout: script_test_7
1969 $(TEST_READELF) -SlW script_test_7 > script_test_7.stdout
1970
1971 check_SCRIPTS += script_test_8.sh
1972 check_DATA += script_test_8.stdout
1973 MOSTLYCLEANFILES += script_test_8
1974 script_test_8: basic_test.o gcctestdir/ld $(srcdir)/script_test_7.t
1975 $(CXXLINK) -Bgcctestdir/ basic_test.o -Wl,-T,$(srcdir)/script_test_7.t \
1976 -Wl,-Ttext=0x20001000 -Wl,-Tdata=0x20200000 -Wl,-Tbss=0x20400000
1977 script_test_8.stdout: script_test_8
1978 $(TEST_READELF) -SlW script_test_8 > script_test_8.stdout
1979
1980 check_SCRIPTS += script_test_9.sh
1981 check_DATA += script_test_9.stdout
1982 MOSTLYCLEANFILES += script_test_9
1983 script_test_9.o: script_test_9.cc
1984 $(CXXCOMPILE) -O0 -c -o $@ $<
1985 script_test_9: gcctestdir/ld $(srcdir)/script_test_9.t script_test_9.o
1986 $(CXXLINK) -Bgcctestdir/ script_test_9.o -Wl,-T,$(srcdir)/script_test_9.t
1987 script_test_9.stdout: script_test_9
1988 $(TEST_READELF) -lW script_test_9 > script_test_9.stdout
1989
1990 # Test scripts with a relocatable link.
1991 # The -g option is necessary to trigger a bug where a section
1992 # declared in a script file is assigned a non-zero starting address.
1993 check_PROGRAMS += script_test_11
1994 script_test_11: gcctestdir/ld script_test_11_r.o
1995 $(LINK) -Bgcctestdir/ script_test_11_r.o
1996 script_test_11_r.o: gcctestdir/ld $(srcdir)/script_test_11.t script_test_11a.o script_test_11b.o
1997 gcctestdir/ld -r -o $@ -T $(srcdir)/script_test_11.t script_test_11a.o script_test_11b.o
1998 script_test_11a.o: script_test_11a.c
1999 $(COMPILE) -c -g -o $@ $<
2000 script_test_11b.o: script_test_11b.c
2001 $(COMPILE) -c -g -o $@ $<
2002
2003 # Test difference between "*(a b)" and "*(a) *(b)" in input section spec.
2004 check_PROGRAMS += script_test_12
2005 script_test_12: gcctestdir/ld $(srcdir)/script_test_12.t script_test_12a.o script_test_12b.o
2006 $(LINK) -Bgcctestdir/ -Wl,-T,$(srcdir)/script_test_12.t script_test_12a.o script_test_12b.o
2007
2008 check_PROGRAMS += script_test_12i
2009 script_test_12i: gcctestdir/ld $(srcdir)/script_test_12i.t script_test_12a.o script_test_12b.o
2010 $(LINK) -Bgcctestdir/ -Wl,-T,$(srcdir)/script_test_12i.t script_test_12a.o script_test_12b.o
2011 script_test_12a.o: script_test_12a.c
2012 $(COMPILE) -O0 -c -o $@ $<
2013 script_test_12b.o: script_test_12b.c
2014 $(COMPILE) -O0 -c -o $@ $<
2015
2016 # Test for ordering internally created sections with a linker script.
2017 check_SCRIPTS += script_test_13.sh
2018 check_DATA += script_test_13.stdout
2019 MOSTLYCLEANFILES += script_test_13
2020 script_test_13.o: script_test_13.c
2021 $(COMPILE) -O0 -c -fPIC -o $@ $<
2022 script_test_13: $(srcdir)/script_test_13.t script_test_13.o gcctestdir/ld
2023 gcctestdir/ld -shared -o $@ script_test_13.o -T $(srcdir)/script_test_13.t
2024 script_test_13.stdout: script_test_13
2025 $(TEST_READELF) -SW script_test_13 > $@
2026
2027 # Test for SORT_BY_INIT_PRIORITY.
2028 check_SCRIPTS += script_test_14.sh
2029 check_DATA += script_test_14.stdout
2030 MOSTLYCLEANFILES += script_test_14
2031 script_test_14.o: script_test_14.s
2032 $(TEST_AS) -o $@ $<
2033 script_test_14: $(srcdir)/script_test_14.t script_test_14.o gcctestdir/ld
2034 gcctestdir/ld -o $@ script_test_14.o -T $(srcdir)/script_test_14.t
2035 script_test_14.stdout: script_test_14
2036 $(TEST_OBJDUMP) -s script_test_14 > $@
2037
2038 # Test BSS section placement at end of segment.
2039 check_SCRIPTS += script_test_15a.sh
2040 check_DATA += script_test_15a.stdout
2041 MOSTLYCLEANFILES += script_test_15a
2042 script_test_15a: $(srcdir)/script_test_15a.t script_test_15.o gcctestdir/ld
2043 gcctestdir/ld -o $@ script_test_15.o -T $(srcdir)/script_test_15a.t
2044 script_test_15a.stdout: script_test_15a
2045 $(TEST_READELF) -lSW script_test_15a > $@
2046
2047 # Test BSS section placement in middle of segment.
2048 check_SCRIPTS += script_test_15b.sh
2049 check_DATA += script_test_15b.stdout
2050 MOSTLYCLEANFILES += script_test_15b
2051 script_test_15b: $(srcdir)/script_test_15b.t script_test_15.o gcctestdir/ld
2052 gcctestdir/ld -o $@ script_test_15.o -T $(srcdir)/script_test_15b.t
2053 script_test_15b.stdout: script_test_15b
2054 $(TEST_READELF) -lSW script_test_15b > $@
2055
2056 # Test orphan BSS section placement.
2057 check_SCRIPTS += script_test_15c.sh
2058 check_DATA += script_test_15c.stdout
2059 MOSTLYCLEANFILES += script_test_15c
2060 script_test_15c: $(srcdir)/script_test_15c.t script_test_15.o gcctestdir/ld
2061 gcctestdir/ld -o $@ script_test_15.o -T $(srcdir)/script_test_15c.t
2062 script_test_15c.stdout: script_test_15c
2063 $(TEST_READELF) -lSW script_test_15c > $@
2064
2065 # Test --dynamic-list, --dynamic-list-data, --dynamic-list-cpp-new,
2066 # and --dynamic-list-cpp-typeinfo
2067
2068 check_SCRIPTS += dynamic_list.sh
2069 check_DATA += dynamic_list.stdout
2070 MOSTLYCLEANFILES += dynamic_list dynamic_list.stdout
2071 dynamic_list: basic_test.o gcctestdir/ld $(srcdir)/dynamic_list.t
2072 $(CXXLINK) -Bgcctestdir/ basic_test.o \
2073 -Wl,--dynamic-list $(srcdir)/dynamic_list.t \
2074 -Wl,--dynamic-list-data \
2075 -Wl,--dynamic-list-cpp-new \
2076 -Wl,--dynamic-list-cpp-typeinfo
2077 dynamic_list.stdout: dynamic_list
2078 $(TEST_READELF) -W --dyn-syms dynamic_list > dynamic_list.stdout
2079
2080 check_PROGRAMS += dynamic_list_2
2081 dynamic_list_2_SOURCES = dynamic_list_2.cc
2082 dynamic_list_2_DEPENDENCIES = gcctestdir/ld dynamic_list_lib1.so dynamic_list_lib2.so
2083 dynamic_list_2_LDFLAGS = -Bgcctestdir/ -L. -Wl,-R,. -Wl,--no-as-needed
2084 dynamic_list_2_LDADD = dynamic_list_lib1.so dynamic_list_lib2.so
2085
2086 dynamic_list_lib1.so: gcctestdir/ld dynamic_list_lib1.o
2087 $(CXXLINK) -Bgcctestdir/ -shared dynamic_list_lib1.o
2088 dynamic_list_lib1.o: dynamic_list_lib1.cc
2089 $(CXXCOMPILE) -c -fpic -o $@ $<
2090
2091 dynamic_list_lib2.so: gcctestdir/ld dynamic_list_lib2.o $(srcdir)/dynamic_list_2.t
2092 $(CXXLINK) -Bgcctestdir/ -shared -Wl,-Bsymbolic-functions -Wl,--dynamic-list,$(srcdir)/dynamic_list_2.t dynamic_list_lib2.o
2093 dynamic_list_lib2.o: dynamic_list_lib2.cc
2094 $(CXXCOMPILE) -c -fpic -o $@ $<
2095
2096 check_PROGRAMS += thin_archive_test_1
2097 MOSTLYCLEANFILES += libthin1.a libthin3.a libthinall.a \
2098 alt/thin_archive_test_2.o alt/thin_archive_test_4.o \
2099 alt/libthin2.a alt/libthin4.a
2100 thin_archive_test_1_SOURCES = thin_archive_main.cc
2101 thin_archive_test_1_DEPENDENCIES = gcctestdir/ld libthin1.a alt/libthin2.a
2102 thin_archive_test_1_LDFLAGS = -Bgcctestdir/ -Lalt
2103 thin_archive_test_1_LDADD = libthin1.a -lthin2
2104
2105 check_PROGRAMS += thin_archive_test_2
2106 thin_archive_test_2_SOURCES = thin_archive_main.cc
2107 thin_archive_test_2_DEPENDENCIES = gcctestdir/ld libthinall.a
2108 thin_archive_test_2_LDFLAGS = -Bgcctestdir/ -L.
2109 thin_archive_test_2_LDADD = -lthinall
2110
2111 libthin1.a: thin_archive_test_1.o alt/thin_archive_test_2.o
2112 rm -f $@
2113 $(TEST_AR) crT $@ $^
2114 alt/libthin2.a: thin_archive_test_3.o alt/thin_archive_test_4.o
2115 rm -f $@
2116 $(TEST_AR) crT $@ $^
2117 libthin3.a: thin_archive_test_1.o alt/thin_archive_test_4.o
2118 rm -f $@
2119 $(TEST_AR) crT $@ $^
2120 alt/libthin4.a: alt/thin_archive_test_2.o thin_archive_test_3.o
2121 rm -f $@
2122 $(TEST_AR) crT $@ $^
2123 libthinall.a: libthin3.a alt/libthin4.a
2124 rm -f $@
2125 $(TEST_AR) crT $@ $^
2126 alt/thin_archive_test_2.o: thin_archive_test_2.cc
2127 test -d alt || mkdir -p alt
2128 $(CXXCOMPILE) -c -o $@ $<
2129 alt/thin_archive_test_4.o: thin_archive_test_4.cc
2130 test -d alt || mkdir -p alt
2131 $(CXXCOMPILE) -c -o $@ $<
2132
2133 if PLUGINS
2134
2135 check_PROGRAMS += plugin_test_1
2136 check_SCRIPTS += plugin_test_1.sh
2137 check_DATA += plugin_test_1.err
2138 MOSTLYCLEANFILES += plugin_test_1.err
2139 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
2140 $(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
2141 plugin_test_1.err: plugin_test_1
2142 @touch plugin_test_1.err
2143
2144 check_PROGRAMS += plugin_test_2
2145 check_SCRIPTS += plugin_test_2.sh
2146 check_DATA += plugin_test_2.err
2147 MOSTLYCLEANFILES += plugin_test_2.err
2148 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
2149 $(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
2150 plugin_test_2.err: plugin_test_2
2151 @touch plugin_test_2.err
2152
2153 check_PROGRAMS += plugin_test_3
2154 check_SCRIPTS += plugin_test_3.sh
2155 check_DATA += plugin_test_3.err
2156 MOSTLYCLEANFILES += plugin_test_3.err
2157 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
2158 $(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
2159 plugin_test_3.err: plugin_test_3
2160 @touch plugin_test_3.err
2161
2162 check_PROGRAMS += plugin_test_4
2163 check_SCRIPTS += plugin_test_4.sh
2164 check_DATA += plugin_test_4.err
2165 MOSTLYCLEANFILES += plugin_test_4.a plugin_test_4.err
2166 plugin_test_4: two_file_test_main.o plugin_test_4.a gcctestdir/ld plugin_test.so
2167 $(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
2168 plugin_test_4.err: plugin_test_4
2169 @touch plugin_test_4.err
2170
2171 plugin_test_4.a: two_file_test_1.o.syms two_file_test_1b.o.syms two_file_test_2.o.syms
2172 $(TEST_AR) cr $@ $^
2173
2174 check_PROGRAMS += plugin_test_5
2175 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
2176 $(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
2177
2178 check_PROGRAMS += plugin_test_6
2179 check_SCRIPTS += plugin_test_6.sh
2180 check_DATA += plugin_test_6.err
2181 MOSTLYCLEANFILES += plugin_test_6.err
2182 plugin_test_6: plugin_common_test_1.o.syms plugin_common_test_2.o.syms gcctestdir/ld plugin_test.so
2183 $(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
2184 plugin_test_6.err: plugin_test_6
2185 @touch plugin_test_6.err
2186
2187 check_PROGRAMS += plugin_test_7
2188 check_SCRIPTS += plugin_test_7.sh
2189 check_DATA += plugin_test_7.err plugin_test_7.o.syms
2190 MOSTLYCLEANFILES += plugin_test_7.err
2191 plugin_test_7: plugin_test_7_1.o plugin_test_7_1.o.syms plugin_test_7_2.o gcctestdir/ld plugin_test.so
2192 $(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
2193 plugin_test_7.o.syms: plugin_test_7
2194 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2195 plugin_test_7_1.o: plugin_test_7_1.c
2196 $(COMPILE) -DLTO -O0 -c -ffunction-sections -fdata-sections -o $@ $<
2197 plugin_test_7_1_orig.o: plugin_test_7_1.c
2198 $(COMPILE) -O0 -c -ffunction-sections -fdata-sections -o $@ $<
2199 plugin_test_7_1.o.syms: plugin_test_7_1_orig.o
2200 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2201 plugin_test_7_2.o: plugin_test_7_2.c
2202 $(COMPILE) -O0 -c -ffunction-sections -fdata-sections -o $@ $<
2203 plugin_test_7.err: plugin_test_7
2204
2205 # Test plugins with -r.
2206 check_PROGRAMS += plugin_test_8
2207 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
2208 ../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
2209 plugin_test_8: plugin_test_8.o gcctestdir/ld
2210 $(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle plugin_test_8.o
2211
2212 # Test that symbols known in the IR file but not in the replacement file
2213 # produce an unresolved symbol error.
2214 check_DATA += plugin_test_9.err
2215 MOSTLYCLEANFILES += plugin_test_9.err
2216 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
2217 @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>$@"
2218 @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 \
2219 echo 1>&2 "Link of plugin_test_9 should have failed"; \
2220 rm -f $@; \
2221 exit 1; \
2222 fi
2223 # Make a .syms file that claims to define the symbol _Z4t16av.
2224 two_file_test_1c.o.syms: two_file_test_1.o.syms two_file_test_1c.o
2225 cp two_file_test_1.o.syms $@.tmp
2226 grep "_Z4t16av" two_file_test_1b.o.syms >> $@.tmp
2227 mv -f $@.tmp $@
2228 # Make a copy of two_file_test_1.o, which does not define the symbol _Z4t16av.
2229 MOSTLYCLEANFILES += two_file_test_1c.o
2230 two_file_test_1c.o: two_file_test_1.o
2231 cp two_file_test_1.o $@
2232
2233 # As above, but check COMDAT case, where a non-IR file contains a duplicate
2234 # of a COMDAT group in an IR file.
2235 check_DATA += plugin_test_9b.err
2236 MOSTLYCLEANFILES += plugin_test_9b.err
2237 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
2238 @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>$@"
2239 @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 \
2240 echo 1>&2 "Link of plugin_test_9b should have failed"; \
2241 rm -f $@; \
2242 exit 1; \
2243 fi
2244 # Make a .syms file that claims to define a method in class A in a COMDAT group.
2245 # The real plugin_test_9b_ir.o will be compiled without the -D, and will not
2246 # define any methods in class A.
2247 plugin_test_9b_ir.o.syms: plugin_test_9b_ir_witha.o
2248 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2249 plugin_test_9b_ir_witha.o: plugin_test_9b_ir.cc
2250 $(CXXCOMPILE) -c -DUSE_CLASS_A -o $@ $<
2251
2252 check_PROGRAMS += plugin_test_10
2253 check_SCRIPTS += plugin_test_10.sh
2254 check_DATA += plugin_test_10.sections
2255 MOSTLYCLEANFILES += plugin_test_10.sections
2256 plugin_test_10: plugin_common_test_1.o.syms plugin_common_test_2.o gcctestdir/ld plugin_test.so
2257 $(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle,--plugin,"./plugin_test.so" plugin_common_test_1.o.syms plugin_common_test_2.o
2258 plugin_test_10.sections: plugin_test_10
2259 $(TEST_READELF) -SW $< >$@ 2>/dev/null
2260
2261 check_PROGRAMS += plugin_test_11
2262 check_SCRIPTS += plugin_test_11.sh
2263 check_DATA += plugin_test_11.err
2264 MOSTLYCLEANFILES += plugin_test_11.err plugin_test_thin.a
2265 PLUGIN_TEST_11_SYMS = two_file_test_1.o.syms two_file_test_1b.o.syms two_file_test_2.o.syms
2266 plugin_test_11: two_file_test_main.o plugin_test_thin.a gcctestdir/ld plugin_test.so $(PLUGIN_TEST_11_SYMS)
2267 $(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
2268 plugin_test_11.err: plugin_test_11
2269 @touch plugin_test_11.err
2270 plugin_test_thin.a: two_file_test_1.o two_file_test_1b.o two_file_test_2.o
2271 rm -f $@
2272 $(TEST_AR) crT $@ $^
2273
2274
2275 check_PROGRAMS += plugin_test_start_lib
2276 check_SCRIPTS += plugin_test_start_lib.sh
2277 check_DATA += plugin_test_start_lib.err
2278 MOSTLYCLEANFILES += plugin_test_start_lib.err
2279 plugin_test_start_lib: unused.o plugin_start_lib_test.o plugin_start_lib_test_2.syms gcctestdir/ld plugin_test.so
2280 $(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle,--plugin,"./plugin_test.so" plugin_start_lib_test.o \
2281 -Wl,--start-lib plugin_start_lib_test_2.syms -Wl,--end-lib 2>plugin_test_start_lib.err
2282 plugin_test_start_lib.err: plugin_test_start_lib
2283 @touch plugin_test_start_lib.err
2284
2285
2286 plugin_start_lib_test_2.syms: plugin_start_lib_test_2.o
2287 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2288
2289
2290 plugin_test.so: plugin_test.o gcctestdir/ld
2291 $(LINK) -Bgcctestdir/ -shared plugin_test.o
2292 plugin_test.o: plugin_test.c
2293 $(COMPILE) -O0 -c -fpic -o $@ $<
2294
2295 two_file_test_main.o.syms: two_file_test_main.o
2296 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2297 two_file_test_1.o.syms: two_file_test_1.o
2298 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2299 two_file_test_1b.o.syms: two_file_test_1b.o
2300 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2301 two_file_test_2.o.syms: two_file_test_2.o
2302 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2303 plugin_common_test_1.o.syms: plugin_common_test_1.o
2304 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2305 plugin_common_test_2.o.syms: plugin_common_test_2.o
2306 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2307
2308 empty.o.syms:
2309 @echo "" >$@
2310 @echo "Symbol table" >>$@
2311
2312 if TLS
2313
2314 check_PROGRAMS += plugin_test_tls
2315 check_SCRIPTS += plugin_test_tls.sh
2316 check_DATA += plugin_test_tls.err
2317 MOSTLYCLEANFILES += plugin_test_tls.err
2318 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
2319 $(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
2320 plugin_test_tls.err: plugin_test_tls
2321 @touch plugin_test_tls.err
2322
2323 two_file_test_2_tls.o.syms: two_file_test_2_tls.o
2324 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2325
2326 endif TLS
2327
2328 MOSTLYCLEANFILES += unused.c
2329 unused.o.syms: unused.o
2330 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2331 @echo " 1: 00000000 4 FUNC GLOBAL DEFAULT 1 UNUSED" >>$@
2332 unused.o: unused.c
2333 $(COMPILE) -c -o $@ $<
2334 unused.c:
2335 @cp /dev/null $@
2336
2337 check_SCRIPTS += plugin_final_layout.sh
2338 check_DATA += plugin_final_layout.stdout plugin_final_layout_readelf.stdout
2339 MOSTLYCLEANFILES += plugin_final_layout
2340 plugin_final_layout.o: plugin_final_layout.cc
2341 $(CXXCOMPILE) -O0 -c -ffunction-sections -fdata-sections -g -o $@ $<
2342 plugin_final_layout: plugin_final_layout.o plugin_section_order.so gcctestdir/ld
2343 $(CXXLINK) -Bgcctestdir/ -Wl,--plugin,"./plugin_section_order.so" plugin_final_layout.o
2344 plugin_final_layout.stdout: plugin_final_layout
2345 $(TEST_NM) -n --synthetic plugin_final_layout > plugin_final_layout.stdout
2346 plugin_final_layout_readelf.stdout: plugin_final_layout
2347 $(TEST_READELF) -Wl plugin_final_layout > plugin_final_layout_readelf.stdout
2348
2349 plugin_section_order.so: plugin_section_order.o gcctestdir/ld
2350 $(LINK) -Bgcctestdir/ -shared plugin_section_order.o
2351 plugin_section_order.o: plugin_section_order.c
2352 $(COMPILE) -O0 -c -fpic -o $@ $<
2353
2354 check_SCRIPTS += plugin_layout_with_alignment.sh
2355 check_DATA += plugin_layout_with_alignment.stdout
2356 MOSTLYCLEANFILES += plugin_layout_with_alignment
2357 plugin_layout_with_alignment.o: plugin_layout_with_alignment.c
2358 $(COMPILE) -O0 -c -ffunction-sections -fdata-sections -g -o $@ $<
2359 plugin_layout_with_alignment: plugin_layout_with_alignment.o plugin_section_alignment.so gcctestdir/ld
2360 $(LINK) -Bgcctestdir/ -Wl,--plugin,"./plugin_section_alignment.so" plugin_layout_with_alignment.o
2361 plugin_layout_with_alignment.stdout: plugin_layout_with_alignment
2362 $(TEST_NM) -n --synthetic plugin_layout_with_alignment > plugin_layout_with_alignment.stdout
2363
2364 plugin_section_alignment.so: plugin_section_alignment.o gcctestdir/ld
2365 $(CXXLINK) -Bgcctestdir/ -shared plugin_section_alignment.o
2366 plugin_section_alignment.o: plugin_section_alignment.cc
2367 $(CXXCOMPILE) -O0 -c -fpic -o $@ $<
2368
2369 endif PLUGINS
2370
2371 check_PROGRAMS += exclude_libs_test
2372 check_SCRIPTS += exclude_libs_test.sh
2373 check_DATA += exclude_libs_test.syms
2374 MOSTLYCLEANFILES += exclude_libs_test.syms libexclude_libs_test_1.a \
2375 libexclude_libs_test_2.a alt/libexclude_libs_test_3.a
2376 exclude_libs_test_SOURCES = exclude_libs_test.c
2377 exclude_libs_test_DEPENDENCIES = gcctestdir/ld libexclude_libs_test_1.a \
2378 libexclude_libs_test_2.a alt/libexclude_libs_test_3.a
2379 exclude_libs_test_LDFLAGS = -Bgcctestdir/ -L. -Lalt \
2380 -Wl,--exclude-libs,dummy:libexclude_libs_test_1 \
2381 -Wl,--exclude-libs,libexclude_libs_test_3
2382 exclude_libs_test_LDADD = -lexclude_libs_test_1 -lexclude_libs_test_2 \
2383 alt/libexclude_libs_test_3.a
2384 exclude_libs_test.syms: exclude_libs_test
2385 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2386 libexclude_libs_test_1.a: exclude_libs_test_1.o
2387 $(TEST_AR) rc $@ $^
2388 libexclude_libs_test_2.a: exclude_libs_test_2.o
2389 $(TEST_AR) rc $@ $^
2390 alt/libexclude_libs_test_3.a: exclude_libs_test_3.o
2391 test -d alt || mkdir -p alt
2392 $(TEST_AR) rc $@ $^
2393
2394 check_PROGRAMS += local_labels_test
2395 local_labels_test.o: ver_test_6.c
2396 $(COMPILE) -g -c -Wa,-L -o $@ $<
2397 local_labels_test: local_labels_test.o gcctestdir/ld
2398 $(LINK) -Bgcctestdir/ local_labels_test.o
2399
2400 check_PROGRAMS += discard_locals_test
2401 check_SCRIPTS += discard_locals_test.sh
2402 check_DATA += discard_locals_test.syms \
2403 discard_locals_relocatable_test1.syms \
2404 discard_locals_relocatable_test2.syms
2405 MOSTLYCLEANFILES += discard_locals_test.syms \
2406 discard_locals_relocatable_test1.syms \
2407 discard_locals_relocatable_test2.syms \
2408 discard_locals_relocatable_test1.out \
2409 discard_locals_relocatable_test2.out
2410 discard_locals_test_SOURCES = discard_locals_test.c
2411 discard_locals_test_LDFLAGS = -Bgcctestdir/ -Wl,--discard-locals
2412 discard_locals_test.syms: discard_locals_test
2413 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2414 # '-Wa,-L' is required to preserve the local label used for testing.
2415 discard_locals_test.o: discard_locals_test.c
2416 $(COMPILE) -c -Wa,-L -o $@ $<
2417
2418 discard_locals_relocatable_test1.syms: discard_locals_relocatable_test1.out
2419 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2420 discard_locals_relocatable_test.o: discard_locals_relocatable_test.c
2421 $(COMPILE) -c -Wa,-L -fPIC -o $@ $<
2422 discard_locals_relocatable_test1.out: discard_locals_relocatable_test.o ../ld-new
2423 ../ld-new --discard-locals -relocatable -o $@ $<
2424
2425 discard_locals_relocatable_test2.syms: discard_locals_relocatable_test2.out
2426 $(TEST_READELF) -sW $< >$@ 2>/dev/null
2427 discard_locals_relocatable_test2.out: discard_locals_relocatable_test.o ../ld-new
2428 ../ld-new --discard-all -relocatable -o $@ $<
2429
2430 if MCMODEL_MEDIUM
2431 check_PROGRAMS += large
2432 large_SOURCES = large.c
2433 large_CFLAGS = -mcmodel=medium
2434 large_DEPENDENCIES = gcctestdir/ld
2435 large_LDFLAGS = -Bgcctestdir/
2436 large_LDADD =
2437 endif MCMODEL_MEDIUM
2438
2439 # Test that hidden and internal symbols in the main program cannot be
2440 # referenced by a shared library.
2441 check_SCRIPTS += hidden_test.sh
2442 check_DATA += hidden_test.err
2443 MOSTLYCLEANFILES += hidden_test hidden_test.err hidden_test.syms
2444 libhidden.so: hidden_test_1.c gcctestdir/ld
2445 $(COMPILE) -Bgcctestdir/ -g -shared -fPIC -w -o $@ $(srcdir)/hidden_test_1.c
2446 hidden_test: hidden_test_main.o libhidden.so gcctestdir/ld
2447 $(LINK) -Bgcctestdir/ -Wl,-R,. hidden_test_main.o libhidden.so 2>hidden_test.err
2448 hidden_test.syms: hidden_test
2449 $(TEST_NM) -D hidden_test > $@
2450 hidden_test.err: hidden_test
2451 @touch hidden_test.err
2452
2453 # Test -retain-symbols-file.
2454 check_SCRIPTS += retain_symbols_file_test.sh
2455 check_DATA += retain_symbols_file_test.stdout
2456 MOSTLYCLEANFILES += retain_symbols_file_test retain_symbols_file_test.in \
2457 retain_symbols_file_test.stdout
2458 retain_symbols_file_test.so: basic_pic_test.o gcctestdir/ld
2459 echo 'main' > retain_symbols_file_test.in
2460 echo 't1' >> retain_symbols_file_test.in
2461 echo '_ZNK4t20a3getEv' >> retain_symbols_file_test.in
2462 echo '_Z3t18v' >> retain_symbols_file_test.in
2463 echo '__tcf_0' >> retain_symbols_file_test.in
2464 $(CXXLINK) -Bgcctestdir/ -shared -Wl,-retain-symbols-file,retain_symbols_file_test.in basic_pic_test.o
2465 retain_symbols_file_test.stdout: retain_symbols_file_test.so
2466 $(TEST_NM) -C retain_symbols_file_test.so > $@
2467
2468
2469 # Test that if the output file already exists and is empty,
2470 # it will get execute permission.
2471 check_PROGRAMS += permission_test
2472 permission_test: basic_test.o gcctestdir/ld
2473 umask 022; \
2474 rm -f $@; \
2475 touch $@; \
2476 chmod 600 $@; \
2477 $(CXXLINK) -Bgcctestdir/ basic_test.o
2478
2479 # Check -l:foo.a
2480 check_PROGRAMS += searched_file_test
2481 MOSTLYCLEANFILES += searched_file_test searched_file_test_lib.o \
2482 alt/searched_file_test_lib.a
2483 searched_file_test_SOURCES = searched_file_test.cc
2484 searched_file_test_DEPENDENCIES = gcctestdir/ld alt/searched_file_test_lib.a
2485 searched_file_test_LDFLAGS = -Bgcctestdir/ -Lalt
2486 searched_file_test_LDADD = -l:searched_file_test_lib.a
2487 searched_file_test_lib.o: searched_file_test_lib.cc
2488 $(CXXCOMPILE) -c -o $@ $<
2489 alt/searched_file_test_lib.a: searched_file_test_lib.o
2490 test -d alt || mkdir -p alt
2491 $(TEST_AR) rc $@ $^
2492
2493 # Test that no .gnu.version sections are created when
2494 # symbol versioning is not used.
2495 check_SCRIPTS += no_version_test.sh
2496 check_DATA += no_version_test.stdout
2497 MOSTLYCLEANFILES += libno_version_test.so no_version_test.stdout
2498 # We invoke the linker directly since gcc may include additional objects that
2499 # uses symbol versioning.
2500 libno_version_test.so: no_version_test.o gcctestdir/ld
2501 gcctestdir/ld -shared -o $@ no_version_test.o
2502 no_version_test.o: no_version_test.c
2503 $(COMPILE) -o $@ -c -fPIC $<
2504 no_version_test.stdout: libno_version_test.so
2505 $(TEST_OBJDUMP) -h $< > $@
2506
2507 # Test STT_GNU_IFUNC symbols.
2508 if IFUNC
2509
2510 ifuncmod1.o: ifuncmod1.c
2511 $(COMPILE) -c -fPIC -o $@ $<
2512 ifuncmod1.so: ifuncmod1.o gcctestdir/ld
2513 $(LINK) -Bgcctestdir/ -shared ifuncmod1.o
2514
2515 ifuncdep1.o: ifuncmod1.c
2516 $(COMPILE) -c -o $@ $<
2517
2518 ifuncmain1pic.o: ifuncmain1.c
2519 $(COMPILE) -c -fPIC -o $@ $<
2520 ifuncmain1pie.o: ifuncmain1.c
2521 $(COMPILE) -c -fPIE -o $@ $<
2522
2523 if HAVE_STATIC
2524 if IFUNC_STATIC
2525 check_PROGRAMS += ifuncmain1static
2526 ifuncmain1static_SOURCES = ifuncmain1.c
2527 ifuncmain1static_DEPENDENCIES = gcctestdir/ld ifuncdep1.o
2528 ifuncmain1static_LDFLAGS = -Bgcctestdir/ -static
2529 ifuncmain1static_LDADD = ifuncdep1.o
2530
2531 check_PROGRAMS += ifuncmain1picstatic
2532 ifuncmain1picstatic: ifuncmain1pic.o ifuncmod1.o gcctestdir/ld
2533 $(LINK) -Bgcctestdir/ -static ifuncmain1pic.o ifuncmod1.o
2534 endif
2535 endif
2536
2537 check_PROGRAMS += ifuncmain1
2538 ifuncmain1_SOURCES = ifuncmain1.c
2539 ifuncmain1_DEPENDENCIES = gcctestdir/ld ifuncmod1.so
2540 ifuncmain1_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
2541 ifuncmain1_LDADD = ifuncmod1.so
2542
2543 check_PROGRAMS += ifuncmain1pic
2544 ifuncmain1pic: ifuncmain1pic.o ifuncmod1.so gcctestdir/ld
2545 $(LINK) -Bgcctestdir/ ifuncmain1pic.o ifuncmod1.so -Wl,-R,.
2546
2547 check_PROGRAMS += ifuncmain1vis
2548 ifuncmain1vis_SOURCES = ifuncmain1vis.c
2549 ifuncmain1vis_DEPENDENCIES = gcctestdir/ld ifuncmod1.so
2550 ifuncmain1vis_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
2551 ifuncmain1vis_LDADD = ifuncmod1.so
2552
2553 check_PROGRAMS += ifuncmain1vispic
2554 ifuncmain1vispic.o: ifuncmain1vis.c
2555 $(COMPILE) -c -fPIC -o $@ $<
2556 ifuncmain1vispic: ifuncmain1vispic.o ifuncmod1.so gcctestdir/ld
2557 $(LINK) -Bgcctestdir/ ifuncmain1pic.o ifuncmod1.so -Wl,-R,.
2558
2559 check_PROGRAMS += ifuncmain1staticpic
2560 ifuncmain1staticpic: ifuncmain1pic.o ifuncmod1.o gcctestdir/ld
2561 $(LINK) -Bgcctestdir/ ifuncmain1pic.o ifuncmod1.o
2562
2563 check_PROGRAMS += ifuncmain1pie
2564 ifuncmain1pie: ifuncmain1pie.o ifuncmod1.so gcctestdir/ld
2565 $(LINK) -Bgcctestdir/ -pie ifuncmain1pie.o ifuncmod1.so -Wl,-R,.
2566
2567 check_PROGRAMS += ifuncmain1vispie
2568 ifuncmain1vispie.o: ifuncmain1vis.c
2569 $(COMPILE) -c -fPIE -o $@ $<
2570 ifuncmain1vispie: ifuncmain1vispie.o ifuncmod1.so gcctestdir/ld
2571 $(LINK) -Bgcctestdir/ -pie ifuncmain1vispie.o ifuncmod1.so -Wl,-R,.
2572
2573 check_PROGRAMS += ifuncmain1staticpie
2574 ifuncmain1staticpie: ifuncmain1pie.o ifuncmod1.o gcctestdir/ld
2575 $(LINK) -Bgcctestdir/ -pie ifuncmain1pie.o ifuncmod1.o
2576
2577 ifuncmain2pic.o: ifuncmain2.c
2578 $(COMPILE) -c -fPIC -o $@ $<
2579
2580 ifuncdep2pic.o: ifuncdep2.c
2581 $(COMPILE) -c -fPIC -o $@ $<
2582
2583 if HAVE_STATIC
2584 if IFUNC_STATIC
2585 check_PROGRAMS += ifuncmain2static
2586 ifuncmain2static_SOURCES = ifuncmain2.c ifuncdep2.c
2587 ifuncmain2static_DEPENDENCIES = gcctestdir/ld
2588 ifuncmain2static_LDFLAGS = -Bgcctestdir/ -static
2589 ifuncmain2static_LDADD =
2590
2591 check_PROGRAMS += ifuncmain2picstatic
2592 ifuncmain2picstatic: ifuncmain2pic.o ifuncdep2pic.o gcctestdir/ld
2593 $(LINK) -Bgcctestdir/ -static ifuncmain2pic.o ifuncdep2pic.o
2594 endif
2595 endif
2596
2597 check_PROGRAMS += ifuncmain2
2598 ifuncmain2_SOURCES = ifuncmain2.c ifuncdep2.c
2599 ifuncmain2_DEPENDENCIES = gcctestdir/ld
2600 ifuncmain2_LDFLAGS = -Bgcctestdir/
2601 ifuncmain2_LDADD =
2602
2603 check_PROGRAMS += ifuncmain2pic
2604 ifuncmain2pic: ifuncmain2pic.o ifuncdep2pic.o gcctestdir/ld
2605 $(LINK) -Bgcctestdir/ ifuncmain2pic.o ifuncdep2pic.o
2606
2607 ifuncmod3.o: ifuncmod3.c
2608 $(COMPILE) -c -fPIC -o $@ $<
2609 ifuncmod3.so: ifuncmod3.o gcctestdir/ld
2610 $(LINK) -Bgcctestdir/ -shared ifuncmod3.o
2611
2612 check_PROGRAMS += ifuncmain3
2613 ifuncmain3_SOURCES = ifuncmain3.c
2614 ifuncmain3_DEPENDENCIES = gcctestdir/ld ifuncmod3.so
2615 ifuncmain3_LDFLAGS = -Bgcctestdir/ -Wl,--export-dynamic -Wl,-R,.
2616 ifuncmain3_LDADD = -ldl
2617
2618 ifuncmain4pic.o: ifuncmain4.c
2619 $(COMPILE) -c -fPIC -o $@ $<
2620
2621 if HAVE_STATIC
2622 if IFUNC_STATIC
2623 check_PROGRAMS += ifuncmain4static
2624 ifuncmain4static_SOURCES = ifuncmain4.c
2625 ifuncmain4static_DEPENDENCIES = gcctestdir/ld
2626 ifuncmain4static_LDFLAGS = -Bgcctestdir/ -static
2627 ifuncmain4static_LDADD =
2628
2629 check_PROGRAMS += ifuncmain4picstatic
2630 ifuncmain4picstatic: ifuncmain4pic.o gcctestdir/ld
2631 $(LINK) -Bgcctestdir/ -static ifuncmain4pic.o
2632 endif
2633 endif
2634
2635 check_PROGRAMS += ifuncmain4
2636 ifuncmain4_SOURCES = ifuncmain4.c
2637 ifuncmain4_DEPENDENCIES = gcctestdir/ld
2638 ifuncmain4_LDFLAGS = -Bgcctestdir/
2639 ifuncmain4_LDADD =
2640
2641 ifuncmain5pic.o: ifuncmain5.c
2642 $(COMPILE) -c -fPIC -o $@ $<
2643
2644 ifuncmain5pie.o: ifuncmain5.c
2645 $(COMPILE) -c -fPIE -o $@ $<
2646
2647 ifuncmod5.o: ifuncmod5.c
2648 $(COMPILE) -c -fPIC -o $@ $<
2649 ifuncmod5.so: ifuncmod5.o gcctestdir/ld
2650 $(LINK) -Bgcctestdir/ -shared ifuncmod5.o
2651
2652 ifuncdep5.o: ifuncmod5.c
2653 $(COMPILE) -c -o $@ $<
2654
2655 if HAVE_STATIC
2656 if IFUNC_STATIC
2657 check_PROGRAMS += ifuncmain5static
2658 ifuncmain5static_SOURCES = ifuncmain5.c
2659 ifuncmain5static_DEPENDENCIES = gcctestdir/ld ifuncdep5.o
2660 ifuncmain5static_LDFLAGS = -Bgcctestdir/ -static
2661 ifuncmain5static_LDADD = ifuncdep5.o
2662
2663 check_PROGRAMS += ifuncmain5picstatic
2664 ifuncmain5picstatic: ifuncmain5pic.o ifuncmod5.o gcctestdir/ld
2665 $(LINK) -Bgcctestdir/ -static ifuncmain5pic.o ifuncmod5.o
2666 endif
2667 endif
2668
2669 check_PROGRAMS += ifuncmain5
2670 ifuncmain5_SOURCES = ifuncmain5.c
2671 ifuncmain5_DEPENDENCIES = gcctestdir/ld ifuncmod5.so
2672 ifuncmain5_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
2673 ifuncmain5_LDADD = ifuncmod5.so
2674
2675 check_PROGRAMS += ifuncmain5pic
2676 ifuncmain5pic: ifuncmain5pic.o ifuncmod5.so gcctestdir/ld
2677 $(LINK) -Bgcctestdir/ ifuncmain5pic.o ifuncmod5.so -Wl,-R,.
2678
2679 check_PROGRAMS += ifuncmain5staticpic
2680 ifuncmain5staticpic: ifuncmain5pic.o ifuncmod5.o gcctestdir/ld
2681 $(LINK) -Bgcctestdir/ ifuncmain5pic.o ifuncmod5.o
2682
2683 check_PROGRAMS += ifuncmain5pie
2684 ifuncmain5pie: ifuncmain5pie.o ifuncmod5.so gcctestdir/ld
2685 $(LINK) -Bgcctestdir/ -pie ifuncmain5pie.o ifuncmod5.so -Wl,-R,.
2686
2687 ifuncmain6pie.o: ifuncmain6pie.c
2688 $(COMPILE) -c -fPIE -o $@ $<
2689
2690 ifuncmod6.o: ifuncmod6.c
2691 $(COMPILE) -c -fPIC -o $@ $<
2692 ifuncmod6.so: ifuncmod6.o gcctestdir/ld
2693 $(LINK) -Bgcctestdir/ -shared ifuncmod6.o
2694
2695 check_PROGRAMS += ifuncmain6pie
2696 ifuncmain6pie: ifuncmain6pie.o ifuncmod6.so gcctestdir/ld
2697 $(LINK) -Bgcctestdir/ -pie ifuncmain6pie.o ifuncmod6.so -Wl,-R,.
2698
2699 ifuncmain7pic.o: ifuncmain7.c
2700 $(COMPILE) -c -fPIC -o $@ $<
2701
2702 ifuncmain7pie.o: ifuncmain7.c
2703 $(COMPILE) -c -fPIE -o $@ $<
2704
2705 if HAVE_STATIC
2706 if IFUNC_STATIC
2707 check_PROGRAMS += ifuncmain7static
2708 ifuncmain7static_SOURCES = ifuncmain7.c
2709 ifuncmain7static_DEPENDENCIES = gcctestdir/ld
2710 ifuncmain7static_LDFLAGS = -Bgcctestdir/ -static
2711 ifuncmain7static_LDADD =
2712
2713 check_PROGRAMS += ifuncmain7picstatic
2714 ifuncmain7picstatic: ifuncmain7pic.o gcctestdir/ld
2715 $(LINK) -Bgcctestdir/ -static ifuncmain7pic.o
2716 endif
2717 endif
2718
2719 check_PROGRAMS += ifuncmain7
2720 ifuncmain7_SOURCES = ifuncmain7.c
2721 ifuncmain7_DEPENDENCIES = gcctestdir/ld
2722 ifuncmain7_LDFLAGS = -Bgcctestdir/
2723 ifuncmain7_LDADD =
2724
2725 check_PROGRAMS += ifuncmain7pic
2726 ifuncmain7pic: ifuncmain7pic.o gcctestdir/ld
2727 $(LINK) -Bgcctestdir/ ifuncmain7pic.o
2728
2729 check_PROGRAMS += ifuncmain7pie
2730 ifuncmain7pie: ifuncmain7pie.o gcctestdir/ld
2731 $(LINK) -Bgcctestdir/ -pie ifuncmain7pie.o
2732
2733 check_PROGRAMS += ifuncvar
2734 ifuncvar1_pic.o: ifuncvar1.c
2735 $(COMPILE) -c -fPIC -o $@ $<
2736 ifuncvar2_pic.o: ifuncvar2.c
2737 $(COMPILE) -c -fPIC -o $@ $<
2738 ifuncvar.so: ifuncvar1_pic.o ifuncvar2_pic.o gcctestdir/ld
2739 $(LINK) -Bgcctestdir/ -shared ifuncvar1_pic.o ifuncvar2_pic.o
2740 ifuncvar_SOURCES = ifuncvar3.c
2741 ifuncvar_DEPENDENCIES = gcctestdir/ld ifuncvar.so
2742 ifuncvar_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
2743 ifuncvar_LDADD = ifuncvar.so
2744
2745 endif IFUNC
2746
2747 # Test that strong reference to a weak symbol in a DSO remains strong.
2748 check_SCRIPTS += strong_ref_weak_def.sh
2749 check_DATA += strong_ref_weak_def.stdout
2750 MOSTLYCLEANFILES += strong_ref_weak_def_1.so strong_ref_weak_def_2.so \
2751 strong_ref_weak_def.stdout
2752 strong_ref_weak_def_2.o: strong_ref_weak_def_2.c
2753 $(COMPILE) -o $@ -c -fPIC $<
2754 strong_ref_weak_def_2.so: strong_ref_weak_def_2.o gcctestdir/ld
2755 gcctestdir/ld -shared -o $@ strong_ref_weak_def_2.o
2756 strong_ref_weak_def_1.o: strong_ref_weak_def_1.c
2757 $(COMPILE) -o $@ -c -fPIC $<
2758 strong_ref_weak_def_1.so: strong_ref_weak_def_1.o strong_ref_weak_def_2.so \
2759 gcctestdir/ld
2760 gcctestdir/ld -shared -o $@ strong_ref_weak_def_1.o \
2761 strong_ref_weak_def_2.so
2762 strong_ref_weak_def.stdout: strong_ref_weak_def_1.so
2763 $(TEST_READELF) -sWD $< > $@
2764
2765 # Test that a strong weak reference remains strong if there is another
2766 # weak reference in a DSO.
2767 check_SCRIPTS += dyn_weak_ref.sh
2768 check_DATA += dyn_weak_ref.stdout
2769 MOSTLYCLEANFILES += dyn_weak_ref_1.so dyn_weak_ref_2.so \
2770 dyn_weak_ref.stdout
2771 dyn_weak_ref_2.o: dyn_weak_ref_2.c
2772 $(COMPILE) -o $@ -c -fPIC $<
2773 dyn_weak_ref_2.so: dyn_weak_ref_2.o gcctestdir/ld
2774 gcctestdir/ld -shared -o $@ dyn_weak_ref_2.o
2775 dyn_weak_ref_1.o: dyn_weak_ref_1.c
2776 $(COMPILE) -o $@ -c -fPIC $<
2777 # We intentionally put dyn_weak_ref_2.so in front of dyn_weak_ref_1.o
2778 # so that the weak ref there goes to gold's symbol table first.
2779 dyn_weak_ref_1.so: dyn_weak_ref_1.o dyn_weak_ref_2.so gcctestdir/ld
2780 gcctestdir/ld -shared -o $@ dyn_weak_ref_2.so dyn_weak_ref_1.o
2781 dyn_weak_ref.stdout: dyn_weak_ref_1.so
2782 $(TEST_READELF) -sWD $< > $@
2783
2784
2785 # Test that --start-lib and --end-lib function correctly.
2786 check_PROGRAMS += start_lib_test
2787 MOSTLYCLEANFILES += libstart_lib_test.a
2788 start_lib_test: start_lib_test_main.o libstart_lib_test.a start_lib_test_2.o start_lib_test_3.o \
2789 gcctestdir/ld
2790 $(LINK) -Bgcctestdir/ -o $@ start_lib_test_main.o -L. -lstart_lib_test \
2791 -Wl,--start-lib start_lib_test_2.o start_lib_test_3.o -Wl,--end-lib
2792 libstart_lib_test.a: start_lib_test_1.o
2793 $(TEST_AR) rc $@ $^
2794
2795 # Test that MEMORY region support works.
2796 check_SCRIPTS += memory_test.sh
2797 check_DATA += memory_test.stdout
2798 MOSTLYCLEANFILES += memory_test.stdout memory_test memory_test.o
2799 memory_test.o: memory_test.s
2800 $(COMPILE) -o $@ -c $<
2801 memory_test: memory_test.o gcctestdir/ld $(srcdir)/memory_test.t
2802 $(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
2803 memory_test.stdout: memory_test
2804 $(TEST_READELF) -lWS $< > $@
2805
2806 # Test INCLUDE directives in linker scripts.
2807 # The binary isn't runnable, so we just check that we can build it without errors.
2808 check_DATA += memory_test_2
2809 MOSTLYCLEANFILES += memory_test_inc_1.t memory_test_inc_2.t memory_test_inc_3.t memory_test_2
2810 memory_test_inc_1.t: $(srcdir)/memory_test_inc_1.t.src
2811 cp $< $@
2812 memory_test_inc_2.t: $(srcdir)/memory_test_inc_2.t.src
2813 cp $< $@
2814 memory_test_inc_3.t: $(srcdir)/memory_test_inc_3.t.src
2815 cp $< $@
2816 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
2817 $(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
2818
2819 if HAVE_PUBNAMES
2820
2821 # Test that --gdb-index functions correctly without gcc-generated pubnames.
2822 check_SCRIPTS += gdb_index_test_1.sh
2823 check_DATA += gdb_index_test_1.stdout
2824 MOSTLYCLEANFILES += gdb_index_test_1.stdout gdb_index_test_1
2825 gdb_index_test.o: gdb_index_test.cc
2826 $(CXXCOMPILE) -O0 -g -gno-pubnames -c -o $@ $<
2827 gdb_index_test_1: gdb_index_test.o gcctestdir/ld
2828 $(CXXLINK) -Bgcctestdir/ -Wl,--gdb-index $<
2829 gdb_index_test_1.stdout: gdb_index_test_1
2830 $(TEST_READELF) --debug-dump=gdb_index $< > $@
2831
2832 # Test that --gdb-index functions correctly with compressed debug sections.
2833 check_SCRIPTS += gdb_index_test_2.sh
2834 check_DATA += gdb_index_test_2.stdout
2835 MOSTLYCLEANFILES += gdb_index_test_2.stdout gdb_index_test_2 gdb_index_test_2_gabi
2836 gdb_index_test_cdebug.o: gdb_index_test.cc
2837 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -Wa,--compress-debug-sections -c -o $@ $<
2838 gdb_index_test_2: gdb_index_test_cdebug.o gcctestdir/ld
2839 $(CXXLINK) -Bgcctestdir/ -Wl,--gdb-index $<
2840 gdb_index_test_2.stdout: gdb_index_test_2
2841 $(TEST_READELF) --debug-dump=gdb_index $< > $@
2842 check_SCRIPTS += gdb_index_test_2_gabi.sh
2843 check_DATA += gdb_index_test_2_gabi.stdout
2844 MOSTLYCLEANFILES += gdb_index_test_2.stdout gdb_index_test_2
2845 gdb_index_test_cdebug_gabi.o: gdb_index_test.cc
2846 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -Wa,--compress-debug-sections=zlib-gabi -c -o $@ $<
2847 gdb_index_test_2_gabi: gdb_index_test_cdebug_gabi.o gcctestdir/ld
2848 $(CXXLINK) -Bgcctestdir/ -Wl,--gdb-index $<
2849 gdb_index_test_2_gabi.stdout: gdb_index_test_2_gabi
2850 $(TEST_READELF) --debug-dump=gdb_index $< > $@
2851
2852 # Another simple C test (DW_AT_high_pc encoding) for --gdb-index.
2853 check_SCRIPTS += gdb_index_test_3.sh
2854 check_DATA += gdb_index_test_3.stdout
2855 MOSTLYCLEANFILES += gdb_index_test_3.stdout gdb_index_test_3
2856 gdb_index_test_3.o: gdb_index_test_3.c
2857 $(COMPILE) -O0 -g -c -o $@ $<
2858 gdb_index_test_3: gdb_index_test_3.o gcctestdir/ld
2859 $(LINK) -Bgcctestdir/ -Wl,--gdb-index,--fatal-warnings $<
2860 gdb_index_test_3.stdout: gdb_index_test_3
2861 $(TEST_READELF) --debug-dump=gdb_index $< > $@
2862
2863 # Test that --gdb-index functions correctly with gcc-generated pubnames.
2864 check_SCRIPTS += gdb_index_test_4.sh
2865 check_DATA += gdb_index_test_4.stdout
2866 MOSTLYCLEANFILES += gdb_index_test_4.stdout gdb_index_test_4
2867 gdb_index_test_pub.o: gdb_index_test.cc
2868 $(CXXCOMPILE) -O0 -g -gpubnames -c -o $@ $<
2869 gdb_index_test_4: gdb_index_test_pub.o gcctestdir/ld
2870 $(CXXLINK) -Bgcctestdir/ -Wl,--gdb-index $<
2871 gdb_index_test_4.stdout: gdb_index_test_4
2872 $(TEST_READELF) --debug-dump=gdb_index $< > $@
2873
2874 endif HAVE_PUBNAMES
2875
2876 # Test that __ehdr_start is defined correctly.
2877 check_PROGRAMS += ehdr_start_test_1
2878 ehdr_start_test_1_SOURCES = ehdr_start_test.cc
2879 ehdr_start_test_1_DEPENDENCIES = gcctestdir/ld
2880 ehdr_start_test_1_CXXFLAGS =
2881 ehdr_start_test_1_LDFLAGS = -Bgcctestdir/
2882 ehdr_start_test_1_LDADD =
2883
2884 # Test that __ehdr_start is defined correctly with a weak reference.
2885 check_PROGRAMS += ehdr_start_test_2
2886 ehdr_start_test_2_SOURCES = ehdr_start_test.cc
2887 ehdr_start_test_2_DEPENDENCIES = gcctestdir/ld
2888 ehdr_start_test_2_CXXFLAGS = -DEHDR_START_WEAK
2889 ehdr_start_test_2_LDFLAGS = -Bgcctestdir/
2890 ehdr_start_test_2_LDADD =
2891
2892 # Test that __ehdr_start is defined correctly when used with a linker script.
2893 check_PROGRAMS += ehdr_start_test_3
2894 ehdr_start_test_3_SOURCES = ehdr_start_test.cc
2895 ehdr_start_test_3_DEPENDENCIES = gcctestdir/ld $(srcdir)/ehdr_start_test.t
2896 ehdr_start_test_3_CXXFLAGS = -DEHDR_START_WEAK
2897 ehdr_start_test_3_LDFLAGS = -Bgcctestdir/ -Wl,-T,$(srcdir)/ehdr_start_test.t
2898 ehdr_start_test_3_LDADD =
2899
2900 # Test that __ehdr_start is left undefined when the text segment is not
2901 # appropriately aligned.
2902 check_SCRIPTS += ehdr_start_test_4.sh
2903 check_DATA += ehdr_start_test_4.syms
2904 MOSTLYCLEANFILES += ehdr_start_test_4
2905 ehdr_start_test_4.syms: ehdr_start_test_4
2906 $(TEST_NM) ehdr_start_test_4 > $@
2907 ehdr_start_test_4: ehdr_start_test_4.o gcctestdir/ld
2908 $(CXXLINK) -Bgcctestdir/ -Wl,-Ttext=0x100100 $<
2909 ehdr_start_test_4.o: ehdr_start_test.cc
2910 $(CXXCOMPILE) -c -DEHDR_START_WEAK -o $@ $<
2911
2912 # Test that __ehdr_start is not overridden when supplied by the user.
2913 check_PROGRAMS += ehdr_start_test_5
2914 ehdr_start_test_5_SOURCES = ehdr_start_test.cc ehdr_start_def.cc
2915 ehdr_start_test_5_DEPENDENCIES = gcctestdir/ld
2916 ehdr_start_test_5_CXXFLAGS = -DEHDR_START_USER_DEF
2917 ehdr_start_test_5_LDFLAGS = -Bgcctestdir/
2918 ehdr_start_test_5_LDADD =
2919
2920 # Test that the --defsym option copies the symbol type and visibility.
2921 check_SCRIPTS += defsym_test.sh
2922 check_DATA += defsym_test.syms
2923 MOSTLYCLEANFILES += defsym_test defsym_test.syms
2924 defsym_test.syms: defsym_test
2925 $(TEST_READELF) -sW $< > $@
2926 defsym_test: defsym_test.o gcctestdir/ld
2927 $(LINK) -Bgcctestdir/ -Wl,--defsym=bar=foo defsym_test.o
2928 defsym_test.o: defsym_test.c
2929 $(COMPILE) -c -o $@ $<
2930
2931 # Test that the -d option (force common allocation) works correctly.
2932 check_PROGRAMS += pr20976
2933 pr20976: pr20976-d.o gcctestdir/ld
2934 $(LINK) -Bgcctestdir/ pr20976-d.o
2935 pr20976-d.o: pr20976.o gcctestdir/ld
2936 gcctestdir/ld -r -d -o $@ pr20976.o
2937
2938 # End-to-end incremental linking tests.
2939 # Incremental linking is currently supported only on the x86_64 target.
2940
2941 if DEFAULT_TARGET_X86_64
2942
2943 two_file_test_1_v1_ndebug.o: two_file_test_1_v1.cc
2944 $(CXXCOMPILE) -O0 -g0 -c -o $@ $<
2945 two_file_test_1_ndebug.o: two_file_test_1.cc
2946 $(CXXCOMPILE) -O0 -g0 -c -o $@ $<
2947 two_file_test_1b_ndebug.o: two_file_test_1b.cc
2948 $(CXXCOMPILE) -O0 -g0 -c -o $@ $<
2949 two_file_test_2_ndebug.o: two_file_test_2.cc
2950 $(CXXCOMPILE) -O0 -g0 -c -o $@ $<
2951 two_file_test_main_ndebug.o: two_file_test_main.cc
2952 $(CXXCOMPILE) -O0 -g0 -c -o $@ $<
2953
2954 check_PROGRAMS += incremental_test_2
2955 MOSTLYCLEANFILES += two_file_test_tmp_2.o
2956 incremental_test_2: two_file_test_1_v1_ndebug.o two_file_test_1_ndebug.o two_file_test_1b_ndebug.o \
2957 two_file_test_2_ndebug.o two_file_test_main_ndebug.o gcctestdir/ld
2958 cp -f two_file_test_1_v1_ndebug.o two_file_test_tmp_2.o
2959 $(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
2960 @sleep 1
2961 cp -f two_file_test_1_ndebug.o two_file_test_tmp_2.o
2962 $(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
2963
2964 check_PROGRAMS += incremental_test_3
2965 MOSTLYCLEANFILES += two_file_test_tmp_3.o
2966 incremental_test_3: two_file_test_1.o two_file_test_1b_v1.o two_file_test_1b.o \
2967 two_file_test_2.o two_file_test_main.o gcctestdir/ld
2968 cp -f two_file_test_1b_v1.o two_file_test_tmp_3.o
2969 $(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
2970 @sleep 1
2971 cp -f two_file_test_1b.o two_file_test_tmp_3.o
2972 $(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
2973
2974 check_PROGRAMS += incremental_test_4
2975 MOSTLYCLEANFILES += incremental_test_4.base two_file_test_tmp_4.o
2976 incremental_test_4: two_file_test_1.o two_file_test_1b.o two_file_test_2_v1.o \
2977 two_file_test_2.o two_file_test_main.o gcctestdir/ld
2978 cp -f two_file_test_2_v1.o two_file_test_tmp_4.o
2979 $(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
2980 mv -f incremental_test_4 incremental_test_4.base
2981 @sleep 1
2982 cp -f two_file_test_2.o two_file_test_tmp_4.o
2983 $(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
2984
2985 check_PROGRAMS += incremental_test_5
2986 MOSTLYCLEANFILES += two_file_test_5.a
2987 incremental_test_5: two_file_test_1.o two_file_test_1b_v1.o two_file_test_1b.o \
2988 two_file_test_2.o two_file_test_main.o gcctestdir/ld
2989 cp -f two_file_test_1b_v1.o two_file_test_tmp_5.o
2990 $(TEST_AR) rc two_file_test_5.a two_file_test_1.o two_file_test_tmp_5.o two_file_test_2.o
2991 $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Wl,-z,norelro -Bgcctestdir/ two_file_test_main.o two_file_test_5.a
2992 @sleep 1
2993 cp -f two_file_test_1b.o two_file_test_tmp_5.o
2994 $(TEST_AR) rc two_file_test_5.a two_file_test_1.o two_file_test_tmp_5.o two_file_test_2.o
2995 $(CXXLINK) -Wl,--incremental-update -Wl,-z,norelro -Bgcctestdir/ two_file_test_main.o two_file_test_5.a
2996
2997 # Test the --incremental-unchanged flag with an archive library.
2998 # The second link should not update the library.
2999 check_PROGRAMS += incremental_test_6
3000 MOSTLYCLEANFILES += two_file_test_6.a
3001 incremental_test_6: two_file_test_1.o two_file_test_1b_v1.o two_file_test_1b.o \
3002 two_file_test_2.o two_file_test_main.o gcctestdir/ld
3003 cp -f two_file_test_1b.o two_file_test_tmp_6.o
3004 $(TEST_AR) rc two_file_test_6.a two_file_test_1.o two_file_test_tmp_6.o two_file_test_2.o
3005 $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Wl,-z,norelro -Bgcctestdir/ two_file_test_main.o two_file_test_6.a
3006 @sleep 1
3007 cp -f two_file_test_1b_v1.o two_file_test_tmp_6.o
3008 $(TEST_AR) rc two_file_test_6.a two_file_test_1.o two_file_test_tmp_6.o two_file_test_2.o
3009 $(CXXLINK) -Wl,--incremental-update -Wl,-z,norelro -Bgcctestdir/ two_file_test_main.o -Wl,--incremental-unchanged two_file_test_6.a -Wl,--incremental-unknown
3010
3011 check_PROGRAMS += incremental_copy_test
3012 incremental_copy_test: copy_test_v1.o copy_test.o copy_test_1.so copy_test_2.so
3013 cp -f copy_test_v1.o copy_test_tmp.o
3014 $(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
3015 @sleep 1
3016 cp -f copy_test.o copy_test_tmp.o
3017 $(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
3018
3019 check_PROGRAMS += incremental_common_test_1
3020 incremental_common_test_1: common_test_1_v1.o common_test_1_v2.o gcctestdir/ld
3021 cp -f common_test_1_v1.o common_test_1_tmp.o
3022 $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Wl,-z,norelro -Bgcctestdir/ common_test_1_tmp.o
3023 @sleep 1
3024 cp -f common_test_1_v2.o common_test_1_tmp.o
3025 $(CXXLINK) -Wl,--incremental-update -Wl,-z,norelro -Bgcctestdir/ common_test_1_tmp.o
3026
3027 check_PROGRAMS += incremental_comdat_test_1
3028 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
3029 cp -f incr_comdat_test_2_v1.o incr_comdat_test_1_tmp.o
3030 $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Wl,-z,norelro -Bgcctestdir/ incr_comdat_test_1.o incr_comdat_test_1_tmp.o
3031 @sleep 1
3032 cp -f incr_comdat_test_2_v2.o incr_comdat_test_1_tmp.o
3033 $(CXXLINK) -Wl,--incremental-update -Wl,-z,norelro -Bgcctestdir/ incr_comdat_test_1.o incr_comdat_test_1_tmp.o
3034 @sleep 1
3035 cp -f incr_comdat_test_2_v3.o incr_comdat_test_1_tmp.o
3036 $(CXXLINK) -Wl,--incremental-update -Wl,-z,norelro -Bgcctestdir/ incr_comdat_test_1.o incr_comdat_test_1_tmp.o
3037
3038 endif DEFAULT_TARGET_X86_64
3039
3040 if DEFAULT_TARGET_X86_64
3041 check_PROGRAMS += exception_x86_64_bnd_test
3042 exception_x86_64_bnd_test_SOURCES = exception_test_main.cc
3043 exception_x86_64_bnd_test_DEPENDENCIES = gcctestdir/ld exception_x86_64_bnd_1.o exception_x86_64_bnd_2.o
3044 exception_x86_64_bnd_test_LDFLAGS = $(exception_test_LDFLAGS)
3045 exception_x86_64_bnd_test_LDADD = exception_x86_64_bnd_1.o exception_x86_64_bnd_2.o
3046 exception_x86_64_bnd_1.o: exception_test_1.cc gcctestdir/as
3047 $(CXXCOMPILE) -c -fpic -Bgcctestdir/ -Wa,-madd-bnd-prefix -o $@ $<
3048 exception_x86_64_bnd_2.o: exception_test_2.cc gcctestdir/as
3049 $(CXXCOMPILE) -c -Bgcctestdir/ -Wa,-madd-bnd-prefix -o $@ $<
3050 endif DEFAULT_TARGET_X86_64
3051
3052 endif GCC
3053 endif NATIVE_LINKER
3054
3055 # These tests work with native and cross linkers.
3056
3057 if NATIVE_OR_CROSS_LINKER
3058
3059 # Test script section order.
3060 check_SCRIPTS += script_test_10.sh
3061 check_DATA += script_test_10.stdout
3062 MOSTLYCLEANFILES += script_test_10
3063 script_test_10.o: script_test_10.s
3064 $(TEST_AS) -o $@ $<
3065 script_test_10: $(srcdir)/script_test_10.t script_test_10.o gcctestdir/ld
3066 gcctestdir/ld -o $@ script_test_10.o -T $(srcdir)/script_test_10.t
3067 script_test_10.stdout: script_test_10
3068 $(TEST_READELF) -SW script_test_10 > $@
3069
3070 # These tests work with cross linkers only.
3071
3072 if DEFAULT_TARGET_I386
3073
3074 check_SCRIPTS += split_i386.sh
3075 check_DATA += split_i386_1.stdout split_i386_2.stdout \
3076 split_i386_3.stdout split_i386_4.stdout split_i386_r.stdout
3077 SPLIT_DEFSYMS = --defsym __morestack=0x100 --defsym __morestack_non_split=0x200
3078 split_i386_1.o: split_i386_1.s
3079 $(TEST_AS) -o $@ $<
3080 split_i386_2.o: split_i386_2.s
3081 $(TEST_AS) -o $@ $<
3082 split_i386_3.o: split_i386_3.s
3083 $(TEST_AS) -o $@ $<
3084 split_i386_4.o: split_i386_4.s
3085 $(TEST_AS) -o $@ $<
3086 split_i386_n.o: split_i386_n.s
3087 $(TEST_AS) -o $@ $<
3088 split_i386_1: split_i386_1.o split_i386_n.o ../ld-new
3089 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_i386_1.o split_i386_n.o
3090 split_i386_1.stdout: split_i386_1
3091 $(TEST_OBJDUMP) -d $< > $@
3092 split_i386_2: split_i386_2.o split_i386_n.o ../ld-new
3093 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_i386_2.o split_i386_n.o
3094 split_i386_2.stdout: split_i386_2
3095 $(TEST_OBJDUMP) -d $< > $@
3096 split_i386_3.stdout: split_i386_3.o split_i386_n.o ../ld-new
3097 ../ld-new $(SPLIT_DEFSYMS) -o split_i386_3 split_i386_3.o split_i386_n.o > $@ 2>&1 || exit 0
3098 split_i386_4: split_i386_4.o split_i386_n.o ../ld-new
3099 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_i386_4.o split_i386_n.o
3100 split_i386_4.stdout: split_i386_4
3101 $(TEST_OBJDUMP) -d $< > $@
3102 split_i386_r.stdout: split_i386_1.o split_i386_n.o ../ld-new
3103 ../ld-new -r split_i386_1.o split_i386_n.o -o split_i386_r > $@ 2>&1 || exit 0
3104 MOSTLYCLEANFILES += split_i386_1 split_i386_2 split_i386_3 \
3105 split_i386_4 split_i386_r
3106
3107 endif DEFAULT_TARGET_I386
3108
3109 if DEFAULT_TARGET_X86_64
3110
3111 check_SCRIPTS += split_x86_64.sh
3112 check_DATA += split_x86_64_1.stdout split_x86_64_2.stdout \
3113 split_x86_64_3.stdout split_x86_64_4.stdout split_x86_64_r.stdout
3114 SPLIT_DEFSYMS = --defsym __morestack=0x100 --defsym __morestack_non_split=0x200
3115 split_x86_64_1.o: split_x86_64_1.s
3116 $(TEST_AS) -o $@ $<
3117 split_x86_64_2.o: split_x86_64_2.s
3118 $(TEST_AS) -o $@ $<
3119 split_x86_64_3.o: split_x86_64_3.s
3120 $(TEST_AS) -o $@ $<
3121 split_x86_64_4.o: split_x86_64_4.s
3122 $(TEST_AS) -o $@ $<
3123 split_x86_64_n.o: split_x86_64_n.s
3124 $(TEST_AS) -o $@ $<
3125 split_x86_64_1: split_x86_64_1.o split_x86_64_n.o ../ld-new
3126 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x86_64_1.o split_x86_64_n.o
3127 split_x86_64_1.stdout: split_x86_64_1
3128 $(TEST_OBJDUMP) -d $< > $@
3129 split_x86_64_2: split_x86_64_2.o split_x86_64_n.o ../ld-new
3130 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x86_64_2.o split_x86_64_n.o
3131 split_x86_64_2.stdout: split_x86_64_2
3132 $(TEST_OBJDUMP) -d $< > $@
3133 split_x86_64_3.stdout: split_x86_64_3.o split_x86_64_n.o ../ld-new
3134 ../ld-new $(SPLIT_DEFSYMS) -o split_x86_64_3 split_x86_64_3.o split_x86_64_n.o > $@ 2>&1 || exit 0
3135 split_x86_64_4: split_x86_64_4.o split_x86_64_n.o ../ld-new
3136 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x86_64_4.o split_x86_64_n.o
3137 split_x86_64_4.stdout: split_x86_64_4
3138 $(TEST_OBJDUMP) -d $< > $@
3139 split_x86_64_r.stdout: split_x86_64_1.o split_x86_64_n.o ../ld-new
3140 ../ld-new -r split_x86_64_1.o split_x86_64_n.o -o split_x86_64_r > $@ 2>&1 || exit 0
3141 MOSTLYCLEANFILES += split_x86_64_1 split_x86_64_2 split_x86_64_3 \
3142 split_x86_64_4 split_x86_64_r
3143
3144 endif DEFAULT_TARGET_X86_64
3145
3146 if DEFAULT_TARGET_X32
3147
3148 check_SCRIPTS += split_x32.sh
3149 check_DATA += split_x32_1.stdout split_x32_2.stdout \
3150 split_x32_3.stdout split_x32_4.stdout split_x32_r.stdout
3151 SPLIT_DEFSYMS = --defsym __morestack=0x100 --defsym __morestack_non_split=0x200
3152 split_x32_1.o: split_x32_1.s
3153 $(TEST_AS) -o $@ $<
3154 split_x32_2.o: split_x32_2.s
3155 $(TEST_AS) -o $@ $<
3156 split_x32_3.o: split_x32_3.s
3157 $(TEST_AS) -o $@ $<
3158 split_x32_4.o: split_x32_4.s
3159 $(TEST_AS) -o $@ $<
3160 split_x32_n.o: split_x32_n.s
3161 $(TEST_AS) -o $@ $<
3162 split_x32_1: split_x32_1.o split_x32_n.o ../ld-new
3163 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x32_1.o split_x32_n.o
3164 split_x32_1.stdout: split_x32_1
3165 $(TEST_OBJDUMP) -d $< > $@
3166 split_x32_2: split_x32_2.o split_x32_n.o ../ld-new
3167 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x32_2.o split_x32_n.o
3168 split_x32_2.stdout: split_x32_2
3169 $(TEST_OBJDUMP) -d $< > $@
3170 split_x32_3.stdout: split_x32_3.o split_x32_n.o ../ld-new
3171 ../ld-new $(SPLIT_DEFSYMS) -o split_x32_3 split_x32_3.o split_x32_n.o > $@ 2>&1 || exit 0
3172 split_x32_4: split_x32_4.o split_x32_n.o ../ld-new
3173 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x32_4.o split_x32_n.o
3174 split_x32_4.stdout: split_x32_4
3175 $(TEST_OBJDUMP) -d $< > $@
3176 split_x32_r.stdout: split_x32_1.o split_x32_n.o ../ld-new
3177 ../ld-new -r split_x32_1.o split_x32_n.o -o split_x32_r > $@ 2>&1 || exit 0
3178 MOSTLYCLEANFILES += split_x32_1 split_x32_2 split_x32_3 \
3179 split_x32_4 split_x32_r
3180
3181 endif DEFAULT_TARGET_X32
3182
3183 if DEFAULT_TARGET_ARM
3184
3185 check_SCRIPTS += arm_abs_global.sh
3186 check_DATA += arm_abs_global.stdout
3187 arm_abs_lib.o: arm_abs_lib.s
3188 $(TEST_AS) -march=armv7-a -o $@ $<
3189 libarm_abs.so: arm_abs_lib.o ../ld-new
3190 ../ld-new -shared -o $@ arm_abs_lib.o
3191 arm_abs_global.o: arm_abs_global.s
3192 $(TEST_AS) -march=armv7-a -o $@ $<
3193 arm_abs_global: arm_abs_global.o libarm_abs.so ../ld-new
3194 ../ld-new -o $@ arm_abs_global.o -L. -larm_abs
3195 arm_abs_global.stdout: arm_abs_global
3196 $(TEST_READELF) -r $< > $@
3197
3198 MOSTLYCLEANFILES += arm_abs_global
3199
3200 check_SCRIPTS += arm_branch_in_range.sh arm_branch_out_of_range.sh
3201 check_DATA += arm_bl_in_range.stdout arm_bl_out_of_range.stdout \
3202 thumb_bl_in_range.stdout thumb_bl_out_of_range.stdout \
3203 thumb2_bl_in_range.stdout thumb2_bl_out_of_range.stdout \
3204 thumb_blx_in_range.stdout thumb_blx_out_of_range.stdout \
3205 thumb2_blx_in_range.stdout thumb2_blx_out_of_range.stdout \
3206 thumb_bl_out_of_range_local.stdout arm_thm_jump11.stdout \
3207 arm_thm_jump8.stdout
3208
3209 arm_bl_in_range.stdout: arm_bl_in_range
3210 $(TEST_OBJDUMP) -D $< > $@
3211
3212 arm_bl_in_range: arm_bl_in_range.o ../ld-new
3213 ../ld-new -T $(srcdir)/arm_branch_range.t -o $@ $<
3214
3215 arm_bl_in_range.o: arm_bl_in_range.s
3216 $(TEST_AS) -o $@ $<
3217
3218 arm_bl_out_of_range.stdout: arm_bl_out_of_range
3219 $(TEST_OBJDUMP) -S $< > $@
3220
3221 arm_bl_out_of_range: arm_bl_out_of_range.o ../ld-new
3222 ../ld-new -T $(srcdir)/arm_branch_range.t -o $@ $<
3223
3224 arm_bl_out_of_range.o: arm_bl_out_of_range.s
3225 $(TEST_AS) -o $@ $<
3226
3227 thumb_bl_in_range.stdout: thumb_bl_in_range
3228 $(TEST_OBJDUMP) -D $< > $@
3229
3230 thumb_bl_in_range: thumb_bl_in_range.o ../ld-new
3231 ../ld-new --no-fix-arm1176 -T $(srcdir)/thumb_branch_range.t -o $@ $<
3232
3233 thumb_bl_in_range.o: thumb_bl_in_range.s
3234 $(TEST_AS) -o $@ -march=armv5te $<
3235
3236 thumb_bl_out_of_range.stdout: thumb_bl_out_of_range
3237 $(TEST_OBJDUMP) -D $< > $@
3238
3239 thumb_bl_out_of_range: thumb_bl_out_of_range.o ../ld-new
3240 ../ld-new --no-fix-arm1176 -T $(srcdir)/thumb_branch_range.t -o $@ $<
3241
3242 thumb_bl_out_of_range.o: thumb_bl_out_of_range.s
3243 $(TEST_AS) -o $@ -march=armv5te $<
3244
3245 thumb2_bl_in_range.stdout: thumb2_bl_in_range
3246 $(TEST_OBJDUMP) -D $< > $@
3247
3248 thumb2_bl_in_range: thumb2_bl_in_range.o ../ld-new
3249 ../ld-new -T $(srcdir)/thumb2_branch_range.t -o $@ $<
3250
3251 thumb2_bl_in_range.o: thumb_bl_in_range.s
3252 $(TEST_AS) -o $@ -march=armv7-a $<
3253
3254 thumb2_bl_out_of_range.stdout: thumb2_bl_out_of_range
3255 $(TEST_OBJDUMP) -D $< > $@
3256
3257 thumb2_bl_out_of_range: thumb2_bl_out_of_range.o ../ld-new
3258 ../ld-new -T $(srcdir)/thumb2_branch_range.t -o $@ $<
3259
3260 thumb2_bl_out_of_range.o: thumb_bl_out_of_range.s
3261 $(TEST_AS) -o $@ -march=armv7-a $<
3262
3263 thumb_blx_in_range.stdout: thumb_blx_in_range
3264 $(TEST_OBJDUMP) -D $< > $@
3265
3266 thumb_blx_in_range: thumb_blx_in_range.o ../ld-new
3267 ../ld-new --no-fix-arm1176 -T $(srcdir)/thumb_branch_range.t -o $@ $<
3268
3269 thumb_blx_in_range.o: thumb_blx_in_range.s
3270 $(TEST_AS) -o $@ -march=armv5te $<
3271
3272 thumb_blx_out_of_range.stdout: thumb_blx_out_of_range
3273 $(TEST_OBJDUMP) -D $< > $@
3274
3275 thumb_blx_out_of_range: thumb_blx_out_of_range.o ../ld-new
3276 ../ld-new --no-fix-arm1176 -T $(srcdir)/thumb_branch_range.t -o $@ $<
3277
3278 thumb_blx_out_of_range.o: thumb_blx_out_of_range.s
3279 $(TEST_AS) -o $@ -march=armv5te $<
3280
3281 thumb2_blx_in_range.stdout: thumb2_blx_in_range
3282 $(TEST_OBJDUMP) -D $< > $@
3283
3284 thumb2_blx_in_range: thumb2_blx_in_range.o ../ld-new
3285 ../ld-new -T $(srcdir)/thumb2_branch_range.t -o $@ $<
3286
3287 thumb2_blx_in_range.o: thumb_blx_in_range.s
3288 $(TEST_AS) -o $@ -march=armv7-a $<
3289
3290 thumb2_blx_out_of_range.stdout: thumb2_blx_out_of_range
3291 $(TEST_OBJDUMP) -D $< > $@
3292
3293 thumb2_blx_out_of_range: thumb2_blx_out_of_range.o ../ld-new
3294 ../ld-new -T $(srcdir)/thumb2_branch_range.t -o $@ $<
3295
3296 thumb2_blx_out_of_range.o: thumb_blx_out_of_range.s
3297 $(TEST_AS) -o $@ -march=armv7-a $<
3298
3299 thumb_bl_out_of_range_local.stdout: thumb_bl_out_of_range_local
3300 $(TEST_OBJDUMP) -D $< > $@
3301
3302 thumb_bl_out_of_range_local: thumb_bl_out_of_range_local.o ../ld-new
3303 ../ld-new --no-fix-arm1176 -T $(srcdir)/thumb_branch_range.t -o $@ $<
3304
3305 thumb_bl_out_of_range_local.o: thumb_bl_out_of_range_local.s
3306 $(TEST_AS) -o $@ -march=armv5te $<
3307
3308 arm_thm_jump11.stdout: arm_thm_jump11
3309 $(TEST_OBJDUMP) -D $< > $@
3310
3311 arm_thm_jump11: arm_thm_jump11.o ../ld-new
3312 ../ld-new -T $(srcdir)/arm_thm_jump11.t -o $@ $<
3313
3314 arm_thm_jump11.o: arm_thm_jump11.s
3315 $(TEST_AS) -o $@ $<
3316
3317 arm_thm_jump8.stdout: arm_thm_jump8
3318 $(TEST_OBJDUMP) -D $< > $@
3319
3320 arm_thm_jump8: arm_thm_jump8.o ../ld-new
3321 ../ld-new -T $(srcdir)/arm_thm_jump8.t -o $@ $<
3322
3323 arm_thm_jump8.o: arm_thm_jump8.s
3324 $(TEST_AS) -o $@ $<
3325
3326 MOSTLYCLEANFILES += arm_bl_in_range arm_bl_out_of_range thumb_bl_in_range \
3327 thumb_bl_out_of_range thumb2_bl_in_range thumb2_bl_out_of_range \
3328 thumb_blx_in_range thumb_blx_out_of_range thumb2_blx_in_range \
3329 thumb2_blx_out_of_range thumb_bl_out_of_range_local arm_thm_jump11 \
3330 arm_thm_jump8
3331
3332 check_SCRIPTS += arm_fix_v4bx.sh
3333 check_DATA += arm_fix_v4bx.stdout arm_fix_v4bx_interworking.stdout \
3334 arm_no_fix_v4bx.stdout
3335
3336 arm_fix_v4bx.stdout: arm_fix_v4bx
3337 $(TEST_OBJDUMP) -D -j.text $< > $@
3338
3339 arm_fix_v4bx: arm_fix_v4bx.o ../ld-new
3340 ../ld-new --no-fix-arm1176 --fix-v4bx -o $@ $<
3341
3342 arm_fix_v4bx.o: arm_fix_v4bx.s
3343 $(TEST_AS) -o $@ $<
3344
3345 arm_fix_v4bx_interworking.stdout: arm_fix_v4bx_interworking
3346 $(TEST_OBJDUMP) -D -j.text $< > $@
3347
3348 arm_fix_v4bx_interworking: arm_fix_v4bx.o ../ld-new
3349 ../ld-new --no-fix-arm1176 --fix-v4bx-interworking -o $@ $<
3350
3351 arm_no_fix_v4bx.stdout: arm_no_fix_v4bx
3352 $(TEST_OBJDUMP) -D -j.text $< > $@
3353
3354 arm_no_fix_v4bx: arm_fix_v4bx.o ../ld-new
3355 ../ld-new --no-fix-arm1176 -o $@ $<
3356
3357 MOSTLYCLEANFILES += arm_fix_v4bx arm_fix_v4bx_interworking arm_no_fix_v4bx
3358
3359 check_SCRIPTS += arm_attr_merge.sh
3360 check_DATA += arm_attr_merge_6.stdout arm_attr_merge_6r.stdout \
3361 arm_attr_merge_7.stdout
3362
3363 arm_attr_merge_6.stdout: arm_attr_merge_6
3364 $(TEST_READELF) -A $< > $@
3365
3366 arm_attr_merge_6: arm_attr_merge_6a.o arm_attr_merge_6b.o ../ld-new
3367 ../ld-new -o $@ arm_attr_merge_6a.o arm_attr_merge_6b.o
3368
3369 arm_attr_merge_6a.o: arm_attr_merge_6a.s
3370 $(TEST_AS) -o $@ $<
3371
3372 arm_attr_merge_6b.o: arm_attr_merge_6b.s
3373 $(TEST_AS) -o $@ $<
3374
3375 arm_attr_merge_6r.stdout: arm_attr_merge_6r
3376 $(TEST_READELF) -A $< > $@
3377
3378 arm_attr_merge_6r: arm_attr_merge_6b.o arm_attr_merge_6a.o ../ld-new
3379 ../ld-new -o $@ arm_attr_merge_6b.o arm_attr_merge_6a.o
3380
3381 arm_attr_merge_7.stdout: arm_attr_merge_7
3382 $(TEST_READELF) -A $< > $@
3383
3384 arm_attr_merge_7: arm_attr_merge_7a.o arm_attr_merge_7b.o ../ld-new
3385 ../ld-new -o $@ arm_attr_merge_7a.o arm_attr_merge_7b.o
3386
3387 arm_attr_merge_7a.o: arm_attr_merge_7a.s
3388 $(TEST_AS) -o $@ $<
3389
3390 arm_attr_merge_7b.o: arm_attr_merge_7b.s
3391 $(TEST_AS) -o $@ $<
3392
3393 MOSTLYCLEANFILES += arm_attr_merge_6 arm_attr_merge_6r arm_attr_merge_7
3394
3395 # ARM1176 workaround test.
3396 check_SCRIPTS += arm_fix_1176.sh
3397 check_DATA += arm_fix_1176_default_v6z.stdout arm_fix_1176_on_v6z.stdout \
3398 arm_fix_1176_off_v6z.stdout arm_fix_1176_default_v5te.stdout \
3399 arm_fix_1176_default_v7a.stdout arm_fix_1176_default_1156t2f_s.stdout
3400
3401 arm_fix_1176_default_v6z.stdout: arm_fix_1176_default_v6z
3402 $(TEST_OBJDUMP) -D -j.foo $< > $@
3403
3404 arm_fix_1176_default_v6z: arm_fix_1176_default_v6z.o ../ld-new
3405 ../ld-new --section-start=.foo=0x2001014 -o $@ $<
3406
3407 arm_fix_1176_default_v6z.o: arm_fix_1176.s
3408 $(TEST_AS) -march=armv6z -o $@ $<
3409
3410 arm_fix_1176_on_v6z.stdout: arm_fix_1176_on_v6z
3411 $(TEST_OBJDUMP) -D -j.foo $< > $@
3412
3413 arm_fix_1176_on_v6z: arm_fix_1176_on_v6z.o ../ld-new
3414 ../ld-new --section-start=.foo=0x2001014 --fix-arm1176 -o $@ $<
3415
3416 arm_fix_1176_on_v6z.o: arm_fix_1176.s
3417 $(TEST_AS) -march=armv6z -o $@ $<
3418
3419 arm_fix_1176_off_v6z.stdout: arm_fix_1176_off_v6z
3420 $(TEST_OBJDUMP) -D -j.foo $< > $@
3421
3422 arm_fix_1176_off_v6z: arm_fix_1176_off_v6z.o ../ld-new
3423 ../ld-new --section-start=.foo=0x2001014 --no-fix-arm1176 -o $@ $<
3424
3425 arm_fix_1176_off_v6z.o: arm_fix_1176.s
3426 $(TEST_AS) -march=armv6z -o $@ $<
3427
3428 arm_fix_1176_default_v5te.stdout: arm_fix_1176_default_v5te
3429 $(TEST_OBJDUMP) -D -j.foo $< > $@
3430
3431 arm_fix_1176_default_v5te: arm_fix_1176_default_v5te.o ../ld-new
3432 ../ld-new --section-start=.foo=0x2001014 -o $@ $<
3433
3434 arm_fix_1176_default_v5te.o: arm_fix_1176.s
3435 $(TEST_AS) -march=armv5te -o $@ $<
3436
3437 arm_fix_1176_default_v7a.stdout: arm_fix_1176_default_v7a
3438 $(TEST_OBJDUMP) -D -j.foo $< > $@
3439
3440 arm_fix_1176_default_v7a: arm_fix_1176_default_v7a.o ../ld-new
3441 ../ld-new --section-start=.foo=0x2001014 -o $@ $<
3442
3443 arm_fix_1176_default_v7a.o: arm_fix_1176.s
3444 $(TEST_AS) -march=armv7-a -o $@ $<
3445
3446 arm_fix_1176_default_1156t2f_s.stdout: arm_fix_1176_default_1156t2f_s
3447 $(TEST_OBJDUMP) -D -j.foo $< > $@
3448
3449 arm_fix_1176_default_1156t2f_s: arm_fix_1176_default_1156t2f_s.o ../ld-new
3450 ../ld-new --section-start=.foo=0x2001014 -o $@ $<
3451
3452 arm_fix_1176_default_1156t2f_s.o: arm_fix_1176.s
3453 $(TEST_AS) -mcpu=arm1156t2f-s -o $@ $<
3454
3455 MOSTLYCLEANFILES += arm_fix_1176_default_v6z arm_fix_1176_on_v6z arm_fix_1176_off_v6z \
3456 arm_fix_1176_default_v5te arm_fix_1176_default_v7a arm_fix_1176_default_1156t2f_s
3457
3458 # Cortex-A8 workaround test.
3459
3460 check_SCRIPTS += arm_cortex_a8.sh
3461 check_DATA += arm_cortex_a8_b_cond.stdout arm_cortex_a8_b.stdout \
3462 arm_cortex_a8_bl.stdout arm_cortex_a8_blx.stdout \
3463 arm_cortex_a8_local.stdout arm_cortex_a8_local_reloc.stdout
3464
3465 arm_cortex_a8_b_cond.stdout: arm_cortex_a8_b_cond
3466 $(TEST_OBJDUMP) -D -j.text $< > $@
3467
3468 arm_cortex_a8_b_cond: arm_cortex_a8_b_cond.o ../ld-new
3469 ../ld-new -o $@ $<
3470
3471 arm_cortex_a8_b_cond.o: arm_cortex_a8_b_cond.s
3472 $(TEST_AS) -o $@ $<
3473
3474 arm_cortex_a8_b.stdout: arm_cortex_a8_b
3475 $(TEST_OBJDUMP) -D -j.text $< > $@
3476
3477 arm_cortex_a8_b: arm_cortex_a8_b.o ../ld-new
3478 ../ld-new --fix-cortex-a8 -o $@ $<
3479
3480 arm_cortex_a8_b.o: arm_cortex_a8_b.s
3481 $(TEST_AS) -o $@ $<
3482
3483 arm_cortex_a8_bl.stdout: arm_cortex_a8_bl
3484 $(TEST_OBJDUMP) -D -j.text $< > $@
3485
3486 arm_cortex_a8_bl: arm_cortex_a8_bl.o ../ld-new
3487 ../ld-new -o $@ $<
3488
3489 arm_cortex_a8_bl.o: arm_cortex_a8_bl.s
3490 $(TEST_AS) -o $@ $<
3491
3492 arm_cortex_a8_blx.stdout: arm_cortex_a8_blx
3493 $(TEST_OBJDUMP) -D -j.text $< > $@
3494
3495 arm_cortex_a8_blx: arm_cortex_a8_blx.o ../ld-new
3496 ../ld-new -o $@ $<
3497
3498 arm_cortex_a8_blx.o: arm_cortex_a8_blx.s
3499 $(TEST_AS) -o $@ $<
3500
3501 arm_cortex_a8_local.stdout: arm_cortex_a8_local
3502 $(TEST_OBJDUMP) -D -j.text $< > $@
3503
3504 arm_cortex_a8_local: arm_cortex_a8_local.o ../ld-new
3505 ../ld-new -o $@ $<
3506
3507 arm_cortex_a8_local.o: arm_cortex_a8_local.s
3508 $(TEST_AS) -o $@ $<
3509
3510 arm_cortex_a8_local_reloc.stdout: arm_cortex_a8_local_reloc
3511 $(TEST_OBJDUMP) -D -j.text $< > $@
3512
3513 arm_cortex_a8_local_reloc: arm_cortex_a8_local_reloc.o ../ld-new
3514 ../ld-new -o $@ $<
3515
3516 arm_cortex_a8_local_reloc.o: arm_cortex_a8_local_reloc.s
3517 $(TEST_AS) -o $@ $<
3518
3519 MOSTLYCLEANFILES += arm_cortex_a8_b_cond arm_cortex_a8_b arm_cortex_a8_bl \
3520 arm_cortex_a8_blx arm_cortex_a8_local arm_cortex_a8_local_reloc
3521
3522 check_SCRIPTS += arm_exidx_test.sh
3523 check_DATA += arm_exidx_test.stdout
3524
3525 arm_exidx_test.stdout: arm_exidx_test.so
3526 $(TEST_READELF) -Sr $< > $@
3527
3528 arm_exidx_test.so: arm_exidx_test.o ../ld-new
3529 ../ld-new -shared -o $@ $<
3530
3531 arm_exidx_test.o: arm_exidx_test.s
3532 $(TEST_AS) -o $@ $<
3533
3534 check_SCRIPTS += pr12826.sh
3535 check_DATA += pr12826.stdout
3536
3537 pr12826.stdout: pr12826.so
3538 $(TEST_READELF) -A $< > $@
3539
3540 pr12826.so: pr12826_1.o pr12826_2.o ../ld-new
3541 ../ld-new -shared -o $@ $<
3542
3543 pr12826_1.o: pr12826_1.s
3544 $(TEST_AS) -o $@ $<
3545
3546 pr12826_2.o: pr12826_2.s
3547 $(TEST_AS) -o $@ $<
3548
3549 check_SCRIPTS += arm_unaligned_reloc.sh
3550 check_DATA += arm_unaligned_reloc.stdout arm_unaligned_reloc_r.stdout
3551
3552 arm_unaligned_reloc.stdout: arm_unaligned_reloc
3553 $(TEST_OBJDUMP) -D $< > $@
3554
3555 arm_unaligned_reloc_r.stdout: arm_unaligned_reloc_r
3556 $(TEST_OBJDUMP) -Dr $< > $@
3557
3558 arm_unaligned_reloc: arm_unaligned_reloc.o ../ld-new
3559 ../ld-new -o $@ $<
3560
3561 arm_unaligned_reloc_r: arm_unaligned_reloc.o ../ld-new
3562 ../ld-new -r -o $@ $<
3563
3564 arm_unaligned_reloc.o: arm_unaligned_reloc.s
3565 $(TEST_AS) -o $@ $<
3566
3567 MOSTLYCLEANFILES += arm_unaligned_reloc arm_unaligned_reloc_r
3568
3569 # Check ARM to ARM farcall veneers
3570
3571 check_SCRIPTS += arm_farcall_arm_arm.sh
3572 check_DATA += arm_farcall_arm_arm.stdout
3573
3574 arm_farcall_arm_arm.stdout: arm_farcall_arm_arm
3575 $(TEST_OBJDUMP) -d $< > $@
3576
3577 arm_farcall_arm_arm: arm_farcall_arm_arm.o ../ld-new
3578 ../ld-new --no-fix-arm1176 --section-start .text=0x1000 --section-start .foo=0x2001020 -o $@ $<
3579
3580 arm_farcall_arm_arm.o: arm_farcall_arm_arm.s
3581 $(TEST_AS) -o $@ $<
3582
3583 MOSTLYCLEANFILES += arm_farcall_arm_arm
3584
3585 # Check ARM to Thumb farcall veneers
3586
3587 check_SCRIPTS += arm_farcall_arm_thumb.sh
3588 check_DATA += arm_farcall_arm_thumb.stdout arm_farcall_arm_thumb_5t.stdout
3589
3590 arm_farcall_arm_thumb.stdout: arm_farcall_arm_thumb
3591 $(TEST_OBJDUMP) -D $< > $@
3592
3593 arm_farcall_arm_thumb: arm_farcall_arm_thumb.o ../ld-new
3594 ../ld-new --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
3595
3596 arm_farcall_arm_thumb.o: arm_farcall_arm_thumb.s
3597 $(TEST_AS) -o $@ $<
3598
3599 arm_farcall_arm_thumb_5t.stdout: arm_farcall_arm_thumb_5t
3600 $(TEST_OBJDUMP) -D $< > $@
3601
3602 arm_farcall_arm_thumb_5t: arm_farcall_arm_thumb_5t.o ../ld-new
3603 ../ld-new --no-fix-arm1176 --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
3604
3605 arm_farcall_arm_thumb_5t.o: arm_farcall_arm_thumb.s
3606 $(TEST_AS) -march=armv5t -o $@ $<
3607
3608 MOSTLYCLEANFILES += arm_farcall_arm_thumb arm_farcall_arm_thumb_5t
3609
3610 # Check Thumb to Thumb farcall veneers
3611
3612 check_SCRIPTS += arm_farcall_thumb_thumb.sh
3613 check_DATA += arm_farcall_thumb_thumb.stdout \
3614 arm_farcall_thumb_thumb_5t.stdout \
3615 arm_farcall_thumb_thumb_7m.stdout \
3616 arm_farcall_thumb_thumb_6m.stdout
3617
3618 arm_farcall_thumb_thumb.stdout: arm_farcall_thumb_thumb
3619 $(TEST_OBJDUMP) -D $< > $@
3620
3621 arm_farcall_thumb_thumb: arm_farcall_thumb_thumb.o ../ld-new
3622 ../ld-new --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
3623
3624 arm_farcall_thumb_thumb.o: arm_farcall_thumb_thumb.s
3625 $(TEST_AS) -march=armv4t -o $@ $<
3626
3627 arm_farcall_thumb_thumb_5t.stdout: arm_farcall_thumb_thumb_5t
3628 $(TEST_OBJDUMP) -D $< > $@
3629
3630 arm_farcall_thumb_thumb_5t: arm_farcall_thumb_thumb_5t.o ../ld-new
3631 ../ld-new --no-fix-arm1176 --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
3632
3633 arm_farcall_thumb_thumb_5t.o: arm_farcall_thumb_thumb.s
3634 $(TEST_AS) -march=armv5t -o $@ $<
3635
3636 arm_farcall_thumb_thumb_7m.stdout: arm_farcall_thumb_thumb_7m
3637 $(TEST_OBJDUMP) -D $< > $@
3638
3639 arm_farcall_thumb_thumb_7m: arm_farcall_thumb_thumb_7m.o ../ld-new
3640 ../ld-new --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
3641
3642 arm_farcall_thumb_thumb_7m.o: arm_farcall_thumb_thumb.s
3643 $(TEST_AS) -march=armv7-m -o $@ $<
3644
3645 arm_farcall_thumb_thumb_6m.stdout: arm_farcall_thumb_thumb_6m
3646 $(TEST_OBJDUMP) -D $< > $@
3647
3648 arm_farcall_thumb_thumb_6m: arm_farcall_thumb_thumb_6m.o ../ld-new
3649 ../ld-new --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
3650
3651 arm_farcall_thumb_thumb_6m.o: arm_farcall_thumb_thumb.s
3652 $(TEST_AS) -march=armv6-m -o $@ $<
3653
3654 MOSTLYCLEANFILES += arm_farcall_thumb_thumb arm_farcall_thumb_thumb_5t \
3655 arm_farcall_thumb_thumb_7m arm_farcall_thumb_thumb_6m
3656
3657 # Check Thumb to ARM farcall veneers
3658
3659 check_SCRIPTS += arm_farcall_thumb_arm.sh
3660 check_DATA += arm_farcall_thumb_arm.stdout \
3661 arm_farcall_thumb_arm_5t.stdout
3662
3663 arm_farcall_thumb_arm.stdout: arm_farcall_thumb_arm
3664 $(TEST_OBJDUMP) -D $< > $@
3665
3666 arm_farcall_thumb_arm: arm_farcall_thumb_arm.o ../ld-new
3667 ../ld-new --section-start .text=0x1c01010 --section-start .foo=0x2001014 -o $@ $<
3668
3669 arm_farcall_thumb_arm.o: arm_farcall_thumb_arm.s
3670 $(TEST_AS) -o $@ $<
3671
3672 arm_farcall_thumb_arm_5t.stdout: arm_farcall_thumb_arm_5t
3673 $(TEST_OBJDUMP) -D $< > $@
3674
3675 arm_farcall_thumb_arm_5t: arm_farcall_thumb_arm_5t.o ../ld-new
3676 ../ld-new --no-fix-arm1176 --section-start .text=0x1c01010 --section-start .foo=0x2001014 -o $@ $<
3677
3678 arm_farcall_thumb_arm_5t.o: arm_farcall_thumb_arm.s
3679 $(TEST_AS) -march=armv5t -o $@ $<
3680
3681 MOSTLYCLEANFILES += arm_farcall_thumb_arm arm_farcall_thumb_arm_5t
3682
3683 # Check handling of --target1-abs, --target1-rel and --target2 options
3684
3685 check_SCRIPTS += arm_target1_abs.sh arm_target1_rel.sh \
3686 arm_target2_rel.sh arm_target2_abs.sh arm_target2_got_rel.sh
3687 check_DATA += arm_target1_abs.stdout arm_target1_rel.stdout \
3688 arm_target2_rel.stdout arm_target2_abs.stdout arm_target2_got_rel.stdout
3689
3690 arm_target1_abs.stdout: arm_target1_abs
3691 $(TEST_OBJDUMP) -s $< > $@
3692
3693 arm_target1_abs: arm_target1.o ../ld-new
3694 ../ld-new --target1-abs --section-start .text=0x8000 -o $@ $<
3695
3696 arm_target1_rel.stdout: arm_target1_rel
3697 $(TEST_OBJDUMP) -s $< > $@
3698
3699 arm_target1_rel: arm_target1.o ../ld-new
3700 ../ld-new --target1-rel --section-start .text=0x8000 -o $@ $<
3701
3702 arm_target1.o: arm_target1.s
3703 $(TEST_AS) -o $@ $<
3704
3705 arm_target2_rel.stdout: arm_target2_rel
3706 $(TEST_OBJDUMP) -s $< > $@
3707
3708 arm_target2_rel: arm_target2.o ../ld-new
3709 ../ld-new --target2=rel --section-start .text=0x8000 -o $@ $<
3710
3711 arm_target2_abs.stdout: arm_target2_abs
3712 $(TEST_OBJDUMP) -s $< > $@
3713
3714 arm_target2_abs: arm_target2.o ../ld-new
3715 ../ld-new --target2=abs --section-start .text=0x8000 -o $@ $<
3716
3717 arm_target2_got_rel.stdout: arm_target2_got_rel
3718 $(TEST_OBJDUMP) -s $< > $@
3719
3720 arm_target2_got_rel: arm_target2.o ../ld-new
3721 ../ld-new --target2=got-rel --section-start .text=0x8000 --section-start .got=0x9000 -o $@ $<
3722
3723 arm_target2.o: arm_target2.s
3724 $(TEST_AS) -o $@ $<
3725
3726 MOSTLYCLEANFILES += arm_target1_abs arm_target1_rel \
3727 arm_target2_rel arm_target2_abs arm_target2_got_rel
3728
3729 # The test demonstrates why the constructor of a target object should not access options.
3730 check_DATA += arm_target_lazy_init
3731 MOSTLYCLEANFILES += arm_target_lazy_init
3732 arm_target_lazy_init: arm_target_lazy_init.o arm_target_lazy_init.t ../ld-new
3733 ../ld-new -T $(srcdir)/arm_target_lazy_init.t -o $@ $<
3734 arm_target_lazy_init.o: arm_target_lazy_init.s
3735 $(TEST_AS) -EL -o $@ $<
3736
3737 endif DEFAULT_TARGET_ARM
3738
3739 if DEFAULT_TARGET_AARCH64
3740
3741 check_SCRIPTS += aarch64_reloc_none.sh
3742 check_DATA += aarch64_reloc_none.stdout
3743 aarch64_reloc_none.o: aarch64_reloc_none.s
3744 $(TEST_AS) -o $@ $<
3745 aarch64_reloc_none: aarch64_reloc_none.o ../ld-new
3746 ../ld-new -o $@ aarch64_reloc_none.o --gc-sections
3747 aarch64_reloc_none.stdout: aarch64_reloc_none
3748 $(TEST_NM) $< > $@
3749
3750 MOSTLYCLEANFILES += aarch64_reloc_none
3751
3752 check_SCRIPTS += aarch64_relocs.sh
3753 check_DATA += aarch64_relocs.stdout
3754 aarch64_globals.o: aarch64_globals.s
3755 $(TEST_AS) -o $@ $<
3756 aarch64_relocs.o: aarch64_relocs.s
3757 $(TEST_AS) -o $@ $<
3758 aarch64_relocs: aarch64_relocs.o aarch64_globals.o ../ld-new
3759 ../ld-new -o $@ aarch64_relocs.o aarch64_globals.o -e0 --emit-relocs
3760 aarch64_relocs.stdout: aarch64_relocs
3761 $(TEST_OBJDUMP) -dr $< > $@
3762
3763 MOSTLYCLEANFILES += aarch64_relocs
3764
3765 endif DEFAULT_TARGET_AARCH64
3766
3767 if DEFAULT_TARGET_S390
3768
3769 check_SCRIPTS += split_s390.sh
3770 check_DATA += split_s390_z1.stdout split_s390_z2.stdout split_s390_z3.stdout \
3771 split_s390_z4.stdout split_s390_n1.stdout split_s390_n2.stdout \
3772 split_s390_a1.stdout split_s390_a2.stdout split_s390_z1_ns.stdout \
3773 split_s390_z2_ns.stdout split_s390_z3_ns.stdout split_s390_z4_ns.stdout \
3774 split_s390_n1_ns.stdout split_s390_n2_ns.stdout split_s390_r.stdout \
3775 split_s390x_z1.stdout split_s390x_z2.stdout split_s390x_z3.stdout \
3776 split_s390x_z4.stdout split_s390x_n1.stdout split_s390x_n2.stdout \
3777 split_s390x_a1.stdout split_s390x_a2.stdout split_s390x_z1_ns.stdout \
3778 split_s390x_z2_ns.stdout split_s390x_z3_ns.stdout \
3779 split_s390x_z4_ns.stdout split_s390x_n1_ns.stdout \
3780 split_s390x_n2_ns.stdout split_s390x_r.stdout
3781 SPLIT_DEFSYMS = --defsym __morestack=0x100 --defsym __morestack_non_split=0x200
3782 split_s390_1_z1.o: split_s390_1_z1.s
3783 $(TEST_AS) -m31 -o $@ $<
3784 split_s390_1_z2.o: split_s390_1_z2.s
3785 $(TEST_AS) -m31 -o $@ $<
3786 split_s390_1_z3.o: split_s390_1_z3.s
3787 $(TEST_AS) -m31 -o $@ $<
3788 split_s390_1_z4.o: split_s390_1_z4.s
3789 $(TEST_AS) -m31 -o $@ $<
3790 split_s390_1_n1.o: split_s390_1_n1.s
3791 $(TEST_AS) -m31 -o $@ $<
3792 split_s390_1_n2.o: split_s390_1_n2.s
3793 $(TEST_AS) -m31 -o $@ $<
3794 split_s390_1_a1.o: split_s390_1_a1.s
3795 $(TEST_AS) -m31 -o $@ $<
3796 split_s390_1_a2.o: split_s390_1_a2.s
3797 $(TEST_AS) -m31 -o $@ $<
3798 split_s390_2_s.o: split_s390_2_s.s
3799 $(TEST_AS) -m31 -o $@ $<
3800 split_s390_2_ns.o: split_s390_2_ns.s
3801 $(TEST_AS) -m31 -o $@ $<
3802 split_s390_z1: split_s390_1_z1.o split_s390_2_s.o ../ld-new
3803 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_z1.o split_s390_2_s.o
3804 split_s390_z1.stdout: split_s390_z1
3805 $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
3806 split_s390_z2: split_s390_1_z2.o split_s390_2_s.o ../ld-new
3807 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_z2.o split_s390_2_s.o
3808 split_s390_z2.stdout: split_s390_z2
3809 $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
3810 split_s390_z3: split_s390_1_z3.o split_s390_2_s.o ../ld-new
3811 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_z3.o split_s390_2_s.o
3812 split_s390_z3.stdout: split_s390_z3
3813 $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
3814 split_s390_z4: split_s390_1_z4.o split_s390_2_s.o ../ld-new
3815 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_z4.o split_s390_2_s.o
3816 split_s390_z4.stdout: split_s390_z4
3817 $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
3818 split_s390_n1: split_s390_1_n1.o split_s390_2_s.o ../ld-new
3819 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_n1.o split_s390_2_s.o
3820 split_s390_n1.stdout: split_s390_n1
3821 $(TEST_OBJDUMP) -d $< > $@
3822 split_s390_n2: split_s390_1_n2.o split_s390_2_s.o ../ld-new
3823 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_n2.o split_s390_2_s.o
3824 split_s390_n2.stdout: split_s390_n2
3825 $(TEST_OBJDUMP) -d $< > $@
3826 split_s390_z1_ns: split_s390_1_z1.o split_s390_2_ns.o ../ld-new
3827 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_z1.o split_s390_2_ns.o
3828 split_s390_z1_ns.stdout: split_s390_z1_ns
3829 $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
3830 split_s390_z2_ns: split_s390_1_z2.o split_s390_2_ns.o ../ld-new
3831 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_z2.o split_s390_2_ns.o
3832 split_s390_z2_ns.stdout: split_s390_z2_ns
3833 $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
3834 split_s390_z3_ns: split_s390_1_z3.o split_s390_2_ns.o ../ld-new
3835 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_z3.o split_s390_2_ns.o
3836 split_s390_z3_ns.stdout: split_s390_z3_ns
3837 $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
3838 split_s390_z4_ns: split_s390_1_z4.o split_s390_2_ns.o ../ld-new
3839 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_z4.o split_s390_2_ns.o
3840 split_s390_z4_ns.stdout: split_s390_z4_ns
3841 $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
3842 split_s390_n1_ns: split_s390_1_n1.o split_s390_2_ns.o ../ld-new
3843 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_n1.o split_s390_2_ns.o
3844 split_s390_n1_ns.stdout: split_s390_n1_ns
3845 $(TEST_OBJDUMP) -d $< > $@
3846 split_s390_n2_ns.stdout: split_s390_1_n2.o split_s390_2_ns.o ../ld-new
3847 ../ld-new $(SPLIT_DEFSYMS) -o split_s390_n2 split_s390_1_n2.o split_s390_2_ns.o > $@ 2>&1 || exit 0
3848 split_s390_a1.stdout: split_s390_1_a1.o split_s390_2_ns.o ../ld-new
3849 ../ld-new $(SPLIT_DEFSYMS) -o split_s390_a1 split_s390_1_a1.o split_s390_2_ns.o > $@ 2>&1 || exit 0
3850 split_s390_a2: split_s390_1_a2.o split_s390_2_ns.o ../ld-new
3851 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390_1_a2.o split_s390_2_ns.o
3852 split_s390_a2.stdout: split_s390_a2
3853 $(TEST_OBJDUMP) -d $< > $@
3854 split_s390_r.stdout: split_s390_1_z1.o split_s390_2_ns.o ../ld-new
3855 ../ld-new -r split_s390_1_z1.o split_s390_2_ns.o -o split_s390_r > $@ 2>&1 || exit 0
3856 split_s390x_1_z1.o: split_s390x_1_z1.s
3857 $(TEST_AS) -m64 -o $@ $<
3858 split_s390x_1_z2.o: split_s390x_1_z2.s
3859 $(TEST_AS) -m64 -o $@ $<
3860 split_s390x_1_z3.o: split_s390x_1_z3.s
3861 $(TEST_AS) -m64 -o $@ $<
3862 split_s390x_1_z4.o: split_s390x_1_z4.s
3863 $(TEST_AS) -m64 -o $@ $<
3864 split_s390x_1_n1.o: split_s390x_1_n1.s
3865 $(TEST_AS) -m64 -o $@ $<
3866 split_s390x_1_n2.o: split_s390x_1_n2.s
3867 $(TEST_AS) -m64 -o $@ $<
3868 split_s390x_1_a1.o: split_s390x_1_a1.s
3869 $(TEST_AS) -m64 -o $@ $<
3870 split_s390x_1_a2.o: split_s390x_1_a2.s
3871 $(TEST_AS) -m64 -o $@ $<
3872 split_s390x_2_s.o: split_s390x_2_s.s
3873 $(TEST_AS) -m64 -o $@ $<
3874 split_s390x_2_ns.o: split_s390x_2_ns.s
3875 $(TEST_AS) -m64 -o $@ $<
3876 split_s390x_z1: split_s390x_1_z1.o split_s390x_2_s.o ../ld-new
3877 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_z1.o split_s390x_2_s.o
3878 split_s390x_z1.stdout: split_s390x_z1
3879 $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
3880 split_s390x_z2: split_s390x_1_z2.o split_s390x_2_s.o ../ld-new
3881 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_z2.o split_s390x_2_s.o
3882 split_s390x_z2.stdout: split_s390x_z2
3883 $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
3884 split_s390x_z3: split_s390x_1_z3.o split_s390x_2_s.o ../ld-new
3885 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_z3.o split_s390x_2_s.o
3886 split_s390x_z3.stdout: split_s390x_z3
3887 $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
3888 split_s390x_z4: split_s390x_1_z4.o split_s390x_2_s.o ../ld-new
3889 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_z4.o split_s390x_2_s.o
3890 split_s390x_z4.stdout: split_s390x_z4
3891 $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
3892 split_s390x_n1: split_s390x_1_n1.o split_s390x_2_s.o ../ld-new
3893 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_n1.o split_s390x_2_s.o
3894 split_s390x_n1.stdout: split_s390x_n1
3895 $(TEST_OBJDUMP) -d $< > $@
3896 split_s390x_n2: split_s390x_1_n2.o split_s390x_2_s.o ../ld-new
3897 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_n2.o split_s390x_2_s.o
3898 split_s390x_n2.stdout: split_s390x_n2
3899 $(TEST_OBJDUMP) -d $< > $@
3900 split_s390x_z1_ns: split_s390x_1_z1.o split_s390x_2_ns.o ../ld-new
3901 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_z1.o split_s390x_2_ns.o
3902 split_s390x_z1_ns.stdout: split_s390x_z1_ns
3903 $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
3904 split_s390x_z2_ns: split_s390x_1_z2.o split_s390x_2_ns.o ../ld-new
3905 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_z2.o split_s390x_2_ns.o
3906 split_s390x_z2_ns.stdout: split_s390x_z2_ns
3907 $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
3908 split_s390x_z3_ns: split_s390x_1_z3.o split_s390x_2_ns.o ../ld-new
3909 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_z3.o split_s390x_2_ns.o
3910 split_s390x_z3_ns.stdout: split_s390x_z3_ns
3911 $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
3912 split_s390x_z4_ns: split_s390x_1_z4.o split_s390x_2_ns.o ../ld-new
3913 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_z4.o split_s390x_2_ns.o
3914 split_s390x_z4_ns.stdout: split_s390x_z4_ns
3915 $(TEST_OBJDUMP) -j .rodata -j .text -D $< > $@
3916 split_s390x_n1_ns: split_s390x_1_n1.o split_s390x_2_ns.o ../ld-new
3917 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_n1.o split_s390x_2_ns.o
3918 split_s390x_n1_ns.stdout: split_s390x_n1_ns
3919 $(TEST_OBJDUMP) -d $< > $@
3920 split_s390x_n2_ns.stdout: split_s390x_1_n2.o split_s390x_2_ns.o ../ld-new
3921 ../ld-new $(SPLIT_DEFSYMS) -o split_s390x_n2 split_s390x_1_n2.o split_s390x_2_ns.o > $@ 2>&1 || exit 0
3922 split_s390x_a1.stdout: split_s390x_1_a1.o split_s390x_2_ns.o ../ld-new
3923 ../ld-new $(SPLIT_DEFSYMS) -o split_s390x_a1 split_s390x_1_a1.o split_s390x_2_ns.o > $@ 2>&1 || exit 0
3924 split_s390x_a2: split_s390x_1_a2.o split_s390x_2_ns.o ../ld-new
3925 ../ld-new $(SPLIT_DEFSYMS) -o $@ split_s390x_1_a2.o split_s390x_2_ns.o
3926 split_s390x_a2.stdout: split_s390x_a2
3927 $(TEST_OBJDUMP) -d $< > $@
3928 split_s390x_r.stdout: split_s390x_1_z1.o split_s390x_2_ns.o ../ld-new
3929 ../ld-new -r split_s390x_1_z1.o split_s390x_2_ns.o -o split_s390x_r > $@ 2>&1 || exit 0
3930 MOSTLYCLEANFILES += split_s390_z1 split_s390_z2 split_s390_z3 \
3931 split_s390_z4 split_s390_n1 split_s390_n2 split_s390_a1 \
3932 split_s390_a2 split_s390_z1_ns split_s390_z2_ns split_s390_z3_ns \
3933 split_s390_z4_ns split_s390_n1_ns split_s390_n2_ns split_s390_r \
3934 split_s390x_z1 split_s390x_z2 split_s390x_z3 split_s390x_z4 \
3935 split_s390x_n1 split_s390x_n2 split_s390x_a1 split_s390x_a2 \
3936 split_s390x_z1_ns split_s390x_z2_ns split_s390x_z3_ns \
3937 split_s390x_z4_ns split_s390x_n1_ns split_s390x_n2_ns split_s390x_r
3938
3939 endif DEFAULT_TARGET_S390
3940
3941 endif NATIVE_OR_CROSS_LINKER
3942
3943 # Tests for the dwp tool.
3944 # We don't want to rely yet on GCC support for -gsplit-dwarf,
3945 # so we use (for now) test cases in x86 assembly language,
3946 # compiled from the dwp_test_*.cc sources.
3947
3948 if DEFAULT_TARGET_X86_64
3949
3950 dwp_test_main.o: dwp_test_main.s
3951 $(TEST_AS) -o $@ $<
3952 dwp_test_1.o: dwp_test_1.s
3953 $(TEST_AS) -o $@ $<
3954 dwp_test_1b.o: dwp_test_1b.s
3955 $(TEST_AS) -o $@ $<
3956 dwp_test_2.o: dwp_test_2.s
3957 $(TEST_AS) -o $@ $<
3958
3959 dwp_test_main.dwo: dwp_test_main.o
3960 $(TEST_OBJCOPY) --extract-dwo $< $@
3961 dwp_test_1.dwo: dwp_test_1.o
3962 $(TEST_OBJCOPY) --extract-dwo $< $@
3963 dwp_test_1b.dwo: dwp_test_1b.o
3964 $(TEST_OBJCOPY) --extract-dwo $< $@
3965 dwp_test_2.dwo: dwp_test_2.o
3966 $(TEST_OBJCOPY) --extract-dwo $< $@
3967
3968 MOSTLYCLEANFILES += *.dwo *.dwp
3969 check_SCRIPTS += dwp_test_1.sh
3970 check_DATA += dwp_test_1.stdout
3971 dwp_test_1.stdout: dwp_test_1.dwp
3972 $(TEST_READELF) -wi $< > $@
3973 dwp_test_1.dwp: ../dwp dwp_test_main.dwo dwp_test_1.dwo dwp_test_1b.dwo dwp_test_2.dwo
3974 ../dwp -o $@ dwp_test_main.dwo dwp_test_1.dwo dwp_test_1b.dwo dwp_test_2.dwo
3975
3976 check_SCRIPTS += dwp_test_2.sh
3977 check_DATA += dwp_test_2.stdout
3978 dwp_test_2.stdout: dwp_test_2.dwp
3979 $(TEST_READELF) -wi $< > $@
3980 dwp_test_2.dwp: ../dwp dwp_test_2a.dwp dwp_test_2b.dwp
3981 ../dwp -o $@ dwp_test_2a.dwp dwp_test_2b.dwp
3982 dwp_test_2a.dwp: ../dwp dwp_test_main.dwo dwp_test_1.dwo
3983 ../dwp -o $@ dwp_test_main.dwo dwp_test_1.dwo
3984 dwp_test_2b.dwp: ../dwp dwp_test_1b.dwo dwp_test_2.dwo
3985 ../dwp -o $@ dwp_test_1b.dwo dwp_test_2.dwo
3986
3987 endif DEFAULT_TARGET_X86_64
This page took 0.108124 seconds and 3 git commands to generate.