blob: 8f8834532dec00f735d74f2aeddf3410e3fa1582 [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 Prichard5cf02f62019-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 Prichard5cf02f62019-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 ],
269}
270
271cc_test_library {
272 name: "libnstest_public_internal",
273 defaults: ["bionic_testlib_defaults"],
274 srcs: ["namespaces_public_internal.cpp"],
275 relative_install_path: "bionic-loader-test-libs/public_namespace_libs",
276}
277
278cc_test_library {
279 name: "libnstest_public",
280 defaults: ["bionic_testlib_defaults"],
281 srcs: ["namespaces_public.cpp"],
282 relative_install_path: "bionic-loader-test-libs/public_namespace_libs",
283 shared_libs: ["libnstest_public_internal"],
284}
285
286cc_test_library {
287 name: "libnstest_private",
288 defaults: ["bionic_testlib_defaults"],
289 srcs: ["namespaces_private.cpp"],
290 relative_install_path: "bionic-loader-test-libs/private_namespace_libs",
291}
292
293cc_test_library {
294 name: "libnstest_dlopened",
295 defaults: ["bionic_testlib_defaults"],
296 srcs: ["namespaces_dlopened.cpp"],
297 relative_install_path: "bionic-loader-test-libs/private_namespace_libs",
298}
Colin Cross2722ebb2016-07-11 16:20:06 -0700299
300// -----------------------------------------------------------------------------
Logan Chien9ee45912018-01-18 12:05:09 +0800301// Build test helper libraries for linker namespaces for allow all shared libs
302//
303// This set of libraries is used to verify linker namespaces for allow all
304// shared libs.
305//
306// Test cases
307// 1. Check that namespace a exposes libnstest_ns_a_public1 to
308// namespace b while keeping libnstest_ns_a_public1_internal as an
309// internal lib.
310// 2. Check that namespace b exposes all libraries to namespace a.
311//
312// Dependency tree (visibility)
313// libnstest_ns_b_public2.so (ns:b)
314// +-> libnstest_ns_a_public1.so (ns:a)
315// +-> libnstest_ns_a_public2_internal.so (ns:a)
316// +-> libnstest_ns_b_public3.so (ns:b)
317//
318// -----------------------------------------------------------------------------
319cc_test_library {
320 name: "libnstest_ns_a_public1",
321 defaults: ["bionic_testlib_defaults"],
322 srcs: ["libnstest_ns_a_public1.cpp"],
323 relative_install_path: "bionic-loader-test-libs/ns_a",
324 shared_libs: [
325 "libnstest_ns_a_public1_internal",
326 "libnstest_ns_b_public3",
327 ],
328}
329
330cc_test_library {
331 name: "libnstest_ns_a_public1_internal",
332 defaults: ["bionic_testlib_defaults"],
333 srcs: ["libnstest_ns_a_public1_internal.cpp"],
334 relative_install_path: "bionic-loader-test-libs/ns_a",
335}
336
337cc_test_library {
338 name: "libnstest_ns_b_public2",
339 defaults: ["bionic_testlib_defaults"],
340 srcs: ["libnstest_ns_b_public2.cpp"],
341 relative_install_path: "bionic-loader-test-libs/ns_b",
342 shared_libs: ["libnstest_ns_a_public1"],
343}
344
345cc_test_library {
346 name: "libnstest_ns_b_public3",
347 defaults: ["bionic_testlib_defaults"],
348 srcs: ["libnstest_ns_b_public3.cpp"],
349 relative_install_path: "bionic-loader-test-libs/ns_b",
350}
351
352// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -0700353// Build DT_RUNPATH test helper libraries
354// -----------------------------------------------------------------------------
355// include $(LOCAL_PATH)/Android.build.dt_runpath.mk
356
357// -----------------------------------------------------------------------------
358// Build library with two parents
359// -----------------------------------------------------------------------------
360// include $(LOCAL_PATH)/Android.build.dlopen_2_parents_reloc.mk
361
362// -----------------------------------------------------------------------------
363// Build libtest_check_order_dlsym.so with its dependencies.
364// -----------------------------------------------------------------------------
365// include $(LOCAL_PATH)/Android.build.dlopen_check_order_dlsym.mk
366
367// -----------------------------------------------------------------------------
368// Build libtest_check_order_siblings.so with its dependencies.
369// -----------------------------------------------------------------------------
370// include $(LOCAL_PATH)/Android.build.dlopen_check_order_reloc_siblings.mk
371
372// -----------------------------------------------------------------------------
373// Build libtest_check_order_root.so with its dependencies.
374// -----------------------------------------------------------------------------
375// include $(LOCAL_PATH)/Android.build.dlopen_check_order_reloc_main_executable.mk
376
377// -----------------------------------------------------------------------------
378// Build libtest_versioned_lib.so with its dependencies.
379// -----------------------------------------------------------------------------
380// include $(LOCAL_PATH)/Android.build.versioned_lib.mk
381
382// -----------------------------------------------------------------------------
383// Build libraries needed by pthread_atfork tests
384// -----------------------------------------------------------------------------
385// include $(LOCAL_PATH)/Android.build.pthread_atfork.mk
386
387// -----------------------------------------------------------------------------
388// Library with dependency loop used by dlfcn tests
389//
390// libtest_with_dependency_loop -> a -> b -> c -> a
391// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700392cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700393 name: "libtest_with_dependency_loop",
394 defaults: ["bionic_testlib_defaults"],
395 srcs: ["dlopen_testlib_loopy_root.cpp"],
396 shared_libs: ["libtest_with_dependency_loop_a"],
397}
398
399// -----------------------------------------------------------------------------
400// libtest_with_dependency_loop_a.so
401// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700402cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700403 name: "libtest_with_dependency_loop_a",
404 defaults: ["bionic_testlib_defaults"],
405 srcs: ["dlopen_testlib_loopy_a.cpp"],
406 shared_libs: ["libtest_with_dependency_loop_b_tmp"],
407}
408
409// -----------------------------------------------------------------------------
410// libtest_with_dependency_loop_b.so
411//
412// this is temporary placeholder - will be removed
413// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700414cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700415 name: "libtest_with_dependency_loop_b_tmp",
416 defaults: ["bionic_testlib_defaults"],
417 srcs: ["dlopen_testlib_loopy_invalid.cpp"],
418 ldflags: ["-Wl,-soname=libtest_with_dependency_loop_b.so"],
419}
420
421// -----------------------------------------------------------------------------
422// libtest_with_dependency_loop_b.so
423// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700424cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700425 name: "libtest_with_dependency_loop_b",
426 defaults: ["bionic_testlib_defaults"],
427 srcs: ["dlopen_testlib_loopy_b.cpp"],
428 shared_libs: ["libtest_with_dependency_loop_c"],
429}
430
431// -----------------------------------------------------------------------------
432// libtest_with_dependency_loop_c.so
433// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700434cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700435 name: "libtest_with_dependency_loop_c",
436 defaults: ["bionic_testlib_defaults"],
437 srcs: ["dlopen_testlib_loopy_c.cpp"],
438 shared_libs: ["libtest_with_dependency_loop_a"],
439}
440
441// -----------------------------------------------------------------------------
442// libtest_relo_check_dt_needed_order.so
443// |
444// +-> libtest_relo_check_dt_needed_order_1.so
445// |
446// +-> libtest_relo_check_dt_needed_order_2.so
447// -----------------------------------------------------------------------------
448
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700449cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700450 name: "libtest_relo_check_dt_needed_order",
451 defaults: ["bionic_testlib_defaults"],
452 srcs: ["dlopen_testlib_relo_check_dt_needed_order.cpp"],
453 shared_libs: [
454 "libtest_relo_check_dt_needed_order_1",
455 "libtest_relo_check_dt_needed_order_2",
456 ],
457}
458
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700459cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700460 name: "libtest_relo_check_dt_needed_order_1",
461 defaults: ["bionic_testlib_defaults"],
462 srcs: ["dlopen_testlib_relo_check_dt_needed_order_1.cpp"],
463}
464
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700465cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700466 name: "libtest_relo_check_dt_needed_order_2",
467 defaults: ["bionic_testlib_defaults"],
468 srcs: ["dlopen_testlib_relo_check_dt_needed_order_2.cpp"],
469}
470
471// -----------------------------------------------------------------------------
472// Library with dependency used by dlfcn tests
473// -----------------------------------------------------------------------------
474// In Android.mk to support dependency on libdlext_test
475
476// -----------------------------------------------------------------------------
477// Library used by ifunc tests
478// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700479cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700480 name: "libtest_ifunc",
481 defaults: ["bionic_testlib_defaults"],
Dimitry Ivanov21975b22017-05-02 16:31:56 -0700482 srcs: ["dlopen_testlib_ifunc.cpp"],
Colin Cross2722ebb2016-07-11 16:20:06 -0700483
Colin Cross2722ebb2016-07-11 16:20:06 -0700484 arch: {
485 mips: {
486 enabled: false,
487 },
488 mips64: {
489 enabled: false,
490 },
491 },
Dimitry Ivanov21975b22017-05-02 16:31:56 -0700492}
493
494cc_test_library {
495 name: "libtest_ifunc_variable",
496 defaults: ["bionic_testlib_defaults"],
497 srcs: ["dlopen_testlib_ifunc_variable.cpp"],
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800498 shared_libs: ["libtest_ifunc_variable_impl"],
Dimitry Ivanov21975b22017-05-02 16:31:56 -0700499
500 arch: {
501 mips: {
502 enabled: false,
503 },
504 mips64: {
505 enabled: false,
506 },
507 },
Dimitry Ivanov21975b22017-05-02 16:31:56 -0700508}
509
510cc_test_library {
511 name: "libtest_ifunc_variable_impl",
512 defaults: ["bionic_testlib_defaults"],
513 srcs: ["dlopen_testlib_ifunc_variable_impl.cpp"],
514
515 arch: {
516 mips: {
517 enabled: false,
518 },
519 mips64: {
520 enabled: false,
521 },
522 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700523}
524
525// -----------------------------------------------------------------------------
526// Library used by atexit tests
527// -----------------------------------------------------------------------------
528
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700529cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700530 name: "libtest_atexit",
531 defaults: ["bionic_testlib_defaults"],
532 srcs: ["atexit_testlib.cpp"],
533}
534
535// -----------------------------------------------------------------------------
536// This library is used by dl_load test to check symbol preempting
537// by main executable
538// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700539cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700540 name: "libdl_preempt_test_1",
541 defaults: ["bionic_testlib_defaults"],
542 srcs: ["dl_preempt_library_1.cpp"],
543}
544
545// -----------------------------------------------------------------------------
546// This library is used by dl_load test to check symbol preempting
547// by libdl_preempt_test_1.so
548// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700549cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700550 name: "libdl_preempt_test_2",
551 defaults: ["bionic_testlib_defaults"],
552 srcs: ["dl_preempt_library_2.cpp"],
553}
554
555// -----------------------------------------------------------------------------
556// Library with DF_1_GLOBAL
557// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700558cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700559 name: "libdl_test_df_1_global",
560 defaults: ["bionic_testlib_defaults"],
561 srcs: ["dl_df_1_global.cpp"],
562 ldflags: ["-Wl,-z,global"],
563
564 target: {
565 host: {
566 // TODO (dimitry): host ld.gold does not yet support -z global
567 // remove this line once it is updated.
568 ldflags: ["-fuse-ld=bfd"],
569 },
570 },
571}
572
573// -----------------------------------------------------------------------------
574// Library using symbol from libdl_test_df_1_global
575// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700576cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700577 name: "libtest_dlsym_df_1_global",
578 defaults: ["bionic_testlib_defaults"],
579 srcs: ["dl_df_1_use_global.cpp"],
580}
581
582// -----------------------------------------------------------------------------
Jiyong Park01162f22017-10-16 15:31:09 +0900583// Library with DF_1_GLOBAL which will be dlopened
584// (note: libdl_test_df_1_global above will be included in DT_NEEDED)
585// -----------------------------------------------------------------------------
586cc_test_library {
587 name: "libtest_dlopen_df_1_global",
588 defaults: ["bionic_testlib_defaults"],
589 srcs: ["dl_df_1_global_dummy.cpp"],
590 ldflags: ["-Wl,-z,global"],
591
592 target: {
593 host: {
594 // TODO (dimitry): host ld.gold does not yet support -z global
595 // remove this line once it is updated.
596 ldflags: ["-fuse-ld=bfd"],
597 },
598 },
599}
600
Jiyong Park01162f22017-10-16 15:31:09 +0900601// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -0700602// Library with weak function
603// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700604cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700605 name: "libtest_dlsym_weak_func",
606 defaults: ["bionic_testlib_defaults"],
607 srcs: ["dlsym_weak_function.cpp"],
608}
609
610// -----------------------------------------------------------------------------
611// Library to check RTLD_LOCAL with dlsym in 'this'
612// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700613cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700614 name: "libtest_dlsym_from_this",
615 defaults: ["bionic_testlib_defaults"],
616 srcs: ["dlsym_from_this_symbol.cpp"],
617 shared_libs: ["libtest_dlsym_from_this_child"],
Colin Cross2722ebb2016-07-11 16:20:06 -0700618}
619
620// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700621cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700622 name: "libtest_dlsym_from_this_child",
623 defaults: ["bionic_testlib_defaults"],
624 srcs: ["dlsym_from_this_functions.cpp"],
625 shared_libs: ["libtest_dlsym_from_this_grandchild"],
626}
627
628// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700629cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700630 name: "libtest_dlsym_from_this_grandchild",
631 defaults: ["bionic_testlib_defaults"],
632 srcs: ["dlsym_from_this_symbol2.cpp"],
633}
634
635// -----------------------------------------------------------------------------
636// Empty library
637// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700638cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700639 name: "libtest_empty",
640 defaults: ["bionic_testlib_defaults"],
641 srcs: ["empty.cpp"],
642}
643
644// -----------------------------------------------------------------------------
dimitry8db36a52017-10-23 15:10:10 +0200645// Library for inaccessible shared library test
646// -----------------------------------------------------------------------------
647cc_test_library {
648 name: "libtestshared",
649 defaults: ["bionic_testlib_defaults"],
650 srcs: ["empty.cpp"],
Nan Zhangdab0fd52017-11-07 11:05:24 -0800651 relative_install_path: "bionic-loader-test-libs/inaccessible_libs",
dimitry8db36a52017-10-23 15:10:10 +0200652}
653
654// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -0700655// Library with weak undefined function
656// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700657cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700658 name: "libtest_dlopen_weak_undefined_func",
659 defaults: ["bionic_testlib_defaults"],
660 srcs: ["dlopen_weak_undefined.cpp"],
661}
662
663// -----------------------------------------------------------------------------
Dimitry Ivanovd0b5c3a2016-11-25 12:23:11 -0800664// Check that RTLD_NEXT of a libc symbol works in dlopened library
665// -----------------------------------------------------------------------------
666cc_test_library {
667 name: "libtest_check_rtld_next_from_library",
668 defaults: ["bionic_testlib_defaults"],
669 srcs: ["check_rtld_next_from_library.cpp"],
Dimitry Ivanovd0b5c3a2016-11-25 12:23:11 -0800670}
671
672// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -0700673// Library with constructor that calls dlopen() b/7941716
674// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700675cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700676 name: "libtest_dlopen_from_ctor",
677 defaults: ["bionic_testlib_defaults"],
678 srcs: ["dlopen_testlib_dlopen_from_ctor.cpp"],
Colin Cross2722ebb2016-07-11 16:20:06 -0700679}
680
681// -----------------------------------------------------------------------------
Dimitry Ivanovec90e242017-02-10 11:04:20 -0800682// Libraries used to check init/fini call order
Dimitry Ivanovea8f3962017-02-09 13:31:57 -0800683// -----------------------------------------------------------------------------
684cc_test_library {
685 name: "libtest_init_fini_order_root",
686 defaults: ["bionic_testlib_defaults"],
687 srcs: ["dlopen_check_init_fini_root.cpp"],
Dimitry Ivanovec90e242017-02-10 11:04:20 -0800688 shared_libs: [
689 "libtest_init_fini_order_child",
690 "libtest_init_fini_order_grand_child",
691 ],
692}
693
694cc_test_library {
695 name: "libtest_init_fini_order_root2",
696 defaults: ["bionic_testlib_defaults"],
697 srcs: ["dlopen_check_init_fini_root.cpp"],
698 shared_libs: [
699 "libtest_init_fini_order_grand_child",
700 "libtest_init_fini_order_child",
701 ],
Dimitry Ivanovea8f3962017-02-09 13:31:57 -0800702}
703
704cc_test_library {
705 name: "libtest_init_fini_order_child",
706 defaults: ["bionic_testlib_defaults"],
707 srcs: ["dlopen_check_init_fini_child.cpp"],
708 shared_libs: ["libtest_init_fini_order_grand_child"],
709}
710
711cc_test_library {
712 name: "libtest_init_fini_order_grand_child",
713 defaults: ["bionic_testlib_defaults"],
714 srcs: ["dlopen_check_init_fini_grand_child.cpp"],
715}
716
717// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -0700718// Library that depends on the library with constructor that calls dlopen() b/7941716
719// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700720cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700721 name: "libtest_dlopen_from_ctor_main",
722 defaults: ["bionic_testlib_defaults"],
723 srcs: ["empty.cpp"],
724 shared_libs: ["libtest_dlopen_from_ctor"],
725}
726
727// -----------------------------------------------------------------------------
dimitry55547db2018-05-25 14:17:37 +0200728// Libraries with non-trivial thread_local variable to test dlclose()
dimitry06016f22018-01-05 11:39:28 +0100729// -----------------------------------------------------------------------------
730cc_test_library {
731 name: "libtest_thread_local_dtor",
732 defaults: ["bionic_testlib_defaults"],
733 srcs: ["thread_local_dtor.cpp"],
734}
735
dimitry55547db2018-05-25 14:17:37 +0200736cc_test_library {
737 name: "libtest_thread_local_dtor2",
738 defaults: ["bionic_testlib_defaults"],
739 srcs: ["thread_local_dtor2.cpp"],
740}
741
742// -----------------------------------------------------------------------------
743// Library dt_needs libtest_thread_local_dtor/2 (to check no-unload on load_group)
744// -----------------------------------------------------------------------------
745cc_test_library {
746 name: "libtest_indirect_thread_local_dtor",
747 defaults: ["bionic_testlib_defaults"],
748 srcs: ["empty.cpp"],
749 shared_libs: [
750 "libtest_thread_local_dtor",
751 "libtest_thread_local_dtor2",
752 ],
753}
754
755
dimitry06016f22018-01-05 11:39:28 +0100756// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -0700757// Tool to use to align the shared libraries in a zip file.
758// -----------------------------------------------------------------------------
759cc_binary_host {
760 name: "bionic_tests_zipalign",
761 srcs: ["bionic_tests_zipalign.cpp"],
762 cflags: [
763 "-Wall",
764 "-Werror",
765 ],
766
767 static_libs: [
768 "libziparchive",
769 "liblog",
770 "libbase",
771 "libz",
772 "libutils",
773 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700774}
Evgenii Stepanov0a3637d2016-07-06 13:20:59 -0700775
776cc_test_library {
777 name: "libcfi-test",
778 defaults: ["bionic_testlib_defaults"],
779 srcs: ["cfi_test_lib.cpp"],
780 sanitize: {
781 cfi: false,
782 },
783}
784
785cc_test_library {
786 name: "libcfi-test-bad",
787 defaults: ["bionic_testlib_defaults"],
788 srcs: ["cfi_test_bad_lib.cpp"],
789 sanitize: {
790 cfi: false,
791 },
792}
Evgenii Stepanov68ecec12017-01-31 13:19:30 -0800793
794cc_test {
795 name: "cfi_test_helper",
796 host_supported: false,
797 defaults: ["bionic_testlib_defaults"],
798 srcs: ["cfi_test_helper.cpp"],
799 ldflags: ["-rdynamic"],
800}
801
802cc_test {
803 name: "cfi_test_helper2",
804 host_supported: false,
805 defaults: ["bionic_testlib_defaults"],
806 srcs: ["cfi_test_helper2.cpp"],
807 shared_libs: ["libcfi-test"],
808 ldflags: ["-Wl,--rpath,${ORIGIN}/.."],
809}
Elliott Hugheseb04ed52017-03-29 13:48:02 -0700810
811cc_test {
812 name: "preinit_getauxval_test_helper",
813 host_supported: false,
814 defaults: ["bionic_testlib_defaults"],
815 srcs: ["preinit_getauxval_test_helper.cpp"],
816}
817
818cc_test {
819 name: "preinit_syscall_test_helper",
820 host_supported: false,
821 defaults: ["bionic_testlib_defaults"],
822 srcs: ["preinit_syscall_test_helper.cpp"],
823}
Jiyong Park02586a22017-05-20 01:01:24 +0900824
825cc_test {
826 name: "ld_preload_test_helper",
827 host_supported: false,
828 defaults: ["bionic_testlib_defaults"],
829 srcs: ["ld_preload_test_helper.cpp"],
830 shared_libs: ["ld_preload_test_helper_lib1"],
831 ldflags: ["-Wl,--rpath,${ORIGIN}/.."],
832}
833
834cc_test_library {
835 name: "ld_preload_test_helper_lib1",
836 host_supported: false,
837 defaults: ["bionic_testlib_defaults"],
838 srcs: ["ld_preload_test_helper_lib1.cpp"],
839}
840
841cc_test_library {
842 name: "ld_preload_test_helper_lib2",
843 host_supported: false,
844 defaults: ["bionic_testlib_defaults"],
845 srcs: ["ld_preload_test_helper_lib2.cpp"],
846}
847
848cc_test {
849 name: "ld_config_test_helper",
850 host_supported: false,
851 defaults: ["bionic_testlib_defaults"],
852 srcs: ["ld_config_test_helper.cpp"],
853 shared_libs: ["ld_config_test_helper_lib1"],
854 ldflags: ["-Wl,--rpath,${ORIGIN}/.."],
855}
856
857cc_test_library {
858 name: "ld_config_test_helper_lib1",
859 host_supported: false,
860 defaults: ["bionic_testlib_defaults"],
861 srcs: ["ld_config_test_helper_lib1.cpp"],
862 shared_libs: ["ld_config_test_helper_lib2"],
Nan Zhangdab0fd52017-11-07 11:05:24 -0800863 relative_install_path: "bionic-loader-test-libs/ns2",
Jiyong Park02586a22017-05-20 01:01:24 +0900864}
865
866cc_test_library {
867 name: "ld_config_test_helper_lib2",
868 host_supported: false,
869 defaults: ["bionic_testlib_defaults"],
870 srcs: ["ld_config_test_helper_lib2.cpp"],
Nan Zhangdab0fd52017-11-07 11:05:24 -0800871 relative_install_path: "bionic-loader-test-libs/ns2",
Jiyong Park02586a22017-05-20 01:01:24 +0900872}
873
874cc_test_library {
875 name: "ld_config_test_helper_lib3",
876 host_supported: false,
877 defaults: ["bionic_testlib_defaults"],
878 srcs: ["ld_config_test_helper_lib3.cpp"],
879}
Ryan Prichard8f639a42018-10-01 23:10:05 -0700880
881cc_test {
882 name: "exec_linker_helper",
883 host_supported: false,
884 defaults: ["bionic_testlib_defaults"],
885 srcs: ["exec_linker_helper.cpp"],
886 shared_libs: ["exec_linker_helper_lib"],
887 ldflags: ["-Wl,--rpath,${ORIGIN}/.."],
888}
889
890cc_test_library {
891 name: "exec_linker_helper_lib",
892 host_supported: false,
893 defaults: ["bionic_testlib_defaults"],
894 srcs: ["exec_linker_helper_lib.cpp"],
895}