OpenCores
URL https://opencores.org/ocsvn/open8_urisc/open8_urisc/trunk

Subversion Repositories open8_urisc

[/] [open8_urisc/] [trunk/] [gnu/] [binutils/] [gold/] [testsuite/] [Makefile.am] - Blame information for rev 62

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 27 khays
# 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
# The two_file_test tests -fmerge-constants, so we simply always turn
11
# it on.  This may need to be controlled by a configure option
12
# eventually.
13
AM_CFLAGS = $(WARN_CFLAGS) $(LFS_CFLAGS) -fmerge-constants
14
AM_CXXFLAGS = $(WARN_CXXFLAGS) $(LFS_CFLAGS) -fmerge-constants
15
 
16
AM_CPPFLAGS = \
17
        -I$(srcdir) -I$(srcdir)/.. -I$(srcdir)/../../include \
18
        -I$(srcdir)/../../elfcpp -I.. \
19
        -DLOCALEDIR="\"$(datadir)/locale\"" \
20
        @INCINTL@
21
 
22
TEST_READELF = $(top_builddir)/../binutils/readelf
23
TEST_OBJDUMP = $(top_builddir)/../binutils/objdump
24
TEST_CXXFILT = $(top_builddir)/../binutils/cxxfilt
25
TEST_STRIP = $(top_builddir)/../binutils/strip-new
26
TEST_AR = $(top_builddir)/../binutils/ar
27
TEST_NM = $(top_builddir)/../binutils/nm-new
28
TEST_AS = $(top_builddir)/../gas/as-new
29
 
30
if PLUGINS
31
LIBDL = -ldl
32
endif
33
 
34
if THREADS
35
THREADSLIB = -lpthread
36
endif
37
 
38
if OMP_SUPPORT
39
TLS_TEST_C_CFLAGS = -fopenmp
40
endif
41
 
42
# 'make clean' is good about deleting some intermediate files (such as
43
# .o's), but not all of them (such as .so's and .err files).  We
44
# improve on that here.  automake-1.9 info docs say "mostlyclean" is
45
# the right choice for files 'make' builds that people rebuild.
46
MOSTLYCLEANFILES = *.so *.syms *.stdout
47
 
48
 
49
# We will add to these later, for each individual test.  Note
50
# that we add each test under check_SCRIPTS or check_PROGRAMS;
51
# the TESTS variable is automatically populated from these.
52
check_SCRIPTS =
53
check_DATA =
54
check_PROGRAMS =
55
BUILT_SOURCES =
56
 
57
TESTS = $(check_SCRIPTS) $(check_PROGRAMS)
58
 
59
# ---------------------------------------------------------------------
60
# These tests test the internals of gold (unittests).
61
 
62
# Infrastucture needed for the unittests
63
check_LIBRARIES = libgoldtest.a
64
libgoldtest_a_SOURCES = test.cc testmain.cc testfile.cc
65
 
66
DEPENDENCIES = \
67
        libgoldtest.a ../libgold.a ../../libiberty/libiberty.a $(LIBINTL_DEP)
68
LDADD = libgoldtest.a ../libgold.a ../../libiberty/libiberty.a $(LIBINTL) \
69
        $(THREADSLIB) $(LIBDL)
70
 
71
 
72
# The unittests themselves
73
if NATIVE_OR_CROSS_LINKER
74
if GCC
75
 
76
# Infrastucture needed for the unittests: a directory where the linker
77
# is named 'ld'.  This is because the -B flag appends 'ld' to its arg.
78
gcctestdir/ld: ../ld-new
79
        test -d gcctestdir || mkdir -p gcctestdir
80
        rm -f gcctestdir/ld
81
        (cd gcctestdir && $(LN_S) ../../ld-new ld)
82
 
83
endif GCC
84
 
85
check_PROGRAMS += object_unittest
86
object_unittest_SOURCES = object_unittest.cc
87
 
88
check_PROGRAMS += binary_unittest
89
binary_unittest_SOURCES = binary_unittest.cc
90
 
91
endif NATIVE_OR_CROSS_LINKER
92
 
93
# ---------------------------------------------------------------------
94
# These tests test the output of gold (end-to-end tests).  In
95
# particular, they make sure that gold can link "difficult" object
96
# files, and the resulting object files run correctly.  These can only
97
# run if we've built ld-new for the native architecture (that is,
98
# we're not cross-compiling it), since we run ld-new as part of these
99
# tests.  We use the gcc-specific flag '-B' to use our linker instead
100
# of the default linker, which is why we only run our tests under gcc.
101
 
102
if NATIVE_LINKER
103
if GCC
104
 
105
# Each of these .o's is a useful, small complete program.  They're
106
# particularly useful for making sure ld-new's flags do what they're
107
# supposed to (hence their names), but are used for many tests that
108
# don't actually involve analyzing input data.
109
flagstest_debug.o: constructor_test.cc
110
        $(CXXCOMPILE) -O0 -g -c -o $@ $<
111
flagstest_ndebug.o: constructor_test.cc
112
        $(CXXCOMPILE) -O0 -c -o $@ $<
113
 
114
check_SCRIPTS += incremental_test.sh
115
check_DATA += incremental_test.stdout
116
MOSTLYCLEANFILES += incremental_test
117
incremental_test_1.o: incremental_test_1.c
118
        $(COMPILE) -O0 -c -ffunction-sections -g -o $@ $<
119
incremental_test_2.o: incremental_test_2.c
120
        $(COMPILE) -O0 -c -ffunction-sections -g -o $@ $<
121
incremental_test: incremental_test_1.o incremental_test_2.o gcctestdir/ld
122
        $(LINK) -Bgcctestdir/ -Wl,--incremental-full incremental_test_1.o incremental_test_2.o -Wl,-debug 2> incremental_test.cmdline
123
incremental_test.stdout: incremental_test ../incremental-dump
124
        ../incremental-dump incremental_test > $@
125
 
126
check_SCRIPTS += gc_comdat_test.sh
127
check_DATA += gc_comdat_test.stdout
128
MOSTLYCLEANFILES += gc_comdat_test
129
gc_comdat_test_1.o: gc_comdat_test_1.cc
130
        $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
131
gc_comdat_test_2.o: gc_comdat_test_2.cc
132
        $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
133
gc_comdat_test: gc_comdat_test_1.o gc_comdat_test_2.o gcctestdir/ld
134
        $(CXXLINK) -Bgcctestdir/ -Wl,--gc-sections gc_comdat_test_1.o gc_comdat_test_2.o
135
gc_comdat_test.stdout: gc_comdat_test
136
        $(TEST_NM) -C gc_comdat_test > gc_comdat_test.stdout
137
 
138
check_SCRIPTS += gc_tls_test.sh
139
check_DATA += gc_tls_test.stdout
140
MOSTLYCLEANFILES += gc_tls_test
141
gc_tls_test.o: gc_tls_test.cc
142
        $(CXXCOMPILE) -O0 -c -g -o $@ $<
143
gc_tls_test:gc_tls_test.o gcctestdir/ld
144
        $(CXXLINK) -Bgcctestdir/ -Wl,--gc-sections gc_tls_test.o
145
gc_tls_test.stdout: gc_tls_test
146
        $(TEST_NM) -C gc_tls_test > gc_tls_test.stdout
147
 
148
check_SCRIPTS += gc_orphan_section_test.sh
149
check_DATA += gc_orphan_section_test.stdout
150
MOSTLYCLEANFILES += gc_orphan_section_test
151
gc_orphan_section_test.o: gc_orphan_section_test.cc
152
        $(CXXCOMPILE) -O0 -c -g -o $@ $<
153
gc_orphan_section_test:gc_orphan_section_test.o gcctestdir/ld
154
        $(CXXLINK) -Bgcctestdir/ -Wl,--gc-sections gc_orphan_section_test.o
155
gc_orphan_section_test.stdout: gc_orphan_section_test
156
        $(TEST_NM) gc_orphan_section_test > gc_orphan_section_test.stdout
157
 
158
check_SCRIPTS += icf_test.sh
159
check_DATA += icf_test.stdout
160
MOSTLYCLEANFILES += icf_test
161
icf_test.o: icf_test.cc
162
        $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
163
icf_test: icf_test.o gcctestdir/ld
164
        $(CXXLINK) -Bgcctestdir/ -Wl,--icf=all icf_test.o
165
icf_test.stdout: icf_test
166
        $(TEST_NM) -C icf_test > icf_test.stdout
167
 
168
check_SCRIPTS += icf_keep_unique_test.sh
169
check_DATA += icf_keep_unique_test.stdout
170
MOSTLYCLEANFILES += icf_keep_unique_test
171
icf_keep_unique_test.o: icf_keep_unique_test.cc
172
        $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
173
icf_keep_unique_test: icf_keep_unique_test.o gcctestdir/ld
174
        $(CXXLINK) -Bgcctestdir/ -Wl,--icf=all -Wl,--keep-unique,_Z11unique_funcv icf_keep_unique_test.o
175
icf_keep_unique_test.stdout: icf_keep_unique_test
176
        $(TEST_NM) -C icf_keep_unique_test > icf_keep_unique_test.stdout
177
 
178
check_SCRIPTS += icf_safe_test.sh
179
check_DATA += icf_safe_test_1.stdout icf_safe_test_2.stdout
180
MOSTLYCLEANFILES += icf_safe_test
181
icf_safe_test.o: icf_safe_test.cc
182
        $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
183
icf_safe_test: icf_safe_test.o gcctestdir/ld
184
        $(CXXLINK) -Bgcctestdir/ -Wl,--icf=safe icf_safe_test.o
185
icf_safe_test_1.stdout: icf_safe_test
186
        $(TEST_NM) icf_safe_test > icf_safe_test_1.stdout
187
icf_safe_test_2.stdout: icf_safe_test
188
        $(TEST_READELF) -h icf_safe_test > icf_safe_test_2.stdout
189
 
190
check_SCRIPTS += icf_safe_so_test.sh
191
check_DATA += icf_safe_so_test_1.stdout icf_safe_so_test_2.stdout
192
MOSTLYCLEANFILES += icf_safe_so_test
193
icf_safe_so_test.o: icf_safe_so_test.cc
194
        $(CXXCOMPILE) -O0 -c -ffunction-sections -fPIC -g -o $@ $<
195
icf_safe_so_test: icf_safe_so_test.o gcctestdir/ld
196
        $(CXXLINK) -Bgcctestdir/ -Wl,--icf=safe icf_safe_so_test.o -fPIC -shared
197
icf_safe_so_test_1.stdout: icf_safe_so_test
198
        $(TEST_NM) icf_safe_so_test > icf_safe_so_test_1.stdout
199
icf_safe_so_test_2.stdout: icf_safe_so_test
200
        $(TEST_READELF) -h icf_safe_so_test > icf_safe_so_test_2.stdout
201
 
202
check_SCRIPTS += final_layout.sh
203
check_DATA += final_layout.stdout
204
MOSTLYCLEANFILES += final_layout
205
final_layout.o: final_layout.cc
206
        $(CXXCOMPILE) -O0 -c -ffunction-sections  -fdata-sections -g -o $@ $<
207
final_layout_sequence.txt:
208
        (echo "*_Z3barv*" && echo ".text._Z3bazv" && echo "*_Z3foov*" && echo "*global_varb*" && echo "*global_vara*" && echo "*global_varc*") > final_layout_sequence.txt
209
final_layout: final_layout.o final_layout_sequence.txt gcctestdir/ld
210
        $(CXXLINK) -Bgcctestdir/ -Wl,--section-ordering-file,final_layout_sequence.txt final_layout.o
211
final_layout.stdout: final_layout
212
        $(TEST_NM) -n final_layout > final_layout.stdout
213
 
214
check_PROGRAMS += icf_virtual_function_folding_test
215
MOSTLYCLEANFILES += icf_virtual_function_folding_test
216
icf_virtual_function_folding_test.o: icf_virtual_function_folding_test.cc
217
        $(CXXCOMPILE) -O0 -c -ffunction-sections -fPIE -g -o $@ $<
218
icf_virtual_function_folding_test: icf_virtual_function_folding_test.o gcctestdir/ld
219
        $(CXXLINK) -Bgcctestdir/ -Wl,--icf=all icf_virtual_function_folding_test.o -pie
220
 
221
check_SCRIPTS += icf_preemptible_functions_test.sh
222
check_DATA += icf_preemptible_functions_test.stdout
223
MOSTLYCLEANFILES += icf_preemptible_functions_test
224
icf_preemptible_functions_test.o: icf_preemptible_functions_test.cc
225
        $(CXXCOMPILE) -O0 -c -ffunction-sections -fPIC -g -o $@ $<
226
icf_preemptible_functions_test: icf_preemptible_functions_test.o gcctestdir/ld
227
        $(CXXLINK) -Bgcctestdir/ -Wl,--icf=all icf_preemptible_functions_test.o -fPIC -shared
228
icf_preemptible_functions_test.stdout: icf_preemptible_functions_test
229
        $(TEST_NM) icf_preemptible_functions_test > icf_preemptible_functions_test.stdout
230
 
231
check_SCRIPTS += icf_string_merge_test.sh
232
check_DATA += icf_string_merge_test.stdout
233
MOSTLYCLEANFILES += icf_string_merge_test
234
icf_string_merge_test.o: icf_string_merge_test.cc
235
        $(CXXCOMPILE) -O0 -c -ffunction-sections -fPIC -g -o $@ $<
236
icf_string_merge_test: icf_string_merge_test.o gcctestdir/ld
237
        $(CXXLINK) -Bgcctestdir/ -Wl,--icf=all icf_string_merge_test.o
238
icf_string_merge_test.stdout: icf_string_merge_test
239
        $(TEST_NM) icf_string_merge_test > icf_string_merge_test.stdout
240
 
241
check_SCRIPTS += icf_sht_rel_addend_test.sh
242
check_DATA += icf_sht_rel_addend_test.stdout
243
MOSTLYCLEANFILES += icf_sht_rel_addend_test
244
icf_sht_rel_addend_test_1.o: icf_sht_rel_addend_test_1.cc
245
        $(CXXCOMPILE) -O0 -c -ffunction-sections -fPIC -g -o $@ $<
246
icf_sht_rel_addend_test_2.o: icf_sht_rel_addend_test_2.cc
247
        $(CXXCOMPILE) -O0 -c -ffunction-sections -fPIC -g -o $@ $<
248
icf_sht_rel_addend_test: icf_sht_rel_addend_test_1.o icf_sht_rel_addend_test_2.o gcctestdir/ld
249
        $(CXXLINK) -Bgcctestdir/ -Wl,--icf=all icf_sht_rel_addend_test_1.o icf_sht_rel_addend_test_2.o
250
icf_sht_rel_addend_test.stdout: icf_sht_rel_addend_test
251
        $(TEST_NM) icf_sht_rel_addend_test > icf_sht_rel_addend_test.stdout
252
 
253
check_PROGRAMS += basic_test
254
check_PROGRAMS += basic_static_test
255
check_PROGRAMS += basic_pic_test
256
check_PROGRAMS += basic_static_pic_test
257
basic_test.o: basic_test.cc
258
        $(CXXCOMPILE) -O0 -c -o $@ $<
259
basic_test: basic_test.o gcctestdir/ld
260
        $(CXXLINK) -Bgcctestdir/ basic_test.o
261
basic_static_test: basic_test.o gcctestdir/ld
262
        $(CXXLINK) -Bgcctestdir/ -static basic_test.o
263
 
264
basic_pic_test.o: basic_test.cc
265
        $(CXXCOMPILE) -O0 -c -fpic -o $@ $<
266
basic_pic_test: basic_pic_test.o gcctestdir/ld
267
        $(CXXLINK) -Bgcctestdir/ basic_pic_test.o
268
basic_static_pic_test: basic_pic_test.o gcctestdir/ld
269
        $(CXXLINK) -Bgcctestdir/ -static basic_pic_test.o
270
 
271
check_PROGRAMS += basic_pie_test
272
basic_pie_test.o: basic_test.cc
273
        $(CXXCOMPILE) -O0 -c -fpie -o $@ $<
274
basic_pie_test: basic_pie_test.o gcctestdir/ld
275
        $(CXXLINK) -Bgcctestdir/ -pie basic_pie_test.o
276
 
277
check_PROGRAMS += constructor_test
278
check_PROGRAMS += constructor_static_test
279
constructor_test_SOURCES = constructor_test.cc
280
constructor_test_DEPENDENCIES = gcctestdir/ld
281
constructor_test_LDFLAGS = -Bgcctestdir/
282
constructor_test_LDADD =
283
 
284
constructor_static_test_SOURCES = $(constructor_test_SOURCES)
285
constructor_static_test_DEPENDENCIES = $(constructor_test_DEPENDENCIES)
286
constructor_static_test_LDFLAGS = $(constructor_test_LDFLAGS) -static
287
constructor_static_test_LDADD = $(constructor_test_LDADD)
288
 
289
 
290
check_PROGRAMS += two_file_test
291
check_PROGRAMS += two_file_static_test
292
check_PROGRAMS += two_file_pic_test
293
two_file_test_SOURCES = \
294
        two_file_test_1.cc \
295
        two_file_test_1b.cc \
296
        two_file_test_2.cc \
297
        two_file_test_main.cc \
298
        two_file_test.h
299
two_file_test_DEPENDENCIES = gcctestdir/ld
300
two_file_test_LDFLAGS = -Bgcctestdir/
301
two_file_test_LDADD =
302
 
303
two_file_static_test_SOURCES = $(two_file_test_SOURCES)
304
two_file_static_test_DEPENDENCIES = $(two_file_test_DEPENDENCIES)
305
two_file_static_test_LDFLAGS = $(two_file_test_LDFLAGS) -static
306
two_file_static_test_LDADD = $(two_file_test_LDADD)
307
 
308
two_file_pic_test_SOURCES = two_file_test_main.cc
309
two_file_pic_test_DEPENDENCIES = \
310
        gcctestdir/ld two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o
311
two_file_pic_test_LDFLAGS = -Bgcctestdir/
312
two_file_pic_test_LDADD = two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o
313
 
314
 
315
check_PROGRAMS += two_file_shared_1_test
316
check_PROGRAMS += two_file_shared_2_test
317
check_PROGRAMS += two_file_shared_1_pic_2_test
318
check_PROGRAMS += two_file_shared_2_pic_1_test
319
check_PROGRAMS += two_file_same_shared_test
320
check_PROGRAMS += two_file_separate_shared_12_test
321
check_PROGRAMS += two_file_separate_shared_21_test
322
two_file_test_1_pic.o: two_file_test_1.cc
323
        $(CXXCOMPILE) -c -fpic -o $@ $<
324
two_file_test_1b_pic.o: two_file_test_1b.cc
325
        $(CXXCOMPILE) -c -fpic -o $@ $<
326
two_file_test_2_pic.o: two_file_test_2.cc
327
        $(CXXCOMPILE) -c -fpic -o $@ $<
328
two_file_shared_1.so: two_file_test_1_pic.o two_file_test_1b_pic.o gcctestdir/ld
329
        $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1_pic.o two_file_test_1b_pic.o
330
two_file_shared_2.so: two_file_test_2_pic.o gcctestdir/ld
331
        $(CXXLINK) -Bgcctestdir/ -shared two_file_test_2_pic.o
332
two_file_shared.so: two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o gcctestdir/ld
333
        $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o
334
 
335
two_file_shared_1_test_SOURCES = two_file_test_2.cc two_file_test_main.cc
336
two_file_shared_1_test_DEPENDENCIES = gcctestdir/ld two_file_shared_1.so
337
two_file_shared_1_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
338
two_file_shared_1_test_LDADD = two_file_shared_1.so
339
 
340
two_file_shared_2_test_SOURCES = two_file_test_1.cc two_file_test_1b.cc two_file_test_main.cc
341
two_file_shared_2_test_DEPENDENCIES = gcctestdir/ld two_file_shared_2.so
342
two_file_shared_2_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
343
two_file_shared_2_test_LDADD = two_file_shared_2.so
344
 
345
two_file_shared_1_pic_2_test_SOURCES = two_file_test_main.cc
346
two_file_shared_1_pic_2_test_DEPENDENCIES = \
347
        gcctestdir/ld two_file_shared_2.so two_file_test_1_pic.o two_file_test_1b_pic.o
348
two_file_shared_1_pic_2_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
349
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
350
 
351
two_file_shared_2_pic_1_test_SOURCES = two_file_test_main.cc
352
two_file_shared_2_pic_1_test_DEPENDENCIES = \
353
        gcctestdir/ld two_file_shared_2.so two_file_test_2_pic.o
354
two_file_shared_2_pic_1_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
355
two_file_shared_2_pic_1_test_LDADD = two_file_test_2_pic.o two_file_shared_1.so
356
 
357
two_file_same_shared_test_SOURCES = two_file_test_main.cc
358
two_file_same_shared_test_DEPENDENCIES = gcctestdir/ld two_file_shared.so
359
two_file_same_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
360
two_file_same_shared_test_LDADD = two_file_shared.so
361
 
362
two_file_separate_shared_12_test_SOURCES = two_file_test_main.cc
363
two_file_separate_shared_12_test_DEPENDENCIES = \
364
        gcctestdir/ld two_file_shared_1.so two_file_shared_2.so
365
two_file_separate_shared_12_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
366
two_file_separate_shared_12_test_LDADD = \
367
        two_file_shared_1.so two_file_shared_2.so
368
 
369
two_file_separate_shared_21_test_SOURCES = two_file_test_main.cc
370
two_file_separate_shared_21_test_DEPENDENCIES = \
371
        gcctestdir/ld two_file_shared_1.so two_file_shared_2.so
372
two_file_separate_shared_21_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
373
two_file_separate_shared_21_test_LDADD = \
374
        two_file_shared_2.so two_file_shared_1.so
375
 
376
check_PROGRAMS += two_file_relocatable_test
377
two_file_relocatable_test_SOURCES = two_file_test_main.cc
378
two_file_relocatable_test_DEPENDENCIES = \
379
        gcctestdir/ld two_file_relocatable.o
380
two_file_relocatable_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
381
two_file_relocatable_test_LDADD = two_file_relocatable.o
382
two_file_relocatable.o: gcctestdir/ld two_file_test_1.o two_file_test_1b.o two_file_test_2.o
383
        gcctestdir/ld -r -o $@ two_file_test_1.o two_file_test_1b.o two_file_test_2.o
384
 
385
check_PROGRAMS += two_file_pie_test
386
two_file_test_1_pie.o: two_file_test_1.cc
387
        $(CXXCOMPILE) -c -fpie -o $@ $<
388
two_file_test_1b_pie.o: two_file_test_1b.cc
389
        $(CXXCOMPILE) -c -fpie -o $@ $<
390
two_file_test_2_pie.o: two_file_test_2.cc
391
        $(CXXCOMPILE) -c -fpie -o $@ $<
392
two_file_test_main_pie.o: two_file_test_main.cc
393
        $(CXXCOMPILE) -c -fpie -o $@ $<
394
two_file_pie_test: two_file_test_1_pie.o two_file_test_1b_pie.o \
395
                two_file_test_2_pie.o two_file_test_main_pie.o gcctestdir/ld
396
        $(CXXLINK) -Bgcctestdir/ -pie two_file_test_1_pie.o two_file_test_1b_pie.o two_file_test_2_pie.o two_file_test_main_pie.o
397
 
398
check_SCRIPTS += two_file_shared.sh
399
check_DATA += two_file_shared.dbg
400
MOSTLYCLEANFILES += two_file_shared.dbg
401
two_file_shared.dbg: two_file_shared.so
402
        $(TEST_READELF) -w $< >$@ 2>/dev/null
403
 
404
# The nonpic tests will fail on platforms which can not put non-PIC
405
# code into shared libraries, so we just don't run them in that case.
406
if FN_PTRS_IN_SO_WITHOUT_PIC
407
 
408
check_PROGRAMS += two_file_shared_1_nonpic_test
409
check_PROGRAMS += two_file_shared_2_nonpic_test
410
check_PROGRAMS += two_file_same_shared_nonpic_test
411
check_PROGRAMS += two_file_separate_shared_12_nonpic_test
412
check_PROGRAMS += two_file_separate_shared_21_nonpic_test
413
check_PROGRAMS += two_file_mixed_shared_test
414
check_PROGRAMS += two_file_mixed_2_shared_test
415
two_file_shared_1_nonpic.so: two_file_test_1.o gcctestdir/ld
416
        $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1.o two_file_test_1b.o
417
two_file_shared_2_nonpic.so: two_file_test_2.o gcctestdir/ld
418
        $(CXXLINK) -Bgcctestdir/ -shared two_file_test_2.o
419
two_file_shared_nonpic.so: two_file_test_1.o two_file_test_1b.o two_file_test_2.o gcctestdir/ld
420
        $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1.o two_file_test_1b.o two_file_test_2.o
421
two_file_shared_mixed.so: two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2.o gcctestdir/ld
422
        $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2.o
423
two_file_shared_mixed_1.so: two_file_test_1.o two_file_test_1b_pic.o two_file_shared_2.so gcctestdir/ld
424
        $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1.o two_file_test_1b_pic.o two_file_shared_2.so
425
 
426
two_file_shared_1_nonpic_test_SOURCES = \
427
        two_file_test_2.cc two_file_test_main.cc
428
two_file_shared_1_nonpic_test_DEPENDENCIES = \
429
        gcctestdir/ld two_file_shared_1_nonpic.so
430
two_file_shared_1_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
431
two_file_shared_1_nonpic_test_LDADD = two_file_shared_1_nonpic.so
432
 
433
two_file_shared_2_nonpic_test_SOURCES = \
434
        two_file_test_1.cc two_file_test_1b.cc two_file_test_main.cc
435
two_file_shared_2_nonpic_test_DEPENDENCIES = \
436
        gcctestdir/ld two_file_shared_2_nonpic.so
437
two_file_shared_2_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
438
two_file_shared_2_nonpic_test_LDADD = two_file_shared_2_nonpic.so
439
 
440
two_file_same_shared_nonpic_test_SOURCES = two_file_test_main.cc
441
two_file_same_shared_nonpic_test_DEPENDENCIES = \
442
        gcctestdir/ld two_file_shared_nonpic.so
443
two_file_same_shared_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
444
two_file_same_shared_nonpic_test_LDADD = two_file_shared_nonpic.so
445
 
446
two_file_separate_shared_12_nonpic_test_SOURCES = two_file_test_main.cc
447
two_file_separate_shared_12_nonpic_test_DEPENDENCIES = \
448
        gcctestdir/ld two_file_shared_1_nonpic.so two_file_shared_2_nonpic.so
449
two_file_separate_shared_12_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
450
two_file_separate_shared_12_nonpic_test_LDADD = \
451
        two_file_shared_1_nonpic.so two_file_shared_2_nonpic.so
452
 
453
two_file_separate_shared_21_nonpic_test_SOURCES = two_file_test_main.cc
454
two_file_separate_shared_21_nonpic_test_DEPENDENCIES = \
455
        gcctestdir/ld two_file_shared_1_nonpic.so two_file_shared_2_nonpic.so
456
two_file_separate_shared_21_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
457
two_file_separate_shared_21_nonpic_test_LDADD = \
458
        two_file_shared_2_nonpic.so two_file_shared_1_nonpic.so
459
 
460
two_file_mixed_shared_test_SOURCES = two_file_test_main.cc
461
two_file_mixed_shared_test_DEPENDENCIES = gcctestdir/ld two_file_shared_mixed.so
462
two_file_mixed_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
463
two_file_mixed_shared_test_LDADD = two_file_shared_mixed.so
464
 
465
two_file_mixed_2_shared_test_SOURCES = two_file_test_main.cc
466
two_file_mixed_2_shared_test_DEPENDENCIES = gcctestdir/ld two_file_shared_mixed_1.so two_file_shared_2.so
467
two_file_mixed_2_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
468
two_file_mixed_2_shared_test_LDADD = two_file_shared_mixed_1.so two_file_shared_2.so
469
 
470
check_PROGRAMS += two_file_mixed_pie_test
471
two_file_mixed_pie_test: two_file_test_1.o two_file_test_1b_pie.o \
472
                two_file_test_main_pie.o two_file_shared_2.so gcctestdir/ld
473
        $(CXXLINK) -Bgcctestdir/ -Wl,-R,. -pie two_file_test_1.o two_file_test_1b_pie.o two_file_test_main_pie.o two_file_shared_2.so
474
 
475
endif FN_PTRS_IN_SO_WITHOUT_PIC
476
 
477
check_PROGRAMS += two_file_strip_test
478
two_file_strip_test: two_file_test
479
        $(TEST_STRIP) -o two_file_strip_test two_file_test
480
 
481
check_PROGRAMS += two_file_same_shared_strip_test
482
two_file_same_shared_strip_test_SOURCES = two_file_test_main.cc
483
two_file_same_shared_strip_test_DEPENDENCIES = \
484
        gcctestdir/ld two_file_shared_strip.so
485
two_file_same_shared_strip_test_LDFLAGS = -Bgcctestdir/ -Wl,-R.
486
two_file_same_shared_strip_test_LDADD = two_file_shared_strip.so
487
two_file_shared_strip.so: two_file_shared.so
488
        $(TEST_STRIP) -S -o two_file_shared_strip.so two_file_shared.so
489
 
490
check_PROGRAMS += common_test_1
491
common_test_1_SOURCES = common_test_1.c
492
common_test_1_DEPENDENCIES = gcctestdir/ld
493
common_test_1_LDFLAGS = -Bgcctestdir/
494
common_test_1_LDADD =
495
 
496
check_PROGRAMS += common_test_2
497
common_test_2_SOURCES = common_test_1.c
498
common_test_2_DEPENDENCIES = common_test_2.so common_test_3.so gcctestdir/ld
499
common_test_2_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
500
common_test_2_LDADD = common_test_2.so common_test_3.so
501
common_test_2_pic.o: common_test_2.c
502
        $(COMPILE) -c -fpic -o $@ $<
503
common_test_2.so: common_test_2_pic.o common_test_3.so gcctestdir/ld
504
        $(LINK) -Bgcctestdir/ -shared common_test_2_pic.o common_test_3.so
505
common_test_3_pic.o: common_test_3.c
506
        $(COMPILE) -c -fpic -o $@ $<
507
common_test_3.so: common_test_3_pic.o ver_test_2.script gcctestdir/ld
508
        $(LINK) -Bgcctestdir/ -shared common_test_3_pic.o -Wl,--version-script,$(srcdir)/ver_test_2.script
509
 
510
check_PROGRAMS += exception_test
511
check_PROGRAMS += exception_static_test
512
check_PROGRAMS += exception_shared_1_test
513
check_PROGRAMS += exception_shared_2_test
514
check_PROGRAMS += exception_same_shared_test
515
check_PROGRAMS += exception_separate_shared_12_test
516
check_PROGRAMS += exception_separate_shared_21_test
517
exception_test_1_pic.o: exception_test_1.cc
518
        $(CXXCOMPILE) -c -fpic -o $@ $<
519
exception_test_2_pic.o: exception_test_2.cc
520
        $(CXXCOMPILE) -c -fpic -o $@ $<
521
exception_shared_1.so: exception_test_1_pic.o gcctestdir/ld
522
        $(CXXLINK) -Bgcctestdir/ -shared exception_test_1_pic.o
523
exception_shared_2.so: exception_test_2_pic.o gcctestdir/ld
524
        $(CXXLINK) -Bgcctestdir/ -shared exception_test_2_pic.o
525
exception_shared.so: exception_test_1_pic.o exception_test_2_pic.o gcctestdir/ld
526
        $(CXXLINK) -Bgcctestdir/ -shared exception_test_1_pic.o exception_test_2_pic.o
527
 
528
exception_test_SOURCES = \
529
        exception_test_main.cc \
530
        exception_test_1.cc \
531
        exception_test_2.cc \
532
        exception_test.h
533
exception_test_DEPENDENCIES = gcctestdir/ld
534
exception_test_LDFLAGS = -Bgcctestdir/
535
exception_test_LDADD =
536
 
537
exception_static_test_SOURCES = $(exception_test_SOURCES)
538
exception_static_test_DEPENDENCIES = $(exception_test_DEPENDENCIES)
539
exception_static_test_LDFLAGS = $(exception_test_LDFLAGS) -static
540
exception_static_test_LDADD = $(exception_test_LDADD)
541
 
542
exception_shared_1_test_SOURCES = exception_test_2.cc exception_test_main.cc
543
exception_shared_1_test_DEPENDENCIES = gcctestdir/ld exception_shared_1.so
544
exception_shared_1_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
545
exception_shared_1_test_LDADD = exception_shared_1.so
546
 
547
exception_shared_2_test_SOURCES = exception_test_1.cc exception_test_main.cc
548
exception_shared_2_test_DEPENDENCIES = gcctestdir/ld exception_shared_2.so
549
exception_shared_2_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
550
exception_shared_2_test_LDADD = exception_shared_2.so
551
 
552
exception_same_shared_test_SOURCES = exception_test_main.cc
553
exception_same_shared_test_DEPENDENCIES = gcctestdir/ld exception_shared.so
554
exception_same_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
555
exception_same_shared_test_LDADD = exception_shared.so
556
 
557
exception_separate_shared_12_test_SOURCES = exception_test_main.cc
558
exception_separate_shared_12_test_DEPENDENCIES = \
559
        gcctestdir/ld exception_shared_1.so exception_shared_2.so
560
exception_separate_shared_12_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
561
exception_separate_shared_12_test_LDADD = \
562
        exception_shared_1.so exception_shared_2.so
563
 
564
exception_separate_shared_21_test_SOURCES = exception_test_main.cc
565
exception_separate_shared_21_test_DEPENDENCIES = \
566
        gcctestdir/ld exception_shared_1.so exception_shared_2.so
567
exception_separate_shared_21_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
568
exception_separate_shared_21_test_LDADD = \
569
        exception_shared_2.so exception_shared_1.so
570
 
571
 
572
check_PROGRAMS += weak_test
573
weak_test_SOURCES = weak_test.cc
574
weak_test_DEPENDENCIES = gcctestdir/ld
575
weak_test_LDFLAGS = -Bgcctestdir/
576
weak_test_LDADD =
577
 
578
check_PROGRAMS += weak_undef_test
579
MOSTLYCLEANFILES += alt/weak_undef_lib.so
580
weak_undef_test_SOURCES = weak_undef_test.cc
581
weak_undef_test_DEPENDENCIES = gcctestdir/ld weak_undef_lib.so alt/weak_undef_lib.so
582
weak_undef_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,alt
583
weak_undef_test_LDADD = -L . weak_undef_lib.so
584
weak_undef_file1.o: weak_undef_file1.cc
585
        $(CXXCOMPILE) -c -fpic -o $@ $<
586
weak_undef_file2.o: weak_undef_file2.cc
587
        $(CXXCOMPILE) -c -fpic -o $@ $<
588
weak_undef_lib.so: weak_undef_file1.o
589
        $(CXXLINK) -Bgcctestdir/ -shared weak_undef_file1.o
590
alt/weak_undef_lib.so: weak_undef_file2.o
591
        test -d alt || mkdir -p alt
592
        $(CXXLINK) -Bgcctestdir/ -shared weak_undef_file2.o
593
 
594
if FN_PTRS_IN_SO_WITHOUT_PIC
595
check_PROGRAMS += weak_undef_nonpic_test
596
MOSTLYCLEANFILES += alt/weak_undef_lib_nonpic.so
597
weak_undef_nonpic_test_SOURCES = weak_undef_test.cc
598
weak_undef_nonpic_test_DEPENDENCIES = gcctestdir/ld weak_undef_lib_nonpic.so alt/weak_undef_lib_nonpic.so
599
weak_undef_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,alt
600
weak_undef_nonpic_test_LDADD = -L . weak_undef_lib_nonpic.so
601
weak_undef_file1_nonpic.o: weak_undef_file1.cc
602
        $(CXXCOMPILE) -c -o $@ $<
603
weak_undef_file2_nonpic.o: weak_undef_file2.cc
604
        $(CXXCOMPILE) -c -o $@ $<
605
weak_undef_lib_nonpic.so: weak_undef_file1_nonpic.o
606
        $(CXXLINK) -Bgcctestdir/ -shared weak_undef_file1_nonpic.o
607
alt/weak_undef_lib_nonpic.so: weak_undef_file2_nonpic.o
608
        test -d alt || mkdir -p alt
609
        $(CXXLINK) -Bgcctestdir/ -shared weak_undef_file2_nonpic.o
610
endif FN_PTRS_IN_SO_WITHOUT_PIC
611
 
612
 
613
check_PROGRAMS += weak_alias_test
614
weak_alias_test_SOURCES = weak_alias_test_main.cc
615
weak_alias_test_DEPENDENCIES = \
616
        gcctestdir/ld weak_alias_test_1.so weak_alias_test_2.so \
617
        weak_alias_test_3.o weak_alias_test_4.so
618
weak_alias_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
619
weak_alias_test_LDADD = \
620
        weak_alias_test_1.so weak_alias_test_2.so weak_alias_test_3.o \
621
        weak_alias_test_4.so
622
weak_alias_test_1_pic.o: weak_alias_test_1.cc
623
        $(CXXCOMPILE) -c -fpic -o $@ $<
624
weak_alias_test_1.so: weak_alias_test_1_pic.o gcctestdir/ld
625
        $(CXXLINK) -Bgcctestdir/ -shared weak_alias_test_1_pic.o
626
weak_alias_test_2_pic.o: weak_alias_test_2.cc
627
        $(CXXCOMPILE) -c -fpic -o $@ $<
628
weak_alias_test_2.so: weak_alias_test_2_pic.o gcctestdir/ld
629
        $(CXXLINK) -Bgcctestdir/ -shared weak_alias_test_2_pic.o
630
weak_alias_test_3.o: weak_alias_test_3.cc
631
        $(CXXCOMPILE) -c -o $@ $<
632
weak_alias_test_4_pic.o: weak_alias_test_4.cc
633
        $(CXXCOMPILE) -c -fpic -o $@ $<
634
weak_alias_test_4.so: weak_alias_test_4_pic.o gcctestdir/ld
635
        $(CXXLINK) -Bgcctestdir/ -shared weak_alias_test_4_pic.o
636
 
637
check_SCRIPTS += weak_plt.sh
638
check_PROGRAMS += weak_plt
639
check_DATA += weak_plt_shared.so
640
weak_plt_main_pic.o: weak_plt_main.cc
641
        $(CXXCOMPILE) -c -fpic -o $@ $<
642
weak_plt: weak_plt_main_pic.o gcctestdir/ld
643
        $(CXXLINK) -Bgcctestdir/ weak_plt_main_pic.o
644
weak_plt_shared_pic.o: weak_plt_shared.cc
645
        $(CXXCOMPILE) -c -fpic -o $@ $<
646
weak_plt_shared.so: weak_plt_shared_pic.o gcctestdir/ld
647
        $(CXXLINK) -Bgcctestdir/ -shared weak_plt_shared_pic.o
648
 
649
check_PROGRAMS += copy_test
650
copy_test_SOURCES = copy_test.cc
651
copy_test_DEPENDENCIES = gcctestdir/ld copy_test_1.so copy_test_2.so
652
copy_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
653
copy_test_LDADD = copy_test_1.so copy_test_2.so
654
copy_test_1_pic.o: copy_test_1.cc
655
        $(CXXCOMPILE) -c -fpic -o $@ $<
656
copy_test_1.so: gcctestdir/ld copy_test_1_pic.o
657
        $(CXXLINK) -Bgcctestdir/ -shared copy_test_1_pic.o
658
copy_test_2_pic.o: copy_test_2.cc
659
        $(CXXCOMPILE) -c -fpic -o $@ $<
660
copy_test_2.so: gcctestdir/ld copy_test_2_pic.o
661
        $(CXXLINK) -Bgcctestdir/ -shared copy_test_2_pic.o
662
 
663
if TLS
664
 
665
check_PROGRAMS += tls_test
666
check_PROGRAMS += tls_pic_test
667
check_PROGRAMS += tls_pie_test
668
check_PROGRAMS += tls_pie_pic_test
669
check_PROGRAMS += tls_shared_test
670
check_PROGRAMS += tls_shared_ie_test
671
check_PROGRAMS += tls_shared_gd_to_ie_test
672
tls_test_pic.o: tls_test.cc
673
        $(CXXCOMPILE) -c -fpic -o $@ $<
674
tls_test_file2_pic.o: tls_test_file2.cc
675
        $(CXXCOMPILE) -c -fpic -o $@ $<
676
tls_test_c_pic.o: tls_test_c.c
677
        $(COMPILE) -c -fpic $(TLS_TEST_C_CFLAGS) -o $@ $<
678
tls_test_shared.so: tls_test_pic.o tls_test_file2_pic.o tls_test_c_pic.o gcctestdir/ld
679
        $(CXXLINK) -Bgcctestdir/ -shared tls_test_pic.o tls_test_file2_pic.o tls_test_c_pic.o -Wl,-z,defs
680
tls_test_shared2.so: tls_test_file2_pic.o gcctestdir/ld
681
        $(CXXLINK) -Bgcctestdir/ -shared tls_test_file2_pic.o
682
 
683
tls_test_pic_ie.o: tls_test.cc
684
        $(CXXCOMPILE) -c -fpic -ftls-model=initial-exec -o $@ $<
685
tls_test_file2_pic_ie.o: tls_test_file2.cc
686
        $(CXXCOMPILE) -c -fpic -ftls-model=initial-exec -o $@ $<
687
tls_test_c_pic_ie.o: tls_test_c.c
688
        $(COMPILE) -c -fpic -ftls-model=initial-exec $(TLS_TEST_C_CFLAGS) -o $@ $<
689
tls_test_ie_shared.so: tls_test_pic_ie.o tls_test_file2_pic_ie.o tls_test_c_pic_ie.o gcctestdir/ld
690
        $(CXXLINK) -Bgcctestdir/ -shared tls_test_pic_ie.o tls_test_file2_pic_ie.o tls_test_c_pic_ie.o
691
 
692
tls_test_SOURCES = tls_test.cc tls_test_file2.cc tls_test_main.cc tls_test.h
693
tls_test_DEPENDENCIES = gcctestdir/ld tls_test_c.o
694
tls_test_LDFLAGS = -Bgcctestdir/
695
tls_test_LDADD = tls_test_c.o -lpthread
696
tls_test_c.o: tls_test_c.c
697
        $(COMPILE) -c $(TLS_TEST_C_CFLAGS) -o $@ $<
698
 
699
tls_pic_test_SOURCES = tls_test_main.cc
700
tls_pic_test_DEPENDENCIES = gcctestdir/ld tls_test_pic.o tls_test_file2_pic.o \
701
        tls_test_c_pic.o
702
tls_pic_test_LDFLAGS = -Bgcctestdir/
703
tls_pic_test_LDADD = tls_test_pic.o tls_test_file2_pic.o tls_test_c_pic.o \
704
        -lpthread
705
 
706
tls_test_main_pie.o: tls_test_main.cc tls_test.h
707
        $(CXXCOMPILE) -c -fpie -o $@ $<
708
tls_test_pie.o: tls_test.cc tls_test.h
709
        $(CXXCOMPILE) -c -fpie -o $@ $<
710
tls_test_file2_pie.o: tls_test_file2.cc tls_test.h
711
        $(CXXCOMPILE) -c -fpie -o $@ $<
712
tls_test_c_pie.o: tls_test_c.c
713
        $(COMPILE) -c -fpic $(TLS_TEST_C_CFLAGS) -o $@ $<
714
tls_pie_test: tls_test_main_pie.o tls_test_pie.o tls_test_file2_pie.o \
715
                tls_test_c_pie.o gcctestdir/ld
716
        $(CXXLINK) -Bgcctestdir/ -pie tls_test_main_pie.o tls_test_pie.o tls_test_file2_pie.o tls_test_c_pie.o -lpthread
717
 
718
tls_pie_pic_test: tls_test_main_pie.o tls_test_pic.o tls_test_file2_pic.o \
719
                tls_test_c_pic.o gcctestdir/ld
720
        $(CXXLINK) -Bgcctestdir/ -pie tls_test_main_pie.o tls_test_pic.o tls_test_file2_pic.o tls_test_c_pic.o -lpthread
721
 
722
tls_shared_test_SOURCES = tls_test_main.cc
723
tls_shared_test_DEPENDENCIES = gcctestdir/ld tls_test_shared.so
724
tls_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
725
tls_shared_test_LDADD = tls_test_shared.so -lpthread
726
 
727
tls_shared_ie_test_SOURCES = tls_test_main.cc
728
tls_shared_ie_test_DEPENDENCIES = gcctestdir/ld tls_test_ie_shared.so
729
tls_shared_ie_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
730
tls_shared_ie_test_LDADD = tls_test_ie_shared.so -lpthread
731
 
732
tls_shared_gd_to_ie_test_SOURCES = tls_test_main.cc
733
tls_shared_gd_to_ie_test_DEPENDENCIES = gcctestdir/ld tls_test_pic.o \
734
        tls_test_c_pic.o tls_test_shared2.so
735
tls_shared_gd_to_ie_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
736
tls_shared_gd_to_ie_test_LDADD = tls_test_pic.o tls_test_c_pic.o \
737
        tls_test_shared2.so -lpthread
738
 
739
if TLS_GNU2_DIALECT
740
 
741
check_PROGRAMS += tls_shared_gnu2_gd_to_ie_test
742
 
743
tls_test_gnu2.o: tls_test.cc
744
        $(CXXCOMPILE) -c -fpic -mtls-dialect=gnu2 -o $@ $<
745
tls_test_file2_gnu2.o: tls_test_file2.cc
746
        $(CXXCOMPILE) -c -fpic -mtls-dialect=gnu2 -o $@ $<
747
tls_test_c_gnu2.o: tls_test_c.c
748
        $(COMPILE) -c -fpic -mtls-dialect=gnu2 $(TLS_TEST_C_CFLAGS) -o $@ $<
749
tls_test_gnu2_shared2.so: tls_test_file2_gnu2.o gcctestdir/ld
750
        $(CXXLINK) -Bgcctestdir/ -shared tls_test_file2_gnu2.o
751
 
752
tls_shared_gnu2_gd_to_ie_test_SOURCES = tls_test_main.cc
753
tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES = gcctestdir/ld tls_test_gnu2.o \
754
        tls_test_c_gnu2.o tls_test_gnu2_shared2.so
755
tls_shared_gnu2_gd_to_ie_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
756
tls_shared_gnu2_gd_to_ie_test_LDADD = tls_test_gnu2.o tls_test_c_gnu2.o \
757
        tls_test_gnu2_shared2.so -lpthread
758
 
759
if TLS_DESCRIPTORS
760
 
761
check_PROGRAMS += tls_shared_gnu2_test
762
 
763
tls_test_gnu2_shared.so: tls_test_gnu2.o tls_test_file2_gnu2.o tls_test_c_gnu2.o gcctestdir/ld
764
        $(CXXLINK) -Bgcctestdir/ -shared tls_test_gnu2.o tls_test_file2_gnu2.o tls_test_c_gnu2.o
765
 
766
tls_shared_gnu2_test_SOURCES = tls_test_main.cc
767
tls_shared_gnu2_test_DEPENDENCIES = gcctestdir/ld tls_test_gnu2_shared.so
768
tls_shared_gnu2_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
769
tls_shared_gnu2_test_LDADD = tls_test_gnu2_shared.so -lpthread
770
 
771
endif TLS_DESCRIPTORS
772
 
773
endif TLS_GNU2_DIALECT
774
 
775
if STATIC_TLS
776
check_PROGRAMS += tls_static_test
777
check_PROGRAMS += tls_static_pic_test
778
 
779
tls_static_test_SOURCES = $(tls_test_SOURCES)
780
tls_static_test_DEPENDENCIES = $(tls_test_DEPENDENCIES)
781
tls_static_test_LDFLAGS = $(tls_test_LDFLAGS) -static
782
tls_static_test_LDADD = $(tls_test_LDADD)
783
 
784
tls_static_pic_test_SOURCES = $(tls_pic_test_SOURCES)
785
tls_static_pic_test_DEPENDENCIES = $(tls_pic_test_DEPENDENCIES)
786
tls_static_pic_test_LDFLAGS = $(tls_pic_test_LDFLAGS) -static
787
tls_static_pic_test_LDADD = $(tls_pic_test_LDADD)
788
endif
789
 
790
if FN_PTRS_IN_SO_WITHOUT_PIC
791
check_PROGRAMS += tls_shared_nonpic_test
792
tls_test_shared_nonpic.so: tls_test.o tls_test_file2.o tls_test_c.o gcctestdir/ld
793
        $(CXXLINK) -Bgcctestdir/ -shared tls_test.o tls_test_file2.o tls_test_c.o
794
 
795
tls_shared_nonpic_test_SOURCES = tls_test_main.cc
796
tls_shared_nonpic_test_DEPENDENCIES = gcctestdir/ld tls_test_shared_nonpic.so
797
tls_shared_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
798
tls_shared_nonpic_test_LDADD = tls_test_shared_nonpic.so -lpthread
799
endif FN_PTRS_IN_SO_WITHOUT_PIC
800
 
801
endif TLS
802
 
803
check_PROGRAMS += many_sections_test
804
many_sections_test_SOURCES = many_sections_test.cc
805
many_sections_test_DEPENDENCIES = gcctestdir/ld
806
many_sections_test_LDFLAGS = -Bgcctestdir/ -rdynamic
807
many_sections_test_LDADD =
808
 
809
BUILT_SOURCES += many_sections_define.h
810
MOSTLYCLEANFILES += many_sections_define.h
811
many_sections_define.h:
812
        (for i in `seq 1 70000`; do \
813
           echo "int var_$$i __attribute__((section(\"section_$$i\"))) = $$i;"; \
814
         done) > $@.tmp
815
        mv -f $@.tmp $@
816
 
817
BUILT_SOURCES += many_sections_check.h
818
MOSTLYCLEANFILES += many_sections_check.h
819
many_sections_check.h:
820
        (for i in `seq 1 1000 70000`; do \
821
           echo "assert(var_$$i == $$i);"; \
822
         done) > $@.tmp
823
        mv -f $@.tmp $@
824
 
825
check_PROGRAMS += many_sections_r_test
826
many_sections_r_test.o: many_sections_test.o gcctestdir/ld
827
        gcctestdir/ld -r -o $@ many_sections_test.o
828
many_sections_r_test: many_sections_r_test.o gcctestdir/ld
829
        $(CXXLINK) -Bgcctestdir/ many_sections_r_test.o $(LIBS)
830
 
831
if CONSTRUCTOR_PRIORITY
832
 
833
check_PROGRAMS += initpri1
834
initpri1_SOURCES = initpri1.c
835
initpri1_DEPENDENCIES = gcctestdir/ld
836
initpri1_LDFLAGS = -Bgcctestdir/
837
initpri1_LDADD =
838
 
839
endif
840
 
841
 
842
# Test --detect-odr-violations
843
check_SCRIPTS += debug_msg.sh
844
 
845
# Create the data files that debug_msg.sh analyzes.
846
check_DATA += debug_msg.err
847
MOSTLYCLEANFILES += debug_msg.err
848
debug_msg.o: debug_msg.cc
849
        $(CXXCOMPILE) -O0 -g -c -w -o $@ $(srcdir)/debug_msg.cc
850
odr_violation1.o: odr_violation1.cc
851
        $(CXXCOMPILE) -O0 -g -c -w -o $@ $(srcdir)/odr_violation1.cc
852
# Compile with different optimization flags to check that rearranged
853
# instructions don't cause a false positive.
854
odr_violation2.o: odr_violation2.cc
855
        $(CXXCOMPILE) -O2 -g -c -w -o $@ $(srcdir)/odr_violation2.cc
856
debug_msg.err: debug_msg.o odr_violation1.o odr_violation2.o gcctestdir/ld
857
        @echo $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg debug_msg.o odr_violation1.o odr_violation2.o "2>$@"
858
        @if $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg debug_msg.o odr_violation1.o odr_violation2.o 2>$@; \
859
        then \
860
          echo 1>&2 "Link of debug_msg should have failed"; \
861
          rm -f $@; \
862
          exit 1; \
863
        fi
864
 
865
# See if we can also detect problems when we're linking .so's, not .o's.
866
check_DATA += debug_msg_so.err
867
MOSTLYCLEANFILES += debug_msg_so.err
868
debug_msg.so: debug_msg.cc gcctestdir/ld
869
        $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -shared -fPIC -w -o $@ $(srcdir)/debug_msg.cc
870
odr_violation1.so: odr_violation1.cc gcctestdir/ld
871
        $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -shared -fPIC -w -o $@ $(srcdir)/odr_violation1.cc
872
odr_violation2.so: odr_violation2.cc gcctestdir/ld
873
        $(CXXCOMPILE) -Bgcctestdir/ -O2 -g -shared -fPIC -w -o $@ $(srcdir)/odr_violation2.cc
874
debug_msg_so.err: debug_msg.so odr_violation1.so odr_violation2.so gcctestdir/ld
875
        @echo $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_so debug_msg.so odr_violation1.so odr_violation2.so "2>$@"
876
        @if $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_so debug_msg.so odr_violation1.so odr_violation2.so 2>$@; \
877
        then \
878
          echo 1>&2 "Link of debug_msg_so should have failed"; \
879
          rm -f $@; \
880
          exit 1; \
881
        fi
882
 
883
# We also want to make sure we do something reasonable when there's no
884
# debug info available.  For the best test, we use .so's.
885
check_DATA += debug_msg_ndebug.err
886
MOSTLYCLEANFILES += debug_msg_ndebug.err
887
debug_msg_ndebug.so: debug_msg.cc gcctestdir/ld
888
        $(CXXCOMPILE) -Bgcctestdir/ -O0 -g0 -shared -fPIC -w -o $@ $(srcdir)/debug_msg.cc
889
odr_violation1_ndebug.so: odr_violation1.cc gcctestdir/ld
890
        $(CXXCOMPILE) -Bgcctestdir/ -O0 -g0 -shared -fPIC -w -o $@ $(srcdir)/odr_violation1.cc
891
odr_violation2_ndebug.so: odr_violation2.cc gcctestdir/ld
892
        $(CXXCOMPILE) -Bgcctestdir/ -O2 -g0 -shared -fPIC -w -o $@ $(srcdir)/odr_violation2.cc
893
debug_msg_ndebug.err: debug_msg_ndebug.so odr_violation1_ndebug.so odr_violation2_ndebug.so gcctestdir/ld
894
        @echo $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_ndebug debug_msg_ndebug.so odr_violation1_ndebug.so odr_violation2_ndebug.so "2>$@"
895
        @if $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_ndebug debug_msg_ndebug.so odr_violation1_ndebug.so odr_violation2_ndebug.so 2>$@; \
896
        then \
897
          echo 1>&2 "Link of debug_msg_ndebug should have failed"; \
898
          rm -f $@; \
899
          exit 1; \
900
        fi
901
 
902
 
903
# Similar to --detect-odr-violations: check for undefined symbols in .so's
904
check_SCRIPTS += undef_symbol.sh
905
check_DATA += undef_symbol.err
906
MOSTLYCLEANFILES += undef_symbol.err
907
undef_symbol.o: undef_symbol.cc
908
        $(CXXCOMPILE) -O0 -g -c -fPIC $<
909
undef_symbol.so: undef_symbol.o gcctestdir/ld
910
        $(CXXLINK) -Bgcctestdir/ -shared undef_symbol.o
911
undef_symbol.err: undef_symbol_main.o undef_symbol.so gcctestdir/ld
912
        @echo $(CXXLINK) -Bgcctestdir/ -o undef_symbol_test undef_symbol_main.o undef_symbol.so "2>$@"
913
        @if $(CXXLINK) -Bgcctestdir/ -o undef_symbol_test undef_symbol_main.o undef_symbol.so 2>$@; \
914
        then \
915
          echo 1>&2 "Link of undef_symbol_test should have failed"; \
916
          rm -f $@; \
917
          exit 1; \
918
        fi
919
 
920
 
921
# Test -o when emitting to a special file (such as something in /dev).
922
check_PROGRAMS += flagstest_o_specialfile
923
flagstest_o_specialfile: flagstest_debug.o gcctestdir/ld
924
        $(CXXLINK) -Bgcctestdir/ -o /dev/stdout $< 2>&1 | cat > $@
925
        chmod a+x $@
926
        test -s $@
927
 
928
if HAVE_ZLIB
929
 
930
# Test --compress-debug-sections.  FIXME: check we actually compress.
931
check_PROGRAMS += flagstest_compress_debug_sections
932
flagstest_compress_debug_sections: flagstest_debug.o gcctestdir/ld
933
        $(CXXLINK) -Bgcctestdir/ -o $@ $< -Wl,--compress-debug-sections=zlib
934
        test -s $@
935
 
936
 
937
# The specialfile output has a tricky case when we also compress debug
938
# sections, because it requires output-file resizing.
939
check_PROGRAMS += flagstest_o_specialfile_and_compress_debug_sections
940
flagstest_o_specialfile_and_compress_debug_sections: flagstest_debug.o \
941
                gcctestdir/ld
942
        $(CXXLINK) -Bgcctestdir/ -o /dev/stdout $< -Wl,--compress-debug-sections=zlib 2>&1 | cat > $@
943
        chmod a+x $@
944
        test -s $@
945
 
946
endif HAVE_ZLIB
947
 
948
# Test symbol versioning.
949
check_PROGRAMS += ver_test
950
ver_test_SOURCES = ver_test_main.cc
951
ver_test_DEPENDENCIES = gcctestdir/ld ver_test_1.so ver_test_2.so ver_test_4.so
952
ver_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
953
ver_test_LDADD = ver_test_1.so ver_test_2.so ver_test_4.so
954
ver_test_1.so: ver_test_1.o ver_test_2.so ver_test_3.o ver_test_4.so gcctestdir/ld
955
        $(CXXLINK) -Bgcctestdir/ -shared ver_test_1.o ver_test_2.so ver_test_3.o ver_test_4.so
956
ver_test_2.so: ver_test_2.o $(srcdir)/ver_test_2.script ver_test_4.so gcctestdir/ld
957
        $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_2.script -Wl,-R,. ver_test_2.o ver_test_4.so
958
ver_test_4.so: ver_test_4.o $(srcdir)/ver_test_4.script gcctestdir/ld
959
        $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_4.script ver_test_4.o
960
ver_test_1.o: ver_test_1.cc
961
        $(CXXCOMPILE) -c -fpic -o $@ $<
962
ver_test_2.o: ver_test_2.cc
963
        $(CXXCOMPILE) -c -fpic -o $@ $<
964
ver_test_3.o: ver_test_3.cc
965
        $(CXXCOMPILE) -c -fpic -o $@ $<
966
ver_test_4.o: ver_test_4.cc
967
        $(CXXCOMPILE) -c -fpic -o $@ $<
968
 
969
check_SCRIPTS += ver_test_1.sh
970
check_DATA += ver_test_1.syms
971
ver_test_1.syms: ver_test_1.so
972
        $(TEST_READELF) -s $< >$@ 2>/dev/null
973
 
974
check_PROGRAMS += ver_test_2
975
ver_test_2_SOURCES = ver_test_main_2.cc
976
ver_test_2_DEPENDENCIES = gcctestdir/ld ver_test_4.so ver_test_2.so
977
ver_test_2_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
978
ver_test_2_LDADD = ver_test_4.so ver_test_2.so
979
 
980
check_SCRIPTS += ver_test_2.sh
981
check_DATA += ver_test_2.syms
982
ver_test_2.syms: ver_test_2
983
        $(TEST_READELF) -s $< >$@ 2>/dev/null
984
 
985
check_SCRIPTS += ver_test_4.sh
986
check_DATA += ver_test_4.syms
987
ver_test_4.syms: ver_test_4.so
988
        $(TEST_READELF) -s $< >$@ 2>/dev/null
989
 
990
ver_test_5.so: ver_test_5.o $(srcdir)/ver_test_5.script ver_test_4.so gcctestdir/ld
991
        $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_5.script ver_test_5.o ver_test_4.so
992
ver_test_5.o: ver_test_5.cc
993
        $(CXXCOMPILE) -c -fpic -o $@ $<
994
check_SCRIPTS += ver_test_5.sh
995
check_DATA += ver_test_5.syms
996
ver_test_5.syms: ver_test_5.so
997
        $(TEST_READELF) -s $< >$@ 2>/dev/null
998
 
999
check_PROGRAMS += ver_test_6
1000
ver_test_6_SOURCES = ver_test_6.c
1001
ver_test_6_DEPENDENCIES = gcctestdir/ld ver_test_2.so
1002
ver_test_6_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1003
ver_test_6_LDADD = ver_test_2.so
1004
 
1005
ver_test_7.so: ver_test_4.o $(srcdir)/ver_test_4.script ver_test_7.o gcctestdir/ld
1006
        $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_4.script ver_test_4.o ver_test_7.o
1007
ver_test_7.o: ver_test_7.cc
1008
        $(CXXCOMPILE) -c -fpic -o $@ $<
1009
check_SCRIPTS += ver_test_7.sh
1010
check_DATA += ver_test_7.syms
1011
ver_test_7.syms: ver_test_7.so
1012
        $(TEST_READELF) -s $< >$@ 2>/dev/null
1013
 
1014
check_PROGRAMS += ver_test_8
1015
ver_test_8_SOURCES = two_file_test_main.cc
1016
ver_test_8_DEPENDENCIES = gcctestdir/ld ver_test_8_1.so ver_test_8_2.so
1017
ver_test_8_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1018
ver_test_8_LDADD = ver_test_8_1.so ver_test_8_2.so
1019
ver_test_8_1.so: two_file_test_1_pic.o two_file_test_1b_pic.o ver_test_8_2.so gcctestdir/ld
1020
        $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1_pic.o two_file_test_1b_pic.o ver_test_8_2.so
1021
ver_test_8_2.so: two_file_test_2_pic.o $(srcdir)/ver_test_8.script gcctestdir/ld
1022
        $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_8.script two_file_test_2_pic.o
1023
 
1024
check_PROGRAMS += ver_test_9
1025
ver_test_9_SOURCES = ver_test_main.cc
1026
ver_test_9_DEPENDENCIES = gcctestdir/ld ver_test_9.so
1027
ver_test_9_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1028
ver_test_9_LDADD = ver_test_9.so
1029
ver_test_9.so: ver_test_9.o ver_test_4.so ver_test_5.so gcctestdir/ld
1030
        $(CXXLINK) -Bgcctestdir/ -shared -Wl,-R,. ver_test_9.o ver_test_5.so ver_test_4.so
1031
ver_test_9.o: ver_test_9.cc
1032
        $(CXXCOMPILE) -c -fpic -o $@ $<
1033
 
1034
check_SCRIPTS += ver_test_10.sh
1035
check_DATA += ver_test_10.syms
1036
ver_test_10.syms: ver_test_10.so
1037
        $(TEST_READELF) -s $< >$@ 2>/dev/null
1038
ver_test_10.so: gcctestdir/ld ver_test_2.o ver_test_10.script
1039
        $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_10.script ver_test_2.o
1040
 
1041
check_PROGRAMS += ver_test_11
1042
MOSTLYCLEANFILES += ver_test_11.a
1043
ver_test_11_SOURCES = ver_test_main_2.cc
1044
ver_test_11_DEPENDENCIES = gcctestdir/ld ver_test_11.a
1045
ver_test_11_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1046
ver_test_11_LDADD = ver_test_11.a
1047
ver_test_11.a: ver_test_1.o ver_test_2.o ver_test_4.o
1048
        $(TEST_AR) rc $@ $^
1049
 
1050
check_PROGRAMS += protected_1
1051
protected_1_SOURCES = \
1052
        protected_main_1.cc protected_main_2.cc protected_main_3.cc
1053
protected_1_DEPENDENCIES = gcctestdir/ld protected_1.so
1054
protected_1_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1055
protected_1_LDADD = protected_1.so
1056
 
1057
protected_1.so: gcctestdir/ld protected_1_pic.o protected_2_pic.o protected_3_pic.o
1058
        $(CXXLINK) -Bgcctestdir/ -shared protected_1_pic.o protected_2_pic.o protected_3_pic.o
1059
protected_1_pic.o: protected_1.cc
1060
        $(CXXCOMPILE) -c -fpic -o $@ $<
1061
protected_2_pic.o: protected_2.cc
1062
        $(CXXCOMPILE) -c -fpic -o $@ $<
1063
protected_3_pic.o: protected_3.cc
1064
        $(CXXCOMPILE) -c -fpic -o $@ $<
1065
 
1066
check_PROGRAMS += protected_2
1067
protected_2_SOURCES = protected_main_1.cc protected_3.cc
1068
protected_2_DEPENDENCIES = gcctestdir/ld protected_1.so
1069
protected_2_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1070
protected_2_LDADD = protected_1.so
1071
 
1072
check_DATA += protected_3.err
1073
MOSTLYCLEANFILES += protected_3.err
1074
protected_4_pic.o: protected_4.cc
1075
        $(CXXCOMPILE) -c -fpic -o $@ $<
1076
protected_3.err: protected_4_pic.o gcctestdir/ld
1077
        @echo $(CXXLINK) -Bgcctestdir/ -shared -o protected_4.so protected_4_pic.o "2>$@"
1078
        @if $(CXXLINK) -Bgcctestdir/ -shared -o protected_4.so protected_4_pic.o 2>$@; then \
1079
          echo 1>&2 "Link of protected_4.so should have failed"; \
1080
          rm -f $@; \
1081
          exit 1; \
1082
        fi
1083
 
1084
check_PROGRAMS += relro_test
1085
check_SCRIPTS += relro_test.sh
1086
check_DATA += relro_test.stdout
1087
relro_test_SOURCES = relro_test_main.cc
1088
relro_test_DEPENDENCIES = gcctestdir/ld relro_test.so
1089
relro_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1090
relro_test_LDADD = relro_test.so
1091
relro_test.so: gcctestdir/ld relro_test_pic.o
1092
        $(CXXLINK) -Bgcctestdir/ -shared -Wl,-z,relro relro_test_pic.o
1093
relro_test_pic.o: relro_test.cc
1094
        $(CXXCOMPILE) -c -fpic -o $@ $<
1095
relro_test.stdout: relro_test.so
1096
        $(TEST_READELF) -SlW relro_test.so > relro_test.stdout
1097
 
1098
check_PROGRAMS += relro_strip_test
1099
relro_strip_test_SOURCES = relro_test_main.cc
1100
relro_strip_test_DEPENDENCIES = gcctestdir/ld relro_strip_test.so
1101
relro_strip_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1102
relro_strip_test_LDADD = relro_strip_test.so
1103
relro_strip_test.so: relro_test.so
1104
        $(TEST_STRIP) -o $@ $<
1105
 
1106
check_PROGRAMS += relro_script_test
1107
relro_script_test_SOURCES = relro_test_main.cc
1108
relro_script_test_DEPENDENCIES = gcctestdir/ld relro_script_test.so
1109
relro_script_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1110
relro_script_test_LDADD = relro_script_test.so
1111
relro_script_test.so: gcctestdir/ld relro_script_test.t relro_test_pic.o
1112
        $(CXXLINK) -Bgcctestdir/ -shared -Wl,-z,relro -T $(srcdir)/relro_script_test.t relro_test_pic.o
1113
 
1114
check_PROGRAMS += script_test_1
1115
script_test_1_SOURCES = script_test_1.cc
1116
script_test_1_DEPENDENCIES = gcctestdir/ld script_test_1.t
1117
script_test_1_LDFLAGS = -Bgcctestdir/ -Wl,-R,. -T $(srcdir)/script_test_1.t
1118
script_test_1_LDADD =
1119
 
1120
check_PROGRAMS += script_test_2
1121
script_test_2_SOURCES = script_test_2.cc script_test_2a.cc script_test_2b.cc
1122
script_test_2_DEPENDENCIES = gcctestdir/ld script_test_2.t
1123
script_test_2_LDFLAGS = -Bgcctestdir/ -Wl,-R,. -T $(srcdir)/script_test_2.t
1124
script_test_2_LDADD =
1125
 
1126
check_PROGRAMS += justsyms
1127
justsyms_SOURCES = justsyms_1.cc
1128
justsyms_DEPENDENCIES = gcctestdir/ld justsyms_2r.o
1129
justsyms_LDFLAGS = -Bgcctestdir/ -Wl,-R,justsyms_2r.o
1130
justsyms_LDADD =
1131
justsyms_2.o: justsyms_2.cc
1132
        $(CXXCOMPILE) -c -o $@ $<
1133
justsyms_2r.o: justsyms_2.o gcctestdir/ld $(srcdir)/justsyms.t
1134
        gcctestdir/ld -o $@ -r -T $(srcdir)/justsyms.t justsyms_2.o
1135
 
1136
check_PROGRAMS += binary_test
1137
MOSTLYCLEANFILES += binary.txt
1138
binary_test_SOURCES = binary_test.cc
1139
binary_test_DEPENDENCIES = gcctestdir/ld binary.txt
1140
binary_test_LDFLAGS = -Bgcctestdir/ -Wl,--format,binary,binary.txt,--format,elf
1141
binary_test_LDADD =
1142
# Copy the file to the build directory to avoid worrying about the
1143
# full pathname in the generated symbols.
1144
binary.txt: $(srcdir)/binary.in
1145
        rm -f $@
1146
        $(LN_S) $< $@
1147
 
1148
check_SCRIPTS += ver_matching_test.sh
1149
check_DATA += ver_matching_test.stdout
1150
MOSTLYCLEANFILES += ver_matching_test.stdout
1151
ver_matching_def.so: ver_matching_def_pic.o $(srcdir)/version_script.map gcctestdir/ld
1152
        $(CXXLINK) -O0 -Bgcctestdir/ -shared ver_matching_def_pic.o -Wl,--version-script=$(srcdir)/version_script.map
1153
ver_matching_def_pic.o: ver_matching_def.cc
1154
        $(CXXCOMPILE) -O0 -c -fpic -o $@ $<
1155
ver_matching_test.stdout: ver_matching_def.so
1156
        $(TEST_OBJDUMP) -T ver_matching_def.so | $(TEST_CXXFILT) > ver_matching_test.stdout
1157
 
1158
check_PROGRAMS += script_test_3
1159
check_SCRIPTS += script_test_3.sh
1160
check_DATA += script_test_3.stdout
1161
MOSTLYCLEANFILES += script_test_3.stdout
1162
script_test_3: basic_test.o gcctestdir/ld script_test_3.t
1163
        $(CXXLINK) -Bgcctestdir/ basic_test.o -T $(srcdir)/script_test_3.t
1164
script_test_3.stdout: script_test_3
1165
        $(TEST_READELF) -SlW script_test_3 > script_test_3.stdout
1166
 
1167
check_PROGRAMS += tls_phdrs_script_test
1168
tls_phdrs_script_test_SOURCES = $(tls_test_SOURCES)
1169
tls_phdrs_script_test_DEPENDENCIES = $(tls_test_DEPENDENCIES) $(srcdir)/script_test_3.t
1170
tls_phdrs_script_test_LDFLAGS = $(tls_test_LDFLAGS) -T $(srcdir)/script_test_3.t
1171
tls_phdrs_script_test_LDADD = $(tls_test_LDADD)
1172
 
1173
check_SCRIPTS += script_test_4.sh
1174
check_DATA += script_test_4.stdout
1175
MOSTLYCLEANFILES += script_test_4
1176
script_test_4: basic_test.o gcctestdir/ld $(srcdir)/script_test_4.t
1177
        $(CXXLINK) -Bgcctestdir/ basic_test.o -T $(srcdir)/script_test_4.t
1178
script_test_4.stdout: script_test_4
1179
        $(TEST_READELF) -SlW script_test_4 > script_test_4.stdout
1180
 
1181
check_PROGRAMS += tls_script_test
1182
tls_script_test_SOURCES = $(tls_test_SOURCES)
1183
tls_script_test_DEPENDENCIES = $(tls_test_DEPENDENCIES) $(srcdir)/script_test_4.t
1184
tls_script_test_LDFLAGS = $(tls_test_LDFLAGS) -T $(srcdir)/script_test_4.t
1185
tls_script_test_LDADD = $(tls_test_LDADD)
1186
 
1187
check_SCRIPTS += script_test_5.sh
1188
check_DATA += script_test_5.stdout
1189
MOSTLYCLEANFILES += script_test_5
1190
script_test_5: script_test_5.o gcctestdir/ld $(srcdir)/script_test_5.t
1191
        $(CXXLINK) -Bgcctestdir/ script_test_5.o -T $(srcdir)/script_test_5.t
1192
script_test_5.stdout: script_test_5
1193
        $(TEST_READELF) -SW script_test_5 > script_test_5.stdout
1194
 
1195
check_SCRIPTS += script_test_6.sh
1196
check_DATA += script_test_6.stdout
1197
MOSTLYCLEANFILES += script_test_6
1198
script_test_6: basic_test.o gcctestdir/ld $(srcdir)/script_test_6.t
1199
        $(CXXLINK) -Bgcctestdir/ basic_test.o -T $(srcdir)/script_test_6.t \
1200
        -Wl,-Ttext=0x10001000 -Wl,-Tdata=0x10200000 -Wl,-Tbss=0x10400000
1201
script_test_6.stdout: script_test_6
1202
        $(TEST_READELF) -SlW script_test_6 > script_test_6.stdout
1203
 
1204
check_SCRIPTS += script_test_7.sh
1205
check_DATA += script_test_7.stdout
1206
MOSTLYCLEANFILES += script_test_7
1207
script_test_7: basic_test.o gcctestdir/ld $(srcdir)/script_test_7.t
1208
        $(CXXLINK) -Bgcctestdir/ basic_test.o -T $(srcdir)/script_test_7.t
1209
script_test_7.stdout: script_test_7
1210
        $(TEST_READELF) -SlW script_test_7 > script_test_7.stdout
1211
 
1212
check_SCRIPTS += script_test_8.sh
1213
check_DATA += script_test_8.stdout
1214
MOSTLYCLEANFILES += script_test_8
1215
script_test_8: basic_test.o gcctestdir/ld $(srcdir)/script_test_7.t
1216
        $(CXXLINK) -Bgcctestdir/ basic_test.o -T $(srcdir)/script_test_7.t \
1217
        -Wl,-Ttext=0x20001000 -Wl,-Tdata=0x20200000 -Wl,-Tbss=0x20400000
1218
script_test_8.stdout: script_test_8
1219
        $(TEST_READELF) -SlW script_test_8 > script_test_8.stdout
1220
 
1221
 
1222
check_SCRIPTS += script_test_9.sh
1223
check_DATA += script_test_9.stdout
1224
script_test_9.o: script_test_9.cc
1225
        $(CXXCOMPILE) -O0 -c -o $@ $<
1226
script_test_9: gcctestdir/ld $(srcdir)/script_test_9.t script_test_9.o
1227
        $(CXXLINK) -Bgcctestdir/ script_test_9.o -T $(srcdir)/script_test_9.t
1228
script_test_9.stdout: script_test_9
1229
        $(TEST_READELF) -lW script_test_9 > script_test_9.stdout
1230
 
1231
 
1232
# Test --dynamic-list, --dynamic-list-data, --dynamic-list-cpp-new,
1233
# and --dynamic-list-cpp-typeinfo
1234
 
1235
check_SCRIPTS += dynamic_list.sh
1236
check_DATA += dynamic_list.stdout
1237
MOSTLYCLEANFILES += dynamic_list dynamic_list.stdout
1238
dynamic_list: basic_test.o gcctestdir/ld $(srcdir)/dynamic_list.t
1239
        $(CXXLINK) -Bgcctestdir/ basic_test.o \
1240
          -Wl,--dynamic-list $(srcdir)/dynamic_list.t \
1241
          -Wl,--dynamic-list-data \
1242
          -Wl,--dynamic-list-cpp-new \
1243
          -Wl,--dynamic-list-cpp-typeinfo
1244
dynamic_list.stdout: dynamic_list
1245
        $(TEST_READELF) -W --dyn-syms dynamic_list > dynamic_list.stdout
1246
 
1247
check_PROGRAMS += thin_archive_test_1
1248
MOSTLYCLEANFILES += libthin1.a libthin3.a libthinall.a \
1249
        alt/thin_archive_test_2.o alt/thin_archive_test_4.o \
1250
        alt/libthin2.a alt/libthin4.a
1251
thin_archive_test_1_SOURCES = thin_archive_main.cc
1252
thin_archive_test_1_DEPENDENCIES = gcctestdir/ld libthin1.a alt/libthin2.a
1253
thin_archive_test_1_LDFLAGS = -Bgcctestdir/ -Lalt
1254
thin_archive_test_1_LDADD = libthin1.a -lthin2
1255
 
1256
check_PROGRAMS += thin_archive_test_2
1257
thin_archive_test_2_SOURCES = thin_archive_main.cc
1258
thin_archive_test_2_DEPENDENCIES = gcctestdir/ld libthinall.a
1259
thin_archive_test_2_LDFLAGS = -Bgcctestdir/ -L.
1260
thin_archive_test_2_LDADD = -lthinall
1261
 
1262
libthin1.a: thin_archive_test_1.o alt/thin_archive_test_2.o
1263
        rm -f $@
1264
        $(TEST_AR) crT $@ $^
1265
alt/libthin2.a: thin_archive_test_3.o alt/thin_archive_test_4.o
1266
        rm -f $@
1267
        $(TEST_AR) crT $@ $^
1268
libthin3.a: thin_archive_test_1.o alt/thin_archive_test_4.o
1269
        rm -f $@
1270
        $(TEST_AR) crT $@ $^
1271
alt/libthin4.a: alt/thin_archive_test_2.o thin_archive_test_3.o
1272
        rm -f $@
1273
        $(TEST_AR) crT $@ $^
1274
libthinall.a: libthin3.a alt/libthin4.a
1275
        rm -f $@
1276
        $(TEST_AR) crT $@ $^
1277
alt/thin_archive_test_2.o: thin_archive_test_2.cc
1278
        test -d alt || mkdir -p alt
1279
        $(CXXCOMPILE) -c -o $@ $<
1280
alt/thin_archive_test_4.o: thin_archive_test_4.cc
1281
        test -d alt || mkdir -p alt
1282
        $(CXXCOMPILE) -c -o $@ $<
1283
 
1284
if PLUGINS
1285
 
1286
check_PROGRAMS += plugin_test_1
1287
check_SCRIPTS += plugin_test_1.sh
1288
check_DATA += plugin_test_1.err
1289
MOSTLYCLEANFILES += plugin_test_1.err
1290
plugin_test_1: two_file_test_main.o two_file_test_1.syms two_file_test_1b.syms two_file_test_2.syms empty.syms gcctestdir/ld plugin_test.so
1291
        $(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle,--plugin,"./plugin_test.so",--plugin-opt,"_Z4f13iv" two_file_test_main.o two_file_test_1.syms two_file_test_1b.syms two_file_test_2.syms empty.syms 2>plugin_test_1.err
1292
plugin_test_1.err: plugin_test_1
1293
        @touch plugin_test_1.err
1294
 
1295
check_PROGRAMS += plugin_test_2
1296
check_SCRIPTS += plugin_test_2.sh
1297
check_DATA += plugin_test_2.err
1298
MOSTLYCLEANFILES += plugin_test_2.err
1299
plugin_test_2: two_file_test_main.o two_file_test_1.syms two_file_test_1b.syms two_file_shared_2.so gcctestdir/ld plugin_test.so
1300
        $(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle,-R,.,--plugin,"./plugin_test.so" two_file_test_main.o two_file_test_1.syms two_file_test_1b.syms two_file_shared_2.so 2>plugin_test_2.err
1301
plugin_test_2.err: plugin_test_2
1302
        @touch plugin_test_2.err
1303
 
1304
check_PROGRAMS += plugin_test_3
1305
check_SCRIPTS += plugin_test_3.sh
1306
check_DATA += plugin_test_3.err
1307
MOSTLYCLEANFILES += plugin_test_3.err
1308
plugin_test_3: two_file_test_main.o two_file_test_1.syms two_file_test_1b.syms two_file_test_2.syms empty.syms gcctestdir/ld plugin_test.so
1309
        $(CXXLINK) -Bgcctestdir/ -Wl,--export-dynamic -Wl,--no-demangle,--plugin,"./plugin_test.so",--plugin-opt,"_Z4f13iv" two_file_test_main.o two_file_test_1.syms two_file_test_1b.syms two_file_test_2.syms empty.syms 2>plugin_test_3.err
1310
plugin_test_3.err: plugin_test_3
1311
        @touch plugin_test_3.err
1312
 
1313
check_PROGRAMS += plugin_test_4
1314
check_SCRIPTS += plugin_test_4.sh
1315
check_DATA += plugin_test_4.err
1316
MOSTLYCLEANFILES += plugin_test_4.a plugin_test_4.err
1317
plugin_test_4: two_file_test_main.o plugin_test_4.a gcctestdir/ld plugin_test.so
1318
        $(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle,--plugin,"./plugin_test.so",--plugin-opt,"_Z4f13iv" two_file_test_main.o -Wl,--whole-archive,plugin_test_4.a,--no-whole-archive 2>plugin_test_4.err
1319
plugin_test_4.err: plugin_test_4
1320
        @touch plugin_test_4.err
1321
 
1322
plugin_test_4.a: two_file_test_1.syms two_file_test_1b.syms two_file_test_2.syms
1323
        $(TEST_AR) cr $@ $^
1324
 
1325
check_PROGRAMS += plugin_test_5
1326
plugin_test_5: two_file_test_main.o two_file_test_1.syms two_file_test_1b.syms two_file_test_2.syms unused.syms gcctestdir/ld plugin_test.so
1327
        $(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle,--plugin,"./plugin_test.so",--plugin-opt,"_Z4f13iv",--gc-sections two_file_test_main.o two_file_test_1.syms two_file_test_1b.syms two_file_test_2.syms unused.syms
1328
 
1329
check_PROGRAMS += plugin_test_6
1330
check_SCRIPTS += plugin_test_6.sh
1331
check_DATA += plugin_test_6.err
1332
MOSTLYCLEANFILES += plugin_test_6.err
1333
plugin_test_6: plugin_common_test_1.syms plugin_common_test_2.syms gcctestdir/ld plugin_test.so
1334
        $(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle,--plugin,"./plugin_test.so" plugin_common_test_1.syms plugin_common_test_2.syms 2>plugin_test_6.err
1335
plugin_test_6.err: plugin_test_6
1336
        @touch plugin_test_6.err
1337
 
1338
check_PROGRAMS += plugin_test_7
1339
check_SCRIPTS += plugin_test_7.sh
1340
check_DATA += plugin_test_7.err plugin_test_7.syms
1341
MOSTLYCLEANFILES += plugin_test_7.err
1342
plugin_test_7: plugin_test_7_1.o plugin_test_7_1.syms plugin_test_7_2.o gcctestdir/ld plugin_test.so
1343
        $(LINK) -Bgcctestdir/ -Wl,--no-demangle,--plugin,"./plugin_test.so",--gc-sections,--print-gc-sections plugin_test_7_1.syms plugin_test_7_2.o 2>plugin_test_7.err
1344
plugin_test_7.syms: plugin_test_7
1345
        $(TEST_READELF) -sW $< >$@ 2>/dev/null
1346
plugin_test_7_1.o: plugin_test_7_1.c
1347
        $(COMPILE) -DLTO -O0 -c -ffunction-sections -fdata-sections -o $@ $<
1348
plugin_test_7_1_orig.o: plugin_test_7_1.c
1349
        $(COMPILE) -O0 -c -ffunction-sections -fdata-sections -o $@ $<
1350
plugin_test_7_1.syms: plugin_test_7_1_orig.o
1351
        $(TEST_READELF) -sW $< >$@ 2>/dev/null
1352
plugin_test_7_2.o: plugin_test_7_2.c
1353
        $(COMPILE) -O0 -c -ffunction-sections -fdata-sections -o $@ $<
1354
plugin_test_7.err: plugin_test_7
1355
 
1356
# Test plugins with -r.
1357
check_PROGRAMS += plugin_test_8
1358
plugin_test_8.o: two_file_test_main.o two_file_test_1.syms two_file_test_1b.syms two_file_test_2.o ../ld-new plugin_test.so
1359
        ../ld-new -r -o $@ --no-demangle --plugin "./plugin_test.so" two_file_test_main.o two_file_test_1.syms two_file_test_1b.syms two_file_test_2.o
1360
plugin_test_8: plugin_test_8.o gcctestdir/ld
1361
        $(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle plugin_test_8.o
1362
 
1363
# Test that symbols known in the IR file but not in the replacement file
1364
# produce an unresolved symbol error.
1365
check_DATA += plugin_test_9.err
1366
MOSTLYCLEANFILES += plugin_test_9.err
1367
plugin_test_9.err: two_file_test_main.o two_file_test_1c.syms two_file_test_2.syms gcctestdir/ld plugin_test.so
1368
        @echo $(CXXLINK) -Bgcctestdir/ -o plugin_test_9 -Wl,--no-demangle,--plugin,"./plugin_test.so" two_file_test_main.o two_file_test_1c.syms two_file_test_2.syms "2>$@"
1369
        @if $(CXXLINK) -Bgcctestdir/ -o plugin_test_9 -Wl,--no-demangle,--plugin,"./plugin_test.so" two_file_test_main.o two_file_test_1c.syms two_file_test_2.syms 2>$@; then \
1370
          echo 1>&2 "Link of plugin_test_9 should have failed"; \
1371
          rm -f $@; \
1372
          exit 1; \
1373
        fi
1374
# Make a .syms file that claims to define the symbol _Z4t16av.
1375
two_file_test_1c.syms: two_file_test_1.syms two_file_test_1c.o
1376
        cp two_file_test_1.syms $@.tmp
1377
        grep "_Z4t16av" two_file_test_1b.syms >> $@.tmp
1378
        mv -f $@.tmp $@
1379
# Make a copy of two_file_test_1.o, which does not define the symbol _Z4t16av.
1380
MOSTLYCLEANFILES += two_file_test_1c.o
1381
two_file_test_1c.o: two_file_test_1.o
1382
        cp two_file_test_1.o $@
1383
 
1384
plugin_test.so: plugin_test.o
1385
        $(LINK) -Bgcctestdir/ -shared plugin_test.o
1386
plugin_test.o: plugin_test.c
1387
        $(COMPILE) -O0 -c -fpic -o $@ $<
1388
 
1389
two_file_test_main.syms: two_file_test_main.o
1390
        $(TEST_READELF) -sW $< >$@ 2>/dev/null
1391
two_file_test_1.syms: two_file_test_1.o
1392
        $(TEST_READELF) -sW $< >$@ 2>/dev/null
1393
two_file_test_1b.syms: two_file_test_1b.o
1394
        $(TEST_READELF) -sW $< >$@ 2>/dev/null
1395
two_file_test_2.syms: two_file_test_2.o
1396
        $(TEST_READELF) -sW $< >$@ 2>/dev/null
1397
plugin_common_test_1.syms: plugin_common_test_1.o
1398
        $(TEST_READELF) -sW $< >$@ 2>/dev/null
1399
plugin_common_test_2.syms: plugin_common_test_2.o
1400
        $(TEST_READELF) -sW $< >$@ 2>/dev/null
1401
 
1402
empty.syms:
1403
        @echo "" >$@
1404
        @echo "Symbol table" >>$@
1405
 
1406
MOSTLYCLEANFILES += unused.c
1407
unused.syms: unused.o
1408
        $(TEST_READELF) -sW $< >$@ 2>/dev/null
1409
        @echo "     1: 00000000     4 FUNC    GLOBAL DEFAULT    1 UNUSED" >>$@
1410
unused.o: unused.c
1411
        $(COMPILE) -c -o $@ $<
1412
unused.c:
1413
        @cp /dev/null $@
1414
 
1415
endif PLUGINS
1416
 
1417
check_PROGRAMS += exclude_libs_test
1418
check_SCRIPTS += exclude_libs_test.sh
1419
check_DATA += exclude_libs_test.syms
1420
MOSTLYCLEANFILES += exclude_libs_test.syms libexclude_libs_test_1.a \
1421
        libexclude_libs_test_2.a alt/libexclude_libs_test_3.a
1422
exclude_libs_test_SOURCES = exclude_libs_test.c
1423
exclude_libs_test_DEPENDENCIES = gcctestdir/ld libexclude_libs_test_1.a \
1424
        libexclude_libs_test_2.a alt/libexclude_libs_test_3.a
1425
exclude_libs_test_LDFLAGS = -Bgcctestdir/ -L. -Lalt \
1426
        -Wl,--exclude-libs,dummy:libexclude_libs_test_1 \
1427
        -Wl,--exclude-libs,libexclude_libs_test_3
1428
exclude_libs_test_LDADD = -lexclude_libs_test_1 -lexclude_libs_test_2 \
1429
        alt/libexclude_libs_test_3.a
1430
exclude_libs_test.syms: exclude_libs_test
1431
        $(TEST_READELF) -sW $< >$@ 2>/dev/null
1432
libexclude_libs_test_1.a: exclude_libs_test_1.o
1433
        $(TEST_AR) rc $@ $^
1434
libexclude_libs_test_2.a: exclude_libs_test_2.o
1435
        $(TEST_AR) rc $@ $^
1436
alt/libexclude_libs_test_3.a: exclude_libs_test_3.o
1437
        test -d alt || mkdir -p alt
1438
        $(TEST_AR) rc $@ $^
1439
 
1440
check_PROGRAMS += local_labels_test
1441
local_labels_test.o: ver_test_6.c
1442
        $(COMPILE) -g -c -Wa,-L -o $@ $<
1443
local_labels_test: local_labels_test.o
1444
        $(LINK) -Bgcctestdir/ local_labels_test.o
1445
 
1446
check_PROGRAMS += discard_locals_test
1447
check_SCRIPTS += discard_locals_test.sh
1448
check_DATA += discard_locals_test.syms \
1449
        discard_locals_relocatable_test1.syms \
1450
        discard_locals_relocatable_test2.syms
1451
MOSTLYCLEANFILES += discard_locals_test.syms \
1452
        discard_locals_relocatable_test1.syms \
1453
        discard_locals_relocatable_test2.syms \
1454
        discard_locals_relocatable_test1.out \
1455
        discard_locals_relocatable_test2.out
1456
discard_locals_test_SOURCES = discard_locals_test.c
1457
discard_locals_test_LDFLAGS = -Bgcctestdir/ -Wl,--discard-locals
1458
discard_locals_test.syms: discard_locals_test
1459
        $(TEST_READELF) -sW $< >$@ 2>/dev/null
1460
# '-Wa,-L' is required to preserve the local label used for testing.
1461
discard_locals_test.o: discard_locals_test.c
1462
        $(COMPILE) -c -Wa,-L -o $@ $<
1463
 
1464
discard_locals_relocatable_test1.syms: discard_locals_relocatable_test1.out
1465
        $(TEST_READELF) -sW $< >$@ 2>/dev/null
1466
discard_locals_relocatable_test.o: discard_locals_relocatable_test.c
1467
        $(COMPILE) -c -Wa,-L -fPIC -o $@ $<
1468
discard_locals_relocatable_test1.out: discard_locals_relocatable_test.o ../ld-new
1469
        ../ld-new --discard-locals -relocatable -o $@ $<
1470
 
1471
discard_locals_relocatable_test2.syms: discard_locals_relocatable_test2.out
1472
        $(TEST_READELF) -sW $< >$@ 2>/dev/null
1473
discard_locals_relocatable_test2.out: discard_locals_relocatable_test.o ../ld-new
1474
        ../ld-new --discard-all -relocatable -o $@ $<
1475
 
1476
if MCMODEL_MEDIUM
1477
check_PROGRAMS += large
1478
large_SOURCES = large.c
1479
large_CFLAGS = -mcmodel=medium
1480
large_DEPENDENCIES = gcctestdir/ld
1481
large_LDFLAGS = -Bgcctestdir/
1482
large_LDADD =
1483
endif MCMODEL_MEDIUM
1484
 
1485
# Test that hidden and internal symbols in the main program cannot be
1486
# referenced by a shared library.
1487
check_SCRIPTS += hidden_test.sh
1488
check_DATA += hidden_test.err
1489
MOSTLYCLEANFILES += hidden_test hidden_test.err
1490
libhidden.so: hidden_test_1.c gcctestdir/ld
1491
        $(COMPILE) -Bgcctestdir/ -g -shared -fPIC -w -o $@ $(srcdir)/hidden_test_1.c
1492
hidden_test: hidden_test_main.o libhidden.so gcctestdir/ld
1493
        $(LINK) -Bgcctestdir/ -Wl,-R,. hidden_test_main.o libhidden.so 2>hidden_test.err
1494
hidden_test.err: hidden_test
1495
        @touch hidden_test.err
1496
 
1497
# Test -retain-symbols-file.
1498
check_SCRIPTS += retain_symbols_file_test.sh
1499
check_DATA += retain_symbols_file_test.stdout
1500
MOSTLYCLEANFILES += retain_symbols_file_test retain_symbols_file_test.in \
1501
                    retain_symbols_file_test.stdout
1502
retain_symbols_file_test.so: basic_pic_test.o gcctestdir/ld
1503
        echo 'main' > retain_symbols_file_test.in
1504
        echo 't1' >> retain_symbols_file_test.in
1505
        echo '_ZN4t16bC1Ev' >> retain_symbols_file_test.in
1506
        echo '_ZNK4t20a3getEv' >> retain_symbols_file_test.in
1507
        echo '_Z3t18v' >> retain_symbols_file_test.in
1508
        echo '__tcf_0' >> retain_symbols_file_test.in
1509
        $(CXXLINK) -Bgcctestdir/ -shared -Wl,-retain-symbols-file,retain_symbols_file_test.in basic_pic_test.o
1510
retain_symbols_file_test.stdout: retain_symbols_file_test.so
1511
        $(TEST_NM) -C retain_symbols_file_test.so > $@
1512
 
1513
 
1514
# Test that if the output file already exists and is empty,
1515
# it will get execute permission.
1516
check_PROGRAMS += permission_test
1517
permission_test: basic_test.o gcctestdir/ld
1518
        umask 022; \
1519
        rm -f $@; \
1520
        touch $@; \
1521
        chmod 600 $@; \
1522
        $(CXXLINK) -Bgcctestdir/ basic_test.o
1523
 
1524
# Check -l:foo.a
1525
check_PROGRAMS += searched_file_test
1526
MOSTLYCLEANFILES += searched_file_test searched_file_test_lib.o \
1527
                    alt/searched_file_test_lib.a
1528
searched_file_test_SOURCES = searched_file_test.cc
1529
searched_file_test_DEPENDENCIES = alt/searched_file_test_lib.a
1530
searched_file_test_LDFLAGS = -Bgcctestdir/ -Lalt
1531
searched_file_test_LDADD = -l:searched_file_test_lib.a
1532
searched_file_test_lib.o: searched_file_test_lib.cc
1533
        $(CXXCOMPILE) -c -o $@ $<
1534
alt/searched_file_test_lib.a: searched_file_test_lib.o
1535
        test -d alt || mkdir -p alt
1536
        $(TEST_AR) rc $@ $^
1537
 
1538
# Test that no .gnu.version sections are created when
1539
# symbol versioning is not used.
1540
check_SCRIPTS += no_version_test.sh
1541
check_DATA += no_version_test.stdout
1542
MOSTLYCLEANFILES += libno_version_test.so no_version_test.stdout
1543
# We invoke the linker directly since gcc may include additional objects that
1544
# uses symbol versioning.
1545
libno_version_test.so: no_version_test.o gcctestdir/ld
1546
        gcctestdir/ld -shared -o $@ no_version_test.o
1547
no_version_test.o: no_version_test.c
1548
        $(COMPILE) -o $@ -c -fPIC $<
1549
no_version_test.stdout: libno_version_test.so
1550
        $(TEST_OBJDUMP) -h $< > $@
1551
 
1552
# Test STT_GNU_IFUNC symbols.
1553
if IFUNC
1554
 
1555
ifuncmod1.o: ifuncmod1.c
1556
        $(COMPILE) -c -fpic -o $@ $<
1557
ifuncmod1.so: ifuncmod1.o gcctestdir/ld
1558
        $(LINK) -Bgcctestdir/ -shared ifuncmod1.o
1559
 
1560
ifuncdep1.o: ifuncmod1.c
1561
        $(COMPILE) -c -o $@ $<
1562
 
1563
ifuncmain1pic.o: ifuncmain1.c
1564
        $(COMPILE) -c -fpic -o $@ $<
1565
ifuncmain1pie.o: ifuncmain1.c
1566
        $(COMPILE) -c -fpie -o $@ $<
1567
 
1568
check_PROGRAMS += ifuncmain1static
1569
ifuncmain1static_SOURCES = ifuncmain1.c
1570
ifuncmain1static_DEPENDENCIES = gcctestdir/ld ifuncdep1.o
1571
ifuncmain1static_LDFLAGS = -Bgcctestdir/ -static
1572
ifuncmain1static_LDADD = ifuncdep1.o
1573
 
1574
check_PROGRAMS += ifuncmain1picstatic
1575
ifuncmain1picstatic: ifuncmain1pic.o ifuncmod1.o gcctestdir/ld
1576
        $(LINK) -Bgcctestdir/ -static ifuncmain1pic.o ifuncmod1.o
1577
 
1578
check_PROGRAMS += ifuncmain1
1579
ifuncmain1_SOURCES = ifuncmain1.c
1580
ifuncmain1_DEPENDENCIES = gcctestdir/ld ifuncmod1.so
1581
ifuncmain1_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1582
ifuncmain1_LDADD = ifuncmod1.so
1583
 
1584
check_PROGRAMS += ifuncmain1pic
1585
ifuncmain1pic: ifuncmain1pic.o ifuncmod1.so gcctestdir/ld
1586
        $(LINK) -Bgcctestdir/ ifuncmain1pic.o ifuncmod1.so -Wl,-R,.
1587
 
1588
check_PROGRAMS += ifuncmain1vis
1589
ifuncmain1vis_SOURCES = ifuncmain1vis.c
1590
ifuncmain1vis_DEPENDENCIES = gcctestdir/ld ifuncmod1.so
1591
ifuncmain1vis_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1592
ifuncmain1vis_LDADD = ifuncmod1.so
1593
 
1594
check_PROGRAMS += ifuncmain1vispic
1595
ifuncmain1vispic.o: ifuncmain1vis.c
1596
        $(COMPILE) -c -fpic -o $@ $<
1597
ifuncmain1vispic: ifuncmain1vispic.o ifuncmod1.so gcctestdir/ld
1598
        $(LINK) -Bgcctestdir/ ifuncmain1pic.o ifuncmod1.so -Wl,-R,.
1599
 
1600
check_PROGRAMS += ifuncmain1staticpic
1601
ifuncmain1staticpic: ifuncmain1pic.o ifuncmod1.o gcctestdir/ld
1602
        $(LINK) -Bgcctestdir/ ifuncmain1pic.o ifuncmod1.o
1603
 
1604
check_PROGRAMS += ifuncmain1pie
1605
ifuncmain1pie: ifuncmain1pie.o ifuncmod1.so gcctestdir/ld
1606
        $(LINK) -Bgcctestdir/ -pie ifuncmain1pie.o ifuncmod1.so -Wl,-R,.
1607
 
1608
check_PROGRAMS += ifuncmain1vispie
1609
ifuncmain1vispie.o: ifuncmain1vis.c
1610
        $(COMPILE) -c -fpie -o $@ $<
1611
ifuncmain1vispie: ifuncmain1vispie.o ifuncmod1.so gcctestdir/ld
1612
        $(LINK) -Bgcctestdir/ -pie ifuncmain1vispie.o ifuncmod1.so -Wl,-R,.
1613
 
1614
check_PROGRAMS += ifuncmain1staticpie
1615
ifuncmain1staticpie: ifuncmain1pie.o ifuncmod1.o gcctestdir/ld
1616
        $(LINK) -Bgcctestdir/ -pie ifuncmain1pie.o ifuncmod1.o
1617
 
1618
ifuncmain2pic.o: ifuncmain2.c
1619
        $(COMPILE) -c -fpic -o $@ $<
1620
 
1621
ifuncdep2pic.o: ifuncdep2.c
1622
        $(COMPILE) -c -fpic -o $@ $<
1623
 
1624
check_PROGRAMS += ifuncmain2static
1625
ifuncmain2static_SOURCES = ifuncmain2.c ifuncdep2.c
1626
ifuncmain2static_DEPENDENCIES = gcctestdir/ld
1627
ifuncmain2static_LDFLAGS = -Bgcctestdir/ -static
1628
ifuncmain2static_LDADD =
1629
 
1630
check_PROGRAMS += ifuncmain2picstatic
1631
ifuncmain2picstatic: ifuncmain2pic.o ifuncdep2pic.o gcctestdir/ld
1632
        $(LINK) -Bgcctestdir/ -static ifuncmain2pic.o ifuncdep2pic.o
1633
 
1634
check_PROGRAMS += ifuncmain2
1635
ifuncmain2_SOURCES = ifuncmain2.c ifuncdep2.c
1636
ifuncmain2_DEPENDENCIES = gcctestdir/ld
1637
ifuncmain2_LDFLAGS = -Bgcctestdir/
1638
ifuncmain2_LDADD =
1639
 
1640
check_PROGRAMS += ifuncmain2pic
1641
ifuncmain2pic: ifuncmain2pic.o ifuncdep2pic.o gcctestdir/ld
1642
        $(LINK) -Bgcctestdir/ ifuncmain2pic.o ifuncdep2pic.o
1643
 
1644
ifuncmod3.o: ifuncmod3.c
1645
        $(COMPILE) -c -fpic -o $@ $<
1646
ifuncmod3.so: ifuncmod3.o gcctestdir/ld
1647
        $(LINK) -Bgcctestdir/ -shared ifuncmod3.o
1648
 
1649
check_PROGRAMS += ifuncmain3
1650
ifuncmain3_SOURCES = ifuncmain3.c
1651
ifuncmain3_DEPENDENCIES = gcctestdir/ld ifuncmod3.so
1652
ifuncmain3_LDFLAGS = -Bgcctestdir/ -Wl,--export-dynamic -Wl,-R,.
1653
ifuncmain3_LDADD = -ldl
1654
 
1655
ifuncmain4pic.o: ifuncmain4.c
1656
        $(COMPILE) -c -fpic -o $@ $<
1657
 
1658
check_PROGRAMS += ifuncmain4static
1659
ifuncmain4static_SOURCES = ifuncmain4.c
1660
ifuncmain4static_DEPENDENCIES = gcctestdir/ld
1661
ifuncmain4static_LDFLAGS = -Bgcctestdir/ -static
1662
ifuncmain4static_LDADD =
1663
 
1664
check_PROGRAMS += ifuncmain4picstatic
1665
ifuncmain4picstatic: ifuncmain4pic.o gcctestdir/ld
1666
        $(LINK) -Bgcctestdir/ -static ifuncmain4pic.o
1667
 
1668
check_PROGRAMS += ifuncmain4
1669
ifuncmain4_SOURCES = ifuncmain4.c
1670
ifuncmain4_DEPENDENCIES = gcctestdir/ld
1671
ifuncmain4_LDFLAGS = -Bgcctestdir/
1672
ifuncmain4_LDADD =
1673
 
1674
ifuncmain5pic.o: ifuncmain5.c
1675
        $(COMPILE) -c -fpic -o $@ $<
1676
 
1677
ifuncmain5pie.o: ifuncmain5.c
1678
        $(COMPILE) -c -fpie -o $@ $<
1679
 
1680
ifuncmod5.o: ifuncmod5.c
1681
        $(COMPILE) -c -fpic -o $@ $<
1682
ifuncmod5.so: ifuncmod5.o gcctestdir/ld
1683
        $(LINK) -Bgcctestdir/ -shared ifuncmod5.o
1684
 
1685
ifuncdep5.o: ifuncmod5.c
1686
        $(COMPILE) -c -o $@ $<
1687
 
1688
check_PROGRAMS += ifuncmain5static
1689
ifuncmain5static_SOURCES = ifuncmain5.c
1690
ifuncmain5static_DEPENDENCIES = gcctestdir/ld ifuncdep5.o
1691
ifuncmain5static_LDFLAGS = -Bgcctestdir/ -static
1692
ifuncmain5static_LDADD = ifuncdep5.o
1693
 
1694
check_PROGRAMS += ifuncmain5picstatic
1695
ifuncmain5picstatic: ifuncmain5pic.o ifuncmod5.o gcctestdir/ld
1696
        $(LINK) -Bgcctestdir/ -static ifuncmain5pic.o ifuncmod5.o
1697
 
1698
check_PROGRAMS += ifuncmain5
1699
ifuncmain5_SOURCES = ifuncmain5.c
1700
ifuncmain5_DEPENDENCIES = gcctestdir/ld ifuncmod5.so
1701
ifuncmain5_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
1702
ifuncmain5_LDADD = ifuncmod5.so
1703
 
1704
check_PROGRAMS += ifuncmain5pic
1705
ifuncmain5pic: ifuncmain5pic.o ifuncmod5.so gcctestdir/ld
1706
        $(LINK) -Bgcctestdir/ ifuncmain5pic.o ifuncmod5.so -Wl,-R,.
1707
 
1708
check_PROGRAMS += ifuncmain5staticpic
1709
ifuncmain5staticpic: ifuncmain5pic.o ifuncmod5.o gcctestdir/ld
1710
        $(LINK) -Bgcctestdir/ ifuncmain5pic.o ifuncmod5.o
1711
 
1712
check_PROGRAMS += ifuncmain5pie
1713
ifuncmain5pie: ifuncmain5pie.o ifuncmod5.so gcctestdir/ld
1714
        $(LINK) -Bgcctestdir/ -pie ifuncmain5pie.o ifuncmod5.so -Wl,-R,.
1715
 
1716
ifuncmain6pie.o: ifuncmain6pie.c
1717
        $(COMPILE) -c -fpie -o $@ $<
1718
 
1719
ifuncmod6.o: ifuncmod6.c
1720
        $(COMPILE) -c -fpic -o $@ $<
1721
ifuncmod6.so: ifuncmod6.o gcctestdir/ld
1722
        $(LINK) -Bgcctestdir/ -shared ifuncmod6.o
1723
 
1724
check_PROGRAMS += ifuncmain6pie
1725
ifuncmain6pie: ifuncmain6pie.o ifuncmod6.so gcctestdir/ld
1726
        $(LINK) -Bgcctestdir/ -pie ifuncmain6pie.o ifuncmod6.so -Wl,-R,.
1727
 
1728
ifuncmain7pic.o: ifuncmain7.c
1729
        $(COMPILE) -c -fpic -o $@ $<
1730
 
1731
ifuncmain7pie.o: ifuncmain7.c
1732
        $(COMPILE) -c -fpie -o $@ $<
1733
 
1734
check_PROGRAMS += ifuncmain7static
1735
ifuncmain7static_SOURCES = ifuncmain7.c
1736
ifuncmain7static_DEPENDENCIES = gcctestdir/ld
1737
ifuncmain7static_LDFLAGS = -Bgcctestdir/ -static
1738
ifuncmain7static_LDADD =
1739
 
1740
check_PROGRAMS += ifuncmain7picstatic
1741
ifuncmain7picstatic: ifuncmain7pic.o gcctestdir/ld
1742
        $(LINK) -Bgcctestdir/ -static ifuncmain7pic.o
1743
 
1744
check_PROGRAMS += ifuncmain7
1745
ifuncmain7_SOURCES = ifuncmain7.c
1746
ifuncmain7_DEPENDENCIES = gcctestdir/ld
1747
ifuncmain7_LDFLAGS = -Bgcctestdir/
1748
ifuncmain7_LDADD =
1749
 
1750
check_PROGRAMS += ifuncmain7pic
1751
ifuncmain7pic: ifuncmain7pic.o gcctestdir/ld
1752
        $(LINK) -Bgcctestdir/ ifuncmain7pic.o
1753
 
1754
check_PROGRAMS += ifuncmain7pie
1755
ifuncmain7pie: ifuncmain7pie.o gcctestdir/ld
1756
        $(LINK) -Bgcctestdir/ -pie ifuncmain7pie.o
1757
 
1758
endif IFUNC
1759
 
1760
# Test that strong reference to a weak symbol in a DSO remains strong.
1761
check_SCRIPTS += strong_ref_weak_def.sh
1762
check_DATA += strong_ref_weak_def.stdout
1763
MOSTLYCLEANFILES += strong_ref_weak_def_1.so strong_ref_weak_def_2.so \
1764
        strong_ref_weak_def.stdout
1765
strong_ref_weak_def_2.o: strong_ref_weak_def_2.c
1766
        $(COMPILE) -o $@ -c -fPIC $<
1767
strong_ref_weak_def_2.so: strong_ref_weak_def_2.o gcctestdir/ld
1768
        gcctestdir/ld -shared -o $@ strong_ref_weak_def_2.o
1769
strong_ref_weak_def_1.o: strong_ref_weak_def_1.c
1770
        $(COMPILE) -o $@ -c -fPIC $<
1771
strong_ref_weak_def_1.so: strong_ref_weak_def_1.o strong_ref_weak_def_2.so \
1772
        gcctestdir/ld
1773
        gcctestdir/ld -shared -o $@ strong_ref_weak_def_1.o \
1774
                strong_ref_weak_def_2.so
1775
strong_ref_weak_def.stdout: strong_ref_weak_def_1.so
1776
        $(TEST_READELF) -sWD $< > $@
1777
 
1778
# Test that a strong weak reference remains strong if there is another
1779
# weak reference in a DSO.
1780
check_SCRIPTS += dyn_weak_ref.sh
1781
check_DATA += dyn_weak_ref.stdout
1782
MOSTLYCLEANFILES += dyn_weak_ref_1.so dyn_weak_ref_2.so \
1783
        dyn_weak_ref.stdout
1784
dyn_weak_ref_2.o: dyn_weak_ref_2.c
1785
        $(COMPILE) -o $@ -c -fPIC $<
1786
dyn_weak_ref_2.so: dyn_weak_ref_2.o gcctestdir/ld
1787
        gcctestdir/ld -shared -o $@ dyn_weak_ref_2.o
1788
dyn_weak_ref_1.o: dyn_weak_ref_1.c
1789
        $(COMPILE) -o $@ -c -fPIC $<
1790
# We intentionally put dyn_weak_ref_2.so in front of dyn_weak_ref_1.o
1791
# so that the weak ref there goes to gold's symbol table first.
1792
dyn_weak_ref_1.so: dyn_weak_ref_1.o dyn_weak_ref_2.so gcctestdir/ld
1793
        gcctestdir/ld -shared -o $@ dyn_weak_ref_2.so dyn_weak_ref_1.o
1794
dyn_weak_ref.stdout: dyn_weak_ref_1.so
1795
        $(TEST_READELF) -sWD $< > $@
1796
 
1797
 
1798
# Test that --start-lib and --end-lib function correctly.
1799
check_PROGRAMS += start_lib_test
1800
start_lib_test: start_lib_test_main.o libstart_lib_test.a start_lib_test_2.o start_lib_test_3.o \
1801
        gcctestdir/ld
1802
        $(LINK) -Bgcctestdir/ -o $@ start_lib_test_main.o -L. -lstart_lib_test \
1803
                -Wl,--start-lib start_lib_test_2.o start_lib_test_3.o -Wl,--end-lib
1804
libstart_lib_test.a: start_lib_test_1.o
1805
        $(TEST_AR) rc $@ $^
1806
 
1807
# Test that MEMORY region support works.
1808
check_SCRIPTS += memory_test.sh
1809
check_DATA += memory_test.stdout
1810
MOSTLYCLEANFILES += memory_test.stdout memory_test memory_test.o
1811
memory_test.o: memory_test.s
1812
        $(COMPILE) -o $@ -c $<
1813
memory_test: memory_test.o gcctestdir/ld $(srcdir)/memory_test.t
1814
        $(LINK) -Bgcctestdir/ -nostartfiles -nostdlib -T $(srcdir)/memory_test.t -o $@ memory_test.o
1815
memory_test.stdout: memory_test
1816
        $(TEST_READELF) -lWS  $< > $@
1817
 
1818
# End-to-end incremental linking tests.
1819
# Incremental linking is currently supported only on the x86_64 target.
1820
 
1821
if DEFAULT_TARGET_X86_64
1822
 
1823
check_PROGRAMS += incremental_test_2
1824
MOSTLYCLEANFILES += two_file_test_tmp_2.o
1825
incremental_test_2: two_file_test_1_v1.o two_file_test_1.o two_file_test_1b.o \
1826
                    two_file_test_2.o two_file_test_main.o gcctestdir/ld
1827
        cp -f two_file_test_1_v1.o two_file_test_tmp_2.o
1828
        $(CXXLINK) -Wl,--incremental-full -Bgcctestdir/ two_file_test_tmp_2.o two_file_test_1b.o two_file_test_2.o two_file_test_main.o
1829
        @sleep 1
1830
        cp -f two_file_test_1.o two_file_test_tmp_2.o
1831
        $(CXXLINK) -Wl,--incremental-update -Bgcctestdir/ two_file_test_tmp_2.o two_file_test_1b.o two_file_test_2.o two_file_test_main.o
1832
 
1833
check_PROGRAMS += incremental_test_3
1834
MOSTLYCLEANFILES += two_file_test_tmp_3.o
1835
incremental_test_3: two_file_test_1.o two_file_test_1b_v1.o two_file_test_1b.o \
1836
                    two_file_test_2.o two_file_test_main.o gcctestdir/ld
1837
        cp -f two_file_test_1b_v1.o two_file_test_tmp_3.o
1838
        $(CXXLINK) -Wl,--incremental-full -Bgcctestdir/ two_file_test_1.o two_file_test_tmp_3.o two_file_test_2.o two_file_test_main.o
1839
        @sleep 1
1840
        cp -f two_file_test_1b.o two_file_test_tmp_3.o
1841
        $(CXXLINK) -Wl,--incremental-update -Bgcctestdir/ two_file_test_1.o two_file_test_tmp_3.o two_file_test_2.o two_file_test_main.o
1842
 
1843
check_PROGRAMS += incremental_test_4
1844
MOSTLYCLEANFILES += incremental_test_4.base two_file_test_tmp_4.o
1845
incremental_test_4: two_file_test_1.o two_file_test_1b.o two_file_test_2_v1.o \
1846
                    two_file_test_2.o two_file_test_main.o gcctestdir/ld
1847
        cp -f two_file_test_2_v1.o two_file_test_tmp_4.o
1848
        $(CXXLINK) -Wl,--incremental-full -Bgcctestdir/ two_file_test_1.o two_file_test_1b.o two_file_test_tmp_4.o two_file_test_main.o
1849
        mv -f incremental_test_4 incremental_test_4.base
1850
        @sleep 1
1851
        cp -f two_file_test_2.o two_file_test_tmp_4.o
1852
        $(CXXLINK) -Wl,--incremental-update,--incremental-base=incremental_test_4.base -Bgcctestdir/ two_file_test_1.o two_file_test_1b.o two_file_test_tmp_4.o two_file_test_main.o
1853
 
1854
endif DEFAULT_TARGET_X86_64
1855
 
1856
endif GCC
1857
endif NATIVE_LINKER
1858
 
1859
# These tests work with native and cross linkers.
1860
 
1861
if NATIVE_OR_CROSS_LINKER
1862
 
1863
# Test script section order.
1864
check_SCRIPTS += script_test_10.sh
1865
check_DATA += script_test_10.stdout
1866
script_test_10.o: script_test_10.s
1867
        $(TEST_AS) -o $@ $<
1868
script_test_10: $(srcdir)/script_test_10.t script_test_10.o gcctestdir/ld
1869
        gcctestdir/ld -o $@ script_test_10.o -T $(srcdir)/script_test_10.t
1870
script_test_10.stdout: script_test_10
1871
        $(TEST_READELF) -SW script_test_10 > $@
1872
 
1873
# These tests work with cross linkers only.
1874
 
1875
if DEFAULT_TARGET_I386
1876
 
1877
check_SCRIPTS += split_i386.sh
1878
check_DATA += split_i386_1.stdout split_i386_2.stdout \
1879
        split_i386_3.stdout split_i386_4.stdout split_i386_r.stdout
1880
SPLIT_DEFSYMS = --defsym __morestack=0x100 --defsym __morestack_non_split=0x200
1881
split_i386_1.o: split_i386_1.s
1882
        $(TEST_AS) -o $@ $<
1883
split_i386_2.o: split_i386_2.s
1884
        $(TEST_AS) -o $@ $<
1885
split_i386_3.o: split_i386_3.s
1886
        $(TEST_AS) -o $@ $<
1887
split_i386_4.o: split_i386_4.s
1888
        $(TEST_AS) -o $@ $<
1889
split_i386_n.o: split_i386_n.s
1890
        $(TEST_AS) -o $@ $<
1891
split_i386_1: split_i386_1.o split_i386_n.o ../ld-new
1892
        ../ld-new $(SPLIT_DEFSYMS) -o $@ split_i386_1.o split_i386_n.o
1893
split_i386_1.stdout: split_i386_1
1894
        $(TEST_OBJDUMP) -d $< > $@
1895
split_i386_2: split_i386_2.o split_i386_n.o ../ld-new
1896
        ../ld-new $(SPLIT_DEFSYMS) -o $@ split_i386_2.o split_i386_n.o
1897
split_i386_2.stdout: split_i386_2
1898
        $(TEST_OBJDUMP) -d $< > $@
1899
split_i386_3.stdout: split_i386_3.o split_i386_n.o ../ld-new
1900
        ../ld-new $(SPLIT_DEFSYMS) -o split_i386_3 split_i386_3.o split_i386_n.o > $@ 2>&1 || exit 0
1901
split_i386_4: split_i386_4.o split_i386_n.o ../ld-new
1902
        ../ld-new $(SPLIT_DEFSYMS) -o $@ split_i386_4.o split_i386_n.o
1903
split_i386_4.stdout: split_i386_4
1904
        $(TEST_OBJDUMP) -d $< > $@
1905
split_i386_r.stdout: split_i386_1.o split_i386_n.o ../ld-new
1906
        ../ld-new -r split_i386_1.o split_i386_n.o -o split_i386_r > $@ 2>&1 || exit 0
1907
MOSTLYCLEANFILES += split_i386_1 split_i386_2 split_i386_3 \
1908
        split_i386_4 split_i386_r
1909
 
1910
endif DEFAULT_TARGET_I386
1911
 
1912
if DEFAULT_TARGET_X86_64
1913
 
1914
check_SCRIPTS += split_x86_64.sh
1915
check_DATA += split_x86_64_1.stdout split_x86_64_2.stdout \
1916
        split_x86_64_3.stdout split_x86_64_4.stdout split_x86_64_r.stdout
1917
SPLIT_DEFSYMS = --defsym __morestack=0x100 --defsym __morestack_non_split=0x200
1918
split_x86_64_1.o: split_x86_64_1.s
1919
        $(TEST_AS) -o $@ $<
1920
split_x86_64_2.o: split_x86_64_2.s
1921
        $(TEST_AS) -o $@ $<
1922
split_x86_64_3.o: split_x86_64_3.s
1923
        $(TEST_AS) -o $@ $<
1924
split_x86_64_4.o: split_x86_64_4.s
1925
        $(TEST_AS) -o $@ $<
1926
split_x86_64_n.o: split_x86_64_n.s
1927
        $(TEST_AS) -o $@ $<
1928
split_x86_64_1: split_x86_64_1.o split_x86_64_n.o ../ld-new
1929
        ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x86_64_1.o split_x86_64_n.o
1930
split_x86_64_1.stdout: split_x86_64_1
1931
        $(TEST_OBJDUMP) -d $< > $@
1932
split_x86_64_2: split_x86_64_2.o split_x86_64_n.o ../ld-new
1933
        ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x86_64_2.o split_x86_64_n.o
1934
split_x86_64_2.stdout: split_x86_64_2
1935
        $(TEST_OBJDUMP) -d $< > $@
1936
split_x86_64_3.stdout: split_x86_64_3.o split_x86_64_n.o ../ld-new
1937
        ../ld-new $(SPLIT_DEFSYMS) -o split_x86_64_3 split_x86_64_3.o split_x86_64_n.o > $@ 2>&1 || exit 0
1938
split_x86_64_4: split_x86_64_4.o split_x86_64_n.o ../ld-new
1939
        ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x86_64_4.o split_x86_64_n.o
1940
split_x86_64_4.stdout: split_x86_64_4
1941
        $(TEST_OBJDUMP) -d $< > $@
1942
split_x86_64_r.stdout: split_x86_64_1.o split_x86_64_n.o ../ld-new
1943
        ../ld-new -r split_x86_64_1.o split_x86_64_n.o -o split_x86_64_r > $@ 2>&1 || exit 0
1944
MOSTLYCLEANFILES += split_x86_64_1 split_x86_64_2 split_x86_64_3 \
1945
        split_x86_64_4 split_x86_64_r
1946
 
1947
endif DEFAULT_TARGET_X86_64
1948
 
1949
if DEFAULT_TARGET_ARM
1950
 
1951
check_SCRIPTS += arm_abs_global.sh
1952
check_DATA += arm_abs_global.stdout
1953
arm_abs_lib.o: arm_abs_lib.s
1954
        $(TEST_AS) -march=armv7-a -o $@ $<
1955
libarm_abs.so: arm_abs_lib.o ../ld-new
1956
        ../ld-new -shared -o $@ arm_abs_lib.o
1957
arm_abs_global.o: arm_abs_global.s
1958
        $(TEST_AS) -march=armv7-a -o $@ $<
1959
arm_abs_global: arm_abs_global.o libarm_abs.so ../ld-new
1960
        ../ld-new -o $@ arm_abs_global.o -L. -larm_abs
1961
arm_abs_global.stdout: arm_abs_global
1962
        $(TEST_READELF) -r $< > $@
1963
 
1964
MOSTLYCLEANFILES += arm_abs_global
1965
 
1966
check_SCRIPTS += arm_branch_in_range.sh arm_branch_out_of_range.sh
1967
check_DATA += arm_bl_in_range.stdout arm_bl_out_of_range.stdout \
1968
        thumb_bl_in_range.stdout thumb_bl_out_of_range.stdout \
1969
        thumb2_bl_in_range.stdout thumb2_bl_out_of_range.stdout \
1970
        thumb_blx_in_range.stdout thumb_blx_out_of_range.stdout \
1971
        thumb2_blx_in_range.stdout thumb2_blx_out_of_range.stdout \
1972
        thumb_bl_out_of_range_local.stdout
1973
 
1974
arm_bl_in_range.stdout: arm_bl_in_range
1975
        $(TEST_OBJDUMP) -D $< > $@
1976
 
1977
arm_bl_in_range: arm_bl_in_range.o ../ld-new
1978
        ../ld-new -T $(srcdir)/arm_branch_range.t -o $@ $<
1979
 
1980
arm_bl_in_range.o: arm_bl_in_range.s
1981
        $(TEST_AS) -o $@ $<
1982
 
1983
arm_bl_out_of_range.stdout: arm_bl_out_of_range
1984
        $(TEST_OBJDUMP) -S $< > $@
1985
 
1986
arm_bl_out_of_range: arm_bl_out_of_range.o ../ld-new
1987
        ../ld-new -T $(srcdir)/arm_branch_range.t -o $@ $<
1988
 
1989
arm_bl_out_of_range.o: arm_bl_out_of_range.s
1990
        $(TEST_AS) -o $@ $<
1991
 
1992
thumb_bl_in_range.stdout: thumb_bl_in_range
1993
        $(TEST_OBJDUMP) -D $< > $@
1994
 
1995
thumb_bl_in_range: thumb_bl_in_range.o ../ld-new
1996
        ../ld-new -T $(srcdir)/thumb_branch_range.t -o $@ $<
1997
 
1998
thumb_bl_in_range.o: thumb_bl_in_range.s
1999
        $(TEST_AS) -o $@ -march=armv5te $<
2000
 
2001
thumb_bl_out_of_range.stdout: thumb_bl_out_of_range
2002
        $(TEST_OBJDUMP) -D $< > $@
2003
 
2004
thumb_bl_out_of_range: thumb_bl_out_of_range.o ../ld-new
2005
        ../ld-new -T $(srcdir)/thumb_branch_range.t -o $@ $<
2006
 
2007
thumb_bl_out_of_range.o: thumb_bl_out_of_range.s
2008
        $(TEST_AS) -o $@ -march=armv5te $<
2009
 
2010
thumb2_bl_in_range.stdout: thumb2_bl_in_range
2011
        $(TEST_OBJDUMP) -D $< > $@
2012
 
2013
thumb2_bl_in_range: thumb2_bl_in_range.o ../ld-new
2014
        ../ld-new -T $(srcdir)/thumb2_branch_range.t -o $@ $<
2015
 
2016
thumb2_bl_in_range.o: thumb_bl_in_range.s
2017
        $(TEST_AS) -o $@ -march=armv7-a $<
2018
 
2019
thumb2_bl_out_of_range.stdout: thumb2_bl_out_of_range
2020
        $(TEST_OBJDUMP) -D $< > $@
2021
 
2022
thumb2_bl_out_of_range: thumb2_bl_out_of_range.o ../ld-new
2023
        ../ld-new -T $(srcdir)/thumb2_branch_range.t -o $@ $<
2024
 
2025
thumb2_bl_out_of_range.o: thumb_bl_out_of_range.s
2026
        $(TEST_AS) -o $@ -march=armv7-a $<
2027
 
2028
thumb_blx_in_range.stdout: thumb_blx_in_range
2029
        $(TEST_OBJDUMP) -D $< > $@
2030
 
2031
thumb_blx_in_range: thumb_blx_in_range.o ../ld-new
2032
        ../ld-new -T $(srcdir)/thumb_branch_range.t -o $@ $<
2033
 
2034
thumb_blx_in_range.o: thumb_blx_in_range.s
2035
        $(TEST_AS) -o $@ -march=armv5te $<
2036
 
2037
thumb_blx_out_of_range.stdout: thumb_blx_out_of_range
2038
        $(TEST_OBJDUMP) -D $< > $@
2039
 
2040
thumb_blx_out_of_range: thumb_blx_out_of_range.o ../ld-new
2041
        ../ld-new -T $(srcdir)/thumb_branch_range.t -o $@ $<
2042
 
2043
thumb_blx_out_of_range.o: thumb_blx_out_of_range.s
2044
        $(TEST_AS) -o $@ -march=armv5te $<
2045
 
2046
thumb2_blx_in_range.stdout: thumb2_blx_in_range
2047
        $(TEST_OBJDUMP) -D $< > $@
2048
 
2049
thumb2_blx_in_range: thumb2_blx_in_range.o ../ld-new
2050
        ../ld-new -T $(srcdir)/thumb2_branch_range.t -o $@ $<
2051
 
2052
thumb2_blx_in_range.o: thumb_blx_in_range.s
2053
        $(TEST_AS) -o $@ -march=armv7-a $<
2054
 
2055
thumb2_blx_out_of_range.stdout: thumb2_blx_out_of_range
2056
        $(TEST_OBJDUMP) -D $< > $@
2057
 
2058
thumb2_blx_out_of_range: thumb2_blx_out_of_range.o ../ld-new
2059
        ../ld-new -T $(srcdir)/thumb2_branch_range.t -o $@ $<
2060
 
2061
thumb2_blx_out_of_range.o: thumb_blx_out_of_range.s
2062
        $(TEST_AS) -o $@ -march=armv7-a $<
2063
 
2064
thumb_bl_out_of_range_local.stdout: thumb_bl_out_of_range_local
2065
        $(TEST_OBJDUMP) -D $< > $@
2066
 
2067
thumb_bl_out_of_range_local: thumb_bl_out_of_range_local.o ../ld-new
2068
        ../ld-new -T $(srcdir)/thumb_branch_range.t -o $@ $<
2069
 
2070
thumb_bl_out_of_range_local.o: thumb_bl_out_of_range_local.s
2071
        $(TEST_AS) -o $@ -march=armv5te $<
2072
 
2073
MOSTLYCLEANFILES += arm_bl_in_range arm_bl_out_of_range thumb_bl_in_range \
2074
        thumb_bl_out_of_range thumb2_bl_in_range thumb2_bl_out_of_range \
2075
        thumb_blx_in_range thumb_blx_out_of_range thumb2_blx_in_range \
2076
        thumb2_blx_out_of_range thumb_bl_out_of_range_local
2077
 
2078
check_SCRIPTS += arm_fix_v4bx.sh
2079
check_DATA += arm_fix_v4bx.stdout arm_fix_v4bx_interworking.stdout \
2080
        arm_no_fix_v4bx.stdout
2081
 
2082
arm_fix_v4bx.stdout: arm_fix_v4bx
2083
        $(TEST_OBJDUMP) -D -j.text $< > $@
2084
 
2085
arm_fix_v4bx: arm_fix_v4bx.o ../ld-new
2086
        ../ld-new --fix-v4bx -o $@ $<
2087
 
2088
arm_fix_v4bx.o: arm_fix_v4bx.s
2089
        $(TEST_AS) -o $@ $<
2090
 
2091
arm_fix_v4bx_interworking.stdout: arm_fix_v4bx_interworking
2092
        $(TEST_OBJDUMP) -D -j.text $< > $@
2093
 
2094
arm_fix_v4bx_interworking: arm_fix_v4bx.o ../ld-new
2095
        ../ld-new --fix-v4bx-interworking -o $@ $<
2096
 
2097
arm_no_fix_v4bx.stdout: arm_no_fix_v4bx
2098
        $(TEST_OBJDUMP) -D -j.text $< > $@
2099
 
2100
arm_no_fix_v4bx: arm_fix_v4bx.o ../ld-new
2101
        ../ld-new -o $@ $<
2102
 
2103
MOSTLYCLEANFILES += arm_fix_v4bx arm_fix_v4bx_interworking arm_no_fix_v4bx
2104
 
2105
check_SCRIPTS += arm_attr_merge.sh
2106
check_DATA += arm_attr_merge_6.stdout arm_attr_merge_6r.stdout \
2107
        arm_attr_merge_7.stdout
2108
 
2109
arm_attr_merge_6.stdout: arm_attr_merge_6
2110
        $(TEST_READELF) -A $< > $@
2111
 
2112
arm_attr_merge_6: arm_attr_merge_6a.o arm_attr_merge_6b.o
2113
        ../ld-new -o $@ arm_attr_merge_6a.o arm_attr_merge_6b.o
2114
 
2115
arm_attr_merge_6a.o: arm_attr_merge_6a.s
2116
        $(TEST_AS) -o $@ $<
2117
 
2118
arm_attr_merge_6b.o: arm_attr_merge_6b.s
2119
        $(TEST_AS) -o $@ $<
2120
 
2121
arm_attr_merge_6r.stdout: arm_attr_merge_6r
2122
        $(TEST_READELF) -A $< > $@
2123
 
2124
arm_attr_merge_6r: arm_attr_merge_6b.o arm_attr_merge_6a.o
2125
        ../ld-new -o $@ arm_attr_merge_6b.o arm_attr_merge_6a.o
2126
 
2127
arm_attr_merge_7.stdout: arm_attr_merge_7
2128
        $(TEST_READELF) -A $< > $@
2129
 
2130
arm_attr_merge_7: arm_attr_merge_7a.o arm_attr_merge_7b.o
2131
        ../ld-new -o $@ arm_attr_merge_7a.o arm_attr_merge_7b.o
2132
 
2133
arm_attr_merge_7a.o: arm_attr_merge_7a.s
2134
        $(TEST_AS) -o $@ $<
2135
 
2136
arm_attr_merge_7b.o: arm_attr_merge_7b.s
2137
        $(TEST_AS) -o $@ $<
2138
 
2139
MOSTLYCLEANFILES += arm_attr_merge_6 arm_attr_merge_6r arm_attr_merge_7
2140
 
2141
# Cortex-A8 workaround test.
2142
 
2143
check_SCRIPTS += arm_cortex_a8.sh
2144
check_DATA += arm_cortex_a8_b_cond.stdout arm_cortex_a8_b.stdout \
2145
        arm_cortex_a8_bl.stdout arm_cortex_a8_blx.stdout \
2146
        arm_cortex_a8_local.stdout arm_cortex_a8_local_reloc.stdout
2147
 
2148
arm_cortex_a8_b_cond.stdout: arm_cortex_a8_b_cond
2149
        $(TEST_OBJDUMP) -D -j.text $< > $@
2150
 
2151
arm_cortex_a8_b_cond: arm_cortex_a8_b_cond.o ../ld-new
2152
        ../ld-new -o $@ $<
2153
 
2154
arm_cortex_a8_b_cond.o: arm_cortex_a8_b_cond.s
2155
        $(TEST_AS) -o $@ $<
2156
 
2157
arm_cortex_a8_b.stdout: arm_cortex_a8_b
2158
        $(TEST_OBJDUMP) -D -j.text $< > $@
2159
 
2160
arm_cortex_a8_b: arm_cortex_a8_b.o ../ld-new
2161
        ../ld-new --fix-cortex-a8 -o $@ $<
2162
 
2163
arm_cortex_a8_b.o: arm_cortex_a8_b.s
2164
        $(TEST_AS) -o $@ $<
2165
 
2166
arm_cortex_a8_bl.stdout: arm_cortex_a8_bl
2167
        $(TEST_OBJDUMP) -D -j.text $< > $@
2168
 
2169
arm_cortex_a8_bl: arm_cortex_a8_bl.o ../ld-new
2170
        ../ld-new -o $@ $<
2171
 
2172
arm_cortex_a8_bl.o: arm_cortex_a8_bl.s
2173
        $(TEST_AS) -o $@ $<
2174
 
2175
arm_cortex_a8_blx.stdout: arm_cortex_a8_blx
2176
        $(TEST_OBJDUMP) -D -j.text $< > $@
2177
 
2178
arm_cortex_a8_blx: arm_cortex_a8_blx.o ../ld-new
2179
        ../ld-new -o $@ $<
2180
 
2181
arm_cortex_a8_blx.o: arm_cortex_a8_blx.s
2182
        $(TEST_AS) -o $@ $<
2183
 
2184
arm_cortex_a8_local.stdout: arm_cortex_a8_local
2185
        $(TEST_OBJDUMP) -D -j.text $< > $@
2186
 
2187
arm_cortex_a8_local: arm_cortex_a8_local.o ../ld-new
2188
        ../ld-new -o $@ $<
2189
 
2190
arm_cortex_a8_local.o: arm_cortex_a8_local.s
2191
        $(TEST_AS) -o $@ $<
2192
 
2193
arm_cortex_a8_local_reloc.stdout: arm_cortex_a8_local_reloc
2194
        $(TEST_OBJDUMP) -D -j.text $< > $@
2195
 
2196
arm_cortex_a8_local_reloc: arm_cortex_a8_local_reloc.o ../ld-new
2197
        ../ld-new -o $@ $<
2198
 
2199
arm_cortex_a8_local_reloc.o: arm_cortex_a8_local_reloc.s
2200
        $(TEST_AS) -o $@ $<
2201
 
2202
MOSTLYCLEANFILES += arm_cortex_a8_b_cond arm_cortex_a8_b arm_cortex_a8_bl \
2203
        arm_cortex_a8_blx arm_cortex_a8_local arm_cortex_a8_local_reloc
2204
 
2205
check_SCRIPTS += arm_exidx_test.sh
2206
check_DATA += arm_exidx_test.stdout
2207
 
2208
arm_exidx_test.stdout: arm_exidx_test.so
2209
        $(TEST_READELF) -S $< > $@
2210
 
2211
arm_exidx_test.so: arm_exidx_test.o ../ld-new
2212
        ../ld-new -shared -o $@ $<
2213
 
2214
arm_exidx_test.o: arm_exidx_test.s
2215
        $(TEST_AS) -o $@ $<
2216
 
2217
check_SCRIPTS += pr12826.sh
2218
check_DATA += pr12826.stdout
2219
 
2220
pr12826.stdout: pr12826.so
2221
        $(TEST_READELF) -A $< > $@
2222
 
2223
pr12826.so: pr12826_1.o pr12826_2.o ../ld-new
2224
        ../ld-new -shared -o $@ $<
2225
 
2226
pr12826_1.o: pr12826_1.s
2227
        $(TEST_AS) -o $@ $<
2228
 
2229
pr12826_2.o: pr12826_2.s
2230
        $(TEST_AS) -o $@ $<
2231
 
2232
endif DEFAULT_TARGET_ARM
2233
 
2234
endif NATIVE_OR_CROSS_LINKER
2235
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.