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