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