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