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