blob: f64055213d0c20a71fc2e6dc4a25c1d8ac506fb9 [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
Elliott Hughes9724e932018-03-23 18:46:07 -0700159// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -0700160// Library to test gnu-styled hash
161// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700162cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700163 name: "libgnu-hash-table-library",
164 defaults: ["bionic_testlib_defaults"],
165 srcs: ["dlext_test_library.cpp"],
166 ldflags: ["-Wl,--hash-style=gnu"],
Colin Cross2722ebb2016-07-11 16:20:06 -0700167}
168
169// -----------------------------------------------------------------------------
170// Library to test sysv-styled hash
171// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700172cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700173 name: "libsysv-hash-table-library",
174 defaults: ["bionic_testlib_defaults"],
175 srcs: ["dlext_test_library.cpp"],
176 ldflags: ["-Wl,--hash-style=sysv"],
177}
178
179// -----------------------------------------------------------------------------
180// Library used by dlext tests - with GNU RELRO program header
181// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700182cc_test_library {
183 name: "libdlext_test",
184 defaults: ["bionic_testlib_defaults"],
185 srcs: ["dlext_test_library.cpp"],
186 ldflags: ["-Wl,-z,relro"],
187 shared_libs: ["libtest_simple"],
188}
Colin Cross2722ebb2016-07-11 16:20:06 -0700189
190// -----------------------------------------------------------------------------
191// Library used by dlext tests - without GNU RELRO program header
192// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700193cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700194 name: "libdlext_test_norelro",
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700195 defaults: ["bionic_testlib_defaults"],
Colin Cross2722ebb2016-07-11 16:20:06 -0700196 srcs: ["dlext_test_library.cpp"],
197 ldflags: ["-Wl,-z,norelro"],
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800198 shared_libs: ["libtest_simple"],
Colin Cross2722ebb2016-07-11 16:20:06 -0700199}
200
201// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700202// Library used by dlext tests - recursive use of RELRO sharing
203// -----------------------------------------------------------------------------
204cc_test_library {
205 name: "libdlext_test_recursive",
206 defaults: ["bionic_testlib_defaults"],
207 srcs: ["dlext_test_recursive_library.cpp"],
208 ldflags: ["-Wl,-z,relro"],
209 shared_libs: ["libdlext_test"],
210}
211
212// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -0700213// Library used by dlext tests - different name non-default location
214// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700215cc_test_library {
216 name: "libdlext_test_fd",
217 defaults: ["bionic_testlib_defaults"],
218 host_supported: false,
219 srcs: ["dlext_test_library.cpp"],
220 ldflags: ["-Wl,--rpath,${ORIGIN}/.."],
221 relative_install_path: "bionic-loader-test-libs/libdlext_test_fd",
222 shared_libs: ["libtest_simple"],
223}
Colin Cross2722ebb2016-07-11 16:20:06 -0700224
225// -----------------------------------------------------------------------------
226// Libraries used by dlext tests for open from a zip-file
227// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700228cc_test_library {
229 name: "libdlext_test_zip",
230 defaults: ["bionic_testlib_defaults"],
231 host_supported: false,
232 srcs: ["dlext_test_library.cpp"],
233 shared_libs: ["libatest_simple_zip"],
234 relative_install_path: "bionic-loader-test-libs/libdlext_test_zip",
235}
236
237cc_test_library {
238 name: "libatest_simple_zip",
239 defaults: ["bionic_testlib_defaults"],
240 host_supported: false,
241 srcs: ["dlopen_testlib_simple.cpp"],
242 relative_install_path: "bionic-loader-test-libs/libatest_simple_zip",
243}
Colin Cross2722ebb2016-07-11 16:20:06 -0700244
245// ----------------------------------------------------------------------------
246// Library with soname which does not match filename
247// ----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700248cc_test_library {
249 name: "libdlext_test_different_soname",
250 defaults: ["bionic_testlib_defaults"],
251 srcs: ["dlext_test_library.cpp"],
252 ldflags: ["-Wl,-soname=libdlext_test_soname.so"],
253}
Colin Cross2722ebb2016-07-11 16:20:06 -0700254
255// -----------------------------------------------------------------------------
256// Library used by dlext tests - zipped and aligned
257// -----------------------------------------------------------------------------
258// In Android.mk to support zipped and aligned tests
259
260// -----------------------------------------------------------------------------
261// Library used by dlfcn tests
262// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700263cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700264 name: "libtest_simple",
265 defaults: ["bionic_testlib_defaults"],
266 srcs: ["dlopen_testlib_simple.cpp"],
267}
268
269// -----------------------------------------------------------------------------
Florian Mayere65e1932024-02-15 22:20:54 +0000270// Libraries and binaries used by memtag_stack_dlopen_test tests
271// -----------------------------------------------------------------------------
272cc_test_library {
273 name: "libtest_simple_memtag_stack",
274 sanitize: {
275 memtag_stack: true,
276 },
277 srcs: ["dlopen_testlib_simple.cpp"],
278}
279
280cc_test_library {
281 name: "libtest_depends_on_simple_memtag_stack",
282 sanitize: {
283 memtag_stack: false,
284 },
285 shared_libs: [
286 "libtest_simple_memtag_stack",
287 ],
288 srcs: ["dlopen_testlib_depends_on_simple.cpp"],
289}
290
291cc_binary {
292 name: "testbinary_is_stack_mte_after_dlopen",
293 sanitize: {
294 memtag_stack: false,
295 memtag_heap: true,
296 },
297 srcs: ["testbinary_is_stack_mte_after_dlopen.cpp"],
298}
299
300cc_binary {
301 name: "testbinary_depends_on_simple_memtag_stack",
302 sanitize: {
303 memtag_stack: false,
304 memtag_heap: true,
305 },
306 shared_libs: [
307 "libtest_simple_memtag_stack",
308 ],
309 srcs: ["testbinary_is_stack_mte.cpp"],
310}
311
312cc_binary {
313 name: "testbinary_depends_on_depends_on_simple_memtag_stack",
314 sanitize: {
315 memtag_stack: false,
316 memtag_heap: true,
317 },
318 shared_libs: [
319 "libtest_depends_on_simple_memtag_stack",
320 ],
321 srcs: ["testbinary_is_stack_mte.cpp"],
322}
323
324// -----------------------------------------------------------------------------
Florian Mayerc10d0642023-03-22 16:12:49 -0700325// Libraries used by hwasan_test
326// -----------------------------------------------------------------------------
327cc_test_library {
328 name: "libtest_simple_hwasan",
329 arch: {
330 arm64: {
331 enabled: true,
332 },
333 },
334 sanitize: {
335 hwaddress: true,
336 },
337 relative_install_path: "hwasan",
338 enabled: false,
339 srcs: ["dlopen_testlib_simple_hwasan.cpp"],
340}
341
342cc_test_library {
343 // A weird name. This is the vanilla (non-HWASan) copy of the library that
344 // is used for the hwasan test.
345 name: "libtest_simple_hwasan_nohwasan",
346 arch: {
347 arm64: {
348 enabled: true,
349 },
350 },
351 stem: "libtest_simple_hwasan",
352 enabled: false,
353 srcs: ["dlopen_testlib_simple_hwasan.cpp"],
354}
355
356// -----------------------------------------------------------------------------
dimitry965d06d2017-11-28 16:03:07 +0100357// Library used by dlext direct unload on the namespace boundary tests
358// -----------------------------------------------------------------------------
359cc_test_library {
360 name: "libtest_missing_symbol",
361 defaults: ["bionic_testlib_defaults"],
362 srcs: ["dlopen_testlib_missing_symbol.cpp"],
363 allow_undefined_symbols: true,
364 relative_install_path: "bionic-loader-test-libs/public_namespace_libs",
365}
366
dimitry965d06d2017-11-28 16:03:07 +0100367// -----------------------------------------------------------------------------
368// Library used by dlext indirect unload on the namespace boundary tests
369//
370// These libraries produce following dependency graph:
371// libtest_missing_symbol_root (private ns)
372// +-> libbnstest_public (public ns)
373// +-> libtest_missing_symbol_child_public (public ns)
374// +-> libnstest_public (public ns)
375// +-> libtest_missing_symbol_child_private (private_ns)
376// +-> libnstest_public (public_ns)
377//
378// All libraries except libtest_missing_symbol are located in
379// private_namespace_libs/
380// -----------------------------------------------------------------------------
381cc_test_library {
382 name: "libtest_missing_symbol_child_public",
383 defaults: ["bionic_testlib_defaults"],
384 srcs: ["empty.cpp"],
385 relative_install_path: "bionic-loader-test-libs/public_namespace_libs",
386 shared_libs: ["libnstest_public"],
387}
388
389cc_test_library {
390 name: "libtest_missing_symbol_child_private",
391 defaults: ["bionic_testlib_defaults"],
392 srcs: ["empty.cpp"],
393 relative_install_path: "bionic-loader-test-libs/private_namespace_libs",
394 shared_libs: ["libnstest_public"],
395}
396
397cc_test_library {
398 name: "libtest_missing_symbol_root",
399 defaults: ["bionic_testlib_defaults"],
400 srcs: ["dlopen_testlib_missing_symbol.cpp"],
401 relative_install_path: "bionic-loader-test-libs/private_namespace_libs",
402 allow_undefined_symbols: true,
403 shared_libs: [
404 "libnstest_public",
405 "libtest_missing_symbol_child_public",
406 "libtest_missing_symbol_child_private",
407 ],
408}
409
410// -----------------------------------------------------------------------------
411// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -0700412// Library used by dlfcn nodelete tests
413// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700414cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700415 name: "libtest_nodelete_1",
416 defaults: ["bionic_testlib_defaults"],
417 srcs: ["dlopen_nodelete_1.cpp"],
418}
419
420// -----------------------------------------------------------------------------
421// Library used by dlfcn nodelete tests
422// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700423cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700424 name: "libtest_nodelete_2",
425 defaults: ["bionic_testlib_defaults"],
426 srcs: ["dlopen_nodelete_2.cpp"],
427}
428
429// -----------------------------------------------------------------------------
430// Library used by dlfcn nodelete tests
431// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700432cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700433 name: "libtest_nodelete_dt_flags_1",
434 defaults: ["bionic_testlib_defaults"],
435 srcs: ["dlopen_nodelete_dt_flags_1.cpp"],
436 ldflags: ["-Wl,-z,nodelete"],
437}
438
439// -----------------------------------------------------------------------------
440// Build test helper libraries for linker namespaces
dimitry965d06d2017-11-28 16:03:07 +0100441//
442// This set of libraries is used to verify linker namespaces.
443//
444// Test cases
445// 1. Check that private libraries loaded in different namespaces are
446// different. Check that dlsym does not confuse them.
447// 2. Check that public libraries loaded in different namespaces are shared
448// between them.
449// 3. Check that namespace sticks on dlopen
450// 4. Check that having access to shared library (libnstest_public.so)
451// does not expose symbols from dependent library (libnstest_public_internal.so)
452//
453// Dependency tree (visibility)
454// libnstest_root.so (this should be local to the namespace)
455// +-> libnstest_public.so
456// +-> libnstest_public_internal.so
457// +-> libnstest_private.so
458//
459// libnstest_dlopened.so (library in private namespace dlopened from libnstest_root.so)
Colin Cross2722ebb2016-07-11 16:20:06 -0700460// -----------------------------------------------------------------------------
dimitry965d06d2017-11-28 16:03:07 +0100461cc_test_library {
462 name: "libnstest_root",
463 defaults: ["bionic_testlib_defaults"],
464 srcs: ["namespaces_root.cpp"],
465 relative_install_path: "bionic-loader-test-libs/private_namespace_libs",
466 shared_libs: [
467 "libnstest_public",
468 "libnstest_private",
469 ],
470}
471
472cc_test_library {
473 name: "libnstest_public_internal",
474 defaults: ["bionic_testlib_defaults"],
475 srcs: ["namespaces_public_internal.cpp"],
476 relative_install_path: "bionic-loader-test-libs/public_namespace_libs",
477}
478
479cc_test_library {
480 name: "libnstest_public",
481 defaults: ["bionic_testlib_defaults"],
482 srcs: ["namespaces_public.cpp"],
483 relative_install_path: "bionic-loader-test-libs/public_namespace_libs",
484 shared_libs: ["libnstest_public_internal"],
485}
486
487cc_test_library {
488 name: "libnstest_private",
489 defaults: ["bionic_testlib_defaults"],
490 srcs: ["namespaces_private.cpp"],
491 relative_install_path: "bionic-loader-test-libs/private_namespace_libs",
492}
493
494cc_test_library {
495 name: "libnstest_dlopened",
496 defaults: ["bionic_testlib_defaults"],
497 srcs: ["namespaces_dlopened.cpp"],
498 relative_install_path: "bionic-loader-test-libs/private_namespace_libs",
499}
Colin Cross2722ebb2016-07-11 16:20:06 -0700500
501// -----------------------------------------------------------------------------
Logan Chien9ee45912018-01-18 12:05:09 +0800502// Build test helper libraries for linker namespaces for allow all shared libs
503//
504// This set of libraries is used to verify linker namespaces for allow all
505// shared libs.
506//
507// Test cases
508// 1. Check that namespace a exposes libnstest_ns_a_public1 to
509// namespace b while keeping libnstest_ns_a_public1_internal as an
510// internal lib.
511// 2. Check that namespace b exposes all libraries to namespace a.
512//
513// Dependency tree (visibility)
514// libnstest_ns_b_public2.so (ns:b)
515// +-> libnstest_ns_a_public1.so (ns:a)
516// +-> libnstest_ns_a_public2_internal.so (ns:a)
517// +-> libnstest_ns_b_public3.so (ns:b)
518//
519// -----------------------------------------------------------------------------
520cc_test_library {
521 name: "libnstest_ns_a_public1",
522 defaults: ["bionic_testlib_defaults"],
523 srcs: ["libnstest_ns_a_public1.cpp"],
524 relative_install_path: "bionic-loader-test-libs/ns_a",
525 shared_libs: [
526 "libnstest_ns_a_public1_internal",
527 "libnstest_ns_b_public3",
528 ],
529}
530
531cc_test_library {
532 name: "libnstest_ns_a_public1_internal",
533 defaults: ["bionic_testlib_defaults"],
534 srcs: ["libnstest_ns_a_public1_internal.cpp"],
535 relative_install_path: "bionic-loader-test-libs/ns_a",
536}
537
538cc_test_library {
539 name: "libnstest_ns_b_public2",
540 defaults: ["bionic_testlib_defaults"],
541 srcs: ["libnstest_ns_b_public2.cpp"],
542 relative_install_path: "bionic-loader-test-libs/ns_b",
543 shared_libs: ["libnstest_ns_a_public1"],
544}
545
546cc_test_library {
547 name: "libnstest_ns_b_public3",
548 defaults: ["bionic_testlib_defaults"],
549 srcs: ["libnstest_ns_b_public3.cpp"],
550 relative_install_path: "bionic-loader-test-libs/ns_b",
551}
552
553// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700554// Build test helper libraries for linker namespaces
555//
556// This set of libraries is to test isolated namespaces
557//
558// Isolated namespaces do not allow loading of the library outside of
559// the search paths.
560//
561// This library cannot be loaded in isolated namespace because one of DT_NEEDED
562// libraries is outside of the search paths.
563//
564// libnstest_root_not_isolated.so (DT_RUNPATH = $ORIGIN/../private_namespace_libs_external/)
565// +-> libnstest_public.so
566// +-> libnstest_private_external.so (located in $ORIGIN/../private_namespace_libs_external/)
567//
568// Search path: $NATIVE_TESTS/private_namespace_libs/
569//
Colin Cross2722ebb2016-07-11 16:20:06 -0700570// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700571
572cc_test_library {
573 name: "libnstest_root_not_isolated",
574 defaults: ["bionic_testlib_defaults"],
575 host_supported: false,
576 srcs: ["namespaces_root.cpp"],
577 shared_libs: [
578 "libnstest_public",
579 "libnstest_private_external",
580 ],
581 relative_install_path: "bionic-loader-test-libs/private_namespace_libs",
582 ldflags: ["-Wl,--rpath,$ORIGIN/../private_namespace_libs_external"],
583}
584
585cc_test_library {
586 name: "libnstest_private_external",
587 defaults: ["bionic_testlib_defaults"],
588 host_supported: false,
589 srcs: ["namespaces_private.cpp"],
590 relative_install_path: "bionic-loader-test-libs/private_namespace_libs_external",
591}
592
593// -----------------------------------------------------------------------------
Ryan Prichard22fa3dd2020-01-31 14:47:48 -0800594// ns_hidden_child linker namespace test
595// -----------------------------------------------------------------------------
596
597cc_test {
598 name: "ns_hidden_child_helper",
599 host_supported: false,
600 defaults: ["bionic_testlib_defaults"],
601 srcs: ["ns_hidden_child_helper.cpp"],
602 shared_libs: [
603 "libns_hidden_child_internal",
604 "libns_hidden_child_global",
605 "libdl_android",
606 ],
607 ldflags: ["-Wl,--rpath,${ORIGIN}/.."],
608}
609
610cc_test_library {
611 name: "libns_hidden_child_global",
612 defaults: ["bionic_testlib_defaults"],
613 host_supported: false,
614 srcs: ["ns_hidden_child_global.cpp"],
615 shared_libs: ["libns_hidden_child_internal"],
616 ldflags: ["-Wl,-z,global"],
617}
618
619cc_test_library {
620 name: "libns_hidden_child_internal",
621 defaults: ["bionic_testlib_defaults"],
622 host_supported: false,
623 srcs: ["ns_hidden_child_internal.cpp"],
624}
625
626cc_test_library {
627 name: "libns_hidden_child_public",
628 defaults: ["bionic_testlib_defaults"],
629 host_supported: false,
630 srcs: ["ns_hidden_child_public.cpp"],
631 shared_libs: ["libns_hidden_child_internal"],
632}
633
634cc_test_library {
635 name: "libns_hidden_child_app",
636 defaults: ["bionic_testlib_defaults"],
637 host_supported: false,
638 srcs: ["ns_hidden_child_app.cpp"],
639 shared_libs: ["libns_hidden_child_public"],
640 relative_install_path: "bionic-loader-test-libs/ns_hidden_child_app",
641}
642
643// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700644// Build DT_RUNPATH test helper libraries
645//
646// Dependencies
647//
648// libtest_dt_runpath_d.so runpath: ${ORIGIN}/dt_runpath_b_c_x, ${ORIGIN}/dt_runpath_y/${LIB}
649// |-> dt_runpath_b_c_x/libtest_dt_runpath_b.so runpath: ${ORIGIN}/../dt_runpath_a
650// | |-> dt_runpath_a/libtest_dt_runpath_a.so
651// |-> dt_runpath_b_c_x/libtest_dt_runpath_c.so runpath: ${ORIGIN}/invalid_dt_runpath
652// | |-> libtest_dt_runpath_a.so (soname)
653// |-> dt_runpath_y/lib[64]/libtest_dt_runpath_y.so
654//
655// This one is used to test dlopen
656// dt_runpath_b_c_x/libtest_dt_runpath_x.so
657//
658// -----------------------------------------------------------------------------
659
660// A leaf library in a non-standard directory.
661cc_test_library {
662 name: "libtest_dt_runpath_a",
663 defaults: ["bionic_testlib_defaults"],
664 srcs: ["empty.cpp"],
665 relative_install_path: "bionic-loader-test-libs/dt_runpath_a",
666}
667
668// Depends on library A with a DT_RUNPATH
669cc_test_library {
670 name: "libtest_dt_runpath_b",
671 defaults: ["bionic_testlib_defaults"],
672 srcs: ["empty.cpp"],
673 shared_libs: ["libtest_dt_runpath_a"],
674 relative_install_path: "bionic-loader-test-libs/dt_runpath_b_c_x",
675 ldflags: ["-Wl,--rpath,${ORIGIN}/../dt_runpath_a"],
676}
677
678// Depends on library A with an incorrect DT_RUNPATH. This does not matter
679// because B is the first in the D (below) dependency order, and library A
680// is already loaded using the correct DT_RUNPATH from library B.
681cc_test_library {
682 name: "libtest_dt_runpath_c",
683 defaults: ["bionic_testlib_defaults"],
684 srcs: ["empty.cpp"],
685 shared_libs: ["libtest_dt_runpath_a"],
686 relative_install_path: "bionic-loader-test-libs/dt_runpath_b_c_x",
687 ldflags: ["-Wl,--rpath,${ORIGIN}/invalid_dt_runpath"],
688}
689
690// D depends on B, C, and Y with DT_RUNPATH.
691cc_test_library {
692 name: "libtest_dt_runpath_d",
693 defaults: ["bionic_testlib_defaults"],
694 srcs: ["dlopen_b.cpp"],
695 shared_libs: [
696 "libtest_dt_runpath_b",
697 "libtest_dt_runpath_c",
698 "libtest_dt_runpath_y",
699 ],
700 ldflags: [
701 "-Wl,--rpath,${ORIGIN}/dt_runpath_b_c_x",
702 "-Wl,--rpath,${ORIGIN}/dt_runpath_y/${LIB}",
703 ],
704}
705
706// D version for open-from-zip test with runpath
707cc_test_library {
708 name: "libtest_dt_runpath_d_zip",
709 srcs: ["dlopen_b.cpp"],
710 shared_libs: [
711 "libtest_dt_runpath_b",
712 "libtest_dt_runpath_c",
713 "libtest_dt_runpath_y",
714 ],
715 cflags: [
716 "-Wall",
717 "-Werror",
718 ],
719 gtest: false,
720 relative_install_path: "libtest_dt_runpath_d_zip",
721 ldflags: [
722 "-Wl,--rpath,${ORIGIN}/dt_runpath_b_c_x",
723 "-Wl,--rpath,${ORIGIN}/dt_runpath_y/${LIB}",
724 ],
725 sanitize: {
726 address: false,
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700727 },
728 stl: "libc++_static",
729 target: {
730 darwin: {
731 enabled: false,
732 },
733 },
734}
735
736// A leaf library in a directory library D has DT_RUNPATH for.
737cc_test_library {
738 name: "libtest_dt_runpath_x",
739 defaults: ["bionic_testlib_defaults"],
740 srcs: ["empty.cpp"],
741 relative_install_path: "bionic-loader-test-libs/dt_runpath_b_c_x",
742}
743
744// A leaf library in lib or lib64 directory
745cc_test_library {
746 name: "libtest_dt_runpath_y",
747 defaults: ["bionic_testlib_defaults"],
748 srcs: ["empty.cpp"],
749
750 multilib: {
751 lib32: {
752 relative_install_path: "bionic-loader-test-libs/dt_runpath_y/lib",
753 },
754 lib64: {
755 relative_install_path: "bionic-loader-test-libs/dt_runpath_y/lib64",
756 },
757 },
758}
Colin Cross2722ebb2016-07-11 16:20:06 -0700759
760// -----------------------------------------------------------------------------
761// Build library with two parents
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700762//
763// Libraries used by dlfcn tests to verify local group ref_counting
764// libtest_two_parents*.so
Colin Cross2722ebb2016-07-11 16:20:06 -0700765// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700766
767// ..._child.so - correct answer
768cc_test_library {
769 name: "libtest_two_parents_child",
770 defaults: ["bionic_testlib_defaults"],
771 srcs: ["dlopen_2_parents_reloc_answer.cpp"],
772}
773
774// ..._parent1.so - correct answer
775cc_test_library {
776 name: "libtest_two_parents_parent1",
777 defaults: ["bionic_testlib_defaults"],
778 srcs: ["dlopen_check_order_reloc_answer_impl.cpp"],
779 shared_libs: ["libtest_two_parents_child"],
780 cflags: ["-D__ANSWER=42"],
781}
782
783// ..._parent2.so - incorrect answer
784cc_test_library {
785 name: "libtest_two_parents_parent2",
786 defaults: ["bionic_testlib_defaults"],
787 srcs: ["dlopen_check_order_reloc_answer_impl.cpp"],
788 shared_libs: ["libtest_two_parents_child"],
789 cflags: ["-D__ANSWER=1"],
790}
Colin Cross2722ebb2016-07-11 16:20:06 -0700791
792// -----------------------------------------------------------------------------
793// Build libtest_check_order_dlsym.so with its dependencies.
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700794//
795// Libraries used by dlfcn tests to verify correct load order:
Colin Cross2722ebb2016-07-11 16:20:06 -0700796// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700797
798// libtest_check_order_2_right.so
799cc_test_library {
800 name: "libtest_check_order_dlsym_2_right",
801 defaults: ["bionic_testlib_defaults"],
802 srcs: ["dlopen_check_order_dlsym_answer.cpp"],
803 cflags: ["-D__ANSWER=42"],
804}
805
806// libtest_check_order_a.so
807cc_test_library {
808 name: "libtest_check_order_dlsym_a",
809 defaults: ["bionic_testlib_defaults"],
810 srcs: ["dlopen_check_order_dlsym_answer.cpp"],
811 cflags: ["-D__ANSWER=1"],
812}
813
814// libtest_check_order_b.so
815cc_test_library {
816 name: "libtest_check_order_dlsym_b",
817 defaults: ["bionic_testlib_defaults"],
818 srcs: ["dlopen_check_order_dlsym_answer.cpp"],
819 cflags: [
820 "-D__ANSWER=2",
821 "-D__ANSWER2=43",
822 ],
823}
824
825// libtest_check_order_c.so
826cc_test_library {
827 name: "libtest_check_order_dlsym_3_c",
828 defaults: ["bionic_testlib_defaults"],
829 srcs: ["dlopen_check_order_dlsym_answer.cpp"],
830 cflags: ["-D__ANSWER=3"],
831}
832
833// libtest_check_order_d.so
834cc_test_library {
835 name: "libtest_check_order_dlsym_d",
836 defaults: ["bionic_testlib_defaults"],
837 shared_libs: ["libtest_check_order_dlsym_b"],
838 srcs: ["dlopen_check_order_dlsym_answer.cpp"],
839 cflags: [
840 "-D__ANSWER=4",
841 "-D__ANSWER2=4",
842 ],
843}
844
845// libtest_check_order_left.so
846cc_test_library {
847 name: "libtest_check_order_dlsym_1_left",
848 defaults: ["bionic_testlib_defaults"],
849 shared_libs: [
850 "libtest_check_order_dlsym_a",
851 "libtest_check_order_dlsym_b",
852 ],
853 srcs: ["empty.cpp"],
854}
855
856// libtest_check_order.so
857cc_test_library {
858 name: "libtest_check_order_dlsym",
859 defaults: ["bionic_testlib_defaults"],
860 shared_libs: [
861 "libtest_check_order_dlsym_1_left",
862 "libtest_check_order_dlsym_2_right",
863 "libtest_check_order_dlsym_3_c",
864 ],
865 srcs: ["empty.cpp"],
866}
Colin Cross2722ebb2016-07-11 16:20:06 -0700867
868// -----------------------------------------------------------------------------
869// Build libtest_check_order_siblings.so with its dependencies.
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700870//
871// Libraries used by dlfcn tests to verify correct relocation order:
872// libtest_check_order_reloc_siblings*.so
Colin Cross2722ebb2016-07-11 16:20:06 -0700873// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700874
875// ..._1.so - empty
876cc_test_library {
877 name: "libtest_check_order_reloc_siblings_1",
878 defaults: ["bionic_testlib_defaults"],
879 shared_libs: [
880 "libtest_check_order_reloc_siblings_a",
881 "libtest_check_order_reloc_siblings_b",
882 ],
883 srcs: ["empty.cpp"],
884}
885
886// ..._2.so - empty
887cc_test_library {
888 name: "libtest_check_order_reloc_siblings_2",
889 defaults: ["bionic_testlib_defaults"],
890 shared_libs: [
891 "libtest_check_order_reloc_siblings_c",
892 "libtest_check_order_reloc_siblings_d",
893 ],
894 srcs: [
895 "dlopen_check_order_reloc_grandchild_answer.cpp",
896 ],
897 allow_undefined_symbols: true,
898}
899
900// ..._3.so - get_answer2();
901cc_test_library {
902 name: "libtest_check_order_reloc_siblings_3",
903 defaults: ["bionic_testlib_defaults"],
904 shared_libs: [
905 "libtest_check_order_reloc_siblings_e",
906 "libtest_check_order_reloc_siblings_f",
907 ],
908 srcs: [
909 "dlopen_check_order_reloc_nephew_answer.cpp",
910 ],
911}
912
913// ..._a.so <- correct impl
914cc_test_library {
915 name: "libtest_check_order_reloc_siblings_a",
916 defaults: ["bionic_testlib_defaults"],
917 srcs: [
918 "dlopen_check_order_reloc_answer_impl.cpp",
919 ],
920 cflags: ["-D__ANSWER=42"],
921}
922
923// ..._b.so
924cc_test_library {
925 name: "libtest_check_order_reloc_siblings_b",
926 defaults: ["bionic_testlib_defaults"],
927 srcs: [
928 "dlopen_check_order_reloc_answer_impl.cpp",
929 ],
930 cflags: ["-D__ANSWER=1"],
931}
932
933// ..._c.so
934cc_test_library {
935 name: "libtest_check_order_reloc_siblings_c",
936 defaults: ["bionic_testlib_defaults"],
937 shared_libs: [
938 "libtest_check_order_reloc_siblings_c_1",
939 "libtest_check_order_reloc_siblings_c_2",
940 ],
941 srcs: [
942 "dlopen_check_order_reloc_answer_impl.cpp",
943 ],
944 cflags: ["-D__ANSWER=2"],
945}
946
947// ..._d.so
948cc_test_library {
949 name: "libtest_check_order_reloc_siblings_d",
950 defaults: ["bionic_testlib_defaults"],
951 srcs: [
952 "dlopen_check_order_reloc_answer_impl.cpp",
953 ],
954 cflags: ["-D__ANSWER=3"],
955}
956
957// ..._e.so
958cc_test_library {
959 name: "libtest_check_order_reloc_siblings_e",
960 defaults: ["bionic_testlib_defaults"],
961 srcs: [
962 "dlopen_check_order_reloc_answer_impl.cpp",
963 ],
964 cflags: [
965 "-D__ANSWER=4",
966 ],
967}
968
969// ..._f.so <- get_answer()
970cc_test_library {
971 name: "libtest_check_order_reloc_siblings_f",
972 defaults: ["bionic_testlib_defaults"],
973 srcs: [
974 "dlopen_check_order_reloc_answer.cpp",
975 ],
976}
977
978// ..._c_1.so
979cc_test_library {
980 name: "libtest_check_order_reloc_siblings_c_1",
981 defaults: ["bionic_testlib_defaults"],
982 srcs: [
983 "dlopen_check_order_reloc_grandchild_answer_impl.cpp",
984 ],
985 cflags: ["-D__ANSWER=42"],
986}
987
988// ..._c_2.so
989cc_test_library {
990 name: "libtest_check_order_reloc_siblings_c_2",
991 defaults: ["bionic_testlib_defaults"],
992 srcs: [
993 "dlopen_check_order_reloc_grandchild_answer_impl.cpp",
994 ],
995 cflags: ["-D__ANSWER=0"],
996}
997
998// libtest_check_order_reloc_siblings.so
999cc_test_library {
1000 name: "libtest_check_order_reloc_siblings",
1001 defaults: ["bionic_testlib_defaults"],
1002 shared_libs: [
1003 "libtest_check_order_reloc_siblings_1",
1004 "libtest_check_order_reloc_siblings_2",
1005 "libtest_check_order_reloc_siblings_3",
1006 ],
1007 srcs: [
1008 "empty.cpp",
1009 ],
1010}
Colin Cross2722ebb2016-07-11 16:20:06 -07001011
1012// -----------------------------------------------------------------------------
1013// Build libtest_check_order_root.so with its dependencies.
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -07001014//
1015// Libraries used by dlfcn tests to verify correct relocation order:
1016// libtest_check_order_reloc_root*.so
Colin Cross2722ebb2016-07-11 16:20:06 -07001017// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -07001018
1019// ..._1.so - empty
1020cc_test_library {
1021 name: "libtest_check_order_reloc_root_1",
1022 defaults: ["bionic_testlib_defaults"],
1023 srcs: ["empty.cpp"],
1024}
1025
1026// ..._2.so - this one has the incorrect answer
1027cc_test_library {
1028 name: "libtest_check_order_reloc_root_2",
1029 defaults: ["bionic_testlib_defaults"],
1030 srcs: ["dlopen_check_order_reloc_root_answer_impl.cpp"],
1031 cflags: ["-D__ANSWER=2"],
1032}
1033
1034// libtest_check_order_reloc_root.so <- implements get_answer3()
1035cc_test_library {
1036 name: "libtest_check_order_reloc_root",
1037 defaults: ["bionic_testlib_defaults"],
1038 srcs: ["dlopen_check_order_reloc_root_answer.cpp"],
1039 shared_libs: [
1040 "libtest_check_order_reloc_root_1",
1041 "libtest_check_order_reloc_root_2",
1042 ],
1043}
Colin Cross2722ebb2016-07-11 16:20:06 -07001044
1045// -----------------------------------------------------------------------------
1046// Build libtest_versioned_lib.so with its dependencies.
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -07001047//
1048// Libraries used to test versioned symbols
Colin Cross2722ebb2016-07-11 16:20:06 -07001049// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -07001050
1051cc_test_library {
1052 name: "libtest_versioned_uselibv1",
1053 defaults: ["bionic_testlib_defaults"],
1054 srcs: ["versioned_uselib.cpp"],
1055 shared_libs: ["libtest_versioned_libv1"],
1056}
1057
1058cc_test_library {
1059 name: "libtest_versioned_uselibv2",
1060 defaults: ["bionic_testlib_defaults"],
1061 srcs: ["versioned_uselib.cpp"],
1062 shared_libs: ["libtest_versioned_libv2"],
1063 version_script: "versioned_uselib.map",
1064}
1065
1066cc_test_library {
1067 name: "libtest_versioned_uselibv2_other",
1068 defaults: ["bionic_testlib_defaults"],
1069 srcs: ["versioned_uselib.cpp"],
1070 shared_libs: [
1071 "libtest_versioned_otherlib_empty",
1072 "libtest_versioned_libv2",
1073 ],
1074}
1075
1076cc_test_library {
1077 name: "libtest_versioned_uselibv3_other",
1078 defaults: ["bionic_testlib_defaults"],
1079 srcs: ["versioned_uselib.cpp"],
1080 shared_libs: [
1081 "libtest_versioned_otherlib_empty",
1082 "libtest_versioned_lib",
1083 ],
1084}
1085
1086// lib v1 - this one used during static linking but never used at runtime
1087// which forces libtest_versioned_uselibv1 to use function v1 from
1088// libtest_versioned_lib.so
1089cc_test_library {
1090 name: "libtest_versioned_libv1",
1091 defaults: ["bionic_testlib_defaults"],
1092 srcs: ["versioned_lib_v1.cpp"],
1093 version_script: "versioned_lib_v1.map",
1094 ldflags: ["-Wl,-soname,libtest_versioned_lib.so"],
1095}
1096
1097// lib v2 - to make libtest_versioned_uselibv2.so use version 2 of versioned_function()
1098cc_test_library {
1099 name: "libtest_versioned_libv2",
1100 defaults: ["bionic_testlib_defaults"],
1101 srcs: ["versioned_lib_v2.cpp"],
1102 version_script: "versioned_lib_v2.map",
1103 ldflags: ["-Wl,-soname,libtest_versioned_lib.so"],
1104}
1105
1106// last version - this one is used at the runtime and exports 3 versions
1107// of versioned_symbol().
1108cc_test_library {
1109 name: "libtest_versioned_lib",
1110 defaults: ["bionic_testlib_defaults"],
1111 srcs: ["versioned_lib_v3.cpp"],
1112 version_script: "versioned_lib_v3.map",
1113}
1114
1115// This library is empty, the actual implementation will provide an unversioned
1116// symbol for versioned_function().
1117cc_test_library {
1118 name: "libtest_versioned_otherlib_empty",
1119 defaults: ["bionic_testlib_defaults"],
1120 srcs: ["empty.cpp"],
1121 ldflags: ["-Wl,-soname,libtest_versioned_otherlib.so"],
1122}
1123
1124cc_test_library {
1125 name: "libtest_versioned_otherlib",
1126 defaults: ["bionic_testlib_defaults"],
1127 srcs: ["versioned_lib_other.cpp"],
1128 version_script: "versioned_lib_other.map",
1129}
Colin Cross2722ebb2016-07-11 16:20:06 -07001130
1131// -----------------------------------------------------------------------------
1132// Build libraries needed by pthread_atfork tests
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -07001133
1134// This library used to test phtread_atfork handler behaviour
1135// during/after dlclose.
Colin Cross2722ebb2016-07-11 16:20:06 -07001136// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -07001137cc_test_library {
1138 name: "libtest_pthread_atfork",
1139 defaults: ["bionic_testlib_defaults"],
1140 srcs: ["pthread_atfork.cpp"],
1141}
Colin Cross2722ebb2016-07-11 16:20:06 -07001142
1143// -----------------------------------------------------------------------------
1144// Library with dependency loop used by dlfcn tests
1145//
1146// libtest_with_dependency_loop -> a -> b -> c -> a
1147// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001148cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001149 name: "libtest_with_dependency_loop",
1150 defaults: ["bionic_testlib_defaults"],
1151 srcs: ["dlopen_testlib_loopy_root.cpp"],
1152 shared_libs: ["libtest_with_dependency_loop_a"],
1153}
1154
1155// -----------------------------------------------------------------------------
1156// libtest_with_dependency_loop_a.so
1157// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001158cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001159 name: "libtest_with_dependency_loop_a",
1160 defaults: ["bionic_testlib_defaults"],
1161 srcs: ["dlopen_testlib_loopy_a.cpp"],
1162 shared_libs: ["libtest_with_dependency_loop_b_tmp"],
1163}
1164
1165// -----------------------------------------------------------------------------
1166// libtest_with_dependency_loop_b.so
1167//
1168// this is temporary placeholder - will be removed
1169// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001170cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001171 name: "libtest_with_dependency_loop_b_tmp",
1172 defaults: ["bionic_testlib_defaults"],
1173 srcs: ["dlopen_testlib_loopy_invalid.cpp"],
1174 ldflags: ["-Wl,-soname=libtest_with_dependency_loop_b.so"],
1175}
1176
1177// -----------------------------------------------------------------------------
1178// libtest_with_dependency_loop_b.so
1179// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001180cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001181 name: "libtest_with_dependency_loop_b",
1182 defaults: ["bionic_testlib_defaults"],
1183 srcs: ["dlopen_testlib_loopy_b.cpp"],
1184 shared_libs: ["libtest_with_dependency_loop_c"],
1185}
1186
1187// -----------------------------------------------------------------------------
1188// libtest_with_dependency_loop_c.so
1189// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001190cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001191 name: "libtest_with_dependency_loop_c",
1192 defaults: ["bionic_testlib_defaults"],
1193 srcs: ["dlopen_testlib_loopy_c.cpp"],
1194 shared_libs: ["libtest_with_dependency_loop_a"],
1195}
1196
1197// -----------------------------------------------------------------------------
1198// libtest_relo_check_dt_needed_order.so
1199// |
1200// +-> libtest_relo_check_dt_needed_order_1.so
1201// |
1202// +-> libtest_relo_check_dt_needed_order_2.so
1203// -----------------------------------------------------------------------------
1204
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001205cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001206 name: "libtest_relo_check_dt_needed_order",
1207 defaults: ["bionic_testlib_defaults"],
1208 srcs: ["dlopen_testlib_relo_check_dt_needed_order.cpp"],
1209 shared_libs: [
1210 "libtest_relo_check_dt_needed_order_1",
1211 "libtest_relo_check_dt_needed_order_2",
1212 ],
1213}
1214
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001215cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001216 name: "libtest_relo_check_dt_needed_order_1",
1217 defaults: ["bionic_testlib_defaults"],
1218 srcs: ["dlopen_testlib_relo_check_dt_needed_order_1.cpp"],
1219}
1220
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001221cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001222 name: "libtest_relo_check_dt_needed_order_2",
1223 defaults: ["bionic_testlib_defaults"],
1224 srcs: ["dlopen_testlib_relo_check_dt_needed_order_2.cpp"],
1225}
1226
1227// -----------------------------------------------------------------------------
1228// Library with dependency used by dlfcn tests
1229// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -07001230cc_test_library {
1231 name: "libtest_with_dependency",
1232 defaults: ["bionic_testlib_defaults"],
1233 srcs: ["dlopen_testlib_simple.cpp"],
1234 shared_libs: ["libdlext_test"],
1235}
Colin Cross2722ebb2016-07-11 16:20:06 -07001236
1237// -----------------------------------------------------------------------------
1238// Library used by ifunc tests
1239// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001240cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001241 name: "libtest_ifunc",
1242 defaults: ["bionic_testlib_defaults"],
Dimitry Ivanov21975b22017-05-02 16:31:56 -07001243 srcs: ["dlopen_testlib_ifunc.cpp"],
Dimitry Ivanov21975b22017-05-02 16:31:56 -07001244}
1245
1246cc_test_library {
1247 name: "libtest_ifunc_variable",
1248 defaults: ["bionic_testlib_defaults"],
1249 srcs: ["dlopen_testlib_ifunc_variable.cpp"],
Elliott Hughesd50a1de2018-02-05 17:30:57 -08001250 shared_libs: ["libtest_ifunc_variable_impl"],
Dimitry Ivanov21975b22017-05-02 16:31:56 -07001251}
1252
1253cc_test_library {
1254 name: "libtest_ifunc_variable_impl",
1255 defaults: ["bionic_testlib_defaults"],
1256 srcs: ["dlopen_testlib_ifunc_variable_impl.cpp"],
Colin Cross2722ebb2016-07-11 16:20:06 -07001257}
1258
1259// -----------------------------------------------------------------------------
1260// Library used by atexit tests
1261// -----------------------------------------------------------------------------
1262
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001263cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001264 name: "libtest_atexit",
1265 defaults: ["bionic_testlib_defaults"],
1266 srcs: ["atexit_testlib.cpp"],
1267}
1268
1269// -----------------------------------------------------------------------------
1270// This library is used by dl_load test to check symbol preempting
1271// by main executable
1272// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001273cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001274 name: "libdl_preempt_test_1",
1275 defaults: ["bionic_testlib_defaults"],
1276 srcs: ["dl_preempt_library_1.cpp"],
1277}
1278
1279// -----------------------------------------------------------------------------
1280// This library is used by dl_load test to check symbol preempting
1281// by libdl_preempt_test_1.so
1282// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001283cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001284 name: "libdl_preempt_test_2",
1285 defaults: ["bionic_testlib_defaults"],
1286 srcs: ["dl_preempt_library_2.cpp"],
1287}
1288
1289// -----------------------------------------------------------------------------
1290// Library with DF_1_GLOBAL
1291// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001292cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001293 name: "libdl_test_df_1_global",
1294 defaults: ["bionic_testlib_defaults"],
1295 srcs: ["dl_df_1_global.cpp"],
1296 ldflags: ["-Wl,-z,global"],
Colin Cross2722ebb2016-07-11 16:20:06 -07001297}
1298
1299// -----------------------------------------------------------------------------
1300// Library using symbol from libdl_test_df_1_global
1301// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001302cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001303 name: "libtest_dlsym_df_1_global",
1304 defaults: ["bionic_testlib_defaults"],
1305 srcs: ["dl_df_1_use_global.cpp"],
1306}
1307
1308// -----------------------------------------------------------------------------
Jiyong Park01162f22017-10-16 15:31:09 +09001309// Library with DF_1_GLOBAL which will be dlopened
1310// (note: libdl_test_df_1_global above will be included in DT_NEEDED)
1311// -----------------------------------------------------------------------------
1312cc_test_library {
1313 name: "libtest_dlopen_df_1_global",
1314 defaults: ["bionic_testlib_defaults"],
1315 srcs: ["dl_df_1_global_dummy.cpp"],
1316 ldflags: ["-Wl,-z,global"],
Jiyong Park01162f22017-10-16 15:31:09 +09001317}
1318
Jiyong Park01162f22017-10-16 15:31:09 +09001319// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -07001320// Library with weak function
1321// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001322cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001323 name: "libtest_dlsym_weak_func",
1324 defaults: ["bionic_testlib_defaults"],
1325 srcs: ["dlsym_weak_function.cpp"],
1326}
1327
1328// -----------------------------------------------------------------------------
1329// Library to check RTLD_LOCAL with dlsym in 'this'
1330// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001331cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001332 name: "libtest_dlsym_from_this",
1333 defaults: ["bionic_testlib_defaults"],
1334 srcs: ["dlsym_from_this_symbol.cpp"],
1335 shared_libs: ["libtest_dlsym_from_this_child"],
Colin Cross2722ebb2016-07-11 16:20:06 -07001336}
1337
1338// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001339cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001340 name: "libtest_dlsym_from_this_child",
1341 defaults: ["bionic_testlib_defaults"],
1342 srcs: ["dlsym_from_this_functions.cpp"],
1343 shared_libs: ["libtest_dlsym_from_this_grandchild"],
1344}
1345
1346// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001347cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001348 name: "libtest_dlsym_from_this_grandchild",
1349 defaults: ["bionic_testlib_defaults"],
1350 srcs: ["dlsym_from_this_symbol2.cpp"],
1351}
1352
1353// -----------------------------------------------------------------------------
1354// Empty library
1355// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001356cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001357 name: "libtest_empty",
1358 defaults: ["bionic_testlib_defaults"],
1359 srcs: ["empty.cpp"],
1360}
1361
1362// -----------------------------------------------------------------------------
dimitry8db36a52017-10-23 15:10:10 +02001363// Library for inaccessible shared library test
1364// -----------------------------------------------------------------------------
1365cc_test_library {
1366 name: "libtestshared",
1367 defaults: ["bionic_testlib_defaults"],
1368 srcs: ["empty.cpp"],
Nan Zhangdab0fd52017-11-07 11:05:24 -08001369 relative_install_path: "bionic-loader-test-libs/inaccessible_libs",
dimitry8db36a52017-10-23 15:10:10 +02001370}
1371
1372// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -07001373// Library with weak undefined function
1374// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001375cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001376 name: "libtest_dlopen_weak_undefined_func",
1377 defaults: ["bionic_testlib_defaults"],
1378 srcs: ["dlopen_weak_undefined.cpp"],
1379}
1380
1381// -----------------------------------------------------------------------------
Dimitry Ivanovd0b5c3a2016-11-25 12:23:11 -08001382// Check that RTLD_NEXT of a libc symbol works in dlopened library
1383// -----------------------------------------------------------------------------
1384cc_test_library {
1385 name: "libtest_check_rtld_next_from_library",
1386 defaults: ["bionic_testlib_defaults"],
1387 srcs: ["check_rtld_next_from_library.cpp"],
Pirama Arumuga Nainar8035caa2020-06-09 12:48:10 -07001388 native_coverage: false,
Dimitry Ivanovd0b5c3a2016-11-25 12:23:11 -08001389}
1390
1391// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -07001392// Library with constructor that calls dlopen() b/7941716
1393// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001394cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001395 name: "libtest_dlopen_from_ctor",
1396 defaults: ["bionic_testlib_defaults"],
1397 srcs: ["dlopen_testlib_dlopen_from_ctor.cpp"],
Colin Cross2722ebb2016-07-11 16:20:06 -07001398}
1399
1400// -----------------------------------------------------------------------------
Dimitry Ivanovec90e242017-02-10 11:04:20 -08001401// Libraries used to check init/fini call order
Dimitry Ivanovea8f3962017-02-09 13:31:57 -08001402// -----------------------------------------------------------------------------
1403cc_test_library {
1404 name: "libtest_init_fini_order_root",
1405 defaults: ["bionic_testlib_defaults"],
1406 srcs: ["dlopen_check_init_fini_root.cpp"],
Dimitry Ivanovec90e242017-02-10 11:04:20 -08001407 shared_libs: [
1408 "libtest_init_fini_order_child",
1409 "libtest_init_fini_order_grand_child",
1410 ],
1411}
1412
1413cc_test_library {
1414 name: "libtest_init_fini_order_root2",
1415 defaults: ["bionic_testlib_defaults"],
1416 srcs: ["dlopen_check_init_fini_root.cpp"],
1417 shared_libs: [
1418 "libtest_init_fini_order_grand_child",
1419 "libtest_init_fini_order_child",
1420 ],
Dimitry Ivanovea8f3962017-02-09 13:31:57 -08001421}
1422
1423cc_test_library {
1424 name: "libtest_init_fini_order_child",
1425 defaults: ["bionic_testlib_defaults"],
1426 srcs: ["dlopen_check_init_fini_child.cpp"],
1427 shared_libs: ["libtest_init_fini_order_grand_child"],
1428}
1429
1430cc_test_library {
1431 name: "libtest_init_fini_order_grand_child",
1432 defaults: ["bionic_testlib_defaults"],
1433 srcs: ["dlopen_check_init_fini_grand_child.cpp"],
1434}
1435
1436// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -07001437// Library that depends on the library with constructor that calls dlopen() b/7941716
1438// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001439cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001440 name: "libtest_dlopen_from_ctor_main",
1441 defaults: ["bionic_testlib_defaults"],
1442 srcs: ["empty.cpp"],
1443 shared_libs: ["libtest_dlopen_from_ctor"],
1444}
1445
1446// -----------------------------------------------------------------------------
dimitry55547db2018-05-25 14:17:37 +02001447// Libraries with non-trivial thread_local variable to test dlclose()
dimitry06016f22018-01-05 11:39:28 +01001448// -----------------------------------------------------------------------------
1449cc_test_library {
1450 name: "libtest_thread_local_dtor",
1451 defaults: ["bionic_testlib_defaults"],
1452 srcs: ["thread_local_dtor.cpp"],
1453}
1454
dimitry55547db2018-05-25 14:17:37 +02001455cc_test_library {
1456 name: "libtest_thread_local_dtor2",
1457 defaults: ["bionic_testlib_defaults"],
1458 srcs: ["thread_local_dtor2.cpp"],
1459}
1460
1461// -----------------------------------------------------------------------------
1462// Library dt_needs libtest_thread_local_dtor/2 (to check no-unload on load_group)
1463// -----------------------------------------------------------------------------
1464cc_test_library {
1465 name: "libtest_indirect_thread_local_dtor",
1466 defaults: ["bionic_testlib_defaults"],
1467 srcs: ["empty.cpp"],
1468 shared_libs: [
1469 "libtest_thread_local_dtor",
1470 "libtest_thread_local_dtor2",
1471 ],
1472}
1473
dimitry06016f22018-01-05 11:39:28 +01001474// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -07001475// Tool to use to align the shared libraries in a zip file.
1476// -----------------------------------------------------------------------------
1477cc_binary_host {
1478 name: "bionic_tests_zipalign",
1479 srcs: ["bionic_tests_zipalign.cpp"],
1480 cflags: [
1481 "-Wall",
1482 "-Werror",
1483 ],
1484
1485 static_libs: [
1486 "libziparchive",
1487 "liblog",
1488 "libbase",
1489 "libz",
1490 "libutils",
1491 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001492}
Evgenii Stepanov0a3637d2016-07-06 13:20:59 -07001493
1494cc_test_library {
1495 name: "libcfi-test",
1496 defaults: ["bionic_testlib_defaults"],
1497 srcs: ["cfi_test_lib.cpp"],
1498 sanitize: {
1499 cfi: false,
1500 },
1501}
1502
1503cc_test_library {
1504 name: "libcfi-test-bad",
1505 defaults: ["bionic_testlib_defaults"],
1506 srcs: ["cfi_test_bad_lib.cpp"],
1507 sanitize: {
1508 cfi: false,
1509 },
1510}
Evgenii Stepanov68ecec12017-01-31 13:19:30 -08001511
1512cc_test {
1513 name: "cfi_test_helper",
1514 host_supported: false,
1515 defaults: ["bionic_testlib_defaults"],
1516 srcs: ["cfi_test_helper.cpp"],
1517 ldflags: ["-rdynamic"],
1518}
1519
1520cc_test {
1521 name: "cfi_test_helper2",
1522 host_supported: false,
1523 defaults: ["bionic_testlib_defaults"],
1524 srcs: ["cfi_test_helper2.cpp"],
1525 shared_libs: ["libcfi-test"],
1526 ldflags: ["-Wl,--rpath,${ORIGIN}/.."],
1527}
Elliott Hugheseb04ed52017-03-29 13:48:02 -07001528
1529cc_test {
1530 name: "preinit_getauxval_test_helper",
1531 host_supported: false,
1532 defaults: ["bionic_testlib_defaults"],
1533 srcs: ["preinit_getauxval_test_helper.cpp"],
1534}
1535
1536cc_test {
1537 name: "preinit_syscall_test_helper",
1538 host_supported: false,
1539 defaults: ["bionic_testlib_defaults"],
1540 srcs: ["preinit_syscall_test_helper.cpp"],
1541}
Jiyong Park02586a22017-05-20 01:01:24 +09001542
1543cc_test {
1544 name: "ld_preload_test_helper",
1545 host_supported: false,
1546 defaults: ["bionic_testlib_defaults"],
1547 srcs: ["ld_preload_test_helper.cpp"],
1548 shared_libs: ["ld_preload_test_helper_lib1"],
1549 ldflags: ["-Wl,--rpath,${ORIGIN}/.."],
1550}
1551
1552cc_test_library {
1553 name: "ld_preload_test_helper_lib1",
1554 host_supported: false,
1555 defaults: ["bionic_testlib_defaults"],
1556 srcs: ["ld_preload_test_helper_lib1.cpp"],
1557}
1558
1559cc_test_library {
1560 name: "ld_preload_test_helper_lib2",
1561 host_supported: false,
1562 defaults: ["bionic_testlib_defaults"],
1563 srcs: ["ld_preload_test_helper_lib2.cpp"],
1564}
1565
1566cc_test {
1567 name: "ld_config_test_helper",
1568 host_supported: false,
1569 defaults: ["bionic_testlib_defaults"],
1570 srcs: ["ld_config_test_helper.cpp"],
1571 shared_libs: ["ld_config_test_helper_lib1"],
1572 ldflags: ["-Wl,--rpath,${ORIGIN}/.."],
1573}
1574
1575cc_test_library {
1576 name: "ld_config_test_helper_lib1",
1577 host_supported: false,
1578 defaults: ["bionic_testlib_defaults"],
1579 srcs: ["ld_config_test_helper_lib1.cpp"],
1580 shared_libs: ["ld_config_test_helper_lib2"],
Nan Zhangdab0fd52017-11-07 11:05:24 -08001581 relative_install_path: "bionic-loader-test-libs/ns2",
Ryan Prichard058eb8f2020-12-17 22:59:04 -08001582 // Mark the library DF_1_GLOBAL so it is added to every linker namespace.
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001583 ldflags: ["-Wl,-z,global"],
Jiyong Park02586a22017-05-20 01:01:24 +09001584}
1585
1586cc_test_library {
1587 name: "ld_config_test_helper_lib2",
1588 host_supported: false,
1589 defaults: ["bionic_testlib_defaults"],
1590 srcs: ["ld_config_test_helper_lib2.cpp"],
Nan Zhangdab0fd52017-11-07 11:05:24 -08001591 relative_install_path: "bionic-loader-test-libs/ns2",
Jiyong Park02586a22017-05-20 01:01:24 +09001592}
1593
1594cc_test_library {
1595 name: "ld_config_test_helper_lib3",
1596 host_supported: false,
1597 defaults: ["bionic_testlib_defaults"],
1598 srcs: ["ld_config_test_helper_lib3.cpp"],
1599}
Ryan Prichard8f639a42018-10-01 23:10:05 -07001600
1601cc_test {
1602 name: "exec_linker_helper",
1603 host_supported: false,
1604 defaults: ["bionic_testlib_defaults"],
1605 srcs: ["exec_linker_helper.cpp"],
1606 shared_libs: ["exec_linker_helper_lib"],
1607 ldflags: ["-Wl,--rpath,${ORIGIN}/.."],
1608}
1609
1610cc_test_library {
1611 name: "exec_linker_helper_lib",
1612 host_supported: false,
1613 defaults: ["bionic_testlib_defaults"],
1614 srcs: ["exec_linker_helper_lib.cpp"],
1615}
Peter Collingbourneb39cb3c2019-03-01 13:12:49 -08001616
1617cc_test_library {
1618 name: "libsegment_gap_outer",
1619 host_supported: false,
1620 defaults: ["bionic_testlib_defaults"],
1621 srcs: ["segment_gap_outer.cpp"],
1622 ldflags: ["-Wl,-T,bionic/tests/libs/segment_gap_outer.lds"],
1623}
1624
1625cc_test_library {
1626 name: "libsegment_gap_inner",
1627 host_supported: false,
1628 defaults: ["bionic_testlib_defaults"],
1629 srcs: ["segment_gap_inner.cpp"],
1630}
Elliott Hughes6663f552020-01-24 14:36:10 -08001631
Elliott Hughes6663f552020-01-24 14:36:10 -08001632// -----------------------------------------------------------------------------
Elliott Hughes6dd1f582020-01-28 12:18:35 -08001633// Check that we support all kinds of relocations: regular, "relocation packer",
1634// and both the old and new SHT_RELR constants.
Elliott Hughes6663f552020-01-24 14:36:10 -08001635// -----------------------------------------------------------------------------
1636
Elliott Hughes6dd1f582020-01-28 12:18:35 -08001637// This is what got standardized for SHT_RELR.
Elliott Hughes6663f552020-01-24 14:36:10 -08001638cc_test_library {
Elliott Hughes6dd1f582020-01-28 12:18:35 -08001639 name: "librelocations-RELR",
1640 ldflags: [
1641 "-Wl,--pack-dyn-relocs=relr",
1642 "-Wl,--no-use-android-relr-tags",
1643 ],
Elliott Hughes6663f552020-01-24 14:36:10 -08001644 host_supported: false,
1645 defaults: ["bionic_testlib_defaults"],
Elliott Hughes6dd1f582020-01-28 12:18:35 -08001646 srcs: ["relocations.cpp"],
Elliott Hughes6663f552020-01-24 14:36:10 -08001647}
1648
Elliott Hughes6dd1f582020-01-28 12:18:35 -08001649// This is the same encoding as SHT_RELR, but using OS-specific constants.
Elliott Hughes6663f552020-01-24 14:36:10 -08001650cc_test_library {
Elliott Hughes6dd1f582020-01-28 12:18:35 -08001651 name: "librelocations-ANDROID_RELR",
1652 ldflags: [
1653 "-Wl,--pack-dyn-relocs=relr",
1654 "-Wl,--use-android-relr-tags",
1655 ],
Elliott Hughes6663f552020-01-24 14:36:10 -08001656 host_supported: false,
1657 defaults: ["bionic_testlib_defaults"],
Elliott Hughes6dd1f582020-01-28 12:18:35 -08001658 srcs: ["relocations.cpp"],
1659}
1660
1661// This is the old relocation packer encoding (DT_ANDROID_REL/DT_ANDROID_RELA).
1662cc_test_library {
1663 name: "librelocations-ANDROID_REL",
1664 ldflags: ["-Wl,--pack-dyn-relocs=android"],
1665 host_supported: false,
1666 defaults: ["bionic_testlib_defaults"],
1667 srcs: ["relocations.cpp"],
1668}
1669
1670// This is not packed at all.
1671cc_test_library {
1672 name: "librelocations-fat",
1673 ldflags: ["-Wl,--pack-dyn-relocs=none"],
1674 host_supported: false,
1675 defaults: ["bionic_testlib_defaults"],
1676 srcs: ["relocations.cpp"],
Elliott Hughes6663f552020-01-24 14:36:10 -08001677}
Evgenii Stepanov51741fb2021-01-06 16:03:15 -08001678
1679cc_defaults {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001680 name: "bionic_targets_only",
1681 enabled: false,
1682 target: {
1683 android: {
1684 enabled: true,
1685 },
1686 linux_bionic: {
1687 enabled: true,
1688 },
1689 },
Evgenii Stepanov51741fb2021-01-06 16:03:15 -08001690}
1691
1692cc_test {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001693 name: "heap_tagging_sync_helper",
1694 defaults: [
1695 "bionic_testlib_defaults",
1696 "bionic_targets_only",
1697 ],
1698 srcs: ["heap_tagging_helper.cpp"],
1699 sanitize: {
1700 memtag_heap: true,
1701 diag: {
1702 memtag_heap: true,
1703 },
1704 hwaddress: false,
1705 },
Evgenii Stepanov51741fb2021-01-06 16:03:15 -08001706}
1707
1708cc_test {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001709 name: "heap_tagging_async_helper",
1710 defaults: [
1711 "bionic_testlib_defaults",
1712 "bionic_targets_only",
1713 ],
1714 srcs: ["heap_tagging_helper.cpp"],
1715 sanitize: {
1716 memtag_heap: true,
1717 diag: {
1718 memtag_heap: false,
1719 },
1720 hwaddress: false,
1721 },
Evgenii Stepanov51741fb2021-01-06 16:03:15 -08001722}
1723
1724cc_test {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001725 name: "heap_tagging_disabled_helper",
1726 defaults: [
1727 "bionic_testlib_defaults",
1728 "bionic_targets_only",
1729 ],
1730 srcs: ["heap_tagging_helper.cpp"],
1731 sanitize: {
1732 memtag_heap: false,
1733 hwaddress: false,
1734 },
Evgenii Stepanov51741fb2021-01-06 16:03:15 -08001735}
1736
1737cc_test {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001738 name: "heap_tagging_static_sync_helper",
1739 defaults: [
1740 "bionic_testlib_defaults",
1741 "bionic_targets_only",
1742 ],
1743 srcs: ["heap_tagging_helper.cpp"],
1744 static_executable: true,
1745 sanitize: {
1746 memtag_heap: true,
1747 diag: {
1748 memtag_heap: true,
1749 },
1750 hwaddress: false,
1751 },
Evgenii Stepanov51741fb2021-01-06 16:03:15 -08001752}
1753
1754cc_test {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001755 name: "heap_tagging_static_async_helper",
1756 defaults: [
1757 "bionic_testlib_defaults",
1758 "bionic_targets_only",
1759 ],
1760 srcs: ["heap_tagging_helper.cpp"],
1761 static_executable: true,
1762 sanitize: {
1763 memtag_heap: true,
1764 diag: {
1765 memtag_heap: false,
1766 },
1767 hwaddress: false,
1768 },
Evgenii Stepanov51741fb2021-01-06 16:03:15 -08001769}
1770
1771cc_test {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001772 name: "heap_tagging_static_disabled_helper",
1773 defaults: [
1774 "bionic_testlib_defaults",
1775 "bionic_targets_only",
1776 ],
1777 srcs: ["heap_tagging_helper.cpp"],
1778 static_executable: true,
1779 sanitize: {
1780 memtag_heap: false,
1781 hwaddress: false,
1782 },
Evgenii Stepanov51741fb2021-01-06 16:03:15 -08001783}
Colin Crossbadcb382021-09-24 17:49:58 -07001784
Florian Mayerc82d7fc2022-08-31 20:57:03 +00001785cc_test {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001786 name: "stack_tagging_helper",
1787 defaults: [
1788 "bionic_testlib_defaults",
1789 "bionic_targets_only",
1790 ],
1791 srcs: ["stack_tagging_helper.cpp"],
1792 sanitize: {
1793 memtag_heap: true,
1794 memtag_stack: true,
1795 diag: {
1796 memtag_heap: true,
1797 },
1798 hwaddress: false,
1799 },
1800 header_libs: ["bionic_libc_platform_headers"],
1801 cflags: ["-fexceptions"],
Florian Mayerc82d7fc2022-08-31 20:57:03 +00001802}
1803
1804cc_test {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001805 name: "stack_tagging_static_helper",
1806 defaults: [
1807 "bionic_testlib_defaults",
1808 "bionic_targets_only",
1809 ],
1810 srcs: ["stack_tagging_helper.cpp"],
1811 static_executable: true,
1812 sanitize: {
1813 memtag_heap: true,
1814 memtag_stack: true,
1815 diag: {
1816 memtag_heap: true,
1817 },
1818 hwaddress: false,
1819 },
1820 header_libs: ["bionic_libc_platform_headers"],
1821 cflags: ["-fexceptions"],
Florian Mayerc82d7fc2022-08-31 20:57:03 +00001822}
1823
Colin Crossbadcb382021-09-24 17:49:58 -07001824cc_genrule {
1825 name: "libdlext_test_zip_zipaligned",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001826 out: ["bionic-loader-test-libs/libdlext_test_zip/libdlext_test_zip_zipaligned.zip"],
Colin Crossbadcb382021-09-24 17:49:58 -07001827 tools: [
1828 "soong_zip",
1829 "bionic_tests_zipalign",
1830 ],
1831 srcs: [
1832 ":libdlext_test_zip",
1833 ":libatest_simple_zip",
1834 ":exec_linker_helper",
1835 ":exec_linker_helper_lib",
1836 ],
1837 cmd: "mkdir -p $(genDir)/zipdir/libdir &&" +
1838 " cp $(in) $(genDir)/zipdir/libdir/ &&" +
1839 " touch $(genDir)/zipdir/empty_file.txt &&" +
1840 " $(location soong_zip) -o $(out).unaligned -L 0 -C $(genDir)/zipdir -D $(genDir)/zipdir &&" +
1841 " $(location bionic_tests_zipalign) 4096 $(out).unaligned $(out)",
1842
Colin Crossbadcb382021-09-24 17:49:58 -07001843}
1844
1845cc_genrule {
1846 name: "libdlext_test_runpath_zip_zipaligned",
1847 out: ["bionic-loader-test-libs/libdlext_test_runpath_zip/libdlext_test_runpath_zip_zipaligned.zip"],
1848 tools: [
1849 "soong_zip",
1850 "bionic_tests_zipalign",
1851 ],
1852 srcs: [
1853 ":libtest_dt_runpath_d_zip",
1854 ":libtest_dt_runpath_a",
1855 ":libtest_dt_runpath_b",
1856 ":libtest_dt_runpath_c",
1857 ":libtest_dt_runpath_x",
1858 ":libtest_dt_runpath_y",
1859 ],
1860 cmd: "mkdir -p $(genDir)/zipdir/libdir &&" +
1861 " if [[ \"$$CC_MULTILIB\" = lib32 ]]; then" +
1862 " PRIVATE_LIB_OR_LIB64=lib;" +
1863 " else" +
1864 " PRIVATE_LIB_OR_LIB64=lib64;" +
1865 " fi &&" +
1866 " if [[ -n \"$$CC_NATIVE_BRIDGE\" ]]; then" +
1867 " PRIVATE_LIB_OR_LIB64=$$PRIVATE_LIB_OR_LIB64/$$CC_NATIVE_BRIDGE;" +
1868 " fi &&" +
1869 " mkdir -p $(genDir)/zipdir/libdir/dt_runpath_a &&" +
1870 " mkdir -p $(genDir)/zipdir/libdir/dt_runpath_b_c_x &&" +
1871 " mkdir -p $(genDir)/zipdir/libdir/dt_runpath_y/$$PRIVATE_LIB_OR_LIB64 &&" +
1872 " cp $(location :libtest_dt_runpath_d_zip) $(genDir)/zipdir/libdir &&" +
1873 " cp $(location :libtest_dt_runpath_a) $(genDir)/zipdir/libdir/dt_runpath_a &&" +
1874 " cp $(location :libtest_dt_runpath_b) $(genDir)/zipdir/libdir/dt_runpath_b_c_x &&" +
1875 " cp $(location :libtest_dt_runpath_c) $(genDir)/zipdir/libdir/dt_runpath_b_c_x &&" +
1876 " cp $(location :libtest_dt_runpath_x) $(genDir)/zipdir/libdir/dt_runpath_b_c_x &&" +
1877 " cp $(location :libtest_dt_runpath_y) $(genDir)/zipdir/libdir/dt_runpath_y/$$PRIVATE_LIB_OR_LIB64 &&" +
1878 " touch $(genDir)/zipdir/empty_file.txt &&" +
1879 " $(location soong_zip) -o $(out).unaligned -L 0 -C $(genDir)/zipdir -D $(genDir)/zipdir &&" +
1880 " $(location bionic_tests_zipalign) 4096 $(out).unaligned $(out)",
Colin Crossbadcb382021-09-24 17:49:58 -07001881}