blob: 06ee132d4120517b67c7e995caf6beabfb4d53b4 [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 {
Aditya Choudharyd9d37c02024-02-02 13:57:12 +000018 default_team: "trendy_team_native_tools_libraries",
Bob Badouraa7d8352021-02-19 13:06:22 -080019 default_applicable_licenses: ["bionic_tests_license"],
20}
21
Colin Cross2722ebb2016-07-11 16:20:06 -070022cc_defaults {
23 name: "bionic_testlib_defaults",
24 host_supported: true,
Chih-Hung Hsieh84f0dcd2017-10-02 11:47:31 -070025 cflags: [
26 "-Wall",
27 "-Werror",
28 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -070029 ldflags: [
Dimitry Ivanovd11d1e42016-10-05 02:51:17 -070030 "-Wl,--rpath,${ORIGIN}",
Dimitry Ivanova36e59b2016-09-01 11:37:39 -070031 "-Wl,--enable-new-dtags",
32 ],
Evgenii Stepanovd957e962023-11-28 15:14:39 -080033 static_libs: ["libbase"],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -070034 relative_install_path: "bionic-loader-test-libs",
35 gtest: false,
Colin Cross2722ebb2016-07-11 16:20:06 -070036 sanitize: {
Evgenii Stepanov0a3637d2016-07-06 13:20:59 -070037 address: false,
Colin Cross2722ebb2016-07-11 16:20:06 -070038 },
Yabin Cui1f553ea2017-01-13 12:31:59 -080039 stl: "libc++_static",
Colin Cross2722ebb2016-07-11 16:20:06 -070040 target: {
41 darwin: {
42 enabled: false,
43 },
44 },
Florian Mayer37b4a152022-10-03 14:29:16 -070045 strip: {
46 none: true,
47 },
Colin Cross2722ebb2016-07-11 16:20:06 -070048}
49
50// -----------------------------------------------------------------------------
Ryan Pricharde4ee12f2019-01-15 20:35:00 -080051// Libraries and helper binaries for ELF TLS
Elliott Hughes9724e932018-03-23 18:46:07 -070052// -----------------------------------------------------------------------------
53cc_test_library {
Ryan Pricharde4ee12f2019-01-15 20:35:00 -080054 name: "libtest_elftls_shared_var",
55 defaults: ["bionic_testlib_defaults"],
56 srcs: ["elftls_shared_var.cpp"],
Ryan Pricharde4ee12f2019-01-15 20:35:00 -080057}
58
59cc_test_library {
60 name: "libtest_elftls_shared_var_ie",
61 defaults: ["bionic_testlib_defaults"],
62 srcs: ["elftls_shared_var_ie.cpp"],
Ryan Pricharde4ee12f2019-01-15 20:35:00 -080063 shared_libs: ["libtest_elftls_shared_var"],
64}
65
66cc_test_library {
67 name: "libtest_elftls_tprel",
68 defaults: ["bionic_testlib_defaults"],
69 srcs: ["elftls_tprel.cpp"],
Ryan Pricharde4ee12f2019-01-15 20:35:00 -080070}
71
72cc_test {
73 name: "elftls_dlopen_ie_error_helper",
74 defaults: ["bionic_testlib_defaults"],
75 srcs: ["elftls_dlopen_ie_error_helper.cpp"],
76 ldflags: ["-Wl,--rpath,${ORIGIN}/.."],
77}
78
Ryan Prichard06d2d792019-01-23 23:19:19 -080079cc_test_library {
80 name: "libtest_elftls_dynamic",
81 defaults: ["bionic_testlib_defaults"],
82 srcs: ["elftls_dynamic.cpp"],
Ryan Prichard06d2d792019-01-23 23:19:19 -080083 shared_libs: ["libtest_elftls_shared_var"],
84}
85
Vy Nguyend5007512020-07-14 17:37:04 -040086cc_test {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +000087 name: "thread_exit_cb_helper",
88 defaults: ["bionic_testlib_defaults"],
89 srcs: ["thread_exit_cb_helper.cpp"],
Vy Nguyend5007512020-07-14 17:37:04 -040090}
91
92cc_test {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +000093 name: "tls_properties_helper",
94 defaults: ["bionic_testlib_defaults"],
95 srcs: ["tls_properties_helper.cpp"],
96 shared_libs: ["libtest_elftls_shared_var"],
Vy Nguyend5007512020-07-14 17:37:04 -040097}
98
Ryan Prichard06d2d792019-01-23 23:19:19 -080099cc_test_library {
100 name: "libtest_elftls_dynamic_filler_1",
101 defaults: ["bionic_testlib_defaults"],
102 srcs: ["elftls_dynamic_filler.cpp"],
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700103 cflags: [
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700104 "-DTLS_FILLER=100",
105 ],
Ryan Prichard06d2d792019-01-23 23:19:19 -0800106}
107
108cc_test_library {
109 name: "libtest_elftls_dynamic_filler_2",
110 defaults: ["bionic_testlib_defaults"],
111 srcs: ["elftls_dynamic_filler.cpp"],
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700112 cflags: [
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700113 "-DTLS_FILLER=200",
114 ],
Ryan Prichard06d2d792019-01-23 23:19:19 -0800115}
116
117cc_test_library {
118 name: "libtest_elftls_dynamic_filler_3",
119 defaults: ["bionic_testlib_defaults"],
120 srcs: ["elftls_dynamic_filler.cpp"],
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700121 cflags: [
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700122 "-DTLS_FILLER=300",
123 ],
Ryan Prichard06d2d792019-01-23 23:19:19 -0800124}
125
Elliott Hughes9724e932018-03-23 18:46:07 -0700126// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -0700127// Library to test gnu-styled hash
128// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700129cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700130 name: "libgnu-hash-table-library",
131 defaults: ["bionic_testlib_defaults"],
132 srcs: ["dlext_test_library.cpp"],
133 ldflags: ["-Wl,--hash-style=gnu"],
Colin Cross2722ebb2016-07-11 16:20:06 -0700134}
135
136// -----------------------------------------------------------------------------
137// Library to test sysv-styled hash
138// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700139cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700140 name: "libsysv-hash-table-library",
141 defaults: ["bionic_testlib_defaults"],
142 srcs: ["dlext_test_library.cpp"],
143 ldflags: ["-Wl,--hash-style=sysv"],
144}
145
146// -----------------------------------------------------------------------------
147// Library used by dlext tests - with GNU RELRO program header
148// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700149cc_test_library {
150 name: "libdlext_test",
151 defaults: ["bionic_testlib_defaults"],
152 srcs: ["dlext_test_library.cpp"],
153 ldflags: ["-Wl,-z,relro"],
154 shared_libs: ["libtest_simple"],
155}
Colin Cross2722ebb2016-07-11 16:20:06 -0700156
157// -----------------------------------------------------------------------------
158// Library used by dlext tests - without GNU RELRO program header
159// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700160cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700161 name: "libdlext_test_norelro",
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700162 defaults: ["bionic_testlib_defaults"],
Colin Cross2722ebb2016-07-11 16:20:06 -0700163 srcs: ["dlext_test_library.cpp"],
164 ldflags: ["-Wl,-z,norelro"],
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800165 shared_libs: ["libtest_simple"],
Colin Cross2722ebb2016-07-11 16:20:06 -0700166}
167
168// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700169// Library used by dlext tests - recursive use of RELRO sharing
170// -----------------------------------------------------------------------------
171cc_test_library {
172 name: "libdlext_test_recursive",
173 defaults: ["bionic_testlib_defaults"],
174 srcs: ["dlext_test_recursive_library.cpp"],
175 ldflags: ["-Wl,-z,relro"],
176 shared_libs: ["libdlext_test"],
177}
178
179// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -0700180// Library used by dlext tests - different name non-default location
181// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700182cc_test_library {
183 name: "libdlext_test_fd",
184 defaults: ["bionic_testlib_defaults"],
185 host_supported: false,
186 srcs: ["dlext_test_library.cpp"],
187 ldflags: ["-Wl,--rpath,${ORIGIN}/.."],
188 relative_install_path: "bionic-loader-test-libs/libdlext_test_fd",
189 shared_libs: ["libtest_simple"],
190}
Colin Cross2722ebb2016-07-11 16:20:06 -0700191
192// -----------------------------------------------------------------------------
193// Libraries used by dlext tests for open from a zip-file
194// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700195cc_test_library {
196 name: "libdlext_test_zip",
197 defaults: ["bionic_testlib_defaults"],
198 host_supported: false,
199 srcs: ["dlext_test_library.cpp"],
200 shared_libs: ["libatest_simple_zip"],
201 relative_install_path: "bionic-loader-test-libs/libdlext_test_zip",
202}
203
204cc_test_library {
205 name: "libatest_simple_zip",
206 defaults: ["bionic_testlib_defaults"],
207 host_supported: false,
208 srcs: ["dlopen_testlib_simple.cpp"],
209 relative_install_path: "bionic-loader-test-libs/libatest_simple_zip",
210}
Colin Cross2722ebb2016-07-11 16:20:06 -0700211
212// ----------------------------------------------------------------------------
213// Library with soname which does not match filename
214// ----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700215cc_test_library {
216 name: "libdlext_test_different_soname",
217 defaults: ["bionic_testlib_defaults"],
218 srcs: ["dlext_test_library.cpp"],
219 ldflags: ["-Wl,-soname=libdlext_test_soname.so"],
220}
Colin Cross2722ebb2016-07-11 16:20:06 -0700221
222// -----------------------------------------------------------------------------
223// Library used by dlext tests - zipped and aligned
224// -----------------------------------------------------------------------------
225// In Android.mk to support zipped and aligned tests
226
227// -----------------------------------------------------------------------------
228// Library used by dlfcn tests
229// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700230cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700231 name: "libtest_simple",
232 defaults: ["bionic_testlib_defaults"],
233 srcs: ["dlopen_testlib_simple.cpp"],
234}
235
236// -----------------------------------------------------------------------------
Florian Mayere65e1932024-02-15 22:20:54 +0000237// Libraries and binaries used by memtag_stack_dlopen_test tests
238// -----------------------------------------------------------------------------
239cc_test_library {
240 name: "libtest_simple_memtag_stack",
241 sanitize: {
242 memtag_stack: true,
243 },
244 srcs: ["dlopen_testlib_simple.cpp"],
245}
246
247cc_test_library {
248 name: "libtest_depends_on_simple_memtag_stack",
249 sanitize: {
250 memtag_stack: false,
251 },
252 shared_libs: [
253 "libtest_simple_memtag_stack",
254 ],
255 srcs: ["dlopen_testlib_depends_on_simple.cpp"],
256}
257
258cc_binary {
259 name: "testbinary_is_stack_mte_after_dlopen",
260 sanitize: {
261 memtag_stack: false,
262 memtag_heap: true,
263 },
264 srcs: ["testbinary_is_stack_mte_after_dlopen.cpp"],
265}
266
267cc_binary {
268 name: "testbinary_depends_on_simple_memtag_stack",
269 sanitize: {
270 memtag_stack: false,
271 memtag_heap: true,
272 },
273 shared_libs: [
274 "libtest_simple_memtag_stack",
275 ],
276 srcs: ["testbinary_is_stack_mte.cpp"],
277}
278
279cc_binary {
280 name: "testbinary_depends_on_depends_on_simple_memtag_stack",
281 sanitize: {
282 memtag_stack: false,
283 memtag_heap: true,
284 },
285 shared_libs: [
286 "libtest_depends_on_simple_memtag_stack",
287 ],
288 srcs: ["testbinary_is_stack_mte.cpp"],
289}
290
291// -----------------------------------------------------------------------------
Florian Mayerc10d0642023-03-22 16:12:49 -0700292// Libraries used by hwasan_test
293// -----------------------------------------------------------------------------
294cc_test_library {
295 name: "libtest_simple_hwasan",
296 arch: {
297 arm64: {
298 enabled: true,
299 },
300 },
301 sanitize: {
302 hwaddress: true,
303 },
304 relative_install_path: "hwasan",
305 enabled: false,
306 srcs: ["dlopen_testlib_simple_hwasan.cpp"],
307}
308
309cc_test_library {
310 // A weird name. This is the vanilla (non-HWASan) copy of the library that
311 // is used for the hwasan test.
312 name: "libtest_simple_hwasan_nohwasan",
313 arch: {
314 arm64: {
315 enabled: true,
316 },
317 },
318 stem: "libtest_simple_hwasan",
319 enabled: false,
320 srcs: ["dlopen_testlib_simple_hwasan.cpp"],
321}
322
323// -----------------------------------------------------------------------------
dimitry965d06d2017-11-28 16:03:07 +0100324// Library used by dlext direct unload on the namespace boundary tests
325// -----------------------------------------------------------------------------
326cc_test_library {
327 name: "libtest_missing_symbol",
328 defaults: ["bionic_testlib_defaults"],
329 srcs: ["dlopen_testlib_missing_symbol.cpp"],
330 allow_undefined_symbols: true,
331 relative_install_path: "bionic-loader-test-libs/public_namespace_libs",
332}
333
dimitry965d06d2017-11-28 16:03:07 +0100334// -----------------------------------------------------------------------------
335// Library used by dlext indirect unload on the namespace boundary tests
336//
337// These libraries produce following dependency graph:
338// libtest_missing_symbol_root (private ns)
339// +-> libbnstest_public (public ns)
340// +-> libtest_missing_symbol_child_public (public ns)
341// +-> libnstest_public (public ns)
342// +-> libtest_missing_symbol_child_private (private_ns)
343// +-> libnstest_public (public_ns)
344//
345// All libraries except libtest_missing_symbol are located in
346// private_namespace_libs/
347// -----------------------------------------------------------------------------
348cc_test_library {
349 name: "libtest_missing_symbol_child_public",
350 defaults: ["bionic_testlib_defaults"],
351 srcs: ["empty.cpp"],
352 relative_install_path: "bionic-loader-test-libs/public_namespace_libs",
353 shared_libs: ["libnstest_public"],
354}
355
356cc_test_library {
357 name: "libtest_missing_symbol_child_private",
358 defaults: ["bionic_testlib_defaults"],
359 srcs: ["empty.cpp"],
360 relative_install_path: "bionic-loader-test-libs/private_namespace_libs",
361 shared_libs: ["libnstest_public"],
362}
363
364cc_test_library {
365 name: "libtest_missing_symbol_root",
366 defaults: ["bionic_testlib_defaults"],
367 srcs: ["dlopen_testlib_missing_symbol.cpp"],
368 relative_install_path: "bionic-loader-test-libs/private_namespace_libs",
369 allow_undefined_symbols: true,
370 shared_libs: [
371 "libnstest_public",
372 "libtest_missing_symbol_child_public",
373 "libtest_missing_symbol_child_private",
374 ],
375}
376
377// -----------------------------------------------------------------------------
378// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -0700379// Library used by dlfcn nodelete tests
380// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700381cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700382 name: "libtest_nodelete_1",
383 defaults: ["bionic_testlib_defaults"],
384 srcs: ["dlopen_nodelete_1.cpp"],
385}
386
387// -----------------------------------------------------------------------------
388// Library used by dlfcn nodelete tests
389// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700390cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700391 name: "libtest_nodelete_2",
392 defaults: ["bionic_testlib_defaults"],
393 srcs: ["dlopen_nodelete_2.cpp"],
394}
395
396// -----------------------------------------------------------------------------
397// Library used by dlfcn nodelete tests
398// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700399cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700400 name: "libtest_nodelete_dt_flags_1",
401 defaults: ["bionic_testlib_defaults"],
402 srcs: ["dlopen_nodelete_dt_flags_1.cpp"],
403 ldflags: ["-Wl,-z,nodelete"],
404}
405
406// -----------------------------------------------------------------------------
407// Build test helper libraries for linker namespaces
dimitry965d06d2017-11-28 16:03:07 +0100408//
409// This set of libraries is used to verify linker namespaces.
410//
411// Test cases
412// 1. Check that private libraries loaded in different namespaces are
413// different. Check that dlsym does not confuse them.
414// 2. Check that public libraries loaded in different namespaces are shared
415// between them.
416// 3. Check that namespace sticks on dlopen
417// 4. Check that having access to shared library (libnstest_public.so)
418// does not expose symbols from dependent library (libnstest_public_internal.so)
419//
420// Dependency tree (visibility)
421// libnstest_root.so (this should be local to the namespace)
422// +-> libnstest_public.so
423// +-> libnstest_public_internal.so
424// +-> libnstest_private.so
425//
426// libnstest_dlopened.so (library in private namespace dlopened from libnstest_root.so)
Colin Cross2722ebb2016-07-11 16:20:06 -0700427// -----------------------------------------------------------------------------
dimitry965d06d2017-11-28 16:03:07 +0100428cc_test_library {
429 name: "libnstest_root",
430 defaults: ["bionic_testlib_defaults"],
431 srcs: ["namespaces_root.cpp"],
432 relative_install_path: "bionic-loader-test-libs/private_namespace_libs",
433 shared_libs: [
434 "libnstest_public",
435 "libnstest_private",
436 ],
437}
438
439cc_test_library {
440 name: "libnstest_public_internal",
441 defaults: ["bionic_testlib_defaults"],
442 srcs: ["namespaces_public_internal.cpp"],
443 relative_install_path: "bionic-loader-test-libs/public_namespace_libs",
444}
445
446cc_test_library {
447 name: "libnstest_public",
448 defaults: ["bionic_testlib_defaults"],
449 srcs: ["namespaces_public.cpp"],
450 relative_install_path: "bionic-loader-test-libs/public_namespace_libs",
451 shared_libs: ["libnstest_public_internal"],
452}
453
454cc_test_library {
455 name: "libnstest_private",
456 defaults: ["bionic_testlib_defaults"],
457 srcs: ["namespaces_private.cpp"],
458 relative_install_path: "bionic-loader-test-libs/private_namespace_libs",
459}
460
461cc_test_library {
462 name: "libnstest_dlopened",
463 defaults: ["bionic_testlib_defaults"],
464 srcs: ["namespaces_dlopened.cpp"],
465 relative_install_path: "bionic-loader-test-libs/private_namespace_libs",
466}
Colin Cross2722ebb2016-07-11 16:20:06 -0700467
468// -----------------------------------------------------------------------------
Logan Chien9ee45912018-01-18 12:05:09 +0800469// Build test helper libraries for linker namespaces for allow all shared libs
470//
471// This set of libraries is used to verify linker namespaces for allow all
472// shared libs.
473//
474// Test cases
475// 1. Check that namespace a exposes libnstest_ns_a_public1 to
476// namespace b while keeping libnstest_ns_a_public1_internal as an
477// internal lib.
478// 2. Check that namespace b exposes all libraries to namespace a.
479//
480// Dependency tree (visibility)
481// libnstest_ns_b_public2.so (ns:b)
482// +-> libnstest_ns_a_public1.so (ns:a)
483// +-> libnstest_ns_a_public2_internal.so (ns:a)
484// +-> libnstest_ns_b_public3.so (ns:b)
485//
486// -----------------------------------------------------------------------------
487cc_test_library {
488 name: "libnstest_ns_a_public1",
489 defaults: ["bionic_testlib_defaults"],
490 srcs: ["libnstest_ns_a_public1.cpp"],
491 relative_install_path: "bionic-loader-test-libs/ns_a",
492 shared_libs: [
493 "libnstest_ns_a_public1_internal",
494 "libnstest_ns_b_public3",
495 ],
496}
497
498cc_test_library {
499 name: "libnstest_ns_a_public1_internal",
500 defaults: ["bionic_testlib_defaults"],
501 srcs: ["libnstest_ns_a_public1_internal.cpp"],
502 relative_install_path: "bionic-loader-test-libs/ns_a",
503}
504
505cc_test_library {
506 name: "libnstest_ns_b_public2",
507 defaults: ["bionic_testlib_defaults"],
508 srcs: ["libnstest_ns_b_public2.cpp"],
509 relative_install_path: "bionic-loader-test-libs/ns_b",
510 shared_libs: ["libnstest_ns_a_public1"],
511}
512
513cc_test_library {
514 name: "libnstest_ns_b_public3",
515 defaults: ["bionic_testlib_defaults"],
516 srcs: ["libnstest_ns_b_public3.cpp"],
517 relative_install_path: "bionic-loader-test-libs/ns_b",
518}
519
520// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700521// Build test helper libraries for linker namespaces
522//
523// This set of libraries is to test isolated namespaces
524//
525// Isolated namespaces do not allow loading of the library outside of
526// the search paths.
527//
528// This library cannot be loaded in isolated namespace because one of DT_NEEDED
529// libraries is outside of the search paths.
530//
531// libnstest_root_not_isolated.so (DT_RUNPATH = $ORIGIN/../private_namespace_libs_external/)
532// +-> libnstest_public.so
533// +-> libnstest_private_external.so (located in $ORIGIN/../private_namespace_libs_external/)
534//
535// Search path: $NATIVE_TESTS/private_namespace_libs/
536//
Colin Cross2722ebb2016-07-11 16:20:06 -0700537// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700538
539cc_test_library {
540 name: "libnstest_root_not_isolated",
541 defaults: ["bionic_testlib_defaults"],
542 host_supported: false,
543 srcs: ["namespaces_root.cpp"],
544 shared_libs: [
545 "libnstest_public",
546 "libnstest_private_external",
547 ],
548 relative_install_path: "bionic-loader-test-libs/private_namespace_libs",
549 ldflags: ["-Wl,--rpath,$ORIGIN/../private_namespace_libs_external"],
550}
551
552cc_test_library {
553 name: "libnstest_private_external",
554 defaults: ["bionic_testlib_defaults"],
555 host_supported: false,
556 srcs: ["namespaces_private.cpp"],
557 relative_install_path: "bionic-loader-test-libs/private_namespace_libs_external",
558}
559
560// -----------------------------------------------------------------------------
Ryan Prichard22fa3dd2020-01-31 14:47:48 -0800561// ns_hidden_child linker namespace test
562// -----------------------------------------------------------------------------
563
564cc_test {
565 name: "ns_hidden_child_helper",
566 host_supported: false,
567 defaults: ["bionic_testlib_defaults"],
568 srcs: ["ns_hidden_child_helper.cpp"],
569 shared_libs: [
570 "libns_hidden_child_internal",
571 "libns_hidden_child_global",
572 "libdl_android",
573 ],
574 ldflags: ["-Wl,--rpath,${ORIGIN}/.."],
575}
576
577cc_test_library {
578 name: "libns_hidden_child_global",
579 defaults: ["bionic_testlib_defaults"],
580 host_supported: false,
581 srcs: ["ns_hidden_child_global.cpp"],
582 shared_libs: ["libns_hidden_child_internal"],
583 ldflags: ["-Wl,-z,global"],
584}
585
586cc_test_library {
587 name: "libns_hidden_child_internal",
588 defaults: ["bionic_testlib_defaults"],
589 host_supported: false,
590 srcs: ["ns_hidden_child_internal.cpp"],
591}
592
593cc_test_library {
594 name: "libns_hidden_child_public",
595 defaults: ["bionic_testlib_defaults"],
596 host_supported: false,
597 srcs: ["ns_hidden_child_public.cpp"],
598 shared_libs: ["libns_hidden_child_internal"],
599}
600
601cc_test_library {
602 name: "libns_hidden_child_app",
603 defaults: ["bionic_testlib_defaults"],
604 host_supported: false,
605 srcs: ["ns_hidden_child_app.cpp"],
606 shared_libs: ["libns_hidden_child_public"],
607 relative_install_path: "bionic-loader-test-libs/ns_hidden_child_app",
608}
609
610// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700611// Build DT_RUNPATH test helper libraries
612//
613// Dependencies
614//
615// libtest_dt_runpath_d.so runpath: ${ORIGIN}/dt_runpath_b_c_x, ${ORIGIN}/dt_runpath_y/${LIB}
616// |-> dt_runpath_b_c_x/libtest_dt_runpath_b.so runpath: ${ORIGIN}/../dt_runpath_a
617// | |-> dt_runpath_a/libtest_dt_runpath_a.so
618// |-> dt_runpath_b_c_x/libtest_dt_runpath_c.so runpath: ${ORIGIN}/invalid_dt_runpath
619// | |-> libtest_dt_runpath_a.so (soname)
620// |-> dt_runpath_y/lib[64]/libtest_dt_runpath_y.so
621//
622// This one is used to test dlopen
623// dt_runpath_b_c_x/libtest_dt_runpath_x.so
624//
625// -----------------------------------------------------------------------------
626
627// A leaf library in a non-standard directory.
628cc_test_library {
629 name: "libtest_dt_runpath_a",
630 defaults: ["bionic_testlib_defaults"],
631 srcs: ["empty.cpp"],
632 relative_install_path: "bionic-loader-test-libs/dt_runpath_a",
633}
634
635// Depends on library A with a DT_RUNPATH
636cc_test_library {
637 name: "libtest_dt_runpath_b",
638 defaults: ["bionic_testlib_defaults"],
639 srcs: ["empty.cpp"],
640 shared_libs: ["libtest_dt_runpath_a"],
641 relative_install_path: "bionic-loader-test-libs/dt_runpath_b_c_x",
642 ldflags: ["-Wl,--rpath,${ORIGIN}/../dt_runpath_a"],
643}
644
645// Depends on library A with an incorrect DT_RUNPATH. This does not matter
646// because B is the first in the D (below) dependency order, and library A
647// is already loaded using the correct DT_RUNPATH from library B.
648cc_test_library {
649 name: "libtest_dt_runpath_c",
650 defaults: ["bionic_testlib_defaults"],
651 srcs: ["empty.cpp"],
652 shared_libs: ["libtest_dt_runpath_a"],
653 relative_install_path: "bionic-loader-test-libs/dt_runpath_b_c_x",
654 ldflags: ["-Wl,--rpath,${ORIGIN}/invalid_dt_runpath"],
655}
656
657// D depends on B, C, and Y with DT_RUNPATH.
658cc_test_library {
659 name: "libtest_dt_runpath_d",
660 defaults: ["bionic_testlib_defaults"],
661 srcs: ["dlopen_b.cpp"],
662 shared_libs: [
663 "libtest_dt_runpath_b",
664 "libtest_dt_runpath_c",
665 "libtest_dt_runpath_y",
666 ],
667 ldflags: [
668 "-Wl,--rpath,${ORIGIN}/dt_runpath_b_c_x",
669 "-Wl,--rpath,${ORIGIN}/dt_runpath_y/${LIB}",
670 ],
671}
672
673// D version for open-from-zip test with runpath
674cc_test_library {
675 name: "libtest_dt_runpath_d_zip",
676 srcs: ["dlopen_b.cpp"],
677 shared_libs: [
678 "libtest_dt_runpath_b",
679 "libtest_dt_runpath_c",
680 "libtest_dt_runpath_y",
681 ],
682 cflags: [
683 "-Wall",
684 "-Werror",
685 ],
686 gtest: false,
687 relative_install_path: "libtest_dt_runpath_d_zip",
688 ldflags: [
689 "-Wl,--rpath,${ORIGIN}/dt_runpath_b_c_x",
690 "-Wl,--rpath,${ORIGIN}/dt_runpath_y/${LIB}",
691 ],
692 sanitize: {
693 address: false,
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700694 },
695 stl: "libc++_static",
696 target: {
697 darwin: {
698 enabled: false,
699 },
700 },
701}
702
703// A leaf library in a directory library D has DT_RUNPATH for.
704cc_test_library {
705 name: "libtest_dt_runpath_x",
706 defaults: ["bionic_testlib_defaults"],
707 srcs: ["empty.cpp"],
708 relative_install_path: "bionic-loader-test-libs/dt_runpath_b_c_x",
709}
710
711// A leaf library in lib or lib64 directory
712cc_test_library {
713 name: "libtest_dt_runpath_y",
714 defaults: ["bionic_testlib_defaults"],
715 srcs: ["empty.cpp"],
716
717 multilib: {
718 lib32: {
719 relative_install_path: "bionic-loader-test-libs/dt_runpath_y/lib",
720 },
721 lib64: {
722 relative_install_path: "bionic-loader-test-libs/dt_runpath_y/lib64",
723 },
724 },
725}
Colin Cross2722ebb2016-07-11 16:20:06 -0700726
727// -----------------------------------------------------------------------------
728// Build library with two parents
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700729//
730// Libraries used by dlfcn tests to verify local group ref_counting
731// libtest_two_parents*.so
Colin Cross2722ebb2016-07-11 16:20:06 -0700732// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700733
734// ..._child.so - correct answer
735cc_test_library {
736 name: "libtest_two_parents_child",
737 defaults: ["bionic_testlib_defaults"],
738 srcs: ["dlopen_2_parents_reloc_answer.cpp"],
739}
740
741// ..._parent1.so - correct answer
742cc_test_library {
743 name: "libtest_two_parents_parent1",
744 defaults: ["bionic_testlib_defaults"],
745 srcs: ["dlopen_check_order_reloc_answer_impl.cpp"],
746 shared_libs: ["libtest_two_parents_child"],
747 cflags: ["-D__ANSWER=42"],
748}
749
750// ..._parent2.so - incorrect answer
751cc_test_library {
752 name: "libtest_two_parents_parent2",
753 defaults: ["bionic_testlib_defaults"],
754 srcs: ["dlopen_check_order_reloc_answer_impl.cpp"],
755 shared_libs: ["libtest_two_parents_child"],
756 cflags: ["-D__ANSWER=1"],
757}
Colin Cross2722ebb2016-07-11 16:20:06 -0700758
759// -----------------------------------------------------------------------------
760// Build libtest_check_order_dlsym.so with its dependencies.
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700761//
762// Libraries used by dlfcn tests to verify correct load order:
Colin Cross2722ebb2016-07-11 16:20:06 -0700763// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700764
765// libtest_check_order_2_right.so
766cc_test_library {
767 name: "libtest_check_order_dlsym_2_right",
768 defaults: ["bionic_testlib_defaults"],
769 srcs: ["dlopen_check_order_dlsym_answer.cpp"],
770 cflags: ["-D__ANSWER=42"],
771}
772
773// libtest_check_order_a.so
774cc_test_library {
775 name: "libtest_check_order_dlsym_a",
776 defaults: ["bionic_testlib_defaults"],
777 srcs: ["dlopen_check_order_dlsym_answer.cpp"],
778 cflags: ["-D__ANSWER=1"],
779}
780
781// libtest_check_order_b.so
782cc_test_library {
783 name: "libtest_check_order_dlsym_b",
784 defaults: ["bionic_testlib_defaults"],
785 srcs: ["dlopen_check_order_dlsym_answer.cpp"],
786 cflags: [
787 "-D__ANSWER=2",
788 "-D__ANSWER2=43",
789 ],
790}
791
792// libtest_check_order_c.so
793cc_test_library {
794 name: "libtest_check_order_dlsym_3_c",
795 defaults: ["bionic_testlib_defaults"],
796 srcs: ["dlopen_check_order_dlsym_answer.cpp"],
797 cflags: ["-D__ANSWER=3"],
798}
799
800// libtest_check_order_d.so
801cc_test_library {
802 name: "libtest_check_order_dlsym_d",
803 defaults: ["bionic_testlib_defaults"],
804 shared_libs: ["libtest_check_order_dlsym_b"],
805 srcs: ["dlopen_check_order_dlsym_answer.cpp"],
806 cflags: [
807 "-D__ANSWER=4",
808 "-D__ANSWER2=4",
809 ],
810}
811
812// libtest_check_order_left.so
813cc_test_library {
814 name: "libtest_check_order_dlsym_1_left",
815 defaults: ["bionic_testlib_defaults"],
816 shared_libs: [
817 "libtest_check_order_dlsym_a",
818 "libtest_check_order_dlsym_b",
819 ],
820 srcs: ["empty.cpp"],
821}
822
823// libtest_check_order.so
824cc_test_library {
825 name: "libtest_check_order_dlsym",
826 defaults: ["bionic_testlib_defaults"],
827 shared_libs: [
828 "libtest_check_order_dlsym_1_left",
829 "libtest_check_order_dlsym_2_right",
830 "libtest_check_order_dlsym_3_c",
831 ],
832 srcs: ["empty.cpp"],
833}
Colin Cross2722ebb2016-07-11 16:20:06 -0700834
835// -----------------------------------------------------------------------------
836// Build libtest_check_order_siblings.so with its dependencies.
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700837//
838// Libraries used by dlfcn tests to verify correct relocation order:
839// libtest_check_order_reloc_siblings*.so
Colin Cross2722ebb2016-07-11 16:20:06 -0700840// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700841
842// ..._1.so - empty
843cc_test_library {
844 name: "libtest_check_order_reloc_siblings_1",
845 defaults: ["bionic_testlib_defaults"],
846 shared_libs: [
847 "libtest_check_order_reloc_siblings_a",
848 "libtest_check_order_reloc_siblings_b",
849 ],
850 srcs: ["empty.cpp"],
851}
852
853// ..._2.so - empty
854cc_test_library {
855 name: "libtest_check_order_reloc_siblings_2",
856 defaults: ["bionic_testlib_defaults"],
857 shared_libs: [
858 "libtest_check_order_reloc_siblings_c",
859 "libtest_check_order_reloc_siblings_d",
860 ],
861 srcs: [
862 "dlopen_check_order_reloc_grandchild_answer.cpp",
863 ],
864 allow_undefined_symbols: true,
865}
866
867// ..._3.so - get_answer2();
868cc_test_library {
869 name: "libtest_check_order_reloc_siblings_3",
870 defaults: ["bionic_testlib_defaults"],
871 shared_libs: [
872 "libtest_check_order_reloc_siblings_e",
873 "libtest_check_order_reloc_siblings_f",
874 ],
875 srcs: [
876 "dlopen_check_order_reloc_nephew_answer.cpp",
877 ],
878}
879
880// ..._a.so <- correct impl
881cc_test_library {
882 name: "libtest_check_order_reloc_siblings_a",
883 defaults: ["bionic_testlib_defaults"],
884 srcs: [
885 "dlopen_check_order_reloc_answer_impl.cpp",
886 ],
887 cflags: ["-D__ANSWER=42"],
888}
889
890// ..._b.so
891cc_test_library {
892 name: "libtest_check_order_reloc_siblings_b",
893 defaults: ["bionic_testlib_defaults"],
894 srcs: [
895 "dlopen_check_order_reloc_answer_impl.cpp",
896 ],
897 cflags: ["-D__ANSWER=1"],
898}
899
900// ..._c.so
901cc_test_library {
902 name: "libtest_check_order_reloc_siblings_c",
903 defaults: ["bionic_testlib_defaults"],
904 shared_libs: [
905 "libtest_check_order_reloc_siblings_c_1",
906 "libtest_check_order_reloc_siblings_c_2",
907 ],
908 srcs: [
909 "dlopen_check_order_reloc_answer_impl.cpp",
910 ],
911 cflags: ["-D__ANSWER=2"],
912}
913
914// ..._d.so
915cc_test_library {
916 name: "libtest_check_order_reloc_siblings_d",
917 defaults: ["bionic_testlib_defaults"],
918 srcs: [
919 "dlopen_check_order_reloc_answer_impl.cpp",
920 ],
921 cflags: ["-D__ANSWER=3"],
922}
923
924// ..._e.so
925cc_test_library {
926 name: "libtest_check_order_reloc_siblings_e",
927 defaults: ["bionic_testlib_defaults"],
928 srcs: [
929 "dlopen_check_order_reloc_answer_impl.cpp",
930 ],
931 cflags: [
932 "-D__ANSWER=4",
933 ],
934}
935
936// ..._f.so <- get_answer()
937cc_test_library {
938 name: "libtest_check_order_reloc_siblings_f",
939 defaults: ["bionic_testlib_defaults"],
940 srcs: [
941 "dlopen_check_order_reloc_answer.cpp",
942 ],
943}
944
945// ..._c_1.so
946cc_test_library {
947 name: "libtest_check_order_reloc_siblings_c_1",
948 defaults: ["bionic_testlib_defaults"],
949 srcs: [
950 "dlopen_check_order_reloc_grandchild_answer_impl.cpp",
951 ],
952 cflags: ["-D__ANSWER=42"],
953}
954
955// ..._c_2.so
956cc_test_library {
957 name: "libtest_check_order_reloc_siblings_c_2",
958 defaults: ["bionic_testlib_defaults"],
959 srcs: [
960 "dlopen_check_order_reloc_grandchild_answer_impl.cpp",
961 ],
962 cflags: ["-D__ANSWER=0"],
963}
964
965// libtest_check_order_reloc_siblings.so
966cc_test_library {
967 name: "libtest_check_order_reloc_siblings",
968 defaults: ["bionic_testlib_defaults"],
969 shared_libs: [
970 "libtest_check_order_reloc_siblings_1",
971 "libtest_check_order_reloc_siblings_2",
972 "libtest_check_order_reloc_siblings_3",
973 ],
974 srcs: [
975 "empty.cpp",
976 ],
977}
Colin Cross2722ebb2016-07-11 16:20:06 -0700978
979// -----------------------------------------------------------------------------
980// Build libtest_check_order_root.so with its dependencies.
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700981//
982// Libraries used by dlfcn tests to verify correct relocation order:
983// libtest_check_order_reloc_root*.so
Colin Cross2722ebb2016-07-11 16:20:06 -0700984// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700985
986// ..._1.so - empty
987cc_test_library {
988 name: "libtest_check_order_reloc_root_1",
989 defaults: ["bionic_testlib_defaults"],
990 srcs: ["empty.cpp"],
991}
992
993// ..._2.so - this one has the incorrect answer
994cc_test_library {
995 name: "libtest_check_order_reloc_root_2",
996 defaults: ["bionic_testlib_defaults"],
997 srcs: ["dlopen_check_order_reloc_root_answer_impl.cpp"],
998 cflags: ["-D__ANSWER=2"],
999}
1000
1001// libtest_check_order_reloc_root.so <- implements get_answer3()
1002cc_test_library {
1003 name: "libtest_check_order_reloc_root",
1004 defaults: ["bionic_testlib_defaults"],
1005 srcs: ["dlopen_check_order_reloc_root_answer.cpp"],
1006 shared_libs: [
1007 "libtest_check_order_reloc_root_1",
1008 "libtest_check_order_reloc_root_2",
1009 ],
1010}
Colin Cross2722ebb2016-07-11 16:20:06 -07001011
1012// -----------------------------------------------------------------------------
1013// Build libtest_versioned_lib.so with its dependencies.
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -07001014//
1015// Libraries used to test versioned symbols
Colin Cross2722ebb2016-07-11 16:20:06 -07001016// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -07001017
1018cc_test_library {
1019 name: "libtest_versioned_uselibv1",
1020 defaults: ["bionic_testlib_defaults"],
1021 srcs: ["versioned_uselib.cpp"],
1022 shared_libs: ["libtest_versioned_libv1"],
1023}
1024
1025cc_test_library {
1026 name: "libtest_versioned_uselibv2",
1027 defaults: ["bionic_testlib_defaults"],
1028 srcs: ["versioned_uselib.cpp"],
1029 shared_libs: ["libtest_versioned_libv2"],
1030 version_script: "versioned_uselib.map",
1031}
1032
1033cc_test_library {
1034 name: "libtest_versioned_uselibv2_other",
1035 defaults: ["bionic_testlib_defaults"],
1036 srcs: ["versioned_uselib.cpp"],
1037 shared_libs: [
1038 "libtest_versioned_otherlib_empty",
1039 "libtest_versioned_libv2",
1040 ],
1041}
1042
1043cc_test_library {
1044 name: "libtest_versioned_uselibv3_other",
1045 defaults: ["bionic_testlib_defaults"],
1046 srcs: ["versioned_uselib.cpp"],
1047 shared_libs: [
1048 "libtest_versioned_otherlib_empty",
1049 "libtest_versioned_lib",
1050 ],
1051}
1052
1053// lib v1 - this one used during static linking but never used at runtime
1054// which forces libtest_versioned_uselibv1 to use function v1 from
1055// libtest_versioned_lib.so
1056cc_test_library {
1057 name: "libtest_versioned_libv1",
1058 defaults: ["bionic_testlib_defaults"],
1059 srcs: ["versioned_lib_v1.cpp"],
1060 version_script: "versioned_lib_v1.map",
1061 ldflags: ["-Wl,-soname,libtest_versioned_lib.so"],
1062}
1063
1064// lib v2 - to make libtest_versioned_uselibv2.so use version 2 of versioned_function()
1065cc_test_library {
1066 name: "libtest_versioned_libv2",
1067 defaults: ["bionic_testlib_defaults"],
1068 srcs: ["versioned_lib_v2.cpp"],
1069 version_script: "versioned_lib_v2.map",
1070 ldflags: ["-Wl,-soname,libtest_versioned_lib.so"],
1071}
1072
1073// last version - this one is used at the runtime and exports 3 versions
1074// of versioned_symbol().
1075cc_test_library {
1076 name: "libtest_versioned_lib",
1077 defaults: ["bionic_testlib_defaults"],
1078 srcs: ["versioned_lib_v3.cpp"],
1079 version_script: "versioned_lib_v3.map",
1080}
1081
1082// This library is empty, the actual implementation will provide an unversioned
1083// symbol for versioned_function().
1084cc_test_library {
1085 name: "libtest_versioned_otherlib_empty",
1086 defaults: ["bionic_testlib_defaults"],
1087 srcs: ["empty.cpp"],
1088 ldflags: ["-Wl,-soname,libtest_versioned_otherlib.so"],
1089}
1090
1091cc_test_library {
1092 name: "libtest_versioned_otherlib",
1093 defaults: ["bionic_testlib_defaults"],
1094 srcs: ["versioned_lib_other.cpp"],
1095 version_script: "versioned_lib_other.map",
1096}
Colin Cross2722ebb2016-07-11 16:20:06 -07001097
1098// -----------------------------------------------------------------------------
1099// Build libraries needed by pthread_atfork tests
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -07001100
1101// This library used to test phtread_atfork handler behaviour
1102// during/after dlclose.
Colin Cross2722ebb2016-07-11 16:20:06 -07001103// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -07001104cc_test_library {
1105 name: "libtest_pthread_atfork",
1106 defaults: ["bionic_testlib_defaults"],
1107 srcs: ["pthread_atfork.cpp"],
1108}
Colin Cross2722ebb2016-07-11 16:20:06 -07001109
1110// -----------------------------------------------------------------------------
1111// Library with dependency loop used by dlfcn tests
1112//
1113// libtest_with_dependency_loop -> a -> b -> c -> a
1114// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001115cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001116 name: "libtest_with_dependency_loop",
1117 defaults: ["bionic_testlib_defaults"],
1118 srcs: ["dlopen_testlib_loopy_root.cpp"],
1119 shared_libs: ["libtest_with_dependency_loop_a"],
1120}
1121
1122// -----------------------------------------------------------------------------
1123// libtest_with_dependency_loop_a.so
1124// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001125cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001126 name: "libtest_with_dependency_loop_a",
1127 defaults: ["bionic_testlib_defaults"],
1128 srcs: ["dlopen_testlib_loopy_a.cpp"],
1129 shared_libs: ["libtest_with_dependency_loop_b_tmp"],
1130}
1131
1132// -----------------------------------------------------------------------------
1133// libtest_with_dependency_loop_b.so
1134//
1135// this is temporary placeholder - will be removed
1136// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001137cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001138 name: "libtest_with_dependency_loop_b_tmp",
1139 defaults: ["bionic_testlib_defaults"],
1140 srcs: ["dlopen_testlib_loopy_invalid.cpp"],
1141 ldflags: ["-Wl,-soname=libtest_with_dependency_loop_b.so"],
1142}
1143
1144// -----------------------------------------------------------------------------
1145// libtest_with_dependency_loop_b.so
1146// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001147cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001148 name: "libtest_with_dependency_loop_b",
1149 defaults: ["bionic_testlib_defaults"],
1150 srcs: ["dlopen_testlib_loopy_b.cpp"],
1151 shared_libs: ["libtest_with_dependency_loop_c"],
1152}
1153
1154// -----------------------------------------------------------------------------
1155// libtest_with_dependency_loop_c.so
1156// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001157cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001158 name: "libtest_with_dependency_loop_c",
1159 defaults: ["bionic_testlib_defaults"],
1160 srcs: ["dlopen_testlib_loopy_c.cpp"],
1161 shared_libs: ["libtest_with_dependency_loop_a"],
1162}
1163
1164// -----------------------------------------------------------------------------
1165// libtest_relo_check_dt_needed_order.so
1166// |
1167// +-> libtest_relo_check_dt_needed_order_1.so
1168// |
1169// +-> libtest_relo_check_dt_needed_order_2.so
1170// -----------------------------------------------------------------------------
1171
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001172cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001173 name: "libtest_relo_check_dt_needed_order",
1174 defaults: ["bionic_testlib_defaults"],
1175 srcs: ["dlopen_testlib_relo_check_dt_needed_order.cpp"],
1176 shared_libs: [
1177 "libtest_relo_check_dt_needed_order_1",
1178 "libtest_relo_check_dt_needed_order_2",
1179 ],
1180}
1181
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001182cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001183 name: "libtest_relo_check_dt_needed_order_1",
1184 defaults: ["bionic_testlib_defaults"],
1185 srcs: ["dlopen_testlib_relo_check_dt_needed_order_1.cpp"],
1186}
1187
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001188cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001189 name: "libtest_relo_check_dt_needed_order_2",
1190 defaults: ["bionic_testlib_defaults"],
1191 srcs: ["dlopen_testlib_relo_check_dt_needed_order_2.cpp"],
1192}
1193
1194// -----------------------------------------------------------------------------
1195// Library with dependency used by dlfcn tests
1196// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -07001197cc_test_library {
1198 name: "libtest_with_dependency",
1199 defaults: ["bionic_testlib_defaults"],
1200 srcs: ["dlopen_testlib_simple.cpp"],
1201 shared_libs: ["libdlext_test"],
1202}
Colin Cross2722ebb2016-07-11 16:20:06 -07001203
1204// -----------------------------------------------------------------------------
1205// Library used by ifunc tests
1206// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001207cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001208 name: "libtest_ifunc",
1209 defaults: ["bionic_testlib_defaults"],
Dimitry Ivanov21975b22017-05-02 16:31:56 -07001210 srcs: ["dlopen_testlib_ifunc.cpp"],
Dimitry Ivanov21975b22017-05-02 16:31:56 -07001211}
1212
1213cc_test_library {
1214 name: "libtest_ifunc_variable",
1215 defaults: ["bionic_testlib_defaults"],
1216 srcs: ["dlopen_testlib_ifunc_variable.cpp"],
Elliott Hughesd50a1de2018-02-05 17:30:57 -08001217 shared_libs: ["libtest_ifunc_variable_impl"],
Dimitry Ivanov21975b22017-05-02 16:31:56 -07001218}
1219
1220cc_test_library {
1221 name: "libtest_ifunc_variable_impl",
1222 defaults: ["bionic_testlib_defaults"],
1223 srcs: ["dlopen_testlib_ifunc_variable_impl.cpp"],
Colin Cross2722ebb2016-07-11 16:20:06 -07001224}
1225
1226// -----------------------------------------------------------------------------
1227// Library used by atexit tests
1228// -----------------------------------------------------------------------------
1229
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001230cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001231 name: "libtest_atexit",
1232 defaults: ["bionic_testlib_defaults"],
1233 srcs: ["atexit_testlib.cpp"],
1234}
1235
1236// -----------------------------------------------------------------------------
1237// This library is used by dl_load test to check symbol preempting
1238// by main executable
1239// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001240cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001241 name: "libdl_preempt_test_1",
1242 defaults: ["bionic_testlib_defaults"],
1243 srcs: ["dl_preempt_library_1.cpp"],
1244}
1245
1246// -----------------------------------------------------------------------------
1247// This library is used by dl_load test to check symbol preempting
1248// by libdl_preempt_test_1.so
1249// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001250cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001251 name: "libdl_preempt_test_2",
1252 defaults: ["bionic_testlib_defaults"],
1253 srcs: ["dl_preempt_library_2.cpp"],
1254}
1255
1256// -----------------------------------------------------------------------------
1257// Library with DF_1_GLOBAL
1258// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001259cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001260 name: "libdl_test_df_1_global",
1261 defaults: ["bionic_testlib_defaults"],
1262 srcs: ["dl_df_1_global.cpp"],
1263 ldflags: ["-Wl,-z,global"],
Colin Cross2722ebb2016-07-11 16:20:06 -07001264}
1265
1266// -----------------------------------------------------------------------------
1267// Library using symbol from libdl_test_df_1_global
1268// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001269cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001270 name: "libtest_dlsym_df_1_global",
1271 defaults: ["bionic_testlib_defaults"],
1272 srcs: ["dl_df_1_use_global.cpp"],
1273}
1274
1275// -----------------------------------------------------------------------------
Jiyong Park01162f22017-10-16 15:31:09 +09001276// Library with DF_1_GLOBAL which will be dlopened
1277// (note: libdl_test_df_1_global above will be included in DT_NEEDED)
1278// -----------------------------------------------------------------------------
1279cc_test_library {
1280 name: "libtest_dlopen_df_1_global",
1281 defaults: ["bionic_testlib_defaults"],
1282 srcs: ["dl_df_1_global_dummy.cpp"],
1283 ldflags: ["-Wl,-z,global"],
Jiyong Park01162f22017-10-16 15:31:09 +09001284}
1285
Jiyong Park01162f22017-10-16 15:31:09 +09001286// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -07001287// Library with weak function
1288// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001289cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001290 name: "libtest_dlsym_weak_func",
1291 defaults: ["bionic_testlib_defaults"],
1292 srcs: ["dlsym_weak_function.cpp"],
1293}
1294
1295// -----------------------------------------------------------------------------
1296// Library to check RTLD_LOCAL with dlsym in 'this'
1297// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001298cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001299 name: "libtest_dlsym_from_this",
1300 defaults: ["bionic_testlib_defaults"],
1301 srcs: ["dlsym_from_this_symbol.cpp"],
1302 shared_libs: ["libtest_dlsym_from_this_child"],
Colin Cross2722ebb2016-07-11 16:20:06 -07001303}
1304
1305// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001306cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001307 name: "libtest_dlsym_from_this_child",
1308 defaults: ["bionic_testlib_defaults"],
1309 srcs: ["dlsym_from_this_functions.cpp"],
1310 shared_libs: ["libtest_dlsym_from_this_grandchild"],
1311}
1312
1313// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001314cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001315 name: "libtest_dlsym_from_this_grandchild",
1316 defaults: ["bionic_testlib_defaults"],
1317 srcs: ["dlsym_from_this_symbol2.cpp"],
1318}
1319
1320// -----------------------------------------------------------------------------
1321// Empty library
1322// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001323cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001324 name: "libtest_empty",
1325 defaults: ["bionic_testlib_defaults"],
1326 srcs: ["empty.cpp"],
1327}
1328
1329// -----------------------------------------------------------------------------
dimitry8db36a52017-10-23 15:10:10 +02001330// Library for inaccessible shared library test
1331// -----------------------------------------------------------------------------
1332cc_test_library {
1333 name: "libtestshared",
1334 defaults: ["bionic_testlib_defaults"],
1335 srcs: ["empty.cpp"],
Nan Zhangdab0fd52017-11-07 11:05:24 -08001336 relative_install_path: "bionic-loader-test-libs/inaccessible_libs",
dimitry8db36a52017-10-23 15:10:10 +02001337}
1338
1339// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -07001340// Library with weak undefined function
1341// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001342cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001343 name: "libtest_dlopen_weak_undefined_func",
1344 defaults: ["bionic_testlib_defaults"],
1345 srcs: ["dlopen_weak_undefined.cpp"],
1346}
1347
1348// -----------------------------------------------------------------------------
Dimitry Ivanovd0b5c3a2016-11-25 12:23:11 -08001349// Check that RTLD_NEXT of a libc symbol works in dlopened library
1350// -----------------------------------------------------------------------------
1351cc_test_library {
1352 name: "libtest_check_rtld_next_from_library",
1353 defaults: ["bionic_testlib_defaults"],
1354 srcs: ["check_rtld_next_from_library.cpp"],
Pirama Arumuga Nainar8035caa2020-06-09 12:48:10 -07001355 native_coverage: false,
Dimitry Ivanovd0b5c3a2016-11-25 12:23:11 -08001356}
1357
1358// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -07001359// Library with constructor that calls dlopen() b/7941716
1360// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001361cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001362 name: "libtest_dlopen_from_ctor",
1363 defaults: ["bionic_testlib_defaults"],
1364 srcs: ["dlopen_testlib_dlopen_from_ctor.cpp"],
Colin Cross2722ebb2016-07-11 16:20:06 -07001365}
1366
1367// -----------------------------------------------------------------------------
Dimitry Ivanovec90e242017-02-10 11:04:20 -08001368// Libraries used to check init/fini call order
Dimitry Ivanovea8f3962017-02-09 13:31:57 -08001369// -----------------------------------------------------------------------------
1370cc_test_library {
1371 name: "libtest_init_fini_order_root",
1372 defaults: ["bionic_testlib_defaults"],
1373 srcs: ["dlopen_check_init_fini_root.cpp"],
Dimitry Ivanovec90e242017-02-10 11:04:20 -08001374 shared_libs: [
1375 "libtest_init_fini_order_child",
1376 "libtest_init_fini_order_grand_child",
1377 ],
1378}
1379
1380cc_test_library {
1381 name: "libtest_init_fini_order_root2",
1382 defaults: ["bionic_testlib_defaults"],
1383 srcs: ["dlopen_check_init_fini_root.cpp"],
1384 shared_libs: [
1385 "libtest_init_fini_order_grand_child",
1386 "libtest_init_fini_order_child",
1387 ],
Dimitry Ivanovea8f3962017-02-09 13:31:57 -08001388}
1389
1390cc_test_library {
1391 name: "libtest_init_fini_order_child",
1392 defaults: ["bionic_testlib_defaults"],
1393 srcs: ["dlopen_check_init_fini_child.cpp"],
1394 shared_libs: ["libtest_init_fini_order_grand_child"],
1395}
1396
1397cc_test_library {
1398 name: "libtest_init_fini_order_grand_child",
1399 defaults: ["bionic_testlib_defaults"],
1400 srcs: ["dlopen_check_init_fini_grand_child.cpp"],
1401}
1402
1403// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -07001404// Library that depends on the library with constructor that calls dlopen() b/7941716
1405// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001406cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001407 name: "libtest_dlopen_from_ctor_main",
1408 defaults: ["bionic_testlib_defaults"],
1409 srcs: ["empty.cpp"],
1410 shared_libs: ["libtest_dlopen_from_ctor"],
1411}
1412
1413// -----------------------------------------------------------------------------
dimitry55547db2018-05-25 14:17:37 +02001414// Libraries with non-trivial thread_local variable to test dlclose()
dimitry06016f22018-01-05 11:39:28 +01001415// -----------------------------------------------------------------------------
1416cc_test_library {
1417 name: "libtest_thread_local_dtor",
1418 defaults: ["bionic_testlib_defaults"],
1419 srcs: ["thread_local_dtor.cpp"],
1420}
1421
dimitry55547db2018-05-25 14:17:37 +02001422cc_test_library {
1423 name: "libtest_thread_local_dtor2",
1424 defaults: ["bionic_testlib_defaults"],
1425 srcs: ["thread_local_dtor2.cpp"],
1426}
1427
1428// -----------------------------------------------------------------------------
1429// Library dt_needs libtest_thread_local_dtor/2 (to check no-unload on load_group)
1430// -----------------------------------------------------------------------------
1431cc_test_library {
1432 name: "libtest_indirect_thread_local_dtor",
1433 defaults: ["bionic_testlib_defaults"],
1434 srcs: ["empty.cpp"],
1435 shared_libs: [
1436 "libtest_thread_local_dtor",
1437 "libtest_thread_local_dtor2",
1438 ],
1439}
1440
dimitry06016f22018-01-05 11:39:28 +01001441// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -07001442// Tool to use to align the shared libraries in a zip file.
1443// -----------------------------------------------------------------------------
1444cc_binary_host {
1445 name: "bionic_tests_zipalign",
1446 srcs: ["bionic_tests_zipalign.cpp"],
1447 cflags: [
1448 "-Wall",
1449 "-Werror",
1450 ],
1451
1452 static_libs: [
1453 "libziparchive",
1454 "liblog",
1455 "libbase",
1456 "libz",
1457 "libutils",
1458 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001459}
Evgenii Stepanov0a3637d2016-07-06 13:20:59 -07001460
1461cc_test_library {
1462 name: "libcfi-test",
1463 defaults: ["bionic_testlib_defaults"],
1464 srcs: ["cfi_test_lib.cpp"],
1465 sanitize: {
1466 cfi: false,
1467 },
1468}
1469
1470cc_test_library {
1471 name: "libcfi-test-bad",
1472 defaults: ["bionic_testlib_defaults"],
1473 srcs: ["cfi_test_bad_lib.cpp"],
1474 sanitize: {
1475 cfi: false,
1476 },
1477}
Evgenii Stepanov68ecec12017-01-31 13:19:30 -08001478
1479cc_test {
1480 name: "cfi_test_helper",
1481 host_supported: false,
1482 defaults: ["bionic_testlib_defaults"],
1483 srcs: ["cfi_test_helper.cpp"],
1484 ldflags: ["-rdynamic"],
1485}
1486
1487cc_test {
1488 name: "cfi_test_helper2",
1489 host_supported: false,
1490 defaults: ["bionic_testlib_defaults"],
1491 srcs: ["cfi_test_helper2.cpp"],
1492 shared_libs: ["libcfi-test"],
1493 ldflags: ["-Wl,--rpath,${ORIGIN}/.."],
1494}
Elliott Hugheseb04ed52017-03-29 13:48:02 -07001495
1496cc_test {
1497 name: "preinit_getauxval_test_helper",
1498 host_supported: false,
1499 defaults: ["bionic_testlib_defaults"],
1500 srcs: ["preinit_getauxval_test_helper.cpp"],
1501}
1502
1503cc_test {
1504 name: "preinit_syscall_test_helper",
1505 host_supported: false,
1506 defaults: ["bionic_testlib_defaults"],
1507 srcs: ["preinit_syscall_test_helper.cpp"],
1508}
Jiyong Park02586a22017-05-20 01:01:24 +09001509
1510cc_test {
1511 name: "ld_preload_test_helper",
1512 host_supported: false,
1513 defaults: ["bionic_testlib_defaults"],
1514 srcs: ["ld_preload_test_helper.cpp"],
1515 shared_libs: ["ld_preload_test_helper_lib1"],
1516 ldflags: ["-Wl,--rpath,${ORIGIN}/.."],
1517}
1518
1519cc_test_library {
1520 name: "ld_preload_test_helper_lib1",
1521 host_supported: false,
1522 defaults: ["bionic_testlib_defaults"],
1523 srcs: ["ld_preload_test_helper_lib1.cpp"],
1524}
1525
1526cc_test_library {
1527 name: "ld_preload_test_helper_lib2",
1528 host_supported: false,
1529 defaults: ["bionic_testlib_defaults"],
1530 srcs: ["ld_preload_test_helper_lib2.cpp"],
1531}
1532
1533cc_test {
1534 name: "ld_config_test_helper",
1535 host_supported: false,
1536 defaults: ["bionic_testlib_defaults"],
1537 srcs: ["ld_config_test_helper.cpp"],
1538 shared_libs: ["ld_config_test_helper_lib1"],
1539 ldflags: ["-Wl,--rpath,${ORIGIN}/.."],
1540}
1541
1542cc_test_library {
1543 name: "ld_config_test_helper_lib1",
1544 host_supported: false,
1545 defaults: ["bionic_testlib_defaults"],
1546 srcs: ["ld_config_test_helper_lib1.cpp"],
1547 shared_libs: ["ld_config_test_helper_lib2"],
Nan Zhangdab0fd52017-11-07 11:05:24 -08001548 relative_install_path: "bionic-loader-test-libs/ns2",
Ryan Prichard058eb8f2020-12-17 22:59:04 -08001549 // Mark the library DF_1_GLOBAL so it is added to every linker namespace.
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001550 ldflags: ["-Wl,-z,global"],
Jiyong Park02586a22017-05-20 01:01:24 +09001551}
1552
1553cc_test_library {
1554 name: "ld_config_test_helper_lib2",
1555 host_supported: false,
1556 defaults: ["bionic_testlib_defaults"],
1557 srcs: ["ld_config_test_helper_lib2.cpp"],
Nan Zhangdab0fd52017-11-07 11:05:24 -08001558 relative_install_path: "bionic-loader-test-libs/ns2",
Jiyong Park02586a22017-05-20 01:01:24 +09001559}
1560
1561cc_test_library {
1562 name: "ld_config_test_helper_lib3",
1563 host_supported: false,
1564 defaults: ["bionic_testlib_defaults"],
1565 srcs: ["ld_config_test_helper_lib3.cpp"],
1566}
Ryan Prichard8f639a42018-10-01 23:10:05 -07001567
1568cc_test {
1569 name: "exec_linker_helper",
1570 host_supported: false,
1571 defaults: ["bionic_testlib_defaults"],
1572 srcs: ["exec_linker_helper.cpp"],
1573 shared_libs: ["exec_linker_helper_lib"],
1574 ldflags: ["-Wl,--rpath,${ORIGIN}/.."],
1575}
1576
1577cc_test_library {
1578 name: "exec_linker_helper_lib",
1579 host_supported: false,
1580 defaults: ["bionic_testlib_defaults"],
1581 srcs: ["exec_linker_helper_lib.cpp"],
1582}
Peter Collingbourneb39cb3c2019-03-01 13:12:49 -08001583
1584cc_test_library {
1585 name: "libsegment_gap_outer",
1586 host_supported: false,
1587 defaults: ["bionic_testlib_defaults"],
1588 srcs: ["segment_gap_outer.cpp"],
1589 ldflags: ["-Wl,-T,bionic/tests/libs/segment_gap_outer.lds"],
1590}
1591
1592cc_test_library {
1593 name: "libsegment_gap_inner",
1594 host_supported: false,
1595 defaults: ["bionic_testlib_defaults"],
1596 srcs: ["segment_gap_inner.cpp"],
1597}
Elliott Hughes6663f552020-01-24 14:36:10 -08001598
Elliott Hughes6663f552020-01-24 14:36:10 -08001599// -----------------------------------------------------------------------------
Elliott Hughes6dd1f582020-01-28 12:18:35 -08001600// Check that we support all kinds of relocations: regular, "relocation packer",
1601// and both the old and new SHT_RELR constants.
Elliott Hughes6663f552020-01-24 14:36:10 -08001602// -----------------------------------------------------------------------------
1603
Elliott Hughes6dd1f582020-01-28 12:18:35 -08001604// This is what got standardized for SHT_RELR.
Elliott Hughes6663f552020-01-24 14:36:10 -08001605cc_test_library {
Elliott Hughes6dd1f582020-01-28 12:18:35 -08001606 name: "librelocations-RELR",
1607 ldflags: [
1608 "-Wl,--pack-dyn-relocs=relr",
1609 "-Wl,--no-use-android-relr-tags",
1610 ],
Elliott Hughes6663f552020-01-24 14:36:10 -08001611 host_supported: false,
1612 defaults: ["bionic_testlib_defaults"],
Elliott Hughes6dd1f582020-01-28 12:18:35 -08001613 srcs: ["relocations.cpp"],
Elliott Hughes6663f552020-01-24 14:36:10 -08001614}
1615
Elliott Hughes6dd1f582020-01-28 12:18:35 -08001616// This is the same encoding as SHT_RELR, but using OS-specific constants.
Elliott Hughes6663f552020-01-24 14:36:10 -08001617cc_test_library {
Elliott Hughes6dd1f582020-01-28 12:18:35 -08001618 name: "librelocations-ANDROID_RELR",
1619 ldflags: [
1620 "-Wl,--pack-dyn-relocs=relr",
1621 "-Wl,--use-android-relr-tags",
1622 ],
Elliott Hughes6663f552020-01-24 14:36:10 -08001623 host_supported: false,
1624 defaults: ["bionic_testlib_defaults"],
Elliott Hughes6dd1f582020-01-28 12:18:35 -08001625 srcs: ["relocations.cpp"],
1626}
1627
1628// This is the old relocation packer encoding (DT_ANDROID_REL/DT_ANDROID_RELA).
1629cc_test_library {
1630 name: "librelocations-ANDROID_REL",
1631 ldflags: ["-Wl,--pack-dyn-relocs=android"],
1632 host_supported: false,
1633 defaults: ["bionic_testlib_defaults"],
1634 srcs: ["relocations.cpp"],
1635}
1636
1637// This is not packed at all.
1638cc_test_library {
1639 name: "librelocations-fat",
1640 ldflags: ["-Wl,--pack-dyn-relocs=none"],
1641 host_supported: false,
1642 defaults: ["bionic_testlib_defaults"],
1643 srcs: ["relocations.cpp"],
Elliott Hughes6663f552020-01-24 14:36:10 -08001644}
Evgenii Stepanov51741fb2021-01-06 16:03:15 -08001645
1646cc_defaults {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001647 name: "bionic_targets_only",
1648 enabled: false,
1649 target: {
1650 android: {
1651 enabled: true,
1652 },
1653 linux_bionic: {
1654 enabled: true,
1655 },
1656 },
Evgenii Stepanov51741fb2021-01-06 16:03:15 -08001657}
1658
1659cc_test {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001660 name: "heap_tagging_sync_helper",
1661 defaults: [
1662 "bionic_testlib_defaults",
1663 "bionic_targets_only",
1664 ],
1665 srcs: ["heap_tagging_helper.cpp"],
1666 sanitize: {
1667 memtag_heap: true,
1668 diag: {
1669 memtag_heap: true,
1670 },
1671 hwaddress: false,
1672 },
Evgenii Stepanov51741fb2021-01-06 16:03:15 -08001673}
1674
1675cc_test {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001676 name: "heap_tagging_async_helper",
1677 defaults: [
1678 "bionic_testlib_defaults",
1679 "bionic_targets_only",
1680 ],
1681 srcs: ["heap_tagging_helper.cpp"],
1682 sanitize: {
1683 memtag_heap: true,
1684 diag: {
1685 memtag_heap: false,
1686 },
1687 hwaddress: false,
1688 },
Evgenii Stepanov51741fb2021-01-06 16:03:15 -08001689}
1690
1691cc_test {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001692 name: "heap_tagging_disabled_helper",
1693 defaults: [
1694 "bionic_testlib_defaults",
1695 "bionic_targets_only",
1696 ],
1697 srcs: ["heap_tagging_helper.cpp"],
1698 sanitize: {
1699 memtag_heap: false,
1700 hwaddress: false,
1701 },
Evgenii Stepanov51741fb2021-01-06 16:03:15 -08001702}
1703
1704cc_test {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001705 name: "heap_tagging_static_sync_helper",
1706 defaults: [
1707 "bionic_testlib_defaults",
1708 "bionic_targets_only",
1709 ],
1710 srcs: ["heap_tagging_helper.cpp"],
1711 static_executable: true,
1712 sanitize: {
1713 memtag_heap: true,
1714 diag: {
1715 memtag_heap: true,
1716 },
1717 hwaddress: false,
1718 },
Evgenii Stepanov51741fb2021-01-06 16:03:15 -08001719}
1720
1721cc_test {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001722 name: "heap_tagging_static_async_helper",
1723 defaults: [
1724 "bionic_testlib_defaults",
1725 "bionic_targets_only",
1726 ],
1727 srcs: ["heap_tagging_helper.cpp"],
1728 static_executable: true,
1729 sanitize: {
1730 memtag_heap: true,
1731 diag: {
1732 memtag_heap: false,
1733 },
1734 hwaddress: false,
1735 },
Evgenii Stepanov51741fb2021-01-06 16:03:15 -08001736}
1737
1738cc_test {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001739 name: "heap_tagging_static_disabled_helper",
1740 defaults: [
1741 "bionic_testlib_defaults",
1742 "bionic_targets_only",
1743 ],
1744 srcs: ["heap_tagging_helper.cpp"],
1745 static_executable: true,
1746 sanitize: {
1747 memtag_heap: false,
1748 hwaddress: false,
1749 },
Evgenii Stepanov51741fb2021-01-06 16:03:15 -08001750}
Colin Crossbadcb382021-09-24 17:49:58 -07001751
Florian Mayerc82d7fc2022-08-31 20:57:03 +00001752cc_test {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001753 name: "stack_tagging_helper",
1754 defaults: [
1755 "bionic_testlib_defaults",
1756 "bionic_targets_only",
1757 ],
1758 srcs: ["stack_tagging_helper.cpp"],
1759 sanitize: {
1760 memtag_heap: true,
1761 memtag_stack: true,
1762 diag: {
1763 memtag_heap: true,
1764 },
1765 hwaddress: false,
1766 },
1767 header_libs: ["bionic_libc_platform_headers"],
1768 cflags: ["-fexceptions"],
Florian Mayerc82d7fc2022-08-31 20:57:03 +00001769}
1770
1771cc_test {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001772 name: "stack_tagging_static_helper",
1773 defaults: [
1774 "bionic_testlib_defaults",
1775 "bionic_targets_only",
1776 ],
1777 srcs: ["stack_tagging_helper.cpp"],
1778 static_executable: true,
1779 sanitize: {
1780 memtag_heap: true,
1781 memtag_stack: true,
1782 diag: {
1783 memtag_heap: true,
1784 },
1785 hwaddress: false,
1786 },
1787 header_libs: ["bionic_libc_platform_headers"],
1788 cflags: ["-fexceptions"],
Florian Mayerc82d7fc2022-08-31 20:57:03 +00001789}
1790
Colin Crossbadcb382021-09-24 17:49:58 -07001791cc_genrule {
1792 name: "libdlext_test_zip_zipaligned",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001793 out: ["bionic-loader-test-libs/libdlext_test_zip/libdlext_test_zip_zipaligned.zip"],
Colin Crossbadcb382021-09-24 17:49:58 -07001794 tools: [
1795 "soong_zip",
1796 "bionic_tests_zipalign",
1797 ],
1798 srcs: [
1799 ":libdlext_test_zip",
1800 ":libatest_simple_zip",
1801 ":exec_linker_helper",
1802 ":exec_linker_helper_lib",
1803 ],
1804 cmd: "mkdir -p $(genDir)/zipdir/libdir &&" +
1805 " cp $(in) $(genDir)/zipdir/libdir/ &&" +
1806 " touch $(genDir)/zipdir/empty_file.txt &&" +
1807 " $(location soong_zip) -o $(out).unaligned -L 0 -C $(genDir)/zipdir -D $(genDir)/zipdir &&" +
1808 " $(location bionic_tests_zipalign) 4096 $(out).unaligned $(out)",
1809
Colin Crossbadcb382021-09-24 17:49:58 -07001810}
1811
1812cc_genrule {
1813 name: "libdlext_test_runpath_zip_zipaligned",
1814 out: ["bionic-loader-test-libs/libdlext_test_runpath_zip/libdlext_test_runpath_zip_zipaligned.zip"],
1815 tools: [
1816 "soong_zip",
1817 "bionic_tests_zipalign",
1818 ],
1819 srcs: [
1820 ":libtest_dt_runpath_d_zip",
1821 ":libtest_dt_runpath_a",
1822 ":libtest_dt_runpath_b",
1823 ":libtest_dt_runpath_c",
1824 ":libtest_dt_runpath_x",
1825 ":libtest_dt_runpath_y",
1826 ],
1827 cmd: "mkdir -p $(genDir)/zipdir/libdir &&" +
1828 " if [[ \"$$CC_MULTILIB\" = lib32 ]]; then" +
1829 " PRIVATE_LIB_OR_LIB64=lib;" +
1830 " else" +
1831 " PRIVATE_LIB_OR_LIB64=lib64;" +
1832 " fi &&" +
1833 " if [[ -n \"$$CC_NATIVE_BRIDGE\" ]]; then" +
1834 " PRIVATE_LIB_OR_LIB64=$$PRIVATE_LIB_OR_LIB64/$$CC_NATIVE_BRIDGE;" +
1835 " fi &&" +
1836 " mkdir -p $(genDir)/zipdir/libdir/dt_runpath_a &&" +
1837 " mkdir -p $(genDir)/zipdir/libdir/dt_runpath_b_c_x &&" +
1838 " mkdir -p $(genDir)/zipdir/libdir/dt_runpath_y/$$PRIVATE_LIB_OR_LIB64 &&" +
1839 " cp $(location :libtest_dt_runpath_d_zip) $(genDir)/zipdir/libdir &&" +
1840 " cp $(location :libtest_dt_runpath_a) $(genDir)/zipdir/libdir/dt_runpath_a &&" +
1841 " cp $(location :libtest_dt_runpath_b) $(genDir)/zipdir/libdir/dt_runpath_b_c_x &&" +
1842 " cp $(location :libtest_dt_runpath_c) $(genDir)/zipdir/libdir/dt_runpath_b_c_x &&" +
1843 " cp $(location :libtest_dt_runpath_x) $(genDir)/zipdir/libdir/dt_runpath_b_c_x &&" +
1844 " cp $(location :libtest_dt_runpath_y) $(genDir)/zipdir/libdir/dt_runpath_y/$$PRIVATE_LIB_OR_LIB64 &&" +
1845 " touch $(genDir)/zipdir/empty_file.txt &&" +
1846 " $(location soong_zip) -o $(out).unaligned -L 0 -C $(genDir)/zipdir -D $(genDir)/zipdir &&" +
1847 " $(location bionic_tests_zipalign) 4096 $(out).unaligned $(out)",
Colin Crossbadcb382021-09-24 17:49:58 -07001848}