1 # Process this file with automake to generate Makefile.in
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.
9 # The two_file_test tests -fmerge-constants, so we simply always turn
10 # it on. This may need to be controlled by a configure option
12 AM_CFLAGS = $(WARN_CFLAGS) $(LFS_CFLAGS) -fmerge-constants
13 AM_CXXFLAGS = $(WARN_CXXFLAGS) $(LFS_CFLAGS) -fmerge-constants
16 -I$(srcdir) -I$(srcdir)/.. -I$(srcdir)/../../include \
17 -I$(srcdir)/../../elfcpp -I.. \
18 -DLOCALEDIR="\"$(datadir)/locale\"" \
21 TEST_READELF = $(top_builddir)/../binutils/readelf
22 TEST_OBJDUMP = $(top_builddir)/../binutils/objdump
23 TEST_CXXFILT = $(top_builddir)/../binutils/cxxfilt
24 TEST_STRIP = $(top_builddir)/../binutils/strip-new
25 TEST_AR = $(top_builddir)/../binutils/ar
32 THREADSLIB = -lpthread
36 TLS_TEST_C_CFLAGS = -fopenmp
39 # 'make clean' is good about deleting some intermediate files (such as
40 # .o's), but not all of them (such as .so's and .err files). We
41 # improve on that here. automake-1.9 info docs say "mostlyclean" is
42 # the right choice for files 'make' builds that people rebuild.
43 MOSTLYCLEANFILES = *.so
46 # We will add to these later, for each individual test. Note
47 # that we add each test under check_SCRIPTS or check_PROGRAMS;
48 # the TESTS variable is automatically populated from these.
54 TESTS = $(check_SCRIPTS) $(check_PROGRAMS)
56 # ---------------------------------------------------------------------
57 # These tests test the internals of gold (unittests).
59 # Infrastucture needed for the unittests
60 check_LIBRARIES = libgoldtest.a
61 libgoldtest_a_SOURCES = test.cc testmain.cc testfile.cc
64 libgoldtest.a ../libgold.a ../../libiberty/libiberty.a $(LIBINTL_DEP)
65 LDADD = libgoldtest.a ../libgold.a ../../libiberty/libiberty.a $(LIBINTL) \
66 $(THREADSLIB) $(LIBDL)
69 # The unittests themselves
70 check_PROGRAMS += object_unittest
71 object_unittest_SOURCES = object_unittest.cc
73 check_PROGRAMS += binary_unittest
74 binary_unittest_SOURCES = binary_unittest.cc
77 # ---------------------------------------------------------------------
78 # These tests test the output of gold (end-to-end tests). In
79 # particular, they make sure that gold can link "difficult" object
80 # files, and the resulting object files run correctly. These can only
81 # run if we've built ld-new for the native architecture (that is,
82 # we're not cross-compiling it), since we run ld-new as part of these
83 # tests. We use the gcc-specific flag '-B' to use our linker instead
84 # of the default linker, which is why we only run our tests under gcc.
89 # Infrastucture needed for the unittests: a directory where the linker
90 # is named 'ld'. This is because the -B flag appends 'ld' to its arg.
91 gcctestdir/ld: ../ld-new
92 test -d gcctestdir || mkdir -p gcctestdir
94 (cd gcctestdir && $(LN_S) ../../ld-new ld)
96 # Each of these .o's is a useful, small complete program. They're
97 # particularly useful for making sure ld-new's flags do what they're
98 # supposed to (hence their names), but are used for many tests that
99 # don't actually involve analyzing input data.
100 flagstest_debug.o: constructor_test.cc
101 $(CXXCOMPILE) -O0 -g -c -o $@ $<
102 flagstest_ndebug.o: constructor_test.cc
103 $(CXXCOMPILE) -O0 -c -o $@ $<
106 check_PROGRAMS += basic_test
107 check_PROGRAMS += basic_static_test
108 check_PROGRAMS += basic_pic_test
109 check_PROGRAMS += basic_static_pic_test
110 basic_test.o: basic_test.cc
111 $(CXXCOMPILE) -O0 -c -o $@ $<
112 basic_test: basic_test.o gcctestdir/ld
113 $(CXXLINK) -Bgcctestdir/ basic_test.o
114 basic_static_test: basic_test.o gcctestdir/ld
115 $(CXXLINK) -Bgcctestdir/ -static basic_test.o
117 basic_pic_test.o: basic_test.cc
118 $(CXXCOMPILE) -O0 -c -fpic -o $@ $<
119 basic_pic_test: basic_pic_test.o gcctestdir/ld
120 $(CXXLINK) -Bgcctestdir/ basic_pic_test.o
121 basic_static_pic_test: basic_pic_test.o gcctestdir/ld
122 $(CXXLINK) -Bgcctestdir/ -static basic_pic_test.o
125 check_PROGRAMS += constructor_test
126 check_PROGRAMS += constructor_static_test
127 constructor_test_SOURCES = constructor_test.cc
128 constructor_test_DEPENDENCIES = gcctestdir/ld
129 constructor_test_LDFLAGS = -Bgcctestdir/
131 constructor_static_test_SOURCES = $(constructor_test_SOURCES)
132 constructor_static_test_DEPENDENCIES = $(constructor_test_DEPENDENCIES)
133 constructor_static_test_LDFLAGS = $(constructor_test_LDFLAGS) -static
136 check_PROGRAMS += two_file_test
137 check_PROGRAMS += two_file_static_test
138 check_PROGRAMS += two_file_pic_test
139 two_file_test_SOURCES = \
141 two_file_test_1b.cc \
143 two_file_test_main.cc \
145 two_file_test_DEPENDENCIES = gcctestdir/ld
146 two_file_test_LDFLAGS = -Bgcctestdir/
148 two_file_static_test_SOURCES = $(two_file_test_SOURCES)
149 two_file_static_test_DEPENDENCIES = $(two_file_test_DEPENDENCIES)
150 two_file_static_test_LDFLAGS = $(two_file_test_LDFLAGS) -static
152 two_file_pic_test_SOURCES = two_file_test_main.cc
153 two_file_pic_test_DEPENDENCIES = \
154 gcctestdir/ld two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o
155 two_file_pic_test_LDFLAGS = -Bgcctestdir/
156 two_file_pic_test_LDADD = two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o
159 check_PROGRAMS += two_file_shared_1_test
160 check_PROGRAMS += two_file_shared_2_test
161 check_PROGRAMS += two_file_shared_1_pic_2_test
162 check_PROGRAMS += two_file_shared_2_pic_1_test
163 check_PROGRAMS += two_file_same_shared_test
164 check_PROGRAMS += two_file_separate_shared_12_test
165 check_PROGRAMS += two_file_separate_shared_21_test
166 two_file_test_1_pic.o: two_file_test_1.cc
167 $(CXXCOMPILE) -c -fpic -o $@ $<
168 two_file_test_1b_pic.o: two_file_test_1b.cc
169 $(CXXCOMPILE) -c -fpic -o $@ $<
170 two_file_test_2_pic.o: two_file_test_2.cc
171 $(CXXCOMPILE) -c -fpic -o $@ $<
172 two_file_shared_1.so: two_file_test_1_pic.o two_file_test_1b_pic.o gcctestdir/ld
173 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1_pic.o two_file_test_1b_pic.o
174 two_file_shared_2.so: two_file_test_2_pic.o gcctestdir/ld
175 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_2_pic.o
176 two_file_shared.so: two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o gcctestdir/ld
177 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o
179 two_file_shared_1_test_SOURCES = two_file_test_2.cc two_file_test_main.cc
180 two_file_shared_1_test_DEPENDENCIES = gcctestdir/ld two_file_shared_1.so
181 two_file_shared_1_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
182 two_file_shared_1_test_LDADD = two_file_shared_1.so
184 two_file_shared_2_test_SOURCES = two_file_test_1.cc two_file_test_1b.cc two_file_test_main.cc
185 two_file_shared_2_test_DEPENDENCIES = gcctestdir/ld two_file_shared_2.so
186 two_file_shared_2_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
187 two_file_shared_2_test_LDADD = two_file_shared_2.so
189 two_file_shared_1_pic_2_test_SOURCES = two_file_test_main.cc
190 two_file_shared_1_pic_2_test_DEPENDENCIES = \
191 gcctestdir/ld two_file_shared_1.so two_file_test_1_pic.o two_file_test_1b_pic.o
192 two_file_shared_1_pic_2_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
193 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
195 two_file_shared_2_pic_1_test_SOURCES = two_file_test_main.cc
196 two_file_shared_2_pic_1_test_DEPENDENCIES = \
197 gcctestdir/ld two_file_shared_2.so two_file_test_2_pic.o
198 two_file_shared_2_pic_1_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
199 two_file_shared_2_pic_1_test_LDADD = two_file_test_2_pic.o two_file_shared_1.so
201 two_file_same_shared_test_SOURCES = two_file_test_main.cc
202 two_file_same_shared_test_DEPENDENCIES = gcctestdir/ld two_file_shared.so
203 two_file_same_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
204 two_file_same_shared_test_LDADD = two_file_shared.so
206 two_file_separate_shared_12_test_SOURCES = two_file_test_main.cc
207 two_file_separate_shared_12_test_DEPENDENCIES = \
208 gcctestdir/ld two_file_shared_1.so two_file_shared_2.so
209 two_file_separate_shared_12_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
210 two_file_separate_shared_12_test_LDADD = \
211 two_file_shared_1.so two_file_shared_2.so
213 two_file_separate_shared_21_test_SOURCES = two_file_test_main.cc
214 two_file_separate_shared_21_test_DEPENDENCIES = \
215 gcctestdir/ld two_file_shared_1.so two_file_shared_2.so
216 two_file_separate_shared_21_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
217 two_file_separate_shared_21_test_LDADD = \
218 two_file_shared_2.so two_file_shared_1.so
220 check_PROGRAMS += two_file_relocatable_test
221 two_file_relocatable_test_SOURCES = two_file_test_main.cc
222 two_file_relocatable_test_DEPENDENCIES = \
223 gcctestdir/ld two_file_relocatable.o
224 two_file_relocatable_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
225 two_file_relocatable_test_LDADD = two_file_relocatable.o
226 two_file_relocatable.o: gcctestdir/ld two_file_test_1.o two_file_test_1b.o two_file_test_2.o
227 gcctestdir/ld -r -o $@ two_file_test_1.o two_file_test_1b.o two_file_test_2.o
229 check_SCRIPTS += two_file_shared.sh
230 check_DATA += two_file_shared.dbg
231 two_file_shared.dbg: two_file_shared.so
232 $(TEST_READELF) -w $< >$@ 2>/dev/null
234 # The nonpic tests will fail on platforms which can not put non-PIC
235 # code into shared libraries, so we just don't run them in that case.
236 if FN_PTRS_IN_SO_WITHOUT_PIC
238 check_PROGRAMS += two_file_shared_1_nonpic_test
239 check_PROGRAMS += two_file_shared_2_nonpic_test
240 check_PROGRAMS += two_file_same_shared_nonpic_test
241 check_PROGRAMS += two_file_separate_shared_12_nonpic_test
242 check_PROGRAMS += two_file_separate_shared_21_nonpic_test
243 check_PROGRAMS += two_file_mixed_shared_test
244 check_PROGRAMS += two_file_mixed_2_shared_test
245 two_file_shared_1_nonpic.so: two_file_test_1.o gcctestdir/ld
246 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1.o two_file_test_1b.o
247 two_file_shared_2_nonpic.so: two_file_test_2.o gcctestdir/ld
248 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_2.o
249 two_file_shared_nonpic.so: two_file_test_1.o two_file_test_1b.o two_file_test_2.o gcctestdir/ld
250 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1.o two_file_test_1b.o two_file_test_2.o
251 two_file_shared_mixed.so: two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2.o gcctestdir/ld
252 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2.o
253 two_file_shared_mixed_1.so: two_file_test_1.o two_file_test_1b_pic.o two_file_shared_2.so gcctestdir/ld
254 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1.o two_file_test_1b_pic.o two_file_shared_2.so
256 two_file_shared_1_nonpic_test_SOURCES = \
257 two_file_test_2.cc two_file_test_main.cc
258 two_file_shared_1_nonpic_test_DEPENDENCIES = \
259 gcctestdir/ld two_file_shared_1_nonpic.so
260 two_file_shared_1_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
261 two_file_shared_1_nonpic_test_LDADD = two_file_shared_1_nonpic.so
263 two_file_shared_2_nonpic_test_SOURCES = \
264 two_file_test_1.cc two_file_test_1b.cc two_file_test_main.cc
265 two_file_shared_2_nonpic_test_DEPENDENCIES = \
266 gcctestdir/ld two_file_shared_2_nonpic.so
267 two_file_shared_2_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
268 two_file_shared_2_nonpic_test_LDADD = two_file_shared_2_nonpic.so
270 two_file_same_shared_nonpic_test_SOURCES = two_file_test_main.cc
271 two_file_same_shared_nonpic_test_DEPENDENCIES = \
272 gcctestdir/ld two_file_shared_nonpic.so
273 two_file_same_shared_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
274 two_file_same_shared_nonpic_test_LDADD = two_file_shared_nonpic.so
276 two_file_separate_shared_12_nonpic_test_SOURCES = two_file_test_main.cc
277 two_file_separate_shared_12_nonpic_test_DEPENDENCIES = \
278 gcctestdir/ld two_file_shared_1_nonpic.so two_file_shared_2_nonpic.so
279 two_file_separate_shared_12_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
280 two_file_separate_shared_12_nonpic_test_LDADD = \
281 two_file_shared_1_nonpic.so two_file_shared_2_nonpic.so
283 two_file_separate_shared_21_nonpic_test_SOURCES = two_file_test_main.cc
284 two_file_separate_shared_21_nonpic_test_DEPENDENCIES = \
285 gcctestdir/ld two_file_shared_1_nonpic.so two_file_shared_2_nonpic.so
286 two_file_separate_shared_21_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
287 two_file_separate_shared_21_nonpic_test_LDADD = \
288 two_file_shared_2_nonpic.so two_file_shared_1_nonpic.so
290 two_file_mixed_shared_test_SOURCES = two_file_test_main.cc
291 two_file_mixed_shared_test_DEPENDENCIES = gcctestdir/ld two_file_shared_mixed.so
292 two_file_mixed_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
293 two_file_mixed_shared_test_LDADD = two_file_shared_mixed.so
295 two_file_mixed_2_shared_test_SOURCES = two_file_test_main.cc
296 two_file_mixed_2_shared_test_DEPENDENCIES = gcctestdir/ld two_file_shared_mixed_1.so two_file_shared_2.so
297 two_file_mixed_2_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
298 two_file_mixed_2_shared_test_LDADD = two_file_shared_mixed_1.so two_file_shared_2.so
300 endif FN_PTRS_IN_SO_WITHOUT_PIC
302 check_PROGRAMS += two_file_strip_test
303 two_file_strip_test: two_file_test
304 $(TEST_STRIP) -o two_file_strip_test two_file_test
306 check_PROGRAMS += two_file_same_shared_strip_test
307 two_file_same_shared_strip_test_SOURCES = two_file_test_main.cc
308 two_file_same_shared_strip_test_DEPENDENCIES = \
309 gcctestdir/ld two_file_shared_strip.so
310 two_file_same_shared_strip_test_LDFLAGS = -Bgcctestdir/ -Wl,-R.
311 two_file_same_shared_strip_test_LDADD = two_file_shared_strip.so
312 two_file_shared_strip.so: two_file_shared.so
313 $(TEST_STRIP) -S -o two_file_shared_strip.so two_file_shared.so
315 check_PROGRAMS += common_test_1
316 common_test_1_SOURCES = common_test_1.c
317 common_test_1_DEPENDENCIES = gcctestdir/ld
318 common_test_1_LDFLAGS = -Bgcctestdir/
320 check_PROGRAMS += exception_test
321 check_PROGRAMS += exception_static_test
322 check_PROGRAMS += exception_shared_1_test
323 check_PROGRAMS += exception_shared_2_test
324 check_PROGRAMS += exception_same_shared_test
325 check_PROGRAMS += exception_separate_shared_12_test
326 check_PROGRAMS += exception_separate_shared_21_test
327 exception_test_1_pic.o: exception_test_1.cc
328 $(CXXCOMPILE) -c -fpic -o $@ $<
329 exception_test_2_pic.o: exception_test_2.cc
330 $(CXXCOMPILE) -c -fpic -o $@ $<
331 exception_shared_1.so: exception_test_1_pic.o gcctestdir/ld
332 $(CXXLINK) -Bgcctestdir/ -shared exception_test_1_pic.o
333 exception_shared_2.so: exception_test_2_pic.o gcctestdir/ld
334 $(CXXLINK) -Bgcctestdir/ -shared exception_test_2_pic.o
335 exception_shared.so: exception_test_1_pic.o exception_test_2_pic.o gcctestdir/ld
336 $(CXXLINK) -Bgcctestdir/ -shared exception_test_1_pic.o exception_test_2_pic.o
338 exception_test_SOURCES = \
339 exception_test_main.cc \
340 exception_test_1.cc \
341 exception_test_2.cc \
343 exception_test_DEPENDENCIES = gcctestdir/ld
344 exception_test_LDFLAGS = -Bgcctestdir/
346 exception_static_test_SOURCES = $(exception_test_SOURCES)
347 exception_static_test_DEPENDENCIES = $(exception_test_DEPENDENCIES)
348 exception_static_test_LDFLAGS = $(exception_test_LDFLAGS) -static
350 exception_shared_1_test_SOURCES = exception_test_2.cc exception_test_main.cc
351 exception_shared_1_test_DEPENDENCIES = gcctestdir/ld exception_shared_1.so
352 exception_shared_1_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
353 exception_shared_1_test_LDADD = exception_shared_1.so
355 exception_shared_2_test_SOURCES = exception_test_1.cc exception_test_main.cc
356 exception_shared_2_test_DEPENDENCIES = gcctestdir/ld exception_shared_2.so
357 exception_shared_2_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
358 exception_shared_2_test_LDADD = exception_shared_2.so
360 exception_same_shared_test_SOURCES = exception_test_main.cc
361 exception_same_shared_test_DEPENDENCIES = gcctestdir/ld exception_shared.so
362 exception_same_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
363 exception_same_shared_test_LDADD = exception_shared.so
365 exception_separate_shared_12_test_SOURCES = exception_test_main.cc
366 exception_separate_shared_12_test_DEPENDENCIES = \
367 gcctestdir/ld exception_shared_1.so exception_shared_2.so
368 exception_separate_shared_12_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
369 exception_separate_shared_12_test_LDADD = \
370 exception_shared_1.so exception_shared_2.so
372 exception_separate_shared_21_test_SOURCES = exception_test_main.cc
373 exception_separate_shared_21_test_DEPENDENCIES = \
374 gcctestdir/ld exception_shared_1.so exception_shared_2.so
375 exception_separate_shared_21_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
376 exception_separate_shared_21_test_LDADD = \
377 exception_shared_2.so exception_shared_1.so
380 check_PROGRAMS += weak_test
381 weak_test_SOURCES = weak_test.cc
382 weak_test_DEPENDENCIES = gcctestdir/ld
383 weak_test_LDFLAGS = -Bgcctestdir/
385 check_PROGRAMS += weak_undef_test
386 weak_undef_test_SOURCES = weak_undef_test.cc
387 weak_undef_test_DEPENDENCIES = gcctestdir/ld weak_undef_lib.so alt/weak_undef_lib.so
388 weak_undef_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,alt
389 weak_undef_test_LDADD = -L . weak_undef_lib.so
390 weak_undef_file1.o: weak_undef_file1.cc
391 $(CXXCOMPILE) -c -fpic -o $@ $<
392 weak_undef_file2.o: weak_undef_file2.cc
393 $(CXXCOMPILE) -c -fpic -o $@ $<
394 weak_undef_lib.so: weak_undef_file1.o
395 $(CXXLINK) -Bgcctestdir/ -shared weak_undef_file1.o
396 alt/weak_undef_lib.so: weak_undef_file2.o
397 test -d alt || mkdir -p alt
398 $(CXXLINK) -Bgcctestdir/ -shared weak_undef_file2.o
400 if FN_PTRS_IN_SO_WITHOUT_PIC
401 check_PROGRAMS += weak_undef_nonpic_test
402 weak_undef_nonpic_test_SOURCES = weak_undef_test.cc
403 weak_undef_nonpic_test_DEPENDENCIES = gcctestdir/ld weak_undef_lib_nonpic.so alt/weak_undef_lib_nonpic.so
404 weak_undef_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,alt
405 weak_undef_nonpic_test_LDADD = -L . weak_undef_lib_nonpic.so
406 weak_undef_file1_nonpic.o: weak_undef_file1.cc
407 $(CXXCOMPILE) -c -o $@ $<
408 weak_undef_file2_nonpic.o: weak_undef_file2.cc
409 $(CXXCOMPILE) -c -o $@ $<
410 weak_undef_lib_nonpic.so: weak_undef_file1_nonpic.o
411 $(CXXLINK) -Bgcctestdir/ -shared weak_undef_file1_nonpic.o
412 alt/weak_undef_lib_nonpic.so: weak_undef_file2_nonpic.o
413 test -d alt || mkdir -p alt
414 $(CXXLINK) -Bgcctestdir/ -shared weak_undef_file2_nonpic.o
415 endif FN_PTRS_IN_SO_WITHOUT_PIC
418 check_PROGRAMS += weak_alias_test
419 weak_alias_test_SOURCES = weak_alias_test_main.cc
420 weak_alias_test_DEPENDENCIES = \
421 gcctestdir/ld weak_alias_test_1.so weak_alias_test_2.so \
422 weak_alias_test_3.o weak_alias_test_4.so
423 weak_alias_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
424 weak_alias_test_LDADD = \
425 weak_alias_test_1.so weak_alias_test_2.so weak_alias_test_3.o \
427 weak_alias_test_1_pic.o: weak_alias_test_1.cc
428 $(CXXCOMPILE) -c -fpic -o $@ $<
429 weak_alias_test_1.so: weak_alias_test_1_pic.o gcctestdir/ld
430 $(CXXLINK) -Bgcctestdir/ -shared weak_alias_test_1_pic.o
431 weak_alias_test_2_pic.o: weak_alias_test_2.cc
432 $(CXXCOMPILE) -c -fpic -o $@ $<
433 weak_alias_test_2.so: weak_alias_test_2_pic.o gcctestdir/ld
434 $(CXXLINK) -Bgcctestdir/ -shared weak_alias_test_2_pic.o
435 weak_alias_test_3.o: weak_alias_test_3.cc
436 $(CXXCOMPILE) -c -o $@ $<
437 weak_alias_test_4_pic.o: weak_alias_test_4.cc
438 $(CXXCOMPILE) -c -fpic -o $@ $<
439 weak_alias_test_4.so: weak_alias_test_4_pic.o gcctestdir/ld
440 $(CXXLINK) -Bgcctestdir/ -shared weak_alias_test_4_pic.o
442 check_SCRIPTS += weak_plt.sh
443 check_PROGRAMS += weak_plt
444 check_DATA += weak_plt_shared.so
445 weak_plt_main_pic.o: weak_plt_main.cc
446 $(CXXCOMPILE) -c -fpic -o $@ $<
447 weak_plt: weak_plt_main_pic.o gcctestdir/ld
448 $(CXXLINK) -Bgcctestdir/ weak_plt_main_pic.o
449 weak_plt_shared_pic.o: weak_plt_shared.cc
450 $(CXXCOMPILE) -c -fpic -o $@ $<
451 weak_plt_shared.so: weak_plt_shared_pic.o gcctestdir/ld
452 $(CXXLINK) -Bgcctestdir/ -shared weak_plt_shared_pic.o
454 check_PROGRAMS += copy_test
455 copy_test_SOURCES = copy_test.cc
456 copy_test_DEPENDENCIES = gcctestdir/ld copy_test_1.so copy_test_2.so
457 copy_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
458 copy_test_LDADD = copy_test_1.so copy_test_2.so
459 copy_test_1_pic.o: copy_test_1.cc
460 $(CXXCOMPILE) -c -fpic -o $@ $<
461 copy_test_1.so: gcctestdir/ld copy_test_1_pic.o
462 $(CXXLINK) -Bgcctestdir/ -shared copy_test_1_pic.o
463 copy_test_2_pic.o: copy_test_2.cc
464 $(CXXCOMPILE) -c -fpic -o $@ $<
465 copy_test_2.so: gcctestdir/ld copy_test_2_pic.o
466 $(CXXLINK) -Bgcctestdir/ -shared copy_test_2_pic.o
470 check_PROGRAMS += tls_test
471 check_PROGRAMS += tls_pic_test
472 check_PROGRAMS += tls_shared_test
473 check_PROGRAMS += tls_shared_ie_test
474 check_PROGRAMS += tls_shared_gd_to_ie_test
475 tls_test_pic.o: tls_test.cc
476 $(CXXCOMPILE) -c -fpic -o $@ $<
477 tls_test_file2_pic.o: tls_test_file2.cc
478 $(CXXCOMPILE) -c -fpic -o $@ $<
479 tls_test_c_pic.o: tls_test_c.c
480 $(COMPILE) -c -fpic $(TLS_TEST_C_CFLAGS) -o $@ $<
481 tls_test_shared.so: tls_test_pic.o tls_test_file2_pic.o tls_test_c_pic.o gcctestdir/ld
482 $(CXXLINK) -Bgcctestdir/ -shared tls_test_pic.o tls_test_file2_pic.o tls_test_c_pic.o -Wl,-z,defs
483 tls_test_shared2.so: tls_test_file2_pic.o gcctestdir/ld
484 $(CXXLINK) -Bgcctestdir/ -shared tls_test_file2_pic.o
486 tls_test_pic_ie.o: tls_test.cc
487 $(CXXCOMPILE) -c -fpic -ftls-model=initial-exec -o $@ $<
488 tls_test_file2_pic_ie.o: tls_test_file2.cc
489 $(CXXCOMPILE) -c -fpic -ftls-model=initial-exec -o $@ $<
490 tls_test_c_pic_ie.o: tls_test_c.c
491 $(COMPILE) -c -fpic -ftls-model=initial-exec $(TLS_TEST_C_CFLAGS) -o $@ $<
492 tls_test_ie_shared.so: tls_test_pic_ie.o tls_test_file2_pic_ie.o tls_test_c_pic_ie.o gcctestdir/ld
493 $(CXXLINK) -Bgcctestdir/ -shared tls_test_pic_ie.o tls_test_file2_pic_ie.o tls_test_c_pic_ie.o
495 tls_test_SOURCES = tls_test.cc tls_test_file2.cc tls_test_main.cc tls_test.h
496 tls_test_DEPENDENCIES = gcctestdir/ld tls_test_c.o
497 tls_test_LDFLAGS = -Bgcctestdir/
498 tls_test_LDADD = tls_test_c.o -lpthread
499 tls_test_c.o: tls_test_c.c
500 $(COMPILE) -c $(TLS_TEST_C_CFLAGS) -o $@ $<
502 tls_pic_test_SOURCES = tls_test_main.cc
503 tls_pic_test_DEPENDENCIES = gcctestdir/ld tls_test_pic.o tls_test_file2_pic.o \
505 tls_pic_test_LDFLAGS = -Bgcctestdir/
506 tls_pic_test_LDADD = tls_test_pic.o tls_test_file2_pic.o tls_test_c_pic.o \
509 tls_shared_test_SOURCES = tls_test_main.cc
510 tls_shared_test_DEPENDENCIES = gcctestdir/ld tls_test_shared.so
511 tls_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
512 tls_shared_test_LDADD = tls_test_shared.so -lpthread
514 tls_shared_ie_test_SOURCES = tls_test_main.cc
515 tls_shared_ie_test_DEPENDENCIES = gcctestdir/ld tls_test_ie_shared.so
516 tls_shared_ie_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
517 tls_shared_ie_test_LDADD = tls_test_ie_shared.so -lpthread
519 tls_shared_gd_to_ie_test_SOURCES = tls_test_main.cc
520 tls_shared_gd_to_ie_test_DEPENDENCIES = gcctestdir/ld tls_test_pic.o \
521 tls_test_c_pic.o tls_test_shared2.so
522 tls_shared_gd_to_ie_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
523 tls_shared_gd_to_ie_test_LDADD = tls_test_pic.o tls_test_c_pic.o \
524 tls_test_shared2.so -lpthread
528 check_PROGRAMS += tls_shared_gnu2_gd_to_ie_test
530 tls_test_gnu2.o: tls_test.cc
531 $(CXXCOMPILE) -c -fpic -mtls-dialect=gnu2 -o $@ $<
532 tls_test_file2_gnu2.o: tls_test_file2.cc
533 $(CXXCOMPILE) -c -fpic -mtls-dialect=gnu2 -o $@ $<
534 tls_test_c_gnu2.o: tls_test_c.c
535 $(COMPILE) -c -fpic -mtls-dialect=gnu2 $(TLS_TEST_C_CFLAGS) -o $@ $<
536 tls_test_gnu2_shared2.so: tls_test_file2_gnu2.o gcctestdir/ld
537 $(CXXLINK) -Bgcctestdir/ -shared tls_test_file2_gnu2.o
539 tls_shared_gnu2_gd_to_ie_test_SOURCES = tls_test_main.cc
540 tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES = gcctestdir/ld tls_test_gnu2.o \
541 tls_test_c_gnu2.o tls_test_gnu2_shared2.so
542 tls_shared_gnu2_gd_to_ie_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
543 tls_shared_gnu2_gd_to_ie_test_LDADD = tls_test_gnu2.o tls_test_c_gnu2.o \
544 tls_test_gnu2_shared2.so -lpthread
548 check_PROGRAMS += tls_shared_gnu2_test
550 tls_test_gnu2_shared.so: tls_test_gnu2.o tls_test_file2_gnu2.o tls_test_c_gnu2.o gcctestdir/ld
551 $(CXXLINK) -Bgcctestdir/ -shared tls_test_gnu2.o tls_test_file2_gnu2.o tls_test_c_gnu2.o
553 tls_shared_gnu2_test_SOURCES = tls_test_main.cc
554 tls_shared_gnu2_test_DEPENDENCIES = gcctestdir/ld tls_test_gnu2_shared.so
555 tls_shared_gnu2_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
556 tls_shared_gnu2_test_LDADD = tls_test_gnu2_shared.so -lpthread
558 endif TLS_DESCRIPTORS
560 endif TLS_GNU2_DIALECT
563 check_PROGRAMS += tls_static_test
564 check_PROGRAMS += tls_static_pic_test
566 tls_static_test_SOURCES = $(tls_test_SOURCES)
567 tls_static_test_DEPENDENCIES = $(tls_test_DEPENDENCIES)
568 tls_static_test_LDFLAGS = $(tls_test_LDFLAGS) -static
569 tls_static_test_LDADD = $(tls_test_LDADD)
571 tls_static_pic_test_SOURCES = $(tls_pic_test_SOURCES)
572 tls_static_pic_test_DEPENDENCIES = $(tls_pic_test_DEPENDENCIES)
573 tls_static_pic_test_LDFLAGS = $(tls_pic_test_LDFLAGS) -static
574 tls_static_pic_test_LDADD = $(tls_pic_test_LDADD)
577 if FN_PTRS_IN_SO_WITHOUT_PIC
578 check_PROGRAMS += tls_shared_nonpic_test
579 tls_test_shared_nonpic.so: tls_test.o tls_test_file2.o tls_test_c.o gcctestdir/ld
580 $(CXXLINK) -Bgcctestdir/ -shared tls_test.o tls_test_file2.o tls_test_c.o
582 tls_shared_nonpic_test_SOURCES = tls_test_main.cc
583 tls_shared_nonpic_test_DEPENDENCIES = gcctestdir/ld tls_test_shared_nonpic.so
584 tls_shared_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
585 tls_shared_nonpic_test_LDADD = tls_test_shared_nonpic.so -lpthread
586 endif FN_PTRS_IN_SO_WITHOUT_PIC
590 check_PROGRAMS += many_sections_test
591 many_sections_test_SOURCES = many_sections_test.cc
592 many_sections_test_DEPENDENCIES = gcctestdir/ld
593 many_sections_test_LDFLAGS = -Bgcctestdir/ -rdynamic
595 BUILT_SOURCES += many_sections_define.h
596 many_sections_define.h:
597 (for i in `seq 1 70000`; do \
598 echo "int var_$$i __attribute__((section(\"section_$$i\"))) = $$i;"; \
602 BUILT_SOURCES += many_sections_check.h
603 many_sections_check.h:
604 (for i in `seq 1 1000 70000`; do \
605 echo "assert(var_$$i == $$i);"; \
609 check_PROGRAMS += many_sections_r_test
610 many_sections_r_test.o: many_sections_test.o gcctestdir/ld
611 gcctestdir/ld -r -o $@ many_sections_test.o
612 many_sections_r_test: many_sections_r_test.o gcctestdir/ld
613 $(CXXLINK) -Bgcctestdir/ many_sections_r_test.o $(LIBS)
615 if CONSTRUCTOR_PRIORITY
617 check_PROGRAMS += initpri1
618 initpri1_SOURCES = initpri1.c
619 initpri1_DEPENDENCIES = gcctestdir/ld
620 initpri1_LDFLAGS = -Bgcctestdir/
625 # Test --detect-odr-violations
626 check_SCRIPTS += debug_msg.sh
628 # Create the data files that debug_msg.sh analyzes.
629 check_DATA += debug_msg.err
630 MOSTLYCLEANFILES += debug_msg.err
631 debug_msg.o: debug_msg.cc
632 $(CXXCOMPILE) -O0 -g -c -w -o $@ $(srcdir)/debug_msg.cc
633 odr_violation1.o: odr_violation1.cc
634 $(CXXCOMPILE) -O0 -g -c -w -o $@ $(srcdir)/odr_violation1.cc
635 odr_violation2.o: odr_violation2.cc
636 $(CXXCOMPILE) -O0 -g -c -w -o $@ $(srcdir)/odr_violation2.cc
637 debug_msg.err: debug_msg.o odr_violation1.o odr_violation2.o gcctestdir/ld
638 @echo $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg debug_msg.o odr_violation1.o odr_violation2.o "2>$@"
639 @if $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg debug_msg.o odr_violation1.o odr_violation2.o 2>$@; \
641 echo 1>&2 "Link of debug_msg should have failed"; \
646 # See if we can also detect problems when we're linking .so's, not .o's.
647 check_DATA += debug_msg_so.err
648 MOSTLYCLEANFILES += debug_msg_so.err
649 debug_msg.so: debug_msg.cc gcctestdir/ld
650 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -shared -fPIC -w -o $@ $(srcdir)/debug_msg.cc
651 odr_violation1.so: odr_violation1.cc gcctestdir/ld
652 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -shared -fPIC -w -o $@ $(srcdir)/odr_violation1.cc
653 odr_violation2.so: odr_violation2.cc gcctestdir/ld
654 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -shared -fPIC -w -o $@ $(srcdir)/odr_violation2.cc
655 debug_msg_so.err: debug_msg.so odr_violation1.so odr_violation2.so gcctestdir/ld
656 @echo $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_so debug_msg.so odr_violation1.so odr_violation2.so "2>$@"
657 @if $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_so debug_msg.so odr_violation1.so odr_violation2.so 2>$@; \
659 echo 1>&2 "Link of debug_msg_so should have failed"; \
664 # We also want to make sure we do something reasonable when there's no
665 # debug info available. For the best test, we use .so's.
666 check_DATA += debug_msg_ndebug.err
667 MOSTLYCLEANFILES += debug_msg_ndebug.err
668 debug_msg_ndebug.so: debug_msg.cc gcctestdir/ld
669 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g0 -shared -fPIC -w -o $@ $(srcdir)/debug_msg.cc
670 odr_violation1_ndebug.so: odr_violation1.cc gcctestdir/ld
671 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g0 -shared -fPIC -w -o $@ $(srcdir)/odr_violation1.cc
672 odr_violation2_ndebug.so: odr_violation2.cc gcctestdir/ld
673 $(CXXCOMPILE) -Bgcctestdir/ -O0 -g0 -shared -fPIC -w -o $@ $(srcdir)/odr_violation2.cc
674 debug_msg_ndebug.err: debug_msg_ndebug.so odr_violation1_ndebug.so odr_violation2_ndebug.so gcctestdir/ld
675 @echo $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_ndebug debug_msg_ndebug.so odr_violation1_ndebug.so odr_violation2_ndebug.so "2>$@"
676 @if $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_ndebug debug_msg_ndebug.so odr_violation1_ndebug.so odr_violation2_ndebug.so 2>$@; \
678 echo 1>&2 "Link of debug_msg_ndebug should have failed"; \
684 # Similar to --detect-odr-violations: check for undefined symbols in .so's
685 check_SCRIPTS += undef_symbol.sh
686 check_DATA += undef_symbol.err
687 MOSTLYCLEANFILES += undef_symbol.err
688 undef_symbol.o: undef_symbol.cc
689 $(CXXCOMPILE) -O0 -g -c -fPIC $<
690 undef_symbol.so: undef_symbol.o gcctestdir/ld
691 $(CXXLINK) -Bgcctestdir/ -shared undef_symbol.o
692 undef_symbol.err: undef_symbol_main.o undef_symbol.so gcctestdir/ld
693 @echo $(CXXLINK) -Bgcctestdir/ -o undef_symbol_test undef_symbol_main.o undef_symbol.so "2>$@"
694 @if $(CXXLINK) -Bgcctestdir/ -o undef_symbol_test undef_symbol_main.o undef_symbol.so 2>$@; \
696 echo 1>&2 "Link of undef_symbol_test should have failed"; \
702 # Test -o when emitting to a special file (such as something in /dev).
703 check_PROGRAMS += flagstest_o_specialfile
704 flagstest_o_specialfile: flagstest_debug.o gcctestdir/ld
705 $(CXXLINK) -Bgcctestdir/ -o /dev/stdout $< 2>&1 | cat > $@
711 # Test --compress-debug-sections. FIXME: check we actually compress.
712 check_PROGRAMS += flagstest_compress_debug_sections
713 flagstest_compress_debug_sections: flagstest_debug.o gcctestdir/ld
714 $(CXXLINK) -Bgcctestdir/ -o $@ $< -Wl,--compress-debug-sections=zlib
718 # The specialfile output has a tricky case when we also compress debug
719 # sections, because it requires output-file resizing.
720 check_PROGRAMS += flagstest_o_specialfile_and_compress_debug_sections
721 flagstest_o_specialfile_and_compress_debug_sections: flagstest_debug.o \
723 $(CXXLINK) -Bgcctestdir/ -o /dev/stdout $< -Wl,--compress-debug-sections=zlib 2>&1 | cat > $@
729 # Test symbol versioning.
730 check_PROGRAMS += ver_test
731 ver_test_SOURCES = ver_test_main.cc
732 ver_test_DEPENDENCIES = gcctestdir/ld ver_test_1.so ver_test_2.so ver_test_4.so
733 ver_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
734 ver_test_LDADD = ver_test_1.so ver_test_2.so ver_test_4.so
735 ver_test_1.so: ver_test_1.o ver_test_2.so ver_test_3.o ver_test_4.so gcctestdir/ld
736 $(CXXLINK) -Bgcctestdir/ -shared ver_test_1.o ver_test_2.so ver_test_3.o ver_test_4.so
737 ver_test_2.so: ver_test_2.o $(srcdir)/ver_test_2.script ver_test_4.so gcctestdir/ld
738 $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_2.script ver_test_2.o ver_test_4.so
739 ver_test_4.so: ver_test_4.o $(srcdir)/ver_test_4.script gcctestdir/ld
740 $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_4.script ver_test_4.o
741 ver_test_1.o: ver_test_1.cc
742 $(CXXCOMPILE) -c -fpic -o $@ $<
743 ver_test_2.o: ver_test_2.cc
744 $(CXXCOMPILE) -c -fpic -o $@ $<
745 ver_test_3.o: ver_test_3.cc
746 $(CXXCOMPILE) -c -fpic -o $@ $<
747 ver_test_4.o: ver_test_4.cc
748 $(CXXCOMPILE) -c -fpic -o $@ $<
750 check_SCRIPTS += ver_test_1.sh
751 check_DATA += ver_test_1.syms
752 ver_test_1.syms: ver_test_1.so
753 $(TEST_READELF) -s $< >$@ 2>/dev/null
755 check_PROGRAMS += ver_test_2
756 ver_test_2_SOURCES = ver_test_main_2.cc
757 ver_test_2_DEPENDENCIES = gcctestdir/ld ver_test_4.so ver_test_2.so
758 ver_test_2_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
759 ver_test_2_LDADD = ver_test_4.so ver_test_2.so
761 check_SCRIPTS += ver_test_2.sh
762 check_DATA += ver_test_2.syms
763 ver_test_2.syms: ver_test_2
764 $(TEST_READELF) -s $< >$@ 2>/dev/null
766 check_SCRIPTS += ver_test_4.sh
767 check_DATA += ver_test_4.syms
768 ver_test_4.syms: ver_test_4.so
769 $(TEST_READELF) -s $< >$@ 2>/dev/null
771 ver_test_5.so: ver_test_5.o $(srcdir)/ver_test_5.script ver_test_4.so gcctestdir/ld
772 $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_5.script ver_test_5.o ver_test_4.so
773 ver_test_5.o: ver_test_5.cc
774 $(CXXCOMPILE) -c -fpic -o $@ $<
775 check_SCRIPTS += ver_test_5.sh
776 check_DATA += ver_test_5.syms
777 ver_test_5.syms: ver_test_5.so
778 $(TEST_READELF) -s $< >$@ 2>/dev/null
780 check_PROGRAMS += ver_test_6
781 ver_test_6_SOURCES = ver_test_6.c
782 ver_test_6_DEPENDENCIES = gcctestdir/ld ver_test_2.so
783 ver_test_6_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
784 ver_test_6_LDADD = ver_test_2.so
786 ver_test_7.so: ver_test_4.o $(srcdir)/ver_test_4.script ver_test_7.o gcctestdir/ld
787 $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_4.script ver_test_4.o ver_test_7.o
788 ver_test_7.o: ver_test_7.cc
789 $(CXXCOMPILE) -c -fpic -o $@ $<
790 check_SCRIPTS += ver_test_7.sh
791 check_DATA += ver_test_7.syms
792 ver_test_7.syms: ver_test_7.so
793 $(TEST_READELF) -s $< >$@ 2>/dev/null
795 check_PROGRAMS += ver_test_8
796 ver_test_8_SOURCES = two_file_test_main.cc
797 ver_test_8_DEPENDENCIES = gcctestdir/ld ver_test_8_1.so ver_test_8_2.so
798 ver_test_8_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
799 ver_test_8_LDADD = ver_test_8_1.so ver_test_8_2.so
800 ver_test_8_1.so: two_file_test_1_pic.o two_file_test_1b_pic.o ver_test_8_2.so gcctestdir/ld
801 $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1_pic.o two_file_test_1b_pic.o ver_test_8_2.so
802 ver_test_8_2.so: two_file_test_2_pic.o $(srcdir)/ver_test_8.script gcctestdir/ld
803 $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_8.script two_file_test_2_pic.o
805 check_PROGRAMS += ver_test_9
806 ver_test_9_SOURCES = ver_test_main.cc
807 ver_test_9_DEPENDENCIES = gcctestdir/ld ver_test_9.so
808 ver_test_9_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
809 ver_test_9_LDADD = ver_test_9.so
810 ver_test_9.so: ver_test_9.o ver_test_4.so ver_test_5.so gcctestdir/ld
811 $(CXXLINK) -Bgcctestdir/ -shared ver_test_9.o ver_test_5.so ver_test_4.so
812 ver_test_9.o: ver_test_9.cc
813 $(CXXCOMPILE) -c -fpic -o $@ $<
815 check_SCRIPTS += ver_test_10.sh
816 check_DATA += ver_test_10.syms
817 ver_test_10.syms: ver_test_10.so
818 $(TEST_READELF) -s $< >$@ 2>/dev/null
819 ver_test_10.so: gcctestdir/ld ver_test_2.o ver_test_10.script
820 $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_10.script ver_test_2.o
822 check_PROGRAMS += ver_test_11
823 ver_test_11_SOURCES = ver_test_main_2.cc
824 ver_test_11_DEPENDENCIES = gcctestdir/ld ver_test_11.a
825 ver_test_11_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
826 ver_test_11_LDADD = ver_test_11.a
827 ver_test_11.a: ver_test_1.o ver_test_2.o ver_test_4.o
830 check_PROGRAMS += protected_1
831 protected_1_SOURCES = \
832 protected_main_1.cc protected_main_2.cc protected_main_3.cc
833 protected_1_DEPENDENCIES = gcctestdir/ld protected_1.so
834 protected_1_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
835 protected_1_LDADD = protected_1.so
837 protected_1.so: gcctestdir/ld protected_1_pic.o protected_2_pic.o protected_3_pic.o
838 $(CXXLINK) -Bgcctestdir/ -shared protected_1_pic.o protected_2_pic.o protected_3_pic.o
839 protected_1_pic.o: protected_1.cc
840 $(CXXCOMPILE) -c -fpic -o $@ $<
841 protected_2_pic.o: protected_2.cc
842 $(CXXCOMPILE) -c -fpic -o $@ $<
843 protected_3_pic.o: protected_3.cc
844 $(CXXCOMPILE) -c -fpic -o $@ $<
846 check_PROGRAMS += protected_2
847 protected_2_SOURCES = protected_main_1.cc protected_3.cc
848 protected_2_DEPENDENCIES = gcctestdir/ld protected_1.so
849 protected_2_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
850 protected_2_LDADD = protected_1.so
852 check_PROGRAMS += relro_test
853 relro_test_SOURCES = relro_test_main.cc
854 relro_test_DEPENDENCIES = gcctestdir/ld relro_test.so
855 relro_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
856 relro_test_LDADD = relro_test.so
857 relro_test.so: gcctestdir/ld relro_test_pic.o
858 $(CXXLINK) -Bgcctestdir/ -shared -Wl,-z,relro relro_test_pic.o
859 relro_test_pic.o: relro_test.cc
860 $(CXXCOMPILE) -c -fpic -o $@ $<
862 check_PROGRAMS += relro_script_test
863 relro_script_test_SOURCES = relro_test_main.cc
864 relro_script_test_DEPENDENCIES = gcctestdir/ld relro_script_test.so
865 relro_script_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
866 relro_script_test_LDADD = relro_script_test.so
867 relro_script_test.so: gcctestdir/ld relro_script_test.t relro_test_pic.o
868 $(CXXLINK) -Bgcctestdir/ -shared -Wl,-z,relro -T $(srcdir)/relro_script_test.t relro_test_pic.o
870 check_PROGRAMS += script_test_1
871 script_test_1_SOURCES = script_test_1.cc
872 script_test_1_DEPENDENCIES = gcctestdir/ld script_test_1.t
873 script_test_1_LDFLAGS = -Bgcctestdir/ -Wl,-R,. -T $(srcdir)/script_test_1.t
875 check_PROGRAMS += script_test_2
876 script_test_2_SOURCES = script_test_2.cc script_test_2a.cc script_test_2b.cc
877 script_test_2_DEPENDENCIES = gcctestdir/ld script_test_2.t
878 script_test_2_LDFLAGS = -Bgcctestdir/ -Wl,-R,. -T $(srcdir)/script_test_2.t
880 check_PROGRAMS += justsyms
881 justsyms_SOURCES = justsyms_1.cc
882 justsyms_DEPENDENCIES = gcctestdir/ld justsyms_2r.o
883 justsyms_LDFLAGS = -Bgcctestdir/ -Wl,-R,justsyms_2r.o
884 justsyms_2.o: justsyms_2.cc
885 $(CXXCOMPILE) -c -o $@ $<
886 justsyms_2r.o: justsyms_2.o gcctestdir/ld $(srcdir)/justsyms.t
887 gcctestdir/ld -o $@ -r -T $(srcdir)/justsyms.t justsyms_2.o
889 check_PROGRAMS += binary_test
890 binary_test_SOURCES = binary_test.cc
891 binary_test_DEPENDENCIES = gcctestdir/ld binary.txt
892 binary_test_LDFLAGS = -Bgcctestdir/ -Wl,--format,binary,binary.txt,--format,elf
893 # Copy the file to the build directory to avoid worrying about the
894 # full pathname in the generated symbols.
895 binary.txt: $(srcdir)/binary.in
899 check_SCRIPTS += ver_matching_test.sh
900 check_DATA += ver_matching_test.stdout
901 MOSTLYCLEANFILES += ver_matching_test.stdout
902 ver_matching_def.so: ver_matching_def.cc gcctestdir/ld
903 $(CXXLINK) -O0 -Bgcctestdir/ -shared $(srcdir)/ver_matching_def.cc -Wl,--version-script=$(srcdir)/version_script.map
904 ver_matching_test.stdout: ver_matching_def.so
905 $(TEST_OBJDUMP) -T ver_matching_def.so | $(TEST_CXXFILT) > ver_matching_test.stdout
907 check_PROGRAMS += script_test_3
908 check_SCRIPTS += script_test_3.sh
909 check_DATA += script_test_3.stdout
910 MOSTLYCLEANFILES += script_test_3.stdout
911 script_test_3: basic_test.o gcctestdir/ld script_test_3.t
912 $(CXXLINK) -Bgcctestdir/ basic_test.o -T $(srcdir)/script_test_3.t
913 script_test_3.stdout: script_test_3
914 $(TEST_READELF) -SlW script_test_3 > script_test_3.stdout
916 check_SCRIPTS += script_test_4.sh
917 check_DATA += script_test_4.stdout
918 MOSTLYCLEANFILES += script_test_4.stdout
919 script_test_4: basic_test.o gcctestdir/ld $(srcdir)/script_test_4.t
920 $(CXXLINK) -Bgcctestdir/ basic_test.o -T $(srcdir)/script_test_4.t
921 script_test_4.stdout: script_test_4
922 $(TEST_READELF) -SlW script_test_4 > script_test_4.stdout
924 check_SCRIPTS += script_test_5.sh
925 check_DATA += script_test_5.stdout
926 MOSTLYCLEANFILES += script_test_5.stdout
927 script_test_5: script_test_5.o gcctestdir/ld $(srcdir)/script_test_5.t
928 $(CXXLINK) -Bgcctestdir/ script_test_5.o -T $(srcdir)/script_test_5.t
929 script_test_5.stdout: script_test_5
930 $(TEST_READELF) -SW script_test_5 > script_test_5.stdout
932 # Test --dynamic-list, --dynamic-list-data, --dynamic-list-cpp-new,
933 # and --dynamic-list-cpp-typeinfo
935 check_SCRIPTS += dynamic_list.sh
936 check_DATA += dynamic_list.stdout
937 MOSTLYCLEANFILES += dynamic_list.stdout
938 dynamic_list: basic_test.o gcctestdir/ld $(srcdir)/dynamic_list.t
939 $(CXXLINK) -Bgcctestdir/ basic_test.o \
940 -Wl,--dynamic-list $(srcdir)/dynamic_list.t \
941 -Wl,--dynamic-list-data \
942 -Wl,--dynamic-list-cpp-new \
943 -Wl,--dynamic-list-cpp-typeinfo
944 dynamic_list.stdout: dynamic_list
945 $(TEST_READELF) -DWs dynamic_list > dynamic_list.stdout
947 check_PROGRAMS += thin_archive_test_1
948 thin_archive_test_1_SOURCES = thin_archive_main.cc
949 thin_archive_test_1_DEPENDENCIES = gcctestdir/ld libthin1.a alt/libthin2.a
950 thin_archive_test_1_LDFLAGS = -Bgcctestdir/ -Lalt
951 thin_archive_test_1_LDADD = libthin1.a -lthin2
953 check_PROGRAMS += thin_archive_test_2
954 thin_archive_test_2_SOURCES = thin_archive_main.cc
955 thin_archive_test_2_DEPENDENCIES = gcctestdir/ld libthinall.a
956 thin_archive_test_2_LDFLAGS = -Bgcctestdir/ -L.
957 thin_archive_test_2_LDADD = -lthinall
959 libthin1.a: thin_archive_test_1.o alt/thin_archive_test_2.o
962 alt/libthin2.a: thin_archive_test_3.o alt/thin_archive_test_4.o
965 libthin3.a: thin_archive_test_1.o alt/thin_archive_test_4.o
968 alt/libthin4.a: alt/thin_archive_test_2.o thin_archive_test_3.o
971 libthinall.a: libthin3.a alt/libthin4.a
974 alt/thin_archive_test_2.o: thin_archive_test_2.cc
975 test -d alt || mkdir -p alt
976 $(CXXCOMPILE) -c -o $@ $<
977 alt/thin_archive_test_4.o: thin_archive_test_4.cc
978 test -d alt || mkdir -p alt
979 $(CXXCOMPILE) -c -o $@ $<
983 check_PROGRAMS += plugin_test_1
984 check_SCRIPTS += plugin_test_1.sh
985 check_DATA += plugin_test_1.err
986 MOSTLYCLEANFILES += plugin_test_1.err
987 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
988 $(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
989 plugin_test_1.err: plugin_test_1
990 @touch plugin_test_1.err
992 check_PROGRAMS += plugin_test_2
993 check_SCRIPTS += plugin_test_2.sh
994 check_DATA += plugin_test_2.err
995 MOSTLYCLEANFILES += plugin_test_2.err
996 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
997 $(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
998 plugin_test_2.err: plugin_test_2
999 @touch plugin_test_2.err
1001 check_PROGRAMS += plugin_test_3
1002 check_SCRIPTS += plugin_test_3.sh
1003 check_DATA += plugin_test_3.err
1004 MOSTLYCLEANFILES += plugin_test_3.err
1005 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
1006 $(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
1007 plugin_test_3.err: plugin_test_3
1008 @touch plugin_test_3.err
1010 check_PROGRAMS += plugin_test_4
1011 check_SCRIPTS += plugin_test_4.sh
1012 check_DATA += plugin_test_4.err
1013 MOSTLYCLEANFILES += plugin_test_4.err
1014 plugin_test_4: two_file_test_main.o plugin_test_4.a gcctestdir/ld plugin_test.so
1015 $(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
1016 plugin_test_4.err: plugin_test_4
1017 @touch plugin_test_4.err
1019 plugin_test_4.a: two_file_test_1.syms two_file_test_1b.syms two_file_test_2.syms
1022 plugin_test.so: plugin_test.o
1023 $(LINK) -Bgcctestdir/ -shared plugin_test.o
1024 plugin_test.o: plugin_test.c
1025 $(COMPILE) -O0 -c -fpic -o $@ $<
1027 two_file_test_main.syms: two_file_test_main.o
1028 $(TEST_READELF) -sW $< >$@ 2>/dev/null
1029 two_file_test_1.syms: two_file_test_1.o
1030 $(TEST_READELF) -sW $< >$@ 2>/dev/null
1031 two_file_test_1b.syms: two_file_test_1b.o
1032 $(TEST_READELF) -sW $< >$@ 2>/dev/null
1033 two_file_test_2.syms: two_file_test_2.o
1034 $(TEST_READELF) -sW $< >$@ 2>/dev/null
1036 @echo "" >empty.syms
1037 @echo "Symbol table" >>empty.syms
1041 check_PROGRAMS += exclude_libs_test
1042 check_SCRIPTS += exclude_libs_test.sh
1043 check_DATA += exclude_libs_test.syms
1044 MOSTLYCLEANFILES += exclude_libs_test.syms libexclude_libs_test_1.a \
1045 libexclude_libs_test_2.a
1046 exclude_libs_test_SOURCES = exclude_libs_test.c
1047 exclude_libs_test_DEPENDENCIES = gcctestdir/ld libexclude_libs_test_1.a \
1048 libexclude_libs_test_2.a
1049 exclude_libs_test_LDFLAGS = -Bgcctestdir/ -L. \
1050 -Wl,--exclude-libs,dummy:libexclude_libs_test_1
1051 exclude_libs_test_LDADD = -lexclude_libs_test_1 -lexclude_libs_test_2
1052 exclude_libs_test.syms: exclude_libs_test
1053 $(TEST_READELF) -sW $< >$@ 2>/dev/null
1054 libexclude_libs_test_1.a: exclude_libs_test_1.o
1056 libexclude_libs_test_2.a: exclude_libs_test_2.o