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