]>
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 | ||
5a6f7e2d ILT |
7 | AUTOMAKE_OPTIONS = |
8 | ||
f958d5fc ILT |
9 | # The two_file_test tests -fmerge-constants, so we simply always turn |
10 | # it on. This may need to be controlled by a configure option | |
11 | # eventually. | |
494e05f4 | 12 | AM_CXXFLAGS = $(WARN_CXXFLAGS) $(LFS_CFLAGS) -fmerge-constants |
5a6f7e2d | 13 | |
fa99aa09 | 14 | INCLUDES = \ |
5a6f7e2d | 15 | -I$(srcdir) -I$(srcdir)/.. -I$(srcdir)/../../include \ |
155a0dd7 | 16 | -I$(srcdir)/../../elfcpp -I.. \ |
5a6f7e2d ILT |
17 | -DLOCALEDIR="\"$(datadir)/locale\"" \ |
18 | @INCINTL@ | |
19 | ||
6835af53 ILT |
20 | TEST_READELF = $(top_builddir)/../binutils/readelf |
21 | TEST_OBJDUMP = $(top_builddir)/../binutils/objdump | |
22 | TEST_CXXFILT = $(top_builddir)/../binutils/cxxfilt | |
23 | TEST_STRIP = $(top_builddir)/../binutils/strip-new | |
24 | ||
fe9a4c12 ILT |
25 | if THREADS |
26 | THREADSLIB = -lpthread | |
27 | endif | |
28 | ||
155a0dd7 ILT |
29 | if OMP_SUPPORT |
30 | TLS_TEST_C_CFLAGS = -fopenmp | |
31 | endif | |
32 | ||
351a8000 ILT |
33 | # 'make clean' is good about deleting some intermediate files (such as |
34 | # .o's), but not all of them (such as .so's and .err files). We | |
35 | # improve on that here. automake-1.9 info docs say "mostlyclean" is | |
36 | # the right choice for files 'make' builds that people rebuild. | |
37 | MOSTLYCLEANFILES = *.so | |
6eee141f | 38 | |
6eee141f | 39 | |
351a8000 ILT |
40 | # We will add to these later, for each individual test. Note |
41 | # that we add each test under check_SCRIPTS or check_PROGRAMS; | |
42 | # the TESTS variable is automatically populated from these. | |
43 | check_SCRIPTS = | |
44 | check_DATA = | |
45 | check_PROGRAMS = | |
d491d34e ILT |
46 | BUILT_SOURCES = |
47 | ||
351a8000 | 48 | TESTS = $(check_SCRIPTS) $(check_PROGRAMS) |
22dc1b09 | 49 | |
351a8000 ILT |
50 | # --------------------------------------------------------------------- |
51 | # These tests test the internals of gold (unittests). | |
5a6f7e2d | 52 | |
351a8000 | 53 | # Infrastucture needed for the unittests |
5a6f7e2d ILT |
54 | check_LIBRARIES = libgoldtest.a |
55 | libgoldtest_a_SOURCES = test.cc testmain.cc testfile.cc | |
56 | ||
ad2d6943 ILT |
57 | DEPENDENCIES = \ |
58 | libgoldtest.a ../libgold.a ../../libiberty/libiberty.a $(LIBINTL_DEP) | |
fe9a4c12 ILT |
59 | LDADD = libgoldtest.a ../libgold.a ../../libiberty/libiberty.a $(LIBINTL) \ |
60 | $(THREADSLIB) | |
5a6f7e2d | 61 | |
5a6f7e2d | 62 | |
351a8000 ILT |
63 | # The unittests themselves |
64 | check_PROGRAMS += object_unittest | |
5a6f7e2d | 65 | object_unittest_SOURCES = object_unittest.cc |
22dc1b09 | 66 | |
bc644c6c ILT |
67 | check_PROGRAMS += binary_unittest |
68 | binary_unittest_SOURCES = binary_unittest.cc | |
69 | ||
351a8000 ILT |
70 | |
71 | # --------------------------------------------------------------------- | |
72 | # These tests test the output of gold (end-to-end tests). In | |
73 | # particular, they make sure that gold can link "difficult" object | |
74 | # files, and the resulting object files run correctly. These can only | |
75 | # run if we've built ld-new for the native architecture (that is, | |
76 | # we're not cross-compiling it), since we run ld-new as part of these | |
77 | # tests. We use the gcc-specific flag '-B' to use our linker instead | |
78 | # of the default linker, which is why we only run our tests under gcc. | |
a360aedd | 79 | |
e2827e5f | 80 | if NATIVE_LINKER |
351a8000 | 81 | if GCC |
e2827e5f | 82 | |
351a8000 ILT |
83 | # Infrastucture needed for the unittests: a directory where the linker |
84 | # is named 'ld'. This is because the -B flag appends 'ld' to its arg. | |
e2827e5f ILT |
85 | gcctestdir/ld: ../ld-new |
86 | test -d gcctestdir || mkdir -p gcctestdir | |
87 | rm -f gcctestdir/ld | |
88 | (cd gcctestdir && $(LN_S) ../../ld-new ld) | |
89 | ||
351a8000 ILT |
90 | # Each of these .o's is a useful, small complete program. They're |
91 | # particularly useful for making sure ld-new's flags do what they're | |
92 | # supposed to (hence their names), but are used for many tests that | |
93 | # don't actually involve analyzing input data. | |
43771f76 ILT |
94 | flagstest_debug.o: constructor_test.cc |
95 | $(CXXCOMPILE) -O0 -g -c -o $@ $< | |
96 | flagstest_ndebug.o: constructor_test.cc | |
97 | $(CXXCOMPILE) -O0 -c -o $@ $< | |
98 | ||
43771f76 | 99 | |
351a8000 ILT |
100 | check_PROGRAMS += basic_test |
101 | check_PROGRAMS += basic_static_test | |
102 | check_PROGRAMS += basic_pic_test | |
103 | check_PROGRAMS += basic_static_pic_test | |
56ba9a23 | 104 | basic_test.o: basic_test.cc |
22dc1b09 | 105 | $(CXXCOMPILE) -O0 -c -o $@ $< |
56ba9a23 ILT |
106 | basic_test: basic_test.o gcctestdir/ld |
107 | $(CXXLINK) -Bgcctestdir/ basic_test.o | |
108 | basic_static_test: basic_test.o gcctestdir/ld | |
109 | $(CXXLINK) -Bgcctestdir/ -static basic_test.o | |
22dc1b09 | 110 | |
56ba9a23 | 111 | basic_pic_test.o: basic_test.cc |
22dc1b09 | 112 | $(CXXCOMPILE) -O0 -c -fpic -o $@ $< |
56ba9a23 ILT |
113 | basic_pic_test: basic_pic_test.o gcctestdir/ld |
114 | $(CXXLINK) -Bgcctestdir/ basic_pic_test.o | |
115 | basic_static_pic_test: basic_pic_test.o gcctestdir/ld | |
116 | $(CXXLINK) -Bgcctestdir/ -static basic_pic_test.o | |
22dc1b09 | 117 | |
351a8000 ILT |
118 | |
119 | check_PROGRAMS += constructor_test | |
120 | check_PROGRAMS += constructor_static_test | |
d5026652 ILT |
121 | constructor_test_SOURCES = constructor_test.cc |
122 | constructor_test_DEPENDENCIES = gcctestdir/ld | |
123 | constructor_test_LDFLAGS = -Bgcctestdir/ | |
124 | ||
351a8000 ILT |
125 | constructor_static_test_SOURCES = $(constructor_test_SOURCES) |
126 | constructor_static_test_DEPENDENCIES = $(constructor_test_DEPENDENCIES) | |
127 | constructor_static_test_LDFLAGS = $(constructor_test_LDFLAGS) -static | |
cb615bc1 | 128 | |
351a8000 ILT |
129 | |
130 | check_PROGRAMS += two_file_test | |
131 | check_PROGRAMS += two_file_static_test | |
132 | check_PROGRAMS += two_file_pic_test | |
3bd52c28 ILT |
133 | two_file_test_SOURCES = \ |
134 | two_file_test_1.cc \ | |
03e8f2b2 | 135 | two_file_test_1b.cc \ |
3bd52c28 ILT |
136 | two_file_test_2.cc \ |
137 | two_file_test_main.cc \ | |
138 | two_file_test.h | |
139 | two_file_test_DEPENDENCIES = gcctestdir/ld | |
140 | two_file_test_LDFLAGS = -Bgcctestdir/ | |
141 | ||
351a8000 ILT |
142 | two_file_static_test_SOURCES = $(two_file_test_SOURCES) |
143 | two_file_static_test_DEPENDENCIES = $(two_file_test_DEPENDENCIES) | |
144 | two_file_static_test_LDFLAGS = $(two_file_test_LDFLAGS) -static | |
f958d5fc ILT |
145 | |
146 | two_file_pic_test_SOURCES = two_file_test_main.cc | |
147 | two_file_pic_test_DEPENDENCIES = \ | |
03e8f2b2 | 148 | gcctestdir/ld two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o |
f958d5fc | 149 | two_file_pic_test_LDFLAGS = -Bgcctestdir/ |
03e8f2b2 | 150 | two_file_pic_test_LDADD = two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o |
f958d5fc | 151 | |
351a8000 ILT |
152 | |
153 | check_PROGRAMS += two_file_shared_1_test | |
154 | check_PROGRAMS += two_file_shared_2_test | |
155 | check_PROGRAMS += two_file_shared_1_pic_2_test | |
156 | check_PROGRAMS += two_file_shared_2_pic_1_test | |
157 | check_PROGRAMS += two_file_same_shared_test | |
158 | check_PROGRAMS += two_file_separate_shared_12_test | |
159 | check_PROGRAMS += two_file_separate_shared_21_test | |
160 | two_file_test_1_pic.o: two_file_test_1.cc | |
161 | $(CXXCOMPILE) -c -fpic -o $@ $< | |
03e8f2b2 ILT |
162 | two_file_test_1b_pic.o: two_file_test_1b.cc |
163 | $(CXXCOMPILE) -c -fpic -o $@ $< | |
351a8000 ILT |
164 | two_file_test_2_pic.o: two_file_test_2.cc |
165 | $(CXXCOMPILE) -c -fpic -o $@ $< | |
03e8f2b2 ILT |
166 | two_file_shared_1.so: two_file_test_1_pic.o two_file_test_1b_pic.o gcctestdir/ld |
167 | $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1_pic.o two_file_test_1b_pic.o | |
351a8000 ILT |
168 | two_file_shared_2.so: two_file_test_2_pic.o gcctestdir/ld |
169 | $(CXXLINK) -Bgcctestdir/ -shared two_file_test_2_pic.o | |
03e8f2b2 ILT |
170 | two_file_shared.so: two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o gcctestdir/ld |
171 | $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o | |
351a8000 | 172 | |
3bd52c28 ILT |
173 | two_file_shared_1_test_SOURCES = two_file_test_2.cc two_file_test_main.cc |
174 | two_file_shared_1_test_DEPENDENCIES = gcctestdir/ld two_file_shared_1.so | |
175 | two_file_shared_1_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
176 | two_file_shared_1_test_LDADD = two_file_shared_1.so | |
177 | ||
03e8f2b2 | 178 | two_file_shared_2_test_SOURCES = two_file_test_1.cc two_file_test_1b.cc two_file_test_main.cc |
3bd52c28 ILT |
179 | two_file_shared_2_test_DEPENDENCIES = gcctestdir/ld two_file_shared_2.so |
180 | two_file_shared_2_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
181 | two_file_shared_2_test_LDADD = two_file_shared_2.so | |
182 | ||
386c048c ILT |
183 | two_file_shared_1_pic_2_test_SOURCES = two_file_test_main.cc |
184 | two_file_shared_1_pic_2_test_DEPENDENCIES = \ | |
03e8f2b2 | 185 | gcctestdir/ld two_file_shared_1.so two_file_test_1_pic.o two_file_test_1b_pic.o |
386c048c | 186 | two_file_shared_1_pic_2_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. |
03e8f2b2 | 187 | 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 |
188 | |
189 | two_file_shared_2_pic_1_test_SOURCES = two_file_test_main.cc | |
190 | two_file_shared_2_pic_1_test_DEPENDENCIES = \ | |
191 | gcctestdir/ld two_file_shared_2.so two_file_test_2_pic.o | |
192 | two_file_shared_2_pic_1_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
193 | two_file_shared_2_pic_1_test_LDADD = two_file_test_2_pic.o two_file_shared_1.so | |
194 | ||
3bd52c28 ILT |
195 | two_file_same_shared_test_SOURCES = two_file_test_main.cc |
196 | two_file_same_shared_test_DEPENDENCIES = gcctestdir/ld two_file_shared.so | |
197 | two_file_same_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
198 | two_file_same_shared_test_LDADD = two_file_shared.so | |
199 | ||
200 | two_file_separate_shared_12_test_SOURCES = two_file_test_main.cc | |
201 | two_file_separate_shared_12_test_DEPENDENCIES = \ | |
202 | gcctestdir/ld two_file_shared_1.so two_file_shared_2.so | |
203 | two_file_separate_shared_12_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
204 | two_file_separate_shared_12_test_LDADD = \ | |
205 | two_file_shared_1.so two_file_shared_2.so | |
206 | ||
207 | two_file_separate_shared_21_test_SOURCES = two_file_test_main.cc | |
208 | two_file_separate_shared_21_test_DEPENDENCIES = \ | |
209 | gcctestdir/ld two_file_shared_1.so two_file_shared_2.so | |
210 | two_file_separate_shared_21_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
211 | two_file_separate_shared_21_test_LDADD = \ | |
212 | two_file_shared_2.so two_file_shared_1.so | |
213 | ||
6a74a719 ILT |
214 | check_PROGRAMS += two_file_relocatable_test |
215 | two_file_relocatable_test_SOURCES = two_file_test_main.cc | |
216 | two_file_relocatable_test_DEPENDENCIES = \ | |
217 | gcctestdir/ld two_file_relocatable.o | |
218 | two_file_relocatable_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
219 | two_file_relocatable_test_LDADD = two_file_relocatable.o | |
220 | two_file_relocatable.o: gcctestdir/ld two_file_test_1.o two_file_test_1b.o two_file_test_2.o | |
221 | gcctestdir/ld -r -o $@ two_file_test_1.o two_file_test_1b.o two_file_test_2.o | |
222 | ||
63402fe4 ILT |
223 | # The nonpic tests will fail on platforms which can not put non-PIC |
224 | # code into shared libraries, so we just don't run them in that case. | |
63402fe4 | 225 | if FN_PTRS_IN_SO_WITHOUT_PIC |
3bd52c28 | 226 | |
351a8000 ILT |
227 | check_PROGRAMS += two_file_shared_1_nonpic_test |
228 | check_PROGRAMS += two_file_shared_2_nonpic_test | |
229 | check_PROGRAMS += two_file_same_shared_nonpic_test | |
230 | check_PROGRAMS += two_file_separate_shared_12_nonpic_test | |
231 | check_PROGRAMS += two_file_separate_shared_21_nonpic_test | |
03e8f2b2 ILT |
232 | check_PROGRAMS += two_file_mixed_shared_test |
233 | check_PROGRAMS += two_file_mixed_2_shared_test | |
351a8000 | 234 | two_file_shared_1_nonpic.so: two_file_test_1.o gcctestdir/ld |
03e8f2b2 | 235 | $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1.o two_file_test_1b.o |
351a8000 ILT |
236 | two_file_shared_2_nonpic.so: two_file_test_2.o gcctestdir/ld |
237 | $(CXXLINK) -Bgcctestdir/ -shared two_file_test_2.o | |
03e8f2b2 ILT |
238 | two_file_shared_nonpic.so: two_file_test_1.o two_file_test_1b.o two_file_test_2.o gcctestdir/ld |
239 | $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1.o two_file_test_1b.o two_file_test_2.o | |
240 | two_file_shared_mixed.so: two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2.o gcctestdir/ld | |
241 | $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2.o | |
242 | two_file_shared_mixed_1.so: two_file_test_1.o two_file_test_1b_pic.o two_file_shared_2.so gcctestdir/ld | |
243 | $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1.o two_file_test_1b_pic.o two_file_shared_2.so | |
351a8000 | 244 | |
3bd52c28 ILT |
245 | two_file_shared_1_nonpic_test_SOURCES = \ |
246 | two_file_test_2.cc two_file_test_main.cc | |
247 | two_file_shared_1_nonpic_test_DEPENDENCIES = \ | |
248 | gcctestdir/ld two_file_shared_1_nonpic.so | |
249 | two_file_shared_1_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
250 | two_file_shared_1_nonpic_test_LDADD = two_file_shared_1_nonpic.so | |
251 | ||
252 | two_file_shared_2_nonpic_test_SOURCES = \ | |
03e8f2b2 | 253 | two_file_test_1.cc two_file_test_1b.cc two_file_test_main.cc |
3bd52c28 ILT |
254 | two_file_shared_2_nonpic_test_DEPENDENCIES = \ |
255 | gcctestdir/ld two_file_shared_2_nonpic.so | |
256 | two_file_shared_2_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
257 | two_file_shared_2_nonpic_test_LDADD = two_file_shared_2_nonpic.so | |
258 | ||
259 | two_file_same_shared_nonpic_test_SOURCES = two_file_test_main.cc | |
260 | two_file_same_shared_nonpic_test_DEPENDENCIES = \ | |
261 | gcctestdir/ld two_file_shared_nonpic.so | |
262 | two_file_same_shared_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
263 | two_file_same_shared_nonpic_test_LDADD = two_file_shared_nonpic.so | |
264 | ||
265 | two_file_separate_shared_12_nonpic_test_SOURCES = two_file_test_main.cc | |
266 | two_file_separate_shared_12_nonpic_test_DEPENDENCIES = \ | |
267 | gcctestdir/ld two_file_shared_1_nonpic.so two_file_shared_2_nonpic.so | |
268 | two_file_separate_shared_12_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
269 | two_file_separate_shared_12_nonpic_test_LDADD = \ | |
270 | two_file_shared_1_nonpic.so two_file_shared_2_nonpic.so | |
271 | ||
272 | two_file_separate_shared_21_nonpic_test_SOURCES = two_file_test_main.cc | |
273 | two_file_separate_shared_21_nonpic_test_DEPENDENCIES = \ | |
274 | gcctestdir/ld two_file_shared_1_nonpic.so two_file_shared_2_nonpic.so | |
275 | two_file_separate_shared_21_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
276 | two_file_separate_shared_21_nonpic_test_LDADD = \ | |
277 | two_file_shared_2_nonpic.so two_file_shared_1_nonpic.so | |
278 | ||
03e8f2b2 ILT |
279 | two_file_mixed_shared_test_SOURCES = two_file_test_main.cc |
280 | two_file_mixed_shared_test_DEPENDENCIES = gcctestdir/ld two_file_shared_mixed.so | |
281 | two_file_mixed_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
282 | two_file_mixed_shared_test_LDADD = two_file_shared_mixed.so | |
283 | ||
284 | two_file_mixed_2_shared_test_SOURCES = two_file_test_main.cc | |
285 | two_file_mixed_2_shared_test_DEPENDENCIES = gcctestdir/ld two_file_shared_mixed_1.so two_file_shared_2.so | |
286 | two_file_mixed_2_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
287 | two_file_mixed_2_shared_test_LDADD = two_file_shared_mixed_1.so two_file_shared_2.so | |
288 | ||
351a8000 | 289 | endif FN_PTRS_IN_SO_WITHOUT_PIC |
3bd52c28 | 290 | |
6835af53 ILT |
291 | check_PROGRAMS += two_file_strip_test |
292 | two_file_strip_test: two_file_test | |
293 | $(TEST_STRIP) -o two_file_strip_test two_file_test | |
294 | ||
295 | check_PROGRAMS += two_file_same_shared_strip_test | |
296 | two_file_same_shared_strip_test_SOURCES = two_file_test_main.cc | |
297 | two_file_same_shared_strip_test_DEPENDENCIES = \ | |
298 | gcctestdir/ld two_file_shared_strip.so | |
299 | two_file_same_shared_strip_test_LDFLAGS = -Bgcctestdir/ -Wl,-R. | |
300 | two_file_same_shared_strip_test_LDADD = two_file_shared_strip.so | |
301 | two_file_shared_strip.so: two_file_shared.so | |
302 | $(TEST_STRIP) -S -o two_file_shared_strip.so two_file_shared.so | |
303 | ||
49bdd526 ILT |
304 | check_PROGRAMS += common_test_1 |
305 | common_test_1_SOURCES = common_test_1.c | |
306 | common_test_1_DEPENDENCIES = gcctestdir/ld | |
307 | common_test_1_LDFLAGS = -Bgcctestdir/ | |
351a8000 ILT |
308 | |
309 | check_PROGRAMS += exception_test | |
310 | check_PROGRAMS += exception_static_test | |
311 | check_PROGRAMS += exception_shared_1_test | |
312 | check_PROGRAMS += exception_shared_2_test | |
313 | check_PROGRAMS += exception_same_shared_test | |
314 | check_PROGRAMS += exception_separate_shared_12_test | |
315 | check_PROGRAMS += exception_separate_shared_21_test | |
316 | exception_test_1_pic.o: exception_test_1.cc | |
317 | $(CXXCOMPILE) -c -fpic -o $@ $< | |
318 | exception_test_2_pic.o: exception_test_2.cc | |
319 | $(CXXCOMPILE) -c -fpic -o $@ $< | |
320 | exception_shared_1.so: exception_test_1_pic.o gcctestdir/ld | |
321 | $(CXXLINK) -Bgcctestdir/ -shared exception_test_1_pic.o | |
322 | exception_shared_2.so: exception_test_2_pic.o gcctestdir/ld | |
323 | $(CXXLINK) -Bgcctestdir/ -shared exception_test_2_pic.o | |
324 | exception_shared.so: exception_test_1_pic.o exception_test_2_pic.o gcctestdir/ld | |
325 | $(CXXLINK) -Bgcctestdir/ -shared exception_test_1_pic.o exception_test_2_pic.o | |
63402fe4 | 326 | |
3151305a ILT |
327 | exception_test_SOURCES = \ |
328 | exception_test_main.cc \ | |
329 | exception_test_1.cc \ | |
330 | exception_test_2.cc \ | |
331 | exception_test.h | |
332 | exception_test_DEPENDENCIES = gcctestdir/ld | |
333 | exception_test_LDFLAGS = -Bgcctestdir/ | |
334 | ||
351a8000 ILT |
335 | exception_static_test_SOURCES = $(exception_test_SOURCES) |
336 | exception_static_test_DEPENDENCIES = $(exception_test_DEPENDENCIES) | |
337 | exception_static_test_LDFLAGS = $(exception_test_LDFLAGS) -static | |
3151305a ILT |
338 | |
339 | exception_shared_1_test_SOURCES = exception_test_2.cc exception_test_main.cc | |
340 | exception_shared_1_test_DEPENDENCIES = gcctestdir/ld exception_shared_1.so | |
341 | exception_shared_1_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
342 | exception_shared_1_test_LDADD = exception_shared_1.so | |
343 | ||
344 | exception_shared_2_test_SOURCES = exception_test_1.cc exception_test_main.cc | |
345 | exception_shared_2_test_DEPENDENCIES = gcctestdir/ld exception_shared_2.so | |
346 | exception_shared_2_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
347 | exception_shared_2_test_LDADD = exception_shared_2.so | |
348 | ||
349 | exception_same_shared_test_SOURCES = exception_test_main.cc | |
350 | exception_same_shared_test_DEPENDENCIES = gcctestdir/ld exception_shared.so | |
351 | exception_same_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
352 | exception_same_shared_test_LDADD = exception_shared.so | |
353 | ||
354 | exception_separate_shared_12_test_SOURCES = exception_test_main.cc | |
355 | exception_separate_shared_12_test_DEPENDENCIES = \ | |
356 | gcctestdir/ld exception_shared_1.so exception_shared_2.so | |
357 | exception_separate_shared_12_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
358 | exception_separate_shared_12_test_LDADD = \ | |
359 | exception_shared_1.so exception_shared_2.so | |
360 | ||
361 | exception_separate_shared_21_test_SOURCES = exception_test_main.cc | |
362 | exception_separate_shared_21_test_DEPENDENCIES = \ | |
363 | gcctestdir/ld exception_shared_1.so exception_shared_2.so | |
364 | exception_separate_shared_21_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
365 | exception_separate_shared_21_test_LDADD = \ | |
366 | exception_shared_2.so exception_shared_1.so | |
367 | ||
3151305a | 368 | |
351a8000 | 369 | check_PROGRAMS += weak_test |
a360aedd | 370 | weak_test_SOURCES = weak_test.cc |
0e470e5c | 371 | weak_test_DEPENDENCIES = gcctestdir/ld |
a360aedd ILT |
372 | weak_test_LDFLAGS = -Bgcctestdir/ |
373 | ||
86925eef CC |
374 | check_PROGRAMS += weak_undef_test |
375 | weak_undef_test_SOURCES = weak_undef_test.cc | |
376 | weak_undef_test_DEPENDENCIES = gcctestdir/ld weak_undef_lib.so alt/weak_undef_lib.so | |
377 | weak_undef_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,alt | |
378 | weak_undef_test_LDADD = -L . weak_undef_lib.so | |
379 | weak_undef_file1.o: weak_undef_file1.cc | |
380 | $(CXXCOMPILE) -c -fpic -o $@ $< | |
381 | weak_undef_file2.o: weak_undef_file2.cc | |
382 | $(CXXCOMPILE) -c -fpic -o $@ $< | |
383 | weak_undef_lib.so: weak_undef_file1.o | |
384 | $(CXXLINK) -Bgcctestdir/ -shared weak_undef_file1.o | |
385 | alt/weak_undef_lib.so: weak_undef_file2.o | |
386 | test -d alt || mkdir -p alt | |
387 | $(CXXLINK) -Bgcctestdir/ -shared weak_undef_file2.o | |
351a8000 | 388 | |
f3c69fca CC |
389 | if FN_PTRS_IN_SO_WITHOUT_PIC |
390 | check_PROGRAMS += weak_undef_nonpic_test | |
391 | weak_undef_nonpic_test_SOURCES = weak_undef_test.cc | |
392 | weak_undef_nonpic_test_DEPENDENCIES = gcctestdir/ld weak_undef_lib_nonpic.so alt/weak_undef_lib_nonpic.so | |
393 | weak_undef_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,alt | |
394 | weak_undef_nonpic_test_LDADD = -L . weak_undef_lib_nonpic.so | |
395 | weak_undef_file1_nonpic.o: weak_undef_file1.cc | |
396 | $(CXXCOMPILE) -c -o $@ $< | |
397 | weak_undef_file2_nonpic.o: weak_undef_file2.cc | |
398 | $(CXXCOMPILE) -c -o $@ $< | |
399 | weak_undef_lib_nonpic.so: weak_undef_file1_nonpic.o | |
400 | $(CXXLINK) -Bgcctestdir/ -shared weak_undef_file1_nonpic.o | |
401 | alt/weak_undef_lib_nonpic.so: weak_undef_file2_nonpic.o | |
402 | test -d alt || mkdir -p alt | |
403 | $(CXXLINK) -Bgcctestdir/ -shared weak_undef_file2_nonpic.o | |
404 | endif FN_PTRS_IN_SO_WITHOUT_PIC | |
405 | ||
406 | ||
99a37bfd ILT |
407 | check_PROGRAMS += weak_alias_test |
408 | weak_alias_test_SOURCES = weak_alias_test_main.cc | |
409 | weak_alias_test_DEPENDENCIES = \ | |
410 | gcctestdir/ld weak_alias_test_1.so weak_alias_test_2.so \ | |
411 | weak_alias_test_3.o weak_alias_test_4.so | |
412 | weak_alias_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
413 | weak_alias_test_LDADD = \ | |
414 | weak_alias_test_1.so weak_alias_test_2.so weak_alias_test_3.o \ | |
415 | weak_alias_test_4.so | |
416 | weak_alias_test_1_pic.o: weak_alias_test_1.cc | |
417 | $(CXXCOMPILE) -c -fpic -o $@ $< | |
de4c45bd | 418 | weak_alias_test_1.so: weak_alias_test_1_pic.o gcctestdir/ld |
99a37bfd ILT |
419 | $(CXXLINK) -Bgcctestdir/ -shared weak_alias_test_1_pic.o |
420 | weak_alias_test_2_pic.o: weak_alias_test_2.cc | |
421 | $(CXXCOMPILE) -c -fpic -o $@ $< | |
de4c45bd | 422 | weak_alias_test_2.so: weak_alias_test_2_pic.o gcctestdir/ld |
99a37bfd ILT |
423 | $(CXXLINK) -Bgcctestdir/ -shared weak_alias_test_2_pic.o |
424 | weak_alias_test_3.o: weak_alias_test_3.cc | |
425 | $(CXXCOMPILE) -c -o $@ $< | |
426 | weak_alias_test_4_pic.o: weak_alias_test_4.cc | |
427 | $(CXXCOMPILE) -c -fpic -o $@ $< | |
de4c45bd | 428 | weak_alias_test_4.so: weak_alias_test_4_pic.o gcctestdir/ld |
99a37bfd ILT |
429 | $(CXXLINK) -Bgcctestdir/ -shared weak_alias_test_4_pic.o |
430 | ||
de4c45bd ILT |
431 | check_SCRIPTS += weak_plt.sh |
432 | check_PROGRAMS += weak_plt | |
433 | check_DATA += weak_plt_shared.so | |
434 | weak_plt_main_pic.o: weak_plt_main.cc | |
435 | $(CXXCOMPILE) -c -fpic -o $@ $< | |
436 | weak_plt: weak_plt_main_pic.o gcctestdir/ld | |
437 | $(CXXLINK) -Bgcctestdir/ weak_plt_main_pic.o | |
438 | weak_plt_shared_pic.o: weak_plt_shared.cc | |
439 | $(CXXCOMPILE) -c -fpic -o $@ $< | |
440 | weak_plt_shared.so: weak_plt_shared_pic.o gcctestdir/ld | |
441 | $(CXXLINK) -Bgcctestdir/ -shared weak_plt_shared_pic.o | |
442 | ||
f34787f8 ILT |
443 | check_PROGRAMS += copy_test |
444 | copy_test_SOURCES = copy_test.cc | |
445 | copy_test_DEPENDENCIES = gcctestdir/ld copy_test_1.so copy_test_2.so | |
446 | copy_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
447 | copy_test_LDADD = copy_test_1.so copy_test_2.so | |
448 | copy_test_1_pic.o: copy_test_1.cc | |
449 | $(CXXCOMPILE) -c -fpic -o $@ $< | |
450 | copy_test_1.so: gcctestdir/ld copy_test_1_pic.o | |
451 | $(CXXLINK) -Bgcctestdir/ -shared copy_test_1_pic.o | |
452 | copy_test_2_pic.o: copy_test_2.cc | |
453 | $(CXXCOMPILE) -c -fpic -o $@ $< | |
454 | copy_test_2.so: gcctestdir/ld copy_test_2_pic.o | |
455 | $(CXXLINK) -Bgcctestdir/ -shared copy_test_2_pic.o | |
456 | ||
6eee141f ILT |
457 | if TLS |
458 | ||
351a8000 ILT |
459 | check_PROGRAMS += tls_test |
460 | check_PROGRAMS += tls_pic_test | |
461 | check_PROGRAMS += tls_shared_test | |
c03c7692 | 462 | check_PROGRAMS += tls_shared_ie_test |
c2b45e22 | 463 | check_PROGRAMS += tls_shared_gd_to_ie_test |
351a8000 ILT |
464 | tls_test_pic.o: tls_test.cc |
465 | $(CXXCOMPILE) -c -fpic -o $@ $< | |
466 | tls_test_file2_pic.o: tls_test_file2.cc | |
467 | $(CXXCOMPILE) -c -fpic -o $@ $< | |
155a0dd7 ILT |
468 | tls_test_c_pic.o: tls_test_c.c |
469 | $(COMPILE) -c -fpic $(TLS_TEST_C_CFLAGS) -o $@ $< | |
470 | tls_test_shared.so: tls_test_pic.o tls_test_file2_pic.o tls_test_c_pic.o gcctestdir/ld | |
9c2d0ef9 | 471 | $(CXXLINK) -Bgcctestdir/ -shared tls_test_pic.o tls_test_file2_pic.o tls_test_c_pic.o -Wl,-z,defs |
c2b45e22 CC |
472 | tls_test_shared2.so: tls_test_file2_pic.o gcctestdir/ld |
473 | $(CXXLINK) -Bgcctestdir/ -shared tls_test_file2_pic.o | |
351a8000 | 474 | |
c03c7692 ILT |
475 | tls_test_pic_ie.o: tls_test.cc |
476 | $(CXXCOMPILE) -c -fpic -ftls-model=initial-exec -o $@ $< | |
477 | tls_test_file2_pic_ie.o: tls_test_file2.cc | |
478 | $(CXXCOMPILE) -c -fpic -ftls-model=initial-exec -o $@ $< | |
155a0dd7 ILT |
479 | tls_test_c_pic_ie.o: tls_test_c.c |
480 | $(COMPILE) -c -fpic -ftls-model=initial-exec $(TLS_TEST_C_CFLAGS) -o $@ $< | |
481 | tls_test_ie_shared.so: tls_test_pic_ie.o tls_test_file2_pic_ie.o tls_test_c_pic_ie.o gcctestdir/ld | |
482 | $(CXXLINK) -Bgcctestdir/ -shared tls_test_pic_ie.o tls_test_file2_pic_ie.o tls_test_c_pic_ie.o | |
c03c7692 | 483 | |
e0374858 | 484 | tls_test_SOURCES = tls_test.cc tls_test_file2.cc tls_test_main.cc tls_test.h |
155a0dd7 | 485 | tls_test_DEPENDENCIES = gcctestdir/ld tls_test_c.o |
6eee141f | 486 | tls_test_LDFLAGS = -Bgcctestdir/ |
155a0dd7 ILT |
487 | tls_test_LDADD = tls_test_c.o -lpthread |
488 | tls_test_c.o: tls_test_c.c | |
489 | $(COMPILE) -c $(TLS_TEST_C_CFLAGS) -o $@ $< | |
6eee141f ILT |
490 | |
491 | tls_pic_test_SOURCES = tls_test_main.cc | |
155a0dd7 ILT |
492 | tls_pic_test_DEPENDENCIES = gcctestdir/ld tls_test_pic.o tls_test_file2_pic.o \ |
493 | tls_test_c_pic.o | |
6eee141f | 494 | tls_pic_test_LDFLAGS = -Bgcctestdir/ |
155a0dd7 ILT |
495 | tls_pic_test_LDADD = tls_test_pic.o tls_test_file2_pic.o tls_test_c_pic.o \ |
496 | -lpthread | |
6eee141f | 497 | |
6eee141f ILT |
498 | tls_shared_test_SOURCES = tls_test_main.cc |
499 | tls_shared_test_DEPENDENCIES = gcctestdir/ld tls_test_shared.so | |
500 | tls_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
501 | tls_shared_test_LDADD = tls_test_shared.so -lpthread | |
502 | ||
c03c7692 ILT |
503 | tls_shared_ie_test_SOURCES = tls_test_main.cc |
504 | tls_shared_ie_test_DEPENDENCIES = gcctestdir/ld tls_test_ie_shared.so | |
505 | tls_shared_ie_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
506 | tls_shared_ie_test_LDADD = tls_test_ie_shared.so -lpthread | |
507 | ||
c2b45e22 | 508 | tls_shared_gd_to_ie_test_SOURCES = tls_test_main.cc |
155a0dd7 ILT |
509 | tls_shared_gd_to_ie_test_DEPENDENCIES = gcctestdir/ld tls_test_pic.o \ |
510 | tls_test_c_pic.o tls_test_shared2.so | |
c2b45e22 | 511 | tls_shared_gd_to_ie_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. |
155a0dd7 ILT |
512 | tls_shared_gd_to_ie_test_LDADD = tls_test_pic.o tls_test_c_pic.o \ |
513 | tls_test_shared2.so -lpthread | |
c2b45e22 CC |
514 | |
515 | if TLS_GNU2_DIALECT | |
516 | ||
517 | check_PROGRAMS += tls_shared_gnu2_gd_to_ie_test | |
518 | ||
519 | tls_test_gnu2.o: tls_test.cc | |
520 | $(CXXCOMPILE) -c -fpic -mtls-dialect=gnu2 -o $@ $< | |
521 | tls_test_file2_gnu2.o: tls_test_file2.cc | |
522 | $(CXXCOMPILE) -c -fpic -mtls-dialect=gnu2 -o $@ $< | |
155a0dd7 ILT |
523 | tls_test_c_gnu2.o: tls_test_c.c |
524 | $(COMPILE) -c -fpic -mtls-dialect=gnu2 $(TLS_TEST_C_CFLAGS) -o $@ $< | |
c2b45e22 CC |
525 | tls_test_gnu2_shared2.so: tls_test_file2_gnu2.o gcctestdir/ld |
526 | $(CXXLINK) -Bgcctestdir/ -shared tls_test_file2_gnu2.o | |
527 | ||
528 | tls_shared_gnu2_gd_to_ie_test_SOURCES = tls_test_main.cc | |
155a0dd7 ILT |
529 | tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES = gcctestdir/ld tls_test_gnu2.o \ |
530 | tls_test_c_gnu2.o tls_test_gnu2_shared2.so | |
c2b45e22 | 531 | tls_shared_gnu2_gd_to_ie_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. |
155a0dd7 ILT |
532 | tls_shared_gnu2_gd_to_ie_test_LDADD = tls_test_gnu2.o tls_test_c_gnu2.o \ |
533 | tls_test_gnu2_shared2.so -lpthread | |
c2b45e22 CC |
534 | |
535 | if TLS_DESCRIPTORS | |
536 | ||
537 | check_PROGRAMS += tls_shared_gnu2_test | |
538 | ||
155a0dd7 ILT |
539 | tls_test_gnu2_shared.so: tls_test_gnu2.o tls_test_file2_gnu2.o tls_test_c_gnu2.o gcctestdir/ld |
540 | $(CXXLINK) -Bgcctestdir/ -shared tls_test_gnu2.o tls_test_file2_gnu2.o tls_test_c_gnu2.o | |
c2b45e22 CC |
541 | |
542 | tls_shared_gnu2_test_SOURCES = tls_test_main.cc | |
543 | tls_shared_gnu2_test_DEPENDENCIES = gcctestdir/ld tls_test_gnu2_shared.so | |
544 | tls_shared_gnu2_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
545 | tls_shared_gnu2_test_LDADD = tls_test_gnu2_shared.so -lpthread | |
546 | ||
547 | endif TLS_DESCRIPTORS | |
548 | ||
549 | endif TLS_GNU2_DIALECT | |
550 | ||
351a8000 ILT |
551 | if STATIC_TLS |
552 | check_PROGRAMS += tls_static_test | |
553 | check_PROGRAMS += tls_static_pic_test | |
554 | ||
555 | tls_static_test_SOURCES = $(tls_test_SOURCES) | |
556 | tls_static_test_DEPENDENCIES = $(tls_test_DEPENDENCIES) | |
557 | tls_static_test_LDFLAGS = $(tls_test_LDFLAGS) -static | |
558 | tls_static_test_LDADD = $(tls_test_LDADD) | |
559 | ||
560 | tls_static_pic_test_SOURCES = $(tls_pic_test_SOURCES) | |
561 | tls_static_pic_test_DEPENDENCIES = $(tls_pic_test_DEPENDENCIES) | |
562 | tls_static_pic_test_LDFLAGS = $(tls_pic_test_LDFLAGS) -static | |
563 | tls_static_pic_test_LDADD = $(tls_pic_test_LDADD) | |
564 | endif | |
6eee141f ILT |
565 | |
566 | if FN_PTRS_IN_SO_WITHOUT_PIC | |
351a8000 | 567 | check_PROGRAMS += tls_shared_nonpic_test |
155a0dd7 ILT |
568 | tls_test_shared_nonpic.so: tls_test.o tls_test_file2.o tls_test_c.o gcctestdir/ld |
569 | $(CXXLINK) -Bgcctestdir/ -shared tls_test.o tls_test_file2.o tls_test_c.o | |
6eee141f ILT |
570 | |
571 | tls_shared_nonpic_test_SOURCES = tls_test_main.cc | |
572 | tls_shared_nonpic_test_DEPENDENCIES = gcctestdir/ld tls_test_shared_nonpic.so | |
573 | tls_shared_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
574 | tls_shared_nonpic_test_LDADD = tls_test_shared_nonpic.so -lpthread | |
351a8000 | 575 | endif FN_PTRS_IN_SO_WITHOUT_PIC |
6eee141f | 576 | |
351a8000 | 577 | endif TLS |
6eee141f | 578 | |
d491d34e ILT |
579 | check_PROGRAMS += many_sections_test |
580 | many_sections_test_SOURCES = many_sections_test.cc | |
581 | many_sections_test_DEPENDENCIES = gcctestdir/ld | |
582 | many_sections_test_LDFLAGS = -Bgcctestdir/ -rdynamic | |
583 | ||
584 | BUILT_SOURCES += many_sections_define.h | |
585 | many_sections_define.h: | |
586 | (for i in `seq 1 70000`; do \ | |
587 | echo "int var_$$i __attribute__((section(\"section_$$i\"))) = $$i;"; \ | |
588 | done) > [email protected] | |
589 | mv -f [email protected] $@ | |
590 | ||
591 | BUILT_SOURCES += many_sections_check.h | |
592 | many_sections_check.h: | |
4c94d6ae | 593 | (for i in `seq 1 1000 70000`; do \ |
d491d34e ILT |
594 | echo "assert(var_$$i == $$i);"; \ |
595 | done) > [email protected] | |
596 | mv -f [email protected] $@ | |
597 | ||
598 | check_PROGRAMS += many_sections_r_test | |
d491d34e ILT |
599 | many_sections_r_test.o: many_sections_test.o gcctestdir/ld |
600 | gcctestdir/ld -r -o $@ many_sections_test.o | |
7bc3e21a ILT |
601 | many_sections_r_test: many_sections_r_test.o gcctestdir/ld |
602 | $(CXXLINK) -Bgcctestdir/ many_sections_r_test.o $(LIBS) | |
6eee141f | 603 | |
2fd32231 ILT |
604 | if CONSTRUCTOR_PRIORITY |
605 | ||
606 | check_PROGRAMS += initpri1 | |
607 | initpri1_SOURCES = initpri1.c | |
608 | initpri1_DEPENDENCIES = gcctestdir/ld | |
609 | initpri1_LDFLAGS = -Bgcctestdir/ | |
610 | ||
611 | endif | |
612 | ||
613 | ||
351a8000 ILT |
614 | # Test --detect-odr-violations |
615 | check_SCRIPTS += debug_msg.sh | |
6eee141f | 616 | |
351a8000 ILT |
617 | # Create the data files that debug_msg.sh analyzes. |
618 | check_DATA += debug_msg.err | |
619 | MOSTLYCLEANFILES += debug_msg.err | |
620 | debug_msg.o: debug_msg.cc | |
621 | $(CXXCOMPILE) -O0 -g -c -w -o $@ $(srcdir)/debug_msg.cc | |
622 | odr_violation1.o: odr_violation1.cc | |
623 | $(CXXCOMPILE) -O0 -g -c -w -o $@ $(srcdir)/odr_violation1.cc | |
624 | odr_violation2.o: odr_violation2.cc | |
625 | $(CXXCOMPILE) -O0 -g -c -w -o $@ $(srcdir)/odr_violation2.cc | |
626 | debug_msg.err: debug_msg.o odr_violation1.o odr_violation2.o gcctestdir/ld | |
627 | @echo $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg debug_msg.o odr_violation1.o odr_violation2.o "2>$@" | |
628 | @if $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg debug_msg.o odr_violation1.o odr_violation2.o 2>$@; \ | |
629 | then \ | |
630 | echo 1>&2 "Link of debug_msg should have failed"; \ | |
631 | rm -f $@; \ | |
632 | exit 1; \ | |
633 | fi | |
634 | ||
635 | # See if we can also detect problems when we're linking .so's, not .o's. | |
636 | check_DATA += debug_msg_so.err | |
637 | MOSTLYCLEANFILES += debug_msg_so.err | |
638 | debug_msg.so: debug_msg.cc gcctestdir/ld | |
639 | $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -shared -fPIC -w -o $@ $(srcdir)/debug_msg.cc | |
640 | odr_violation1.so: odr_violation1.cc gcctestdir/ld | |
641 | $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -shared -fPIC -w -o $@ $(srcdir)/odr_violation1.cc | |
642 | odr_violation2.so: odr_violation2.cc gcctestdir/ld | |
643 | $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -shared -fPIC -w -o $@ $(srcdir)/odr_violation2.cc | |
644 | debug_msg_so.err: debug_msg.so odr_violation1.so odr_violation2.so gcctestdir/ld | |
645 | @echo $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_so debug_msg.so odr_violation1.so odr_violation2.so "2>$@" | |
646 | @if $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_so debug_msg.so odr_violation1.so odr_violation2.so 2>$@; \ | |
647 | then \ | |
648 | echo 1>&2 "Link of debug_msg_so should have failed"; \ | |
649 | rm -f $@; \ | |
650 | exit 1; \ | |
651 | fi | |
652 | ||
653 | # We also want to make sure we do something reasonable when there's no | |
654 | # debug info available. For the best test, we use .so's. | |
655 | check_DATA += debug_msg_ndebug.err | |
656 | MOSTLYCLEANFILES += debug_msg_ndebug.err | |
657 | debug_msg_ndebug.so: debug_msg.cc gcctestdir/ld | |
658 | $(CXXCOMPILE) -Bgcctestdir/ -O0 -g0 -shared -fPIC -w -o $@ $(srcdir)/debug_msg.cc | |
659 | odr_violation1_ndebug.so: odr_violation1.cc gcctestdir/ld | |
660 | $(CXXCOMPILE) -Bgcctestdir/ -O0 -g0 -shared -fPIC -w -o $@ $(srcdir)/odr_violation1.cc | |
661 | odr_violation2_ndebug.so: odr_violation2.cc gcctestdir/ld | |
662 | $(CXXCOMPILE) -Bgcctestdir/ -O0 -g0 -shared -fPIC -w -o $@ $(srcdir)/odr_violation2.cc | |
663 | debug_msg_ndebug.err: debug_msg_ndebug.so odr_violation1_ndebug.so odr_violation2_ndebug.so gcctestdir/ld | |
664 | @echo $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_ndebug debug_msg_ndebug.so odr_violation1_ndebug.so odr_violation2_ndebug.so "2>$@" | |
665 | @if $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_ndebug debug_msg_ndebug.so odr_violation1_ndebug.so odr_violation2_ndebug.so 2>$@; \ | |
666 | then \ | |
667 | echo 1>&2 "Link of debug_msg_ndebug should have failed"; \ | |
668 | rm -f $@; \ | |
669 | exit 1; \ | |
670 | fi | |
671 | ||
672 | ||
673 | # Similar to --detect-odr-violations: check for undefined symbols in .so's | |
674 | check_SCRIPTS += undef_symbol.sh | |
675 | check_DATA += undef_symbol.err | |
676 | MOSTLYCLEANFILES += undef_symbol.err | |
677 | undef_symbol.o: undef_symbol.cc | |
678 | $(CXXCOMPILE) -O0 -g -c -fPIC $< | |
679 | undef_symbol.so: undef_symbol.o gcctestdir/ld | |
680 | $(CXXLINK) -Bgcctestdir/ -shared undef_symbol.o | |
681 | undef_symbol.err: undef_symbol_main.o undef_symbol.so gcctestdir/ld | |
682 | @echo $(CXXLINK) -Bgcctestdir/ -o undef_symbol_test undef_symbol_main.o undef_symbol.so "2>$@" | |
683 | @if $(CXXLINK) -Bgcctestdir/ -o undef_symbol_test undef_symbol_main.o undef_symbol.so 2>$@; \ | |
684 | then \ | |
685 | echo 1>&2 "Link of undef_symbol_test should have failed"; \ | |
686 | rm -f $@; \ | |
687 | exit 1; \ | |
688 | fi | |
689 | ||
690 | ||
351a8000 ILT |
691 | # Test -o when emitting to a special file (such as something in /dev). |
692 | check_PROGRAMS += flagstest_o_specialfile | |
0e470e5c | 693 | flagstest_o_specialfile: flagstest_debug.o gcctestdir/ld |
351a8000 ILT |
694 | $(CXXLINK) -Bgcctestdir/ -o /dev/stdout $< 2>&1 | cat > $@ |
695 | chmod a+x $@ | |
696 | test -s $@ | |
697 | ||
7fcd0256 ILT |
698 | if HAVE_ZLIB |
699 | ||
700 | # Test --compress-debug-sections. FIXME: check we actually compress. | |
701 | check_PROGRAMS += flagstest_compress_debug_sections | |
702 | flagstest_compress_debug_sections: flagstest_debug.o gcctestdir/ld | |
703 | $(CXXLINK) -Bgcctestdir/ -o $@ $< -Wl,--compress-debug-sections=zlib | |
704 | test -s $@ | |
705 | ||
706 | ||
351a8000 ILT |
707 | # The specialfile output has a tricky case when we also compress debug |
708 | # sections, because it requires output-file resizing. | |
709 | check_PROGRAMS += flagstest_o_specialfile_and_compress_debug_sections | |
0e470e5c ILT |
710 | flagstest_o_specialfile_and_compress_debug_sections: flagstest_debug.o \ |
711 | gcctestdir/ld | |
126f3ece | 712 | $(CXXLINK) -Bgcctestdir/ -o /dev/stdout $< -Wl,--compress-debug-sections=zlib 2>&1 | cat > $@ |
351a8000 ILT |
713 | chmod a+x $@ |
714 | test -s $@ | |
715 | ||
7fcd0256 ILT |
716 | endif HAVE_ZLIB |
717 | ||
99f8faca ILT |
718 | # Test symbol versioning. |
719 | check_PROGRAMS += ver_test | |
720 | ver_test_SOURCES = ver_test_main.cc | |
721 | ver_test_DEPENDENCIES = gcctestdir/ld ver_test_1.so ver_test_2.so ver_test_4.so | |
722 | ver_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
723 | ver_test_LDADD = ver_test_1.so ver_test_2.so ver_test_4.so | |
724 | ver_test_1.so: ver_test_1.o ver_test_2.so ver_test_3.o ver_test_4.so gcctestdir/ld | |
725 | $(CXXLINK) -Bgcctestdir/ -shared ver_test_1.o ver_test_2.so ver_test_3.o ver_test_4.so | |
09124467 ILT |
726 | ver_test_2.so: ver_test_2.o $(srcdir)/ver_test_2.script ver_test_4.so gcctestdir/ld |
727 | $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_2.script ver_test_2.o ver_test_4.so | |
728 | ver_test_4.so: ver_test_4.o $(srcdir)/ver_test_4.script gcctestdir/ld | |
729 | $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_4.script ver_test_4.o | |
99f8faca ILT |
730 | ver_test_1.o: ver_test_1.cc |
731 | $(CXXCOMPILE) -c -fpic -o $@ $< | |
732 | ver_test_2.o: ver_test_2.cc | |
733 | $(CXXCOMPILE) -c -fpic -o $@ $< | |
734 | ver_test_3.o: ver_test_3.cc | |
735 | $(CXXCOMPILE) -c -fpic -o $@ $< | |
736 | ver_test_4.o: ver_test_4.cc | |
737 | $(CXXCOMPILE) -c -fpic -o $@ $< | |
351a8000 | 738 | |
be3e6201 ILT |
739 | check_PROGRAMS += ver_test_2 |
740 | ver_test_2_SOURCES = ver_test_main_2.cc | |
741 | ver_test_2_DEPENDENCIES = gcctestdir/ld ver_test_4.so ver_test_2.so | |
742 | ver_test_2_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
743 | ver_test_2_LDADD = ver_test_4.so ver_test_2.so | |
744 | ||
be3e6201 ILT |
745 | check_SCRIPTS += ver_test_2.sh |
746 | check_DATA += ver_test_2.syms | |
747 | ver_test_2.syms: ver_test_2 | |
6835af53 | 748 | $(TEST_READELF) -s $< >$@ 2>/dev/null |
be3e6201 | 749 | |
686c8caf ILT |
750 | check_SCRIPTS += ver_test_4.sh |
751 | check_DATA += ver_test_4.syms | |
752 | ver_test_4.syms: ver_test_4.so | |
6835af53 | 753 | $(TEST_READELF) -s $< >$@ 2>/dev/null |
5871526f ILT |
754 | |
755 | ver_test_5.so: ver_test_5.o $(srcdir)/ver_test_5.script ver_test_4.so gcctestdir/ld | |
756 | $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_5.script ver_test_5.o ver_test_4.so | |
757 | ver_test_5.o: ver_test_5.cc | |
758 | $(CXXCOMPILE) -c -fpic -o $@ $< | |
759 | check_SCRIPTS += ver_test_5.sh | |
760 | check_DATA += ver_test_5.syms | |
761 | ver_test_5.syms: ver_test_5.so | |
6835af53 | 762 | $(TEST_READELF) -s $< >$@ 2>/dev/null |
5871526f | 763 | |
18e6b24e ILT |
764 | check_PROGRAMS += ver_test_6 |
765 | ver_test_6_SOURCES = ver_test_6.c | |
766 | ver_test_6_DEPENDENCIES = gcctestdir/ld ver_test_2.so | |
767 | ver_test_6_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
768 | ver_test_6_LDADD = ver_test_2.so | |
769 | ||
479f6503 ILT |
770 | ver_test_7.so: ver_test_4.o $(srcdir)/ver_test_4.script ver_test_7.o gcctestdir/ld |
771 | $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_4.script ver_test_4.o ver_test_7.o | |
772 | ver_test_7.o: ver_test_7.cc | |
773 | $(CXXCOMPILE) -c -fpic -o $@ $< | |
774 | check_SCRIPTS += ver_test_7.sh | |
775 | check_DATA += ver_test_7.syms | |
776 | ver_test_7.syms: ver_test_7.so | |
6835af53 | 777 | $(TEST_READELF) -s $< >$@ 2>/dev/null |
479f6503 | 778 | |
75517b77 ILT |
779 | check_PROGRAMS += ver_test_8 |
780 | ver_test_8_SOURCES = two_file_test_main.cc | |
781 | ver_test_8_DEPENDENCIES = gcctestdir/ld ver_test_8_1.so ver_test_8_2.so | |
782 | ver_test_8_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
783 | ver_test_8_LDADD = ver_test_8_1.so ver_test_8_2.so | |
784 | ver_test_8_1.so: two_file_test_1_pic.o two_file_test_1b_pic.o ver_test_8_2.so gcctestdir/ld | |
785 | $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1_pic.o two_file_test_1b_pic.o ver_test_8_2.so | |
786 | ver_test_8_2.so: two_file_test_2_pic.o $(srcdir)/ver_test_8.script gcctestdir/ld | |
787 | $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_8.script two_file_test_2_pic.o | |
788 | ||
95d14cd3 ILT |
789 | check_PROGRAMS += ver_test_9 |
790 | ver_test_9_SOURCES = ver_test_main.cc | |
791 | ver_test_9_DEPENDENCIES = gcctestdir/ld ver_test_9.so | |
792 | ver_test_9_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
793 | ver_test_9_LDADD = ver_test_9.so | |
794 | ver_test_9.so: ver_test_9.o ver_test_4.so ver_test_5.so gcctestdir/ld | |
795 | $(CXXLINK) -Bgcctestdir/ -shared ver_test_9.o ver_test_5.so ver_test_4.so | |
796 | ver_test_9.o: ver_test_9.cc | |
797 | $(CXXCOMPILE) -c -fpic -o $@ $< | |
798 | ||
057ead22 ILT |
799 | check_SCRIPTS += ver_test_10.sh |
800 | check_DATA += ver_test_10.syms | |
801 | ver_test_10.syms: ver_test_10.so | |
802 | $(TEST_READELF) -s $< >$@ 2>/dev/null | |
803 | ver_test_10.so: gcctestdir/ld ver_test_2.o ver_test_10.script | |
804 | $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_10.script ver_test_2.o | |
805 | ||
8bdcdf2c ILT |
806 | check_PROGRAMS += protected_1 |
807 | protected_1_SOURCES = \ | |
808 | protected_main_1.cc protected_main_2.cc protected_main_3.cc | |
809 | protected_1_DEPENDENCIES = gcctestdir/ld protected_1.so | |
810 | protected_1_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
811 | protected_1_LDADD = protected_1.so | |
812 | ||
813 | protected_1.so: gcctestdir/ld protected_1_pic.o protected_2_pic.o protected_3_pic.o | |
814 | $(CXXLINK) -Bgcctestdir/ -shared protected_1_pic.o protected_2_pic.o protected_3_pic.o | |
815 | protected_1_pic.o: protected_1.cc | |
816 | $(CXXCOMPILE) -c -fpic -o $@ $< | |
817 | protected_2_pic.o: protected_2.cc | |
818 | $(CXXCOMPILE) -c -fpic -o $@ $< | |
819 | protected_3_pic.o: protected_3.cc | |
820 | $(CXXCOMPILE) -c -fpic -o $@ $< | |
821 | ||
822 | check_PROGRAMS += protected_2 | |
823 | protected_2_SOURCES = protected_main_1.cc protected_3.cc | |
824 | protected_2_DEPENDENCIES = gcctestdir/ld protected_1.so | |
825 | protected_2_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
826 | protected_2_LDADD = protected_1.so | |
827 | ||
9f1d377b ILT |
828 | check_PROGRAMS += relro_test |
829 | relro_test_SOURCES = relro_test_main.cc | |
830 | relro_test_DEPENDENCIES = gcctestdir/ld relro_test.so | |
831 | relro_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
832 | relro_test_LDADD = relro_test.so | |
833 | relro_test.so: gcctestdir/ld relro_test_pic.o | |
834 | $(CXXLINK) -Bgcctestdir/ -shared -Wl,-z,relro relro_test_pic.o | |
835 | relro_test_pic.o: relro_test.cc | |
836 | $(CXXCOMPILE) -c -fpic -o $@ $< | |
837 | ||
2d924fd9 ILT |
838 | check_PROGRAMS += relro_script_test |
839 | relro_script_test_SOURCES = relro_test_main.cc | |
840 | relro_script_test_DEPENDENCIES = gcctestdir/ld relro_script_test.so | |
841 | relro_script_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
842 | relro_script_test_LDADD = relro_script_test.so | |
843 | relro_script_test.so: gcctestdir/ld relro_script_test.t relro_test_pic.o | |
844 | $(CXXLINK) -Bgcctestdir/ -shared -Wl,-z,relro -T $(srcdir)/relro_script_test.t relro_test_pic.o | |
845 | ||
e5756efb ILT |
846 | check_PROGRAMS += script_test_1 |
847 | script_test_1_SOURCES = script_test_1.cc | |
848 | script_test_1_DEPENDENCIES = gcctestdir/ld script_test_1.t | |
849 | script_test_1_LDFLAGS = -Bgcctestdir/ -Wl,-R,. -T $(srcdir)/script_test_1.t | |
850 | ||
a445fddf ILT |
851 | check_PROGRAMS += script_test_2 |
852 | script_test_2_SOURCES = script_test_2.cc script_test_2a.cc script_test_2b.cc | |
853 | script_test_2_DEPENDENCIES = gcctestdir/ld script_test_2.t | |
854 | script_test_2_LDFLAGS = -Bgcctestdir/ -Wl,-R,. -T $(srcdir)/script_test_2.t | |
855 | ||
88dd47ac ILT |
856 | check_PROGRAMS += justsyms |
857 | justsyms_SOURCES = justsyms_1.cc | |
858 | justsyms_DEPENDENCIES = gcctestdir/ld justsyms_2r.o | |
859 | justsyms_LDFLAGS = -Bgcctestdir/ -Wl,-R,justsyms_2r.o | |
860 | justsyms_2.o: justsyms_2.cc | |
861 | $(CXXCOMPILE) -c -o $@ $< | |
83bfb6b7 | 862 | justsyms_2r.o: justsyms_2.o gcctestdir/ld $(srcdir)/justsyms.t |
88dd47ac ILT |
863 | gcctestdir/ld -o $@ -r -T $(srcdir)/justsyms.t justsyms_2.o |
864 | ||
bc644c6c ILT |
865 | check_PROGRAMS += binary_test |
866 | binary_test_SOURCES = binary_test.cc | |
867 | binary_test_DEPENDENCIES = gcctestdir/ld binary.txt | |
868 | binary_test_LDFLAGS = -Bgcctestdir/ -Wl,--format,binary,binary.txt,--format,elf | |
869 | # Copy the file to the build directory to avoid worrying about the | |
870 | # full pathname in the generated symbols. | |
871 | binary.txt: $(srcdir)/binary.in | |
872 | rm -f $@ | |
873 | $(LN_S) $< $@ | |
874 | ||
09124467 ILT |
875 | check_SCRIPTS += ver_matching_test.sh |
876 | check_DATA += ver_matching_test.stdout | |
877 | MOSTLYCLEANFILES += ver_matching_test.stdout | |
878 | ver_matching_def.so: ver_matching_def.cc gcctestdir/ld | |
879 | $(CXXLINK) -O0 -Bgcctestdir/ -shared $(srcdir)/ver_matching_def.cc -Wl,--version-script=$(srcdir)/version_script.map | |
880 | ver_matching_test.stdout: ver_matching_def.so | |
6835af53 | 881 | $(TEST_OBJDUMP) -T ver_matching_def.so | $(TEST_CXXFILT) > ver_matching_test.stdout |
1c4f3631 ILT |
882 | |
883 | check_PROGRAMS += script_test_3 | |
884 | check_SCRIPTS += script_test_3.sh | |
885 | check_DATA += script_test_3.stdout | |
886 | MOSTLYCLEANFILES += script_test_3.stdout | |
887 | script_test_3: basic_test.o gcctestdir/ld script_test_3.t | |
888 | $(CXXLINK) -Bgcctestdir/ basic_test.o -T $(srcdir)/script_test_3.t | |
889 | script_test_3.stdout: script_test_3 | |
2cefc357 | 890 | $(TEST_READELF) -SlW script_test_3 > script_test_3.stdout |
09124467 | 891 | |
e6188289 ILT |
892 | check_SCRIPTS += script_test_4.sh |
893 | check_DATA += script_test_4.stdout | |
894 | MOSTLYCLEANFILES += script_test_4.stdout | |
895 | script_test_4: basic_test.o gcctestdir/ld $(srcdir)/script_test_4.t | |
896 | $(CXXLINK) -Bgcctestdir/ basic_test.o -T $(srcdir)/script_test_4.t | |
897 | script_test_4.stdout: script_test_4 | |
898 | $(TEST_READELF) -SlW script_test_4 > script_test_4.stdout | |
899 | ||
351a8000 ILT |
900 | endif GCC |
901 | endif NATIVE_LINKER |