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