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