blob: cae30b5f584735a2ddbbf7daa9cee98c6c7f4d93 [file] [log] [blame]
Colin Cross2722ebb2016-07-11 16:20:06 -07001//
2// Copyright (C) 2012 The Android Open Source Project
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15//
16
17cc_defaults {
18 name: "bionic_testlib_defaults",
19 host_supported: true,
Chih-Hung Hsieh84f0dcd2017-10-02 11:47:31 -070020 cflags: [
21 "-Wall",
22 "-Werror",
23 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -070024 ldflags: [
Dimitry Ivanovd11d1e42016-10-05 02:51:17 -070025 "-Wl,--rpath,${ORIGIN}",
Dimitry Ivanova36e59b2016-09-01 11:37:39 -070026 "-Wl,--enable-new-dtags",
27 ],
28 relative_install_path: "bionic-loader-test-libs",
29 gtest: false,
Colin Cross2722ebb2016-07-11 16:20:06 -070030 sanitize: {
Evgenii Stepanov0a3637d2016-07-06 13:20:59 -070031 address: false,
32 coverage: false,
Colin Cross2722ebb2016-07-11 16:20:06 -070033 },
Yabin Cui1f553ea2017-01-13 12:31:59 -080034 stl: "libc++_static",
Colin Cross2722ebb2016-07-11 16:20:06 -070035 target: {
36 darwin: {
37 enabled: false,
38 },
39 },
40}
41
42// -----------------------------------------------------------------------------
43// Library to test gnu-styled hash
44// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -070045cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -070046 name: "libgnu-hash-table-library",
47 defaults: ["bionic_testlib_defaults"],
48 srcs: ["dlext_test_library.cpp"],
49 ldflags: ["-Wl,--hash-style=gnu"],
50 arch: {
51 mips: {
52 enabled: false,
53 },
54 mips64: {
55 enabled: false,
56 },
57 },
58}
59
60// -----------------------------------------------------------------------------
61// Library to test sysv-styled hash
62// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -070063cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -070064 name: "libsysv-hash-table-library",
65 defaults: ["bionic_testlib_defaults"],
66 srcs: ["dlext_test_library.cpp"],
67 ldflags: ["-Wl,--hash-style=sysv"],
68}
69
70// -----------------------------------------------------------------------------
71// Library used by dlext tests - with GNU RELRO program header
72// -----------------------------------------------------------------------------
73// In Android.mk to support creating symlinks
74
75// -----------------------------------------------------------------------------
76// Library used by dlext tests - without GNU RELRO program header
77// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -070078cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -070079 name: "libdlext_test_norelro",
Dimitry Ivanova36e59b2016-09-01 11:37:39 -070080 defaults: ["bionic_testlib_defaults"],
Colin Cross2722ebb2016-07-11 16:20:06 -070081 srcs: ["dlext_test_library.cpp"],
82 ldflags: ["-Wl,-z,norelro"],
83 shared_libs = ["libtest_simple"],
84}
85
86// -----------------------------------------------------------------------------
87// Library used by dlext tests - different name non-default location
88// -----------------------------------------------------------------------------
89// In Android.mk to support installing to /data
90
91// -----------------------------------------------------------------------------
92// Libraries used by dlext tests for open from a zip-file
93// -----------------------------------------------------------------------------
94// In Android.mk to support installing to /data
95
96// ----------------------------------------------------------------------------
97// Library with soname which does not match filename
98// ----------------------------------------------------------------------------
99// In Android.mk to support zipped and aligned tests
100
101// -----------------------------------------------------------------------------
102// Library used by dlext tests - zipped and aligned
103// -----------------------------------------------------------------------------
104// In Android.mk to support zipped and aligned tests
105
106// -----------------------------------------------------------------------------
107// Library used by dlfcn tests
108// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700109cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700110 name: "libtest_simple",
111 defaults: ["bionic_testlib_defaults"],
112 srcs: ["dlopen_testlib_simple.cpp"],
113}
114
115// -----------------------------------------------------------------------------
dimitry965d06d2017-11-28 16:03:07 +0100116// Library used by dlext direct unload on the namespace boundary tests
117// -----------------------------------------------------------------------------
118cc_test_library {
119 name: "libtest_missing_symbol",
120 defaults: ["bionic_testlib_defaults"],
121 srcs: ["dlopen_testlib_missing_symbol.cpp"],
122 allow_undefined_symbols: true,
123 relative_install_path: "bionic-loader-test-libs/public_namespace_libs",
124}
125
126
127// -----------------------------------------------------------------------------
128// Library used by dlext indirect unload on the namespace boundary tests
129//
130// These libraries produce following dependency graph:
131// libtest_missing_symbol_root (private ns)
132// +-> libbnstest_public (public ns)
133// +-> libtest_missing_symbol_child_public (public ns)
134// +-> libnstest_public (public ns)
135// +-> libtest_missing_symbol_child_private (private_ns)
136// +-> libnstest_public (public_ns)
137//
138// All libraries except libtest_missing_symbol are located in
139// private_namespace_libs/
140// -----------------------------------------------------------------------------
141cc_test_library {
142 name: "libtest_missing_symbol_child_public",
143 defaults: ["bionic_testlib_defaults"],
144 srcs: ["empty.cpp"],
145 relative_install_path: "bionic-loader-test-libs/public_namespace_libs",
146 shared_libs: ["libnstest_public"],
147}
148
149cc_test_library {
150 name: "libtest_missing_symbol_child_private",
151 defaults: ["bionic_testlib_defaults"],
152 srcs: ["empty.cpp"],
153 relative_install_path: "bionic-loader-test-libs/private_namespace_libs",
154 shared_libs: ["libnstest_public"],
155}
156
157cc_test_library {
158 name: "libtest_missing_symbol_root",
159 defaults: ["bionic_testlib_defaults"],
160 srcs: ["dlopen_testlib_missing_symbol.cpp"],
161 relative_install_path: "bionic-loader-test-libs/private_namespace_libs",
162 allow_undefined_symbols: true,
163 shared_libs: [
164 "libnstest_public",
165 "libtest_missing_symbol_child_public",
166 "libtest_missing_symbol_child_private",
167 ],
168}
169
170// -----------------------------------------------------------------------------
171// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -0700172// Library used by dlfcn nodelete tests
173// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700174cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700175 name: "libtest_nodelete_1",
176 defaults: ["bionic_testlib_defaults"],
177 srcs: ["dlopen_nodelete_1.cpp"],
178}
179
180// -----------------------------------------------------------------------------
181// Library used by dlfcn nodelete tests
182// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700183cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700184 name: "libtest_nodelete_2",
185 defaults: ["bionic_testlib_defaults"],
186 srcs: ["dlopen_nodelete_2.cpp"],
187}
188
189// -----------------------------------------------------------------------------
190// Library used by dlfcn nodelete tests
191// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700192cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700193 name: "libtest_nodelete_dt_flags_1",
194 defaults: ["bionic_testlib_defaults"],
195 srcs: ["dlopen_nodelete_dt_flags_1.cpp"],
196 ldflags: ["-Wl,-z,nodelete"],
197}
198
199// -----------------------------------------------------------------------------
200// Build test helper libraries for linker namespaces
dimitry965d06d2017-11-28 16:03:07 +0100201//
202// This set of libraries is used to verify linker namespaces.
203//
204// Test cases
205// 1. Check that private libraries loaded in different namespaces are
206// different. Check that dlsym does not confuse them.
207// 2. Check that public libraries loaded in different namespaces are shared
208// between them.
209// 3. Check that namespace sticks on dlopen
210// 4. Check that having access to shared library (libnstest_public.so)
211// does not expose symbols from dependent library (libnstest_public_internal.so)
212//
213// Dependency tree (visibility)
214// libnstest_root.so (this should be local to the namespace)
215// +-> libnstest_public.so
216// +-> libnstest_public_internal.so
217// +-> libnstest_private.so
218//
219// libnstest_dlopened.so (library in private namespace dlopened from libnstest_root.so)
Colin Cross2722ebb2016-07-11 16:20:06 -0700220// -----------------------------------------------------------------------------
dimitry965d06d2017-11-28 16:03:07 +0100221cc_test_library {
222 name: "libnstest_root",
223 defaults: ["bionic_testlib_defaults"],
224 srcs: ["namespaces_root.cpp"],
225 relative_install_path: "bionic-loader-test-libs/private_namespace_libs",
226 shared_libs: [
227 "libnstest_public",
228 "libnstest_private",
229 ],
230}
231
232cc_test_library {
233 name: "libnstest_public_internal",
234 defaults: ["bionic_testlib_defaults"],
235 srcs: ["namespaces_public_internal.cpp"],
236 relative_install_path: "bionic-loader-test-libs/public_namespace_libs",
237}
238
239cc_test_library {
240 name: "libnstest_public",
241 defaults: ["bionic_testlib_defaults"],
242 srcs: ["namespaces_public.cpp"],
243 relative_install_path: "bionic-loader-test-libs/public_namespace_libs",
244 shared_libs: ["libnstest_public_internal"],
245}
246
247cc_test_library {
248 name: "libnstest_private",
249 defaults: ["bionic_testlib_defaults"],
250 srcs: ["namespaces_private.cpp"],
251 relative_install_path: "bionic-loader-test-libs/private_namespace_libs",
252}
253
254cc_test_library {
255 name: "libnstest_dlopened",
256 defaults: ["bionic_testlib_defaults"],
257 srcs: ["namespaces_dlopened.cpp"],
258 relative_install_path: "bionic-loader-test-libs/private_namespace_libs",
259}
Colin Cross2722ebb2016-07-11 16:20:06 -0700260
261// -----------------------------------------------------------------------------
Logan Chien9ee45912018-01-18 12:05:09 +0800262// Build test helper libraries for linker namespaces for allow all shared libs
263//
264// This set of libraries is used to verify linker namespaces for allow all
265// shared libs.
266//
267// Test cases
268// 1. Check that namespace a exposes libnstest_ns_a_public1 to
269// namespace b while keeping libnstest_ns_a_public1_internal as an
270// internal lib.
271// 2. Check that namespace b exposes all libraries to namespace a.
272//
273// Dependency tree (visibility)
274// libnstest_ns_b_public2.so (ns:b)
275// +-> libnstest_ns_a_public1.so (ns:a)
276// +-> libnstest_ns_a_public2_internal.so (ns:a)
277// +-> libnstest_ns_b_public3.so (ns:b)
278//
279// -----------------------------------------------------------------------------
280cc_test_library {
281 name: "libnstest_ns_a_public1",
282 defaults: ["bionic_testlib_defaults"],
283 srcs: ["libnstest_ns_a_public1.cpp"],
284 relative_install_path: "bionic-loader-test-libs/ns_a",
285 shared_libs: [
286 "libnstest_ns_a_public1_internal",
287 "libnstest_ns_b_public3",
288 ],
289}
290
291cc_test_library {
292 name: "libnstest_ns_a_public1_internal",
293 defaults: ["bionic_testlib_defaults"],
294 srcs: ["libnstest_ns_a_public1_internal.cpp"],
295 relative_install_path: "bionic-loader-test-libs/ns_a",
296}
297
298cc_test_library {
299 name: "libnstest_ns_b_public2",
300 defaults: ["bionic_testlib_defaults"],
301 srcs: ["libnstest_ns_b_public2.cpp"],
302 relative_install_path: "bionic-loader-test-libs/ns_b",
303 shared_libs: ["libnstest_ns_a_public1"],
304}
305
306cc_test_library {
307 name: "libnstest_ns_b_public3",
308 defaults: ["bionic_testlib_defaults"],
309 srcs: ["libnstest_ns_b_public3.cpp"],
310 relative_install_path: "bionic-loader-test-libs/ns_b",
311}
312
313// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -0700314// Build DT_RUNPATH test helper libraries
315// -----------------------------------------------------------------------------
316// include $(LOCAL_PATH)/Android.build.dt_runpath.mk
317
318// -----------------------------------------------------------------------------
319// Build library with two parents
320// -----------------------------------------------------------------------------
321// include $(LOCAL_PATH)/Android.build.dlopen_2_parents_reloc.mk
322
323// -----------------------------------------------------------------------------
324// Build libtest_check_order_dlsym.so with its dependencies.
325// -----------------------------------------------------------------------------
326// include $(LOCAL_PATH)/Android.build.dlopen_check_order_dlsym.mk
327
328// -----------------------------------------------------------------------------
329// Build libtest_check_order_siblings.so with its dependencies.
330// -----------------------------------------------------------------------------
331// include $(LOCAL_PATH)/Android.build.dlopen_check_order_reloc_siblings.mk
332
333// -----------------------------------------------------------------------------
334// Build libtest_check_order_root.so with its dependencies.
335// -----------------------------------------------------------------------------
336// include $(LOCAL_PATH)/Android.build.dlopen_check_order_reloc_main_executable.mk
337
338// -----------------------------------------------------------------------------
339// Build libtest_versioned_lib.so with its dependencies.
340// -----------------------------------------------------------------------------
341// include $(LOCAL_PATH)/Android.build.versioned_lib.mk
342
343// -----------------------------------------------------------------------------
344// Build libraries needed by pthread_atfork tests
345// -----------------------------------------------------------------------------
346// include $(LOCAL_PATH)/Android.build.pthread_atfork.mk
347
348// -----------------------------------------------------------------------------
349// Library with dependency loop used by dlfcn tests
350//
351// libtest_with_dependency_loop -> a -> b -> c -> a
352// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700353cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700354 name: "libtest_with_dependency_loop",
355 defaults: ["bionic_testlib_defaults"],
356 srcs: ["dlopen_testlib_loopy_root.cpp"],
357 shared_libs: ["libtest_with_dependency_loop_a"],
358}
359
360// -----------------------------------------------------------------------------
361// libtest_with_dependency_loop_a.so
362// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700363cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700364 name: "libtest_with_dependency_loop_a",
365 defaults: ["bionic_testlib_defaults"],
366 srcs: ["dlopen_testlib_loopy_a.cpp"],
367 shared_libs: ["libtest_with_dependency_loop_b_tmp"],
368}
369
370// -----------------------------------------------------------------------------
371// libtest_with_dependency_loop_b.so
372//
373// this is temporary placeholder - will be removed
374// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700375cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700376 name: "libtest_with_dependency_loop_b_tmp",
377 defaults: ["bionic_testlib_defaults"],
378 srcs: ["dlopen_testlib_loopy_invalid.cpp"],
379 ldflags: ["-Wl,-soname=libtest_with_dependency_loop_b.so"],
380}
381
382// -----------------------------------------------------------------------------
383// libtest_with_dependency_loop_b.so
384// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700385cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700386 name: "libtest_with_dependency_loop_b",
387 defaults: ["bionic_testlib_defaults"],
388 srcs: ["dlopen_testlib_loopy_b.cpp"],
389 shared_libs: ["libtest_with_dependency_loop_c"],
390}
391
392// -----------------------------------------------------------------------------
393// libtest_with_dependency_loop_c.so
394// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700395cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700396 name: "libtest_with_dependency_loop_c",
397 defaults: ["bionic_testlib_defaults"],
398 srcs: ["dlopen_testlib_loopy_c.cpp"],
399 shared_libs: ["libtest_with_dependency_loop_a"],
400}
401
402// -----------------------------------------------------------------------------
403// libtest_relo_check_dt_needed_order.so
404// |
405// +-> libtest_relo_check_dt_needed_order_1.so
406// |
407// +-> libtest_relo_check_dt_needed_order_2.so
408// -----------------------------------------------------------------------------
409
410
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700411cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700412 name: "libtest_relo_check_dt_needed_order",
413 defaults: ["bionic_testlib_defaults"],
414 srcs: ["dlopen_testlib_relo_check_dt_needed_order.cpp"],
415 shared_libs: [
416 "libtest_relo_check_dt_needed_order_1",
417 "libtest_relo_check_dt_needed_order_2",
418 ],
419}
420
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700421cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700422 name: "libtest_relo_check_dt_needed_order_1",
423 defaults: ["bionic_testlib_defaults"],
424 srcs: ["dlopen_testlib_relo_check_dt_needed_order_1.cpp"],
425}
426
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700427cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700428 name: "libtest_relo_check_dt_needed_order_2",
429 defaults: ["bionic_testlib_defaults"],
430 srcs: ["dlopen_testlib_relo_check_dt_needed_order_2.cpp"],
431}
432
433// -----------------------------------------------------------------------------
434// Library with dependency used by dlfcn tests
435// -----------------------------------------------------------------------------
436// In Android.mk to support dependency on libdlext_test
437
438// -----------------------------------------------------------------------------
439// Library used by ifunc tests
440// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700441cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700442 name: "libtest_ifunc",
443 defaults: ["bionic_testlib_defaults"],
Dimitry Ivanov21975b22017-05-02 16:31:56 -0700444 srcs: ["dlopen_testlib_ifunc.cpp"],
Colin Cross2722ebb2016-07-11 16:20:06 -0700445
Colin Cross2722ebb2016-07-11 16:20:06 -0700446 arch: {
447 mips: {
448 enabled: false,
449 },
450 mips64: {
451 enabled: false,
452 },
453 },
Dimitry Ivanov21975b22017-05-02 16:31:56 -0700454}
455
456cc_test_library {
457 name: "libtest_ifunc_variable",
458 defaults: ["bionic_testlib_defaults"],
459 srcs: ["dlopen_testlib_ifunc_variable.cpp"],
460 shared_libs: [ "libtest_ifunc_variable_impl" ],
461
462 arch: {
463 mips: {
464 enabled: false,
465 },
466 mips64: {
467 enabled: false,
468 },
469 },
Dimitry Ivanov21975b22017-05-02 16:31:56 -0700470}
471
472cc_test_library {
473 name: "libtest_ifunc_variable_impl",
474 defaults: ["bionic_testlib_defaults"],
475 srcs: ["dlopen_testlib_ifunc_variable_impl.cpp"],
476
477 arch: {
478 mips: {
479 enabled: false,
480 },
481 mips64: {
482 enabled: false,
483 },
484 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700485}
486
487// -----------------------------------------------------------------------------
488// Library used by atexit tests
489// -----------------------------------------------------------------------------
490
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700491cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700492 name: "libtest_atexit",
493 defaults: ["bionic_testlib_defaults"],
494 srcs: ["atexit_testlib.cpp"],
495}
496
497// -----------------------------------------------------------------------------
498// This library is used by dl_load test to check symbol preempting
499// by main executable
500// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700501cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700502 name: "libdl_preempt_test_1",
503 defaults: ["bionic_testlib_defaults"],
504 srcs: ["dl_preempt_library_1.cpp"],
505}
506
507// -----------------------------------------------------------------------------
508// This library is used by dl_load test to check symbol preempting
509// by libdl_preempt_test_1.so
510// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700511cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700512 name: "libdl_preempt_test_2",
513 defaults: ["bionic_testlib_defaults"],
514 srcs: ["dl_preempt_library_2.cpp"],
515}
516
517// -----------------------------------------------------------------------------
518// Library with DF_1_GLOBAL
519// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700520cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700521 name: "libdl_test_df_1_global",
522 defaults: ["bionic_testlib_defaults"],
523 srcs: ["dl_df_1_global.cpp"],
524 ldflags: ["-Wl,-z,global"],
525
526 target: {
527 host: {
528 // TODO (dimitry): host ld.gold does not yet support -z global
529 // remove this line once it is updated.
530 ldflags: ["-fuse-ld=bfd"],
531 },
532 },
533}
534
535// -----------------------------------------------------------------------------
536// Library using symbol from libdl_test_df_1_global
537// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700538cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700539 name: "libtest_dlsym_df_1_global",
540 defaults: ["bionic_testlib_defaults"],
541 srcs: ["dl_df_1_use_global.cpp"],
542}
543
544// -----------------------------------------------------------------------------
Jiyong Park01162f22017-10-16 15:31:09 +0900545// Library with DF_1_GLOBAL which will be dlopened
546// (note: libdl_test_df_1_global above will be included in DT_NEEDED)
547// -----------------------------------------------------------------------------
548cc_test_library {
549 name: "libtest_dlopen_df_1_global",
550 defaults: ["bionic_testlib_defaults"],
551 srcs: ["dl_df_1_global_dummy.cpp"],
552 ldflags: ["-Wl,-z,global"],
553
554 target: {
555 host: {
556 // TODO (dimitry): host ld.gold does not yet support -z global
557 // remove this line once it is updated.
558 ldflags: ["-fuse-ld=bfd"],
559 },
560 },
561}
562
563
564// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -0700565// Library with weak function
566// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700567cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700568 name: "libtest_dlsym_weak_func",
569 defaults: ["bionic_testlib_defaults"],
570 srcs: ["dlsym_weak_function.cpp"],
571}
572
573// -----------------------------------------------------------------------------
574// Library to check RTLD_LOCAL with dlsym in 'this'
575// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700576cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700577 name: "libtest_dlsym_from_this",
578 defaults: ["bionic_testlib_defaults"],
579 srcs: ["dlsym_from_this_symbol.cpp"],
580 shared_libs: ["libtest_dlsym_from_this_child"],
Colin Cross2722ebb2016-07-11 16:20:06 -0700581}
582
583// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700584cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700585 name: "libtest_dlsym_from_this_child",
586 defaults: ["bionic_testlib_defaults"],
587 srcs: ["dlsym_from_this_functions.cpp"],
588 shared_libs: ["libtest_dlsym_from_this_grandchild"],
589}
590
591// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700592cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700593 name: "libtest_dlsym_from_this_grandchild",
594 defaults: ["bionic_testlib_defaults"],
595 srcs: ["dlsym_from_this_symbol2.cpp"],
596}
597
598// -----------------------------------------------------------------------------
599// Empty library
600// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700601cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700602 name: "libtest_empty",
603 defaults: ["bionic_testlib_defaults"],
604 srcs: ["empty.cpp"],
605}
606
607// -----------------------------------------------------------------------------
dimitry8db36a52017-10-23 15:10:10 +0200608// Library for inaccessible shared library test
609// -----------------------------------------------------------------------------
610cc_test_library {
611 name: "libtestshared",
612 defaults: ["bionic_testlib_defaults"],
613 srcs: ["empty.cpp"],
Nan Zhangdab0fd52017-11-07 11:05:24 -0800614 relative_install_path: "bionic-loader-test-libs/inaccessible_libs",
dimitry8db36a52017-10-23 15:10:10 +0200615}
616
617// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -0700618// Library with weak undefined function
619// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700620cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700621 name: "libtest_dlopen_weak_undefined_func",
622 defaults: ["bionic_testlib_defaults"],
623 srcs: ["dlopen_weak_undefined.cpp"],
624}
625
626// -----------------------------------------------------------------------------
Dimitry Ivanovd0b5c3a2016-11-25 12:23:11 -0800627// Check that RTLD_NEXT of a libc symbol works in dlopened library
628// -----------------------------------------------------------------------------
629cc_test_library {
630 name: "libtest_check_rtld_next_from_library",
631 defaults: ["bionic_testlib_defaults"],
632 srcs: ["check_rtld_next_from_library.cpp"],
Dimitry Ivanovd0b5c3a2016-11-25 12:23:11 -0800633}
634
635// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -0700636// Library with constructor that calls dlopen() b/7941716
637// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700638cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700639 name: "libtest_dlopen_from_ctor",
640 defaults: ["bionic_testlib_defaults"],
641 srcs: ["dlopen_testlib_dlopen_from_ctor.cpp"],
Colin Cross2722ebb2016-07-11 16:20:06 -0700642}
643
644// -----------------------------------------------------------------------------
Dimitry Ivanovec90e242017-02-10 11:04:20 -0800645// Libraries used to check init/fini call order
Dimitry Ivanovea8f3962017-02-09 13:31:57 -0800646// -----------------------------------------------------------------------------
647cc_test_library {
648 name: "libtest_init_fini_order_root",
649 defaults: ["bionic_testlib_defaults"],
650 srcs: ["dlopen_check_init_fini_root.cpp"],
Dimitry Ivanovec90e242017-02-10 11:04:20 -0800651 shared_libs: [
652 "libtest_init_fini_order_child",
653 "libtest_init_fini_order_grand_child",
654 ],
655}
656
657cc_test_library {
658 name: "libtest_init_fini_order_root2",
659 defaults: ["bionic_testlib_defaults"],
660 srcs: ["dlopen_check_init_fini_root.cpp"],
661 shared_libs: [
662 "libtest_init_fini_order_grand_child",
663 "libtest_init_fini_order_child",
664 ],
Dimitry Ivanovea8f3962017-02-09 13:31:57 -0800665}
666
667cc_test_library {
668 name: "libtest_init_fini_order_child",
669 defaults: ["bionic_testlib_defaults"],
670 srcs: ["dlopen_check_init_fini_child.cpp"],
671 shared_libs: ["libtest_init_fini_order_grand_child"],
672}
673
674cc_test_library {
675 name: "libtest_init_fini_order_grand_child",
676 defaults: ["bionic_testlib_defaults"],
677 srcs: ["dlopen_check_init_fini_grand_child.cpp"],
678}
679
680// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -0700681// Library that depends on the library with constructor that calls dlopen() b/7941716
682// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700683cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700684 name: "libtest_dlopen_from_ctor_main",
685 defaults: ["bionic_testlib_defaults"],
686 srcs: ["empty.cpp"],
687 shared_libs: ["libtest_dlopen_from_ctor"],
688}
689
690// -----------------------------------------------------------------------------
dimitry06016f22018-01-05 11:39:28 +0100691// Library with non-trivial thread_local variable to test dlclose()
692// -----------------------------------------------------------------------------
693cc_test_library {
694 name: "libtest_thread_local_dtor",
695 defaults: ["bionic_testlib_defaults"],
696 srcs: ["thread_local_dtor.cpp"],
697}
698
699
700// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -0700701// Tool to use to align the shared libraries in a zip file.
702// -----------------------------------------------------------------------------
703cc_binary_host {
704 name: "bionic_tests_zipalign",
705 srcs: ["bionic_tests_zipalign.cpp"],
706 cflags: [
707 "-Wall",
708 "-Werror",
709 ],
710
711 static_libs: [
712 "libziparchive",
713 "liblog",
714 "libbase",
715 "libz",
716 "libutils",
717 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700718}
Evgenii Stepanov0a3637d2016-07-06 13:20:59 -0700719
720cc_test_library {
721 name: "libcfi-test",
722 defaults: ["bionic_testlib_defaults"],
723 srcs: ["cfi_test_lib.cpp"],
724 sanitize: {
725 cfi: false,
726 },
727}
728
729cc_test_library {
730 name: "libcfi-test-bad",
731 defaults: ["bionic_testlib_defaults"],
732 srcs: ["cfi_test_bad_lib.cpp"],
733 sanitize: {
734 cfi: false,
735 },
736}
Evgenii Stepanov68ecec12017-01-31 13:19:30 -0800737
738cc_test {
739 name: "cfi_test_helper",
740 host_supported: false,
741 defaults: ["bionic_testlib_defaults"],
742 srcs: ["cfi_test_helper.cpp"],
743 ldflags: ["-rdynamic"],
744}
745
746cc_test {
747 name: "cfi_test_helper2",
748 host_supported: false,
749 defaults: ["bionic_testlib_defaults"],
750 srcs: ["cfi_test_helper2.cpp"],
751 shared_libs: ["libcfi-test"],
752 ldflags: ["-Wl,--rpath,${ORIGIN}/.."],
753}
Elliott Hugheseb04ed52017-03-29 13:48:02 -0700754
755cc_test {
756 name: "preinit_getauxval_test_helper",
757 host_supported: false,
758 defaults: ["bionic_testlib_defaults"],
759 srcs: ["preinit_getauxval_test_helper.cpp"],
760}
761
762cc_test {
763 name: "preinit_syscall_test_helper",
764 host_supported: false,
765 defaults: ["bionic_testlib_defaults"],
766 srcs: ["preinit_syscall_test_helper.cpp"],
767}
Jiyong Park02586a22017-05-20 01:01:24 +0900768
769cc_test {
770 name: "ld_preload_test_helper",
771 host_supported: false,
772 defaults: ["bionic_testlib_defaults"],
773 srcs: ["ld_preload_test_helper.cpp"],
774 shared_libs: ["ld_preload_test_helper_lib1"],
775 ldflags: ["-Wl,--rpath,${ORIGIN}/.."],
776}
777
778cc_test_library {
779 name: "ld_preload_test_helper_lib1",
780 host_supported: false,
781 defaults: ["bionic_testlib_defaults"],
782 srcs: ["ld_preload_test_helper_lib1.cpp"],
783}
784
785cc_test_library {
786 name: "ld_preload_test_helper_lib2",
787 host_supported: false,
788 defaults: ["bionic_testlib_defaults"],
789 srcs: ["ld_preload_test_helper_lib2.cpp"],
790}
791
792cc_test {
793 name: "ld_config_test_helper",
794 host_supported: false,
795 defaults: ["bionic_testlib_defaults"],
796 srcs: ["ld_config_test_helper.cpp"],
797 shared_libs: ["ld_config_test_helper_lib1"],
798 ldflags: ["-Wl,--rpath,${ORIGIN}/.."],
799}
800
801cc_test_library {
802 name: "ld_config_test_helper_lib1",
803 host_supported: false,
804 defaults: ["bionic_testlib_defaults"],
805 srcs: ["ld_config_test_helper_lib1.cpp"],
806 shared_libs: ["ld_config_test_helper_lib2"],
Nan Zhangdab0fd52017-11-07 11:05:24 -0800807 relative_install_path: "bionic-loader-test-libs/ns2",
Jiyong Park02586a22017-05-20 01:01:24 +0900808}
809
810cc_test_library {
811 name: "ld_config_test_helper_lib2",
812 host_supported: false,
813 defaults: ["bionic_testlib_defaults"],
814 srcs: ["ld_config_test_helper_lib2.cpp"],
Nan Zhangdab0fd52017-11-07 11:05:24 -0800815 relative_install_path: "bionic-loader-test-libs/ns2",
Jiyong Park02586a22017-05-20 01:01:24 +0900816}
817
818cc_test_library {
819 name: "ld_config_test_helper_lib3",
820 host_supported: false,
821 defaults: ["bionic_testlib_defaults"],
822 srcs: ["ld_config_test_helper_lib3.cpp"],
823}