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 | ||
63402fe4 ILT |
200 | # The nonpic tests will fail on platforms which can not put non-PIC |
201 | # code into shared libraries, so we just don't run them in that case. | |
63402fe4 | 202 | if FN_PTRS_IN_SO_WITHOUT_PIC |
3bd52c28 | 203 | |
351a8000 ILT |
204 | check_PROGRAMS += two_file_shared_1_nonpic_test |
205 | check_PROGRAMS += two_file_shared_2_nonpic_test | |
206 | check_PROGRAMS += two_file_same_shared_nonpic_test | |
207 | check_PROGRAMS += two_file_separate_shared_12_nonpic_test | |
208 | check_PROGRAMS += two_file_separate_shared_21_nonpic_test | |
03e8f2b2 ILT |
209 | check_PROGRAMS += two_file_mixed_shared_test |
210 | check_PROGRAMS += two_file_mixed_2_shared_test | |
351a8000 | 211 | two_file_shared_1_nonpic.so: two_file_test_1.o gcctestdir/ld |
03e8f2b2 | 212 | $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1.o two_file_test_1b.o |
351a8000 ILT |
213 | two_file_shared_2_nonpic.so: two_file_test_2.o gcctestdir/ld |
214 | $(CXXLINK) -Bgcctestdir/ -shared two_file_test_2.o | |
03e8f2b2 ILT |
215 | two_file_shared_nonpic.so: two_file_test_1.o two_file_test_1b.o two_file_test_2.o gcctestdir/ld |
216 | $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1.o two_file_test_1b.o two_file_test_2.o | |
217 | two_file_shared_mixed.so: two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2.o gcctestdir/ld | |
218 | $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2.o | |
219 | two_file_shared_mixed_1.so: two_file_test_1.o two_file_test_1b_pic.o two_file_shared_2.so gcctestdir/ld | |
220 | $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1.o two_file_test_1b_pic.o two_file_shared_2.so | |
351a8000 | 221 | |
3bd52c28 ILT |
222 | two_file_shared_1_nonpic_test_SOURCES = \ |
223 | two_file_test_2.cc two_file_test_main.cc | |
224 | two_file_shared_1_nonpic_test_DEPENDENCIES = \ | |
225 | gcctestdir/ld two_file_shared_1_nonpic.so | |
226 | two_file_shared_1_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
227 | two_file_shared_1_nonpic_test_LDADD = two_file_shared_1_nonpic.so | |
228 | ||
229 | two_file_shared_2_nonpic_test_SOURCES = \ | |
03e8f2b2 | 230 | two_file_test_1.cc two_file_test_1b.cc two_file_test_main.cc |
3bd52c28 ILT |
231 | two_file_shared_2_nonpic_test_DEPENDENCIES = \ |
232 | gcctestdir/ld two_file_shared_2_nonpic.so | |
233 | two_file_shared_2_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
234 | two_file_shared_2_nonpic_test_LDADD = two_file_shared_2_nonpic.so | |
235 | ||
236 | two_file_same_shared_nonpic_test_SOURCES = two_file_test_main.cc | |
237 | two_file_same_shared_nonpic_test_DEPENDENCIES = \ | |
238 | gcctestdir/ld two_file_shared_nonpic.so | |
239 | two_file_same_shared_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
240 | two_file_same_shared_nonpic_test_LDADD = two_file_shared_nonpic.so | |
241 | ||
242 | two_file_separate_shared_12_nonpic_test_SOURCES = two_file_test_main.cc | |
243 | two_file_separate_shared_12_nonpic_test_DEPENDENCIES = \ | |
244 | gcctestdir/ld two_file_shared_1_nonpic.so two_file_shared_2_nonpic.so | |
245 | two_file_separate_shared_12_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
246 | two_file_separate_shared_12_nonpic_test_LDADD = \ | |
247 | two_file_shared_1_nonpic.so two_file_shared_2_nonpic.so | |
248 | ||
249 | two_file_separate_shared_21_nonpic_test_SOURCES = two_file_test_main.cc | |
250 | two_file_separate_shared_21_nonpic_test_DEPENDENCIES = \ | |
251 | gcctestdir/ld two_file_shared_1_nonpic.so two_file_shared_2_nonpic.so | |
252 | two_file_separate_shared_21_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
253 | two_file_separate_shared_21_nonpic_test_LDADD = \ | |
254 | two_file_shared_2_nonpic.so two_file_shared_1_nonpic.so | |
255 | ||
03e8f2b2 ILT |
256 | two_file_mixed_shared_test_SOURCES = two_file_test_main.cc |
257 | two_file_mixed_shared_test_DEPENDENCIES = gcctestdir/ld two_file_shared_mixed.so | |
258 | two_file_mixed_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
259 | two_file_mixed_shared_test_LDADD = two_file_shared_mixed.so | |
260 | ||
261 | two_file_mixed_2_shared_test_SOURCES = two_file_test_main.cc | |
262 | two_file_mixed_2_shared_test_DEPENDENCIES = gcctestdir/ld two_file_shared_mixed_1.so two_file_shared_2.so | |
263 | two_file_mixed_2_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
264 | two_file_mixed_2_shared_test_LDADD = two_file_shared_mixed_1.so two_file_shared_2.so | |
265 | ||
351a8000 | 266 | endif FN_PTRS_IN_SO_WITHOUT_PIC |
3bd52c28 | 267 | |
351a8000 ILT |
268 | |
269 | check_PROGRAMS += exception_test | |
270 | check_PROGRAMS += exception_static_test | |
271 | check_PROGRAMS += exception_shared_1_test | |
272 | check_PROGRAMS += exception_shared_2_test | |
273 | check_PROGRAMS += exception_same_shared_test | |
274 | check_PROGRAMS += exception_separate_shared_12_test | |
275 | check_PROGRAMS += exception_separate_shared_21_test | |
276 | exception_test_1_pic.o: exception_test_1.cc | |
277 | $(CXXCOMPILE) -c -fpic -o $@ $< | |
278 | exception_test_2_pic.o: exception_test_2.cc | |
279 | $(CXXCOMPILE) -c -fpic -o $@ $< | |
280 | exception_shared_1.so: exception_test_1_pic.o gcctestdir/ld | |
281 | $(CXXLINK) -Bgcctestdir/ -shared exception_test_1_pic.o | |
282 | exception_shared_2.so: exception_test_2_pic.o gcctestdir/ld | |
283 | $(CXXLINK) -Bgcctestdir/ -shared exception_test_2_pic.o | |
284 | exception_shared.so: exception_test_1_pic.o exception_test_2_pic.o gcctestdir/ld | |
285 | $(CXXLINK) -Bgcctestdir/ -shared exception_test_1_pic.o exception_test_2_pic.o | |
63402fe4 | 286 | |
3151305a ILT |
287 | exception_test_SOURCES = \ |
288 | exception_test_main.cc \ | |
289 | exception_test_1.cc \ | |
290 | exception_test_2.cc \ | |
291 | exception_test.h | |
292 | exception_test_DEPENDENCIES = gcctestdir/ld | |
293 | exception_test_LDFLAGS = -Bgcctestdir/ | |
294 | ||
351a8000 ILT |
295 | exception_static_test_SOURCES = $(exception_test_SOURCES) |
296 | exception_static_test_DEPENDENCIES = $(exception_test_DEPENDENCIES) | |
297 | exception_static_test_LDFLAGS = $(exception_test_LDFLAGS) -static | |
3151305a ILT |
298 | |
299 | exception_shared_1_test_SOURCES = exception_test_2.cc exception_test_main.cc | |
300 | exception_shared_1_test_DEPENDENCIES = gcctestdir/ld exception_shared_1.so | |
301 | exception_shared_1_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
302 | exception_shared_1_test_LDADD = exception_shared_1.so | |
303 | ||
304 | exception_shared_2_test_SOURCES = exception_test_1.cc exception_test_main.cc | |
305 | exception_shared_2_test_DEPENDENCIES = gcctestdir/ld exception_shared_2.so | |
306 | exception_shared_2_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
307 | exception_shared_2_test_LDADD = exception_shared_2.so | |
308 | ||
309 | exception_same_shared_test_SOURCES = exception_test_main.cc | |
310 | exception_same_shared_test_DEPENDENCIES = gcctestdir/ld exception_shared.so | |
311 | exception_same_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
312 | exception_same_shared_test_LDADD = exception_shared.so | |
313 | ||
314 | exception_separate_shared_12_test_SOURCES = exception_test_main.cc | |
315 | exception_separate_shared_12_test_DEPENDENCIES = \ | |
316 | gcctestdir/ld exception_shared_1.so exception_shared_2.so | |
317 | exception_separate_shared_12_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
318 | exception_separate_shared_12_test_LDADD = \ | |
319 | exception_shared_1.so exception_shared_2.so | |
320 | ||
321 | exception_separate_shared_21_test_SOURCES = exception_test_main.cc | |
322 | exception_separate_shared_21_test_DEPENDENCIES = \ | |
323 | gcctestdir/ld exception_shared_1.so exception_shared_2.so | |
324 | exception_separate_shared_21_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
325 | exception_separate_shared_21_test_LDADD = \ | |
326 | exception_shared_2.so exception_shared_1.so | |
327 | ||
3151305a | 328 | |
351a8000 | 329 | check_PROGRAMS += weak_test |
a360aedd | 330 | weak_test_SOURCES = weak_test.cc |
0e470e5c | 331 | weak_test_DEPENDENCIES = gcctestdir/ld |
a360aedd ILT |
332 | weak_test_LDFLAGS = -Bgcctestdir/ |
333 | ||
351a8000 | 334 | |
6eee141f ILT |
335 | if TLS |
336 | ||
351a8000 ILT |
337 | check_PROGRAMS += tls_test |
338 | check_PROGRAMS += tls_pic_test | |
339 | check_PROGRAMS += tls_shared_test | |
c03c7692 | 340 | check_PROGRAMS += tls_shared_ie_test |
351a8000 ILT |
341 | tls_test_pic.o: tls_test.cc |
342 | $(CXXCOMPILE) -c -fpic -o $@ $< | |
343 | tls_test_file2_pic.o: tls_test_file2.cc | |
344 | $(CXXCOMPILE) -c -fpic -o $@ $< | |
345 | tls_test_shared.so: tls_test_pic.o tls_test_file2_pic.o gcctestdir/ld | |
346 | $(CXXLINK) -Bgcctestdir/ -shared tls_test_pic.o tls_test_file2_pic.o | |
347 | ||
c03c7692 ILT |
348 | tls_test_pic_ie.o: tls_test.cc |
349 | $(CXXCOMPILE) -c -fpic -ftls-model=initial-exec -o $@ $< | |
350 | tls_test_file2_pic_ie.o: tls_test_file2.cc | |
351 | $(CXXCOMPILE) -c -fpic -ftls-model=initial-exec -o $@ $< | |
352 | tls_test_ie_shared.so: tls_test_pic_ie.o tls_test_file2_pic_ie.o gcctestdir/ld | |
353 | $(CXXLINK) -Bgcctestdir/ -shared tls_test_pic_ie.o tls_test_file2_pic_ie.o | |
354 | ||
e0374858 | 355 | tls_test_SOURCES = tls_test.cc tls_test_file2.cc tls_test_main.cc tls_test.h |
6eee141f ILT |
356 | tls_test_DEPENDENCIES = gcctestdir/ld |
357 | tls_test_LDFLAGS = -Bgcctestdir/ | |
358 | tls_test_LDADD = -lpthread | |
359 | ||
360 | tls_pic_test_SOURCES = tls_test_main.cc | |
e0374858 | 361 | tls_pic_test_DEPENDENCIES = gcctestdir/ld tls_test_pic.o tls_test_file2_pic.o |
6eee141f | 362 | tls_pic_test_LDFLAGS = -Bgcctestdir/ |
e0374858 | 363 | tls_pic_test_LDADD = tls_test_pic.o tls_test_file2_pic.o -lpthread |
6eee141f | 364 | |
6eee141f ILT |
365 | tls_shared_test_SOURCES = tls_test_main.cc |
366 | tls_shared_test_DEPENDENCIES = gcctestdir/ld tls_test_shared.so | |
367 | tls_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
368 | tls_shared_test_LDADD = tls_test_shared.so -lpthread | |
369 | ||
c03c7692 ILT |
370 | tls_shared_ie_test_SOURCES = tls_test_main.cc |
371 | tls_shared_ie_test_DEPENDENCIES = gcctestdir/ld tls_test_ie_shared.so | |
372 | tls_shared_ie_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
373 | tls_shared_ie_test_LDADD = tls_test_ie_shared.so -lpthread | |
374 | ||
351a8000 ILT |
375 | if STATIC_TLS |
376 | check_PROGRAMS += tls_static_test | |
377 | check_PROGRAMS += tls_static_pic_test | |
378 | ||
379 | tls_static_test_SOURCES = $(tls_test_SOURCES) | |
380 | tls_static_test_DEPENDENCIES = $(tls_test_DEPENDENCIES) | |
381 | tls_static_test_LDFLAGS = $(tls_test_LDFLAGS) -static | |
382 | tls_static_test_LDADD = $(tls_test_LDADD) | |
383 | ||
384 | tls_static_pic_test_SOURCES = $(tls_pic_test_SOURCES) | |
385 | tls_static_pic_test_DEPENDENCIES = $(tls_pic_test_DEPENDENCIES) | |
386 | tls_static_pic_test_LDFLAGS = $(tls_pic_test_LDFLAGS) -static | |
387 | tls_static_pic_test_LDADD = $(tls_pic_test_LDADD) | |
388 | endif | |
6eee141f ILT |
389 | |
390 | if FN_PTRS_IN_SO_WITHOUT_PIC | |
351a8000 ILT |
391 | check_PROGRAMS += tls_shared_nonpic_test |
392 | tls_test_shared_nonpic.so: tls_test.o tls_test_file2.o gcctestdir/ld | |
393 | $(CXXLINK) -Bgcctestdir/ -shared tls_test.o tls_test_file2.o | |
6eee141f ILT |
394 | |
395 | tls_shared_nonpic_test_SOURCES = tls_test_main.cc | |
396 | tls_shared_nonpic_test_DEPENDENCIES = gcctestdir/ld tls_test_shared_nonpic.so | |
397 | tls_shared_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
398 | tls_shared_nonpic_test_LDADD = tls_test_shared_nonpic.so -lpthread | |
351a8000 | 399 | endif FN_PTRS_IN_SO_WITHOUT_PIC |
6eee141f | 400 | |
351a8000 | 401 | endif TLS |
6eee141f | 402 | |
6eee141f | 403 | |
351a8000 ILT |
404 | # Test --detect-odr-violations |
405 | check_SCRIPTS += debug_msg.sh | |
6eee141f | 406 | |
351a8000 ILT |
407 | # Create the data files that debug_msg.sh analyzes. |
408 | check_DATA += debug_msg.err | |
409 | MOSTLYCLEANFILES += debug_msg.err | |
410 | debug_msg.o: debug_msg.cc | |
411 | $(CXXCOMPILE) -O0 -g -c -w -o $@ $(srcdir)/debug_msg.cc | |
412 | odr_violation1.o: odr_violation1.cc | |
413 | $(CXXCOMPILE) -O0 -g -c -w -o $@ $(srcdir)/odr_violation1.cc | |
414 | odr_violation2.o: odr_violation2.cc | |
415 | $(CXXCOMPILE) -O0 -g -c -w -o $@ $(srcdir)/odr_violation2.cc | |
416 | debug_msg.err: debug_msg.o odr_violation1.o odr_violation2.o gcctestdir/ld | |
417 | @echo $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg debug_msg.o odr_violation1.o odr_violation2.o "2>$@" | |
418 | @if $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg debug_msg.o odr_violation1.o odr_violation2.o 2>$@; \ | |
419 | then \ | |
420 | echo 1>&2 "Link of debug_msg should have failed"; \ | |
421 | rm -f $@; \ | |
422 | exit 1; \ | |
423 | fi | |
424 | ||
425 | # See if we can also detect problems when we're linking .so's, not .o's. | |
426 | check_DATA += debug_msg_so.err | |
427 | MOSTLYCLEANFILES += debug_msg_so.err | |
428 | debug_msg.so: debug_msg.cc gcctestdir/ld | |
429 | $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -shared -fPIC -w -o $@ $(srcdir)/debug_msg.cc | |
430 | odr_violation1.so: odr_violation1.cc gcctestdir/ld | |
431 | $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -shared -fPIC -w -o $@ $(srcdir)/odr_violation1.cc | |
432 | odr_violation2.so: odr_violation2.cc gcctestdir/ld | |
433 | $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -shared -fPIC -w -o $@ $(srcdir)/odr_violation2.cc | |
434 | debug_msg_so.err: debug_msg.so odr_violation1.so odr_violation2.so gcctestdir/ld | |
435 | @echo $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_so debug_msg.so odr_violation1.so odr_violation2.so "2>$@" | |
436 | @if $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_so debug_msg.so odr_violation1.so odr_violation2.so 2>$@; \ | |
437 | then \ | |
438 | echo 1>&2 "Link of debug_msg_so should have failed"; \ | |
439 | rm -f $@; \ | |
440 | exit 1; \ | |
441 | fi | |
442 | ||
443 | # We also want to make sure we do something reasonable when there's no | |
444 | # debug info available. For the best test, we use .so's. | |
445 | check_DATA += debug_msg_ndebug.err | |
446 | MOSTLYCLEANFILES += debug_msg_ndebug.err | |
447 | debug_msg_ndebug.so: debug_msg.cc gcctestdir/ld | |
448 | $(CXXCOMPILE) -Bgcctestdir/ -O0 -g0 -shared -fPIC -w -o $@ $(srcdir)/debug_msg.cc | |
449 | odr_violation1_ndebug.so: odr_violation1.cc gcctestdir/ld | |
450 | $(CXXCOMPILE) -Bgcctestdir/ -O0 -g0 -shared -fPIC -w -o $@ $(srcdir)/odr_violation1.cc | |
451 | odr_violation2_ndebug.so: odr_violation2.cc gcctestdir/ld | |
452 | $(CXXCOMPILE) -Bgcctestdir/ -O0 -g0 -shared -fPIC -w -o $@ $(srcdir)/odr_violation2.cc | |
453 | debug_msg_ndebug.err: debug_msg_ndebug.so odr_violation1_ndebug.so odr_violation2_ndebug.so gcctestdir/ld | |
454 | @echo $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_ndebug debug_msg_ndebug.so odr_violation1_ndebug.so odr_violation2_ndebug.so "2>$@" | |
455 | @if $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_ndebug debug_msg_ndebug.so odr_violation1_ndebug.so odr_violation2_ndebug.so 2>$@; \ | |
456 | then \ | |
457 | echo 1>&2 "Link of debug_msg_ndebug should have failed"; \ | |
458 | rm -f $@; \ | |
459 | exit 1; \ | |
460 | fi | |
461 | ||
462 | ||
463 | # Similar to --detect-odr-violations: check for undefined symbols in .so's | |
464 | check_SCRIPTS += undef_symbol.sh | |
465 | check_DATA += undef_symbol.err | |
466 | MOSTLYCLEANFILES += undef_symbol.err | |
467 | undef_symbol.o: undef_symbol.cc | |
468 | $(CXXCOMPILE) -O0 -g -c -fPIC $< | |
469 | undef_symbol.so: undef_symbol.o gcctestdir/ld | |
470 | $(CXXLINK) -Bgcctestdir/ -shared undef_symbol.o | |
471 | undef_symbol.err: undef_symbol_main.o undef_symbol.so gcctestdir/ld | |
472 | @echo $(CXXLINK) -Bgcctestdir/ -o undef_symbol_test undef_symbol_main.o undef_symbol.so "2>$@" | |
473 | @if $(CXXLINK) -Bgcctestdir/ -o undef_symbol_test undef_symbol_main.o undef_symbol.so 2>$@; \ | |
474 | then \ | |
475 | echo 1>&2 "Link of undef_symbol_test should have failed"; \ | |
476 | rm -f $@; \ | |
477 | exit 1; \ | |
478 | fi | |
479 | ||
480 | ||
481 | # Test --compress-debug-sections. FIXME: check we actually compress. | |
482 | check_PROGRAMS += flagstest_compress_debug_sections | |
0e470e5c | 483 | flagstest_compress_debug_sections: flagstest_debug.o gcctestdir/ld |
351a8000 ILT |
484 | $(CXXLINK) -Bgcctestdir/ -o $@ $< --compress-debug-sections=zlib |
485 | test -s $@ | |
486 | ||
487 | ||
488 | # Test -o when emitting to a special file (such as something in /dev). | |
489 | check_PROGRAMS += flagstest_o_specialfile | |
0e470e5c | 490 | flagstest_o_specialfile: flagstest_debug.o gcctestdir/ld |
351a8000 ILT |
491 | $(CXXLINK) -Bgcctestdir/ -o /dev/stdout $< 2>&1 | cat > $@ |
492 | chmod a+x $@ | |
493 | test -s $@ | |
494 | ||
495 | # The specialfile output has a tricky case when we also compress debug | |
496 | # sections, because it requires output-file resizing. | |
497 | check_PROGRAMS += flagstest_o_specialfile_and_compress_debug_sections | |
0e470e5c ILT |
498 | flagstest_o_specialfile_and_compress_debug_sections: flagstest_debug.o \ |
499 | gcctestdir/ld | |
351a8000 ILT |
500 | $(CXXLINK) -Bgcctestdir/ -o /dev/stdout $< --compress-debug-sections=zlib 2>&1 | cat > $@ |
501 | chmod a+x $@ | |
502 | test -s $@ | |
503 | ||
99f8faca ILT |
504 | # Test symbol versioning. |
505 | check_PROGRAMS += ver_test | |
506 | ver_test_SOURCES = ver_test_main.cc | |
507 | ver_test_DEPENDENCIES = gcctestdir/ld ver_test_1.so ver_test_2.so ver_test_4.so | |
508 | ver_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. | |
509 | ver_test_LDADD = ver_test_1.so ver_test_2.so ver_test_4.so | |
510 | ver_test_1.so: ver_test_1.o ver_test_2.so ver_test_3.o ver_test_4.so gcctestdir/ld | |
511 | $(CXXLINK) -Bgcctestdir/ -shared ver_test_1.o ver_test_2.so ver_test_3.o ver_test_4.so | |
09124467 ILT |
512 | ver_test_2.so: ver_test_2.o $(srcdir)/ver_test_2.script ver_test_4.so gcctestdir/ld |
513 | $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_2.script ver_test_2.o ver_test_4.so | |
514 | ver_test_4.so: ver_test_4.o $(srcdir)/ver_test_4.script gcctestdir/ld | |
515 | $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_4.script ver_test_4.o | |
99f8faca ILT |
516 | ver_test_1.o: ver_test_1.cc |
517 | $(CXXCOMPILE) -c -fpic -o $@ $< | |
518 | ver_test_2.o: ver_test_2.cc | |
519 | $(CXXCOMPILE) -c -fpic -o $@ $< | |
520 | ver_test_3.o: ver_test_3.cc | |
521 | $(CXXCOMPILE) -c -fpic -o $@ $< | |
522 | ver_test_4.o: ver_test_4.cc | |
523 | $(CXXCOMPILE) -c -fpic -o $@ $< | |
351a8000 | 524 | |
e5756efb ILT |
525 | check_PROGRAMS += script_test_1 |
526 | script_test_1_SOURCES = script_test_1.cc | |
527 | script_test_1_DEPENDENCIES = gcctestdir/ld script_test_1.t | |
528 | script_test_1_LDFLAGS = -Bgcctestdir/ -Wl,-R,. -T $(srcdir)/script_test_1.t | |
529 | ||
a445fddf ILT |
530 | check_PROGRAMS += script_test_2 |
531 | script_test_2_SOURCES = script_test_2.cc script_test_2a.cc script_test_2b.cc | |
532 | script_test_2_DEPENDENCIES = gcctestdir/ld script_test_2.t | |
533 | script_test_2_LDFLAGS = -Bgcctestdir/ -Wl,-R,. -T $(srcdir)/script_test_2.t | |
534 | ||
09124467 ILT |
535 | if OBJDUMP_AND_CPPFILT |
536 | check_SCRIPTS += ver_matching_test.sh | |
537 | check_DATA += ver_matching_test.stdout | |
538 | MOSTLYCLEANFILES += ver_matching_test.stdout | |
539 | ver_matching_def.so: ver_matching_def.cc gcctestdir/ld | |
540 | $(CXXLINK) -O0 -Bgcctestdir/ -shared $(srcdir)/ver_matching_def.cc -Wl,--version-script=$(srcdir)/version_script.map | |
541 | ver_matching_test.stdout: ver_matching_def.so | |
542 | objdump -T ver_matching_def.so | c++filt > ver_matching_test.stdout | |
1c4f3631 ILT |
543 | |
544 | check_PROGRAMS += script_test_3 | |
545 | check_SCRIPTS += script_test_3.sh | |
546 | check_DATA += script_test_3.stdout | |
547 | MOSTLYCLEANFILES += script_test_3.stdout | |
548 | script_test_3: basic_test.o gcctestdir/ld script_test_3.t | |
549 | $(CXXLINK) -Bgcctestdir/ basic_test.o -T $(srcdir)/script_test_3.t | |
550 | script_test_3.stdout: script_test_3 | |
551 | objdump -p script_test_3 > script_test_3.stdout | |
09124467 ILT |
552 | endif OBJDUMP_AND_CPPFILT |
553 | ||
351a8000 ILT |
554 | endif GCC |
555 | endif NATIVE_LINKER |