blob: fabcd048e44f495d0b099386ce4069a028c168eb [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
Bob Badouraa7d8352021-02-19 13:06:22 -080017package {
18 default_applicable_licenses: ["bionic_tests_license"],
19}
20
Colin Cross2722ebb2016-07-11 16:20:06 -070021cc_defaults {
22 name: "bionic_testlib_defaults",
23 host_supported: true,
Chih-Hung Hsieh84f0dcd2017-10-02 11:47:31 -070024 cflags: [
25 "-Wall",
26 "-Werror",
27 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -070028 ldflags: [
Dimitry Ivanovd11d1e42016-10-05 02:51:17 -070029 "-Wl,--rpath,${ORIGIN}",
Dimitry Ivanova36e59b2016-09-01 11:37:39 -070030 "-Wl,--enable-new-dtags",
31 ],
32 relative_install_path: "bionic-loader-test-libs",
33 gtest: false,
Colin Cross2722ebb2016-07-11 16:20:06 -070034 sanitize: {
Evgenii Stepanov0a3637d2016-07-06 13:20:59 -070035 address: false,
Mitch Phillipsdfde0ee2019-05-01 14:26:13 -070036 fuzzer: false,
Colin Cross2722ebb2016-07-11 16:20:06 -070037 },
Yabin Cui1f553ea2017-01-13 12:31:59 -080038 stl: "libc++_static",
Colin Cross2722ebb2016-07-11 16:20:06 -070039 target: {
40 darwin: {
41 enabled: false,
42 },
43 },
44}
45
46// -----------------------------------------------------------------------------
Ryan Pricharde4ee12f2019-01-15 20:35:00 -080047// Libraries and helper binaries for ELF TLS
Elliott Hughes9724e932018-03-23 18:46:07 -070048// -----------------------------------------------------------------------------
49cc_test_library {
Ryan Pricharde4ee12f2019-01-15 20:35:00 -080050 name: "libtest_elftls_shared_var",
51 defaults: ["bionic_testlib_defaults"],
52 srcs: ["elftls_shared_var.cpp"],
53 cflags: ["-fno-emulated-tls"],
54}
55
56cc_test_library {
57 name: "libtest_elftls_shared_var_ie",
58 defaults: ["bionic_testlib_defaults"],
59 srcs: ["elftls_shared_var_ie.cpp"],
60 cflags: ["-fno-emulated-tls"],
61 shared_libs: ["libtest_elftls_shared_var"],
62}
63
64cc_test_library {
65 name: "libtest_elftls_tprel",
66 defaults: ["bionic_testlib_defaults"],
67 srcs: ["elftls_tprel.cpp"],
68 cflags: ["-fno-emulated-tls"],
69}
70
71cc_test {
72 name: "elftls_dlopen_ie_error_helper",
73 defaults: ["bionic_testlib_defaults"],
74 srcs: ["elftls_dlopen_ie_error_helper.cpp"],
75 ldflags: ["-Wl,--rpath,${ORIGIN}/.."],
76}
77
Ryan Prichard06d2d792019-01-23 23:19:19 -080078cc_test_library {
79 name: "libtest_elftls_dynamic",
80 defaults: ["bionic_testlib_defaults"],
81 srcs: ["elftls_dynamic.cpp"],
82 cflags: ["-fno-emulated-tls"],
83 shared_libs: ["libtest_elftls_shared_var"],
84}
85
Vy Nguyend5007512020-07-14 17:37:04 -040086cc_test {
Vy Nguyen19f84862020-09-23 21:43:31 -040087 name: "thread_exit_cb_helper",
Vy Nguyend5007512020-07-14 17:37:04 -040088 defaults: ["bionic_testlib_defaults"],
89 srcs: ["thread_exit_cb_helper.cpp"],
90 cflags: ["-fno-emulated-tls"],
91}
92
93cc_test {
94 name: "tls_properties_helper",
95 defaults: ["bionic_testlib_defaults"],
96 srcs: ["tls_properties_helper.cpp"],
97 cflags: ["-fno-emulated-tls"],
98 shared_libs: ["libtest_elftls_shared_var"],
99}
100
101
Ryan Prichard06d2d792019-01-23 23:19:19 -0800102cc_test_library {
103 name: "libtest_elftls_dynamic_filler_1",
104 defaults: ["bionic_testlib_defaults"],
105 srcs: ["elftls_dynamic_filler.cpp"],
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700106 cflags: [
107 "-fno-emulated-tls",
108 "-DTLS_FILLER=100",
109 ],
Ryan Prichard06d2d792019-01-23 23:19:19 -0800110}
111
112cc_test_library {
113 name: "libtest_elftls_dynamic_filler_2",
114 defaults: ["bionic_testlib_defaults"],
115 srcs: ["elftls_dynamic_filler.cpp"],
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700116 cflags: [
117 "-fno-emulated-tls",
118 "-DTLS_FILLER=200",
119 ],
Ryan Prichard06d2d792019-01-23 23:19:19 -0800120}
121
122cc_test_library {
123 name: "libtest_elftls_dynamic_filler_3",
124 defaults: ["bionic_testlib_defaults"],
125 srcs: ["elftls_dynamic_filler.cpp"],
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700126 cflags: [
127 "-fno-emulated-tls",
128 "-DTLS_FILLER=300",
129 ],
Ryan Prichard06d2d792019-01-23 23:19:19 -0800130}
131
Elliott Hughes9724e932018-03-23 18:46:07 -0700132// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -0700133// Library to test gnu-styled hash
134// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700135cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700136 name: "libgnu-hash-table-library",
137 defaults: ["bionic_testlib_defaults"],
138 srcs: ["dlext_test_library.cpp"],
139 ldflags: ["-Wl,--hash-style=gnu"],
Colin Cross2722ebb2016-07-11 16:20:06 -0700140}
141
142// -----------------------------------------------------------------------------
143// Library to test sysv-styled hash
144// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700145cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700146 name: "libsysv-hash-table-library",
147 defaults: ["bionic_testlib_defaults"],
148 srcs: ["dlext_test_library.cpp"],
149 ldflags: ["-Wl,--hash-style=sysv"],
150}
151
152// -----------------------------------------------------------------------------
153// Library used by dlext tests - with GNU RELRO program header
154// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700155cc_test_library {
156 name: "libdlext_test",
157 defaults: ["bionic_testlib_defaults"],
158 srcs: ["dlext_test_library.cpp"],
159 ldflags: ["-Wl,-z,relro"],
160 shared_libs: ["libtest_simple"],
161}
Colin Cross2722ebb2016-07-11 16:20:06 -0700162
163// -----------------------------------------------------------------------------
164// Library used by dlext tests - without GNU RELRO program header
165// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700166cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700167 name: "libdlext_test_norelro",
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700168 defaults: ["bionic_testlib_defaults"],
Colin Cross2722ebb2016-07-11 16:20:06 -0700169 srcs: ["dlext_test_library.cpp"],
170 ldflags: ["-Wl,-z,norelro"],
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800171 shared_libs: ["libtest_simple"],
Colin Cross2722ebb2016-07-11 16:20:06 -0700172}
173
174// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700175// Library used by dlext tests - recursive use of RELRO sharing
176// -----------------------------------------------------------------------------
177cc_test_library {
178 name: "libdlext_test_recursive",
179 defaults: ["bionic_testlib_defaults"],
180 srcs: ["dlext_test_recursive_library.cpp"],
181 ldflags: ["-Wl,-z,relro"],
182 shared_libs: ["libdlext_test"],
183}
184
185// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -0700186// Library used by dlext tests - different name non-default location
187// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700188cc_test_library {
189 name: "libdlext_test_fd",
190 defaults: ["bionic_testlib_defaults"],
191 host_supported: false,
192 srcs: ["dlext_test_library.cpp"],
193 ldflags: ["-Wl,--rpath,${ORIGIN}/.."],
194 relative_install_path: "bionic-loader-test-libs/libdlext_test_fd",
195 shared_libs: ["libtest_simple"],
196}
Colin Cross2722ebb2016-07-11 16:20:06 -0700197
198// -----------------------------------------------------------------------------
199// Libraries used by dlext tests for open from a zip-file
200// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700201cc_test_library {
202 name: "libdlext_test_zip",
203 defaults: ["bionic_testlib_defaults"],
204 host_supported: false,
205 srcs: ["dlext_test_library.cpp"],
206 shared_libs: ["libatest_simple_zip"],
207 relative_install_path: "bionic-loader-test-libs/libdlext_test_zip",
208}
209
210cc_test_library {
211 name: "libatest_simple_zip",
212 defaults: ["bionic_testlib_defaults"],
213 host_supported: false,
214 srcs: ["dlopen_testlib_simple.cpp"],
215 relative_install_path: "bionic-loader-test-libs/libatest_simple_zip",
216}
Colin Cross2722ebb2016-07-11 16:20:06 -0700217
218// ----------------------------------------------------------------------------
219// Library with soname which does not match filename
220// ----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700221cc_test_library {
222 name: "libdlext_test_different_soname",
223 defaults: ["bionic_testlib_defaults"],
224 srcs: ["dlext_test_library.cpp"],
225 ldflags: ["-Wl,-soname=libdlext_test_soname.so"],
226}
Colin Cross2722ebb2016-07-11 16:20:06 -0700227
228// -----------------------------------------------------------------------------
229// Library used by dlext tests - zipped and aligned
230// -----------------------------------------------------------------------------
231// In Android.mk to support zipped and aligned tests
232
233// -----------------------------------------------------------------------------
234// Library used by dlfcn tests
235// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700236cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700237 name: "libtest_simple",
238 defaults: ["bionic_testlib_defaults"],
239 srcs: ["dlopen_testlib_simple.cpp"],
240}
241
242// -----------------------------------------------------------------------------
dimitry965d06d2017-11-28 16:03:07 +0100243// Library used by dlext direct unload on the namespace boundary tests
244// -----------------------------------------------------------------------------
245cc_test_library {
246 name: "libtest_missing_symbol",
247 defaults: ["bionic_testlib_defaults"],
248 srcs: ["dlopen_testlib_missing_symbol.cpp"],
249 allow_undefined_symbols: true,
250 relative_install_path: "bionic-loader-test-libs/public_namespace_libs",
251}
252
dimitry965d06d2017-11-28 16:03:07 +0100253// -----------------------------------------------------------------------------
254// Library used by dlext indirect unload on the namespace boundary tests
255//
256// These libraries produce following dependency graph:
257// libtest_missing_symbol_root (private ns)
258// +-> libbnstest_public (public ns)
259// +-> libtest_missing_symbol_child_public (public ns)
260// +-> libnstest_public (public ns)
261// +-> libtest_missing_symbol_child_private (private_ns)
262// +-> libnstest_public (public_ns)
263//
264// All libraries except libtest_missing_symbol are located in
265// private_namespace_libs/
266// -----------------------------------------------------------------------------
267cc_test_library {
268 name: "libtest_missing_symbol_child_public",
269 defaults: ["bionic_testlib_defaults"],
270 srcs: ["empty.cpp"],
271 relative_install_path: "bionic-loader-test-libs/public_namespace_libs",
272 shared_libs: ["libnstest_public"],
273}
274
275cc_test_library {
276 name: "libtest_missing_symbol_child_private",
277 defaults: ["bionic_testlib_defaults"],
278 srcs: ["empty.cpp"],
279 relative_install_path: "bionic-loader-test-libs/private_namespace_libs",
280 shared_libs: ["libnstest_public"],
281}
282
283cc_test_library {
284 name: "libtest_missing_symbol_root",
285 defaults: ["bionic_testlib_defaults"],
286 srcs: ["dlopen_testlib_missing_symbol.cpp"],
287 relative_install_path: "bionic-loader-test-libs/private_namespace_libs",
288 allow_undefined_symbols: true,
289 shared_libs: [
290 "libnstest_public",
291 "libtest_missing_symbol_child_public",
292 "libtest_missing_symbol_child_private",
293 ],
294}
295
296// -----------------------------------------------------------------------------
297// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -0700298// Library used by dlfcn nodelete tests
299// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700300cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700301 name: "libtest_nodelete_1",
302 defaults: ["bionic_testlib_defaults"],
303 srcs: ["dlopen_nodelete_1.cpp"],
304}
305
306// -----------------------------------------------------------------------------
307// Library used by dlfcn nodelete tests
308// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700309cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700310 name: "libtest_nodelete_2",
311 defaults: ["bionic_testlib_defaults"],
312 srcs: ["dlopen_nodelete_2.cpp"],
313}
314
315// -----------------------------------------------------------------------------
316// Library used by dlfcn nodelete tests
317// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700318cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700319 name: "libtest_nodelete_dt_flags_1",
320 defaults: ["bionic_testlib_defaults"],
321 srcs: ["dlopen_nodelete_dt_flags_1.cpp"],
322 ldflags: ["-Wl,-z,nodelete"],
323}
324
325// -----------------------------------------------------------------------------
326// Build test helper libraries for linker namespaces
dimitry965d06d2017-11-28 16:03:07 +0100327//
328// This set of libraries is used to verify linker namespaces.
329//
330// Test cases
331// 1. Check that private libraries loaded in different namespaces are
332// different. Check that dlsym does not confuse them.
333// 2. Check that public libraries loaded in different namespaces are shared
334// between them.
335// 3. Check that namespace sticks on dlopen
336// 4. Check that having access to shared library (libnstest_public.so)
337// does not expose symbols from dependent library (libnstest_public_internal.so)
338//
339// Dependency tree (visibility)
340// libnstest_root.so (this should be local to the namespace)
341// +-> libnstest_public.so
342// +-> libnstest_public_internal.so
343// +-> libnstest_private.so
344//
345// libnstest_dlopened.so (library in private namespace dlopened from libnstest_root.so)
Colin Cross2722ebb2016-07-11 16:20:06 -0700346// -----------------------------------------------------------------------------
dimitry965d06d2017-11-28 16:03:07 +0100347cc_test_library {
348 name: "libnstest_root",
349 defaults: ["bionic_testlib_defaults"],
350 srcs: ["namespaces_root.cpp"],
351 relative_install_path: "bionic-loader-test-libs/private_namespace_libs",
352 shared_libs: [
353 "libnstest_public",
354 "libnstest_private",
355 ],
356}
357
358cc_test_library {
359 name: "libnstest_public_internal",
360 defaults: ["bionic_testlib_defaults"],
361 srcs: ["namespaces_public_internal.cpp"],
362 relative_install_path: "bionic-loader-test-libs/public_namespace_libs",
363}
364
365cc_test_library {
366 name: "libnstest_public",
367 defaults: ["bionic_testlib_defaults"],
368 srcs: ["namespaces_public.cpp"],
369 relative_install_path: "bionic-loader-test-libs/public_namespace_libs",
370 shared_libs: ["libnstest_public_internal"],
371}
372
373cc_test_library {
374 name: "libnstest_private",
375 defaults: ["bionic_testlib_defaults"],
376 srcs: ["namespaces_private.cpp"],
377 relative_install_path: "bionic-loader-test-libs/private_namespace_libs",
378}
379
380cc_test_library {
381 name: "libnstest_dlopened",
382 defaults: ["bionic_testlib_defaults"],
383 srcs: ["namespaces_dlopened.cpp"],
384 relative_install_path: "bionic-loader-test-libs/private_namespace_libs",
385}
Colin Cross2722ebb2016-07-11 16:20:06 -0700386
387// -----------------------------------------------------------------------------
Logan Chien9ee45912018-01-18 12:05:09 +0800388// Build test helper libraries for linker namespaces for allow all shared libs
389//
390// This set of libraries is used to verify linker namespaces for allow all
391// shared libs.
392//
393// Test cases
394// 1. Check that namespace a exposes libnstest_ns_a_public1 to
395// namespace b while keeping libnstest_ns_a_public1_internal as an
396// internal lib.
397// 2. Check that namespace b exposes all libraries to namespace a.
398//
399// Dependency tree (visibility)
400// libnstest_ns_b_public2.so (ns:b)
401// +-> libnstest_ns_a_public1.so (ns:a)
402// +-> libnstest_ns_a_public2_internal.so (ns:a)
403// +-> libnstest_ns_b_public3.so (ns:b)
404//
405// -----------------------------------------------------------------------------
406cc_test_library {
407 name: "libnstest_ns_a_public1",
408 defaults: ["bionic_testlib_defaults"],
409 srcs: ["libnstest_ns_a_public1.cpp"],
410 relative_install_path: "bionic-loader-test-libs/ns_a",
411 shared_libs: [
412 "libnstest_ns_a_public1_internal",
413 "libnstest_ns_b_public3",
414 ],
415}
416
417cc_test_library {
418 name: "libnstest_ns_a_public1_internal",
419 defaults: ["bionic_testlib_defaults"],
420 srcs: ["libnstest_ns_a_public1_internal.cpp"],
421 relative_install_path: "bionic-loader-test-libs/ns_a",
422}
423
424cc_test_library {
425 name: "libnstest_ns_b_public2",
426 defaults: ["bionic_testlib_defaults"],
427 srcs: ["libnstest_ns_b_public2.cpp"],
428 relative_install_path: "bionic-loader-test-libs/ns_b",
429 shared_libs: ["libnstest_ns_a_public1"],
430}
431
432cc_test_library {
433 name: "libnstest_ns_b_public3",
434 defaults: ["bionic_testlib_defaults"],
435 srcs: ["libnstest_ns_b_public3.cpp"],
436 relative_install_path: "bionic-loader-test-libs/ns_b",
437}
438
439// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700440// Build test helper libraries for linker namespaces
441//
442// This set of libraries is to test isolated namespaces
443//
444// Isolated namespaces do not allow loading of the library outside of
445// the search paths.
446//
447// This library cannot be loaded in isolated namespace because one of DT_NEEDED
448// libraries is outside of the search paths.
449//
450// libnstest_root_not_isolated.so (DT_RUNPATH = $ORIGIN/../private_namespace_libs_external/)
451// +-> libnstest_public.so
452// +-> libnstest_private_external.so (located in $ORIGIN/../private_namespace_libs_external/)
453//
454// Search path: $NATIVE_TESTS/private_namespace_libs/
455//
Colin Cross2722ebb2016-07-11 16:20:06 -0700456// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700457
458cc_test_library {
459 name: "libnstest_root_not_isolated",
460 defaults: ["bionic_testlib_defaults"],
461 host_supported: false,
462 srcs: ["namespaces_root.cpp"],
463 shared_libs: [
464 "libnstest_public",
465 "libnstest_private_external",
466 ],
467 relative_install_path: "bionic-loader-test-libs/private_namespace_libs",
468 ldflags: ["-Wl,--rpath,$ORIGIN/../private_namespace_libs_external"],
469}
470
471cc_test_library {
472 name: "libnstest_private_external",
473 defaults: ["bionic_testlib_defaults"],
474 host_supported: false,
475 srcs: ["namespaces_private.cpp"],
476 relative_install_path: "bionic-loader-test-libs/private_namespace_libs_external",
477}
478
479// -----------------------------------------------------------------------------
Ryan Prichard22fa3dd2020-01-31 14:47:48 -0800480// ns_hidden_child linker namespace test
481// -----------------------------------------------------------------------------
482
483cc_test {
484 name: "ns_hidden_child_helper",
485 host_supported: false,
486 defaults: ["bionic_testlib_defaults"],
487 srcs: ["ns_hidden_child_helper.cpp"],
488 shared_libs: [
489 "libns_hidden_child_internal",
490 "libns_hidden_child_global",
491 "libdl_android",
492 ],
493 ldflags: ["-Wl,--rpath,${ORIGIN}/.."],
494}
495
496cc_test_library {
497 name: "libns_hidden_child_global",
498 defaults: ["bionic_testlib_defaults"],
499 host_supported: false,
500 srcs: ["ns_hidden_child_global.cpp"],
501 shared_libs: ["libns_hidden_child_internal"],
502 ldflags: ["-Wl,-z,global"],
503}
504
505cc_test_library {
506 name: "libns_hidden_child_internal",
507 defaults: ["bionic_testlib_defaults"],
508 host_supported: false,
509 srcs: ["ns_hidden_child_internal.cpp"],
510}
511
512cc_test_library {
513 name: "libns_hidden_child_public",
514 defaults: ["bionic_testlib_defaults"],
515 host_supported: false,
516 srcs: ["ns_hidden_child_public.cpp"],
517 shared_libs: ["libns_hidden_child_internal"],
518}
519
520cc_test_library {
521 name: "libns_hidden_child_app",
522 defaults: ["bionic_testlib_defaults"],
523 host_supported: false,
524 srcs: ["ns_hidden_child_app.cpp"],
525 shared_libs: ["libns_hidden_child_public"],
526 relative_install_path: "bionic-loader-test-libs/ns_hidden_child_app",
527}
528
529// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700530// Build DT_RUNPATH test helper libraries
531//
532// Dependencies
533//
534// libtest_dt_runpath_d.so runpath: ${ORIGIN}/dt_runpath_b_c_x, ${ORIGIN}/dt_runpath_y/${LIB}
535// |-> dt_runpath_b_c_x/libtest_dt_runpath_b.so runpath: ${ORIGIN}/../dt_runpath_a
536// | |-> dt_runpath_a/libtest_dt_runpath_a.so
537// |-> dt_runpath_b_c_x/libtest_dt_runpath_c.so runpath: ${ORIGIN}/invalid_dt_runpath
538// | |-> libtest_dt_runpath_a.so (soname)
539// |-> dt_runpath_y/lib[64]/libtest_dt_runpath_y.so
540//
541// This one is used to test dlopen
542// dt_runpath_b_c_x/libtest_dt_runpath_x.so
543//
544// -----------------------------------------------------------------------------
545
546// A leaf library in a non-standard directory.
547cc_test_library {
548 name: "libtest_dt_runpath_a",
549 defaults: ["bionic_testlib_defaults"],
550 srcs: ["empty.cpp"],
551 relative_install_path: "bionic-loader-test-libs/dt_runpath_a",
552}
553
554// Depends on library A with a DT_RUNPATH
555cc_test_library {
556 name: "libtest_dt_runpath_b",
557 defaults: ["bionic_testlib_defaults"],
558 srcs: ["empty.cpp"],
559 shared_libs: ["libtest_dt_runpath_a"],
560 relative_install_path: "bionic-loader-test-libs/dt_runpath_b_c_x",
561 ldflags: ["-Wl,--rpath,${ORIGIN}/../dt_runpath_a"],
562}
563
564// Depends on library A with an incorrect DT_RUNPATH. This does not matter
565// because B is the first in the D (below) dependency order, and library A
566// is already loaded using the correct DT_RUNPATH from library B.
567cc_test_library {
568 name: "libtest_dt_runpath_c",
569 defaults: ["bionic_testlib_defaults"],
570 srcs: ["empty.cpp"],
571 shared_libs: ["libtest_dt_runpath_a"],
572 relative_install_path: "bionic-loader-test-libs/dt_runpath_b_c_x",
573 ldflags: ["-Wl,--rpath,${ORIGIN}/invalid_dt_runpath"],
574}
575
576// D depends on B, C, and Y with DT_RUNPATH.
577cc_test_library {
578 name: "libtest_dt_runpath_d",
579 defaults: ["bionic_testlib_defaults"],
580 srcs: ["dlopen_b.cpp"],
581 shared_libs: [
582 "libtest_dt_runpath_b",
583 "libtest_dt_runpath_c",
584 "libtest_dt_runpath_y",
585 ],
586 ldflags: [
587 "-Wl,--rpath,${ORIGIN}/dt_runpath_b_c_x",
588 "-Wl,--rpath,${ORIGIN}/dt_runpath_y/${LIB}",
589 ],
590}
591
592// D version for open-from-zip test with runpath
593cc_test_library {
594 name: "libtest_dt_runpath_d_zip",
595 srcs: ["dlopen_b.cpp"],
596 shared_libs: [
597 "libtest_dt_runpath_b",
598 "libtest_dt_runpath_c",
599 "libtest_dt_runpath_y",
600 ],
601 cflags: [
602 "-Wall",
603 "-Werror",
604 ],
605 gtest: false,
606 relative_install_path: "libtest_dt_runpath_d_zip",
607 ldflags: [
608 "-Wl,--rpath,${ORIGIN}/dt_runpath_b_c_x",
609 "-Wl,--rpath,${ORIGIN}/dt_runpath_y/${LIB}",
610 ],
611 sanitize: {
612 address: false,
613 fuzzer: false,
614 },
615 stl: "libc++_static",
616 target: {
617 darwin: {
618 enabled: false,
619 },
620 },
621}
622
623// A leaf library in a directory library D has DT_RUNPATH for.
624cc_test_library {
625 name: "libtest_dt_runpath_x",
626 defaults: ["bionic_testlib_defaults"],
627 srcs: ["empty.cpp"],
628 relative_install_path: "bionic-loader-test-libs/dt_runpath_b_c_x",
629}
630
631// A leaf library in lib or lib64 directory
632cc_test_library {
633 name: "libtest_dt_runpath_y",
634 defaults: ["bionic_testlib_defaults"],
635 srcs: ["empty.cpp"],
636
637 multilib: {
638 lib32: {
639 relative_install_path: "bionic-loader-test-libs/dt_runpath_y/lib",
640 },
641 lib64: {
642 relative_install_path: "bionic-loader-test-libs/dt_runpath_y/lib64",
643 },
644 },
645}
Colin Cross2722ebb2016-07-11 16:20:06 -0700646
647// -----------------------------------------------------------------------------
648// Build library with two parents
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700649//
650// Libraries used by dlfcn tests to verify local group ref_counting
651// libtest_two_parents*.so
Colin Cross2722ebb2016-07-11 16:20:06 -0700652// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700653
654// ..._child.so - correct answer
655cc_test_library {
656 name: "libtest_two_parents_child",
657 defaults: ["bionic_testlib_defaults"],
658 srcs: ["dlopen_2_parents_reloc_answer.cpp"],
659}
660
661// ..._parent1.so - correct answer
662cc_test_library {
663 name: "libtest_two_parents_parent1",
664 defaults: ["bionic_testlib_defaults"],
665 srcs: ["dlopen_check_order_reloc_answer_impl.cpp"],
666 shared_libs: ["libtest_two_parents_child"],
667 cflags: ["-D__ANSWER=42"],
668}
669
670// ..._parent2.so - incorrect answer
671cc_test_library {
672 name: "libtest_two_parents_parent2",
673 defaults: ["bionic_testlib_defaults"],
674 srcs: ["dlopen_check_order_reloc_answer_impl.cpp"],
675 shared_libs: ["libtest_two_parents_child"],
676 cflags: ["-D__ANSWER=1"],
677}
Colin Cross2722ebb2016-07-11 16:20:06 -0700678
679// -----------------------------------------------------------------------------
680// Build libtest_check_order_dlsym.so with its dependencies.
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700681//
682// Libraries used by dlfcn tests to verify correct load order:
Colin Cross2722ebb2016-07-11 16:20:06 -0700683// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700684
685// libtest_check_order_2_right.so
686cc_test_library {
687 name: "libtest_check_order_dlsym_2_right",
688 defaults: ["bionic_testlib_defaults"],
689 srcs: ["dlopen_check_order_dlsym_answer.cpp"],
690 cflags: ["-D__ANSWER=42"],
691}
692
693// libtest_check_order_a.so
694cc_test_library {
695 name: "libtest_check_order_dlsym_a",
696 defaults: ["bionic_testlib_defaults"],
697 srcs: ["dlopen_check_order_dlsym_answer.cpp"],
698 cflags: ["-D__ANSWER=1"],
699}
700
701// libtest_check_order_b.so
702cc_test_library {
703 name: "libtest_check_order_dlsym_b",
704 defaults: ["bionic_testlib_defaults"],
705 srcs: ["dlopen_check_order_dlsym_answer.cpp"],
706 cflags: [
707 "-D__ANSWER=2",
708 "-D__ANSWER2=43",
709 ],
710}
711
712// libtest_check_order_c.so
713cc_test_library {
714 name: "libtest_check_order_dlsym_3_c",
715 defaults: ["bionic_testlib_defaults"],
716 srcs: ["dlopen_check_order_dlsym_answer.cpp"],
717 cflags: ["-D__ANSWER=3"],
718}
719
720// libtest_check_order_d.so
721cc_test_library {
722 name: "libtest_check_order_dlsym_d",
723 defaults: ["bionic_testlib_defaults"],
724 shared_libs: ["libtest_check_order_dlsym_b"],
725 srcs: ["dlopen_check_order_dlsym_answer.cpp"],
726 cflags: [
727 "-D__ANSWER=4",
728 "-D__ANSWER2=4",
729 ],
730}
731
732// libtest_check_order_left.so
733cc_test_library {
734 name: "libtest_check_order_dlsym_1_left",
735 defaults: ["bionic_testlib_defaults"],
736 shared_libs: [
737 "libtest_check_order_dlsym_a",
738 "libtest_check_order_dlsym_b",
739 ],
740 srcs: ["empty.cpp"],
741}
742
743// libtest_check_order.so
744cc_test_library {
745 name: "libtest_check_order_dlsym",
746 defaults: ["bionic_testlib_defaults"],
747 shared_libs: [
748 "libtest_check_order_dlsym_1_left",
749 "libtest_check_order_dlsym_2_right",
750 "libtest_check_order_dlsym_3_c",
751 ],
752 srcs: ["empty.cpp"],
753}
Colin Cross2722ebb2016-07-11 16:20:06 -0700754
755// -----------------------------------------------------------------------------
756// Build libtest_check_order_siblings.so with its dependencies.
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700757//
758// Libraries used by dlfcn tests to verify correct relocation order:
759// libtest_check_order_reloc_siblings*.so
Colin Cross2722ebb2016-07-11 16:20:06 -0700760// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700761
762// ..._1.so - empty
763cc_test_library {
764 name: "libtest_check_order_reloc_siblings_1",
765 defaults: ["bionic_testlib_defaults"],
766 shared_libs: [
767 "libtest_check_order_reloc_siblings_a",
768 "libtest_check_order_reloc_siblings_b",
769 ],
770 srcs: ["empty.cpp"],
771}
772
773// ..._2.so - empty
774cc_test_library {
775 name: "libtest_check_order_reloc_siblings_2",
776 defaults: ["bionic_testlib_defaults"],
777 shared_libs: [
778 "libtest_check_order_reloc_siblings_c",
779 "libtest_check_order_reloc_siblings_d",
780 ],
781 srcs: [
782 "dlopen_check_order_reloc_grandchild_answer.cpp",
783 ],
784 allow_undefined_symbols: true,
785}
786
787// ..._3.so - get_answer2();
788cc_test_library {
789 name: "libtest_check_order_reloc_siblings_3",
790 defaults: ["bionic_testlib_defaults"],
791 shared_libs: [
792 "libtest_check_order_reloc_siblings_e",
793 "libtest_check_order_reloc_siblings_f",
794 ],
795 srcs: [
796 "dlopen_check_order_reloc_nephew_answer.cpp",
797 ],
798}
799
800// ..._a.so <- correct impl
801cc_test_library {
802 name: "libtest_check_order_reloc_siblings_a",
803 defaults: ["bionic_testlib_defaults"],
804 srcs: [
805 "dlopen_check_order_reloc_answer_impl.cpp",
806 ],
807 cflags: ["-D__ANSWER=42"],
808}
809
810// ..._b.so
811cc_test_library {
812 name: "libtest_check_order_reloc_siblings_b",
813 defaults: ["bionic_testlib_defaults"],
814 srcs: [
815 "dlopen_check_order_reloc_answer_impl.cpp",
816 ],
817 cflags: ["-D__ANSWER=1"],
818}
819
820// ..._c.so
821cc_test_library {
822 name: "libtest_check_order_reloc_siblings_c",
823 defaults: ["bionic_testlib_defaults"],
824 shared_libs: [
825 "libtest_check_order_reloc_siblings_c_1",
826 "libtest_check_order_reloc_siblings_c_2",
827 ],
828 srcs: [
829 "dlopen_check_order_reloc_answer_impl.cpp",
830 ],
831 cflags: ["-D__ANSWER=2"],
832}
833
834// ..._d.so
835cc_test_library {
836 name: "libtest_check_order_reloc_siblings_d",
837 defaults: ["bionic_testlib_defaults"],
838 srcs: [
839 "dlopen_check_order_reloc_answer_impl.cpp",
840 ],
841 cflags: ["-D__ANSWER=3"],
842}
843
844// ..._e.so
845cc_test_library {
846 name: "libtest_check_order_reloc_siblings_e",
847 defaults: ["bionic_testlib_defaults"],
848 srcs: [
849 "dlopen_check_order_reloc_answer_impl.cpp",
850 ],
851 cflags: [
852 "-D__ANSWER=4",
853 ],
854}
855
856// ..._f.so <- get_answer()
857cc_test_library {
858 name: "libtest_check_order_reloc_siblings_f",
859 defaults: ["bionic_testlib_defaults"],
860 srcs: [
861 "dlopen_check_order_reloc_answer.cpp",
862 ],
863}
864
865// ..._c_1.so
866cc_test_library {
867 name: "libtest_check_order_reloc_siblings_c_1",
868 defaults: ["bionic_testlib_defaults"],
869 srcs: [
870 "dlopen_check_order_reloc_grandchild_answer_impl.cpp",
871 ],
872 cflags: ["-D__ANSWER=42"],
873}
874
875// ..._c_2.so
876cc_test_library {
877 name: "libtest_check_order_reloc_siblings_c_2",
878 defaults: ["bionic_testlib_defaults"],
879 srcs: [
880 "dlopen_check_order_reloc_grandchild_answer_impl.cpp",
881 ],
882 cflags: ["-D__ANSWER=0"],
883}
884
885// libtest_check_order_reloc_siblings.so
886cc_test_library {
887 name: "libtest_check_order_reloc_siblings",
888 defaults: ["bionic_testlib_defaults"],
889 shared_libs: [
890 "libtest_check_order_reloc_siblings_1",
891 "libtest_check_order_reloc_siblings_2",
892 "libtest_check_order_reloc_siblings_3",
893 ],
894 srcs: [
895 "empty.cpp",
896 ],
897}
Colin Cross2722ebb2016-07-11 16:20:06 -0700898
899// -----------------------------------------------------------------------------
900// Build libtest_check_order_root.so with its dependencies.
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700901//
902// Libraries used by dlfcn tests to verify correct relocation order:
903// libtest_check_order_reloc_root*.so
Colin Cross2722ebb2016-07-11 16:20:06 -0700904// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700905
906// ..._1.so - empty
907cc_test_library {
908 name: "libtest_check_order_reloc_root_1",
909 defaults: ["bionic_testlib_defaults"],
910 srcs: ["empty.cpp"],
911}
912
913// ..._2.so - this one has the incorrect answer
914cc_test_library {
915 name: "libtest_check_order_reloc_root_2",
916 defaults: ["bionic_testlib_defaults"],
917 srcs: ["dlopen_check_order_reloc_root_answer_impl.cpp"],
918 cflags: ["-D__ANSWER=2"],
919}
920
921// libtest_check_order_reloc_root.so <- implements get_answer3()
922cc_test_library {
923 name: "libtest_check_order_reloc_root",
924 defaults: ["bionic_testlib_defaults"],
925 srcs: ["dlopen_check_order_reloc_root_answer.cpp"],
926 shared_libs: [
927 "libtest_check_order_reloc_root_1",
928 "libtest_check_order_reloc_root_2",
929 ],
930}
Colin Cross2722ebb2016-07-11 16:20:06 -0700931
932// -----------------------------------------------------------------------------
933// Build libtest_versioned_lib.so with its dependencies.
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700934//
935// Libraries used to test versioned symbols
Colin Cross2722ebb2016-07-11 16:20:06 -0700936// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700937
938cc_test_library {
939 name: "libtest_versioned_uselibv1",
940 defaults: ["bionic_testlib_defaults"],
941 srcs: ["versioned_uselib.cpp"],
942 shared_libs: ["libtest_versioned_libv1"],
943}
944
945cc_test_library {
946 name: "libtest_versioned_uselibv2",
947 defaults: ["bionic_testlib_defaults"],
948 srcs: ["versioned_uselib.cpp"],
949 shared_libs: ["libtest_versioned_libv2"],
950 version_script: "versioned_uselib.map",
951}
952
953cc_test_library {
954 name: "libtest_versioned_uselibv2_other",
955 defaults: ["bionic_testlib_defaults"],
956 srcs: ["versioned_uselib.cpp"],
957 shared_libs: [
958 "libtest_versioned_otherlib_empty",
959 "libtest_versioned_libv2",
960 ],
961}
962
963cc_test_library {
964 name: "libtest_versioned_uselibv3_other",
965 defaults: ["bionic_testlib_defaults"],
966 srcs: ["versioned_uselib.cpp"],
967 shared_libs: [
968 "libtest_versioned_otherlib_empty",
969 "libtest_versioned_lib",
970 ],
971}
972
973// lib v1 - this one used during static linking but never used at runtime
974// which forces libtest_versioned_uselibv1 to use function v1 from
975// libtest_versioned_lib.so
976cc_test_library {
977 name: "libtest_versioned_libv1",
978 defaults: ["bionic_testlib_defaults"],
979 srcs: ["versioned_lib_v1.cpp"],
980 version_script: "versioned_lib_v1.map",
981 ldflags: ["-Wl,-soname,libtest_versioned_lib.so"],
982}
983
984// lib v2 - to make libtest_versioned_uselibv2.so use version 2 of versioned_function()
985cc_test_library {
986 name: "libtest_versioned_libv2",
987 defaults: ["bionic_testlib_defaults"],
988 srcs: ["versioned_lib_v2.cpp"],
989 version_script: "versioned_lib_v2.map",
990 ldflags: ["-Wl,-soname,libtest_versioned_lib.so"],
991}
992
993// last version - this one is used at the runtime and exports 3 versions
994// of versioned_symbol().
995cc_test_library {
996 name: "libtest_versioned_lib",
997 defaults: ["bionic_testlib_defaults"],
998 srcs: ["versioned_lib_v3.cpp"],
999 version_script: "versioned_lib_v3.map",
1000}
1001
1002// This library is empty, the actual implementation will provide an unversioned
1003// symbol for versioned_function().
1004cc_test_library {
1005 name: "libtest_versioned_otherlib_empty",
1006 defaults: ["bionic_testlib_defaults"],
1007 srcs: ["empty.cpp"],
1008 ldflags: ["-Wl,-soname,libtest_versioned_otherlib.so"],
1009}
1010
1011cc_test_library {
1012 name: "libtest_versioned_otherlib",
1013 defaults: ["bionic_testlib_defaults"],
1014 srcs: ["versioned_lib_other.cpp"],
1015 version_script: "versioned_lib_other.map",
1016}
Colin Cross2722ebb2016-07-11 16:20:06 -07001017
1018// -----------------------------------------------------------------------------
1019// Build libraries needed by pthread_atfork tests
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -07001020
1021// This library used to test phtread_atfork handler behaviour
1022// during/after dlclose.
Colin Cross2722ebb2016-07-11 16:20:06 -07001023// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -07001024cc_test_library {
1025 name: "libtest_pthread_atfork",
1026 defaults: ["bionic_testlib_defaults"],
1027 srcs: ["pthread_atfork.cpp"],
1028}
Colin Cross2722ebb2016-07-11 16:20:06 -07001029
1030// -----------------------------------------------------------------------------
1031// Library with dependency loop used by dlfcn tests
1032//
1033// libtest_with_dependency_loop -> a -> b -> c -> a
1034// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001035cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001036 name: "libtest_with_dependency_loop",
1037 defaults: ["bionic_testlib_defaults"],
1038 srcs: ["dlopen_testlib_loopy_root.cpp"],
1039 shared_libs: ["libtest_with_dependency_loop_a"],
1040}
1041
1042// -----------------------------------------------------------------------------
1043// libtest_with_dependency_loop_a.so
1044// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001045cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001046 name: "libtest_with_dependency_loop_a",
1047 defaults: ["bionic_testlib_defaults"],
1048 srcs: ["dlopen_testlib_loopy_a.cpp"],
1049 shared_libs: ["libtest_with_dependency_loop_b_tmp"],
1050}
1051
1052// -----------------------------------------------------------------------------
1053// libtest_with_dependency_loop_b.so
1054//
1055// this is temporary placeholder - will be removed
1056// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001057cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001058 name: "libtest_with_dependency_loop_b_tmp",
1059 defaults: ["bionic_testlib_defaults"],
1060 srcs: ["dlopen_testlib_loopy_invalid.cpp"],
1061 ldflags: ["-Wl,-soname=libtest_with_dependency_loop_b.so"],
1062}
1063
1064// -----------------------------------------------------------------------------
1065// libtest_with_dependency_loop_b.so
1066// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001067cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001068 name: "libtest_with_dependency_loop_b",
1069 defaults: ["bionic_testlib_defaults"],
1070 srcs: ["dlopen_testlib_loopy_b.cpp"],
1071 shared_libs: ["libtest_with_dependency_loop_c"],
1072}
1073
1074// -----------------------------------------------------------------------------
1075// libtest_with_dependency_loop_c.so
1076// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001077cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001078 name: "libtest_with_dependency_loop_c",
1079 defaults: ["bionic_testlib_defaults"],
1080 srcs: ["dlopen_testlib_loopy_c.cpp"],
1081 shared_libs: ["libtest_with_dependency_loop_a"],
1082}
1083
1084// -----------------------------------------------------------------------------
1085// libtest_relo_check_dt_needed_order.so
1086// |
1087// +-> libtest_relo_check_dt_needed_order_1.so
1088// |
1089// +-> libtest_relo_check_dt_needed_order_2.so
1090// -----------------------------------------------------------------------------
1091
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001092cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001093 name: "libtest_relo_check_dt_needed_order",
1094 defaults: ["bionic_testlib_defaults"],
1095 srcs: ["dlopen_testlib_relo_check_dt_needed_order.cpp"],
1096 shared_libs: [
1097 "libtest_relo_check_dt_needed_order_1",
1098 "libtest_relo_check_dt_needed_order_2",
1099 ],
1100}
1101
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001102cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001103 name: "libtest_relo_check_dt_needed_order_1",
1104 defaults: ["bionic_testlib_defaults"],
1105 srcs: ["dlopen_testlib_relo_check_dt_needed_order_1.cpp"],
1106}
1107
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001108cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001109 name: "libtest_relo_check_dt_needed_order_2",
1110 defaults: ["bionic_testlib_defaults"],
1111 srcs: ["dlopen_testlib_relo_check_dt_needed_order_2.cpp"],
1112}
1113
1114// -----------------------------------------------------------------------------
1115// Library with dependency used by dlfcn tests
1116// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -07001117cc_test_library {
1118 name: "libtest_with_dependency",
1119 defaults: ["bionic_testlib_defaults"],
1120 srcs: ["dlopen_testlib_simple.cpp"],
1121 shared_libs: ["libdlext_test"],
1122}
Colin Cross2722ebb2016-07-11 16:20:06 -07001123
1124// -----------------------------------------------------------------------------
1125// Library used by ifunc tests
1126// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001127cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001128 name: "libtest_ifunc",
1129 defaults: ["bionic_testlib_defaults"],
Dimitry Ivanov21975b22017-05-02 16:31:56 -07001130 srcs: ["dlopen_testlib_ifunc.cpp"],
Dimitry Ivanov21975b22017-05-02 16:31:56 -07001131}
1132
1133cc_test_library {
1134 name: "libtest_ifunc_variable",
1135 defaults: ["bionic_testlib_defaults"],
1136 srcs: ["dlopen_testlib_ifunc_variable.cpp"],
Elliott Hughesd50a1de2018-02-05 17:30:57 -08001137 shared_libs: ["libtest_ifunc_variable_impl"],
Dimitry Ivanov21975b22017-05-02 16:31:56 -07001138}
1139
1140cc_test_library {
1141 name: "libtest_ifunc_variable_impl",
1142 defaults: ["bionic_testlib_defaults"],
1143 srcs: ["dlopen_testlib_ifunc_variable_impl.cpp"],
Colin Cross2722ebb2016-07-11 16:20:06 -07001144}
1145
1146// -----------------------------------------------------------------------------
1147// Library used by atexit tests
1148// -----------------------------------------------------------------------------
1149
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001150cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001151 name: "libtest_atexit",
1152 defaults: ["bionic_testlib_defaults"],
1153 srcs: ["atexit_testlib.cpp"],
1154}
1155
1156// -----------------------------------------------------------------------------
1157// This library is used by dl_load test to check symbol preempting
1158// by main executable
1159// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001160cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001161 name: "libdl_preempt_test_1",
1162 defaults: ["bionic_testlib_defaults"],
1163 srcs: ["dl_preempt_library_1.cpp"],
1164}
1165
1166// -----------------------------------------------------------------------------
1167// This library is used by dl_load test to check symbol preempting
1168// by libdl_preempt_test_1.so
1169// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001170cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001171 name: "libdl_preempt_test_2",
1172 defaults: ["bionic_testlib_defaults"],
1173 srcs: ["dl_preempt_library_2.cpp"],
1174}
1175
1176// -----------------------------------------------------------------------------
1177// Library with DF_1_GLOBAL
1178// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001179cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001180 name: "libdl_test_df_1_global",
1181 defaults: ["bionic_testlib_defaults"],
1182 srcs: ["dl_df_1_global.cpp"],
1183 ldflags: ["-Wl,-z,global"],
1184
1185 target: {
1186 host: {
1187 // TODO (dimitry): host ld.gold does not yet support -z global
1188 // remove this line once it is updated.
1189 ldflags: ["-fuse-ld=bfd"],
1190 },
1191 },
1192}
1193
1194// -----------------------------------------------------------------------------
1195// Library using symbol from libdl_test_df_1_global
1196// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001197cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001198 name: "libtest_dlsym_df_1_global",
1199 defaults: ["bionic_testlib_defaults"],
1200 srcs: ["dl_df_1_use_global.cpp"],
1201}
1202
1203// -----------------------------------------------------------------------------
Jiyong Park01162f22017-10-16 15:31:09 +09001204// Library with DF_1_GLOBAL which will be dlopened
1205// (note: libdl_test_df_1_global above will be included in DT_NEEDED)
1206// -----------------------------------------------------------------------------
1207cc_test_library {
1208 name: "libtest_dlopen_df_1_global",
1209 defaults: ["bionic_testlib_defaults"],
1210 srcs: ["dl_df_1_global_dummy.cpp"],
1211 ldflags: ["-Wl,-z,global"],
1212
1213 target: {
1214 host: {
1215 // TODO (dimitry): host ld.gold does not yet support -z global
1216 // remove this line once it is updated.
1217 ldflags: ["-fuse-ld=bfd"],
1218 },
1219 },
1220}
1221
Jiyong Park01162f22017-10-16 15:31:09 +09001222// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -07001223// Library with weak function
1224// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001225cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001226 name: "libtest_dlsym_weak_func",
1227 defaults: ["bionic_testlib_defaults"],
1228 srcs: ["dlsym_weak_function.cpp"],
1229}
1230
1231// -----------------------------------------------------------------------------
1232// Library to check RTLD_LOCAL with dlsym in 'this'
1233// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001234cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001235 name: "libtest_dlsym_from_this",
1236 defaults: ["bionic_testlib_defaults"],
1237 srcs: ["dlsym_from_this_symbol.cpp"],
1238 shared_libs: ["libtest_dlsym_from_this_child"],
Colin Cross2722ebb2016-07-11 16:20:06 -07001239}
1240
1241// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001242cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001243 name: "libtest_dlsym_from_this_child",
1244 defaults: ["bionic_testlib_defaults"],
1245 srcs: ["dlsym_from_this_functions.cpp"],
1246 shared_libs: ["libtest_dlsym_from_this_grandchild"],
1247}
1248
1249// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001250cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001251 name: "libtest_dlsym_from_this_grandchild",
1252 defaults: ["bionic_testlib_defaults"],
1253 srcs: ["dlsym_from_this_symbol2.cpp"],
1254}
1255
1256// -----------------------------------------------------------------------------
1257// Empty library
1258// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001259cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001260 name: "libtest_empty",
1261 defaults: ["bionic_testlib_defaults"],
1262 srcs: ["empty.cpp"],
1263}
1264
1265// -----------------------------------------------------------------------------
dimitry8db36a52017-10-23 15:10:10 +02001266// Library for inaccessible shared library test
1267// -----------------------------------------------------------------------------
1268cc_test_library {
1269 name: "libtestshared",
1270 defaults: ["bionic_testlib_defaults"],
1271 srcs: ["empty.cpp"],
Nan Zhangdab0fd52017-11-07 11:05:24 -08001272 relative_install_path: "bionic-loader-test-libs/inaccessible_libs",
dimitry8db36a52017-10-23 15:10:10 +02001273}
1274
1275// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -07001276// Library with weak undefined function
1277// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001278cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001279 name: "libtest_dlopen_weak_undefined_func",
1280 defaults: ["bionic_testlib_defaults"],
1281 srcs: ["dlopen_weak_undefined.cpp"],
1282}
1283
1284// -----------------------------------------------------------------------------
Dimitry Ivanovd0b5c3a2016-11-25 12:23:11 -08001285// Check that RTLD_NEXT of a libc symbol works in dlopened library
1286// -----------------------------------------------------------------------------
1287cc_test_library {
1288 name: "libtest_check_rtld_next_from_library",
1289 defaults: ["bionic_testlib_defaults"],
1290 srcs: ["check_rtld_next_from_library.cpp"],
Pirama Arumuga Nainar8035caa2020-06-09 12:48:10 -07001291 native_coverage: false,
Dimitry Ivanovd0b5c3a2016-11-25 12:23:11 -08001292}
1293
1294// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -07001295// Library with constructor that calls dlopen() b/7941716
1296// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001297cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001298 name: "libtest_dlopen_from_ctor",
1299 defaults: ["bionic_testlib_defaults"],
1300 srcs: ["dlopen_testlib_dlopen_from_ctor.cpp"],
Colin Cross2722ebb2016-07-11 16:20:06 -07001301}
1302
1303// -----------------------------------------------------------------------------
Dimitry Ivanovec90e242017-02-10 11:04:20 -08001304// Libraries used to check init/fini call order
Dimitry Ivanovea8f3962017-02-09 13:31:57 -08001305// -----------------------------------------------------------------------------
1306cc_test_library {
1307 name: "libtest_init_fini_order_root",
1308 defaults: ["bionic_testlib_defaults"],
1309 srcs: ["dlopen_check_init_fini_root.cpp"],
Dimitry Ivanovec90e242017-02-10 11:04:20 -08001310 shared_libs: [
1311 "libtest_init_fini_order_child",
1312 "libtest_init_fini_order_grand_child",
1313 ],
1314}
1315
1316cc_test_library {
1317 name: "libtest_init_fini_order_root2",
1318 defaults: ["bionic_testlib_defaults"],
1319 srcs: ["dlopen_check_init_fini_root.cpp"],
1320 shared_libs: [
1321 "libtest_init_fini_order_grand_child",
1322 "libtest_init_fini_order_child",
1323 ],
Dimitry Ivanovea8f3962017-02-09 13:31:57 -08001324}
1325
1326cc_test_library {
1327 name: "libtest_init_fini_order_child",
1328 defaults: ["bionic_testlib_defaults"],
1329 srcs: ["dlopen_check_init_fini_child.cpp"],
1330 shared_libs: ["libtest_init_fini_order_grand_child"],
1331}
1332
1333cc_test_library {
1334 name: "libtest_init_fini_order_grand_child",
1335 defaults: ["bionic_testlib_defaults"],
1336 srcs: ["dlopen_check_init_fini_grand_child.cpp"],
1337}
1338
1339// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -07001340// Library that depends on the library with constructor that calls dlopen() b/7941716
1341// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001342cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001343 name: "libtest_dlopen_from_ctor_main",
1344 defaults: ["bionic_testlib_defaults"],
1345 srcs: ["empty.cpp"],
1346 shared_libs: ["libtest_dlopen_from_ctor"],
1347}
1348
1349// -----------------------------------------------------------------------------
dimitry55547db2018-05-25 14:17:37 +02001350// Libraries with non-trivial thread_local variable to test dlclose()
dimitry06016f22018-01-05 11:39:28 +01001351// -----------------------------------------------------------------------------
1352cc_test_library {
1353 name: "libtest_thread_local_dtor",
1354 defaults: ["bionic_testlib_defaults"],
1355 srcs: ["thread_local_dtor.cpp"],
1356}
1357
dimitry55547db2018-05-25 14:17:37 +02001358cc_test_library {
1359 name: "libtest_thread_local_dtor2",
1360 defaults: ["bionic_testlib_defaults"],
1361 srcs: ["thread_local_dtor2.cpp"],
1362}
1363
1364// -----------------------------------------------------------------------------
1365// Library dt_needs libtest_thread_local_dtor/2 (to check no-unload on load_group)
1366// -----------------------------------------------------------------------------
1367cc_test_library {
1368 name: "libtest_indirect_thread_local_dtor",
1369 defaults: ["bionic_testlib_defaults"],
1370 srcs: ["empty.cpp"],
1371 shared_libs: [
1372 "libtest_thread_local_dtor",
1373 "libtest_thread_local_dtor2",
1374 ],
1375}
1376
dimitry06016f22018-01-05 11:39:28 +01001377// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -07001378// Tool to use to align the shared libraries in a zip file.
1379// -----------------------------------------------------------------------------
1380cc_binary_host {
1381 name: "bionic_tests_zipalign",
1382 srcs: ["bionic_tests_zipalign.cpp"],
1383 cflags: [
1384 "-Wall",
1385 "-Werror",
1386 ],
1387
1388 static_libs: [
1389 "libziparchive",
1390 "liblog",
1391 "libbase",
1392 "libz",
1393 "libutils",
1394 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001395}
Evgenii Stepanov0a3637d2016-07-06 13:20:59 -07001396
1397cc_test_library {
1398 name: "libcfi-test",
1399 defaults: ["bionic_testlib_defaults"],
1400 srcs: ["cfi_test_lib.cpp"],
1401 sanitize: {
1402 cfi: false,
1403 },
1404}
1405
1406cc_test_library {
1407 name: "libcfi-test-bad",
1408 defaults: ["bionic_testlib_defaults"],
1409 srcs: ["cfi_test_bad_lib.cpp"],
1410 sanitize: {
1411 cfi: false,
1412 },
1413}
Evgenii Stepanov68ecec12017-01-31 13:19:30 -08001414
1415cc_test {
1416 name: "cfi_test_helper",
1417 host_supported: false,
1418 defaults: ["bionic_testlib_defaults"],
1419 srcs: ["cfi_test_helper.cpp"],
1420 ldflags: ["-rdynamic"],
1421}
1422
1423cc_test {
1424 name: "cfi_test_helper2",
1425 host_supported: false,
1426 defaults: ["bionic_testlib_defaults"],
1427 srcs: ["cfi_test_helper2.cpp"],
1428 shared_libs: ["libcfi-test"],
1429 ldflags: ["-Wl,--rpath,${ORIGIN}/.."],
1430}
Elliott Hugheseb04ed52017-03-29 13:48:02 -07001431
1432cc_test {
1433 name: "preinit_getauxval_test_helper",
1434 host_supported: false,
1435 defaults: ["bionic_testlib_defaults"],
1436 srcs: ["preinit_getauxval_test_helper.cpp"],
1437}
1438
1439cc_test {
1440 name: "preinit_syscall_test_helper",
1441 host_supported: false,
1442 defaults: ["bionic_testlib_defaults"],
1443 srcs: ["preinit_syscall_test_helper.cpp"],
1444}
Jiyong Park02586a22017-05-20 01:01:24 +09001445
1446cc_test {
1447 name: "ld_preload_test_helper",
1448 host_supported: false,
1449 defaults: ["bionic_testlib_defaults"],
1450 srcs: ["ld_preload_test_helper.cpp"],
1451 shared_libs: ["ld_preload_test_helper_lib1"],
1452 ldflags: ["-Wl,--rpath,${ORIGIN}/.."],
1453}
1454
1455cc_test_library {
1456 name: "ld_preload_test_helper_lib1",
1457 host_supported: false,
1458 defaults: ["bionic_testlib_defaults"],
1459 srcs: ["ld_preload_test_helper_lib1.cpp"],
1460}
1461
1462cc_test_library {
1463 name: "ld_preload_test_helper_lib2",
1464 host_supported: false,
1465 defaults: ["bionic_testlib_defaults"],
1466 srcs: ["ld_preload_test_helper_lib2.cpp"],
1467}
1468
1469cc_test {
1470 name: "ld_config_test_helper",
1471 host_supported: false,
1472 defaults: ["bionic_testlib_defaults"],
1473 srcs: ["ld_config_test_helper.cpp"],
1474 shared_libs: ["ld_config_test_helper_lib1"],
1475 ldflags: ["-Wl,--rpath,${ORIGIN}/.."],
1476}
1477
1478cc_test_library {
1479 name: "ld_config_test_helper_lib1",
1480 host_supported: false,
1481 defaults: ["bionic_testlib_defaults"],
1482 srcs: ["ld_config_test_helper_lib1.cpp"],
1483 shared_libs: ["ld_config_test_helper_lib2"],
Nan Zhangdab0fd52017-11-07 11:05:24 -08001484 relative_install_path: "bionic-loader-test-libs/ns2",
Ryan Prichard058eb8f2020-12-17 22:59:04 -08001485 // Mark the library DF_1_GLOBAL so it is added to every linker namespace.
1486 ldflags: ["-Wl,-z,global"]
Jiyong Park02586a22017-05-20 01:01:24 +09001487}
1488
1489cc_test_library {
1490 name: "ld_config_test_helper_lib2",
1491 host_supported: false,
1492 defaults: ["bionic_testlib_defaults"],
1493 srcs: ["ld_config_test_helper_lib2.cpp"],
Nan Zhangdab0fd52017-11-07 11:05:24 -08001494 relative_install_path: "bionic-loader-test-libs/ns2",
Jiyong Park02586a22017-05-20 01:01:24 +09001495}
1496
1497cc_test_library {
1498 name: "ld_config_test_helper_lib3",
1499 host_supported: false,
1500 defaults: ["bionic_testlib_defaults"],
1501 srcs: ["ld_config_test_helper_lib3.cpp"],
1502}
Ryan Prichard8f639a42018-10-01 23:10:05 -07001503
1504cc_test {
1505 name: "exec_linker_helper",
1506 host_supported: false,
1507 defaults: ["bionic_testlib_defaults"],
1508 srcs: ["exec_linker_helper.cpp"],
1509 shared_libs: ["exec_linker_helper_lib"],
1510 ldflags: ["-Wl,--rpath,${ORIGIN}/.."],
1511}
1512
1513cc_test_library {
1514 name: "exec_linker_helper_lib",
1515 host_supported: false,
1516 defaults: ["bionic_testlib_defaults"],
1517 srcs: ["exec_linker_helper_lib.cpp"],
1518}
Peter Collingbourneb39cb3c2019-03-01 13:12:49 -08001519
1520cc_test_library {
1521 name: "libsegment_gap_outer",
1522 host_supported: false,
1523 defaults: ["bionic_testlib_defaults"],
1524 srcs: ["segment_gap_outer.cpp"],
1525 ldflags: ["-Wl,-T,bionic/tests/libs/segment_gap_outer.lds"],
1526}
1527
1528cc_test_library {
1529 name: "libsegment_gap_inner",
1530 host_supported: false,
1531 defaults: ["bionic_testlib_defaults"],
1532 srcs: ["segment_gap_inner.cpp"],
1533}
Elliott Hughes6663f552020-01-24 14:36:10 -08001534
1535
1536// -----------------------------------------------------------------------------
Elliott Hughes6dd1f582020-01-28 12:18:35 -08001537// Check that we support all kinds of relocations: regular, "relocation packer",
1538// and both the old and new SHT_RELR constants.
Elliott Hughes6663f552020-01-24 14:36:10 -08001539// -----------------------------------------------------------------------------
1540
Elliott Hughes6dd1f582020-01-28 12:18:35 -08001541// This is what got standardized for SHT_RELR.
Elliott Hughes6663f552020-01-24 14:36:10 -08001542cc_test_library {
Elliott Hughes6dd1f582020-01-28 12:18:35 -08001543 name: "librelocations-RELR",
1544 ldflags: [
1545 "-Wl,--pack-dyn-relocs=relr",
1546 "-Wl,--no-use-android-relr-tags",
1547 ],
Elliott Hughes6663f552020-01-24 14:36:10 -08001548 host_supported: false,
1549 defaults: ["bionic_testlib_defaults"],
Elliott Hughes6dd1f582020-01-28 12:18:35 -08001550 srcs: ["relocations.cpp"],
1551
Elliott Hughes6663f552020-01-24 14:36:10 -08001552 // Hack to ensure we're using llvm-objcopy because our binutils prebuilt
1553 // only supports the old numbers (http://b/141010852).
1554 strip: {
1555 keep_symbols: true,
1556 },
1557}
1558
Elliott Hughes6dd1f582020-01-28 12:18:35 -08001559// This is the same encoding as SHT_RELR, but using OS-specific constants.
Elliott Hughes6663f552020-01-24 14:36:10 -08001560cc_test_library {
Elliott Hughes6dd1f582020-01-28 12:18:35 -08001561 name: "librelocations-ANDROID_RELR",
1562 ldflags: [
1563 "-Wl,--pack-dyn-relocs=relr",
1564 "-Wl,--use-android-relr-tags",
1565 ],
Elliott Hughes6663f552020-01-24 14:36:10 -08001566 host_supported: false,
1567 defaults: ["bionic_testlib_defaults"],
Elliott Hughes6dd1f582020-01-28 12:18:35 -08001568 srcs: ["relocations.cpp"],
1569}
1570
1571// This is the old relocation packer encoding (DT_ANDROID_REL/DT_ANDROID_RELA).
1572cc_test_library {
1573 name: "librelocations-ANDROID_REL",
1574 ldflags: ["-Wl,--pack-dyn-relocs=android"],
1575 host_supported: false,
1576 defaults: ["bionic_testlib_defaults"],
1577 srcs: ["relocations.cpp"],
1578}
1579
1580// This is not packed at all.
1581cc_test_library {
1582 name: "librelocations-fat",
1583 ldflags: ["-Wl,--pack-dyn-relocs=none"],
1584 host_supported: false,
1585 defaults: ["bionic_testlib_defaults"],
1586 srcs: ["relocations.cpp"],
Elliott Hughes6663f552020-01-24 14:36:10 -08001587}
Evgenii Stepanov51741fb2021-01-06 16:03:15 -08001588
1589cc_defaults {
1590 name: "bionic_targets_only",
1591 enabled: false,
1592 target: {
1593 android: {
1594 enabled: true,
1595 },
1596 linux_bionic: {
1597 enabled: true,
1598 },
1599 },
1600}
1601
1602cc_test {
1603 name: "heap_tagging_sync_helper",
1604 defaults: ["bionic_testlib_defaults", "bionic_targets_only"],
1605 srcs: ["heap_tagging_helper.cpp"],
1606 sanitize: {
1607 memtag_heap: true,
1608 diag: {
1609 memtag_heap: true,
1610 },
1611 },
1612}
1613
1614cc_test {
1615 name: "heap_tagging_async_helper",
1616 defaults: ["bionic_testlib_defaults", "bionic_targets_only"],
1617 srcs: ["heap_tagging_helper.cpp"],
1618 sanitize: {
1619 memtag_heap: true,
1620 diag: {
1621 memtag_heap: false,
1622 },
1623 },
1624}
1625
1626cc_test {
1627 name: "heap_tagging_disabled_helper",
1628 defaults: ["bionic_testlib_defaults", "bionic_targets_only"],
1629 srcs: ["heap_tagging_helper.cpp"],
1630 sanitize: {
1631 memtag_heap: false,
1632 },
1633}
1634
1635cc_test {
1636 name: "heap_tagging_static_sync_helper",
1637 defaults: ["bionic_testlib_defaults", "bionic_targets_only"],
1638 srcs: ["heap_tagging_helper.cpp"],
1639 static_executable: true,
1640 sanitize: {
1641 memtag_heap: true,
1642 diag: {
1643 memtag_heap: true,
1644 },
1645 },
1646}
1647
1648cc_test {
1649 name: "heap_tagging_static_async_helper",
1650 defaults: ["bionic_testlib_defaults", "bionic_targets_only"],
1651 srcs: ["heap_tagging_helper.cpp"],
1652 static_executable: true,
1653 sanitize: {
1654 memtag_heap: true,
1655 diag: {
1656 memtag_heap: false,
1657 },
1658 },
1659}
1660
1661cc_test {
1662 name: "heap_tagging_static_disabled_helper",
1663 defaults: ["bionic_testlib_defaults", "bionic_targets_only"],
1664 srcs: ["heap_tagging_helper.cpp"],
1665 static_executable: true,
1666 sanitize: {
1667 memtag_heap: false,
1668 },
1669}