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