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