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 ILT |
15 | -I$(srcdir) -I$(srcdir)/.. -I$(srcdir)/../../include \ |
16 | -I$(srcdir)/../../elfcpp \ | |
17 | -DLOCALEDIR="\"$(datadir)/locale\"" \ | |
18 | @INCINTL@ | |
19 | ||
fe9a4c12 ILT |
20 | if THREADS |
21 | THREADSLIB = -lpthread | |
22 | endif | |
23 | ||
351a8000 ILT |
24 | # 'make clean' is good about deleting some intermediate files (such as |
25 | # .o's), but not all of them (such as .so's and .err files). We | |
26 | # improve on that here. automake-1.9 info docs say "mostlyclean" is | |
27 | # the right choice for files 'make' builds that people rebuild. | |
28 | MOSTLYCLEANFILES = *.so | |
6eee141f | 29 | |
6eee141f | 30 | |
351a8000 ILT |
31 | # We will add to these later, for each individual test. Note |
32 | # that we add each test under check_SCRIPTS or check_PROGRAMS; | |
33 | # the TESTS variable is automatically populated from these. | |
34 | check_SCRIPTS = | |
35 | check_DATA = | |
36 | check_PROGRAMS = | |
37 | TESTS = $(check_SCRIPTS) $(check_PROGRAMS) | |
22dc1b09 | 38 | |
351a8000 ILT |
39 | # --------------------------------------------------------------------- |
40 | # These tests test the internals of gold (unittests). | |
5a6f7e2d | 41 | |
351a8000 | 42 | # Infrastucture needed for the unittests |
5a6f7e2d ILT |
43 | check_LIBRARIES = libgoldtest.a |
44 | libgoldtest_a_SOURCES = test.cc testmain.cc testfile.cc | |
45 | ||
ad2d6943 ILT |
46 | DEPENDENCIES = \ |
47 | libgoldtest.a ../libgold.a ../../libiberty/libiberty.a $(LIBINTL_DEP) | |
fe9a4c12 ILT |
48 | LDADD = libgoldtest.a ../libgold.a ../../libiberty/libiberty.a $(LIBINTL) \ |
49 | $(THREADSLIB) | |
5a6f7e2d | 50 | |
5a6f7e2d | 51 | |
351a8000 ILT |
52 | # The unittests themselves |
53 | check_PROGRAMS += object_unittest | |
5a6f7e2d | 54 | object_unittest_SOURCES = object_unittest.cc |
22dc1b09 | 55 | |
351a8000 ILT |
56 | |
57 | # --------------------------------------------------------------------- | |
58 | # These tests test the output of gold (end-to-end tests). In | |
59 | # particular, they make sure that gold can link "difficult" object | |
60 | # files, and the resulting object files run correctly. These can only | |
61 | # run if we've built ld-new for the native architecture (that is, | |
62 | # we're not cross-compiling it), since we run ld-new as part of these | |
63 | # tests. We use the gcc-specific flag '-B' to use our linker instead | |
64 | # of the default linker, which is why we only run our tests under gcc. | |
a360aedd | 65 | |
e2827e5f | 66 | if NATIVE_LINKER |
351a8000 | 67 | if GCC |
e2827e5f | 68 | |
351a8000 ILT |
69 | # Infrastucture needed for the unittests: a directory where the linker |
70 | # is named 'ld'. This is because the -B flag appends 'ld' to its arg. | |
e2827e5f ILT |
71 | gcctestdir/ld: ../ld-new |
72 | test -d gcctestdir || mkdir -p gcctestdir | |
73 | rm -f gcctestdir/ld | |
74 | (cd gcctestdir && $(LN_S) ../../ld-new ld) | |
75 | ||
351a8000 ILT |
76 | # Each of these .o's is a useful, small complete program. They're |
77 | # particularly useful for making sure ld-new's flags do what they're | |
78 | # supposed to (hence their names), but are used for many tests that | |
79 | # don't actually involve analyzing input data. | |
43771f76 ILT |
80 | flagstest_debug.o: constructor_test.cc |
81 | $(CXXCOMPILE) -O0 -g -c -o $@ $< | |
82 | flagstest_ndebug.o: constructor_test.cc | |
83 | $(CXXCOMPILE) -O0 -c -o $@ $< | |
84 | ||
43771f76 | 85 | |
351a8000 ILT |
86 | check_PROGRAMS += basic_test |
87 | check_PROGRAMS += basic_static_test | |
88 | check_PROGRAMS += basic_pic_test | |
89 | check_PROGRAMS += basic_static_pic_test | |
56ba9a23 | 90 | basic_test.o: basic_test.cc |
22dc1b09 | 91 | $(CXXCOMPILE) -O0 -c -o $@ $< |
56ba9a23 ILT |
92 | basic_test: basic_test.o gcctestdir/ld |
93 | $(CXXLINK) -Bgcctestdir/ basic_test.o | |
94 | basic_static_test: basic_test.o gcctestdir/ld | |
95 | $(CXXLINK) -Bgcctestdir/ -static basic_test.o | |
22dc1b09 | 96 | |
56ba9a23 | 97 | basic_pic_test.o: basic_test.cc |
22dc1b09 | 98 | $(CXXCOMPILE) -O0 -c -fpic -o $@ $< |
56ba9a23 ILT |
99 | basic_pic_test: basic_pic_test.o gcctestdir/ld |
100 | $(CXXLINK) -Bgcctestdir/ basic_pic_test.o | |
101 | basic_static_pic_test: basic_pic_test.o gcctestdir/ld | |
102 | $(CXXLINK) -Bgcctestdir/ -static basic_pic_test.o | |
22dc1b09 | 103 | |
351a8000 ILT |
104 | |
105 | check_PROGRAMS += constructor_test | |
106 | check_PROGRAMS += constructor_static_test | |
d5026652 ILT |
107 | constructor_test_SOURCES = constructor_test.cc |
108 | constructor_test_DEPENDENCIES = gcctestdir/ld | |
109 | constructor_test_LDFLAGS = -Bgcctestdir/ | |
110 | ||
351a8000 ILT |
111 | constructor_static_test_SOURCES = $(constructor_test_SOURCES) |
112 | constructor_static_test_DEPENDENCIES = $(constructor_test_DEPENDENCIES) | |
113 | constructor_static_test_LDFLAGS = $(constructor_test_LDFLAGS) -static | |
cb615bc1 | 114 | |
351a8000 ILT |
115 | |
116 | check_PROGRAMS += two_file_test | |
117 | check_PROGRAMS += two_file_static_test | |
118 | check_PROGRAMS += two_file_pic_test | |
3bd52c28 ILT |
119 | two_file_test_SOURCES = \ |
120 | two_file_test_1.cc \ | |
03e8f2b2 | 121 | two_file_test_1b.cc \ |
3bd52c28 ILT |
122 | two_file_test_2.cc \ |
123 | two_file_test_main.cc \ | |
124 | two_file_test.h | |
125 | two_file_test_DEPENDENCIES = gcctestdir/ld | |
126 | two_file_test_LDFLAGS = -Bgcctestdir/ | |
127 | ||
351a8000 ILT |
128 | two_file_static_test_SOURCES = $(two_file_test_SOURCES) |
129 | two_file_static_test_DEPENDENCIES = $(two_file_test_DEPENDENCIES) | |
130 | two_file_static_test_LDFLAGS = $(two_file_test_LDFLAGS) -static | |
f958d5fc ILT |
131 | |
132 | two_file_pic_test_SOURCES = two_file_test_main.cc | |
133 | two_file_pic_test_DEPENDENCIES = \ | |
03e8f2b2 | 134 | gcctestdir/ld two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o |
f958d5fc | 135 | two_file_pic_test_LDFLAGS = -Bgcctestdir/ |
03e8f2b2 | 136 | two_file_pic_test_LDADD = two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o |
f958d5fc | 137 | |
351a8000 ILT |
138 | |
139 | check_PROGRAMS += two_file_shared_1_test | |
140 | check_PROGRAMS += two_file_shared_2_test | |
141 | check_PROGRAMS += two_file_shared_1_pic_2_test | |
142 | check_PROGRAMS += two_file_shared_2_pic_1_test | |
143 | check_PROGRAMS += two_file_same_shared_test | |
144 | check_PROGRAMS += two_file_separate_shared_12_test | |
145 | check_PROGRAMS += two_file_separate_shared_21_test | |
146 | two_file_test_1_pic.o: two_file_test_1.cc | |
147 | $(CXXCOMPILE) -c -fpic -o $@ $< | |
03e8f2b2 ILT |
148 | two_file_test_1b_pic.o: two_file_test_1b.cc |
149 | $(CXXCOMPILE) -c -fpic -o $@ $< | |
351a8000 ILT |
150 | two_file_test_2_pic.o: two_file_test_2.cc |
151 | $(CXXCOMPILE) -c -fpic -o $@ $< | |
03e8f2b2 ILT |
152 | two_file_shared_1.so: two_file_test_1_pic.o two_file_test_1b_pic.o gcctestdir/ld |
153 | $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1_pic.o two_file_test_1b_pic.o | |
351a8000 ILT |
154 | two_file_shared_2.so: two_file_test_2_pic.o gcctestdir/ld |
155 | $(CXXLINK) -Bgcctestdir/ -shared two_file_test_2_pic.o | |
03e8f2b2 ILT |
156 | two_file_shared.so: two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o gcctestdir/ld |
157 | $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o | |
351a8000 | 158 | |
3bd52c28 ILT |
159 | two_file_shared_1_test_SOURCES = two_file_test_2.cc two_file_test_main.cc |
160 | two_file_shared_1_test_DEPENDENCIES = gcctestdir/ld two_file_shared_1.so | |
161 | two_file_shared_1_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
162 | two_file_shared_1_test_LDADD = two_file_shared_1.so | |
163 | ||
03e8f2b2 | 164 | two_file_shared_2_test_SOURCES = two_file_test_1.cc two_file_test_1b.cc two_file_test_main.cc |
3bd52c28 ILT |
165 | two_file_shared_2_test_DEPENDENCIES = gcctestdir/ld two_file_shared_2.so |
166 | two_file_shared_2_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
167 | two_file_shared_2_test_LDADD = two_file_shared_2.so | |
168 | ||
386c048c ILT |
169 | two_file_shared_1_pic_2_test_SOURCES = two_file_test_main.cc |
170 | two_file_shared_1_pic_2_test_DEPENDENCIES = \ | |
03e8f2b2 | 171 | gcctestdir/ld two_file_shared_1.so two_file_test_1_pic.o two_file_test_1b_pic.o |
386c048c | 172 | two_file_shared_1_pic_2_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. |
03e8f2b2 | 173 | 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 |
174 | |
175 | two_file_shared_2_pic_1_test_SOURCES = two_file_test_main.cc | |
176 | two_file_shared_2_pic_1_test_DEPENDENCIES = \ | |
177 | gcctestdir/ld two_file_shared_2.so two_file_test_2_pic.o | |
178 | two_file_shared_2_pic_1_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
179 | two_file_shared_2_pic_1_test_LDADD = two_file_test_2_pic.o two_file_shared_1.so | |
180 | ||
3bd52c28 ILT |
181 | two_file_same_shared_test_SOURCES = two_file_test_main.cc |
182 | two_file_same_shared_test_DEPENDENCIES = gcctestdir/ld two_file_shared.so | |
183 | two_file_same_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
184 | two_file_same_shared_test_LDADD = two_file_shared.so | |
185 | ||
186 | two_file_separate_shared_12_test_SOURCES = two_file_test_main.cc | |
187 | two_file_separate_shared_12_test_DEPENDENCIES = \ | |
188 | gcctestdir/ld two_file_shared_1.so two_file_shared_2.so | |
189 | two_file_separate_shared_12_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
190 | two_file_separate_shared_12_test_LDADD = \ | |
191 | two_file_shared_1.so two_file_shared_2.so | |
192 | ||
193 | two_file_separate_shared_21_test_SOURCES = two_file_test_main.cc | |
194 | two_file_separate_shared_21_test_DEPENDENCIES = \ | |
195 | gcctestdir/ld two_file_shared_1.so two_file_shared_2.so | |
196 | two_file_separate_shared_21_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
197 | two_file_separate_shared_21_test_LDADD = \ | |
198 | two_file_shared_2.so two_file_shared_1.so | |
199 | ||
6a74a719 ILT |
200 | check_PROGRAMS += two_file_relocatable_test |
201 | two_file_relocatable_test_SOURCES = two_file_test_main.cc | |
202 | two_file_relocatable_test_DEPENDENCIES = \ | |
203 | gcctestdir/ld two_file_relocatable.o | |
204 | two_file_relocatable_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
205 | two_file_relocatable_test_LDADD = two_file_relocatable.o | |
206 | two_file_relocatable.o: gcctestdir/ld two_file_test_1.o two_file_test_1b.o two_file_test_2.o | |
207 | gcctestdir/ld -r -o $@ two_file_test_1.o two_file_test_1b.o two_file_test_2.o | |
208 | ||
63402fe4 ILT |
209 | # The nonpic tests will fail on platforms which can not put non-PIC |
210 | # code into shared libraries, so we just don't run them in that case. | |
63402fe4 | 211 | if FN_PTRS_IN_SO_WITHOUT_PIC |
3bd52c28 | 212 | |
351a8000 ILT |
213 | check_PROGRAMS += two_file_shared_1_nonpic_test |
214 | check_PROGRAMS += two_file_shared_2_nonpic_test | |
215 | check_PROGRAMS += two_file_same_shared_nonpic_test | |
216 | check_PROGRAMS += two_file_separate_shared_12_nonpic_test | |
217 | check_PROGRAMS += two_file_separate_shared_21_nonpic_test | |
03e8f2b2 ILT |
218 | check_PROGRAMS += two_file_mixed_shared_test |
219 | check_PROGRAMS += two_file_mixed_2_shared_test | |
351a8000 | 220 | two_file_shared_1_nonpic.so: two_file_test_1.o gcctestdir/ld |
03e8f2b2 | 221 | $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1.o two_file_test_1b.o |
351a8000 ILT |
222 | two_file_shared_2_nonpic.so: two_file_test_2.o gcctestdir/ld |
223 | $(CXXLINK) -Bgcctestdir/ -shared two_file_test_2.o | |
03e8f2b2 ILT |
224 | two_file_shared_nonpic.so: two_file_test_1.o two_file_test_1b.o two_file_test_2.o gcctestdir/ld |
225 | $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1.o two_file_test_1b.o two_file_test_2.o | |
226 | two_file_shared_mixed.so: two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2.o gcctestdir/ld | |
227 | $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2.o | |
228 | two_file_shared_mixed_1.so: two_file_test_1.o two_file_test_1b_pic.o two_file_shared_2.so gcctestdir/ld | |
229 | $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1.o two_file_test_1b_pic.o two_file_shared_2.so | |
351a8000 | 230 | |
3bd52c28 ILT |
231 | two_file_shared_1_nonpic_test_SOURCES = \ |
232 | two_file_test_2.cc two_file_test_main.cc | |
233 | two_file_shared_1_nonpic_test_DEPENDENCIES = \ | |
234 | gcctestdir/ld two_file_shared_1_nonpic.so | |
235 | two_file_shared_1_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
236 | two_file_shared_1_nonpic_test_LDADD = two_file_shared_1_nonpic.so | |
237 | ||
238 | two_file_shared_2_nonpic_test_SOURCES = \ | |
03e8f2b2 | 239 | two_file_test_1.cc two_file_test_1b.cc two_file_test_main.cc |
3bd52c28 ILT |
240 | two_file_shared_2_nonpic_test_DEPENDENCIES = \ |
241 | gcctestdir/ld two_file_shared_2_nonpic.so | |
242 | two_file_shared_2_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
243 | two_file_shared_2_nonpic_test_LDADD = two_file_shared_2_nonpic.so | |
244 | ||
245 | two_file_same_shared_nonpic_test_SOURCES = two_file_test_main.cc | |
246 | two_file_same_shared_nonpic_test_DEPENDENCIES = \ | |
247 | gcctestdir/ld two_file_shared_nonpic.so | |
248 | two_file_same_shared_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
249 | two_file_same_shared_nonpic_test_LDADD = two_file_shared_nonpic.so | |
250 | ||
251 | two_file_separate_shared_12_nonpic_test_SOURCES = two_file_test_main.cc | |
252 | two_file_separate_shared_12_nonpic_test_DEPENDENCIES = \ | |
253 | gcctestdir/ld two_file_shared_1_nonpic.so two_file_shared_2_nonpic.so | |
254 | two_file_separate_shared_12_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
255 | two_file_separate_shared_12_nonpic_test_LDADD = \ | |
256 | two_file_shared_1_nonpic.so two_file_shared_2_nonpic.so | |
257 | ||
258 | two_file_separate_shared_21_nonpic_test_SOURCES = two_file_test_main.cc | |
259 | two_file_separate_shared_21_nonpic_test_DEPENDENCIES = \ | |
260 | gcctestdir/ld two_file_shared_1_nonpic.so two_file_shared_2_nonpic.so | |
261 | two_file_separate_shared_21_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
262 | two_file_separate_shared_21_nonpic_test_LDADD = \ | |
263 | two_file_shared_2_nonpic.so two_file_shared_1_nonpic.so | |
264 | ||
03e8f2b2 ILT |
265 | two_file_mixed_shared_test_SOURCES = two_file_test_main.cc |
266 | two_file_mixed_shared_test_DEPENDENCIES = gcctestdir/ld two_file_shared_mixed.so | |
267 | two_file_mixed_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
268 | two_file_mixed_shared_test_LDADD = two_file_shared_mixed.so | |
269 | ||
270 | two_file_mixed_2_shared_test_SOURCES = two_file_test_main.cc | |
271 | two_file_mixed_2_shared_test_DEPENDENCIES = gcctestdir/ld two_file_shared_mixed_1.so two_file_shared_2.so | |
272 | two_file_mixed_2_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
273 | two_file_mixed_2_shared_test_LDADD = two_file_shared_mixed_1.so two_file_shared_2.so | |
274 | ||
351a8000 | 275 | endif FN_PTRS_IN_SO_WITHOUT_PIC |
3bd52c28 | 276 | |
351a8000 ILT |
277 | |
278 | check_PROGRAMS += exception_test | |
279 | check_PROGRAMS += exception_static_test | |
280 | check_PROGRAMS += exception_shared_1_test | |
281 | check_PROGRAMS += exception_shared_2_test | |
282 | check_PROGRAMS += exception_same_shared_test | |
283 | check_PROGRAMS += exception_separate_shared_12_test | |
284 | check_PROGRAMS += exception_separate_shared_21_test | |
285 | exception_test_1_pic.o: exception_test_1.cc | |
286 | $(CXXCOMPILE) -c -fpic -o $@ $< | |
287 | exception_test_2_pic.o: exception_test_2.cc | |
288 | $(CXXCOMPILE) -c -fpic -o $@ $< | |
289 | exception_shared_1.so: exception_test_1_pic.o gcctestdir/ld | |
290 | $(CXXLINK) -Bgcctestdir/ -shared exception_test_1_pic.o | |
291 | exception_shared_2.so: exception_test_2_pic.o gcctestdir/ld | |
292 | $(CXXLINK) -Bgcctestdir/ -shared exception_test_2_pic.o | |
293 | exception_shared.so: exception_test_1_pic.o exception_test_2_pic.o gcctestdir/ld | |
294 | $(CXXLINK) -Bgcctestdir/ -shared exception_test_1_pic.o exception_test_2_pic.o | |
63402fe4 | 295 | |
3151305a ILT |
296 | exception_test_SOURCES = \ |
297 | exception_test_main.cc \ | |
298 | exception_test_1.cc \ | |
299 | exception_test_2.cc \ | |
300 | exception_test.h | |
301 | exception_test_DEPENDENCIES = gcctestdir/ld | |
302 | exception_test_LDFLAGS = -Bgcctestdir/ | |
303 | ||
351a8000 ILT |
304 | exception_static_test_SOURCES = $(exception_test_SOURCES) |
305 | exception_static_test_DEPENDENCIES = $(exception_test_DEPENDENCIES) | |
306 | exception_static_test_LDFLAGS = $(exception_test_LDFLAGS) -static | |
3151305a ILT |
307 | |
308 | exception_shared_1_test_SOURCES = exception_test_2.cc exception_test_main.cc | |
309 | exception_shared_1_test_DEPENDENCIES = gcctestdir/ld exception_shared_1.so | |
310 | exception_shared_1_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
311 | exception_shared_1_test_LDADD = exception_shared_1.so | |
312 | ||
313 | exception_shared_2_test_SOURCES = exception_test_1.cc exception_test_main.cc | |
314 | exception_shared_2_test_DEPENDENCIES = gcctestdir/ld exception_shared_2.so | |
315 | exception_shared_2_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
316 | exception_shared_2_test_LDADD = exception_shared_2.so | |
317 | ||
318 | exception_same_shared_test_SOURCES = exception_test_main.cc | |
319 | exception_same_shared_test_DEPENDENCIES = gcctestdir/ld exception_shared.so | |
320 | exception_same_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
321 | exception_same_shared_test_LDADD = exception_shared.so | |
322 | ||
323 | exception_separate_shared_12_test_SOURCES = exception_test_main.cc | |
324 | exception_separate_shared_12_test_DEPENDENCIES = \ | |
325 | gcctestdir/ld exception_shared_1.so exception_shared_2.so | |
326 | exception_separate_shared_12_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
327 | exception_separate_shared_12_test_LDADD = \ | |
328 | exception_shared_1.so exception_shared_2.so | |
329 | ||
330 | exception_separate_shared_21_test_SOURCES = exception_test_main.cc | |
331 | exception_separate_shared_21_test_DEPENDENCIES = \ | |
332 | gcctestdir/ld exception_shared_1.so exception_shared_2.so | |
333 | exception_separate_shared_21_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
334 | exception_separate_shared_21_test_LDADD = \ | |
335 | exception_shared_2.so exception_shared_1.so | |
336 | ||
3151305a | 337 | |
351a8000 | 338 | check_PROGRAMS += weak_test |
a360aedd | 339 | weak_test_SOURCES = weak_test.cc |
0e470e5c | 340 | weak_test_DEPENDENCIES = gcctestdir/ld |
a360aedd ILT |
341 | weak_test_LDFLAGS = -Bgcctestdir/ |
342 | ||
351a8000 | 343 | |
6eee141f ILT |
344 | if TLS |
345 | ||
351a8000 ILT |
346 | check_PROGRAMS += tls_test |
347 | check_PROGRAMS += tls_pic_test | |
348 | check_PROGRAMS += tls_shared_test | |
c03c7692 | 349 | check_PROGRAMS += tls_shared_ie_test |
351a8000 ILT |
350 | tls_test_pic.o: tls_test.cc |
351 | $(CXXCOMPILE) -c -fpic -o $@ $< | |
352 | tls_test_file2_pic.o: tls_test_file2.cc | |
353 | $(CXXCOMPILE) -c -fpic -o $@ $< | |
354 | tls_test_shared.so: tls_test_pic.o tls_test_file2_pic.o gcctestdir/ld | |
355 | $(CXXLINK) -Bgcctestdir/ -shared tls_test_pic.o tls_test_file2_pic.o | |
356 | ||
c03c7692 ILT |
357 | tls_test_pic_ie.o: tls_test.cc |
358 | $(CXXCOMPILE) -c -fpic -ftls-model=initial-exec -o $@ $< | |
359 | tls_test_file2_pic_ie.o: tls_test_file2.cc | |
360 | $(CXXCOMPILE) -c -fpic -ftls-model=initial-exec -o $@ $< | |
361 | tls_test_ie_shared.so: tls_test_pic_ie.o tls_test_file2_pic_ie.o gcctestdir/ld | |
362 | $(CXXLINK) -Bgcctestdir/ -shared tls_test_pic_ie.o tls_test_file2_pic_ie.o | |
363 | ||
e0374858 | 364 | tls_test_SOURCES = tls_test.cc tls_test_file2.cc tls_test_main.cc tls_test.h |
6eee141f ILT |
365 | tls_test_DEPENDENCIES = gcctestdir/ld |
366 | tls_test_LDFLAGS = -Bgcctestdir/ | |
367 | tls_test_LDADD = -lpthread | |
368 | ||
369 | tls_pic_test_SOURCES = tls_test_main.cc | |
e0374858 | 370 | tls_pic_test_DEPENDENCIES = gcctestdir/ld tls_test_pic.o tls_test_file2_pic.o |
6eee141f | 371 | tls_pic_test_LDFLAGS = -Bgcctestdir/ |
e0374858 | 372 | tls_pic_test_LDADD = tls_test_pic.o tls_test_file2_pic.o -lpthread |
6eee141f | 373 | |
6eee141f ILT |
374 | tls_shared_test_SOURCES = tls_test_main.cc |
375 | tls_shared_test_DEPENDENCIES = gcctestdir/ld tls_test_shared.so | |
376 | tls_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
377 | tls_shared_test_LDADD = tls_test_shared.so -lpthread | |
378 | ||
c03c7692 ILT |
379 | tls_shared_ie_test_SOURCES = tls_test_main.cc |
380 | tls_shared_ie_test_DEPENDENCIES = gcctestdir/ld tls_test_ie_shared.so | |
381 | tls_shared_ie_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
382 | tls_shared_ie_test_LDADD = tls_test_ie_shared.so -lpthread | |
383 | ||
351a8000 ILT |
384 | if STATIC_TLS |
385 | check_PROGRAMS += tls_static_test | |
386 | check_PROGRAMS += tls_static_pic_test | |
387 | ||
388 | tls_static_test_SOURCES = $(tls_test_SOURCES) | |
389 | tls_static_test_DEPENDENCIES = $(tls_test_DEPENDENCIES) | |
390 | tls_static_test_LDFLAGS = $(tls_test_LDFLAGS) -static | |
391 | tls_static_test_LDADD = $(tls_test_LDADD) | |
392 | ||
393 | tls_static_pic_test_SOURCES = $(tls_pic_test_SOURCES) | |
394 | tls_static_pic_test_DEPENDENCIES = $(tls_pic_test_DEPENDENCIES) | |
395 | tls_static_pic_test_LDFLAGS = $(tls_pic_test_LDFLAGS) -static | |
396 | tls_static_pic_test_LDADD = $(tls_pic_test_LDADD) | |
397 | endif | |
6eee141f ILT |
398 | |
399 | if FN_PTRS_IN_SO_WITHOUT_PIC | |
351a8000 ILT |
400 | check_PROGRAMS += tls_shared_nonpic_test |
401 | tls_test_shared_nonpic.so: tls_test.o tls_test_file2.o gcctestdir/ld | |
402 | $(CXXLINK) -Bgcctestdir/ -shared tls_test.o tls_test_file2.o | |
6eee141f ILT |
403 | |
404 | tls_shared_nonpic_test_SOURCES = tls_test_main.cc | |
405 | tls_shared_nonpic_test_DEPENDENCIES = gcctestdir/ld tls_test_shared_nonpic.so | |
406 | tls_shared_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
407 | tls_shared_nonpic_test_LDADD = tls_test_shared_nonpic.so -lpthread | |
351a8000 | 408 | endif FN_PTRS_IN_SO_WITHOUT_PIC |
6eee141f | 409 | |
351a8000 | 410 | endif TLS |
6eee141f | 411 | |
6eee141f | 412 | |
351a8000 ILT |
413 | # Test --detect-odr-violations |
414 | check_SCRIPTS += debug_msg.sh | |
6eee141f | 415 | |
351a8000 ILT |
416 | # Create the data files that debug_msg.sh analyzes. |
417 | check_DATA += debug_msg.err | |
418 | MOSTLYCLEANFILES += debug_msg.err | |
419 | debug_msg.o: debug_msg.cc | |
420 | $(CXXCOMPILE) -O0 -g -c -w -o $@ $(srcdir)/debug_msg.cc | |
421 | odr_violation1.o: odr_violation1.cc | |
422 | $(CXXCOMPILE) -O0 -g -c -w -o $@ $(srcdir)/odr_violation1.cc | |
423 | odr_violation2.o: odr_violation2.cc | |
424 | $(CXXCOMPILE) -O0 -g -c -w -o $@ $(srcdir)/odr_violation2.cc | |
425 | debug_msg.err: debug_msg.o odr_violation1.o odr_violation2.o gcctestdir/ld | |
426 | @echo $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg debug_msg.o odr_violation1.o odr_violation2.o "2>$@" | |
427 | @if $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg debug_msg.o odr_violation1.o odr_violation2.o 2>$@; \ | |
428 | then \ | |
429 | echo 1>&2 "Link of debug_msg should have failed"; \ | |
430 | rm -f $@; \ | |
431 | exit 1; \ | |
432 | fi | |
433 | ||
434 | # See if we can also detect problems when we're linking .so's, not .o's. | |
435 | check_DATA += debug_msg_so.err | |
436 | MOSTLYCLEANFILES += debug_msg_so.err | |
437 | debug_msg.so: debug_msg.cc gcctestdir/ld | |
438 | $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -shared -fPIC -w -o $@ $(srcdir)/debug_msg.cc | |
439 | odr_violation1.so: odr_violation1.cc gcctestdir/ld | |
440 | $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -shared -fPIC -w -o $@ $(srcdir)/odr_violation1.cc | |
441 | odr_violation2.so: odr_violation2.cc gcctestdir/ld | |
442 | $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -shared -fPIC -w -o $@ $(srcdir)/odr_violation2.cc | |
443 | debug_msg_so.err: debug_msg.so odr_violation1.so odr_violation2.so gcctestdir/ld | |
444 | @echo $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_so debug_msg.so odr_violation1.so odr_violation2.so "2>$@" | |
445 | @if $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_so debug_msg.so odr_violation1.so odr_violation2.so 2>$@; \ | |
446 | then \ | |
447 | echo 1>&2 "Link of debug_msg_so should have failed"; \ | |
448 | rm -f $@; \ | |
449 | exit 1; \ | |
450 | fi | |
451 | ||
452 | # We also want to make sure we do something reasonable when there's no | |
453 | # debug info available. For the best test, we use .so's. | |
454 | check_DATA += debug_msg_ndebug.err | |
455 | MOSTLYCLEANFILES += debug_msg_ndebug.err | |
456 | debug_msg_ndebug.so: debug_msg.cc gcctestdir/ld | |
457 | $(CXXCOMPILE) -Bgcctestdir/ -O0 -g0 -shared -fPIC -w -o $@ $(srcdir)/debug_msg.cc | |
458 | odr_violation1_ndebug.so: odr_violation1.cc gcctestdir/ld | |
459 | $(CXXCOMPILE) -Bgcctestdir/ -O0 -g0 -shared -fPIC -w -o $@ $(srcdir)/odr_violation1.cc | |
460 | odr_violation2_ndebug.so: odr_violation2.cc gcctestdir/ld | |
461 | $(CXXCOMPILE) -Bgcctestdir/ -O0 -g0 -shared -fPIC -w -o $@ $(srcdir)/odr_violation2.cc | |
462 | debug_msg_ndebug.err: debug_msg_ndebug.so odr_violation1_ndebug.so odr_violation2_ndebug.so gcctestdir/ld | |
463 | @echo $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_ndebug debug_msg_ndebug.so odr_violation1_ndebug.so odr_violation2_ndebug.so "2>$@" | |
464 | @if $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_ndebug debug_msg_ndebug.so odr_violation1_ndebug.so odr_violation2_ndebug.so 2>$@; \ | |
465 | then \ | |
466 | echo 1>&2 "Link of debug_msg_ndebug should have failed"; \ | |
467 | rm -f $@; \ | |
468 | exit 1; \ | |
469 | fi | |
470 | ||
471 | ||
472 | # Similar to --detect-odr-violations: check for undefined symbols in .so's | |
473 | check_SCRIPTS += undef_symbol.sh | |
474 | check_DATA += undef_symbol.err | |
475 | MOSTLYCLEANFILES += undef_symbol.err | |
476 | undef_symbol.o: undef_symbol.cc | |
477 | $(CXXCOMPILE) -O0 -g -c -fPIC $< | |
478 | undef_symbol.so: undef_symbol.o gcctestdir/ld | |
479 | $(CXXLINK) -Bgcctestdir/ -shared undef_symbol.o | |
480 | undef_symbol.err: undef_symbol_main.o undef_symbol.so gcctestdir/ld | |
481 | @echo $(CXXLINK) -Bgcctestdir/ -o undef_symbol_test undef_symbol_main.o undef_symbol.so "2>$@" | |
482 | @if $(CXXLINK) -Bgcctestdir/ -o undef_symbol_test undef_symbol_main.o undef_symbol.so 2>$@; \ | |
483 | then \ | |
484 | echo 1>&2 "Link of undef_symbol_test should have failed"; \ | |
485 | rm -f $@; \ | |
486 | exit 1; \ | |
487 | fi | |
488 | ||
489 | ||
490 | # Test --compress-debug-sections. FIXME: check we actually compress. | |
491 | check_PROGRAMS += flagstest_compress_debug_sections | |
0e470e5c | 492 | flagstest_compress_debug_sections: flagstest_debug.o gcctestdir/ld |
351a8000 ILT |
493 | $(CXXLINK) -Bgcctestdir/ -o $@ $< --compress-debug-sections=zlib |
494 | test -s $@ | |
495 | ||
496 | ||
497 | # Test -o when emitting to a special file (such as something in /dev). | |
498 | check_PROGRAMS += flagstest_o_specialfile | |
0e470e5c | 499 | flagstest_o_specialfile: flagstest_debug.o gcctestdir/ld |
351a8000 ILT |
500 | $(CXXLINK) -Bgcctestdir/ -o /dev/stdout $< 2>&1 | cat > $@ |
501 | chmod a+x $@ | |
502 | test -s $@ | |
503 | ||
504 | # The specialfile output has a tricky case when we also compress debug | |
505 | # sections, because it requires output-file resizing. | |
506 | check_PROGRAMS += flagstest_o_specialfile_and_compress_debug_sections | |
0e470e5c ILT |
507 | flagstest_o_specialfile_and_compress_debug_sections: flagstest_debug.o \ |
508 | gcctestdir/ld | |
351a8000 ILT |
509 | $(CXXLINK) -Bgcctestdir/ -o /dev/stdout $< --compress-debug-sections=zlib 2>&1 | cat > $@ |
510 | chmod a+x $@ | |
511 | test -s $@ | |
512 | ||
99f8faca ILT |
513 | # Test symbol versioning. |
514 | check_PROGRAMS += ver_test | |
515 | ver_test_SOURCES = ver_test_main.cc | |
516 | ver_test_DEPENDENCIES = gcctestdir/ld ver_test_1.so ver_test_2.so ver_test_4.so | |
517 | ver_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
518 | ver_test_LDADD = ver_test_1.so ver_test_2.so ver_test_4.so | |
519 | ver_test_1.so: ver_test_1.o ver_test_2.so ver_test_3.o ver_test_4.so gcctestdir/ld | |
520 | $(CXXLINK) -Bgcctestdir/ -shared ver_test_1.o ver_test_2.so ver_test_3.o ver_test_4.so | |
09124467 ILT |
521 | ver_test_2.so: ver_test_2.o $(srcdir)/ver_test_2.script ver_test_4.so gcctestdir/ld |
522 | $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_2.script ver_test_2.o ver_test_4.so | |
523 | ver_test_4.so: ver_test_4.o $(srcdir)/ver_test_4.script gcctestdir/ld | |
524 | $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_4.script ver_test_4.o | |
99f8faca ILT |
525 | ver_test_1.o: ver_test_1.cc |
526 | $(CXXCOMPILE) -c -fpic -o $@ $< | |
527 | ver_test_2.o: ver_test_2.cc | |
528 | $(CXXCOMPILE) -c -fpic -o $@ $< | |
529 | ver_test_3.o: ver_test_3.cc | |
530 | $(CXXCOMPILE) -c -fpic -o $@ $< | |
531 | ver_test_4.o: ver_test_4.cc | |
532 | $(CXXCOMPILE) -c -fpic -o $@ $< | |
351a8000 | 533 | |
e5756efb ILT |
534 | check_PROGRAMS += script_test_1 |
535 | script_test_1_SOURCES = script_test_1.cc | |
536 | script_test_1_DEPENDENCIES = gcctestdir/ld script_test_1.t | |
537 | script_test_1_LDFLAGS = -Bgcctestdir/ -Wl,-R,. -T $(srcdir)/script_test_1.t | |
538 | ||
a445fddf ILT |
539 | check_PROGRAMS += script_test_2 |
540 | script_test_2_SOURCES = script_test_2.cc script_test_2a.cc script_test_2b.cc | |
541 | script_test_2_DEPENDENCIES = gcctestdir/ld script_test_2.t | |
542 | script_test_2_LDFLAGS = -Bgcctestdir/ -Wl,-R,. -T $(srcdir)/script_test_2.t | |
543 | ||
88dd47ac ILT |
544 | check_PROGRAMS += justsyms |
545 | justsyms_SOURCES = justsyms_1.cc | |
546 | justsyms_DEPENDENCIES = gcctestdir/ld justsyms_2r.o | |
547 | justsyms_LDFLAGS = -Bgcctestdir/ -Wl,-R,justsyms_2r.o | |
548 | justsyms_2.o: justsyms_2.cc | |
549 | $(CXXCOMPILE) -c -o $@ $< | |
550 | justsyms_2r.o: justsyms_2.o gcctestdir/ld | |
551 | gcctestdir/ld -o $@ -r -T $(srcdir)/justsyms.t justsyms_2.o | |
552 | ||
09124467 ILT |
553 | if OBJDUMP_AND_CPPFILT |
554 | check_SCRIPTS += ver_matching_test.sh | |
555 | check_DATA += ver_matching_test.stdout | |
556 | MOSTLYCLEANFILES += ver_matching_test.stdout | |
557 | ver_matching_def.so: ver_matching_def.cc gcctestdir/ld | |
558 | $(CXXLINK) -O0 -Bgcctestdir/ -shared $(srcdir)/ver_matching_def.cc -Wl,--version-script=$(srcdir)/version_script.map | |
559 | ver_matching_test.stdout: ver_matching_def.so | |
560 | objdump -T ver_matching_def.so | c++filt > ver_matching_test.stdout | |
1c4f3631 ILT |
561 | |
562 | check_PROGRAMS += script_test_3 | |
563 | check_SCRIPTS += script_test_3.sh | |
564 | check_DATA += script_test_3.stdout | |
565 | MOSTLYCLEANFILES += script_test_3.stdout | |
566 | script_test_3: basic_test.o gcctestdir/ld script_test_3.t | |
567 | $(CXXLINK) -Bgcctestdir/ basic_test.o -T $(srcdir)/script_test_3.t | |
568 | script_test_3.stdout: script_test_3 | |
569 | objdump -p script_test_3 > script_test_3.stdout | |
09124467 ILT |
570 | endif OBJDUMP_AND_CPPFILT |
571 | ||
351a8000 ILT |
572 | endif GCC |
573 | endif NATIVE_LINKER |