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