• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1//
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,
20    cflags: [
21        "-Wall",
22        "-Werror",
23    ],
24    ldflags: [
25        "-Wl,--rpath,${ORIGIN}",
26        "-Wl,--enable-new-dtags",
27    ],
28    relative_install_path: "bionic-loader-test-libs",
29    gtest: false,
30    sanitize: {
31        address: false,
32        coverage: false,
33    },
34    stl: "libc++_static",
35    target: {
36        darwin: {
37            enabled: false,
38        },
39    },
40}
41
42// -----------------------------------------------------------------------------
43// Libraries and helper binaries for ELF TLS
44// -----------------------------------------------------------------------------
45cc_test_library {
46    name: "libtest_elftls_shared_var",
47    defaults: ["bionic_testlib_defaults"],
48    srcs: ["elftls_shared_var.cpp"],
49    cflags: ["-fno-emulated-tls"],
50}
51
52cc_test_library {
53    name: "libtest_elftls_shared_var_ie",
54    defaults: ["bionic_testlib_defaults"],
55    srcs: ["elftls_shared_var_ie.cpp"],
56    cflags: ["-fno-emulated-tls"],
57    shared_libs: ["libtest_elftls_shared_var"],
58}
59
60cc_test_library {
61    name: "libtest_elftls_tprel",
62    defaults: ["bionic_testlib_defaults"],
63    srcs: ["elftls_tprel.cpp"],
64    cflags: ["-fno-emulated-tls"],
65}
66
67cc_test {
68    name: "elftls_dlopen_ie_error_helper",
69    defaults: ["bionic_testlib_defaults"],
70    srcs: ["elftls_dlopen_ie_error_helper.cpp"],
71    ldflags: ["-Wl,--rpath,${ORIGIN}/.."],
72}
73
74cc_test_library {
75    name: "libtest_elftls_dynamic",
76    defaults: ["bionic_testlib_defaults"],
77    srcs: ["elftls_dynamic.cpp"],
78    cflags: ["-fno-emulated-tls"],
79    shared_libs: ["libtest_elftls_shared_var"],
80}
81
82cc_test_library {
83    name: "libtest_elftls_dynamic_filler_1",
84    defaults: ["bionic_testlib_defaults"],
85    srcs: ["elftls_dynamic_filler.cpp"],
86    cflags: ["-fno-emulated-tls", "-DTLS_FILLER=100"],
87}
88
89cc_test_library {
90    name: "libtest_elftls_dynamic_filler_2",
91    defaults: ["bionic_testlib_defaults"],
92    srcs: ["elftls_dynamic_filler.cpp"],
93    cflags: ["-fno-emulated-tls", "-DTLS_FILLER=200"],
94}
95
96cc_test_library {
97    name: "libtest_elftls_dynamic_filler_3",
98    defaults: ["bionic_testlib_defaults"],
99    srcs: ["elftls_dynamic_filler.cpp"],
100    cflags: ["-fno-emulated-tls", "-DTLS_FILLER=300"],
101}
102
103// -----------------------------------------------------------------------------
104// Library to test gnu-styled hash
105// -----------------------------------------------------------------------------
106cc_test_library {
107    name: "libgnu-hash-table-library",
108    defaults: ["bionic_testlib_defaults"],
109    srcs: ["dlext_test_library.cpp"],
110    ldflags: ["-Wl,--hash-style=gnu"],
111    arch: {
112        mips: {
113            enabled: false,
114        },
115        mips64: {
116            enabled: false,
117        },
118    },
119}
120
121// -----------------------------------------------------------------------------
122// Library to test sysv-styled hash
123// -----------------------------------------------------------------------------
124cc_test_library {
125    name: "libsysv-hash-table-library",
126    defaults: ["bionic_testlib_defaults"],
127    srcs: ["dlext_test_library.cpp"],
128    ldflags: ["-Wl,--hash-style=sysv"],
129}
130
131// -----------------------------------------------------------------------------
132// Library used by dlext tests - with GNU RELRO program header
133// -----------------------------------------------------------------------------
134// In Android.mk to support creating symlinks
135
136// -----------------------------------------------------------------------------
137// Library used by dlext tests - without GNU RELRO program header
138// -----------------------------------------------------------------------------
139cc_test_library {
140    name: "libdlext_test_norelro",
141    defaults: ["bionic_testlib_defaults"],
142    srcs: ["dlext_test_library.cpp"],
143    ldflags: ["-Wl,-z,norelro"],
144    shared_libs: ["libtest_simple"],
145}
146
147// -----------------------------------------------------------------------------
148// Library used by dlext tests - different name non-default location
149// -----------------------------------------------------------------------------
150// In Android.mk to support installing to /data
151
152// -----------------------------------------------------------------------------
153// Libraries used by dlext tests for open from a zip-file
154// -----------------------------------------------------------------------------
155// In Android.mk to support installing to /data
156
157// ----------------------------------------------------------------------------
158// Library with soname which does not match filename
159// ----------------------------------------------------------------------------
160// In Android.mk to support zipped and aligned tests
161
162// -----------------------------------------------------------------------------
163// Library used by dlext tests - zipped and aligned
164// -----------------------------------------------------------------------------
165// In Android.mk to support zipped and aligned tests
166
167// -----------------------------------------------------------------------------
168// Library used by dlfcn tests
169// -----------------------------------------------------------------------------
170cc_test_library {
171    name: "libtest_simple",
172    defaults: ["bionic_testlib_defaults"],
173    srcs: ["dlopen_testlib_simple.cpp"],
174}
175
176// -----------------------------------------------------------------------------
177// Library used by dlext direct unload on the namespace boundary tests
178// -----------------------------------------------------------------------------
179cc_test_library {
180    name: "libtest_missing_symbol",
181    defaults: ["bionic_testlib_defaults"],
182    srcs: ["dlopen_testlib_missing_symbol.cpp"],
183    allow_undefined_symbols: true,
184    relative_install_path: "bionic-loader-test-libs/public_namespace_libs",
185}
186
187// -----------------------------------------------------------------------------
188// Library used by dlext indirect unload on the namespace boundary tests
189//
190// These libraries produce following dependency graph:
191// libtest_missing_symbol_root (private ns)
192// +-> libbnstest_public (public ns)
193// +-> libtest_missing_symbol_child_public (public ns)
194//     +-> libnstest_public (public ns)
195// +-> libtest_missing_symbol_child_private (private_ns)
196//     +-> libnstest_public (public_ns)
197//
198// All libraries except libtest_missing_symbol are located in
199// private_namespace_libs/
200// -----------------------------------------------------------------------------
201cc_test_library {
202    name: "libtest_missing_symbol_child_public",
203    defaults: ["bionic_testlib_defaults"],
204    srcs: ["empty.cpp"],
205    relative_install_path: "bionic-loader-test-libs/public_namespace_libs",
206    shared_libs: ["libnstest_public"],
207}
208
209cc_test_library {
210    name: "libtest_missing_symbol_child_private",
211    defaults: ["bionic_testlib_defaults"],
212    srcs: ["empty.cpp"],
213    relative_install_path: "bionic-loader-test-libs/private_namespace_libs",
214    shared_libs: ["libnstest_public"],
215}
216
217cc_test_library {
218    name: "libtest_missing_symbol_root",
219    defaults: ["bionic_testlib_defaults"],
220    srcs: ["dlopen_testlib_missing_symbol.cpp"],
221    relative_install_path: "bionic-loader-test-libs/private_namespace_libs",
222    allow_undefined_symbols: true,
223    shared_libs: [
224        "libnstest_public",
225        "libtest_missing_symbol_child_public",
226        "libtest_missing_symbol_child_private",
227    ],
228}
229
230// -----------------------------------------------------------------------------
231// -----------------------------------------------------------------------------
232// Library used by dlfcn nodelete tests
233// -----------------------------------------------------------------------------
234cc_test_library {
235    name: "libtest_nodelete_1",
236    defaults: ["bionic_testlib_defaults"],
237    srcs: ["dlopen_nodelete_1.cpp"],
238}
239
240// -----------------------------------------------------------------------------
241// Library used by dlfcn nodelete tests
242// -----------------------------------------------------------------------------
243cc_test_library {
244    name: "libtest_nodelete_2",
245    defaults: ["bionic_testlib_defaults"],
246    srcs: ["dlopen_nodelete_2.cpp"],
247}
248
249// -----------------------------------------------------------------------------
250// Library used by dlfcn nodelete tests
251// -----------------------------------------------------------------------------
252cc_test_library {
253    name: "libtest_nodelete_dt_flags_1",
254    defaults: ["bionic_testlib_defaults"],
255    srcs: ["dlopen_nodelete_dt_flags_1.cpp"],
256    ldflags: ["-Wl,-z,nodelete"],
257}
258
259// -----------------------------------------------------------------------------
260// Build test helper libraries for linker namespaces
261//
262// This set of libraries is used to verify linker namespaces.
263//
264// Test cases
265// 1. Check that private libraries loaded in different namespaces are
266//    different. Check that dlsym does not confuse them.
267// 2. Check that public libraries loaded in different namespaces are shared
268//    between them.
269// 3. Check that namespace sticks on dlopen
270// 4. Check that having access to shared library (libnstest_public.so)
271//    does not expose symbols from dependent library (libnstest_public_internal.so)
272//
273// Dependency tree (visibility)
274// libnstest_root.so (this should be local to the namespace)
275// +-> libnstest_public.so
276//     +-> libnstest_public_internal.so
277// +-> libnstest_private.so
278//
279// libnstest_dlopened.so (library in private namespace dlopened from libnstest_root.so)
280// -----------------------------------------------------------------------------
281cc_test_library {
282    name: "libnstest_root",
283    defaults: ["bionic_testlib_defaults"],
284    srcs: ["namespaces_root.cpp"],
285    relative_install_path: "bionic-loader-test-libs/private_namespace_libs",
286    shared_libs: [
287        "libnstest_public",
288        "libnstest_private",
289    ],
290    // The dlext.ns_anonymous test copies the loaded segments of this shared
291    // object into a new mapping, so every segment must be readable. Turn off
292    // eXecute-Only-Memory. See http://b/123034666.
293    xom: false,
294}
295
296cc_test_library {
297    name: "libnstest_public_internal",
298    defaults: ["bionic_testlib_defaults"],
299    srcs: ["namespaces_public_internal.cpp"],
300    relative_install_path: "bionic-loader-test-libs/public_namespace_libs",
301}
302
303cc_test_library {
304    name: "libnstest_public",
305    defaults: ["bionic_testlib_defaults"],
306    srcs: ["namespaces_public.cpp"],
307    relative_install_path: "bionic-loader-test-libs/public_namespace_libs",
308    shared_libs: ["libnstest_public_internal"],
309}
310
311cc_test_library {
312    name: "libnstest_private",
313    defaults: ["bionic_testlib_defaults"],
314    srcs: ["namespaces_private.cpp"],
315    relative_install_path: "bionic-loader-test-libs/private_namespace_libs",
316}
317
318cc_test_library {
319    name: "libnstest_dlopened",
320    defaults: ["bionic_testlib_defaults"],
321    srcs: ["namespaces_dlopened.cpp"],
322    relative_install_path: "bionic-loader-test-libs/private_namespace_libs",
323}
324
325// -----------------------------------------------------------------------------
326// Build test helper libraries for linker namespaces for allow all shared libs
327//
328// This set of libraries is used to verify linker namespaces for allow all
329// shared libs.
330//
331// Test cases
332// 1. Check that namespace a exposes libnstest_ns_a_public1 to
333//    namespace b while keeping libnstest_ns_a_public1_internal as an
334//    internal lib.
335// 2. Check that namespace b exposes all libraries to namespace a.
336//
337// Dependency tree (visibility)
338// libnstest_ns_b_public2.so  (ns:b)
339// +-> libnstest_ns_a_public1.so  (ns:a)
340//     +-> libnstest_ns_a_public2_internal.so  (ns:a)
341//     +-> libnstest_ns_b_public3.so  (ns:b)
342//
343// -----------------------------------------------------------------------------
344cc_test_library {
345    name: "libnstest_ns_a_public1",
346    defaults: ["bionic_testlib_defaults"],
347    srcs: ["libnstest_ns_a_public1.cpp"],
348    relative_install_path: "bionic-loader-test-libs/ns_a",
349    shared_libs: [
350        "libnstest_ns_a_public1_internal",
351        "libnstest_ns_b_public3",
352    ],
353}
354
355cc_test_library {
356    name: "libnstest_ns_a_public1_internal",
357    defaults: ["bionic_testlib_defaults"],
358    srcs: ["libnstest_ns_a_public1_internal.cpp"],
359    relative_install_path: "bionic-loader-test-libs/ns_a",
360}
361
362cc_test_library {
363    name: "libnstest_ns_b_public2",
364    defaults: ["bionic_testlib_defaults"],
365    srcs: ["libnstest_ns_b_public2.cpp"],
366    relative_install_path: "bionic-loader-test-libs/ns_b",
367    shared_libs: ["libnstest_ns_a_public1"],
368}
369
370cc_test_library {
371    name: "libnstest_ns_b_public3",
372    defaults: ["bionic_testlib_defaults"],
373    srcs: ["libnstest_ns_b_public3.cpp"],
374    relative_install_path: "bionic-loader-test-libs/ns_b",
375}
376
377// -----------------------------------------------------------------------------
378// Build DT_RUNPATH test helper libraries
379// -----------------------------------------------------------------------------
380// include $(LOCAL_PATH)/Android.build.dt_runpath.mk
381
382// -----------------------------------------------------------------------------
383// Build library with two parents
384// -----------------------------------------------------------------------------
385// include $(LOCAL_PATH)/Android.build.dlopen_2_parents_reloc.mk
386
387// -----------------------------------------------------------------------------
388// Build libtest_check_order_dlsym.so with its dependencies.
389// -----------------------------------------------------------------------------
390// include $(LOCAL_PATH)/Android.build.dlopen_check_order_dlsym.mk
391
392// -----------------------------------------------------------------------------
393// Build libtest_check_order_siblings.so with its dependencies.
394// -----------------------------------------------------------------------------
395// include $(LOCAL_PATH)/Android.build.dlopen_check_order_reloc_siblings.mk
396
397// -----------------------------------------------------------------------------
398// Build libtest_check_order_root.so with its dependencies.
399// -----------------------------------------------------------------------------
400// include $(LOCAL_PATH)/Android.build.dlopen_check_order_reloc_main_executable.mk
401
402// -----------------------------------------------------------------------------
403// Build libtest_versioned_lib.so with its dependencies.
404// -----------------------------------------------------------------------------
405// include $(LOCAL_PATH)/Android.build.versioned_lib.mk
406
407// -----------------------------------------------------------------------------
408// Build libraries needed by pthread_atfork tests
409// -----------------------------------------------------------------------------
410// include $(LOCAL_PATH)/Android.build.pthread_atfork.mk
411
412// -----------------------------------------------------------------------------
413// Library with dependency loop used by dlfcn tests
414//
415// libtest_with_dependency_loop -> a -> b -> c -> a
416// -----------------------------------------------------------------------------
417cc_test_library {
418    name: "libtest_with_dependency_loop",
419    defaults: ["bionic_testlib_defaults"],
420    srcs: ["dlopen_testlib_loopy_root.cpp"],
421    shared_libs: ["libtest_with_dependency_loop_a"],
422}
423
424// -----------------------------------------------------------------------------
425// libtest_with_dependency_loop_a.so
426// -----------------------------------------------------------------------------
427cc_test_library {
428    name: "libtest_with_dependency_loop_a",
429    defaults: ["bionic_testlib_defaults"],
430    srcs: ["dlopen_testlib_loopy_a.cpp"],
431    shared_libs: ["libtest_with_dependency_loop_b_tmp"],
432}
433
434// -----------------------------------------------------------------------------
435// libtest_with_dependency_loop_b.so
436//
437// this is temporary placeholder - will be removed
438// -----------------------------------------------------------------------------
439cc_test_library {
440    name: "libtest_with_dependency_loop_b_tmp",
441    defaults: ["bionic_testlib_defaults"],
442    srcs: ["dlopen_testlib_loopy_invalid.cpp"],
443    ldflags: ["-Wl,-soname=libtest_with_dependency_loop_b.so"],
444}
445
446// -----------------------------------------------------------------------------
447// libtest_with_dependency_loop_b.so
448// -----------------------------------------------------------------------------
449cc_test_library {
450    name: "libtest_with_dependency_loop_b",
451    defaults: ["bionic_testlib_defaults"],
452    srcs: ["dlopen_testlib_loopy_b.cpp"],
453    shared_libs: ["libtest_with_dependency_loop_c"],
454}
455
456// -----------------------------------------------------------------------------
457// libtest_with_dependency_loop_c.so
458// -----------------------------------------------------------------------------
459cc_test_library {
460    name: "libtest_with_dependency_loop_c",
461    defaults: ["bionic_testlib_defaults"],
462    srcs: ["dlopen_testlib_loopy_c.cpp"],
463    shared_libs: ["libtest_with_dependency_loop_a"],
464}
465
466// -----------------------------------------------------------------------------
467// libtest_relo_check_dt_needed_order.so
468// |
469// +-> libtest_relo_check_dt_needed_order_1.so
470// |
471// +-> libtest_relo_check_dt_needed_order_2.so
472// -----------------------------------------------------------------------------
473
474cc_test_library {
475    name: "libtest_relo_check_dt_needed_order",
476    defaults: ["bionic_testlib_defaults"],
477    srcs: ["dlopen_testlib_relo_check_dt_needed_order.cpp"],
478    shared_libs: [
479        "libtest_relo_check_dt_needed_order_1",
480        "libtest_relo_check_dt_needed_order_2",
481    ],
482}
483
484cc_test_library {
485    name: "libtest_relo_check_dt_needed_order_1",
486    defaults: ["bionic_testlib_defaults"],
487    srcs: ["dlopen_testlib_relo_check_dt_needed_order_1.cpp"],
488}
489
490cc_test_library {
491    name: "libtest_relo_check_dt_needed_order_2",
492    defaults: ["bionic_testlib_defaults"],
493    srcs: ["dlopen_testlib_relo_check_dt_needed_order_2.cpp"],
494}
495
496// -----------------------------------------------------------------------------
497// Library with dependency used by dlfcn tests
498// -----------------------------------------------------------------------------
499// In Android.mk to support dependency on libdlext_test
500
501// -----------------------------------------------------------------------------
502// Library used by ifunc tests
503// -----------------------------------------------------------------------------
504cc_test_library {
505    name: "libtest_ifunc",
506    defaults: ["bionic_testlib_defaults"],
507    srcs: ["dlopen_testlib_ifunc.cpp"],
508
509    arch: {
510        mips: {
511            enabled: false,
512        },
513        mips64: {
514            enabled: false,
515        },
516    },
517}
518
519cc_test_library {
520    name: "libtest_ifunc_variable",
521    defaults: ["bionic_testlib_defaults"],
522    srcs: ["dlopen_testlib_ifunc_variable.cpp"],
523    shared_libs: ["libtest_ifunc_variable_impl"],
524
525    arch: {
526        mips: {
527            enabled: false,
528        },
529        mips64: {
530            enabled: false,
531        },
532    },
533}
534
535cc_test_library {
536    name: "libtest_ifunc_variable_impl",
537    defaults: ["bionic_testlib_defaults"],
538    srcs: ["dlopen_testlib_ifunc_variable_impl.cpp"],
539
540    arch: {
541        mips: {
542            enabled: false,
543        },
544        mips64: {
545            enabled: false,
546        },
547    },
548}
549
550// -----------------------------------------------------------------------------
551// Library used by atexit tests
552// -----------------------------------------------------------------------------
553
554cc_test_library {
555    name: "libtest_atexit",
556    defaults: ["bionic_testlib_defaults"],
557    srcs: ["atexit_testlib.cpp"],
558}
559
560// -----------------------------------------------------------------------------
561// This library is used by dl_load test to check symbol preempting
562// by main executable
563// -----------------------------------------------------------------------------
564cc_test_library {
565    name: "libdl_preempt_test_1",
566    defaults: ["bionic_testlib_defaults"],
567    srcs: ["dl_preempt_library_1.cpp"],
568}
569
570// -----------------------------------------------------------------------------
571// This library is used by dl_load test to check symbol preempting
572// by libdl_preempt_test_1.so
573// -----------------------------------------------------------------------------
574cc_test_library {
575    name: "libdl_preempt_test_2",
576    defaults: ["bionic_testlib_defaults"],
577    srcs: ["dl_preempt_library_2.cpp"],
578}
579
580// -----------------------------------------------------------------------------
581// Library with DF_1_GLOBAL
582// -----------------------------------------------------------------------------
583cc_test_library {
584    name: "libdl_test_df_1_global",
585    defaults: ["bionic_testlib_defaults"],
586    srcs: ["dl_df_1_global.cpp"],
587    ldflags: ["-Wl,-z,global"],
588
589    target: {
590        host: {
591            // TODO (dimitry): host ld.gold does not yet support -z global
592            // remove this line once it is updated.
593            ldflags: ["-fuse-ld=bfd"],
594        },
595    },
596}
597
598// -----------------------------------------------------------------------------
599// Library using symbol from libdl_test_df_1_global
600// -----------------------------------------------------------------------------
601cc_test_library {
602    name: "libtest_dlsym_df_1_global",
603    defaults: ["bionic_testlib_defaults"],
604    srcs: ["dl_df_1_use_global.cpp"],
605}
606
607// -----------------------------------------------------------------------------
608// Library with DF_1_GLOBAL which will be dlopened
609// (note: libdl_test_df_1_global above will be included in DT_NEEDED)
610// -----------------------------------------------------------------------------
611cc_test_library {
612    name: "libtest_dlopen_df_1_global",
613    defaults: ["bionic_testlib_defaults"],
614    srcs: ["dl_df_1_global_dummy.cpp"],
615    ldflags: ["-Wl,-z,global"],
616
617    target: {
618        host: {
619            // TODO (dimitry): host ld.gold does not yet support -z global
620            // remove this line once it is updated.
621            ldflags: ["-fuse-ld=bfd"],
622        },
623    },
624}
625
626// -----------------------------------------------------------------------------
627// Library with weak function
628// -----------------------------------------------------------------------------
629cc_test_library {
630    name: "libtest_dlsym_weak_func",
631    defaults: ["bionic_testlib_defaults"],
632    srcs: ["dlsym_weak_function.cpp"],
633}
634
635// -----------------------------------------------------------------------------
636// Library to check RTLD_LOCAL with dlsym in 'this'
637// -----------------------------------------------------------------------------
638cc_test_library {
639    name: "libtest_dlsym_from_this",
640    defaults: ["bionic_testlib_defaults"],
641    srcs: ["dlsym_from_this_symbol.cpp"],
642    shared_libs: ["libtest_dlsym_from_this_child"],
643}
644
645// -----------------------------------------------------------------------------
646cc_test_library {
647    name: "libtest_dlsym_from_this_child",
648    defaults: ["bionic_testlib_defaults"],
649    srcs: ["dlsym_from_this_functions.cpp"],
650    shared_libs: ["libtest_dlsym_from_this_grandchild"],
651}
652
653// -----------------------------------------------------------------------------
654cc_test_library {
655    name: "libtest_dlsym_from_this_grandchild",
656    defaults: ["bionic_testlib_defaults"],
657    srcs: ["dlsym_from_this_symbol2.cpp"],
658}
659
660// -----------------------------------------------------------------------------
661// Empty library
662// -----------------------------------------------------------------------------
663cc_test_library {
664    name: "libtest_empty",
665    defaults: ["bionic_testlib_defaults"],
666    srcs: ["empty.cpp"],
667}
668
669// -----------------------------------------------------------------------------
670// Library for inaccessible shared library test
671// -----------------------------------------------------------------------------
672cc_test_library {
673    name: "libtestshared",
674    defaults: ["bionic_testlib_defaults"],
675    srcs: ["empty.cpp"],
676    relative_install_path: "bionic-loader-test-libs/inaccessible_libs",
677}
678
679// -----------------------------------------------------------------------------
680// Library with weak undefined function
681// -----------------------------------------------------------------------------
682cc_test_library {
683    name: "libtest_dlopen_weak_undefined_func",
684    defaults: ["bionic_testlib_defaults"],
685    srcs: ["dlopen_weak_undefined.cpp"],
686}
687
688// -----------------------------------------------------------------------------
689// Check that RTLD_NEXT of a libc symbol works in dlopened library
690// -----------------------------------------------------------------------------
691cc_test_library {
692    name: "libtest_check_rtld_next_from_library",
693    defaults: ["bionic_testlib_defaults"],
694    srcs: ["check_rtld_next_from_library.cpp"],
695}
696
697// -----------------------------------------------------------------------------
698// Library with constructor that calls dlopen() b/7941716
699// -----------------------------------------------------------------------------
700cc_test_library {
701    name: "libtest_dlopen_from_ctor",
702    defaults: ["bionic_testlib_defaults"],
703    srcs: ["dlopen_testlib_dlopen_from_ctor.cpp"],
704}
705
706// -----------------------------------------------------------------------------
707// Libraries used to check init/fini call order
708// -----------------------------------------------------------------------------
709cc_test_library {
710    name: "libtest_init_fini_order_root",
711    defaults: ["bionic_testlib_defaults"],
712    srcs: ["dlopen_check_init_fini_root.cpp"],
713    shared_libs: [
714        "libtest_init_fini_order_child",
715        "libtest_init_fini_order_grand_child",
716    ],
717}
718
719cc_test_library {
720    name: "libtest_init_fini_order_root2",
721    defaults: ["bionic_testlib_defaults"],
722    srcs: ["dlopen_check_init_fini_root.cpp"],
723    shared_libs: [
724        "libtest_init_fini_order_grand_child",
725        "libtest_init_fini_order_child",
726    ],
727}
728
729cc_test_library {
730    name: "libtest_init_fini_order_child",
731    defaults: ["bionic_testlib_defaults"],
732    srcs: ["dlopen_check_init_fini_child.cpp"],
733    shared_libs: ["libtest_init_fini_order_grand_child"],
734}
735
736cc_test_library {
737    name: "libtest_init_fini_order_grand_child",
738    defaults: ["bionic_testlib_defaults"],
739    srcs: ["dlopen_check_init_fini_grand_child.cpp"],
740}
741
742// -----------------------------------------------------------------------------
743// Library that depends on the library with constructor that calls dlopen() b/7941716
744// -----------------------------------------------------------------------------
745cc_test_library {
746    name: "libtest_dlopen_from_ctor_main",
747    defaults: ["bionic_testlib_defaults"],
748    srcs: ["empty.cpp"],
749    shared_libs: ["libtest_dlopen_from_ctor"],
750}
751
752// -----------------------------------------------------------------------------
753// Libraries with non-trivial thread_local variable to test dlclose()
754// -----------------------------------------------------------------------------
755cc_test_library {
756    name: "libtest_thread_local_dtor",
757    defaults: ["bionic_testlib_defaults"],
758    srcs: ["thread_local_dtor.cpp"],
759}
760
761cc_test_library {
762    name: "libtest_thread_local_dtor2",
763    defaults: ["bionic_testlib_defaults"],
764    srcs: ["thread_local_dtor2.cpp"],
765}
766
767// -----------------------------------------------------------------------------
768// Library dt_needs libtest_thread_local_dtor/2 (to check no-unload on load_group)
769// -----------------------------------------------------------------------------
770cc_test_library {
771    name: "libtest_indirect_thread_local_dtor",
772    defaults: ["bionic_testlib_defaults"],
773    srcs: ["empty.cpp"],
774    shared_libs: [
775        "libtest_thread_local_dtor",
776        "libtest_thread_local_dtor2",
777    ],
778}
779
780
781// -----------------------------------------------------------------------------
782// Tool to use to align the shared libraries in a zip file.
783// -----------------------------------------------------------------------------
784cc_binary_host {
785    name: "bionic_tests_zipalign",
786    srcs: ["bionic_tests_zipalign.cpp"],
787    cflags: [
788        "-Wall",
789        "-Werror",
790    ],
791
792    static_libs: [
793        "libziparchive",
794        "liblog",
795        "libbase",
796        "libz",
797        "libutils",
798    ],
799}
800
801cc_test_library {
802    name: "libcfi-test",
803    defaults: ["bionic_testlib_defaults"],
804    srcs: ["cfi_test_lib.cpp"],
805    sanitize: {
806        cfi: false,
807    },
808}
809
810cc_test_library {
811    name: "libcfi-test-bad",
812    defaults: ["bionic_testlib_defaults"],
813    srcs: ["cfi_test_bad_lib.cpp"],
814    sanitize: {
815        cfi: false,
816    },
817}
818
819cc_test {
820    name: "cfi_test_helper",
821    host_supported: false,
822    defaults: ["bionic_testlib_defaults"],
823    srcs: ["cfi_test_helper.cpp"],
824    ldflags: ["-rdynamic"],
825}
826
827cc_test {
828    name: "cfi_test_helper2",
829    host_supported: false,
830    defaults: ["bionic_testlib_defaults"],
831    srcs: ["cfi_test_helper2.cpp"],
832    shared_libs: ["libcfi-test"],
833    ldflags: ["-Wl,--rpath,${ORIGIN}/.."],
834}
835
836cc_test {
837    name: "preinit_getauxval_test_helper",
838    host_supported: false,
839    defaults: ["bionic_testlib_defaults"],
840    srcs: ["preinit_getauxval_test_helper.cpp"],
841}
842
843cc_test {
844    name: "preinit_syscall_test_helper",
845    host_supported: false,
846    defaults: ["bionic_testlib_defaults"],
847    srcs: ["preinit_syscall_test_helper.cpp"],
848}
849
850cc_test {
851    name: "ld_preload_test_helper",
852    host_supported: false,
853    defaults: ["bionic_testlib_defaults"],
854    srcs: ["ld_preload_test_helper.cpp"],
855    shared_libs: ["ld_preload_test_helper_lib1"],
856    ldflags: ["-Wl,--rpath,${ORIGIN}/.."],
857}
858
859cc_test_library {
860    name: "ld_preload_test_helper_lib1",
861    host_supported: false,
862    defaults: ["bionic_testlib_defaults"],
863    srcs: ["ld_preload_test_helper_lib1.cpp"],
864}
865
866cc_test_library {
867    name: "ld_preload_test_helper_lib2",
868    host_supported: false,
869    defaults: ["bionic_testlib_defaults"],
870    srcs: ["ld_preload_test_helper_lib2.cpp"],
871}
872
873cc_test {
874    name: "ld_config_test_helper",
875    host_supported: false,
876    defaults: ["bionic_testlib_defaults"],
877    srcs: ["ld_config_test_helper.cpp"],
878    shared_libs: ["ld_config_test_helper_lib1"],
879    ldflags: ["-Wl,--rpath,${ORIGIN}/.."],
880}
881
882cc_test_library {
883    name: "ld_config_test_helper_lib1",
884    host_supported: false,
885    defaults: ["bionic_testlib_defaults"],
886    srcs: ["ld_config_test_helper_lib1.cpp"],
887    shared_libs: ["ld_config_test_helper_lib2"],
888    relative_install_path: "bionic-loader-test-libs/ns2",
889}
890
891cc_test_library {
892    name: "ld_config_test_helper_lib2",
893    host_supported: false,
894    defaults: ["bionic_testlib_defaults"],
895    srcs: ["ld_config_test_helper_lib2.cpp"],
896    relative_install_path: "bionic-loader-test-libs/ns2",
897}
898
899cc_test_library {
900    name: "ld_config_test_helper_lib3",
901    host_supported: false,
902    defaults: ["bionic_testlib_defaults"],
903    srcs: ["ld_config_test_helper_lib3.cpp"],
904}
905
906cc_test {
907    name: "exec_linker_helper",
908    host_supported: false,
909    defaults: ["bionic_testlib_defaults"],
910    srcs: ["exec_linker_helper.cpp"],
911    shared_libs: ["exec_linker_helper_lib"],
912    ldflags: ["-Wl,--rpath,${ORIGIN}/.."],
913}
914
915cc_test_library {
916    name: "exec_linker_helper_lib",
917    host_supported: false,
918    defaults: ["bionic_testlib_defaults"],
919    srcs: ["exec_linker_helper_lib.cpp"],
920}
921
922cc_test_library {
923    name: "libsegment_gap_outer",
924    host_supported: false,
925    defaults: ["bionic_testlib_defaults"],
926    srcs: ["segment_gap_outer.cpp"],
927    ldflags: ["-Wl,-T,bionic/tests/libs/segment_gap_outer.lds"],
928}
929
930cc_test_library {
931    name: "libsegment_gap_inner",
932    host_supported: false,
933    defaults: ["bionic_testlib_defaults"],
934    srcs: ["segment_gap_inner.cpp"],
935}
936