blob: 89e9b5d59d30bf481eabc485639a3d9a4f8eaf8a [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 ],
Evgenii Stepanovd957e962023-11-28 15:14:39 -080032 static_libs: ["libbase"],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -070033 relative_install_path: "bionic-loader-test-libs",
34 gtest: false,
Colin Cross2722ebb2016-07-11 16:20:06 -070035 sanitize: {
Evgenii Stepanov0a3637d2016-07-06 13:20:59 -070036 address: 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 },
Florian Mayer37b4a152022-10-03 14:29:16 -070044 strip: {
45 none: true,
46 },
Colin Cross2722ebb2016-07-11 16:20:06 -070047}
48
49// -----------------------------------------------------------------------------
Ryan Pricharde4ee12f2019-01-15 20:35:00 -080050// Libraries and helper binaries for ELF TLS
Elliott Hughes9724e932018-03-23 18:46:07 -070051// -----------------------------------------------------------------------------
52cc_test_library {
Ryan Pricharde4ee12f2019-01-15 20:35:00 -080053 name: "libtest_elftls_shared_var",
54 defaults: ["bionic_testlib_defaults"],
55 srcs: ["elftls_shared_var.cpp"],
Ryan Pricharde4ee12f2019-01-15 20:35:00 -080056}
57
58cc_test_library {
59 name: "libtest_elftls_shared_var_ie",
60 defaults: ["bionic_testlib_defaults"],
61 srcs: ["elftls_shared_var_ie.cpp"],
Ryan Pricharde4ee12f2019-01-15 20:35:00 -080062 shared_libs: ["libtest_elftls_shared_var"],
63}
64
65cc_test_library {
66 name: "libtest_elftls_tprel",
67 defaults: ["bionic_testlib_defaults"],
68 srcs: ["elftls_tprel.cpp"],
Ryan Pricharde4ee12f2019-01-15 20:35:00 -080069}
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"],
Ryan Prichard06d2d792019-01-23 23:19:19 -080082 shared_libs: ["libtest_elftls_shared_var"],
83}
84
Vy Nguyend5007512020-07-14 17:37:04 -040085cc_test {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +000086 name: "thread_exit_cb_helper",
87 defaults: ["bionic_testlib_defaults"],
88 srcs: ["thread_exit_cb_helper.cpp"],
Vy Nguyend5007512020-07-14 17:37:04 -040089}
90
91cc_test {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +000092 name: "tls_properties_helper",
93 defaults: ["bionic_testlib_defaults"],
94 srcs: ["tls_properties_helper.cpp"],
95 shared_libs: ["libtest_elftls_shared_var"],
Vy Nguyend5007512020-07-14 17:37:04 -040096}
97
Ryan Prichard06d2d792019-01-23 23:19:19 -080098cc_test_library {
99 name: "libtest_elftls_dynamic_filler_1",
100 defaults: ["bionic_testlib_defaults"],
101 srcs: ["elftls_dynamic_filler.cpp"],
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700102 cflags: [
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700103 "-DTLS_FILLER=100",
104 ],
Ryan Prichard06d2d792019-01-23 23:19:19 -0800105}
106
107cc_test_library {
108 name: "libtest_elftls_dynamic_filler_2",
109 defaults: ["bionic_testlib_defaults"],
110 srcs: ["elftls_dynamic_filler.cpp"],
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700111 cflags: [
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700112 "-DTLS_FILLER=200",
113 ],
Ryan Prichard06d2d792019-01-23 23:19:19 -0800114}
115
116cc_test_library {
117 name: "libtest_elftls_dynamic_filler_3",
118 defaults: ["bionic_testlib_defaults"],
119 srcs: ["elftls_dynamic_filler.cpp"],
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700120 cflags: [
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700121 "-DTLS_FILLER=300",
122 ],
Ryan Prichard06d2d792019-01-23 23:19:19 -0800123}
124
Elliott Hughes9724e932018-03-23 18:46:07 -0700125// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -0700126// Library to test gnu-styled hash
127// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700128cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700129 name: "libgnu-hash-table-library",
130 defaults: ["bionic_testlib_defaults"],
131 srcs: ["dlext_test_library.cpp"],
132 ldflags: ["-Wl,--hash-style=gnu"],
Colin Cross2722ebb2016-07-11 16:20:06 -0700133}
134
135// -----------------------------------------------------------------------------
136// Library to test sysv-styled hash
137// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700138cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700139 name: "libsysv-hash-table-library",
140 defaults: ["bionic_testlib_defaults"],
141 srcs: ["dlext_test_library.cpp"],
142 ldflags: ["-Wl,--hash-style=sysv"],
143}
144
145// -----------------------------------------------------------------------------
146// Library used by dlext tests - with GNU RELRO program header
147// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700148cc_test_library {
149 name: "libdlext_test",
150 defaults: ["bionic_testlib_defaults"],
151 srcs: ["dlext_test_library.cpp"],
152 ldflags: ["-Wl,-z,relro"],
153 shared_libs: ["libtest_simple"],
154}
Colin Cross2722ebb2016-07-11 16:20:06 -0700155
156// -----------------------------------------------------------------------------
157// Library used by dlext tests - without GNU RELRO program header
158// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700159cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700160 name: "libdlext_test_norelro",
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700161 defaults: ["bionic_testlib_defaults"],
Colin Cross2722ebb2016-07-11 16:20:06 -0700162 srcs: ["dlext_test_library.cpp"],
163 ldflags: ["-Wl,-z,norelro"],
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800164 shared_libs: ["libtest_simple"],
Colin Cross2722ebb2016-07-11 16:20:06 -0700165}
166
167// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700168// Library used by dlext tests - recursive use of RELRO sharing
169// -----------------------------------------------------------------------------
170cc_test_library {
171 name: "libdlext_test_recursive",
172 defaults: ["bionic_testlib_defaults"],
173 srcs: ["dlext_test_recursive_library.cpp"],
174 ldflags: ["-Wl,-z,relro"],
175 shared_libs: ["libdlext_test"],
176}
177
178// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -0700179// Library used by dlext tests - different name non-default location
180// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700181cc_test_library {
182 name: "libdlext_test_fd",
183 defaults: ["bionic_testlib_defaults"],
184 host_supported: false,
185 srcs: ["dlext_test_library.cpp"],
186 ldflags: ["-Wl,--rpath,${ORIGIN}/.."],
187 relative_install_path: "bionic-loader-test-libs/libdlext_test_fd",
188 shared_libs: ["libtest_simple"],
189}
Colin Cross2722ebb2016-07-11 16:20:06 -0700190
191// -----------------------------------------------------------------------------
192// Libraries used by dlext tests for open from a zip-file
193// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700194cc_test_library {
195 name: "libdlext_test_zip",
196 defaults: ["bionic_testlib_defaults"],
197 host_supported: false,
198 srcs: ["dlext_test_library.cpp"],
199 shared_libs: ["libatest_simple_zip"],
200 relative_install_path: "bionic-loader-test-libs/libdlext_test_zip",
201}
202
203cc_test_library {
204 name: "libatest_simple_zip",
205 defaults: ["bionic_testlib_defaults"],
206 host_supported: false,
207 srcs: ["dlopen_testlib_simple.cpp"],
208 relative_install_path: "bionic-loader-test-libs/libatest_simple_zip",
209}
Colin Cross2722ebb2016-07-11 16:20:06 -0700210
211// ----------------------------------------------------------------------------
212// Library with soname which does not match filename
213// ----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700214cc_test_library {
215 name: "libdlext_test_different_soname",
216 defaults: ["bionic_testlib_defaults"],
217 srcs: ["dlext_test_library.cpp"],
218 ldflags: ["-Wl,-soname=libdlext_test_soname.so"],
219}
Colin Cross2722ebb2016-07-11 16:20:06 -0700220
221// -----------------------------------------------------------------------------
222// Library used by dlext tests - zipped and aligned
223// -----------------------------------------------------------------------------
224// In Android.mk to support zipped and aligned tests
225
226// -----------------------------------------------------------------------------
227// Library used by dlfcn tests
228// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700229cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700230 name: "libtest_simple",
231 defaults: ["bionic_testlib_defaults"],
232 srcs: ["dlopen_testlib_simple.cpp"],
233}
234
235// -----------------------------------------------------------------------------
Florian Mayerc10d0642023-03-22 16:12:49 -0700236// Libraries used by hwasan_test
237// -----------------------------------------------------------------------------
238cc_test_library {
239 name: "libtest_simple_hwasan",
240 arch: {
241 arm64: {
242 enabled: true,
243 },
244 },
245 sanitize: {
246 hwaddress: true,
247 },
248 relative_install_path: "hwasan",
249 enabled: false,
250 srcs: ["dlopen_testlib_simple_hwasan.cpp"],
251}
252
253cc_test_library {
254 // A weird name. This is the vanilla (non-HWASan) copy of the library that
255 // is used for the hwasan test.
256 name: "libtest_simple_hwasan_nohwasan",
257 arch: {
258 arm64: {
259 enabled: true,
260 },
261 },
262 stem: "libtest_simple_hwasan",
263 enabled: false,
264 srcs: ["dlopen_testlib_simple_hwasan.cpp"],
265}
266
267// -----------------------------------------------------------------------------
dimitry965d06d2017-11-28 16:03:07 +0100268// Library used by dlext direct unload on the namespace boundary tests
269// -----------------------------------------------------------------------------
270cc_test_library {
271 name: "libtest_missing_symbol",
272 defaults: ["bionic_testlib_defaults"],
273 srcs: ["dlopen_testlib_missing_symbol.cpp"],
274 allow_undefined_symbols: true,
275 relative_install_path: "bionic-loader-test-libs/public_namespace_libs",
276}
277
dimitry965d06d2017-11-28 16:03:07 +0100278// -----------------------------------------------------------------------------
279// Library used by dlext indirect unload on the namespace boundary tests
280//
281// These libraries produce following dependency graph:
282// libtest_missing_symbol_root (private ns)
283// +-> libbnstest_public (public ns)
284// +-> libtest_missing_symbol_child_public (public ns)
285// +-> libnstest_public (public ns)
286// +-> libtest_missing_symbol_child_private (private_ns)
287// +-> libnstest_public (public_ns)
288//
289// All libraries except libtest_missing_symbol are located in
290// private_namespace_libs/
291// -----------------------------------------------------------------------------
292cc_test_library {
293 name: "libtest_missing_symbol_child_public",
294 defaults: ["bionic_testlib_defaults"],
295 srcs: ["empty.cpp"],
296 relative_install_path: "bionic-loader-test-libs/public_namespace_libs",
297 shared_libs: ["libnstest_public"],
298}
299
300cc_test_library {
301 name: "libtest_missing_symbol_child_private",
302 defaults: ["bionic_testlib_defaults"],
303 srcs: ["empty.cpp"],
304 relative_install_path: "bionic-loader-test-libs/private_namespace_libs",
305 shared_libs: ["libnstest_public"],
306}
307
308cc_test_library {
309 name: "libtest_missing_symbol_root",
310 defaults: ["bionic_testlib_defaults"],
311 srcs: ["dlopen_testlib_missing_symbol.cpp"],
312 relative_install_path: "bionic-loader-test-libs/private_namespace_libs",
313 allow_undefined_symbols: true,
314 shared_libs: [
315 "libnstest_public",
316 "libtest_missing_symbol_child_public",
317 "libtest_missing_symbol_child_private",
318 ],
319}
320
321// -----------------------------------------------------------------------------
322// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -0700323// Library used by dlfcn nodelete tests
324// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700325cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700326 name: "libtest_nodelete_1",
327 defaults: ["bionic_testlib_defaults"],
328 srcs: ["dlopen_nodelete_1.cpp"],
329}
330
331// -----------------------------------------------------------------------------
332// Library used by dlfcn nodelete tests
333// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700334cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700335 name: "libtest_nodelete_2",
336 defaults: ["bionic_testlib_defaults"],
337 srcs: ["dlopen_nodelete_2.cpp"],
338}
339
340// -----------------------------------------------------------------------------
341// Library used by dlfcn nodelete tests
342// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700343cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700344 name: "libtest_nodelete_dt_flags_1",
345 defaults: ["bionic_testlib_defaults"],
346 srcs: ["dlopen_nodelete_dt_flags_1.cpp"],
347 ldflags: ["-Wl,-z,nodelete"],
348}
349
350// -----------------------------------------------------------------------------
351// Build test helper libraries for linker namespaces
dimitry965d06d2017-11-28 16:03:07 +0100352//
353// This set of libraries is used to verify linker namespaces.
354//
355// Test cases
356// 1. Check that private libraries loaded in different namespaces are
357// different. Check that dlsym does not confuse them.
358// 2. Check that public libraries loaded in different namespaces are shared
359// between them.
360// 3. Check that namespace sticks on dlopen
361// 4. Check that having access to shared library (libnstest_public.so)
362// does not expose symbols from dependent library (libnstest_public_internal.so)
363//
364// Dependency tree (visibility)
365// libnstest_root.so (this should be local to the namespace)
366// +-> libnstest_public.so
367// +-> libnstest_public_internal.so
368// +-> libnstest_private.so
369//
370// libnstest_dlopened.so (library in private namespace dlopened from libnstest_root.so)
Colin Cross2722ebb2016-07-11 16:20:06 -0700371// -----------------------------------------------------------------------------
dimitry965d06d2017-11-28 16:03:07 +0100372cc_test_library {
373 name: "libnstest_root",
374 defaults: ["bionic_testlib_defaults"],
375 srcs: ["namespaces_root.cpp"],
376 relative_install_path: "bionic-loader-test-libs/private_namespace_libs",
377 shared_libs: [
378 "libnstest_public",
379 "libnstest_private",
380 ],
381}
382
383cc_test_library {
384 name: "libnstest_public_internal",
385 defaults: ["bionic_testlib_defaults"],
386 srcs: ["namespaces_public_internal.cpp"],
387 relative_install_path: "bionic-loader-test-libs/public_namespace_libs",
388}
389
390cc_test_library {
391 name: "libnstest_public",
392 defaults: ["bionic_testlib_defaults"],
393 srcs: ["namespaces_public.cpp"],
394 relative_install_path: "bionic-loader-test-libs/public_namespace_libs",
395 shared_libs: ["libnstest_public_internal"],
396}
397
398cc_test_library {
399 name: "libnstest_private",
400 defaults: ["bionic_testlib_defaults"],
401 srcs: ["namespaces_private.cpp"],
402 relative_install_path: "bionic-loader-test-libs/private_namespace_libs",
403}
404
405cc_test_library {
406 name: "libnstest_dlopened",
407 defaults: ["bionic_testlib_defaults"],
408 srcs: ["namespaces_dlopened.cpp"],
409 relative_install_path: "bionic-loader-test-libs/private_namespace_libs",
410}
Colin Cross2722ebb2016-07-11 16:20:06 -0700411
412// -----------------------------------------------------------------------------
Logan Chien9ee45912018-01-18 12:05:09 +0800413// Build test helper libraries for linker namespaces for allow all shared libs
414//
415// This set of libraries is used to verify linker namespaces for allow all
416// shared libs.
417//
418// Test cases
419// 1. Check that namespace a exposes libnstest_ns_a_public1 to
420// namespace b while keeping libnstest_ns_a_public1_internal as an
421// internal lib.
422// 2. Check that namespace b exposes all libraries to namespace a.
423//
424// Dependency tree (visibility)
425// libnstest_ns_b_public2.so (ns:b)
426// +-> libnstest_ns_a_public1.so (ns:a)
427// +-> libnstest_ns_a_public2_internal.so (ns:a)
428// +-> libnstest_ns_b_public3.so (ns:b)
429//
430// -----------------------------------------------------------------------------
431cc_test_library {
432 name: "libnstest_ns_a_public1",
433 defaults: ["bionic_testlib_defaults"],
434 srcs: ["libnstest_ns_a_public1.cpp"],
435 relative_install_path: "bionic-loader-test-libs/ns_a",
436 shared_libs: [
437 "libnstest_ns_a_public1_internal",
438 "libnstest_ns_b_public3",
439 ],
440}
441
442cc_test_library {
443 name: "libnstest_ns_a_public1_internal",
444 defaults: ["bionic_testlib_defaults"],
445 srcs: ["libnstest_ns_a_public1_internal.cpp"],
446 relative_install_path: "bionic-loader-test-libs/ns_a",
447}
448
449cc_test_library {
450 name: "libnstest_ns_b_public2",
451 defaults: ["bionic_testlib_defaults"],
452 srcs: ["libnstest_ns_b_public2.cpp"],
453 relative_install_path: "bionic-loader-test-libs/ns_b",
454 shared_libs: ["libnstest_ns_a_public1"],
455}
456
457cc_test_library {
458 name: "libnstest_ns_b_public3",
459 defaults: ["bionic_testlib_defaults"],
460 srcs: ["libnstest_ns_b_public3.cpp"],
461 relative_install_path: "bionic-loader-test-libs/ns_b",
462}
463
464// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700465// Build test helper libraries for linker namespaces
466//
467// This set of libraries is to test isolated namespaces
468//
469// Isolated namespaces do not allow loading of the library outside of
470// the search paths.
471//
472// This library cannot be loaded in isolated namespace because one of DT_NEEDED
473// libraries is outside of the search paths.
474//
475// libnstest_root_not_isolated.so (DT_RUNPATH = $ORIGIN/../private_namespace_libs_external/)
476// +-> libnstest_public.so
477// +-> libnstest_private_external.so (located in $ORIGIN/../private_namespace_libs_external/)
478//
479// Search path: $NATIVE_TESTS/private_namespace_libs/
480//
Colin Cross2722ebb2016-07-11 16:20:06 -0700481// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700482
483cc_test_library {
484 name: "libnstest_root_not_isolated",
485 defaults: ["bionic_testlib_defaults"],
486 host_supported: false,
487 srcs: ["namespaces_root.cpp"],
488 shared_libs: [
489 "libnstest_public",
490 "libnstest_private_external",
491 ],
492 relative_install_path: "bionic-loader-test-libs/private_namespace_libs",
493 ldflags: ["-Wl,--rpath,$ORIGIN/../private_namespace_libs_external"],
494}
495
496cc_test_library {
497 name: "libnstest_private_external",
498 defaults: ["bionic_testlib_defaults"],
499 host_supported: false,
500 srcs: ["namespaces_private.cpp"],
501 relative_install_path: "bionic-loader-test-libs/private_namespace_libs_external",
502}
503
504// -----------------------------------------------------------------------------
Ryan Prichard22fa3dd2020-01-31 14:47:48 -0800505// ns_hidden_child linker namespace test
506// -----------------------------------------------------------------------------
507
508cc_test {
509 name: "ns_hidden_child_helper",
510 host_supported: false,
511 defaults: ["bionic_testlib_defaults"],
512 srcs: ["ns_hidden_child_helper.cpp"],
513 shared_libs: [
514 "libns_hidden_child_internal",
515 "libns_hidden_child_global",
516 "libdl_android",
517 ],
518 ldflags: ["-Wl,--rpath,${ORIGIN}/.."],
519}
520
521cc_test_library {
522 name: "libns_hidden_child_global",
523 defaults: ["bionic_testlib_defaults"],
524 host_supported: false,
525 srcs: ["ns_hidden_child_global.cpp"],
526 shared_libs: ["libns_hidden_child_internal"],
527 ldflags: ["-Wl,-z,global"],
528}
529
530cc_test_library {
531 name: "libns_hidden_child_internal",
532 defaults: ["bionic_testlib_defaults"],
533 host_supported: false,
534 srcs: ["ns_hidden_child_internal.cpp"],
535}
536
537cc_test_library {
538 name: "libns_hidden_child_public",
539 defaults: ["bionic_testlib_defaults"],
540 host_supported: false,
541 srcs: ["ns_hidden_child_public.cpp"],
542 shared_libs: ["libns_hidden_child_internal"],
543}
544
545cc_test_library {
546 name: "libns_hidden_child_app",
547 defaults: ["bionic_testlib_defaults"],
548 host_supported: false,
549 srcs: ["ns_hidden_child_app.cpp"],
550 shared_libs: ["libns_hidden_child_public"],
551 relative_install_path: "bionic-loader-test-libs/ns_hidden_child_app",
552}
553
554// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700555// Build DT_RUNPATH test helper libraries
556//
557// Dependencies
558//
559// libtest_dt_runpath_d.so runpath: ${ORIGIN}/dt_runpath_b_c_x, ${ORIGIN}/dt_runpath_y/${LIB}
560// |-> dt_runpath_b_c_x/libtest_dt_runpath_b.so runpath: ${ORIGIN}/../dt_runpath_a
561// | |-> dt_runpath_a/libtest_dt_runpath_a.so
562// |-> dt_runpath_b_c_x/libtest_dt_runpath_c.so runpath: ${ORIGIN}/invalid_dt_runpath
563// | |-> libtest_dt_runpath_a.so (soname)
564// |-> dt_runpath_y/lib[64]/libtest_dt_runpath_y.so
565//
566// This one is used to test dlopen
567// dt_runpath_b_c_x/libtest_dt_runpath_x.so
568//
569// -----------------------------------------------------------------------------
570
571// A leaf library in a non-standard directory.
572cc_test_library {
573 name: "libtest_dt_runpath_a",
574 defaults: ["bionic_testlib_defaults"],
575 srcs: ["empty.cpp"],
576 relative_install_path: "bionic-loader-test-libs/dt_runpath_a",
577}
578
579// Depends on library A with a DT_RUNPATH
580cc_test_library {
581 name: "libtest_dt_runpath_b",
582 defaults: ["bionic_testlib_defaults"],
583 srcs: ["empty.cpp"],
584 shared_libs: ["libtest_dt_runpath_a"],
585 relative_install_path: "bionic-loader-test-libs/dt_runpath_b_c_x",
586 ldflags: ["-Wl,--rpath,${ORIGIN}/../dt_runpath_a"],
587}
588
589// Depends on library A with an incorrect DT_RUNPATH. This does not matter
590// because B is the first in the D (below) dependency order, and library A
591// is already loaded using the correct DT_RUNPATH from library B.
592cc_test_library {
593 name: "libtest_dt_runpath_c",
594 defaults: ["bionic_testlib_defaults"],
595 srcs: ["empty.cpp"],
596 shared_libs: ["libtest_dt_runpath_a"],
597 relative_install_path: "bionic-loader-test-libs/dt_runpath_b_c_x",
598 ldflags: ["-Wl,--rpath,${ORIGIN}/invalid_dt_runpath"],
599}
600
601// D depends on B, C, and Y with DT_RUNPATH.
602cc_test_library {
603 name: "libtest_dt_runpath_d",
604 defaults: ["bionic_testlib_defaults"],
605 srcs: ["dlopen_b.cpp"],
606 shared_libs: [
607 "libtest_dt_runpath_b",
608 "libtest_dt_runpath_c",
609 "libtest_dt_runpath_y",
610 ],
611 ldflags: [
612 "-Wl,--rpath,${ORIGIN}/dt_runpath_b_c_x",
613 "-Wl,--rpath,${ORIGIN}/dt_runpath_y/${LIB}",
614 ],
615}
616
617// D version for open-from-zip test with runpath
618cc_test_library {
619 name: "libtest_dt_runpath_d_zip",
620 srcs: ["dlopen_b.cpp"],
621 shared_libs: [
622 "libtest_dt_runpath_b",
623 "libtest_dt_runpath_c",
624 "libtest_dt_runpath_y",
625 ],
626 cflags: [
627 "-Wall",
628 "-Werror",
629 ],
630 gtest: false,
631 relative_install_path: "libtest_dt_runpath_d_zip",
632 ldflags: [
633 "-Wl,--rpath,${ORIGIN}/dt_runpath_b_c_x",
634 "-Wl,--rpath,${ORIGIN}/dt_runpath_y/${LIB}",
635 ],
636 sanitize: {
637 address: false,
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700638 },
639 stl: "libc++_static",
640 target: {
641 darwin: {
642 enabled: false,
643 },
644 },
645}
646
647// A leaf library in a directory library D has DT_RUNPATH for.
648cc_test_library {
649 name: "libtest_dt_runpath_x",
650 defaults: ["bionic_testlib_defaults"],
651 srcs: ["empty.cpp"],
652 relative_install_path: "bionic-loader-test-libs/dt_runpath_b_c_x",
653}
654
655// A leaf library in lib or lib64 directory
656cc_test_library {
657 name: "libtest_dt_runpath_y",
658 defaults: ["bionic_testlib_defaults"],
659 srcs: ["empty.cpp"],
660
661 multilib: {
662 lib32: {
663 relative_install_path: "bionic-loader-test-libs/dt_runpath_y/lib",
664 },
665 lib64: {
666 relative_install_path: "bionic-loader-test-libs/dt_runpath_y/lib64",
667 },
668 },
669}
Colin Cross2722ebb2016-07-11 16:20:06 -0700670
671// -----------------------------------------------------------------------------
672// Build library with two parents
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700673//
674// Libraries used by dlfcn tests to verify local group ref_counting
675// libtest_two_parents*.so
Colin Cross2722ebb2016-07-11 16:20:06 -0700676// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700677
678// ..._child.so - correct answer
679cc_test_library {
680 name: "libtest_two_parents_child",
681 defaults: ["bionic_testlib_defaults"],
682 srcs: ["dlopen_2_parents_reloc_answer.cpp"],
683}
684
685// ..._parent1.so - correct answer
686cc_test_library {
687 name: "libtest_two_parents_parent1",
688 defaults: ["bionic_testlib_defaults"],
689 srcs: ["dlopen_check_order_reloc_answer_impl.cpp"],
690 shared_libs: ["libtest_two_parents_child"],
691 cflags: ["-D__ANSWER=42"],
692}
693
694// ..._parent2.so - incorrect answer
695cc_test_library {
696 name: "libtest_two_parents_parent2",
697 defaults: ["bionic_testlib_defaults"],
698 srcs: ["dlopen_check_order_reloc_answer_impl.cpp"],
699 shared_libs: ["libtest_two_parents_child"],
700 cflags: ["-D__ANSWER=1"],
701}
Colin Cross2722ebb2016-07-11 16:20:06 -0700702
703// -----------------------------------------------------------------------------
704// Build libtest_check_order_dlsym.so with its dependencies.
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700705//
706// Libraries used by dlfcn tests to verify correct load order:
Colin Cross2722ebb2016-07-11 16:20:06 -0700707// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700708
709// libtest_check_order_2_right.so
710cc_test_library {
711 name: "libtest_check_order_dlsym_2_right",
712 defaults: ["bionic_testlib_defaults"],
713 srcs: ["dlopen_check_order_dlsym_answer.cpp"],
714 cflags: ["-D__ANSWER=42"],
715}
716
717// libtest_check_order_a.so
718cc_test_library {
719 name: "libtest_check_order_dlsym_a",
720 defaults: ["bionic_testlib_defaults"],
721 srcs: ["dlopen_check_order_dlsym_answer.cpp"],
722 cflags: ["-D__ANSWER=1"],
723}
724
725// libtest_check_order_b.so
726cc_test_library {
727 name: "libtest_check_order_dlsym_b",
728 defaults: ["bionic_testlib_defaults"],
729 srcs: ["dlopen_check_order_dlsym_answer.cpp"],
730 cflags: [
731 "-D__ANSWER=2",
732 "-D__ANSWER2=43",
733 ],
734}
735
736// libtest_check_order_c.so
737cc_test_library {
738 name: "libtest_check_order_dlsym_3_c",
739 defaults: ["bionic_testlib_defaults"],
740 srcs: ["dlopen_check_order_dlsym_answer.cpp"],
741 cflags: ["-D__ANSWER=3"],
742}
743
744// libtest_check_order_d.so
745cc_test_library {
746 name: "libtest_check_order_dlsym_d",
747 defaults: ["bionic_testlib_defaults"],
748 shared_libs: ["libtest_check_order_dlsym_b"],
749 srcs: ["dlopen_check_order_dlsym_answer.cpp"],
750 cflags: [
751 "-D__ANSWER=4",
752 "-D__ANSWER2=4",
753 ],
754}
755
756// libtest_check_order_left.so
757cc_test_library {
758 name: "libtest_check_order_dlsym_1_left",
759 defaults: ["bionic_testlib_defaults"],
760 shared_libs: [
761 "libtest_check_order_dlsym_a",
762 "libtest_check_order_dlsym_b",
763 ],
764 srcs: ["empty.cpp"],
765}
766
767// libtest_check_order.so
768cc_test_library {
769 name: "libtest_check_order_dlsym",
770 defaults: ["bionic_testlib_defaults"],
771 shared_libs: [
772 "libtest_check_order_dlsym_1_left",
773 "libtest_check_order_dlsym_2_right",
774 "libtest_check_order_dlsym_3_c",
775 ],
776 srcs: ["empty.cpp"],
777}
Colin Cross2722ebb2016-07-11 16:20:06 -0700778
779// -----------------------------------------------------------------------------
780// Build libtest_check_order_siblings.so with its dependencies.
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700781//
782// Libraries used by dlfcn tests to verify correct relocation order:
783// libtest_check_order_reloc_siblings*.so
Colin Cross2722ebb2016-07-11 16:20:06 -0700784// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700785
786// ..._1.so - empty
787cc_test_library {
788 name: "libtest_check_order_reloc_siblings_1",
789 defaults: ["bionic_testlib_defaults"],
790 shared_libs: [
791 "libtest_check_order_reloc_siblings_a",
792 "libtest_check_order_reloc_siblings_b",
793 ],
794 srcs: ["empty.cpp"],
795}
796
797// ..._2.so - empty
798cc_test_library {
799 name: "libtest_check_order_reloc_siblings_2",
800 defaults: ["bionic_testlib_defaults"],
801 shared_libs: [
802 "libtest_check_order_reloc_siblings_c",
803 "libtest_check_order_reloc_siblings_d",
804 ],
805 srcs: [
806 "dlopen_check_order_reloc_grandchild_answer.cpp",
807 ],
808 allow_undefined_symbols: true,
809}
810
811// ..._3.so - get_answer2();
812cc_test_library {
813 name: "libtest_check_order_reloc_siblings_3",
814 defaults: ["bionic_testlib_defaults"],
815 shared_libs: [
816 "libtest_check_order_reloc_siblings_e",
817 "libtest_check_order_reloc_siblings_f",
818 ],
819 srcs: [
820 "dlopen_check_order_reloc_nephew_answer.cpp",
821 ],
822}
823
824// ..._a.so <- correct impl
825cc_test_library {
826 name: "libtest_check_order_reloc_siblings_a",
827 defaults: ["bionic_testlib_defaults"],
828 srcs: [
829 "dlopen_check_order_reloc_answer_impl.cpp",
830 ],
831 cflags: ["-D__ANSWER=42"],
832}
833
834// ..._b.so
835cc_test_library {
836 name: "libtest_check_order_reloc_siblings_b",
837 defaults: ["bionic_testlib_defaults"],
838 srcs: [
839 "dlopen_check_order_reloc_answer_impl.cpp",
840 ],
841 cflags: ["-D__ANSWER=1"],
842}
843
844// ..._c.so
845cc_test_library {
846 name: "libtest_check_order_reloc_siblings_c",
847 defaults: ["bionic_testlib_defaults"],
848 shared_libs: [
849 "libtest_check_order_reloc_siblings_c_1",
850 "libtest_check_order_reloc_siblings_c_2",
851 ],
852 srcs: [
853 "dlopen_check_order_reloc_answer_impl.cpp",
854 ],
855 cflags: ["-D__ANSWER=2"],
856}
857
858// ..._d.so
859cc_test_library {
860 name: "libtest_check_order_reloc_siblings_d",
861 defaults: ["bionic_testlib_defaults"],
862 srcs: [
863 "dlopen_check_order_reloc_answer_impl.cpp",
864 ],
865 cflags: ["-D__ANSWER=3"],
866}
867
868// ..._e.so
869cc_test_library {
870 name: "libtest_check_order_reloc_siblings_e",
871 defaults: ["bionic_testlib_defaults"],
872 srcs: [
873 "dlopen_check_order_reloc_answer_impl.cpp",
874 ],
875 cflags: [
876 "-D__ANSWER=4",
877 ],
878}
879
880// ..._f.so <- get_answer()
881cc_test_library {
882 name: "libtest_check_order_reloc_siblings_f",
883 defaults: ["bionic_testlib_defaults"],
884 srcs: [
885 "dlopen_check_order_reloc_answer.cpp",
886 ],
887}
888
889// ..._c_1.so
890cc_test_library {
891 name: "libtest_check_order_reloc_siblings_c_1",
892 defaults: ["bionic_testlib_defaults"],
893 srcs: [
894 "dlopen_check_order_reloc_grandchild_answer_impl.cpp",
895 ],
896 cflags: ["-D__ANSWER=42"],
897}
898
899// ..._c_2.so
900cc_test_library {
901 name: "libtest_check_order_reloc_siblings_c_2",
902 defaults: ["bionic_testlib_defaults"],
903 srcs: [
904 "dlopen_check_order_reloc_grandchild_answer_impl.cpp",
905 ],
906 cflags: ["-D__ANSWER=0"],
907}
908
909// libtest_check_order_reloc_siblings.so
910cc_test_library {
911 name: "libtest_check_order_reloc_siblings",
912 defaults: ["bionic_testlib_defaults"],
913 shared_libs: [
914 "libtest_check_order_reloc_siblings_1",
915 "libtest_check_order_reloc_siblings_2",
916 "libtest_check_order_reloc_siblings_3",
917 ],
918 srcs: [
919 "empty.cpp",
920 ],
921}
Colin Cross2722ebb2016-07-11 16:20:06 -0700922
923// -----------------------------------------------------------------------------
924// Build libtest_check_order_root.so with its dependencies.
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700925//
926// Libraries used by dlfcn tests to verify correct relocation order:
927// libtest_check_order_reloc_root*.so
Colin Cross2722ebb2016-07-11 16:20:06 -0700928// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700929
930// ..._1.so - empty
931cc_test_library {
932 name: "libtest_check_order_reloc_root_1",
933 defaults: ["bionic_testlib_defaults"],
934 srcs: ["empty.cpp"],
935}
936
937// ..._2.so - this one has the incorrect answer
938cc_test_library {
939 name: "libtest_check_order_reloc_root_2",
940 defaults: ["bionic_testlib_defaults"],
941 srcs: ["dlopen_check_order_reloc_root_answer_impl.cpp"],
942 cflags: ["-D__ANSWER=2"],
943}
944
945// libtest_check_order_reloc_root.so <- implements get_answer3()
946cc_test_library {
947 name: "libtest_check_order_reloc_root",
948 defaults: ["bionic_testlib_defaults"],
949 srcs: ["dlopen_check_order_reloc_root_answer.cpp"],
950 shared_libs: [
951 "libtest_check_order_reloc_root_1",
952 "libtest_check_order_reloc_root_2",
953 ],
954}
Colin Cross2722ebb2016-07-11 16:20:06 -0700955
956// -----------------------------------------------------------------------------
957// Build libtest_versioned_lib.so with its dependencies.
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700958//
959// Libraries used to test versioned symbols
Colin Cross2722ebb2016-07-11 16:20:06 -0700960// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700961
962cc_test_library {
963 name: "libtest_versioned_uselibv1",
964 defaults: ["bionic_testlib_defaults"],
965 srcs: ["versioned_uselib.cpp"],
966 shared_libs: ["libtest_versioned_libv1"],
967}
968
969cc_test_library {
970 name: "libtest_versioned_uselibv2",
971 defaults: ["bionic_testlib_defaults"],
972 srcs: ["versioned_uselib.cpp"],
973 shared_libs: ["libtest_versioned_libv2"],
974 version_script: "versioned_uselib.map",
975}
976
977cc_test_library {
978 name: "libtest_versioned_uselibv2_other",
979 defaults: ["bionic_testlib_defaults"],
980 srcs: ["versioned_uselib.cpp"],
981 shared_libs: [
982 "libtest_versioned_otherlib_empty",
983 "libtest_versioned_libv2",
984 ],
985}
986
987cc_test_library {
988 name: "libtest_versioned_uselibv3_other",
989 defaults: ["bionic_testlib_defaults"],
990 srcs: ["versioned_uselib.cpp"],
991 shared_libs: [
992 "libtest_versioned_otherlib_empty",
993 "libtest_versioned_lib",
994 ],
995}
996
997// lib v1 - this one used during static linking but never used at runtime
998// which forces libtest_versioned_uselibv1 to use function v1 from
999// libtest_versioned_lib.so
1000cc_test_library {
1001 name: "libtest_versioned_libv1",
1002 defaults: ["bionic_testlib_defaults"],
1003 srcs: ["versioned_lib_v1.cpp"],
1004 version_script: "versioned_lib_v1.map",
1005 ldflags: ["-Wl,-soname,libtest_versioned_lib.so"],
1006}
1007
1008// lib v2 - to make libtest_versioned_uselibv2.so use version 2 of versioned_function()
1009cc_test_library {
1010 name: "libtest_versioned_libv2",
1011 defaults: ["bionic_testlib_defaults"],
1012 srcs: ["versioned_lib_v2.cpp"],
1013 version_script: "versioned_lib_v2.map",
1014 ldflags: ["-Wl,-soname,libtest_versioned_lib.so"],
1015}
1016
1017// last version - this one is used at the runtime and exports 3 versions
1018// of versioned_symbol().
1019cc_test_library {
1020 name: "libtest_versioned_lib",
1021 defaults: ["bionic_testlib_defaults"],
1022 srcs: ["versioned_lib_v3.cpp"],
1023 version_script: "versioned_lib_v3.map",
1024}
1025
1026// This library is empty, the actual implementation will provide an unversioned
1027// symbol for versioned_function().
1028cc_test_library {
1029 name: "libtest_versioned_otherlib_empty",
1030 defaults: ["bionic_testlib_defaults"],
1031 srcs: ["empty.cpp"],
1032 ldflags: ["-Wl,-soname,libtest_versioned_otherlib.so"],
1033}
1034
1035cc_test_library {
1036 name: "libtest_versioned_otherlib",
1037 defaults: ["bionic_testlib_defaults"],
1038 srcs: ["versioned_lib_other.cpp"],
1039 version_script: "versioned_lib_other.map",
1040}
Colin Cross2722ebb2016-07-11 16:20:06 -07001041
1042// -----------------------------------------------------------------------------
1043// Build libraries needed by pthread_atfork tests
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -07001044
1045// This library used to test phtread_atfork handler behaviour
1046// during/after dlclose.
Colin Cross2722ebb2016-07-11 16:20:06 -07001047// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -07001048cc_test_library {
1049 name: "libtest_pthread_atfork",
1050 defaults: ["bionic_testlib_defaults"],
1051 srcs: ["pthread_atfork.cpp"],
1052}
Colin Cross2722ebb2016-07-11 16:20:06 -07001053
1054// -----------------------------------------------------------------------------
1055// Library with dependency loop used by dlfcn tests
1056//
1057// libtest_with_dependency_loop -> a -> b -> c -> a
1058// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001059cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001060 name: "libtest_with_dependency_loop",
1061 defaults: ["bionic_testlib_defaults"],
1062 srcs: ["dlopen_testlib_loopy_root.cpp"],
1063 shared_libs: ["libtest_with_dependency_loop_a"],
1064}
1065
1066// -----------------------------------------------------------------------------
1067// libtest_with_dependency_loop_a.so
1068// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001069cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001070 name: "libtest_with_dependency_loop_a",
1071 defaults: ["bionic_testlib_defaults"],
1072 srcs: ["dlopen_testlib_loopy_a.cpp"],
1073 shared_libs: ["libtest_with_dependency_loop_b_tmp"],
1074}
1075
1076// -----------------------------------------------------------------------------
1077// libtest_with_dependency_loop_b.so
1078//
1079// this is temporary placeholder - will be removed
1080// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001081cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001082 name: "libtest_with_dependency_loop_b_tmp",
1083 defaults: ["bionic_testlib_defaults"],
1084 srcs: ["dlopen_testlib_loopy_invalid.cpp"],
1085 ldflags: ["-Wl,-soname=libtest_with_dependency_loop_b.so"],
1086}
1087
1088// -----------------------------------------------------------------------------
1089// libtest_with_dependency_loop_b.so
1090// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001091cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001092 name: "libtest_with_dependency_loop_b",
1093 defaults: ["bionic_testlib_defaults"],
1094 srcs: ["dlopen_testlib_loopy_b.cpp"],
1095 shared_libs: ["libtest_with_dependency_loop_c"],
1096}
1097
1098// -----------------------------------------------------------------------------
1099// libtest_with_dependency_loop_c.so
1100// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001101cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001102 name: "libtest_with_dependency_loop_c",
1103 defaults: ["bionic_testlib_defaults"],
1104 srcs: ["dlopen_testlib_loopy_c.cpp"],
1105 shared_libs: ["libtest_with_dependency_loop_a"],
1106}
1107
1108// -----------------------------------------------------------------------------
1109// libtest_relo_check_dt_needed_order.so
1110// |
1111// +-> libtest_relo_check_dt_needed_order_1.so
1112// |
1113// +-> libtest_relo_check_dt_needed_order_2.so
1114// -----------------------------------------------------------------------------
1115
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001116cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001117 name: "libtest_relo_check_dt_needed_order",
1118 defaults: ["bionic_testlib_defaults"],
1119 srcs: ["dlopen_testlib_relo_check_dt_needed_order.cpp"],
1120 shared_libs: [
1121 "libtest_relo_check_dt_needed_order_1",
1122 "libtest_relo_check_dt_needed_order_2",
1123 ],
1124}
1125
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001126cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001127 name: "libtest_relo_check_dt_needed_order_1",
1128 defaults: ["bionic_testlib_defaults"],
1129 srcs: ["dlopen_testlib_relo_check_dt_needed_order_1.cpp"],
1130}
1131
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001132cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001133 name: "libtest_relo_check_dt_needed_order_2",
1134 defaults: ["bionic_testlib_defaults"],
1135 srcs: ["dlopen_testlib_relo_check_dt_needed_order_2.cpp"],
1136}
1137
1138// -----------------------------------------------------------------------------
1139// Library with dependency used by dlfcn tests
1140// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -07001141cc_test_library {
1142 name: "libtest_with_dependency",
1143 defaults: ["bionic_testlib_defaults"],
1144 srcs: ["dlopen_testlib_simple.cpp"],
1145 shared_libs: ["libdlext_test"],
1146}
Colin Cross2722ebb2016-07-11 16:20:06 -07001147
1148// -----------------------------------------------------------------------------
1149// Library used by ifunc tests
1150// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001151cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001152 name: "libtest_ifunc",
1153 defaults: ["bionic_testlib_defaults"],
Dimitry Ivanov21975b22017-05-02 16:31:56 -07001154 srcs: ["dlopen_testlib_ifunc.cpp"],
Dimitry Ivanov21975b22017-05-02 16:31:56 -07001155}
1156
1157cc_test_library {
1158 name: "libtest_ifunc_variable",
1159 defaults: ["bionic_testlib_defaults"],
1160 srcs: ["dlopen_testlib_ifunc_variable.cpp"],
Elliott Hughesd50a1de2018-02-05 17:30:57 -08001161 shared_libs: ["libtest_ifunc_variable_impl"],
Dimitry Ivanov21975b22017-05-02 16:31:56 -07001162}
1163
1164cc_test_library {
1165 name: "libtest_ifunc_variable_impl",
1166 defaults: ["bionic_testlib_defaults"],
1167 srcs: ["dlopen_testlib_ifunc_variable_impl.cpp"],
Colin Cross2722ebb2016-07-11 16:20:06 -07001168}
1169
1170// -----------------------------------------------------------------------------
1171// Library used by atexit tests
1172// -----------------------------------------------------------------------------
1173
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001174cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001175 name: "libtest_atexit",
1176 defaults: ["bionic_testlib_defaults"],
1177 srcs: ["atexit_testlib.cpp"],
1178}
1179
1180// -----------------------------------------------------------------------------
1181// This library is used by dl_load test to check symbol preempting
1182// by main executable
1183// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001184cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001185 name: "libdl_preempt_test_1",
1186 defaults: ["bionic_testlib_defaults"],
1187 srcs: ["dl_preempt_library_1.cpp"],
1188}
1189
1190// -----------------------------------------------------------------------------
1191// This library is used by dl_load test to check symbol preempting
1192// by libdl_preempt_test_1.so
1193// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001194cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001195 name: "libdl_preempt_test_2",
1196 defaults: ["bionic_testlib_defaults"],
1197 srcs: ["dl_preempt_library_2.cpp"],
1198}
1199
1200// -----------------------------------------------------------------------------
1201// Library with DF_1_GLOBAL
1202// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001203cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001204 name: "libdl_test_df_1_global",
1205 defaults: ["bionic_testlib_defaults"],
1206 srcs: ["dl_df_1_global.cpp"],
1207 ldflags: ["-Wl,-z,global"],
Colin Cross2722ebb2016-07-11 16:20:06 -07001208}
1209
1210// -----------------------------------------------------------------------------
1211// Library using symbol from libdl_test_df_1_global
1212// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001213cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001214 name: "libtest_dlsym_df_1_global",
1215 defaults: ["bionic_testlib_defaults"],
1216 srcs: ["dl_df_1_use_global.cpp"],
1217}
1218
1219// -----------------------------------------------------------------------------
Jiyong Park01162f22017-10-16 15:31:09 +09001220// Library with DF_1_GLOBAL which will be dlopened
1221// (note: libdl_test_df_1_global above will be included in DT_NEEDED)
1222// -----------------------------------------------------------------------------
1223cc_test_library {
1224 name: "libtest_dlopen_df_1_global",
1225 defaults: ["bionic_testlib_defaults"],
1226 srcs: ["dl_df_1_global_dummy.cpp"],
1227 ldflags: ["-Wl,-z,global"],
Jiyong Park01162f22017-10-16 15:31:09 +09001228}
1229
Jiyong Park01162f22017-10-16 15:31:09 +09001230// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -07001231// Library with weak function
1232// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001233cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001234 name: "libtest_dlsym_weak_func",
1235 defaults: ["bionic_testlib_defaults"],
1236 srcs: ["dlsym_weak_function.cpp"],
1237}
1238
1239// -----------------------------------------------------------------------------
1240// Library to check RTLD_LOCAL with dlsym in 'this'
1241// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001242cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001243 name: "libtest_dlsym_from_this",
1244 defaults: ["bionic_testlib_defaults"],
1245 srcs: ["dlsym_from_this_symbol.cpp"],
1246 shared_libs: ["libtest_dlsym_from_this_child"],
Colin Cross2722ebb2016-07-11 16:20:06 -07001247}
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_child",
1252 defaults: ["bionic_testlib_defaults"],
1253 srcs: ["dlsym_from_this_functions.cpp"],
1254 shared_libs: ["libtest_dlsym_from_this_grandchild"],
1255}
1256
1257// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001258cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001259 name: "libtest_dlsym_from_this_grandchild",
1260 defaults: ["bionic_testlib_defaults"],
1261 srcs: ["dlsym_from_this_symbol2.cpp"],
1262}
1263
1264// -----------------------------------------------------------------------------
1265// Empty library
1266// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001267cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001268 name: "libtest_empty",
1269 defaults: ["bionic_testlib_defaults"],
1270 srcs: ["empty.cpp"],
1271}
1272
1273// -----------------------------------------------------------------------------
dimitry8db36a52017-10-23 15:10:10 +02001274// Library for inaccessible shared library test
1275// -----------------------------------------------------------------------------
1276cc_test_library {
1277 name: "libtestshared",
1278 defaults: ["bionic_testlib_defaults"],
1279 srcs: ["empty.cpp"],
Nan Zhangdab0fd52017-11-07 11:05:24 -08001280 relative_install_path: "bionic-loader-test-libs/inaccessible_libs",
dimitry8db36a52017-10-23 15:10:10 +02001281}
1282
1283// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -07001284// Library with weak undefined function
1285// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001286cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001287 name: "libtest_dlopen_weak_undefined_func",
1288 defaults: ["bionic_testlib_defaults"],
1289 srcs: ["dlopen_weak_undefined.cpp"],
1290}
1291
1292// -----------------------------------------------------------------------------
Dimitry Ivanovd0b5c3a2016-11-25 12:23:11 -08001293// Check that RTLD_NEXT of a libc symbol works in dlopened library
1294// -----------------------------------------------------------------------------
1295cc_test_library {
1296 name: "libtest_check_rtld_next_from_library",
1297 defaults: ["bionic_testlib_defaults"],
1298 srcs: ["check_rtld_next_from_library.cpp"],
Pirama Arumuga Nainar8035caa2020-06-09 12:48:10 -07001299 native_coverage: false,
Dimitry Ivanovd0b5c3a2016-11-25 12:23:11 -08001300}
1301
1302// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -07001303// Library with constructor that calls dlopen() b/7941716
1304// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001305cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001306 name: "libtest_dlopen_from_ctor",
1307 defaults: ["bionic_testlib_defaults"],
1308 srcs: ["dlopen_testlib_dlopen_from_ctor.cpp"],
Colin Cross2722ebb2016-07-11 16:20:06 -07001309}
1310
1311// -----------------------------------------------------------------------------
Dimitry Ivanovec90e242017-02-10 11:04:20 -08001312// Libraries used to check init/fini call order
Dimitry Ivanovea8f3962017-02-09 13:31:57 -08001313// -----------------------------------------------------------------------------
1314cc_test_library {
1315 name: "libtest_init_fini_order_root",
1316 defaults: ["bionic_testlib_defaults"],
1317 srcs: ["dlopen_check_init_fini_root.cpp"],
Dimitry Ivanovec90e242017-02-10 11:04:20 -08001318 shared_libs: [
1319 "libtest_init_fini_order_child",
1320 "libtest_init_fini_order_grand_child",
1321 ],
1322}
1323
1324cc_test_library {
1325 name: "libtest_init_fini_order_root2",
1326 defaults: ["bionic_testlib_defaults"],
1327 srcs: ["dlopen_check_init_fini_root.cpp"],
1328 shared_libs: [
1329 "libtest_init_fini_order_grand_child",
1330 "libtest_init_fini_order_child",
1331 ],
Dimitry Ivanovea8f3962017-02-09 13:31:57 -08001332}
1333
1334cc_test_library {
1335 name: "libtest_init_fini_order_child",
1336 defaults: ["bionic_testlib_defaults"],
1337 srcs: ["dlopen_check_init_fini_child.cpp"],
1338 shared_libs: ["libtest_init_fini_order_grand_child"],
1339}
1340
1341cc_test_library {
1342 name: "libtest_init_fini_order_grand_child",
1343 defaults: ["bionic_testlib_defaults"],
1344 srcs: ["dlopen_check_init_fini_grand_child.cpp"],
1345}
1346
1347// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -07001348// Library that depends on the library with constructor that calls dlopen() b/7941716
1349// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001350cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001351 name: "libtest_dlopen_from_ctor_main",
1352 defaults: ["bionic_testlib_defaults"],
1353 srcs: ["empty.cpp"],
1354 shared_libs: ["libtest_dlopen_from_ctor"],
1355}
1356
1357// -----------------------------------------------------------------------------
dimitry55547db2018-05-25 14:17:37 +02001358// Libraries with non-trivial thread_local variable to test dlclose()
dimitry06016f22018-01-05 11:39:28 +01001359// -----------------------------------------------------------------------------
1360cc_test_library {
1361 name: "libtest_thread_local_dtor",
1362 defaults: ["bionic_testlib_defaults"],
1363 srcs: ["thread_local_dtor.cpp"],
1364}
1365
dimitry55547db2018-05-25 14:17:37 +02001366cc_test_library {
1367 name: "libtest_thread_local_dtor2",
1368 defaults: ["bionic_testlib_defaults"],
1369 srcs: ["thread_local_dtor2.cpp"],
1370}
1371
1372// -----------------------------------------------------------------------------
1373// Library dt_needs libtest_thread_local_dtor/2 (to check no-unload on load_group)
1374// -----------------------------------------------------------------------------
1375cc_test_library {
1376 name: "libtest_indirect_thread_local_dtor",
1377 defaults: ["bionic_testlib_defaults"],
1378 srcs: ["empty.cpp"],
1379 shared_libs: [
1380 "libtest_thread_local_dtor",
1381 "libtest_thread_local_dtor2",
1382 ],
1383}
1384
dimitry06016f22018-01-05 11:39:28 +01001385// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -07001386// Tool to use to align the shared libraries in a zip file.
1387// -----------------------------------------------------------------------------
1388cc_binary_host {
1389 name: "bionic_tests_zipalign",
1390 srcs: ["bionic_tests_zipalign.cpp"],
1391 cflags: [
1392 "-Wall",
1393 "-Werror",
1394 ],
1395
1396 static_libs: [
1397 "libziparchive",
1398 "liblog",
1399 "libbase",
1400 "libz",
1401 "libutils",
1402 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001403}
Evgenii Stepanov0a3637d2016-07-06 13:20:59 -07001404
1405cc_test_library {
1406 name: "libcfi-test",
1407 defaults: ["bionic_testlib_defaults"],
1408 srcs: ["cfi_test_lib.cpp"],
1409 sanitize: {
1410 cfi: false,
1411 },
1412}
1413
1414cc_test_library {
1415 name: "libcfi-test-bad",
1416 defaults: ["bionic_testlib_defaults"],
1417 srcs: ["cfi_test_bad_lib.cpp"],
1418 sanitize: {
1419 cfi: false,
1420 },
1421}
Evgenii Stepanov68ecec12017-01-31 13:19:30 -08001422
1423cc_test {
1424 name: "cfi_test_helper",
1425 host_supported: false,
1426 defaults: ["bionic_testlib_defaults"],
1427 srcs: ["cfi_test_helper.cpp"],
1428 ldflags: ["-rdynamic"],
1429}
1430
1431cc_test {
1432 name: "cfi_test_helper2",
1433 host_supported: false,
1434 defaults: ["bionic_testlib_defaults"],
1435 srcs: ["cfi_test_helper2.cpp"],
1436 shared_libs: ["libcfi-test"],
1437 ldflags: ["-Wl,--rpath,${ORIGIN}/.."],
1438}
Elliott Hugheseb04ed52017-03-29 13:48:02 -07001439
1440cc_test {
1441 name: "preinit_getauxval_test_helper",
1442 host_supported: false,
1443 defaults: ["bionic_testlib_defaults"],
1444 srcs: ["preinit_getauxval_test_helper.cpp"],
1445}
1446
1447cc_test {
1448 name: "preinit_syscall_test_helper",
1449 host_supported: false,
1450 defaults: ["bionic_testlib_defaults"],
1451 srcs: ["preinit_syscall_test_helper.cpp"],
1452}
Jiyong Park02586a22017-05-20 01:01:24 +09001453
1454cc_test {
1455 name: "ld_preload_test_helper",
1456 host_supported: false,
1457 defaults: ["bionic_testlib_defaults"],
1458 srcs: ["ld_preload_test_helper.cpp"],
1459 shared_libs: ["ld_preload_test_helper_lib1"],
1460 ldflags: ["-Wl,--rpath,${ORIGIN}/.."],
1461}
1462
1463cc_test_library {
1464 name: "ld_preload_test_helper_lib1",
1465 host_supported: false,
1466 defaults: ["bionic_testlib_defaults"],
1467 srcs: ["ld_preload_test_helper_lib1.cpp"],
1468}
1469
1470cc_test_library {
1471 name: "ld_preload_test_helper_lib2",
1472 host_supported: false,
1473 defaults: ["bionic_testlib_defaults"],
1474 srcs: ["ld_preload_test_helper_lib2.cpp"],
1475}
1476
1477cc_test {
1478 name: "ld_config_test_helper",
1479 host_supported: false,
1480 defaults: ["bionic_testlib_defaults"],
1481 srcs: ["ld_config_test_helper.cpp"],
1482 shared_libs: ["ld_config_test_helper_lib1"],
1483 ldflags: ["-Wl,--rpath,${ORIGIN}/.."],
1484}
1485
1486cc_test_library {
1487 name: "ld_config_test_helper_lib1",
1488 host_supported: false,
1489 defaults: ["bionic_testlib_defaults"],
1490 srcs: ["ld_config_test_helper_lib1.cpp"],
1491 shared_libs: ["ld_config_test_helper_lib2"],
Nan Zhangdab0fd52017-11-07 11:05:24 -08001492 relative_install_path: "bionic-loader-test-libs/ns2",
Ryan Prichard058eb8f2020-12-17 22:59:04 -08001493 // Mark the library DF_1_GLOBAL so it is added to every linker namespace.
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001494 ldflags: ["-Wl,-z,global"],
Jiyong Park02586a22017-05-20 01:01:24 +09001495}
1496
1497cc_test_library {
1498 name: "ld_config_test_helper_lib2",
1499 host_supported: false,
1500 defaults: ["bionic_testlib_defaults"],
1501 srcs: ["ld_config_test_helper_lib2.cpp"],
Nan Zhangdab0fd52017-11-07 11:05:24 -08001502 relative_install_path: "bionic-loader-test-libs/ns2",
Jiyong Park02586a22017-05-20 01:01:24 +09001503}
1504
1505cc_test_library {
1506 name: "ld_config_test_helper_lib3",
1507 host_supported: false,
1508 defaults: ["bionic_testlib_defaults"],
1509 srcs: ["ld_config_test_helper_lib3.cpp"],
1510}
Ryan Prichard8f639a42018-10-01 23:10:05 -07001511
1512cc_test {
1513 name: "exec_linker_helper",
1514 host_supported: false,
1515 defaults: ["bionic_testlib_defaults"],
1516 srcs: ["exec_linker_helper.cpp"],
1517 shared_libs: ["exec_linker_helper_lib"],
1518 ldflags: ["-Wl,--rpath,${ORIGIN}/.."],
1519}
1520
1521cc_test_library {
1522 name: "exec_linker_helper_lib",
1523 host_supported: false,
1524 defaults: ["bionic_testlib_defaults"],
1525 srcs: ["exec_linker_helper_lib.cpp"],
1526}
Peter Collingbourneb39cb3c2019-03-01 13:12:49 -08001527
1528cc_test_library {
1529 name: "libsegment_gap_outer",
1530 host_supported: false,
1531 defaults: ["bionic_testlib_defaults"],
1532 srcs: ["segment_gap_outer.cpp"],
1533 ldflags: ["-Wl,-T,bionic/tests/libs/segment_gap_outer.lds"],
1534}
1535
1536cc_test_library {
1537 name: "libsegment_gap_inner",
1538 host_supported: false,
1539 defaults: ["bionic_testlib_defaults"],
1540 srcs: ["segment_gap_inner.cpp"],
1541}
Elliott Hughes6663f552020-01-24 14:36:10 -08001542
Elliott Hughes6663f552020-01-24 14:36:10 -08001543// -----------------------------------------------------------------------------
Elliott Hughes6dd1f582020-01-28 12:18:35 -08001544// Check that we support all kinds of relocations: regular, "relocation packer",
1545// and both the old and new SHT_RELR constants.
Elliott Hughes6663f552020-01-24 14:36:10 -08001546// -----------------------------------------------------------------------------
1547
Elliott Hughes6dd1f582020-01-28 12:18:35 -08001548// This is what got standardized for SHT_RELR.
Elliott Hughes6663f552020-01-24 14:36:10 -08001549cc_test_library {
Elliott Hughes6dd1f582020-01-28 12:18:35 -08001550 name: "librelocations-RELR",
1551 ldflags: [
1552 "-Wl,--pack-dyn-relocs=relr",
1553 "-Wl,--no-use-android-relr-tags",
1554 ],
Elliott Hughes6663f552020-01-24 14:36:10 -08001555 host_supported: false,
1556 defaults: ["bionic_testlib_defaults"],
Elliott Hughes6dd1f582020-01-28 12:18:35 -08001557 srcs: ["relocations.cpp"],
Elliott Hughes6663f552020-01-24 14:36:10 -08001558}
1559
Elliott Hughes6dd1f582020-01-28 12:18:35 -08001560// This is the same encoding as SHT_RELR, but using OS-specific constants.
Elliott Hughes6663f552020-01-24 14:36:10 -08001561cc_test_library {
Elliott Hughes6dd1f582020-01-28 12:18:35 -08001562 name: "librelocations-ANDROID_RELR",
1563 ldflags: [
1564 "-Wl,--pack-dyn-relocs=relr",
1565 "-Wl,--use-android-relr-tags",
1566 ],
Elliott Hughes6663f552020-01-24 14:36:10 -08001567 host_supported: false,
1568 defaults: ["bionic_testlib_defaults"],
Elliott Hughes6dd1f582020-01-28 12:18:35 -08001569 srcs: ["relocations.cpp"],
1570}
1571
1572// This is the old relocation packer encoding (DT_ANDROID_REL/DT_ANDROID_RELA).
1573cc_test_library {
1574 name: "librelocations-ANDROID_REL",
1575 ldflags: ["-Wl,--pack-dyn-relocs=android"],
1576 host_supported: false,
1577 defaults: ["bionic_testlib_defaults"],
1578 srcs: ["relocations.cpp"],
1579}
1580
1581// This is not packed at all.
1582cc_test_library {
1583 name: "librelocations-fat",
1584 ldflags: ["-Wl,--pack-dyn-relocs=none"],
1585 host_supported: false,
1586 defaults: ["bionic_testlib_defaults"],
1587 srcs: ["relocations.cpp"],
Elliott Hughes6663f552020-01-24 14:36:10 -08001588}
Evgenii Stepanov51741fb2021-01-06 16:03:15 -08001589
1590cc_defaults {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001591 name: "bionic_targets_only",
1592 enabled: false,
1593 target: {
1594 android: {
1595 enabled: true,
1596 },
1597 linux_bionic: {
1598 enabled: true,
1599 },
1600 },
Evgenii Stepanov51741fb2021-01-06 16:03:15 -08001601}
1602
1603cc_test {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001604 name: "heap_tagging_sync_helper",
1605 defaults: [
1606 "bionic_testlib_defaults",
1607 "bionic_targets_only",
1608 ],
1609 srcs: ["heap_tagging_helper.cpp"],
1610 sanitize: {
1611 memtag_heap: true,
1612 diag: {
1613 memtag_heap: true,
1614 },
1615 hwaddress: false,
1616 },
Evgenii Stepanov51741fb2021-01-06 16:03:15 -08001617}
1618
1619cc_test {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001620 name: "heap_tagging_async_helper",
1621 defaults: [
1622 "bionic_testlib_defaults",
1623 "bionic_targets_only",
1624 ],
1625 srcs: ["heap_tagging_helper.cpp"],
1626 sanitize: {
1627 memtag_heap: true,
1628 diag: {
1629 memtag_heap: false,
1630 },
1631 hwaddress: false,
1632 },
Evgenii Stepanov51741fb2021-01-06 16:03:15 -08001633}
1634
1635cc_test {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001636 name: "heap_tagging_disabled_helper",
1637 defaults: [
1638 "bionic_testlib_defaults",
1639 "bionic_targets_only",
1640 ],
1641 srcs: ["heap_tagging_helper.cpp"],
1642 sanitize: {
1643 memtag_heap: false,
1644 hwaddress: false,
1645 },
Evgenii Stepanov51741fb2021-01-06 16:03:15 -08001646}
1647
1648cc_test {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001649 name: "heap_tagging_static_sync_helper",
1650 defaults: [
1651 "bionic_testlib_defaults",
1652 "bionic_targets_only",
1653 ],
1654 srcs: ["heap_tagging_helper.cpp"],
1655 static_executable: true,
1656 sanitize: {
1657 memtag_heap: true,
1658 diag: {
1659 memtag_heap: true,
1660 },
1661 hwaddress: false,
1662 },
Evgenii Stepanov51741fb2021-01-06 16:03:15 -08001663}
1664
1665cc_test {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001666 name: "heap_tagging_static_async_helper",
1667 defaults: [
1668 "bionic_testlib_defaults",
1669 "bionic_targets_only",
1670 ],
1671 srcs: ["heap_tagging_helper.cpp"],
1672 static_executable: true,
1673 sanitize: {
1674 memtag_heap: true,
1675 diag: {
1676 memtag_heap: false,
1677 },
1678 hwaddress: false,
1679 },
Evgenii Stepanov51741fb2021-01-06 16:03:15 -08001680}
1681
1682cc_test {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001683 name: "heap_tagging_static_disabled_helper",
1684 defaults: [
1685 "bionic_testlib_defaults",
1686 "bionic_targets_only",
1687 ],
1688 srcs: ["heap_tagging_helper.cpp"],
1689 static_executable: true,
1690 sanitize: {
1691 memtag_heap: false,
1692 hwaddress: false,
1693 },
Evgenii Stepanov51741fb2021-01-06 16:03:15 -08001694}
Colin Crossbadcb382021-09-24 17:49:58 -07001695
Florian Mayerc82d7fc2022-08-31 20:57:03 +00001696cc_test {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001697 name: "stack_tagging_helper",
1698 defaults: [
1699 "bionic_testlib_defaults",
1700 "bionic_targets_only",
1701 ],
1702 srcs: ["stack_tagging_helper.cpp"],
1703 sanitize: {
1704 memtag_heap: true,
1705 memtag_stack: true,
1706 diag: {
1707 memtag_heap: true,
1708 },
1709 hwaddress: false,
1710 },
1711 header_libs: ["bionic_libc_platform_headers"],
1712 cflags: ["-fexceptions"],
Florian Mayerc82d7fc2022-08-31 20:57:03 +00001713}
1714
1715cc_test {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001716 name: "stack_tagging_static_helper",
1717 defaults: [
1718 "bionic_testlib_defaults",
1719 "bionic_targets_only",
1720 ],
1721 srcs: ["stack_tagging_helper.cpp"],
1722 static_executable: true,
1723 sanitize: {
1724 memtag_heap: true,
1725 memtag_stack: true,
1726 diag: {
1727 memtag_heap: true,
1728 },
1729 hwaddress: false,
1730 },
1731 header_libs: ["bionic_libc_platform_headers"],
1732 cflags: ["-fexceptions"],
Florian Mayerc82d7fc2022-08-31 20:57:03 +00001733}
1734
Colin Crossbadcb382021-09-24 17:49:58 -07001735cc_genrule {
1736 name: "libdlext_test_zip_zipaligned",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001737 out: ["bionic-loader-test-libs/libdlext_test_zip/libdlext_test_zip_zipaligned.zip"],
Colin Crossbadcb382021-09-24 17:49:58 -07001738 tools: [
1739 "soong_zip",
1740 "bionic_tests_zipalign",
1741 ],
1742 srcs: [
1743 ":libdlext_test_zip",
1744 ":libatest_simple_zip",
1745 ":exec_linker_helper",
1746 ":exec_linker_helper_lib",
1747 ],
1748 cmd: "mkdir -p $(genDir)/zipdir/libdir &&" +
1749 " cp $(in) $(genDir)/zipdir/libdir/ &&" +
1750 " touch $(genDir)/zipdir/empty_file.txt &&" +
1751 " $(location soong_zip) -o $(out).unaligned -L 0 -C $(genDir)/zipdir -D $(genDir)/zipdir &&" +
1752 " $(location bionic_tests_zipalign) 4096 $(out).unaligned $(out)",
1753
Colin Crossbadcb382021-09-24 17:49:58 -07001754}
1755
1756cc_genrule {
1757 name: "libdlext_test_runpath_zip_zipaligned",
1758 out: ["bionic-loader-test-libs/libdlext_test_runpath_zip/libdlext_test_runpath_zip_zipaligned.zip"],
1759 tools: [
1760 "soong_zip",
1761 "bionic_tests_zipalign",
1762 ],
1763 srcs: [
1764 ":libtest_dt_runpath_d_zip",
1765 ":libtest_dt_runpath_a",
1766 ":libtest_dt_runpath_b",
1767 ":libtest_dt_runpath_c",
1768 ":libtest_dt_runpath_x",
1769 ":libtest_dt_runpath_y",
1770 ],
1771 cmd: "mkdir -p $(genDir)/zipdir/libdir &&" +
1772 " if [[ \"$$CC_MULTILIB\" = lib32 ]]; then" +
1773 " PRIVATE_LIB_OR_LIB64=lib;" +
1774 " else" +
1775 " PRIVATE_LIB_OR_LIB64=lib64;" +
1776 " fi &&" +
1777 " if [[ -n \"$$CC_NATIVE_BRIDGE\" ]]; then" +
1778 " PRIVATE_LIB_OR_LIB64=$$PRIVATE_LIB_OR_LIB64/$$CC_NATIVE_BRIDGE;" +
1779 " fi &&" +
1780 " mkdir -p $(genDir)/zipdir/libdir/dt_runpath_a &&" +
1781 " mkdir -p $(genDir)/zipdir/libdir/dt_runpath_b_c_x &&" +
1782 " mkdir -p $(genDir)/zipdir/libdir/dt_runpath_y/$$PRIVATE_LIB_OR_LIB64 &&" +
1783 " cp $(location :libtest_dt_runpath_d_zip) $(genDir)/zipdir/libdir &&" +
1784 " cp $(location :libtest_dt_runpath_a) $(genDir)/zipdir/libdir/dt_runpath_a &&" +
1785 " cp $(location :libtest_dt_runpath_b) $(genDir)/zipdir/libdir/dt_runpath_b_c_x &&" +
1786 " cp $(location :libtest_dt_runpath_c) $(genDir)/zipdir/libdir/dt_runpath_b_c_x &&" +
1787 " cp $(location :libtest_dt_runpath_x) $(genDir)/zipdir/libdir/dt_runpath_b_c_x &&" +
1788 " cp $(location :libtest_dt_runpath_y) $(genDir)/zipdir/libdir/dt_runpath_y/$$PRIVATE_LIB_OR_LIB64 &&" +
1789 " touch $(genDir)/zipdir/empty_file.txt &&" +
1790 " $(location soong_zip) -o $(out).unaligned -L 0 -C $(genDir)/zipdir -D $(genDir)/zipdir &&" +
1791 " $(location bionic_tests_zipalign) 4096 $(out).unaligned $(out)",
Colin Crossbadcb382021-09-24 17:49:58 -07001792}