blob: 05d1ed2f91dbed47320ce2d7f88993e34782dcc8 [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// -----------------------------------------------------------------------------
Ryan Pricharde4ee12f2019-01-15 20:35:00 -080043// Libraries and helper binaries for ELF TLS
Elliott Hughes9724e932018-03-23 18:46:07 -070044// -----------------------------------------------------------------------------
45cc_test_library {
46 name: "libelf-tls-library",
47 defaults: ["bionic_testlib_defaults"],
48 srcs: ["elf_tls_test_library.cpp"],
49 cflags: ["-fno-emulated-tls"],
Chih-Hung Hsiehd6b56c92018-04-12 13:40:54 -070050 allow_undefined_symbols: true, // __tls_get_addr is undefined.
Elliott Hughes9724e932018-03-23 18:46:07 -070051}
52
Ryan Pricharde4ee12f2019-01-15 20:35:00 -080053cc_test_library {
54 name: "libtest_elftls_shared_var",
55 defaults: ["bionic_testlib_defaults"],
56 srcs: ["elftls_shared_var.cpp"],
57 cflags: ["-fno-emulated-tls"],
58}
59
60cc_test_library {
61 name: "libtest_elftls_shared_var_ie",
62 defaults: ["bionic_testlib_defaults"],
63 srcs: ["elftls_shared_var_ie.cpp"],
64 cflags: ["-fno-emulated-tls"],
65 shared_libs: ["libtest_elftls_shared_var"],
66}
67
68cc_test_library {
69 name: "libtest_elftls_tprel",
70 defaults: ["bionic_testlib_defaults"],
71 srcs: ["elftls_tprel.cpp"],
72 cflags: ["-fno-emulated-tls"],
73}
74
75cc_test {
76 name: "elftls_dlopen_ie_error_helper",
77 defaults: ["bionic_testlib_defaults"],
78 srcs: ["elftls_dlopen_ie_error_helper.cpp"],
79 ldflags: ["-Wl,--rpath,${ORIGIN}/.."],
80}
81
Elliott Hughes9724e932018-03-23 18:46:07 -070082// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -070083// Library to test gnu-styled hash
84// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -070085cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -070086 name: "libgnu-hash-table-library",
87 defaults: ["bionic_testlib_defaults"],
88 srcs: ["dlext_test_library.cpp"],
89 ldflags: ["-Wl,--hash-style=gnu"],
90 arch: {
91 mips: {
92 enabled: false,
93 },
94 mips64: {
95 enabled: false,
96 },
97 },
98}
99
100// -----------------------------------------------------------------------------
101// Library to test sysv-styled hash
102// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700103cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700104 name: "libsysv-hash-table-library",
105 defaults: ["bionic_testlib_defaults"],
106 srcs: ["dlext_test_library.cpp"],
107 ldflags: ["-Wl,--hash-style=sysv"],
108}
109
110// -----------------------------------------------------------------------------
111// Library used by dlext tests - with GNU RELRO program header
112// -----------------------------------------------------------------------------
113// In Android.mk to support creating symlinks
114
115// -----------------------------------------------------------------------------
116// Library used by dlext tests - without GNU RELRO program header
117// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700118cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700119 name: "libdlext_test_norelro",
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700120 defaults: ["bionic_testlib_defaults"],
Colin Cross2722ebb2016-07-11 16:20:06 -0700121 srcs: ["dlext_test_library.cpp"],
122 ldflags: ["-Wl,-z,norelro"],
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800123 shared_libs: ["libtest_simple"],
Colin Cross2722ebb2016-07-11 16:20:06 -0700124}
125
126// -----------------------------------------------------------------------------
127// Library used by dlext tests - different name non-default location
128// -----------------------------------------------------------------------------
129// In Android.mk to support installing to /data
130
131// -----------------------------------------------------------------------------
132// Libraries used by dlext tests for open from a zip-file
133// -----------------------------------------------------------------------------
134// In Android.mk to support installing to /data
135
136// ----------------------------------------------------------------------------
137// Library with soname which does not match filename
138// ----------------------------------------------------------------------------
139// In Android.mk to support zipped and aligned tests
140
141// -----------------------------------------------------------------------------
142// Library used by dlext tests - zipped and aligned
143// -----------------------------------------------------------------------------
144// In Android.mk to support zipped and aligned tests
145
146// -----------------------------------------------------------------------------
147// Library used by dlfcn tests
148// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700149cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700150 name: "libtest_simple",
151 defaults: ["bionic_testlib_defaults"],
152 srcs: ["dlopen_testlib_simple.cpp"],
153}
154
155// -----------------------------------------------------------------------------
dimitry965d06d2017-11-28 16:03:07 +0100156// Library used by dlext direct unload on the namespace boundary tests
157// -----------------------------------------------------------------------------
158cc_test_library {
159 name: "libtest_missing_symbol",
160 defaults: ["bionic_testlib_defaults"],
161 srcs: ["dlopen_testlib_missing_symbol.cpp"],
162 allow_undefined_symbols: true,
163 relative_install_path: "bionic-loader-test-libs/public_namespace_libs",
164}
165
dimitry965d06d2017-11-28 16:03:07 +0100166// -----------------------------------------------------------------------------
167// Library used by dlext indirect unload on the namespace boundary tests
168//
169// These libraries produce following dependency graph:
170// libtest_missing_symbol_root (private ns)
171// +-> libbnstest_public (public ns)
172// +-> libtest_missing_symbol_child_public (public ns)
173// +-> libnstest_public (public ns)
174// +-> libtest_missing_symbol_child_private (private_ns)
175// +-> libnstest_public (public_ns)
176//
177// All libraries except libtest_missing_symbol are located in
178// private_namespace_libs/
179// -----------------------------------------------------------------------------
180cc_test_library {
181 name: "libtest_missing_symbol_child_public",
182 defaults: ["bionic_testlib_defaults"],
183 srcs: ["empty.cpp"],
184 relative_install_path: "bionic-loader-test-libs/public_namespace_libs",
185 shared_libs: ["libnstest_public"],
186}
187
188cc_test_library {
189 name: "libtest_missing_symbol_child_private",
190 defaults: ["bionic_testlib_defaults"],
191 srcs: ["empty.cpp"],
192 relative_install_path: "bionic-loader-test-libs/private_namespace_libs",
193 shared_libs: ["libnstest_public"],
194}
195
196cc_test_library {
197 name: "libtest_missing_symbol_root",
198 defaults: ["bionic_testlib_defaults"],
199 srcs: ["dlopen_testlib_missing_symbol.cpp"],
200 relative_install_path: "bionic-loader-test-libs/private_namespace_libs",
201 allow_undefined_symbols: true,
202 shared_libs: [
203 "libnstest_public",
204 "libtest_missing_symbol_child_public",
205 "libtest_missing_symbol_child_private",
206 ],
207}
208
209// -----------------------------------------------------------------------------
210// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -0700211// Library used by dlfcn nodelete tests
212// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700213cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700214 name: "libtest_nodelete_1",
215 defaults: ["bionic_testlib_defaults"],
216 srcs: ["dlopen_nodelete_1.cpp"],
217}
218
219// -----------------------------------------------------------------------------
220// Library used by dlfcn nodelete tests
221// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700222cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700223 name: "libtest_nodelete_2",
224 defaults: ["bionic_testlib_defaults"],
225 srcs: ["dlopen_nodelete_2.cpp"],
226}
227
228// -----------------------------------------------------------------------------
229// Library used by dlfcn nodelete tests
230// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700231cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700232 name: "libtest_nodelete_dt_flags_1",
233 defaults: ["bionic_testlib_defaults"],
234 srcs: ["dlopen_nodelete_dt_flags_1.cpp"],
235 ldflags: ["-Wl,-z,nodelete"],
236}
237
238// -----------------------------------------------------------------------------
239// Build test helper libraries for linker namespaces
dimitry965d06d2017-11-28 16:03:07 +0100240//
241// This set of libraries is used to verify linker namespaces.
242//
243// Test cases
244// 1. Check that private libraries loaded in different namespaces are
245// different. Check that dlsym does not confuse them.
246// 2. Check that public libraries loaded in different namespaces are shared
247// between them.
248// 3. Check that namespace sticks on dlopen
249// 4. Check that having access to shared library (libnstest_public.so)
250// does not expose symbols from dependent library (libnstest_public_internal.so)
251//
252// Dependency tree (visibility)
253// libnstest_root.so (this should be local to the namespace)
254// +-> libnstest_public.so
255// +-> libnstest_public_internal.so
256// +-> libnstest_private.so
257//
258// libnstest_dlopened.so (library in private namespace dlopened from libnstest_root.so)
Colin Cross2722ebb2016-07-11 16:20:06 -0700259// -----------------------------------------------------------------------------
dimitry965d06d2017-11-28 16:03:07 +0100260cc_test_library {
261 name: "libnstest_root",
262 defaults: ["bionic_testlib_defaults"],
263 srcs: ["namespaces_root.cpp"],
264 relative_install_path: "bionic-loader-test-libs/private_namespace_libs",
265 shared_libs: [
266 "libnstest_public",
267 "libnstest_private",
268 ],
Ryan Prichardcd4e5ba2019-01-17 17:45:42 -0800269 // The dlext.ns_anonymous test copies the loaded segments of this shared
270 // object into a new mapping, so every segment must be readable. Turn off
271 // eXecute-Only-Memory. See http://b/123034666.
272 xom: false,
dimitry965d06d2017-11-28 16:03:07 +0100273}
274
275cc_test_library {
276 name: "libnstest_public_internal",
277 defaults: ["bionic_testlib_defaults"],
278 srcs: ["namespaces_public_internal.cpp"],
279 relative_install_path: "bionic-loader-test-libs/public_namespace_libs",
280}
281
282cc_test_library {
283 name: "libnstest_public",
284 defaults: ["bionic_testlib_defaults"],
285 srcs: ["namespaces_public.cpp"],
286 relative_install_path: "bionic-loader-test-libs/public_namespace_libs",
287 shared_libs: ["libnstest_public_internal"],
288}
289
290cc_test_library {
291 name: "libnstest_private",
292 defaults: ["bionic_testlib_defaults"],
293 srcs: ["namespaces_private.cpp"],
294 relative_install_path: "bionic-loader-test-libs/private_namespace_libs",
295}
296
297cc_test_library {
298 name: "libnstest_dlopened",
299 defaults: ["bionic_testlib_defaults"],
300 srcs: ["namespaces_dlopened.cpp"],
301 relative_install_path: "bionic-loader-test-libs/private_namespace_libs",
302}
Colin Cross2722ebb2016-07-11 16:20:06 -0700303
304// -----------------------------------------------------------------------------
Logan Chien9ee45912018-01-18 12:05:09 +0800305// Build test helper libraries for linker namespaces for allow all shared libs
306//
307// This set of libraries is used to verify linker namespaces for allow all
308// shared libs.
309//
310// Test cases
311// 1. Check that namespace a exposes libnstest_ns_a_public1 to
312// namespace b while keeping libnstest_ns_a_public1_internal as an
313// internal lib.
314// 2. Check that namespace b exposes all libraries to namespace a.
315//
316// Dependency tree (visibility)
317// libnstest_ns_b_public2.so (ns:b)
318// +-> libnstest_ns_a_public1.so (ns:a)
319// +-> libnstest_ns_a_public2_internal.so (ns:a)
320// +-> libnstest_ns_b_public3.so (ns:b)
321//
322// -----------------------------------------------------------------------------
323cc_test_library {
324 name: "libnstest_ns_a_public1",
325 defaults: ["bionic_testlib_defaults"],
326 srcs: ["libnstest_ns_a_public1.cpp"],
327 relative_install_path: "bionic-loader-test-libs/ns_a",
328 shared_libs: [
329 "libnstest_ns_a_public1_internal",
330 "libnstest_ns_b_public3",
331 ],
332}
333
334cc_test_library {
335 name: "libnstest_ns_a_public1_internal",
336 defaults: ["bionic_testlib_defaults"],
337 srcs: ["libnstest_ns_a_public1_internal.cpp"],
338 relative_install_path: "bionic-loader-test-libs/ns_a",
339}
340
341cc_test_library {
342 name: "libnstest_ns_b_public2",
343 defaults: ["bionic_testlib_defaults"],
344 srcs: ["libnstest_ns_b_public2.cpp"],
345 relative_install_path: "bionic-loader-test-libs/ns_b",
346 shared_libs: ["libnstest_ns_a_public1"],
347}
348
349cc_test_library {
350 name: "libnstest_ns_b_public3",
351 defaults: ["bionic_testlib_defaults"],
352 srcs: ["libnstest_ns_b_public3.cpp"],
353 relative_install_path: "bionic-loader-test-libs/ns_b",
354}
355
356// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -0700357// Build DT_RUNPATH test helper libraries
358// -----------------------------------------------------------------------------
359// include $(LOCAL_PATH)/Android.build.dt_runpath.mk
360
361// -----------------------------------------------------------------------------
362// Build library with two parents
363// -----------------------------------------------------------------------------
364// include $(LOCAL_PATH)/Android.build.dlopen_2_parents_reloc.mk
365
366// -----------------------------------------------------------------------------
367// Build libtest_check_order_dlsym.so with its dependencies.
368// -----------------------------------------------------------------------------
369// include $(LOCAL_PATH)/Android.build.dlopen_check_order_dlsym.mk
370
371// -----------------------------------------------------------------------------
372// Build libtest_check_order_siblings.so with its dependencies.
373// -----------------------------------------------------------------------------
374// include $(LOCAL_PATH)/Android.build.dlopen_check_order_reloc_siblings.mk
375
376// -----------------------------------------------------------------------------
377// Build libtest_check_order_root.so with its dependencies.
378// -----------------------------------------------------------------------------
379// include $(LOCAL_PATH)/Android.build.dlopen_check_order_reloc_main_executable.mk
380
381// -----------------------------------------------------------------------------
382// Build libtest_versioned_lib.so with its dependencies.
383// -----------------------------------------------------------------------------
384// include $(LOCAL_PATH)/Android.build.versioned_lib.mk
385
386// -----------------------------------------------------------------------------
387// Build libraries needed by pthread_atfork tests
388// -----------------------------------------------------------------------------
389// include $(LOCAL_PATH)/Android.build.pthread_atfork.mk
390
391// -----------------------------------------------------------------------------
392// Library with dependency loop used by dlfcn tests
393//
394// libtest_with_dependency_loop -> a -> b -> c -> a
395// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700396cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700397 name: "libtest_with_dependency_loop",
398 defaults: ["bionic_testlib_defaults"],
399 srcs: ["dlopen_testlib_loopy_root.cpp"],
400 shared_libs: ["libtest_with_dependency_loop_a"],
401}
402
403// -----------------------------------------------------------------------------
404// libtest_with_dependency_loop_a.so
405// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700406cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700407 name: "libtest_with_dependency_loop_a",
408 defaults: ["bionic_testlib_defaults"],
409 srcs: ["dlopen_testlib_loopy_a.cpp"],
410 shared_libs: ["libtest_with_dependency_loop_b_tmp"],
411}
412
413// -----------------------------------------------------------------------------
414// libtest_with_dependency_loop_b.so
415//
416// this is temporary placeholder - will be removed
417// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700418cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700419 name: "libtest_with_dependency_loop_b_tmp",
420 defaults: ["bionic_testlib_defaults"],
421 srcs: ["dlopen_testlib_loopy_invalid.cpp"],
422 ldflags: ["-Wl,-soname=libtest_with_dependency_loop_b.so"],
423}
424
425// -----------------------------------------------------------------------------
426// libtest_with_dependency_loop_b.so
427// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700428cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700429 name: "libtest_with_dependency_loop_b",
430 defaults: ["bionic_testlib_defaults"],
431 srcs: ["dlopen_testlib_loopy_b.cpp"],
432 shared_libs: ["libtest_with_dependency_loop_c"],
433}
434
435// -----------------------------------------------------------------------------
436// libtest_with_dependency_loop_c.so
437// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700438cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700439 name: "libtest_with_dependency_loop_c",
440 defaults: ["bionic_testlib_defaults"],
441 srcs: ["dlopen_testlib_loopy_c.cpp"],
442 shared_libs: ["libtest_with_dependency_loop_a"],
443}
444
445// -----------------------------------------------------------------------------
446// libtest_relo_check_dt_needed_order.so
447// |
448// +-> libtest_relo_check_dt_needed_order_1.so
449// |
450// +-> libtest_relo_check_dt_needed_order_2.so
451// -----------------------------------------------------------------------------
452
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700453cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700454 name: "libtest_relo_check_dt_needed_order",
455 defaults: ["bionic_testlib_defaults"],
456 srcs: ["dlopen_testlib_relo_check_dt_needed_order.cpp"],
457 shared_libs: [
458 "libtest_relo_check_dt_needed_order_1",
459 "libtest_relo_check_dt_needed_order_2",
460 ],
461}
462
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700463cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700464 name: "libtest_relo_check_dt_needed_order_1",
465 defaults: ["bionic_testlib_defaults"],
466 srcs: ["dlopen_testlib_relo_check_dt_needed_order_1.cpp"],
467}
468
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700469cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700470 name: "libtest_relo_check_dt_needed_order_2",
471 defaults: ["bionic_testlib_defaults"],
472 srcs: ["dlopen_testlib_relo_check_dt_needed_order_2.cpp"],
473}
474
475// -----------------------------------------------------------------------------
476// Library with dependency used by dlfcn tests
477// -----------------------------------------------------------------------------
478// In Android.mk to support dependency on libdlext_test
479
480// -----------------------------------------------------------------------------
481// Library used by ifunc tests
482// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700483cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700484 name: "libtest_ifunc",
485 defaults: ["bionic_testlib_defaults"],
Dimitry Ivanov21975b22017-05-02 16:31:56 -0700486 srcs: ["dlopen_testlib_ifunc.cpp"],
Colin Cross2722ebb2016-07-11 16:20:06 -0700487
Colin Cross2722ebb2016-07-11 16:20:06 -0700488 arch: {
489 mips: {
490 enabled: false,
491 },
492 mips64: {
493 enabled: false,
494 },
495 },
Dimitry Ivanov21975b22017-05-02 16:31:56 -0700496}
497
498cc_test_library {
499 name: "libtest_ifunc_variable",
500 defaults: ["bionic_testlib_defaults"],
501 srcs: ["dlopen_testlib_ifunc_variable.cpp"],
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800502 shared_libs: ["libtest_ifunc_variable_impl"],
Dimitry Ivanov21975b22017-05-02 16:31:56 -0700503
504 arch: {
505 mips: {
506 enabled: false,
507 },
508 mips64: {
509 enabled: false,
510 },
511 },
Dimitry Ivanov21975b22017-05-02 16:31:56 -0700512}
513
514cc_test_library {
515 name: "libtest_ifunc_variable_impl",
516 defaults: ["bionic_testlib_defaults"],
517 srcs: ["dlopen_testlib_ifunc_variable_impl.cpp"],
518
519 arch: {
520 mips: {
521 enabled: false,
522 },
523 mips64: {
524 enabled: false,
525 },
526 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700527}
528
529// -----------------------------------------------------------------------------
530// Library used by atexit tests
531// -----------------------------------------------------------------------------
532
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700533cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700534 name: "libtest_atexit",
535 defaults: ["bionic_testlib_defaults"],
536 srcs: ["atexit_testlib.cpp"],
537}
538
539// -----------------------------------------------------------------------------
540// This library is used by dl_load test to check symbol preempting
541// by main executable
542// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700543cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700544 name: "libdl_preempt_test_1",
545 defaults: ["bionic_testlib_defaults"],
546 srcs: ["dl_preempt_library_1.cpp"],
547}
548
549// -----------------------------------------------------------------------------
550// This library is used by dl_load test to check symbol preempting
551// by libdl_preempt_test_1.so
552// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700553cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700554 name: "libdl_preempt_test_2",
555 defaults: ["bionic_testlib_defaults"],
556 srcs: ["dl_preempt_library_2.cpp"],
557}
558
559// -----------------------------------------------------------------------------
560// Library with DF_1_GLOBAL
561// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700562cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700563 name: "libdl_test_df_1_global",
564 defaults: ["bionic_testlib_defaults"],
565 srcs: ["dl_df_1_global.cpp"],
566 ldflags: ["-Wl,-z,global"],
567
568 target: {
569 host: {
570 // TODO (dimitry): host ld.gold does not yet support -z global
571 // remove this line once it is updated.
572 ldflags: ["-fuse-ld=bfd"],
573 },
574 },
575}
576
577// -----------------------------------------------------------------------------
578// Library using symbol from libdl_test_df_1_global
579// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700580cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700581 name: "libtest_dlsym_df_1_global",
582 defaults: ["bionic_testlib_defaults"],
583 srcs: ["dl_df_1_use_global.cpp"],
584}
585
586// -----------------------------------------------------------------------------
Jiyong Park01162f22017-10-16 15:31:09 +0900587// Library with DF_1_GLOBAL which will be dlopened
588// (note: libdl_test_df_1_global above will be included in DT_NEEDED)
589// -----------------------------------------------------------------------------
590cc_test_library {
591 name: "libtest_dlopen_df_1_global",
592 defaults: ["bionic_testlib_defaults"],
593 srcs: ["dl_df_1_global_dummy.cpp"],
594 ldflags: ["-Wl,-z,global"],
595
596 target: {
597 host: {
598 // TODO (dimitry): host ld.gold does not yet support -z global
599 // remove this line once it is updated.
600 ldflags: ["-fuse-ld=bfd"],
601 },
602 },
603}
604
Jiyong Park01162f22017-10-16 15:31:09 +0900605// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -0700606// Library with weak function
607// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700608cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700609 name: "libtest_dlsym_weak_func",
610 defaults: ["bionic_testlib_defaults"],
611 srcs: ["dlsym_weak_function.cpp"],
612}
613
614// -----------------------------------------------------------------------------
615// Library to check RTLD_LOCAL with dlsym in 'this'
616// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700617cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700618 name: "libtest_dlsym_from_this",
619 defaults: ["bionic_testlib_defaults"],
620 srcs: ["dlsym_from_this_symbol.cpp"],
621 shared_libs: ["libtest_dlsym_from_this_child"],
Colin Cross2722ebb2016-07-11 16:20:06 -0700622}
623
624// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700625cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700626 name: "libtest_dlsym_from_this_child",
627 defaults: ["bionic_testlib_defaults"],
628 srcs: ["dlsym_from_this_functions.cpp"],
629 shared_libs: ["libtest_dlsym_from_this_grandchild"],
630}
631
632// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700633cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700634 name: "libtest_dlsym_from_this_grandchild",
635 defaults: ["bionic_testlib_defaults"],
636 srcs: ["dlsym_from_this_symbol2.cpp"],
637}
638
639// -----------------------------------------------------------------------------
640// Empty library
641// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700642cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700643 name: "libtest_empty",
644 defaults: ["bionic_testlib_defaults"],
645 srcs: ["empty.cpp"],
646}
647
648// -----------------------------------------------------------------------------
dimitry8db36a52017-10-23 15:10:10 +0200649// Library for inaccessible shared library test
650// -----------------------------------------------------------------------------
651cc_test_library {
652 name: "libtestshared",
653 defaults: ["bionic_testlib_defaults"],
654 srcs: ["empty.cpp"],
Nan Zhangdab0fd52017-11-07 11:05:24 -0800655 relative_install_path: "bionic-loader-test-libs/inaccessible_libs",
dimitry8db36a52017-10-23 15:10:10 +0200656}
657
658// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -0700659// Library with weak undefined function
660// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700661cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700662 name: "libtest_dlopen_weak_undefined_func",
663 defaults: ["bionic_testlib_defaults"],
664 srcs: ["dlopen_weak_undefined.cpp"],
665}
666
667// -----------------------------------------------------------------------------
Dimitry Ivanovd0b5c3a2016-11-25 12:23:11 -0800668// Check that RTLD_NEXT of a libc symbol works in dlopened library
669// -----------------------------------------------------------------------------
670cc_test_library {
671 name: "libtest_check_rtld_next_from_library",
672 defaults: ["bionic_testlib_defaults"],
673 srcs: ["check_rtld_next_from_library.cpp"],
Dimitry Ivanovd0b5c3a2016-11-25 12:23:11 -0800674}
675
676// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -0700677// Library with constructor that calls dlopen() b/7941716
678// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700679cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700680 name: "libtest_dlopen_from_ctor",
681 defaults: ["bionic_testlib_defaults"],
682 srcs: ["dlopen_testlib_dlopen_from_ctor.cpp"],
Colin Cross2722ebb2016-07-11 16:20:06 -0700683}
684
685// -----------------------------------------------------------------------------
Dimitry Ivanovec90e242017-02-10 11:04:20 -0800686// Libraries used to check init/fini call order
Dimitry Ivanovea8f3962017-02-09 13:31:57 -0800687// -----------------------------------------------------------------------------
688cc_test_library {
689 name: "libtest_init_fini_order_root",
690 defaults: ["bionic_testlib_defaults"],
691 srcs: ["dlopen_check_init_fini_root.cpp"],
Dimitry Ivanovec90e242017-02-10 11:04:20 -0800692 shared_libs: [
693 "libtest_init_fini_order_child",
694 "libtest_init_fini_order_grand_child",
695 ],
696}
697
698cc_test_library {
699 name: "libtest_init_fini_order_root2",
700 defaults: ["bionic_testlib_defaults"],
701 srcs: ["dlopen_check_init_fini_root.cpp"],
702 shared_libs: [
703 "libtest_init_fini_order_grand_child",
704 "libtest_init_fini_order_child",
705 ],
Dimitry Ivanovea8f3962017-02-09 13:31:57 -0800706}
707
708cc_test_library {
709 name: "libtest_init_fini_order_child",
710 defaults: ["bionic_testlib_defaults"],
711 srcs: ["dlopen_check_init_fini_child.cpp"],
712 shared_libs: ["libtest_init_fini_order_grand_child"],
713}
714
715cc_test_library {
716 name: "libtest_init_fini_order_grand_child",
717 defaults: ["bionic_testlib_defaults"],
718 srcs: ["dlopen_check_init_fini_grand_child.cpp"],
719}
720
721// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -0700722// Library that depends on the library with constructor that calls dlopen() b/7941716
723// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700724cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700725 name: "libtest_dlopen_from_ctor_main",
726 defaults: ["bionic_testlib_defaults"],
727 srcs: ["empty.cpp"],
728 shared_libs: ["libtest_dlopen_from_ctor"],
729}
730
731// -----------------------------------------------------------------------------
dimitry55547db2018-05-25 14:17:37 +0200732// Libraries with non-trivial thread_local variable to test dlclose()
dimitry06016f22018-01-05 11:39:28 +0100733// -----------------------------------------------------------------------------
734cc_test_library {
735 name: "libtest_thread_local_dtor",
736 defaults: ["bionic_testlib_defaults"],
737 srcs: ["thread_local_dtor.cpp"],
738}
739
dimitry55547db2018-05-25 14:17:37 +0200740cc_test_library {
741 name: "libtest_thread_local_dtor2",
742 defaults: ["bionic_testlib_defaults"],
743 srcs: ["thread_local_dtor2.cpp"],
744}
745
746// -----------------------------------------------------------------------------
747// Library dt_needs libtest_thread_local_dtor/2 (to check no-unload on load_group)
748// -----------------------------------------------------------------------------
749cc_test_library {
750 name: "libtest_indirect_thread_local_dtor",
751 defaults: ["bionic_testlib_defaults"],
752 srcs: ["empty.cpp"],
753 shared_libs: [
754 "libtest_thread_local_dtor",
755 "libtest_thread_local_dtor2",
756 ],
757}
758
759
dimitry06016f22018-01-05 11:39:28 +0100760// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -0700761// Tool to use to align the shared libraries in a zip file.
762// -----------------------------------------------------------------------------
763cc_binary_host {
764 name: "bionic_tests_zipalign",
765 srcs: ["bionic_tests_zipalign.cpp"],
766 cflags: [
767 "-Wall",
768 "-Werror",
769 ],
770
771 static_libs: [
772 "libziparchive",
773 "liblog",
774 "libbase",
775 "libz",
776 "libutils",
777 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700778}
Evgenii Stepanov0a3637d2016-07-06 13:20:59 -0700779
780cc_test_library {
781 name: "libcfi-test",
782 defaults: ["bionic_testlib_defaults"],
783 srcs: ["cfi_test_lib.cpp"],
784 sanitize: {
785 cfi: false,
786 },
787}
788
789cc_test_library {
790 name: "libcfi-test-bad",
791 defaults: ["bionic_testlib_defaults"],
792 srcs: ["cfi_test_bad_lib.cpp"],
793 sanitize: {
794 cfi: false,
795 },
796}
Evgenii Stepanov68ecec12017-01-31 13:19:30 -0800797
798cc_test {
799 name: "cfi_test_helper",
800 host_supported: false,
801 defaults: ["bionic_testlib_defaults"],
802 srcs: ["cfi_test_helper.cpp"],
803 ldflags: ["-rdynamic"],
804}
805
806cc_test {
807 name: "cfi_test_helper2",
808 host_supported: false,
809 defaults: ["bionic_testlib_defaults"],
810 srcs: ["cfi_test_helper2.cpp"],
811 shared_libs: ["libcfi-test"],
812 ldflags: ["-Wl,--rpath,${ORIGIN}/.."],
813}
Elliott Hugheseb04ed52017-03-29 13:48:02 -0700814
815cc_test {
816 name: "preinit_getauxval_test_helper",
817 host_supported: false,
818 defaults: ["bionic_testlib_defaults"],
819 srcs: ["preinit_getauxval_test_helper.cpp"],
820}
821
822cc_test {
823 name: "preinit_syscall_test_helper",
824 host_supported: false,
825 defaults: ["bionic_testlib_defaults"],
826 srcs: ["preinit_syscall_test_helper.cpp"],
827}
Jiyong Park02586a22017-05-20 01:01:24 +0900828
829cc_test {
830 name: "ld_preload_test_helper",
831 host_supported: false,
832 defaults: ["bionic_testlib_defaults"],
833 srcs: ["ld_preload_test_helper.cpp"],
834 shared_libs: ["ld_preload_test_helper_lib1"],
835 ldflags: ["-Wl,--rpath,${ORIGIN}/.."],
836}
837
838cc_test_library {
839 name: "ld_preload_test_helper_lib1",
840 host_supported: false,
841 defaults: ["bionic_testlib_defaults"],
842 srcs: ["ld_preload_test_helper_lib1.cpp"],
843}
844
845cc_test_library {
846 name: "ld_preload_test_helper_lib2",
847 host_supported: false,
848 defaults: ["bionic_testlib_defaults"],
849 srcs: ["ld_preload_test_helper_lib2.cpp"],
850}
851
852cc_test {
853 name: "ld_config_test_helper",
854 host_supported: false,
855 defaults: ["bionic_testlib_defaults"],
856 srcs: ["ld_config_test_helper.cpp"],
857 shared_libs: ["ld_config_test_helper_lib1"],
858 ldflags: ["-Wl,--rpath,${ORIGIN}/.."],
859}
860
861cc_test_library {
862 name: "ld_config_test_helper_lib1",
863 host_supported: false,
864 defaults: ["bionic_testlib_defaults"],
865 srcs: ["ld_config_test_helper_lib1.cpp"],
866 shared_libs: ["ld_config_test_helper_lib2"],
Nan Zhangdab0fd52017-11-07 11:05:24 -0800867 relative_install_path: "bionic-loader-test-libs/ns2",
Jiyong Park02586a22017-05-20 01:01:24 +0900868}
869
870cc_test_library {
871 name: "ld_config_test_helper_lib2",
872 host_supported: false,
873 defaults: ["bionic_testlib_defaults"],
874 srcs: ["ld_config_test_helper_lib2.cpp"],
Nan Zhangdab0fd52017-11-07 11:05:24 -0800875 relative_install_path: "bionic-loader-test-libs/ns2",
Jiyong Park02586a22017-05-20 01:01:24 +0900876}
877
878cc_test_library {
879 name: "ld_config_test_helper_lib3",
880 host_supported: false,
881 defaults: ["bionic_testlib_defaults"],
882 srcs: ["ld_config_test_helper_lib3.cpp"],
883}
Ryan Prichard8f639a42018-10-01 23:10:05 -0700884
885cc_test {
886 name: "exec_linker_helper",
887 host_supported: false,
888 defaults: ["bionic_testlib_defaults"],
889 srcs: ["exec_linker_helper.cpp"],
890 shared_libs: ["exec_linker_helper_lib"],
891 ldflags: ["-Wl,--rpath,${ORIGIN}/.."],
892}
893
894cc_test_library {
895 name: "exec_linker_helper_lib",
896 host_supported: false,
897 defaults: ["bionic_testlib_defaults"],
898 srcs: ["exec_linker_helper_lib.cpp"],
899}