blob: fc7fd4096cf1eb379bde22e49898f3275f2942e6 [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
Ryan Prichard98731dc2024-02-29 22:56:36 -0800126cc_test_library {
127 name: "libtest_elftls_dynamic_filler_4",
128 defaults: ["bionic_testlib_defaults"],
129 srcs: ["elftls_dynamic_filler.cpp"],
130 cflags: [
131 "-DTLS_FILLER=400",
132 ],
133}
134
135cc_test_library {
136 name: "libtest_elftls_dynamic_filler_5",
137 defaults: ["bionic_testlib_defaults"],
138 srcs: ["elftls_dynamic_filler.cpp"],
139 cflags: [
140 "-DTLS_FILLER=500",
141 ],
142}
143
144cc_test {
145 name: "elftls_dtv_resize_helper",
146 defaults: [
147 "bionic_testlib_defaults",
148 "bionic_targets_only",
149 ],
150 srcs: ["elftls_dtv_resize_helper.cpp"],
151 include_dirs: [
152 "bionic/libc",
153 ],
154 static_libs: [
155 "libbase",
156 ],
157}
158
Ryan Prichard43963922024-03-14 16:51:27 -0700159cc_test {
160 name: "elftls_align_test_helper",
161 defaults: ["bionic_testlib_defaults"],
162 srcs: ["elftls_align_test_helper.cpp"],
163 stl: "none", // avoid including extra TLS variables in the executable
164}
165
166cc_test {
167 name: "elftls_skew_align_test_helper",
168 defaults: ["bionic_testlib_defaults"],
169 srcs: ["elftls_skew_align_test_helper.cpp"],
170 stl: "none", // avoid including extra TLS variables in the executable
171}
172
Elliott Hughes9724e932018-03-23 18:46:07 -0700173// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -0700174// Library to test gnu-styled hash
175// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700176cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700177 name: "libgnu-hash-table-library",
178 defaults: ["bionic_testlib_defaults"],
179 srcs: ["dlext_test_library.cpp"],
180 ldflags: ["-Wl,--hash-style=gnu"],
Colin Cross2722ebb2016-07-11 16:20:06 -0700181}
182
183// -----------------------------------------------------------------------------
184// Library to test sysv-styled hash
185// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700186cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700187 name: "libsysv-hash-table-library",
188 defaults: ["bionic_testlib_defaults"],
189 srcs: ["dlext_test_library.cpp"],
190 ldflags: ["-Wl,--hash-style=sysv"],
191}
192
193// -----------------------------------------------------------------------------
194// Library used by dlext tests - with GNU RELRO program header
195// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700196cc_test_library {
197 name: "libdlext_test",
198 defaults: ["bionic_testlib_defaults"],
199 srcs: ["dlext_test_library.cpp"],
200 ldflags: ["-Wl,-z,relro"],
201 shared_libs: ["libtest_simple"],
202}
Colin Cross2722ebb2016-07-11 16:20:06 -0700203
204// -----------------------------------------------------------------------------
205// Library used by dlext tests - without GNU RELRO program header
206// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700207cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700208 name: "libdlext_test_norelro",
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700209 defaults: ["bionic_testlib_defaults"],
Colin Cross2722ebb2016-07-11 16:20:06 -0700210 srcs: ["dlext_test_library.cpp"],
211 ldflags: ["-Wl,-z,norelro"],
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800212 shared_libs: ["libtest_simple"],
Colin Cross2722ebb2016-07-11 16:20:06 -0700213}
214
215// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700216// Library used by dlext tests - recursive use of RELRO sharing
217// -----------------------------------------------------------------------------
218cc_test_library {
219 name: "libdlext_test_recursive",
220 defaults: ["bionic_testlib_defaults"],
221 srcs: ["dlext_test_recursive_library.cpp"],
222 ldflags: ["-Wl,-z,relro"],
223 shared_libs: ["libdlext_test"],
224}
225
226// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -0700227// Library used by dlext tests - different name non-default location
228// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700229cc_test_library {
230 name: "libdlext_test_fd",
231 defaults: ["bionic_testlib_defaults"],
232 host_supported: false,
233 srcs: ["dlext_test_library.cpp"],
234 ldflags: ["-Wl,--rpath,${ORIGIN}/.."],
235 relative_install_path: "bionic-loader-test-libs/libdlext_test_fd",
236 shared_libs: ["libtest_simple"],
237}
Colin Cross2722ebb2016-07-11 16:20:06 -0700238
239// -----------------------------------------------------------------------------
240// Libraries used by dlext tests for open from a zip-file
241// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700242cc_test_library {
243 name: "libdlext_test_zip",
244 defaults: ["bionic_testlib_defaults"],
245 host_supported: false,
246 srcs: ["dlext_test_library.cpp"],
247 shared_libs: ["libatest_simple_zip"],
248 relative_install_path: "bionic-loader-test-libs/libdlext_test_zip",
249}
250
251cc_test_library {
252 name: "libatest_simple_zip",
253 defaults: ["bionic_testlib_defaults"],
254 host_supported: false,
255 srcs: ["dlopen_testlib_simple.cpp"],
256 relative_install_path: "bionic-loader-test-libs/libatest_simple_zip",
257}
Colin Cross2722ebb2016-07-11 16:20:06 -0700258
259// ----------------------------------------------------------------------------
260// Library with soname which does not match filename
261// ----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700262cc_test_library {
263 name: "libdlext_test_different_soname",
264 defaults: ["bionic_testlib_defaults"],
265 srcs: ["dlext_test_library.cpp"],
266 ldflags: ["-Wl,-soname=libdlext_test_soname.so"],
267}
Colin Cross2722ebb2016-07-11 16:20:06 -0700268
269// -----------------------------------------------------------------------------
270// Library used by dlext tests - zipped and aligned
271// -----------------------------------------------------------------------------
272// In Android.mk to support zipped and aligned tests
273
274// -----------------------------------------------------------------------------
275// Library used by dlfcn tests
276// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700277cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700278 name: "libtest_simple",
279 defaults: ["bionic_testlib_defaults"],
280 srcs: ["dlopen_testlib_simple.cpp"],
281}
282
283// -----------------------------------------------------------------------------
Florian Mayere65e1932024-02-15 22:20:54 +0000284// Libraries and binaries used by memtag_stack_dlopen_test tests
285// -----------------------------------------------------------------------------
286cc_test_library {
287 name: "libtest_simple_memtag_stack",
288 sanitize: {
289 memtag_stack: true,
290 },
291 srcs: ["dlopen_testlib_simple.cpp"],
292}
293
294cc_test_library {
295 name: "libtest_depends_on_simple_memtag_stack",
296 sanitize: {
297 memtag_stack: false,
298 },
299 shared_libs: [
300 "libtest_simple_memtag_stack",
301 ],
302 srcs: ["dlopen_testlib_depends_on_simple.cpp"],
303}
304
305cc_binary {
306 name: "testbinary_is_stack_mte_after_dlopen",
307 sanitize: {
308 memtag_stack: false,
309 memtag_heap: true,
310 },
311 srcs: ["testbinary_is_stack_mte_after_dlopen.cpp"],
312}
313
314cc_binary {
315 name: "testbinary_depends_on_simple_memtag_stack",
316 sanitize: {
317 memtag_stack: false,
318 memtag_heap: true,
319 },
320 shared_libs: [
321 "libtest_simple_memtag_stack",
322 ],
323 srcs: ["testbinary_is_stack_mte.cpp"],
324}
325
326cc_binary {
327 name: "testbinary_depends_on_depends_on_simple_memtag_stack",
328 sanitize: {
329 memtag_stack: false,
330 memtag_heap: true,
331 },
332 shared_libs: [
333 "libtest_depends_on_simple_memtag_stack",
334 ],
335 srcs: ["testbinary_is_stack_mte.cpp"],
336}
337
338// -----------------------------------------------------------------------------
Florian Mayerc10d0642023-03-22 16:12:49 -0700339// Libraries used by hwasan_test
340// -----------------------------------------------------------------------------
341cc_test_library {
342 name: "libtest_simple_hwasan",
343 arch: {
344 arm64: {
345 enabled: true,
346 },
347 },
348 sanitize: {
349 hwaddress: true,
350 },
351 relative_install_path: "hwasan",
352 enabled: false,
353 srcs: ["dlopen_testlib_simple_hwasan.cpp"],
354}
355
356cc_test_library {
357 // A weird name. This is the vanilla (non-HWASan) copy of the library that
358 // is used for the hwasan test.
359 name: "libtest_simple_hwasan_nohwasan",
360 arch: {
361 arm64: {
362 enabled: true,
363 },
364 },
365 stem: "libtest_simple_hwasan",
366 enabled: false,
367 srcs: ["dlopen_testlib_simple_hwasan.cpp"],
368}
369
370// -----------------------------------------------------------------------------
dimitry965d06d2017-11-28 16:03:07 +0100371// Library used by dlext direct unload on the namespace boundary tests
372// -----------------------------------------------------------------------------
373cc_test_library {
374 name: "libtest_missing_symbol",
375 defaults: ["bionic_testlib_defaults"],
376 srcs: ["dlopen_testlib_missing_symbol.cpp"],
377 allow_undefined_symbols: true,
378 relative_install_path: "bionic-loader-test-libs/public_namespace_libs",
379}
380
dimitry965d06d2017-11-28 16:03:07 +0100381// -----------------------------------------------------------------------------
382// Library used by dlext indirect unload on the namespace boundary tests
383//
384// These libraries produce following dependency graph:
385// libtest_missing_symbol_root (private ns)
386// +-> libbnstest_public (public ns)
387// +-> libtest_missing_symbol_child_public (public ns)
388// +-> libnstest_public (public ns)
389// +-> libtest_missing_symbol_child_private (private_ns)
390// +-> libnstest_public (public_ns)
391//
392// All libraries except libtest_missing_symbol are located in
393// private_namespace_libs/
394// -----------------------------------------------------------------------------
395cc_test_library {
396 name: "libtest_missing_symbol_child_public",
397 defaults: ["bionic_testlib_defaults"],
398 srcs: ["empty.cpp"],
399 relative_install_path: "bionic-loader-test-libs/public_namespace_libs",
400 shared_libs: ["libnstest_public"],
401}
402
403cc_test_library {
404 name: "libtest_missing_symbol_child_private",
405 defaults: ["bionic_testlib_defaults"],
406 srcs: ["empty.cpp"],
407 relative_install_path: "bionic-loader-test-libs/private_namespace_libs",
408 shared_libs: ["libnstest_public"],
409}
410
411cc_test_library {
412 name: "libtest_missing_symbol_root",
413 defaults: ["bionic_testlib_defaults"],
414 srcs: ["dlopen_testlib_missing_symbol.cpp"],
415 relative_install_path: "bionic-loader-test-libs/private_namespace_libs",
416 allow_undefined_symbols: true,
417 shared_libs: [
418 "libnstest_public",
419 "libtest_missing_symbol_child_public",
420 "libtest_missing_symbol_child_private",
421 ],
422}
423
424// -----------------------------------------------------------------------------
425// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -0700426// Library used by dlfcn nodelete tests
427// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700428cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700429 name: "libtest_nodelete_1",
430 defaults: ["bionic_testlib_defaults"],
431 srcs: ["dlopen_nodelete_1.cpp"],
432}
433
434// -----------------------------------------------------------------------------
435// Library used by dlfcn nodelete tests
436// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700437cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700438 name: "libtest_nodelete_2",
439 defaults: ["bionic_testlib_defaults"],
440 srcs: ["dlopen_nodelete_2.cpp"],
441}
442
443// -----------------------------------------------------------------------------
444// Library used by dlfcn nodelete tests
445// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700446cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700447 name: "libtest_nodelete_dt_flags_1",
448 defaults: ["bionic_testlib_defaults"],
449 srcs: ["dlopen_nodelete_dt_flags_1.cpp"],
450 ldflags: ["-Wl,-z,nodelete"],
451}
452
453// -----------------------------------------------------------------------------
454// Build test helper libraries for linker namespaces
dimitry965d06d2017-11-28 16:03:07 +0100455//
456// This set of libraries is used to verify linker namespaces.
457//
458// Test cases
459// 1. Check that private libraries loaded in different namespaces are
460// different. Check that dlsym does not confuse them.
461// 2. Check that public libraries loaded in different namespaces are shared
462// between them.
463// 3. Check that namespace sticks on dlopen
464// 4. Check that having access to shared library (libnstest_public.so)
465// does not expose symbols from dependent library (libnstest_public_internal.so)
466//
467// Dependency tree (visibility)
468// libnstest_root.so (this should be local to the namespace)
469// +-> libnstest_public.so
470// +-> libnstest_public_internal.so
471// +-> libnstest_private.so
472//
473// libnstest_dlopened.so (library in private namespace dlopened from libnstest_root.so)
Colin Cross2722ebb2016-07-11 16:20:06 -0700474// -----------------------------------------------------------------------------
dimitry965d06d2017-11-28 16:03:07 +0100475cc_test_library {
476 name: "libnstest_root",
477 defaults: ["bionic_testlib_defaults"],
478 srcs: ["namespaces_root.cpp"],
479 relative_install_path: "bionic-loader-test-libs/private_namespace_libs",
480 shared_libs: [
481 "libnstest_public",
482 "libnstest_private",
483 ],
484}
485
486cc_test_library {
487 name: "libnstest_public_internal",
488 defaults: ["bionic_testlib_defaults"],
489 srcs: ["namespaces_public_internal.cpp"],
490 relative_install_path: "bionic-loader-test-libs/public_namespace_libs",
491}
492
493cc_test_library {
494 name: "libnstest_public",
495 defaults: ["bionic_testlib_defaults"],
496 srcs: ["namespaces_public.cpp"],
497 relative_install_path: "bionic-loader-test-libs/public_namespace_libs",
498 shared_libs: ["libnstest_public_internal"],
499}
500
501cc_test_library {
502 name: "libnstest_private",
503 defaults: ["bionic_testlib_defaults"],
504 srcs: ["namespaces_private.cpp"],
505 relative_install_path: "bionic-loader-test-libs/private_namespace_libs",
506}
507
508cc_test_library {
509 name: "libnstest_dlopened",
510 defaults: ["bionic_testlib_defaults"],
511 srcs: ["namespaces_dlopened.cpp"],
512 relative_install_path: "bionic-loader-test-libs/private_namespace_libs",
513}
Colin Cross2722ebb2016-07-11 16:20:06 -0700514
515// -----------------------------------------------------------------------------
Logan Chien9ee45912018-01-18 12:05:09 +0800516// Build test helper libraries for linker namespaces for allow all shared libs
517//
518// This set of libraries is used to verify linker namespaces for allow all
519// shared libs.
520//
521// Test cases
522// 1. Check that namespace a exposes libnstest_ns_a_public1 to
523// namespace b while keeping libnstest_ns_a_public1_internal as an
524// internal lib.
525// 2. Check that namespace b exposes all libraries to namespace a.
526//
527// Dependency tree (visibility)
528// libnstest_ns_b_public2.so (ns:b)
529// +-> libnstest_ns_a_public1.so (ns:a)
530// +-> libnstest_ns_a_public2_internal.so (ns:a)
531// +-> libnstest_ns_b_public3.so (ns:b)
532//
533// -----------------------------------------------------------------------------
534cc_test_library {
535 name: "libnstest_ns_a_public1",
536 defaults: ["bionic_testlib_defaults"],
537 srcs: ["libnstest_ns_a_public1.cpp"],
538 relative_install_path: "bionic-loader-test-libs/ns_a",
539 shared_libs: [
540 "libnstest_ns_a_public1_internal",
541 "libnstest_ns_b_public3",
542 ],
543}
544
545cc_test_library {
546 name: "libnstest_ns_a_public1_internal",
547 defaults: ["bionic_testlib_defaults"],
548 srcs: ["libnstest_ns_a_public1_internal.cpp"],
549 relative_install_path: "bionic-loader-test-libs/ns_a",
550}
551
552cc_test_library {
553 name: "libnstest_ns_b_public2",
554 defaults: ["bionic_testlib_defaults"],
555 srcs: ["libnstest_ns_b_public2.cpp"],
556 relative_install_path: "bionic-loader-test-libs/ns_b",
557 shared_libs: ["libnstest_ns_a_public1"],
558}
559
560cc_test_library {
561 name: "libnstest_ns_b_public3",
562 defaults: ["bionic_testlib_defaults"],
563 srcs: ["libnstest_ns_b_public3.cpp"],
564 relative_install_path: "bionic-loader-test-libs/ns_b",
565}
566
567// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700568// Build test helper libraries for linker namespaces
569//
570// This set of libraries is to test isolated namespaces
571//
572// Isolated namespaces do not allow loading of the library outside of
573// the search paths.
574//
575// This library cannot be loaded in isolated namespace because one of DT_NEEDED
576// libraries is outside of the search paths.
577//
578// libnstest_root_not_isolated.so (DT_RUNPATH = $ORIGIN/../private_namespace_libs_external/)
579// +-> libnstest_public.so
580// +-> libnstest_private_external.so (located in $ORIGIN/../private_namespace_libs_external/)
581//
582// Search path: $NATIVE_TESTS/private_namespace_libs/
583//
Colin Cross2722ebb2016-07-11 16:20:06 -0700584// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700585
586cc_test_library {
587 name: "libnstest_root_not_isolated",
588 defaults: ["bionic_testlib_defaults"],
589 host_supported: false,
590 srcs: ["namespaces_root.cpp"],
591 shared_libs: [
592 "libnstest_public",
593 "libnstest_private_external",
594 ],
595 relative_install_path: "bionic-loader-test-libs/private_namespace_libs",
596 ldflags: ["-Wl,--rpath,$ORIGIN/../private_namespace_libs_external"],
597}
598
599cc_test_library {
600 name: "libnstest_private_external",
601 defaults: ["bionic_testlib_defaults"],
602 host_supported: false,
603 srcs: ["namespaces_private.cpp"],
604 relative_install_path: "bionic-loader-test-libs/private_namespace_libs_external",
605}
606
607// -----------------------------------------------------------------------------
Ryan Prichard22fa3dd2020-01-31 14:47:48 -0800608// ns_hidden_child linker namespace test
609// -----------------------------------------------------------------------------
610
611cc_test {
612 name: "ns_hidden_child_helper",
613 host_supported: false,
614 defaults: ["bionic_testlib_defaults"],
615 srcs: ["ns_hidden_child_helper.cpp"],
616 shared_libs: [
617 "libns_hidden_child_internal",
618 "libns_hidden_child_global",
619 "libdl_android",
620 ],
621 ldflags: ["-Wl,--rpath,${ORIGIN}/.."],
622}
623
624cc_test_library {
625 name: "libns_hidden_child_global",
626 defaults: ["bionic_testlib_defaults"],
627 host_supported: false,
628 srcs: ["ns_hidden_child_global.cpp"],
629 shared_libs: ["libns_hidden_child_internal"],
630 ldflags: ["-Wl,-z,global"],
631}
632
633cc_test_library {
634 name: "libns_hidden_child_internal",
635 defaults: ["bionic_testlib_defaults"],
636 host_supported: false,
637 srcs: ["ns_hidden_child_internal.cpp"],
638}
639
640cc_test_library {
641 name: "libns_hidden_child_public",
642 defaults: ["bionic_testlib_defaults"],
643 host_supported: false,
644 srcs: ["ns_hidden_child_public.cpp"],
645 shared_libs: ["libns_hidden_child_internal"],
646}
647
648cc_test_library {
649 name: "libns_hidden_child_app",
650 defaults: ["bionic_testlib_defaults"],
651 host_supported: false,
652 srcs: ["ns_hidden_child_app.cpp"],
653 shared_libs: ["libns_hidden_child_public"],
654 relative_install_path: "bionic-loader-test-libs/ns_hidden_child_app",
655}
656
657// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700658// Build DT_RUNPATH test helper libraries
659//
660// Dependencies
661//
662// libtest_dt_runpath_d.so runpath: ${ORIGIN}/dt_runpath_b_c_x, ${ORIGIN}/dt_runpath_y/${LIB}
663// |-> dt_runpath_b_c_x/libtest_dt_runpath_b.so runpath: ${ORIGIN}/../dt_runpath_a
664// | |-> dt_runpath_a/libtest_dt_runpath_a.so
665// |-> dt_runpath_b_c_x/libtest_dt_runpath_c.so runpath: ${ORIGIN}/invalid_dt_runpath
666// | |-> libtest_dt_runpath_a.so (soname)
667// |-> dt_runpath_y/lib[64]/libtest_dt_runpath_y.so
668//
669// This one is used to test dlopen
670// dt_runpath_b_c_x/libtest_dt_runpath_x.so
671//
672// -----------------------------------------------------------------------------
673
674// A leaf library in a non-standard directory.
675cc_test_library {
676 name: "libtest_dt_runpath_a",
677 defaults: ["bionic_testlib_defaults"],
678 srcs: ["empty.cpp"],
679 relative_install_path: "bionic-loader-test-libs/dt_runpath_a",
680}
681
682// Depends on library A with a DT_RUNPATH
683cc_test_library {
684 name: "libtest_dt_runpath_b",
685 defaults: ["bionic_testlib_defaults"],
686 srcs: ["empty.cpp"],
687 shared_libs: ["libtest_dt_runpath_a"],
688 relative_install_path: "bionic-loader-test-libs/dt_runpath_b_c_x",
689 ldflags: ["-Wl,--rpath,${ORIGIN}/../dt_runpath_a"],
690}
691
692// Depends on library A with an incorrect DT_RUNPATH. This does not matter
693// because B is the first in the D (below) dependency order, and library A
694// is already loaded using the correct DT_RUNPATH from library B.
695cc_test_library {
696 name: "libtest_dt_runpath_c",
697 defaults: ["bionic_testlib_defaults"],
698 srcs: ["empty.cpp"],
699 shared_libs: ["libtest_dt_runpath_a"],
700 relative_install_path: "bionic-loader-test-libs/dt_runpath_b_c_x",
701 ldflags: ["-Wl,--rpath,${ORIGIN}/invalid_dt_runpath"],
702}
703
704// D depends on B, C, and Y with DT_RUNPATH.
705cc_test_library {
706 name: "libtest_dt_runpath_d",
707 defaults: ["bionic_testlib_defaults"],
708 srcs: ["dlopen_b.cpp"],
709 shared_libs: [
710 "libtest_dt_runpath_b",
711 "libtest_dt_runpath_c",
712 "libtest_dt_runpath_y",
713 ],
714 ldflags: [
715 "-Wl,--rpath,${ORIGIN}/dt_runpath_b_c_x",
716 "-Wl,--rpath,${ORIGIN}/dt_runpath_y/${LIB}",
717 ],
718}
719
720// D version for open-from-zip test with runpath
721cc_test_library {
722 name: "libtest_dt_runpath_d_zip",
723 srcs: ["dlopen_b.cpp"],
724 shared_libs: [
725 "libtest_dt_runpath_b",
726 "libtest_dt_runpath_c",
727 "libtest_dt_runpath_y",
728 ],
729 cflags: [
730 "-Wall",
731 "-Werror",
732 ],
733 gtest: false,
734 relative_install_path: "libtest_dt_runpath_d_zip",
735 ldflags: [
736 "-Wl,--rpath,${ORIGIN}/dt_runpath_b_c_x",
737 "-Wl,--rpath,${ORIGIN}/dt_runpath_y/${LIB}",
738 ],
739 sanitize: {
740 address: false,
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700741 },
742 stl: "libc++_static",
743 target: {
744 darwin: {
745 enabled: false,
746 },
747 },
748}
749
750// A leaf library in a directory library D has DT_RUNPATH for.
751cc_test_library {
752 name: "libtest_dt_runpath_x",
753 defaults: ["bionic_testlib_defaults"],
754 srcs: ["empty.cpp"],
755 relative_install_path: "bionic-loader-test-libs/dt_runpath_b_c_x",
756}
757
758// A leaf library in lib or lib64 directory
759cc_test_library {
760 name: "libtest_dt_runpath_y",
761 defaults: ["bionic_testlib_defaults"],
762 srcs: ["empty.cpp"],
763
764 multilib: {
765 lib32: {
766 relative_install_path: "bionic-loader-test-libs/dt_runpath_y/lib",
767 },
768 lib64: {
769 relative_install_path: "bionic-loader-test-libs/dt_runpath_y/lib64",
770 },
771 },
772}
Colin Cross2722ebb2016-07-11 16:20:06 -0700773
774// -----------------------------------------------------------------------------
775// Build library with two parents
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700776//
777// Libraries used by dlfcn tests to verify local group ref_counting
778// libtest_two_parents*.so
Colin Cross2722ebb2016-07-11 16:20:06 -0700779// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700780
781// ..._child.so - correct answer
782cc_test_library {
783 name: "libtest_two_parents_child",
784 defaults: ["bionic_testlib_defaults"],
785 srcs: ["dlopen_2_parents_reloc_answer.cpp"],
786}
787
788// ..._parent1.so - correct answer
789cc_test_library {
790 name: "libtest_two_parents_parent1",
791 defaults: ["bionic_testlib_defaults"],
792 srcs: ["dlopen_check_order_reloc_answer_impl.cpp"],
793 shared_libs: ["libtest_two_parents_child"],
794 cflags: ["-D__ANSWER=42"],
795}
796
797// ..._parent2.so - incorrect answer
798cc_test_library {
799 name: "libtest_two_parents_parent2",
800 defaults: ["bionic_testlib_defaults"],
801 srcs: ["dlopen_check_order_reloc_answer_impl.cpp"],
802 shared_libs: ["libtest_two_parents_child"],
803 cflags: ["-D__ANSWER=1"],
804}
Colin Cross2722ebb2016-07-11 16:20:06 -0700805
806// -----------------------------------------------------------------------------
807// Build libtest_check_order_dlsym.so with its dependencies.
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700808//
809// Libraries used by dlfcn tests to verify correct load order:
Colin Cross2722ebb2016-07-11 16:20:06 -0700810// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700811
812// libtest_check_order_2_right.so
813cc_test_library {
814 name: "libtest_check_order_dlsym_2_right",
815 defaults: ["bionic_testlib_defaults"],
816 srcs: ["dlopen_check_order_dlsym_answer.cpp"],
817 cflags: ["-D__ANSWER=42"],
818}
819
820// libtest_check_order_a.so
821cc_test_library {
822 name: "libtest_check_order_dlsym_a",
823 defaults: ["bionic_testlib_defaults"],
824 srcs: ["dlopen_check_order_dlsym_answer.cpp"],
825 cflags: ["-D__ANSWER=1"],
826}
827
828// libtest_check_order_b.so
829cc_test_library {
830 name: "libtest_check_order_dlsym_b",
831 defaults: ["bionic_testlib_defaults"],
832 srcs: ["dlopen_check_order_dlsym_answer.cpp"],
833 cflags: [
834 "-D__ANSWER=2",
835 "-D__ANSWER2=43",
836 ],
837}
838
839// libtest_check_order_c.so
840cc_test_library {
841 name: "libtest_check_order_dlsym_3_c",
842 defaults: ["bionic_testlib_defaults"],
843 srcs: ["dlopen_check_order_dlsym_answer.cpp"],
844 cflags: ["-D__ANSWER=3"],
845}
846
847// libtest_check_order_d.so
848cc_test_library {
849 name: "libtest_check_order_dlsym_d",
850 defaults: ["bionic_testlib_defaults"],
851 shared_libs: ["libtest_check_order_dlsym_b"],
852 srcs: ["dlopen_check_order_dlsym_answer.cpp"],
853 cflags: [
854 "-D__ANSWER=4",
855 "-D__ANSWER2=4",
856 ],
857}
858
859// libtest_check_order_left.so
860cc_test_library {
861 name: "libtest_check_order_dlsym_1_left",
862 defaults: ["bionic_testlib_defaults"],
863 shared_libs: [
864 "libtest_check_order_dlsym_a",
865 "libtest_check_order_dlsym_b",
866 ],
867 srcs: ["empty.cpp"],
868}
869
870// libtest_check_order.so
871cc_test_library {
872 name: "libtest_check_order_dlsym",
873 defaults: ["bionic_testlib_defaults"],
874 shared_libs: [
875 "libtest_check_order_dlsym_1_left",
876 "libtest_check_order_dlsym_2_right",
877 "libtest_check_order_dlsym_3_c",
878 ],
879 srcs: ["empty.cpp"],
880}
Colin Cross2722ebb2016-07-11 16:20:06 -0700881
882// -----------------------------------------------------------------------------
883// Build libtest_check_order_siblings.so with its dependencies.
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700884//
885// Libraries used by dlfcn tests to verify correct relocation order:
886// libtest_check_order_reloc_siblings*.so
Colin Cross2722ebb2016-07-11 16:20:06 -0700887// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700888
889// ..._1.so - empty
890cc_test_library {
891 name: "libtest_check_order_reloc_siblings_1",
892 defaults: ["bionic_testlib_defaults"],
893 shared_libs: [
894 "libtest_check_order_reloc_siblings_a",
895 "libtest_check_order_reloc_siblings_b",
896 ],
897 srcs: ["empty.cpp"],
898}
899
900// ..._2.so - empty
901cc_test_library {
902 name: "libtest_check_order_reloc_siblings_2",
903 defaults: ["bionic_testlib_defaults"],
904 shared_libs: [
905 "libtest_check_order_reloc_siblings_c",
906 "libtest_check_order_reloc_siblings_d",
907 ],
908 srcs: [
909 "dlopen_check_order_reloc_grandchild_answer.cpp",
910 ],
911 allow_undefined_symbols: true,
912}
913
914// ..._3.so - get_answer2();
915cc_test_library {
916 name: "libtest_check_order_reloc_siblings_3",
917 defaults: ["bionic_testlib_defaults"],
918 shared_libs: [
919 "libtest_check_order_reloc_siblings_e",
920 "libtest_check_order_reloc_siblings_f",
921 ],
922 srcs: [
923 "dlopen_check_order_reloc_nephew_answer.cpp",
924 ],
925}
926
927// ..._a.so <- correct impl
928cc_test_library {
929 name: "libtest_check_order_reloc_siblings_a",
930 defaults: ["bionic_testlib_defaults"],
931 srcs: [
932 "dlopen_check_order_reloc_answer_impl.cpp",
933 ],
934 cflags: ["-D__ANSWER=42"],
935}
936
937// ..._b.so
938cc_test_library {
939 name: "libtest_check_order_reloc_siblings_b",
940 defaults: ["bionic_testlib_defaults"],
941 srcs: [
942 "dlopen_check_order_reloc_answer_impl.cpp",
943 ],
944 cflags: ["-D__ANSWER=1"],
945}
946
947// ..._c.so
948cc_test_library {
949 name: "libtest_check_order_reloc_siblings_c",
950 defaults: ["bionic_testlib_defaults"],
951 shared_libs: [
952 "libtest_check_order_reloc_siblings_c_1",
953 "libtest_check_order_reloc_siblings_c_2",
954 ],
955 srcs: [
956 "dlopen_check_order_reloc_answer_impl.cpp",
957 ],
958 cflags: ["-D__ANSWER=2"],
959}
960
961// ..._d.so
962cc_test_library {
963 name: "libtest_check_order_reloc_siblings_d",
964 defaults: ["bionic_testlib_defaults"],
965 srcs: [
966 "dlopen_check_order_reloc_answer_impl.cpp",
967 ],
968 cflags: ["-D__ANSWER=3"],
969}
970
971// ..._e.so
972cc_test_library {
973 name: "libtest_check_order_reloc_siblings_e",
974 defaults: ["bionic_testlib_defaults"],
975 srcs: [
976 "dlopen_check_order_reloc_answer_impl.cpp",
977 ],
978 cflags: [
979 "-D__ANSWER=4",
980 ],
981}
982
983// ..._f.so <- get_answer()
984cc_test_library {
985 name: "libtest_check_order_reloc_siblings_f",
986 defaults: ["bionic_testlib_defaults"],
987 srcs: [
988 "dlopen_check_order_reloc_answer.cpp",
989 ],
990}
991
992// ..._c_1.so
993cc_test_library {
994 name: "libtest_check_order_reloc_siblings_c_1",
995 defaults: ["bionic_testlib_defaults"],
996 srcs: [
997 "dlopen_check_order_reloc_grandchild_answer_impl.cpp",
998 ],
999 cflags: ["-D__ANSWER=42"],
1000}
1001
1002// ..._c_2.so
1003cc_test_library {
1004 name: "libtest_check_order_reloc_siblings_c_2",
1005 defaults: ["bionic_testlib_defaults"],
1006 srcs: [
1007 "dlopen_check_order_reloc_grandchild_answer_impl.cpp",
1008 ],
1009 cflags: ["-D__ANSWER=0"],
1010}
1011
1012// libtest_check_order_reloc_siblings.so
1013cc_test_library {
1014 name: "libtest_check_order_reloc_siblings",
1015 defaults: ["bionic_testlib_defaults"],
1016 shared_libs: [
1017 "libtest_check_order_reloc_siblings_1",
1018 "libtest_check_order_reloc_siblings_2",
1019 "libtest_check_order_reloc_siblings_3",
1020 ],
1021 srcs: [
1022 "empty.cpp",
1023 ],
1024}
Colin Cross2722ebb2016-07-11 16:20:06 -07001025
1026// -----------------------------------------------------------------------------
1027// Build libtest_check_order_root.so with its dependencies.
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -07001028//
1029// Libraries used by dlfcn tests to verify correct relocation order:
1030// libtest_check_order_reloc_root*.so
Colin Cross2722ebb2016-07-11 16:20:06 -07001031// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -07001032
1033// ..._1.so - empty
1034cc_test_library {
1035 name: "libtest_check_order_reloc_root_1",
1036 defaults: ["bionic_testlib_defaults"],
1037 srcs: ["empty.cpp"],
1038}
1039
1040// ..._2.so - this one has the incorrect answer
1041cc_test_library {
1042 name: "libtest_check_order_reloc_root_2",
1043 defaults: ["bionic_testlib_defaults"],
1044 srcs: ["dlopen_check_order_reloc_root_answer_impl.cpp"],
1045 cflags: ["-D__ANSWER=2"],
1046}
1047
1048// libtest_check_order_reloc_root.so <- implements get_answer3()
1049cc_test_library {
1050 name: "libtest_check_order_reloc_root",
1051 defaults: ["bionic_testlib_defaults"],
1052 srcs: ["dlopen_check_order_reloc_root_answer.cpp"],
1053 shared_libs: [
1054 "libtest_check_order_reloc_root_1",
1055 "libtest_check_order_reloc_root_2",
1056 ],
1057}
Colin Cross2722ebb2016-07-11 16:20:06 -07001058
1059// -----------------------------------------------------------------------------
1060// Build libtest_versioned_lib.so with its dependencies.
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -07001061//
1062// Libraries used to test versioned symbols
Colin Cross2722ebb2016-07-11 16:20:06 -07001063// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -07001064
1065cc_test_library {
1066 name: "libtest_versioned_uselibv1",
1067 defaults: ["bionic_testlib_defaults"],
1068 srcs: ["versioned_uselib.cpp"],
1069 shared_libs: ["libtest_versioned_libv1"],
1070}
1071
1072cc_test_library {
1073 name: "libtest_versioned_uselibv2",
1074 defaults: ["bionic_testlib_defaults"],
1075 srcs: ["versioned_uselib.cpp"],
1076 shared_libs: ["libtest_versioned_libv2"],
1077 version_script: "versioned_uselib.map",
1078}
1079
1080cc_test_library {
1081 name: "libtest_versioned_uselibv2_other",
1082 defaults: ["bionic_testlib_defaults"],
1083 srcs: ["versioned_uselib.cpp"],
1084 shared_libs: [
1085 "libtest_versioned_otherlib_empty",
1086 "libtest_versioned_libv2",
1087 ],
1088}
1089
1090cc_test_library {
1091 name: "libtest_versioned_uselibv3_other",
1092 defaults: ["bionic_testlib_defaults"],
1093 srcs: ["versioned_uselib.cpp"],
1094 shared_libs: [
1095 "libtest_versioned_otherlib_empty",
1096 "libtest_versioned_lib",
1097 ],
1098}
1099
1100// lib v1 - this one used during static linking but never used at runtime
1101// which forces libtest_versioned_uselibv1 to use function v1 from
1102// libtest_versioned_lib.so
1103cc_test_library {
1104 name: "libtest_versioned_libv1",
1105 defaults: ["bionic_testlib_defaults"],
1106 srcs: ["versioned_lib_v1.cpp"],
1107 version_script: "versioned_lib_v1.map",
1108 ldflags: ["-Wl,-soname,libtest_versioned_lib.so"],
1109}
1110
1111// lib v2 - to make libtest_versioned_uselibv2.so use version 2 of versioned_function()
1112cc_test_library {
1113 name: "libtest_versioned_libv2",
1114 defaults: ["bionic_testlib_defaults"],
1115 srcs: ["versioned_lib_v2.cpp"],
1116 version_script: "versioned_lib_v2.map",
1117 ldflags: ["-Wl,-soname,libtest_versioned_lib.so"],
1118}
1119
1120// last version - this one is used at the runtime and exports 3 versions
1121// of versioned_symbol().
1122cc_test_library {
1123 name: "libtest_versioned_lib",
1124 defaults: ["bionic_testlib_defaults"],
1125 srcs: ["versioned_lib_v3.cpp"],
1126 version_script: "versioned_lib_v3.map",
1127}
1128
1129// This library is empty, the actual implementation will provide an unversioned
1130// symbol for versioned_function().
1131cc_test_library {
1132 name: "libtest_versioned_otherlib_empty",
1133 defaults: ["bionic_testlib_defaults"],
1134 srcs: ["empty.cpp"],
1135 ldflags: ["-Wl,-soname,libtest_versioned_otherlib.so"],
1136}
1137
1138cc_test_library {
1139 name: "libtest_versioned_otherlib",
1140 defaults: ["bionic_testlib_defaults"],
1141 srcs: ["versioned_lib_other.cpp"],
1142 version_script: "versioned_lib_other.map",
1143}
Colin Cross2722ebb2016-07-11 16:20:06 -07001144
1145// -----------------------------------------------------------------------------
1146// Build libraries needed by pthread_atfork tests
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -07001147
1148// This library used to test phtread_atfork handler behaviour
1149// during/after dlclose.
Colin Cross2722ebb2016-07-11 16:20:06 -07001150// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -07001151cc_test_library {
1152 name: "libtest_pthread_atfork",
1153 defaults: ["bionic_testlib_defaults"],
1154 srcs: ["pthread_atfork.cpp"],
1155}
Colin Cross2722ebb2016-07-11 16:20:06 -07001156
1157// -----------------------------------------------------------------------------
1158// Library with dependency loop used by dlfcn tests
1159//
1160// libtest_with_dependency_loop -> a -> b -> c -> a
1161// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001162cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001163 name: "libtest_with_dependency_loop",
1164 defaults: ["bionic_testlib_defaults"],
1165 srcs: ["dlopen_testlib_loopy_root.cpp"],
1166 shared_libs: ["libtest_with_dependency_loop_a"],
1167}
1168
1169// -----------------------------------------------------------------------------
1170// libtest_with_dependency_loop_a.so
1171// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001172cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001173 name: "libtest_with_dependency_loop_a",
1174 defaults: ["bionic_testlib_defaults"],
1175 srcs: ["dlopen_testlib_loopy_a.cpp"],
1176 shared_libs: ["libtest_with_dependency_loop_b_tmp"],
1177}
1178
1179// -----------------------------------------------------------------------------
1180// libtest_with_dependency_loop_b.so
1181//
1182// this is temporary placeholder - will be removed
1183// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001184cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001185 name: "libtest_with_dependency_loop_b_tmp",
1186 defaults: ["bionic_testlib_defaults"],
1187 srcs: ["dlopen_testlib_loopy_invalid.cpp"],
1188 ldflags: ["-Wl,-soname=libtest_with_dependency_loop_b.so"],
1189}
1190
1191// -----------------------------------------------------------------------------
1192// libtest_with_dependency_loop_b.so
1193// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001194cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001195 name: "libtest_with_dependency_loop_b",
1196 defaults: ["bionic_testlib_defaults"],
1197 srcs: ["dlopen_testlib_loopy_b.cpp"],
1198 shared_libs: ["libtest_with_dependency_loop_c"],
1199}
1200
1201// -----------------------------------------------------------------------------
1202// libtest_with_dependency_loop_c.so
1203// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001204cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001205 name: "libtest_with_dependency_loop_c",
1206 defaults: ["bionic_testlib_defaults"],
1207 srcs: ["dlopen_testlib_loopy_c.cpp"],
1208 shared_libs: ["libtest_with_dependency_loop_a"],
1209}
1210
1211// -----------------------------------------------------------------------------
1212// libtest_relo_check_dt_needed_order.so
1213// |
1214// +-> libtest_relo_check_dt_needed_order_1.so
1215// |
1216// +-> libtest_relo_check_dt_needed_order_2.so
1217// -----------------------------------------------------------------------------
1218
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001219cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001220 name: "libtest_relo_check_dt_needed_order",
1221 defaults: ["bionic_testlib_defaults"],
1222 srcs: ["dlopen_testlib_relo_check_dt_needed_order.cpp"],
1223 shared_libs: [
1224 "libtest_relo_check_dt_needed_order_1",
1225 "libtest_relo_check_dt_needed_order_2",
1226 ],
1227}
1228
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001229cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001230 name: "libtest_relo_check_dt_needed_order_1",
1231 defaults: ["bionic_testlib_defaults"],
1232 srcs: ["dlopen_testlib_relo_check_dt_needed_order_1.cpp"],
1233}
1234
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001235cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001236 name: "libtest_relo_check_dt_needed_order_2",
1237 defaults: ["bionic_testlib_defaults"],
1238 srcs: ["dlopen_testlib_relo_check_dt_needed_order_2.cpp"],
1239}
1240
1241// -----------------------------------------------------------------------------
1242// Library with dependency used by dlfcn tests
1243// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -07001244cc_test_library {
1245 name: "libtest_with_dependency",
1246 defaults: ["bionic_testlib_defaults"],
1247 srcs: ["dlopen_testlib_simple.cpp"],
1248 shared_libs: ["libdlext_test"],
1249}
Colin Cross2722ebb2016-07-11 16:20:06 -07001250
1251// -----------------------------------------------------------------------------
1252// Library used by ifunc tests
1253// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001254cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001255 name: "libtest_ifunc",
1256 defaults: ["bionic_testlib_defaults"],
Dimitry Ivanov21975b22017-05-02 16:31:56 -07001257 srcs: ["dlopen_testlib_ifunc.cpp"],
Dimitry Ivanov21975b22017-05-02 16:31:56 -07001258}
1259
1260cc_test_library {
1261 name: "libtest_ifunc_variable",
1262 defaults: ["bionic_testlib_defaults"],
1263 srcs: ["dlopen_testlib_ifunc_variable.cpp"],
Elliott Hughesd50a1de2018-02-05 17:30:57 -08001264 shared_libs: ["libtest_ifunc_variable_impl"],
Dimitry Ivanov21975b22017-05-02 16:31:56 -07001265}
1266
1267cc_test_library {
1268 name: "libtest_ifunc_variable_impl",
1269 defaults: ["bionic_testlib_defaults"],
1270 srcs: ["dlopen_testlib_ifunc_variable_impl.cpp"],
Colin Cross2722ebb2016-07-11 16:20:06 -07001271}
1272
1273// -----------------------------------------------------------------------------
1274// Library used by atexit tests
1275// -----------------------------------------------------------------------------
1276
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001277cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001278 name: "libtest_atexit",
1279 defaults: ["bionic_testlib_defaults"],
1280 srcs: ["atexit_testlib.cpp"],
1281}
1282
1283// -----------------------------------------------------------------------------
1284// This library is used by dl_load test to check symbol preempting
1285// by main executable
1286// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001287cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001288 name: "libdl_preempt_test_1",
1289 defaults: ["bionic_testlib_defaults"],
1290 srcs: ["dl_preempt_library_1.cpp"],
1291}
1292
1293// -----------------------------------------------------------------------------
1294// This library is used by dl_load test to check symbol preempting
1295// by libdl_preempt_test_1.so
1296// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001297cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001298 name: "libdl_preempt_test_2",
1299 defaults: ["bionic_testlib_defaults"],
1300 srcs: ["dl_preempt_library_2.cpp"],
1301}
1302
1303// -----------------------------------------------------------------------------
1304// Library with DF_1_GLOBAL
1305// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001306cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001307 name: "libdl_test_df_1_global",
1308 defaults: ["bionic_testlib_defaults"],
1309 srcs: ["dl_df_1_global.cpp"],
1310 ldflags: ["-Wl,-z,global"],
Colin Cross2722ebb2016-07-11 16:20:06 -07001311}
1312
1313// -----------------------------------------------------------------------------
1314// Library using symbol from libdl_test_df_1_global
1315// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001316cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001317 name: "libtest_dlsym_df_1_global",
1318 defaults: ["bionic_testlib_defaults"],
1319 srcs: ["dl_df_1_use_global.cpp"],
1320}
1321
1322// -----------------------------------------------------------------------------
Jiyong Park01162f22017-10-16 15:31:09 +09001323// Library with DF_1_GLOBAL which will be dlopened
1324// (note: libdl_test_df_1_global above will be included in DT_NEEDED)
1325// -----------------------------------------------------------------------------
1326cc_test_library {
1327 name: "libtest_dlopen_df_1_global",
1328 defaults: ["bionic_testlib_defaults"],
1329 srcs: ["dl_df_1_global_dummy.cpp"],
1330 ldflags: ["-Wl,-z,global"],
Jiyong Park01162f22017-10-16 15:31:09 +09001331}
1332
Jiyong Park01162f22017-10-16 15:31:09 +09001333// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -07001334// Library with weak function
1335// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001336cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001337 name: "libtest_dlsym_weak_func",
1338 defaults: ["bionic_testlib_defaults"],
1339 srcs: ["dlsym_weak_function.cpp"],
1340}
1341
1342// -----------------------------------------------------------------------------
1343// Library to check RTLD_LOCAL with dlsym in 'this'
1344// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001345cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001346 name: "libtest_dlsym_from_this",
1347 defaults: ["bionic_testlib_defaults"],
1348 srcs: ["dlsym_from_this_symbol.cpp"],
1349 shared_libs: ["libtest_dlsym_from_this_child"],
Colin Cross2722ebb2016-07-11 16:20:06 -07001350}
1351
1352// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001353cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001354 name: "libtest_dlsym_from_this_child",
1355 defaults: ["bionic_testlib_defaults"],
1356 srcs: ["dlsym_from_this_functions.cpp"],
1357 shared_libs: ["libtest_dlsym_from_this_grandchild"],
1358}
1359
1360// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001361cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001362 name: "libtest_dlsym_from_this_grandchild",
1363 defaults: ["bionic_testlib_defaults"],
1364 srcs: ["dlsym_from_this_symbol2.cpp"],
1365}
1366
1367// -----------------------------------------------------------------------------
1368// Empty library
1369// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001370cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001371 name: "libtest_empty",
1372 defaults: ["bionic_testlib_defaults"],
1373 srcs: ["empty.cpp"],
1374}
1375
1376// -----------------------------------------------------------------------------
dimitry8db36a52017-10-23 15:10:10 +02001377// Library for inaccessible shared library test
1378// -----------------------------------------------------------------------------
1379cc_test_library {
1380 name: "libtestshared",
1381 defaults: ["bionic_testlib_defaults"],
1382 srcs: ["empty.cpp"],
Nan Zhangdab0fd52017-11-07 11:05:24 -08001383 relative_install_path: "bionic-loader-test-libs/inaccessible_libs",
dimitry8db36a52017-10-23 15:10:10 +02001384}
1385
1386// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -07001387// Library with weak undefined function
1388// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001389cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001390 name: "libtest_dlopen_weak_undefined_func",
1391 defaults: ["bionic_testlib_defaults"],
1392 srcs: ["dlopen_weak_undefined.cpp"],
1393}
1394
1395// -----------------------------------------------------------------------------
Dimitry Ivanovd0b5c3a2016-11-25 12:23:11 -08001396// Check that RTLD_NEXT of a libc symbol works in dlopened library
1397// -----------------------------------------------------------------------------
1398cc_test_library {
1399 name: "libtest_check_rtld_next_from_library",
1400 defaults: ["bionic_testlib_defaults"],
1401 srcs: ["check_rtld_next_from_library.cpp"],
Pirama Arumuga Nainar8035caa2020-06-09 12:48:10 -07001402 native_coverage: false,
Dimitry Ivanovd0b5c3a2016-11-25 12:23:11 -08001403}
1404
1405// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -07001406// Library with constructor that calls dlopen() b/7941716
1407// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001408cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001409 name: "libtest_dlopen_from_ctor",
1410 defaults: ["bionic_testlib_defaults"],
1411 srcs: ["dlopen_testlib_dlopen_from_ctor.cpp"],
Colin Cross2722ebb2016-07-11 16:20:06 -07001412}
1413
1414// -----------------------------------------------------------------------------
Dimitry Ivanovec90e242017-02-10 11:04:20 -08001415// Libraries used to check init/fini call order
Dimitry Ivanovea8f3962017-02-09 13:31:57 -08001416// -----------------------------------------------------------------------------
1417cc_test_library {
1418 name: "libtest_init_fini_order_root",
1419 defaults: ["bionic_testlib_defaults"],
1420 srcs: ["dlopen_check_init_fini_root.cpp"],
Dimitry Ivanovec90e242017-02-10 11:04:20 -08001421 shared_libs: [
1422 "libtest_init_fini_order_child",
1423 "libtest_init_fini_order_grand_child",
1424 ],
1425}
1426
1427cc_test_library {
1428 name: "libtest_init_fini_order_root2",
1429 defaults: ["bionic_testlib_defaults"],
1430 srcs: ["dlopen_check_init_fini_root.cpp"],
1431 shared_libs: [
1432 "libtest_init_fini_order_grand_child",
1433 "libtest_init_fini_order_child",
1434 ],
Dimitry Ivanovea8f3962017-02-09 13:31:57 -08001435}
1436
1437cc_test_library {
1438 name: "libtest_init_fini_order_child",
1439 defaults: ["bionic_testlib_defaults"],
1440 srcs: ["dlopen_check_init_fini_child.cpp"],
1441 shared_libs: ["libtest_init_fini_order_grand_child"],
1442}
1443
1444cc_test_library {
1445 name: "libtest_init_fini_order_grand_child",
1446 defaults: ["bionic_testlib_defaults"],
1447 srcs: ["dlopen_check_init_fini_grand_child.cpp"],
1448}
1449
1450// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -07001451// Library that depends on the library with constructor that calls dlopen() b/7941716
1452// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001453cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001454 name: "libtest_dlopen_from_ctor_main",
1455 defaults: ["bionic_testlib_defaults"],
1456 srcs: ["empty.cpp"],
1457 shared_libs: ["libtest_dlopen_from_ctor"],
1458}
1459
1460// -----------------------------------------------------------------------------
dimitry55547db2018-05-25 14:17:37 +02001461// Libraries with non-trivial thread_local variable to test dlclose()
dimitry06016f22018-01-05 11:39:28 +01001462// -----------------------------------------------------------------------------
1463cc_test_library {
1464 name: "libtest_thread_local_dtor",
1465 defaults: ["bionic_testlib_defaults"],
1466 srcs: ["thread_local_dtor.cpp"],
1467}
1468
dimitry55547db2018-05-25 14:17:37 +02001469cc_test_library {
1470 name: "libtest_thread_local_dtor2",
1471 defaults: ["bionic_testlib_defaults"],
1472 srcs: ["thread_local_dtor2.cpp"],
1473}
1474
1475// -----------------------------------------------------------------------------
1476// Library dt_needs libtest_thread_local_dtor/2 (to check no-unload on load_group)
1477// -----------------------------------------------------------------------------
1478cc_test_library {
1479 name: "libtest_indirect_thread_local_dtor",
1480 defaults: ["bionic_testlib_defaults"],
1481 srcs: ["empty.cpp"],
1482 shared_libs: [
1483 "libtest_thread_local_dtor",
1484 "libtest_thread_local_dtor2",
1485 ],
1486}
1487
dimitry06016f22018-01-05 11:39:28 +01001488// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -07001489// Tool to use to align the shared libraries in a zip file.
1490// -----------------------------------------------------------------------------
1491cc_binary_host {
1492 name: "bionic_tests_zipalign",
1493 srcs: ["bionic_tests_zipalign.cpp"],
1494 cflags: [
1495 "-Wall",
1496 "-Werror",
1497 ],
1498
1499 static_libs: [
1500 "libziparchive",
1501 "liblog",
1502 "libbase",
1503 "libz",
1504 "libutils",
1505 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001506}
Evgenii Stepanov0a3637d2016-07-06 13:20:59 -07001507
1508cc_test_library {
1509 name: "libcfi-test",
1510 defaults: ["bionic_testlib_defaults"],
1511 srcs: ["cfi_test_lib.cpp"],
1512 sanitize: {
1513 cfi: false,
1514 },
1515}
1516
1517cc_test_library {
1518 name: "libcfi-test-bad",
1519 defaults: ["bionic_testlib_defaults"],
1520 srcs: ["cfi_test_bad_lib.cpp"],
1521 sanitize: {
1522 cfi: false,
1523 },
1524}
Evgenii Stepanov68ecec12017-01-31 13:19:30 -08001525
1526cc_test {
1527 name: "cfi_test_helper",
1528 host_supported: false,
1529 defaults: ["bionic_testlib_defaults"],
1530 srcs: ["cfi_test_helper.cpp"],
1531 ldflags: ["-rdynamic"],
1532}
1533
1534cc_test {
1535 name: "cfi_test_helper2",
1536 host_supported: false,
1537 defaults: ["bionic_testlib_defaults"],
1538 srcs: ["cfi_test_helper2.cpp"],
1539 shared_libs: ["libcfi-test"],
1540 ldflags: ["-Wl,--rpath,${ORIGIN}/.."],
1541}
Elliott Hugheseb04ed52017-03-29 13:48:02 -07001542
1543cc_test {
1544 name: "preinit_getauxval_test_helper",
1545 host_supported: false,
1546 defaults: ["bionic_testlib_defaults"],
1547 srcs: ["preinit_getauxval_test_helper.cpp"],
1548}
1549
1550cc_test {
1551 name: "preinit_syscall_test_helper",
1552 host_supported: false,
1553 defaults: ["bionic_testlib_defaults"],
1554 srcs: ["preinit_syscall_test_helper.cpp"],
1555}
Jiyong Park02586a22017-05-20 01:01:24 +09001556
1557cc_test {
1558 name: "ld_preload_test_helper",
1559 host_supported: false,
1560 defaults: ["bionic_testlib_defaults"],
1561 srcs: ["ld_preload_test_helper.cpp"],
1562 shared_libs: ["ld_preload_test_helper_lib1"],
1563 ldflags: ["-Wl,--rpath,${ORIGIN}/.."],
1564}
1565
1566cc_test_library {
1567 name: "ld_preload_test_helper_lib1",
1568 host_supported: false,
1569 defaults: ["bionic_testlib_defaults"],
1570 srcs: ["ld_preload_test_helper_lib1.cpp"],
1571}
1572
1573cc_test_library {
1574 name: "ld_preload_test_helper_lib2",
1575 host_supported: false,
1576 defaults: ["bionic_testlib_defaults"],
1577 srcs: ["ld_preload_test_helper_lib2.cpp"],
1578}
1579
1580cc_test {
1581 name: "ld_config_test_helper",
1582 host_supported: false,
1583 defaults: ["bionic_testlib_defaults"],
1584 srcs: ["ld_config_test_helper.cpp"],
1585 shared_libs: ["ld_config_test_helper_lib1"],
1586 ldflags: ["-Wl,--rpath,${ORIGIN}/.."],
1587}
1588
1589cc_test_library {
1590 name: "ld_config_test_helper_lib1",
1591 host_supported: false,
1592 defaults: ["bionic_testlib_defaults"],
1593 srcs: ["ld_config_test_helper_lib1.cpp"],
1594 shared_libs: ["ld_config_test_helper_lib2"],
Nan Zhangdab0fd52017-11-07 11:05:24 -08001595 relative_install_path: "bionic-loader-test-libs/ns2",
Ryan Prichard058eb8f2020-12-17 22:59:04 -08001596 // Mark the library DF_1_GLOBAL so it is added to every linker namespace.
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001597 ldflags: ["-Wl,-z,global"],
Jiyong Park02586a22017-05-20 01:01:24 +09001598}
1599
1600cc_test_library {
1601 name: "ld_config_test_helper_lib2",
1602 host_supported: false,
1603 defaults: ["bionic_testlib_defaults"],
1604 srcs: ["ld_config_test_helper_lib2.cpp"],
Nan Zhangdab0fd52017-11-07 11:05:24 -08001605 relative_install_path: "bionic-loader-test-libs/ns2",
Jiyong Park02586a22017-05-20 01:01:24 +09001606}
1607
1608cc_test_library {
1609 name: "ld_config_test_helper_lib3",
1610 host_supported: false,
1611 defaults: ["bionic_testlib_defaults"],
1612 srcs: ["ld_config_test_helper_lib3.cpp"],
1613}
Ryan Prichard8f639a42018-10-01 23:10:05 -07001614
1615cc_test {
1616 name: "exec_linker_helper",
1617 host_supported: false,
1618 defaults: ["bionic_testlib_defaults"],
1619 srcs: ["exec_linker_helper.cpp"],
1620 shared_libs: ["exec_linker_helper_lib"],
1621 ldflags: ["-Wl,--rpath,${ORIGIN}/.."],
1622}
1623
1624cc_test_library {
1625 name: "exec_linker_helper_lib",
1626 host_supported: false,
1627 defaults: ["bionic_testlib_defaults"],
1628 srcs: ["exec_linker_helper_lib.cpp"],
1629}
Peter Collingbourneb39cb3c2019-03-01 13:12:49 -08001630
1631cc_test_library {
1632 name: "libsegment_gap_outer",
1633 host_supported: false,
1634 defaults: ["bionic_testlib_defaults"],
1635 srcs: ["segment_gap_outer.cpp"],
1636 ldflags: ["-Wl,-T,bionic/tests/libs/segment_gap_outer.lds"],
1637}
1638
1639cc_test_library {
1640 name: "libsegment_gap_inner",
1641 host_supported: false,
1642 defaults: ["bionic_testlib_defaults"],
1643 srcs: ["segment_gap_inner.cpp"],
1644}
Elliott Hughes6663f552020-01-24 14:36:10 -08001645
Elliott Hughes6663f552020-01-24 14:36:10 -08001646// -----------------------------------------------------------------------------
Elliott Hughes6dd1f582020-01-28 12:18:35 -08001647// Check that we support all kinds of relocations: regular, "relocation packer",
1648// and both the old and new SHT_RELR constants.
Elliott Hughes6663f552020-01-24 14:36:10 -08001649// -----------------------------------------------------------------------------
1650
Elliott Hughes6dd1f582020-01-28 12:18:35 -08001651// This is what got standardized for SHT_RELR.
Elliott Hughes6663f552020-01-24 14:36:10 -08001652cc_test_library {
Elliott Hughes6dd1f582020-01-28 12:18:35 -08001653 name: "librelocations-RELR",
1654 ldflags: [
1655 "-Wl,--pack-dyn-relocs=relr",
1656 "-Wl,--no-use-android-relr-tags",
1657 ],
Elliott Hughes6663f552020-01-24 14:36:10 -08001658 host_supported: false,
1659 defaults: ["bionic_testlib_defaults"],
Elliott Hughes6dd1f582020-01-28 12:18:35 -08001660 srcs: ["relocations.cpp"],
Elliott Hughes6663f552020-01-24 14:36:10 -08001661}
1662
Elliott Hughes6dd1f582020-01-28 12:18:35 -08001663// This is the same encoding as SHT_RELR, but using OS-specific constants.
Elliott Hughes6663f552020-01-24 14:36:10 -08001664cc_test_library {
Elliott Hughes6dd1f582020-01-28 12:18:35 -08001665 name: "librelocations-ANDROID_RELR",
1666 ldflags: [
1667 "-Wl,--pack-dyn-relocs=relr",
1668 "-Wl,--use-android-relr-tags",
1669 ],
Elliott Hughes6663f552020-01-24 14:36:10 -08001670 host_supported: false,
1671 defaults: ["bionic_testlib_defaults"],
Elliott Hughes6dd1f582020-01-28 12:18:35 -08001672 srcs: ["relocations.cpp"],
1673}
1674
1675// This is the old relocation packer encoding (DT_ANDROID_REL/DT_ANDROID_RELA).
1676cc_test_library {
1677 name: "librelocations-ANDROID_REL",
1678 ldflags: ["-Wl,--pack-dyn-relocs=android"],
1679 host_supported: false,
1680 defaults: ["bionic_testlib_defaults"],
1681 srcs: ["relocations.cpp"],
1682}
1683
1684// This is not packed at all.
1685cc_test_library {
1686 name: "librelocations-fat",
1687 ldflags: ["-Wl,--pack-dyn-relocs=none"],
1688 host_supported: false,
1689 defaults: ["bionic_testlib_defaults"],
1690 srcs: ["relocations.cpp"],
Elliott Hughes6663f552020-01-24 14:36:10 -08001691}
Evgenii Stepanov51741fb2021-01-06 16:03:15 -08001692
1693cc_defaults {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001694 name: "bionic_targets_only",
1695 enabled: false,
1696 target: {
1697 android: {
1698 enabled: true,
1699 },
1700 linux_bionic: {
1701 enabled: true,
1702 },
1703 },
Evgenii Stepanov51741fb2021-01-06 16:03:15 -08001704}
1705
1706cc_test {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001707 name: "heap_tagging_sync_helper",
1708 defaults: [
1709 "bionic_testlib_defaults",
1710 "bionic_targets_only",
1711 ],
1712 srcs: ["heap_tagging_helper.cpp"],
1713 sanitize: {
1714 memtag_heap: true,
1715 diag: {
1716 memtag_heap: true,
1717 },
1718 hwaddress: false,
1719 },
Evgenii Stepanov51741fb2021-01-06 16:03:15 -08001720}
1721
1722cc_test {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001723 name: "heap_tagging_async_helper",
1724 defaults: [
1725 "bionic_testlib_defaults",
1726 "bionic_targets_only",
1727 ],
1728 srcs: ["heap_tagging_helper.cpp"],
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_disabled_helper",
1740 defaults: [
1741 "bionic_testlib_defaults",
1742 "bionic_targets_only",
1743 ],
1744 srcs: ["heap_tagging_helper.cpp"],
1745 sanitize: {
1746 memtag_heap: false,
1747 hwaddress: false,
1748 },
Evgenii Stepanov51741fb2021-01-06 16:03:15 -08001749}
1750
1751cc_test {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001752 name: "heap_tagging_static_sync_helper",
1753 defaults: [
1754 "bionic_testlib_defaults",
1755 "bionic_targets_only",
1756 ],
1757 srcs: ["heap_tagging_helper.cpp"],
1758 static_executable: true,
1759 sanitize: {
1760 memtag_heap: true,
1761 diag: {
1762 memtag_heap: true,
1763 },
1764 hwaddress: false,
1765 },
Evgenii Stepanov51741fb2021-01-06 16:03:15 -08001766}
1767
1768cc_test {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001769 name: "heap_tagging_static_async_helper",
1770 defaults: [
1771 "bionic_testlib_defaults",
1772 "bionic_targets_only",
1773 ],
1774 srcs: ["heap_tagging_helper.cpp"],
1775 static_executable: true,
1776 sanitize: {
1777 memtag_heap: true,
1778 diag: {
1779 memtag_heap: false,
1780 },
1781 hwaddress: false,
1782 },
Evgenii Stepanov51741fb2021-01-06 16:03:15 -08001783}
1784
1785cc_test {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001786 name: "heap_tagging_static_disabled_helper",
1787 defaults: [
1788 "bionic_testlib_defaults",
1789 "bionic_targets_only",
1790 ],
1791 srcs: ["heap_tagging_helper.cpp"],
1792 static_executable: true,
1793 sanitize: {
1794 memtag_heap: false,
1795 hwaddress: false,
1796 },
Evgenii Stepanov51741fb2021-01-06 16:03:15 -08001797}
Colin Crossbadcb382021-09-24 17:49:58 -07001798
Florian Mayerc82d7fc2022-08-31 20:57:03 +00001799cc_test {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001800 name: "stack_tagging_helper",
1801 defaults: [
1802 "bionic_testlib_defaults",
1803 "bionic_targets_only",
1804 ],
1805 srcs: ["stack_tagging_helper.cpp"],
1806 sanitize: {
1807 memtag_heap: true,
1808 memtag_stack: true,
1809 diag: {
1810 memtag_heap: true,
1811 },
1812 hwaddress: false,
1813 },
1814 header_libs: ["bionic_libc_platform_headers"],
1815 cflags: ["-fexceptions"],
Florian Mayerc82d7fc2022-08-31 20:57:03 +00001816}
1817
1818cc_test {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001819 name: "stack_tagging_static_helper",
1820 defaults: [
1821 "bionic_testlib_defaults",
1822 "bionic_targets_only",
1823 ],
1824 srcs: ["stack_tagging_helper.cpp"],
1825 static_executable: true,
1826 sanitize: {
1827 memtag_heap: true,
1828 memtag_stack: true,
1829 diag: {
1830 memtag_heap: true,
1831 },
1832 hwaddress: false,
1833 },
1834 header_libs: ["bionic_libc_platform_headers"],
1835 cflags: ["-fexceptions"],
Florian Mayerc82d7fc2022-08-31 20:57:03 +00001836}
1837
Colin Crossbadcb382021-09-24 17:49:58 -07001838cc_genrule {
1839 name: "libdlext_test_zip_zipaligned",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001840 out: ["bionic-loader-test-libs/libdlext_test_zip/libdlext_test_zip_zipaligned.zip"],
Colin Crossbadcb382021-09-24 17:49:58 -07001841 tools: [
1842 "soong_zip",
1843 "bionic_tests_zipalign",
1844 ],
1845 srcs: [
1846 ":libdlext_test_zip",
1847 ":libatest_simple_zip",
1848 ":exec_linker_helper",
1849 ":exec_linker_helper_lib",
1850 ],
1851 cmd: "mkdir -p $(genDir)/zipdir/libdir &&" +
1852 " cp $(in) $(genDir)/zipdir/libdir/ &&" +
1853 " touch $(genDir)/zipdir/empty_file.txt &&" +
1854 " $(location soong_zip) -o $(out).unaligned -L 0 -C $(genDir)/zipdir -D $(genDir)/zipdir &&" +
1855 " $(location bionic_tests_zipalign) 4096 $(out).unaligned $(out)",
1856
Colin Crossbadcb382021-09-24 17:49:58 -07001857}
1858
1859cc_genrule {
1860 name: "libdlext_test_runpath_zip_zipaligned",
1861 out: ["bionic-loader-test-libs/libdlext_test_runpath_zip/libdlext_test_runpath_zip_zipaligned.zip"],
1862 tools: [
1863 "soong_zip",
1864 "bionic_tests_zipalign",
1865 ],
1866 srcs: [
1867 ":libtest_dt_runpath_d_zip",
1868 ":libtest_dt_runpath_a",
1869 ":libtest_dt_runpath_b",
1870 ":libtest_dt_runpath_c",
1871 ":libtest_dt_runpath_x",
1872 ":libtest_dt_runpath_y",
1873 ],
1874 cmd: "mkdir -p $(genDir)/zipdir/libdir &&" +
1875 " if [[ \"$$CC_MULTILIB\" = lib32 ]]; then" +
1876 " PRIVATE_LIB_OR_LIB64=lib;" +
1877 " else" +
1878 " PRIVATE_LIB_OR_LIB64=lib64;" +
1879 " fi &&" +
1880 " if [[ -n \"$$CC_NATIVE_BRIDGE\" ]]; then" +
1881 " PRIVATE_LIB_OR_LIB64=$$PRIVATE_LIB_OR_LIB64/$$CC_NATIVE_BRIDGE;" +
1882 " fi &&" +
1883 " mkdir -p $(genDir)/zipdir/libdir/dt_runpath_a &&" +
1884 " mkdir -p $(genDir)/zipdir/libdir/dt_runpath_b_c_x &&" +
1885 " mkdir -p $(genDir)/zipdir/libdir/dt_runpath_y/$$PRIVATE_LIB_OR_LIB64 &&" +
1886 " cp $(location :libtest_dt_runpath_d_zip) $(genDir)/zipdir/libdir &&" +
1887 " cp $(location :libtest_dt_runpath_a) $(genDir)/zipdir/libdir/dt_runpath_a &&" +
1888 " cp $(location :libtest_dt_runpath_b) $(genDir)/zipdir/libdir/dt_runpath_b_c_x &&" +
1889 " cp $(location :libtest_dt_runpath_c) $(genDir)/zipdir/libdir/dt_runpath_b_c_x &&" +
1890 " cp $(location :libtest_dt_runpath_x) $(genDir)/zipdir/libdir/dt_runpath_b_c_x &&" +
1891 " cp $(location :libtest_dt_runpath_y) $(genDir)/zipdir/libdir/dt_runpath_y/$$PRIVATE_LIB_OR_LIB64 &&" +
1892 " touch $(genDir)/zipdir/empty_file.txt &&" +
1893 " $(location soong_zip) -o $(out).unaligned -L 0 -C $(genDir)/zipdir -D $(genDir)/zipdir &&" +
1894 " $(location bionic_tests_zipalign) 4096 $(out).unaligned $(out)",
Colin Crossbadcb382021-09-24 17:49:58 -07001895}