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