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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [binutils-2.20.1/] [gold/] [testsuite/] [Makefile.am] - Blame information for rev 438

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

Line No. Rev Author Line
1 205 julius
# 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
check_PROGRAMS += object_unittest
74
object_unittest_SOURCES = object_unittest.cc
75
 
76
check_PROGRAMS += binary_unittest
77
binary_unittest_SOURCES = binary_unittest.cc
78
 
79
 
80
# ---------------------------------------------------------------------
81
# These tests test the output of gold (end-to-end tests).  In
82
# particular, they make sure that gold can link "difficult" object
83
# files, and the resulting object files run correctly.  These can only
84
# run if we've built ld-new for the native architecture (that is,
85
# we're not cross-compiling it), since we run ld-new as part of these
86
# tests.  We use the gcc-specific flag '-B' to use our linker instead
87
# of the default linker, which is why we only run our tests under gcc.
88
 
89
if NATIVE_LINKER
90
if GCC
91
 
92
# Infrastucture needed for the unittests: a directory where the linker
93
# is named 'ld'.  This is because the -B flag appends 'ld' to its arg.
94
gcctestdir/ld: ../ld-new
95
        test -d gcctestdir || mkdir -p gcctestdir
96
        rm -f gcctestdir/ld
97
        (cd gcctestdir && $(LN_S) ../../ld-new ld)
98
 
99
# Each of these .o's is a useful, small complete program.  They're
100
# particularly useful for making sure ld-new's flags do what they're
101
# supposed to (hence their names), but are used for many tests that
102
# don't actually involve analyzing input data.
103
flagstest_debug.o: constructor_test.cc
104
        $(CXXCOMPILE) -O0 -g -c -o $@ $<
105
flagstest_ndebug.o: constructor_test.cc
106
        $(CXXCOMPILE) -O0 -c -o $@ $<
107
 
108
 
109
check_SCRIPTS += gc_comdat_test.sh
110
check_DATA += gc_comdat_test.stdout
111
MOSTLYCLEANFILES += gc_comdat_test
112
gc_comdat_test_1.o: gc_comdat_test_1.cc
113
        $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
114
gc_comdat_test_2.o: gc_comdat_test_2.cc
115
        $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
116
gc_comdat_test: gc_comdat_test_1.o gc_comdat_test_2.o gcctestdir/ld
117
        $(CXXLINK) -Bgcctestdir/ -Wl,--gc-sections gc_comdat_test_1.o gc_comdat_test_2.o
118
gc_comdat_test.stdout: gc_comdat_test
119
        $(TEST_NM) -C gc_comdat_test > gc_comdat_test.stdout
120
 
121
check_SCRIPTS += gc_tls_test.sh
122
check_DATA += gc_tls_test.stdout
123
MOSTLYCLEANFILES += gc_tls_test
124
gc_tls_test.o: gc_tls_test.cc
125
        $(CXXCOMPILE) -O0 -c -g -o $@ $<
126
gc_tls_test:gc_tls_test.o gcctestdir/ld
127
        $(CXXLINK) -Bgcctestdir/ -Wl,--gc-sections gc_tls_test.o
128
gc_tls_test.stdout: gc_tls_test
129
        $(TEST_NM) -C gc_tls_test > gc_tls_test.stdout
130
 
131
check_SCRIPTS += icf_test.sh
132
check_DATA += icf_test.stdout
133
MOSTLYCLEANFILES += icf_test
134
icf_test.o: icf_test.cc
135
        $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
136
icf_test: icf_test.o gcctestdir/ld
137
        $(CXXLINK) -Bgcctestdir/ -Wl,--icf=all icf_test.o
138
icf_test.stdout: icf_test
139
        $(TEST_NM) -C icf_test > icf_test.stdout
140
 
141
check_SCRIPTS += icf_keep_unique_test.sh
142
check_DATA += icf_keep_unique_test.stdout
143
MOSTLYCLEANFILES += icf_keep_unique_test
144
icf_keep_unique_test.o: icf_keep_unique_test.cc
145
        $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
146
icf_keep_unique_test: icf_keep_unique_test.o gcctestdir/ld
147
        $(CXXLINK) -Bgcctestdir/ -Wl,--icf=all -Wl,--keep-unique,_Z11unique_funcv icf_keep_unique_test.o
148
icf_keep_unique_test.stdout: icf_keep_unique_test
149
        $(TEST_NM) -C icf_keep_unique_test > icf_keep_unique_test.stdout
150
 
151
check_SCRIPTS += icf_safe_test.sh
152
check_DATA += icf_safe_test.stdout
153
MOSTLYCLEANFILES += icf_safe_test
154
icf_safe_test.o: icf_safe_test.cc
155
        $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
156
icf_safe_test: icf_safe_test.o gcctestdir/ld
157
        $(CXXLINK) -Bgcctestdir/ -Wl,--icf=safe icf_safe_test.o
158
icf_safe_test.stdout: icf_safe_test
159
        $(TEST_NM) icf_safe_test > icf_safe_test.stdout
160
 
161
check_PROGRAMS += basic_test
162
check_PROGRAMS += basic_static_test
163
check_PROGRAMS += basic_pic_test
164
check_PROGRAMS += basic_static_pic_test
165
basic_test.o: basic_test.cc
166
        $(CXXCOMPILE) -O0 -c -o $@ $<
167
basic_test: basic_test.o gcctestdir/ld
168
        $(CXXLINK) -Bgcctestdir/ basic_test.o
169
basic_static_test: basic_test.o gcctestdir/ld
170
        $(CXXLINK) -Bgcctestdir/ -static basic_test.o
171
 
172
basic_pic_test.o: basic_test.cc
173
        $(CXXCOMPILE) -O0 -c -fpic -o $@ $<
174
basic_pic_test: basic_pic_test.o gcctestdir/ld
175
        $(CXXLINK) -Bgcctestdir/ basic_pic_test.o
176
basic_static_pic_test: basic_pic_test.o gcctestdir/ld
177
        $(CXXLINK) -Bgcctestdir/ -static basic_pic_test.o
178
 
179
check_PROGRAMS += basic_pie_test
180
basic_pie_test.o: basic_test.cc
181
        $(CXXCOMPILE) -O0 -c -fpie -o $@ $<
182
basic_pie_test: basic_pie_test.o gcctestdir/ld
183
        $(CXXLINK) -Bgcctestdir/ -pie basic_pie_test.o
184
 
185
check_PROGRAMS += constructor_test
186
check_PROGRAMS += constructor_static_test
187
constructor_test_SOURCES = constructor_test.cc
188
constructor_test_DEPENDENCIES = gcctestdir/ld
189
constructor_test_LDFLAGS = -Bgcctestdir/
190
 
191
constructor_static_test_SOURCES = $(constructor_test_SOURCES)
192
constructor_static_test_DEPENDENCIES = $(constructor_test_DEPENDENCIES)
193
constructor_static_test_LDFLAGS = $(constructor_test_LDFLAGS) -static
194
 
195
 
196
check_PROGRAMS += two_file_test
197
check_PROGRAMS += two_file_static_test
198
check_PROGRAMS += two_file_pic_test
199
two_file_test_SOURCES = \
200
        two_file_test_1.cc \
201
        two_file_test_1b.cc \
202
        two_file_test_2.cc \
203
        two_file_test_main.cc \
204
        two_file_test.h
205
two_file_test_DEPENDENCIES = gcctestdir/ld
206
two_file_test_LDFLAGS = -Bgcctestdir/
207
 
208
two_file_static_test_SOURCES = $(two_file_test_SOURCES)
209
two_file_static_test_DEPENDENCIES = $(two_file_test_DEPENDENCIES)
210
two_file_static_test_LDFLAGS = $(two_file_test_LDFLAGS) -static
211
 
212
two_file_pic_test_SOURCES = two_file_test_main.cc
213
two_file_pic_test_DEPENDENCIES = \
214
        gcctestdir/ld two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o
215
two_file_pic_test_LDFLAGS = -Bgcctestdir/
216
two_file_pic_test_LDADD = two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o
217
 
218
 
219
check_PROGRAMS += two_file_shared_1_test
220
check_PROGRAMS += two_file_shared_2_test
221
check_PROGRAMS += two_file_shared_1_pic_2_test
222
check_PROGRAMS += two_file_shared_2_pic_1_test
223
check_PROGRAMS += two_file_same_shared_test
224
check_PROGRAMS += two_file_separate_shared_12_test
225
check_PROGRAMS += two_file_separate_shared_21_test
226
two_file_test_1_pic.o: two_file_test_1.cc
227
        $(CXXCOMPILE) -c -fpic -o $@ $<
228
two_file_test_1b_pic.o: two_file_test_1b.cc
229
        $(CXXCOMPILE) -c -fpic -o $@ $<
230
two_file_test_2_pic.o: two_file_test_2.cc
231
        $(CXXCOMPILE) -c -fpic -o $@ $<
232
two_file_shared_1.so: two_file_test_1_pic.o two_file_test_1b_pic.o gcctestdir/ld
233
        $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1_pic.o two_file_test_1b_pic.o
234
two_file_shared_2.so: two_file_test_2_pic.o gcctestdir/ld
235
        $(CXXLINK) -Bgcctestdir/ -shared two_file_test_2_pic.o
236
two_file_shared.so: two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o gcctestdir/ld
237
        $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o
238
 
239
two_file_shared_1_test_SOURCES = two_file_test_2.cc two_file_test_main.cc
240
two_file_shared_1_test_DEPENDENCIES = gcctestdir/ld two_file_shared_1.so
241
two_file_shared_1_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
242
two_file_shared_1_test_LDADD = two_file_shared_1.so
243
 
244
two_file_shared_2_test_SOURCES = two_file_test_1.cc two_file_test_1b.cc two_file_test_main.cc
245
two_file_shared_2_test_DEPENDENCIES = gcctestdir/ld two_file_shared_2.so
246
two_file_shared_2_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
247
two_file_shared_2_test_LDADD = two_file_shared_2.so
248
 
249
two_file_shared_1_pic_2_test_SOURCES = two_file_test_main.cc
250
two_file_shared_1_pic_2_test_DEPENDENCIES = \
251
        gcctestdir/ld two_file_shared_1.so two_file_test_1_pic.o two_file_test_1b_pic.o
252
two_file_shared_1_pic_2_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
253
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
254
 
255
two_file_shared_2_pic_1_test_SOURCES = two_file_test_main.cc
256
two_file_shared_2_pic_1_test_DEPENDENCIES = \
257
        gcctestdir/ld two_file_shared_2.so two_file_test_2_pic.o
258
two_file_shared_2_pic_1_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
259
two_file_shared_2_pic_1_test_LDADD = two_file_test_2_pic.o two_file_shared_1.so
260
 
261
two_file_same_shared_test_SOURCES = two_file_test_main.cc
262
two_file_same_shared_test_DEPENDENCIES = gcctestdir/ld two_file_shared.so
263
two_file_same_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
264
two_file_same_shared_test_LDADD = two_file_shared.so
265
 
266
two_file_separate_shared_12_test_SOURCES = two_file_test_main.cc
267
two_file_separate_shared_12_test_DEPENDENCIES = \
268
        gcctestdir/ld two_file_shared_1.so two_file_shared_2.so
269
two_file_separate_shared_12_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
270
two_file_separate_shared_12_test_LDADD = \
271
        two_file_shared_1.so two_file_shared_2.so
272
 
273
two_file_separate_shared_21_test_SOURCES = two_file_test_main.cc
274
two_file_separate_shared_21_test_DEPENDENCIES = \
275
        gcctestdir/ld two_file_shared_1.so two_file_shared_2.so
276
two_file_separate_shared_21_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
277
two_file_separate_shared_21_test_LDADD = \
278
        two_file_shared_2.so two_file_shared_1.so
279
 
280
check_PROGRAMS += two_file_relocatable_test
281
two_file_relocatable_test_SOURCES = two_file_test_main.cc
282
two_file_relocatable_test_DEPENDENCIES = \
283
        gcctestdir/ld two_file_relocatable.o
284
two_file_relocatable_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
285
two_file_relocatable_test_LDADD = two_file_relocatable.o
286
two_file_relocatable.o: gcctestdir/ld two_file_test_1.o two_file_test_1b.o two_file_test_2.o
287
        gcctestdir/ld -r -o $@ two_file_test_1.o two_file_test_1b.o two_file_test_2.o
288
 
289
check_PROGRAMS += two_file_pie_test
290
two_file_test_1_pie.o: two_file_test_1.cc
291
        $(CXXCOMPILE) -c -fpie -o $@ $<
292
two_file_test_1b_pie.o: two_file_test_1b.cc
293
        $(CXXCOMPILE) -c -fpie -o $@ $<
294
two_file_test_2_pie.o: two_file_test_2.cc
295
        $(CXXCOMPILE) -c -fpie -o $@ $<
296
two_file_test_main_pie.o: two_file_test_main.cc
297
        $(CXXCOMPILE) -c -fpie -o $@ $<
298
two_file_pie_test: two_file_test_1_pie.o two_file_test_1b_pie.o \
299
                two_file_test_2_pie.o two_file_test_main_pie.o gcctestdir/ld
300
        $(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
301
 
302
check_SCRIPTS += two_file_shared.sh
303
check_DATA += two_file_shared.dbg
304
MOSTLYCLEANFILES += two_file_shared.dbg
305
two_file_shared.dbg: two_file_shared.so
306
        $(TEST_READELF) -w $< >$@ 2>/dev/null
307
 
308
# The nonpic tests will fail on platforms which can not put non-PIC
309
# code into shared libraries, so we just don't run them in that case.
310
if FN_PTRS_IN_SO_WITHOUT_PIC
311
 
312
check_PROGRAMS += two_file_shared_1_nonpic_test
313
check_PROGRAMS += two_file_shared_2_nonpic_test
314
check_PROGRAMS += two_file_same_shared_nonpic_test
315
check_PROGRAMS += two_file_separate_shared_12_nonpic_test
316
check_PROGRAMS += two_file_separate_shared_21_nonpic_test
317
check_PROGRAMS += two_file_mixed_shared_test
318
check_PROGRAMS += two_file_mixed_2_shared_test
319
two_file_shared_1_nonpic.so: two_file_test_1.o gcctestdir/ld
320
        $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1.o two_file_test_1b.o
321
two_file_shared_2_nonpic.so: two_file_test_2.o gcctestdir/ld
322
        $(CXXLINK) -Bgcctestdir/ -shared two_file_test_2.o
323
two_file_shared_nonpic.so: two_file_test_1.o two_file_test_1b.o two_file_test_2.o gcctestdir/ld
324
        $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1.o two_file_test_1b.o two_file_test_2.o
325
two_file_shared_mixed.so: two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2.o gcctestdir/ld
326
        $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2.o
327
two_file_shared_mixed_1.so: two_file_test_1.o two_file_test_1b_pic.o two_file_shared_2.so gcctestdir/ld
328
        $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1.o two_file_test_1b_pic.o two_file_shared_2.so
329
 
330
two_file_shared_1_nonpic_test_SOURCES = \
331
        two_file_test_2.cc two_file_test_main.cc
332
two_file_shared_1_nonpic_test_DEPENDENCIES = \
333
        gcctestdir/ld two_file_shared_1_nonpic.so
334
two_file_shared_1_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
335
two_file_shared_1_nonpic_test_LDADD = two_file_shared_1_nonpic.so
336
 
337
two_file_shared_2_nonpic_test_SOURCES = \
338
        two_file_test_1.cc two_file_test_1b.cc two_file_test_main.cc
339
two_file_shared_2_nonpic_test_DEPENDENCIES = \
340
        gcctestdir/ld two_file_shared_2_nonpic.so
341
two_file_shared_2_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
342
two_file_shared_2_nonpic_test_LDADD = two_file_shared_2_nonpic.so
343
 
344
two_file_same_shared_nonpic_test_SOURCES = two_file_test_main.cc
345
two_file_same_shared_nonpic_test_DEPENDENCIES = \
346
        gcctestdir/ld two_file_shared_nonpic.so
347
two_file_same_shared_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
348
two_file_same_shared_nonpic_test_LDADD = two_file_shared_nonpic.so
349
 
350
two_file_separate_shared_12_nonpic_test_SOURCES = two_file_test_main.cc
351
two_file_separate_shared_12_nonpic_test_DEPENDENCIES = \
352
        gcctestdir/ld two_file_shared_1_nonpic.so two_file_shared_2_nonpic.so
353
two_file_separate_shared_12_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
354
two_file_separate_shared_12_nonpic_test_LDADD = \
355
        two_file_shared_1_nonpic.so two_file_shared_2_nonpic.so
356
 
357
two_file_separate_shared_21_nonpic_test_SOURCES = two_file_test_main.cc
358
two_file_separate_shared_21_nonpic_test_DEPENDENCIES = \
359
        gcctestdir/ld two_file_shared_1_nonpic.so two_file_shared_2_nonpic.so
360
two_file_separate_shared_21_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
361
two_file_separate_shared_21_nonpic_test_LDADD = \
362
        two_file_shared_2_nonpic.so two_file_shared_1_nonpic.so
363
 
364
two_file_mixed_shared_test_SOURCES = two_file_test_main.cc
365
two_file_mixed_shared_test_DEPENDENCIES = gcctestdir/ld two_file_shared_mixed.so
366
two_file_mixed_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
367
two_file_mixed_shared_test_LDADD = two_file_shared_mixed.so
368
 
369
two_file_mixed_2_shared_test_SOURCES = two_file_test_main.cc
370
two_file_mixed_2_shared_test_DEPENDENCIES = gcctestdir/ld two_file_shared_mixed_1.so two_file_shared_2.so
371
two_file_mixed_2_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
372
two_file_mixed_2_shared_test_LDADD = two_file_shared_mixed_1.so two_file_shared_2.so
373
 
374
endif FN_PTRS_IN_SO_WITHOUT_PIC
375
 
376
check_PROGRAMS += two_file_strip_test
377
two_file_strip_test: two_file_test
378
        $(TEST_STRIP) -o two_file_strip_test two_file_test
379
 
380
check_PROGRAMS += two_file_same_shared_strip_test
381
two_file_same_shared_strip_test_SOURCES = two_file_test_main.cc
382
two_file_same_shared_strip_test_DEPENDENCIES = \
383
        gcctestdir/ld two_file_shared_strip.so
384
two_file_same_shared_strip_test_LDFLAGS = -Bgcctestdir/ -Wl,-R.
385
two_file_same_shared_strip_test_LDADD = two_file_shared_strip.so
386
two_file_shared_strip.so: two_file_shared.so
387
        $(TEST_STRIP) -S -o two_file_shared_strip.so two_file_shared.so
388
 
389
check_PROGRAMS += common_test_1
390
common_test_1_SOURCES = common_test_1.c
391
common_test_1_DEPENDENCIES = gcctestdir/ld
392
common_test_1_LDFLAGS = -Bgcctestdir/
393
 
394
check_PROGRAMS += exception_test
395
check_PROGRAMS += exception_static_test
396
check_PROGRAMS += exception_shared_1_test
397
check_PROGRAMS += exception_shared_2_test
398
check_PROGRAMS += exception_same_shared_test
399
check_PROGRAMS += exception_separate_shared_12_test
400
check_PROGRAMS += exception_separate_shared_21_test
401
exception_test_1_pic.o: exception_test_1.cc
402
        $(CXXCOMPILE) -c -fpic -o $@ $<
403
exception_test_2_pic.o: exception_test_2.cc
404
        $(CXXCOMPILE) -c -fpic -o $@ $<
405
exception_shared_1.so: exception_test_1_pic.o gcctestdir/ld
406
        $(CXXLINK) -Bgcctestdir/ -shared exception_test_1_pic.o
407
exception_shared_2.so: exception_test_2_pic.o gcctestdir/ld
408
        $(CXXLINK) -Bgcctestdir/ -shared exception_test_2_pic.o
409
exception_shared.so: exception_test_1_pic.o exception_test_2_pic.o gcctestdir/ld
410
        $(CXXLINK) -Bgcctestdir/ -shared exception_test_1_pic.o exception_test_2_pic.o
411
 
412
exception_test_SOURCES = \
413
        exception_test_main.cc \
414
        exception_test_1.cc \
415
        exception_test_2.cc \
416
        exception_test.h
417
exception_test_DEPENDENCIES = gcctestdir/ld
418
exception_test_LDFLAGS = -Bgcctestdir/
419
 
420
exception_static_test_SOURCES = $(exception_test_SOURCES)
421
exception_static_test_DEPENDENCIES = $(exception_test_DEPENDENCIES)
422
exception_static_test_LDFLAGS = $(exception_test_LDFLAGS) -static
423
 
424
exception_shared_1_test_SOURCES = exception_test_2.cc exception_test_main.cc
425
exception_shared_1_test_DEPENDENCIES = gcctestdir/ld exception_shared_1.so
426
exception_shared_1_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
427
exception_shared_1_test_LDADD = exception_shared_1.so
428
 
429
exception_shared_2_test_SOURCES = exception_test_1.cc exception_test_main.cc
430
exception_shared_2_test_DEPENDENCIES = gcctestdir/ld exception_shared_2.so
431
exception_shared_2_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
432
exception_shared_2_test_LDADD = exception_shared_2.so
433
 
434
exception_same_shared_test_SOURCES = exception_test_main.cc
435
exception_same_shared_test_DEPENDENCIES = gcctestdir/ld exception_shared.so
436
exception_same_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
437
exception_same_shared_test_LDADD = exception_shared.so
438
 
439
exception_separate_shared_12_test_SOURCES = exception_test_main.cc
440
exception_separate_shared_12_test_DEPENDENCIES = \
441
        gcctestdir/ld exception_shared_1.so exception_shared_2.so
442
exception_separate_shared_12_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
443
exception_separate_shared_12_test_LDADD = \
444
        exception_shared_1.so exception_shared_2.so
445
 
446
exception_separate_shared_21_test_SOURCES = exception_test_main.cc
447
exception_separate_shared_21_test_DEPENDENCIES = \
448
        gcctestdir/ld exception_shared_1.so exception_shared_2.so
449
exception_separate_shared_21_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
450
exception_separate_shared_21_test_LDADD = \
451
        exception_shared_2.so exception_shared_1.so
452
 
453
 
454
check_PROGRAMS += weak_test
455
weak_test_SOURCES = weak_test.cc
456
weak_test_DEPENDENCIES = gcctestdir/ld
457
weak_test_LDFLAGS = -Bgcctestdir/
458
 
459
check_PROGRAMS += weak_undef_test
460
MOSTLYCLEANFILES += alt/weak_undef_lib.so
461
weak_undef_test_SOURCES = weak_undef_test.cc
462
weak_undef_test_DEPENDENCIES = gcctestdir/ld weak_undef_lib.so alt/weak_undef_lib.so
463
weak_undef_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,alt
464
weak_undef_test_LDADD = -L . weak_undef_lib.so
465
weak_undef_file1.o: weak_undef_file1.cc
466
        $(CXXCOMPILE) -c -fpic -o $@ $<
467
weak_undef_file2.o: weak_undef_file2.cc
468
        $(CXXCOMPILE) -c -fpic -o $@ $<
469
weak_undef_lib.so: weak_undef_file1.o
470
        $(CXXLINK) -Bgcctestdir/ -shared weak_undef_file1.o
471
alt/weak_undef_lib.so: weak_undef_file2.o
472
        test -d alt || mkdir -p alt
473
        $(CXXLINK) -Bgcctestdir/ -shared weak_undef_file2.o
474
 
475
if FN_PTRS_IN_SO_WITHOUT_PIC
476
check_PROGRAMS += weak_undef_nonpic_test
477
MOSTLYCLEANFILES += alt/weak_undef_lib_nonpic.so
478
weak_undef_nonpic_test_SOURCES = weak_undef_test.cc
479
weak_undef_nonpic_test_DEPENDENCIES = gcctestdir/ld weak_undef_lib_nonpic.so alt/weak_undef_lib_nonpic.so
480
weak_undef_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,alt
481
weak_undef_nonpic_test_LDADD = -L . weak_undef_lib_nonpic.so
482
weak_undef_file1_nonpic.o: weak_undef_file1.cc
483
        $(CXXCOMPILE) -c -o $@ $<
484
weak_undef_file2_nonpic.o: weak_undef_file2.cc
485
        $(CXXCOMPILE) -c -o $@ $<
486
weak_undef_lib_nonpic.so: weak_undef_file1_nonpic.o
487
        $(CXXLINK) -Bgcctestdir/ -shared weak_undef_file1_nonpic.o
488
alt/weak_undef_lib_nonpic.so: weak_undef_file2_nonpic.o
489
        test -d alt || mkdir -p alt
490
        $(CXXLINK) -Bgcctestdir/ -shared weak_undef_file2_nonpic.o
491
endif FN_PTRS_IN_SO_WITHOUT_PIC
492
 
493
 
494
check_PROGRAMS += weak_alias_test
495
weak_alias_test_SOURCES = weak_alias_test_main.cc
496
weak_alias_test_DEPENDENCIES = \
497
        gcctestdir/ld weak_alias_test_1.so weak_alias_test_2.so \
498
        weak_alias_test_3.o weak_alias_test_4.so
499
weak_alias_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
500
weak_alias_test_LDADD = \
501
        weak_alias_test_1.so weak_alias_test_2.so weak_alias_test_3.o \
502
        weak_alias_test_4.so
503
weak_alias_test_1_pic.o: weak_alias_test_1.cc
504
        $(CXXCOMPILE) -c -fpic -o $@ $<
505
weak_alias_test_1.so: weak_alias_test_1_pic.o gcctestdir/ld
506
        $(CXXLINK) -Bgcctestdir/ -shared weak_alias_test_1_pic.o
507
weak_alias_test_2_pic.o: weak_alias_test_2.cc
508
        $(CXXCOMPILE) -c -fpic -o $@ $<
509
weak_alias_test_2.so: weak_alias_test_2_pic.o gcctestdir/ld
510
        $(CXXLINK) -Bgcctestdir/ -shared weak_alias_test_2_pic.o
511
weak_alias_test_3.o: weak_alias_test_3.cc
512
        $(CXXCOMPILE) -c -o $@ $<
513
weak_alias_test_4_pic.o: weak_alias_test_4.cc
514
        $(CXXCOMPILE) -c -fpic -o $@ $<
515
weak_alias_test_4.so: weak_alias_test_4_pic.o gcctestdir/ld
516
        $(CXXLINK) -Bgcctestdir/ -shared weak_alias_test_4_pic.o
517
 
518
check_SCRIPTS += weak_plt.sh
519
check_PROGRAMS += weak_plt
520
check_DATA += weak_plt_shared.so
521
weak_plt_main_pic.o: weak_plt_main.cc
522
        $(CXXCOMPILE) -c -fpic -o $@ $<
523
weak_plt: weak_plt_main_pic.o gcctestdir/ld
524
        $(CXXLINK) -Bgcctestdir/ weak_plt_main_pic.o
525
weak_plt_shared_pic.o: weak_plt_shared.cc
526
        $(CXXCOMPILE) -c -fpic -o $@ $<
527
weak_plt_shared.so: weak_plt_shared_pic.o gcctestdir/ld
528
        $(CXXLINK) -Bgcctestdir/ -shared weak_plt_shared_pic.o
529
 
530
check_PROGRAMS += copy_test
531
copy_test_SOURCES = copy_test.cc
532
copy_test_DEPENDENCIES = gcctestdir/ld copy_test_1.so copy_test_2.so
533
copy_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
534
copy_test_LDADD = copy_test_1.so copy_test_2.so
535
copy_test_1_pic.o: copy_test_1.cc
536
        $(CXXCOMPILE) -c -fpic -o $@ $<
537
copy_test_1.so: gcctestdir/ld copy_test_1_pic.o
538
        $(CXXLINK) -Bgcctestdir/ -shared copy_test_1_pic.o
539
copy_test_2_pic.o: copy_test_2.cc
540
        $(CXXCOMPILE) -c -fpic -o $@ $<
541
copy_test_2.so: gcctestdir/ld copy_test_2_pic.o
542
        $(CXXLINK) -Bgcctestdir/ -shared copy_test_2_pic.o
543
 
544
if TLS
545
 
546
check_PROGRAMS += tls_test
547
check_PROGRAMS += tls_pic_test
548
check_PROGRAMS += tls_shared_test
549
check_PROGRAMS += tls_shared_ie_test
550
check_PROGRAMS += tls_shared_gd_to_ie_test
551
tls_test_pic.o: tls_test.cc
552
        $(CXXCOMPILE) -c -fpic -o $@ $<
553
tls_test_file2_pic.o: tls_test_file2.cc
554
        $(CXXCOMPILE) -c -fpic -o $@ $<
555
tls_test_c_pic.o: tls_test_c.c
556
        $(COMPILE) -c -fpic $(TLS_TEST_C_CFLAGS) -o $@ $<
557
tls_test_shared.so: tls_test_pic.o tls_test_file2_pic.o tls_test_c_pic.o gcctestdir/ld
558
        $(CXXLINK) -Bgcctestdir/ -shared tls_test_pic.o tls_test_file2_pic.o tls_test_c_pic.o -Wl,-z,defs
559
tls_test_shared2.so: tls_test_file2_pic.o gcctestdir/ld
560
        $(CXXLINK) -Bgcctestdir/ -shared tls_test_file2_pic.o
561
 
562
tls_test_pic_ie.o: tls_test.cc
563
        $(CXXCOMPILE) -c -fpic -ftls-model=initial-exec -o $@ $<
564
tls_test_file2_pic_ie.o: tls_test_file2.cc
565
        $(CXXCOMPILE) -c -fpic -ftls-model=initial-exec -o $@ $<
566
tls_test_c_pic_ie.o: tls_test_c.c
567
        $(COMPILE) -c -fpic -ftls-model=initial-exec $(TLS_TEST_C_CFLAGS) -o $@ $<
568
tls_test_ie_shared.so: tls_test_pic_ie.o tls_test_file2_pic_ie.o tls_test_c_pic_ie.o gcctestdir/ld
569
        $(CXXLINK) -Bgcctestdir/ -shared tls_test_pic_ie.o tls_test_file2_pic_ie.o tls_test_c_pic_ie.o
570
 
571
tls_test_SOURCES = tls_test.cc tls_test_file2.cc tls_test_main.cc tls_test.h
572
tls_test_DEPENDENCIES = gcctestdir/ld tls_test_c.o
573
tls_test_LDFLAGS = -Bgcctestdir/
574
tls_test_LDADD = tls_test_c.o -lpthread
575
tls_test_c.o: tls_test_c.c
576
        $(COMPILE) -c $(TLS_TEST_C_CFLAGS) -o $@ $<
577
 
578
tls_pic_test_SOURCES = tls_test_main.cc
579
tls_pic_test_DEPENDENCIES = gcctestdir/ld tls_test_pic.o tls_test_file2_pic.o \
580
        tls_test_c_pic.o
581
tls_pic_test_LDFLAGS = -Bgcctestdir/
582
tls_pic_test_LDADD = tls_test_pic.o tls_test_file2_pic.o tls_test_c_pic.o \
583
        -lpthread
584
 
585
tls_shared_test_SOURCES = tls_test_main.cc
586
tls_shared_test_DEPENDENCIES = gcctestdir/ld tls_test_shared.so
587
tls_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
588
tls_shared_test_LDADD = tls_test_shared.so -lpthread
589
 
590
tls_shared_ie_test_SOURCES = tls_test_main.cc
591
tls_shared_ie_test_DEPENDENCIES = gcctestdir/ld tls_test_ie_shared.so
592
tls_shared_ie_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
593
tls_shared_ie_test_LDADD = tls_test_ie_shared.so -lpthread
594
 
595
tls_shared_gd_to_ie_test_SOURCES = tls_test_main.cc
596
tls_shared_gd_to_ie_test_DEPENDENCIES = gcctestdir/ld tls_test_pic.o \
597
        tls_test_c_pic.o tls_test_shared2.so
598
tls_shared_gd_to_ie_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
599
tls_shared_gd_to_ie_test_LDADD = tls_test_pic.o tls_test_c_pic.o \
600
        tls_test_shared2.so -lpthread
601
 
602
if TLS_GNU2_DIALECT
603
 
604
check_PROGRAMS += tls_shared_gnu2_gd_to_ie_test
605
 
606
tls_test_gnu2.o: tls_test.cc
607
        $(CXXCOMPILE) -c -fpic -mtls-dialect=gnu2 -o $@ $<
608
tls_test_file2_gnu2.o: tls_test_file2.cc
609
        $(CXXCOMPILE) -c -fpic -mtls-dialect=gnu2 -o $@ $<
610
tls_test_c_gnu2.o: tls_test_c.c
611
        $(COMPILE) -c -fpic -mtls-dialect=gnu2 $(TLS_TEST_C_CFLAGS) -o $@ $<
612
tls_test_gnu2_shared2.so: tls_test_file2_gnu2.o gcctestdir/ld
613
        $(CXXLINK) -Bgcctestdir/ -shared tls_test_file2_gnu2.o
614
 
615
tls_shared_gnu2_gd_to_ie_test_SOURCES = tls_test_main.cc
616
tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES = gcctestdir/ld tls_test_gnu2.o \
617
        tls_test_c_gnu2.o tls_test_gnu2_shared2.so
618
tls_shared_gnu2_gd_to_ie_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
619
tls_shared_gnu2_gd_to_ie_test_LDADD = tls_test_gnu2.o tls_test_c_gnu2.o \
620
        tls_test_gnu2_shared2.so -lpthread
621
 
622
if TLS_DESCRIPTORS
623
 
624
check_PROGRAMS += tls_shared_gnu2_test
625
 
626
tls_test_gnu2_shared.so: tls_test_gnu2.o tls_test_file2_gnu2.o tls_test_c_gnu2.o gcctestdir/ld
627
        $(CXXLINK) -Bgcctestdir/ -shared tls_test_gnu2.o tls_test_file2_gnu2.o tls_test_c_gnu2.o
628
 
629
tls_shared_gnu2_test_SOURCES = tls_test_main.cc
630
tls_shared_gnu2_test_DEPENDENCIES = gcctestdir/ld tls_test_gnu2_shared.so
631
tls_shared_gnu2_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
632
tls_shared_gnu2_test_LDADD = tls_test_gnu2_shared.so -lpthread
633
 
634
endif TLS_DESCRIPTORS
635
 
636
endif TLS_GNU2_DIALECT
637
 
638
if STATIC_TLS
639
check_PROGRAMS += tls_static_test
640
check_PROGRAMS += tls_static_pic_test
641
 
642
tls_static_test_SOURCES = $(tls_test_SOURCES)
643
tls_static_test_DEPENDENCIES = $(tls_test_DEPENDENCIES)
644
tls_static_test_LDFLAGS = $(tls_test_LDFLAGS) -static
645
tls_static_test_LDADD = $(tls_test_LDADD)
646
 
647
tls_static_pic_test_SOURCES = $(tls_pic_test_SOURCES)
648
tls_static_pic_test_DEPENDENCIES = $(tls_pic_test_DEPENDENCIES)
649
tls_static_pic_test_LDFLAGS = $(tls_pic_test_LDFLAGS) -static
650
tls_static_pic_test_LDADD = $(tls_pic_test_LDADD)
651
endif
652
 
653
if FN_PTRS_IN_SO_WITHOUT_PIC
654
check_PROGRAMS += tls_shared_nonpic_test
655
tls_test_shared_nonpic.so: tls_test.o tls_test_file2.o tls_test_c.o gcctestdir/ld
656
        $(CXXLINK) -Bgcctestdir/ -shared tls_test.o tls_test_file2.o tls_test_c.o
657
 
658
tls_shared_nonpic_test_SOURCES = tls_test_main.cc
659
tls_shared_nonpic_test_DEPENDENCIES = gcctestdir/ld tls_test_shared_nonpic.so
660
tls_shared_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
661
tls_shared_nonpic_test_LDADD = tls_test_shared_nonpic.so -lpthread
662
endif FN_PTRS_IN_SO_WITHOUT_PIC
663
 
664
endif TLS
665
 
666
check_PROGRAMS += many_sections_test
667
many_sections_test_SOURCES = many_sections_test.cc
668
many_sections_test_DEPENDENCIES = gcctestdir/ld
669
many_sections_test_LDFLAGS = -Bgcctestdir/ -rdynamic
670
 
671
BUILT_SOURCES += many_sections_define.h
672
MOSTLYCLEANFILES += many_sections_define.h
673
many_sections_define.h:
674
        (for i in `seq 1 70000`; do \
675
           echo "int var_$$i __attribute__((section(\"section_$$i\"))) = $$i;"; \
676
         done) > $@.tmp
677
        mv -f $@.tmp $@
678
 
679
BUILT_SOURCES += many_sections_check.h
680
MOSTLYCLEANFILES += many_sections_check.h
681
many_sections_check.h:
682
        (for i in `seq 1 1000 70000`; do \
683
           echo "assert(var_$$i == $$i);"; \
684
         done) > $@.tmp
685
        mv -f $@.tmp $@
686
 
687
check_PROGRAMS += many_sections_r_test
688
many_sections_r_test.o: many_sections_test.o gcctestdir/ld
689
        gcctestdir/ld -r -o $@ many_sections_test.o
690
many_sections_r_test: many_sections_r_test.o gcctestdir/ld
691
        $(CXXLINK) -Bgcctestdir/ many_sections_r_test.o $(LIBS)
692
 
693
if CONSTRUCTOR_PRIORITY
694
 
695
check_PROGRAMS += initpri1
696
initpri1_SOURCES = initpri1.c
697
initpri1_DEPENDENCIES = gcctestdir/ld
698
initpri1_LDFLAGS = -Bgcctestdir/
699
 
700
endif
701
 
702
 
703
# Test --detect-odr-violations
704
check_SCRIPTS += debug_msg.sh
705
 
706
# Create the data files that debug_msg.sh analyzes.
707
check_DATA += debug_msg.err
708
MOSTLYCLEANFILES += debug_msg.err
709
debug_msg.o: debug_msg.cc
710
        $(CXXCOMPILE) -O0 -g -c -w -o $@ $(srcdir)/debug_msg.cc
711
odr_violation1.o: odr_violation1.cc
712
        $(CXXCOMPILE) -O0 -g -c -w -o $@ $(srcdir)/odr_violation1.cc
713
odr_violation2.o: odr_violation2.cc
714
        $(CXXCOMPILE) -O0 -g -c -w -o $@ $(srcdir)/odr_violation2.cc
715
debug_msg.err: debug_msg.o odr_violation1.o odr_violation2.o gcctestdir/ld
716
        @echo $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg debug_msg.o odr_violation1.o odr_violation2.o "2>$@"
717
        @if $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg debug_msg.o odr_violation1.o odr_violation2.o 2>$@; \
718
        then \
719
          echo 1>&2 "Link of debug_msg should have failed"; \
720
          rm -f $@; \
721
          exit 1; \
722
        fi
723
 
724
# See if we can also detect problems when we're linking .so's, not .o's.
725
check_DATA += debug_msg_so.err
726
MOSTLYCLEANFILES += debug_msg_so.err
727
debug_msg.so: debug_msg.cc gcctestdir/ld
728
        $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -shared -fPIC -w -o $@ $(srcdir)/debug_msg.cc
729
odr_violation1.so: odr_violation1.cc gcctestdir/ld
730
        $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -shared -fPIC -w -o $@ $(srcdir)/odr_violation1.cc
731
odr_violation2.so: odr_violation2.cc gcctestdir/ld
732
        $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -shared -fPIC -w -o $@ $(srcdir)/odr_violation2.cc
733
debug_msg_so.err: debug_msg.so odr_violation1.so odr_violation2.so gcctestdir/ld
734
        @echo $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_so debug_msg.so odr_violation1.so odr_violation2.so "2>$@"
735
        @if $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_so debug_msg.so odr_violation1.so odr_violation2.so 2>$@; \
736
        then \
737
          echo 1>&2 "Link of debug_msg_so should have failed"; \
738
          rm -f $@; \
739
          exit 1; \
740
        fi
741
 
742
# We also want to make sure we do something reasonable when there's no
743
# debug info available.  For the best test, we use .so's.
744
check_DATA += debug_msg_ndebug.err
745
MOSTLYCLEANFILES += debug_msg_ndebug.err
746
debug_msg_ndebug.so: debug_msg.cc gcctestdir/ld
747
        $(CXXCOMPILE) -Bgcctestdir/ -O0 -g0 -shared -fPIC -w -o $@ $(srcdir)/debug_msg.cc
748
odr_violation1_ndebug.so: odr_violation1.cc gcctestdir/ld
749
        $(CXXCOMPILE) -Bgcctestdir/ -O0 -g0 -shared -fPIC -w -o $@ $(srcdir)/odr_violation1.cc
750
odr_violation2_ndebug.so: odr_violation2.cc gcctestdir/ld
751
        $(CXXCOMPILE) -Bgcctestdir/ -O0 -g0 -shared -fPIC -w -o $@ $(srcdir)/odr_violation2.cc
752
debug_msg_ndebug.err: debug_msg_ndebug.so odr_violation1_ndebug.so odr_violation2_ndebug.so gcctestdir/ld
753
        @echo $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_ndebug debug_msg_ndebug.so odr_violation1_ndebug.so odr_violation2_ndebug.so "2>$@"
754
        @if $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_ndebug debug_msg_ndebug.so odr_violation1_ndebug.so odr_violation2_ndebug.so 2>$@; \
755
        then \
756
          echo 1>&2 "Link of debug_msg_ndebug should have failed"; \
757
          rm -f $@; \
758
          exit 1; \
759
        fi
760
 
761
 
762
# Similar to --detect-odr-violations: check for undefined symbols in .so's
763
check_SCRIPTS += undef_symbol.sh
764
check_DATA += undef_symbol.err
765
MOSTLYCLEANFILES += undef_symbol.err
766
undef_symbol.o: undef_symbol.cc
767
        $(CXXCOMPILE) -O0 -g -c -fPIC $<
768
undef_symbol.so: undef_symbol.o gcctestdir/ld
769
        $(CXXLINK) -Bgcctestdir/ -shared undef_symbol.o
770
undef_symbol.err: undef_symbol_main.o undef_symbol.so gcctestdir/ld
771
        @echo $(CXXLINK) -Bgcctestdir/ -o undef_symbol_test undef_symbol_main.o undef_symbol.so "2>$@"
772
        @if $(CXXLINK) -Bgcctestdir/ -o undef_symbol_test undef_symbol_main.o undef_symbol.so 2>$@; \
773
        then \
774
          echo 1>&2 "Link of undef_symbol_test should have failed"; \
775
          rm -f $@; \
776
          exit 1; \
777
        fi
778
 
779
 
780
# Test -o when emitting to a special file (such as something in /dev).
781
check_PROGRAMS += flagstest_o_specialfile
782
flagstest_o_specialfile: flagstest_debug.o gcctestdir/ld
783
        $(CXXLINK) -Bgcctestdir/ -o /dev/stdout $< 2>&1 | cat > $@
784
        chmod a+x $@
785
        test -s $@
786
 
787
if HAVE_ZLIB
788
 
789
# Test --compress-debug-sections.  FIXME: check we actually compress.
790
check_PROGRAMS += flagstest_compress_debug_sections
791
flagstest_compress_debug_sections: flagstest_debug.o gcctestdir/ld
792
        $(CXXLINK) -Bgcctestdir/ -o $@ $< -Wl,--compress-debug-sections=zlib
793
        test -s $@
794
 
795
 
796
# The specialfile output has a tricky case when we also compress debug
797
# sections, because it requires output-file resizing.
798
check_PROGRAMS += flagstest_o_specialfile_and_compress_debug_sections
799
flagstest_o_specialfile_and_compress_debug_sections: flagstest_debug.o \
800
                gcctestdir/ld
801
        $(CXXLINK) -Bgcctestdir/ -o /dev/stdout $< -Wl,--compress-debug-sections=zlib 2>&1 | cat > $@
802
        chmod a+x $@
803
        test -s $@
804
 
805
endif HAVE_ZLIB
806
 
807
# Test symbol versioning.
808
check_PROGRAMS += ver_test
809
ver_test_SOURCES = ver_test_main.cc
810
ver_test_DEPENDENCIES = gcctestdir/ld ver_test_1.so ver_test_2.so ver_test_4.so
811
ver_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
812
ver_test_LDADD = ver_test_1.so ver_test_2.so ver_test_4.so
813
ver_test_1.so: ver_test_1.o ver_test_2.so ver_test_3.o ver_test_4.so gcctestdir/ld
814
        $(CXXLINK) -Bgcctestdir/ -shared ver_test_1.o ver_test_2.so ver_test_3.o ver_test_4.so
815
ver_test_2.so: ver_test_2.o $(srcdir)/ver_test_2.script ver_test_4.so gcctestdir/ld
816
        $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_2.script ver_test_2.o ver_test_4.so
817
ver_test_4.so: ver_test_4.o $(srcdir)/ver_test_4.script gcctestdir/ld
818
        $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_4.script ver_test_4.o
819
ver_test_1.o: ver_test_1.cc
820
        $(CXXCOMPILE) -c -fpic -o $@ $<
821
ver_test_2.o: ver_test_2.cc
822
        $(CXXCOMPILE) -c -fpic -o $@ $<
823
ver_test_3.o: ver_test_3.cc
824
        $(CXXCOMPILE) -c -fpic -o $@ $<
825
ver_test_4.o: ver_test_4.cc
826
        $(CXXCOMPILE) -c -fpic -o $@ $<
827
 
828
check_SCRIPTS += ver_test_1.sh
829
check_DATA += ver_test_1.syms
830
ver_test_1.syms: ver_test_1.so
831
        $(TEST_READELF) -s $< >$@ 2>/dev/null
832
 
833
check_PROGRAMS += ver_test_2
834
ver_test_2_SOURCES = ver_test_main_2.cc
835
ver_test_2_DEPENDENCIES = gcctestdir/ld ver_test_4.so ver_test_2.so
836
ver_test_2_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
837
ver_test_2_LDADD = ver_test_4.so ver_test_2.so
838
 
839
check_SCRIPTS += ver_test_2.sh
840
check_DATA += ver_test_2.syms
841
ver_test_2.syms: ver_test_2
842
        $(TEST_READELF) -s $< >$@ 2>/dev/null
843
 
844
check_SCRIPTS += ver_test_4.sh
845
check_DATA += ver_test_4.syms
846
ver_test_4.syms: ver_test_4.so
847
        $(TEST_READELF) -s $< >$@ 2>/dev/null
848
 
849
ver_test_5.so: ver_test_5.o $(srcdir)/ver_test_5.script ver_test_4.so gcctestdir/ld
850
        $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_5.script ver_test_5.o ver_test_4.so
851
ver_test_5.o: ver_test_5.cc
852
        $(CXXCOMPILE) -c -fpic -o $@ $<
853
check_SCRIPTS += ver_test_5.sh
854
check_DATA += ver_test_5.syms
855
ver_test_5.syms: ver_test_5.so
856
        $(TEST_READELF) -s $< >$@ 2>/dev/null
857
 
858
check_PROGRAMS += ver_test_6
859
ver_test_6_SOURCES = ver_test_6.c
860
ver_test_6_DEPENDENCIES = gcctestdir/ld ver_test_2.so
861
ver_test_6_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
862
ver_test_6_LDADD = ver_test_2.so
863
 
864
ver_test_7.so: ver_test_4.o $(srcdir)/ver_test_4.script ver_test_7.o gcctestdir/ld
865
        $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_4.script ver_test_4.o ver_test_7.o
866
ver_test_7.o: ver_test_7.cc
867
        $(CXXCOMPILE) -c -fpic -o $@ $<
868
check_SCRIPTS += ver_test_7.sh
869
check_DATA += ver_test_7.syms
870
ver_test_7.syms: ver_test_7.so
871
        $(TEST_READELF) -s $< >$@ 2>/dev/null
872
 
873
check_PROGRAMS += ver_test_8
874
ver_test_8_SOURCES = two_file_test_main.cc
875
ver_test_8_DEPENDENCIES = gcctestdir/ld ver_test_8_1.so ver_test_8_2.so
876
ver_test_8_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
877
ver_test_8_LDADD = ver_test_8_1.so ver_test_8_2.so
878
ver_test_8_1.so: two_file_test_1_pic.o two_file_test_1b_pic.o ver_test_8_2.so gcctestdir/ld
879
        $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1_pic.o two_file_test_1b_pic.o ver_test_8_2.so
880
ver_test_8_2.so: two_file_test_2_pic.o $(srcdir)/ver_test_8.script gcctestdir/ld
881
        $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_8.script two_file_test_2_pic.o
882
 
883
check_PROGRAMS += ver_test_9
884
ver_test_9_SOURCES = ver_test_main.cc
885
ver_test_9_DEPENDENCIES = gcctestdir/ld ver_test_9.so
886
ver_test_9_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
887
ver_test_9_LDADD = ver_test_9.so
888
ver_test_9.so: ver_test_9.o ver_test_4.so ver_test_5.so gcctestdir/ld
889
        $(CXXLINK) -Bgcctestdir/ -shared ver_test_9.o ver_test_5.so ver_test_4.so
890
ver_test_9.o: ver_test_9.cc
891
        $(CXXCOMPILE) -c -fpic -o $@ $<
892
 
893
check_SCRIPTS += ver_test_10.sh
894
check_DATA += ver_test_10.syms
895
ver_test_10.syms: ver_test_10.so
896
        $(TEST_READELF) -s $< >$@ 2>/dev/null
897
ver_test_10.so: gcctestdir/ld ver_test_2.o ver_test_10.script
898
        $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_10.script ver_test_2.o
899
 
900
check_PROGRAMS += ver_test_11
901
MOSTLYCLEANFILES += ver_test_11.a
902
ver_test_11_SOURCES = ver_test_main_2.cc
903
ver_test_11_DEPENDENCIES = gcctestdir/ld ver_test_11.a
904
ver_test_11_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
905
ver_test_11_LDADD = ver_test_11.a
906
ver_test_11.a: ver_test_1.o ver_test_2.o ver_test_4.o
907
        $(TEST_AR) rc $@ $^
908
 
909
check_PROGRAMS += protected_1
910
protected_1_SOURCES = \
911
        protected_main_1.cc protected_main_2.cc protected_main_3.cc
912
protected_1_DEPENDENCIES = gcctestdir/ld protected_1.so
913
protected_1_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
914
protected_1_LDADD = protected_1.so
915
 
916
protected_1.so: gcctestdir/ld protected_1_pic.o protected_2_pic.o protected_3_pic.o
917
        $(CXXLINK) -Bgcctestdir/ -shared protected_1_pic.o protected_2_pic.o protected_3_pic.o
918
protected_1_pic.o: protected_1.cc
919
        $(CXXCOMPILE) -c -fpic -o $@ $<
920
protected_2_pic.o: protected_2.cc
921
        $(CXXCOMPILE) -c -fpic -o $@ $<
922
protected_3_pic.o: protected_3.cc
923
        $(CXXCOMPILE) -c -fpic -o $@ $<
924
 
925
check_PROGRAMS += protected_2
926
protected_2_SOURCES = protected_main_1.cc protected_3.cc
927
protected_2_DEPENDENCIES = gcctestdir/ld protected_1.so
928
protected_2_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
929
protected_2_LDADD = protected_1.so
930
 
931
check_PROGRAMS += relro_test
932
relro_test_SOURCES = relro_test_main.cc
933
relro_test_DEPENDENCIES = gcctestdir/ld relro_test.so
934
relro_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
935
relro_test_LDADD = relro_test.so
936
relro_test.so: gcctestdir/ld relro_test_pic.o
937
        $(CXXLINK) -Bgcctestdir/ -shared -Wl,-z,relro relro_test_pic.o
938
relro_test_pic.o: relro_test.cc
939
        $(CXXCOMPILE) -c -fpic -o $@ $<
940
 
941
check_PROGRAMS += relro_script_test
942
relro_script_test_SOURCES = relro_test_main.cc
943
relro_script_test_DEPENDENCIES = gcctestdir/ld relro_script_test.so
944
relro_script_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
945
relro_script_test_LDADD = relro_script_test.so
946
relro_script_test.so: gcctestdir/ld relro_script_test.t relro_test_pic.o
947
        $(CXXLINK) -Bgcctestdir/ -shared -Wl,-z,relro -T $(srcdir)/relro_script_test.t relro_test_pic.o
948
 
949
check_PROGRAMS += script_test_1
950
script_test_1_SOURCES = script_test_1.cc
951
script_test_1_DEPENDENCIES = gcctestdir/ld script_test_1.t
952
script_test_1_LDFLAGS = -Bgcctestdir/ -Wl,-R,. -T $(srcdir)/script_test_1.t
953
 
954
check_PROGRAMS += script_test_2
955
script_test_2_SOURCES = script_test_2.cc script_test_2a.cc script_test_2b.cc
956
script_test_2_DEPENDENCIES = gcctestdir/ld script_test_2.t
957
script_test_2_LDFLAGS = -Bgcctestdir/ -Wl,-R,. -T $(srcdir)/script_test_2.t
958
 
959
check_PROGRAMS += justsyms
960
justsyms_SOURCES = justsyms_1.cc
961
justsyms_DEPENDENCIES = gcctestdir/ld justsyms_2r.o
962
justsyms_LDFLAGS = -Bgcctestdir/ -Wl,-R,justsyms_2r.o
963
justsyms_2.o: justsyms_2.cc
964
        $(CXXCOMPILE) -c -o $@ $<
965
justsyms_2r.o: justsyms_2.o gcctestdir/ld $(srcdir)/justsyms.t
966
        gcctestdir/ld -o $@ -r -T $(srcdir)/justsyms.t justsyms_2.o
967
 
968
check_PROGRAMS += binary_test
969
MOSTLYCLEANFILES += binary.txt
970
binary_test_SOURCES = binary_test.cc
971
binary_test_DEPENDENCIES = gcctestdir/ld binary.txt
972
binary_test_LDFLAGS = -Bgcctestdir/ -Wl,--format,binary,binary.txt,--format,elf
973
# Copy the file to the build directory to avoid worrying about the
974
# full pathname in the generated symbols.
975
binary.txt: $(srcdir)/binary.in
976
        rm -f $@
977
        $(LN_S) $< $@
978
 
979
check_SCRIPTS += ver_matching_test.sh
980
check_DATA += ver_matching_test.stdout
981
MOSTLYCLEANFILES += ver_matching_test.stdout
982
ver_matching_def.so: ver_matching_def.cc gcctestdir/ld
983
        $(CXXLINK) -O0 -Bgcctestdir/ -shared $(srcdir)/ver_matching_def.cc -Wl,--version-script=$(srcdir)/version_script.map
984
ver_matching_test.stdout: ver_matching_def.so
985
        $(TEST_OBJDUMP) -T ver_matching_def.so | $(TEST_CXXFILT) > ver_matching_test.stdout
986
 
987
check_PROGRAMS += script_test_3
988
check_SCRIPTS += script_test_3.sh
989
check_DATA += script_test_3.stdout
990
MOSTLYCLEANFILES += script_test_3.stdout
991
script_test_3: basic_test.o gcctestdir/ld script_test_3.t
992
        $(CXXLINK) -Bgcctestdir/ basic_test.o -T $(srcdir)/script_test_3.t
993
script_test_3.stdout: script_test_3
994
        $(TEST_READELF) -SlW script_test_3 > script_test_3.stdout
995
 
996
check_SCRIPTS += script_test_4.sh
997
check_DATA += script_test_4.stdout
998
MOSTLYCLEANFILES += script_test_4
999
script_test_4: basic_test.o gcctestdir/ld $(srcdir)/script_test_4.t
1000
        $(CXXLINK) -Bgcctestdir/ basic_test.o -T $(srcdir)/script_test_4.t
1001
script_test_4.stdout: script_test_4
1002
        $(TEST_READELF) -SlW script_test_4 > script_test_4.stdout
1003
 
1004
check_SCRIPTS += script_test_5.sh
1005
check_DATA += script_test_5.stdout
1006
MOSTLYCLEANFILES += script_test_5
1007
script_test_5: script_test_5.o gcctestdir/ld $(srcdir)/script_test_5.t
1008
        $(CXXLINK) -Bgcctestdir/ script_test_5.o -T $(srcdir)/script_test_5.t
1009
script_test_5.stdout: script_test_5
1010
        $(TEST_READELF) -SW script_test_5 > script_test_5.stdout
1011
 
1012
# Test --dynamic-list, --dynamic-list-data, --dynamic-list-cpp-new,
1013
# and --dynamic-list-cpp-typeinfo
1014
 
1015
check_SCRIPTS += dynamic_list.sh
1016
check_DATA += dynamic_list.stdout
1017
MOSTLYCLEANFILES += dynamic_list dynamic_list.stdout
1018
dynamic_list: basic_test.o gcctestdir/ld $(srcdir)/dynamic_list.t
1019
        $(CXXLINK) -Bgcctestdir/ basic_test.o \
1020
          -Wl,--dynamic-list $(srcdir)/dynamic_list.t \
1021
          -Wl,--dynamic-list-data \
1022
          -Wl,--dynamic-list-cpp-new \
1023
          -Wl,--dynamic-list-cpp-typeinfo
1024
dynamic_list.stdout: dynamic_list
1025
        $(TEST_READELF) -DWs dynamic_list > dynamic_list.stdout
1026
 
1027
check_PROGRAMS += thin_archive_test_1
1028
MOSTLYCLEANFILES += libthin1.a libthin3.a libthinall.a \
1029
        alt/thin_archive_test_2.o alt/thin_archive_test_4.o \
1030
        alt/libthin2.a alt/libthin4.a
1031
thin_archive_test_1_SOURCES = thin_archive_main.cc
1032
thin_archive_test_1_DEPENDENCIES = gcctestdir/ld libthin1.a alt/libthin2.a
1033
thin_archive_test_1_LDFLAGS = -Bgcctestdir/ -Lalt
1034
thin_archive_test_1_LDADD = libthin1.a -lthin2
1035
 
1036
check_PROGRAMS += thin_archive_test_2
1037
thin_archive_test_2_SOURCES = thin_archive_main.cc
1038
thin_archive_test_2_DEPENDENCIES = gcctestdir/ld libthinall.a
1039
thin_archive_test_2_LDFLAGS = -Bgcctestdir/ -L.
1040
thin_archive_test_2_LDADD = -lthinall
1041
 
1042
libthin1.a: thin_archive_test_1.o alt/thin_archive_test_2.o
1043
        rm -f $@
1044
        $(TEST_AR) crT $@ $^
1045
alt/libthin2.a: thin_archive_test_3.o alt/thin_archive_test_4.o
1046
        rm -f $@
1047
        $(TEST_AR) crT $@ $^
1048
libthin3.a: thin_archive_test_1.o alt/thin_archive_test_4.o
1049
        rm -f $@
1050
        $(TEST_AR) crT $@ $^
1051
alt/libthin4.a: alt/thin_archive_test_2.o thin_archive_test_3.o
1052
        rm -f $@
1053
        $(TEST_AR) crT $@ $^
1054
libthinall.a: libthin3.a alt/libthin4.a
1055
        rm -f $@
1056
        $(TEST_AR) crT $@ $^
1057
alt/thin_archive_test_2.o: thin_archive_test_2.cc
1058
        test -d alt || mkdir -p alt
1059
        $(CXXCOMPILE) -c -o $@ $<
1060
alt/thin_archive_test_4.o: thin_archive_test_4.cc
1061
        test -d alt || mkdir -p alt
1062
        $(CXXCOMPILE) -c -o $@ $<
1063
 
1064
if PLUGINS
1065
 
1066
check_PROGRAMS += plugin_test_1
1067
check_SCRIPTS += plugin_test_1.sh
1068
check_DATA += plugin_test_1.err
1069
MOSTLYCLEANFILES += plugin_test_1.err
1070
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
1071
        $(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
1072
plugin_test_1.err: plugin_test_1
1073
        @touch plugin_test_1.err
1074
 
1075
check_PROGRAMS += plugin_test_2
1076
check_SCRIPTS += plugin_test_2.sh
1077
check_DATA += plugin_test_2.err
1078
MOSTLYCLEANFILES += plugin_test_2.err
1079
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
1080
        $(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
1081
plugin_test_2.err: plugin_test_2
1082
        @touch plugin_test_2.err
1083
 
1084
check_PROGRAMS += plugin_test_3
1085
check_SCRIPTS += plugin_test_3.sh
1086
check_DATA += plugin_test_3.err
1087
MOSTLYCLEANFILES += plugin_test_3.err
1088
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
1089
        $(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
1090
plugin_test_3.err: plugin_test_3
1091
        @touch plugin_test_3.err
1092
 
1093
check_PROGRAMS += plugin_test_4
1094
check_SCRIPTS += plugin_test_4.sh
1095
check_DATA += plugin_test_4.err
1096
MOSTLYCLEANFILES += plugin_test_4.a plugin_test_4.err
1097
plugin_test_4: two_file_test_main.o plugin_test_4.a gcctestdir/ld plugin_test.so
1098
        $(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
1099
plugin_test_4.err: plugin_test_4
1100
        @touch plugin_test_4.err
1101
 
1102
plugin_test_4.a: two_file_test_1.syms two_file_test_1b.syms two_file_test_2.syms
1103
        $(TEST_AR) cr $@ $^
1104
 
1105
plugin_test.so: plugin_test.o
1106
        $(LINK) -Bgcctestdir/ -shared plugin_test.o
1107
plugin_test.o: plugin_test.c
1108
        $(COMPILE) -O0 -c -fpic -o $@ $<
1109
 
1110
two_file_test_main.syms: two_file_test_main.o
1111
        $(TEST_READELF) -sW $< >$@ 2>/dev/null
1112
two_file_test_1.syms: two_file_test_1.o
1113
        $(TEST_READELF) -sW $< >$@ 2>/dev/null
1114
two_file_test_1b.syms: two_file_test_1b.o
1115
        $(TEST_READELF) -sW $< >$@ 2>/dev/null
1116
two_file_test_2.syms: two_file_test_2.o
1117
        $(TEST_READELF) -sW $< >$@ 2>/dev/null
1118
empty.syms:
1119
        @echo "" >empty.syms
1120
        @echo "Symbol table" >>empty.syms
1121
 
1122
endif PLUGINS
1123
 
1124
check_PROGRAMS += exclude_libs_test
1125
check_SCRIPTS += exclude_libs_test.sh
1126
check_DATA += exclude_libs_test.syms
1127
MOSTLYCLEANFILES += exclude_libs_test.syms libexclude_libs_test_1.a \
1128
        libexclude_libs_test_2.a alt/libexclude_libs_test_3.a
1129
exclude_libs_test_SOURCES = exclude_libs_test.c
1130
exclude_libs_test_DEPENDENCIES = gcctestdir/ld libexclude_libs_test_1.a \
1131
        libexclude_libs_test_2.a alt/libexclude_libs_test_3.a
1132
exclude_libs_test_LDFLAGS = -Bgcctestdir/ -L. -Lalt \
1133
        -Wl,--exclude-libs,dummy:libexclude_libs_test_1 \
1134
        -Wl,--exclude-libs,libexclude_libs_test_3
1135
exclude_libs_test_LDADD = -lexclude_libs_test_1 -lexclude_libs_test_2 \
1136
        alt/libexclude_libs_test_3.a
1137
exclude_libs_test.syms: exclude_libs_test
1138
        $(TEST_READELF) -sW $< >$@ 2>/dev/null
1139
libexclude_libs_test_1.a: exclude_libs_test_1.o
1140
        $(TEST_AR) rc $@ $^
1141
libexclude_libs_test_2.a: exclude_libs_test_2.o
1142
        $(TEST_AR) rc $@ $^
1143
alt/libexclude_libs_test_3.a: exclude_libs_test_3.o
1144
        test -d alt || mkdir -p alt
1145
        $(TEST_AR) rc $@ $^
1146
 
1147
check_PROGRAMS += local_labels_test
1148
local_labels_test.o: ver_test_6.c
1149
        $(COMPILE) -g -c -Wa,-L -o $@ $<
1150
local_labels_test: local_labels_test.o
1151
        $(LINK) -Bgcctestdir/ local_labels_test.o
1152
 
1153
check_PROGRAMS += discard_locals_test
1154
check_SCRIPTS += discard_locals_test.sh
1155
check_DATA += discard_locals_test.syms
1156
MOSTLYCLEANFILES += discard_locals_test.syms
1157
discard_locals_test_SOURCES = discard_locals_test.c
1158
discard_locals_test_LDFLAGS = -Bgcctestdir/ -Wl,--discard-locals
1159
discard_locals_test.syms: discard_locals_test
1160
        $(TEST_READELF) -sW $< >$@ 2>/dev/null
1161
# '-Wa,-L' is required to preserve the local label used for testing.
1162
discard_locals_test.o: discard_locals_test.c
1163
        $(COMPILE) -c -Wa,-L -o $@ $<
1164
 
1165
if MCMODEL_MEDIUM
1166
check_PROGRAMS += large
1167
large_SOURCES = large.c
1168
large_CFLAGS = -mcmodel=medium
1169
large_DEPENDENCIES = gcctestdir/ld
1170
large_LDFLAGS = -Bgcctestdir/
1171
endif MCMODEL_MEDIUM
1172
 
1173
# Test that hidden and internal symbols in the main program cannot be
1174
# referenced by a shared library.
1175
check_SCRIPTS += hidden_test.sh
1176
check_DATA += hidden_test.err
1177
MOSTLYCLEANFILES += hidden_test hidden_test.err
1178
libhidden.so: hidden_test_1.c gcctestdir/ld
1179
        $(COMPILE) -Bgcctestdir/ -g -shared -fPIC -w -o $@ $(srcdir)/hidden_test_1.c
1180
hidden_test: hidden_test_main.o libhidden.so gcctestdir/ld
1181
        $(LINK) -Bgcctestdir/ -Wl,-R,. hidden_test_main.o libhidden.so 2>hidden_test.err
1182
hidden_test.err: hidden_test
1183
        @touch hidden_test.err
1184
 
1185
# Test -retain-symbols-file.
1186
check_SCRIPTS += retain_symbols_file_test.sh
1187
check_DATA += retain_symbols_file_test.stdout
1188
MOSTLYCLEANFILES += retain_symbols_file_test retain_symbols_file_test.in \
1189
                    retain_symbols_file_test.stdout
1190
retain_symbols_file_test.so: basic_pic_test.o gcctestdir/ld
1191
        echo 'main' > retain_symbols_file_test.in
1192
        echo 't1' >> retain_symbols_file_test.in
1193
        echo '_ZN4t16bC1Ev' >> retain_symbols_file_test.in
1194
        echo '_ZNK4t20a3getEv' >> retain_symbols_file_test.in
1195
        echo '_Z3t18v' >> retain_symbols_file_test.in
1196
        echo '__tcf_0' >> retain_symbols_file_test.in
1197
        $(CXXLINK) -Bgcctestdir/ -shared -Wl,-retain-symbols-file,retain_symbols_file_test.in basic_pic_test.o
1198
retain_symbols_file_test.stdout: retain_symbols_file_test.so
1199
        $(TEST_NM) -C retain_symbols_file_test.so > $@
1200
 
1201
 
1202
# Test that if the output file already exists and is empty,
1203
# it will get execute permission.
1204
check_PROGRAMS += permission_test
1205
permission_test: basic_test.o gcctestdir/ld
1206
        umask 022; \
1207
        rm -f $@; \
1208
        touch $@; \
1209
        chmod 600 $@; \
1210
        $(CXXLINK) -Bgcctestdir/ basic_test.o
1211
 
1212
# Check -l:foo.a
1213
check_PROGRAMS += searched_file_test
1214
MOSTLYCLEANFILES += searched_file_test searched_file_test_lib.o \
1215
                    alt/searched_file_test_lib.a
1216
searched_file_test_SOURCES = searched_file_test.cc
1217
searched_file_test_DEPENDENCIES = alt/searched_file_test_lib.a
1218
searched_file_test_LDFLAGS = -Bgcctestdir/ -Lalt
1219
searched_file_test_LDADD = -l:searched_file_test_lib.a
1220
searched_file_test_lib.o: searched_file_test_lib.cc
1221
        $(CXXCOMPILE) -c -o $@ $<
1222
alt/searched_file_test_lib.a: searched_file_test_lib.o
1223
        test -d alt || mkdir -p alt
1224
        $(TEST_AR) rc $@ $^
1225
 
1226
endif GCC
1227
endif NATIVE_LINKER
1228
 
1229
# These tests work with cross linkers.
1230
 
1231
if DEFAULT_TARGET_I386
1232
 
1233
check_SCRIPTS += split_i386.sh
1234
check_DATA += split_i386_1.stdout split_i386_2.stdout \
1235
        split_i386_3.stdout split_i386_4.stdout split_i386_r.stdout
1236
SPLIT_DEFSYMS = --defsym __morestack=0x100 --defsym __morestack_non_split=0x200
1237
split_i386_1.o: split_i386_1.s
1238
        $(TEST_AS) -o $@ $<
1239
split_i386_2.o: split_i386_2.s
1240
        $(TEST_AS) -o $@ $<
1241
split_i386_3.o: split_i386_3.s
1242
        $(TEST_AS) -o $@ $<
1243
split_i386_4.o: split_i386_4.s
1244
        $(TEST_AS) -o $@ $<
1245
split_i386_n.o: split_i386_n.s
1246
        $(TEST_AS) -o $@ $<
1247
split_i386_1: split_i386_1.o split_i386_n.o ../ld-new
1248
        ../ld-new $(SPLIT_DEFSYMS) -o $@ split_i386_1.o split_i386_n.o
1249
split_i386_1.stdout: split_i386_1
1250
        $(TEST_OBJDUMP) -d $< > $@
1251
split_i386_2: split_i386_2.o split_i386_n.o ../ld-new
1252
        ../ld-new $(SPLIT_DEFSYMS) -o $@ split_i386_2.o split_i386_n.o
1253
split_i386_2.stdout: split_i386_2
1254
        $(TEST_OBJDUMP) -d $< > $@
1255
split_i386_3.stdout: split_i386_3.o split_i386_n.o ../ld-new
1256
        ../ld-new $(SPLIT_DEFSYMS) -o split_i386_3 split_i386_3.o split_i386_n.o > $@ 2>&1 || exit 0
1257
split_i386_4: split_i386_4.o split_i386_n.o ../ld-new
1258
        ../ld-new $(SPLIT_DEFSYMS) -o $@ split_i386_4.o split_i386_n.o
1259
split_i386_4.stdout: split_i386_4
1260
        $(TEST_OBJDUMP) -d $< > $@
1261
split_i386_r.stdout: split_i386_1.o split_i386_n.o ../ld-new
1262
        ../ld-new -r split_i386_1.o split_i386_n.o -o split_i386_r > $@ 2>&1 || exit 0
1263
MOSTLYCLEANFILES += split_i386_1 split_i386_2 split_i386_3 \
1264
        split_i386_4 split_i386_r
1265
 
1266
endif DEFAULT_TARGET_I386
1267
 
1268
if DEFAULT_TARGET_X86_64
1269
 
1270
check_SCRIPTS += split_x86_64.sh
1271
check_DATA += split_x86_64_1.stdout split_x86_64_2.stdout \
1272
        split_x86_64_3.stdout split_x86_64_4.stdout split_x86_64_r.stdout
1273
SPLIT_DEFSYMS = --defsym __morestack=0x100 --defsym __morestack_non_split=0x200
1274
split_x86_64_1.o: split_x86_64_1.s
1275
        $(TEST_AS) -o $@ $<
1276
split_x86_64_2.o: split_x86_64_2.s
1277
        $(TEST_AS) -o $@ $<
1278
split_x86_64_3.o: split_x86_64_3.s
1279
        $(TEST_AS) -o $@ $<
1280
split_x86_64_4.o: split_x86_64_4.s
1281
        $(TEST_AS) -o $@ $<
1282
split_x86_64_n.o: split_x86_64_n.s
1283
        $(TEST_AS) -o $@ $<
1284
split_x86_64_1: split_x86_64_1.o split_x86_64_n.o ../ld-new
1285
        ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x86_64_1.o split_x86_64_n.o
1286
split_x86_64_1.stdout: split_x86_64_1
1287
        $(TEST_OBJDUMP) -d $< > $@
1288
split_x86_64_2: split_x86_64_2.o split_x86_64_n.o ../ld-new
1289
        ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x86_64_2.o split_x86_64_n.o
1290
split_x86_64_2.stdout: split_x86_64_2
1291
        $(TEST_OBJDUMP) -d $< > $@
1292
split_x86_64_3.stdout: split_x86_64_3.o split_x86_64_n.o ../ld-new
1293
        ../ld-new $(SPLIT_DEFSYMS) -o split_x86_64_3 split_x86_64_3.o split_x86_64_n.o > $@ 2>&1 || exit 0
1294
split_x86_64_4: split_x86_64_4.o split_x86_64_n.o ../ld-new
1295
        ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x86_64_4.o split_x86_64_n.o
1296
split_x86_64_4.stdout: split_x86_64_4
1297
        $(TEST_OBJDUMP) -d $< > $@
1298
split_x86_64_r.stdout: split_x86_64_1.o split_x86_64_n.o ../ld-new
1299
        ../ld-new -r split_x86_64_1.o split_x86_64_n.o -o split_x86_64_r > $@ 2>&1 || exit 0
1300
MOSTLYCLEANFILES += split_x86_64_1 split_x86_64_2 split_x86_64_3 \
1301
        split_x86_64_4 split_x86_64_r
1302
 
1303
endif DEFAULT_TARGET_X86_64

powered by: WebSVN 2.1.0

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