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