blob: fdf2ccaaaf04da36b4f0d58fcbece5e80ec10143 [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
17cc_defaults {
18 name: "bionic_testlib_defaults",
19 host_supported: true,
Chih-Hung Hsieh84f0dcd2017-10-02 11:47:31 -070020 cflags: [
21 "-Wall",
22 "-Werror",
23 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -070024 ldflags: [
Dimitry Ivanovd11d1e42016-10-05 02:51:17 -070025 "-Wl,--rpath,${ORIGIN}",
Dimitry Ivanova36e59b2016-09-01 11:37:39 -070026 "-Wl,--enable-new-dtags",
27 ],
28 relative_install_path: "bionic-loader-test-libs",
29 gtest: false,
Colin Cross2722ebb2016-07-11 16:20:06 -070030 sanitize: {
Evgenii Stepanov0a3637d2016-07-06 13:20:59 -070031 address: false,
Mitch Phillipsdfde0ee2019-05-01 14:26:13 -070032 fuzzer: false,
Colin Cross2722ebb2016-07-11 16:20:06 -070033 },
Yabin Cui1f553ea2017-01-13 12:31:59 -080034 stl: "libc++_static",
Colin Cross2722ebb2016-07-11 16:20:06 -070035 target: {
36 darwin: {
37 enabled: false,
38 },
39 },
40}
41
42// -----------------------------------------------------------------------------
Ryan Pricharde4ee12f2019-01-15 20:35:00 -080043// Libraries and helper binaries for ELF TLS
Elliott Hughes9724e932018-03-23 18:46:07 -070044// -----------------------------------------------------------------------------
45cc_test_library {
Ryan Pricharde4ee12f2019-01-15 20:35:00 -080046 name: "libtest_elftls_shared_var",
47 defaults: ["bionic_testlib_defaults"],
48 srcs: ["elftls_shared_var.cpp"],
49 cflags: ["-fno-emulated-tls"],
50}
51
52cc_test_library {
53 name: "libtest_elftls_shared_var_ie",
54 defaults: ["bionic_testlib_defaults"],
55 srcs: ["elftls_shared_var_ie.cpp"],
56 cflags: ["-fno-emulated-tls"],
57 shared_libs: ["libtest_elftls_shared_var"],
58}
59
60cc_test_library {
61 name: "libtest_elftls_tprel",
62 defaults: ["bionic_testlib_defaults"],
63 srcs: ["elftls_tprel.cpp"],
64 cflags: ["-fno-emulated-tls"],
65}
66
67cc_test {
68 name: "elftls_dlopen_ie_error_helper",
69 defaults: ["bionic_testlib_defaults"],
70 srcs: ["elftls_dlopen_ie_error_helper.cpp"],
71 ldflags: ["-Wl,--rpath,${ORIGIN}/.."],
72}
73
Ryan Prichard06d2d792019-01-23 23:19:19 -080074cc_test_library {
75 name: "libtest_elftls_dynamic",
76 defaults: ["bionic_testlib_defaults"],
77 srcs: ["elftls_dynamic.cpp"],
78 cflags: ["-fno-emulated-tls"],
79 shared_libs: ["libtest_elftls_shared_var"],
80}
81
82cc_test_library {
83 name: "libtest_elftls_dynamic_filler_1",
84 defaults: ["bionic_testlib_defaults"],
85 srcs: ["elftls_dynamic_filler.cpp"],
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -070086 cflags: [
87 "-fno-emulated-tls",
88 "-DTLS_FILLER=100",
89 ],
Ryan Prichard06d2d792019-01-23 23:19:19 -080090}
91
92cc_test_library {
93 name: "libtest_elftls_dynamic_filler_2",
94 defaults: ["bionic_testlib_defaults"],
95 srcs: ["elftls_dynamic_filler.cpp"],
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -070096 cflags: [
97 "-fno-emulated-tls",
98 "-DTLS_FILLER=200",
99 ],
Ryan Prichard06d2d792019-01-23 23:19:19 -0800100}
101
102cc_test_library {
103 name: "libtest_elftls_dynamic_filler_3",
104 defaults: ["bionic_testlib_defaults"],
105 srcs: ["elftls_dynamic_filler.cpp"],
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700106 cflags: [
107 "-fno-emulated-tls",
108 "-DTLS_FILLER=300",
109 ],
Ryan Prichard06d2d792019-01-23 23:19:19 -0800110}
111
Elliott Hughes9724e932018-03-23 18:46:07 -0700112// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -0700113// Library to test gnu-styled hash
114// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700115cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700116 name: "libgnu-hash-table-library",
117 defaults: ["bionic_testlib_defaults"],
118 srcs: ["dlext_test_library.cpp"],
119 ldflags: ["-Wl,--hash-style=gnu"],
120 arch: {
121 mips: {
122 enabled: false,
123 },
124 mips64: {
125 enabled: false,
126 },
127 },
128}
129
130// -----------------------------------------------------------------------------
131// Library to test sysv-styled hash
132// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700133cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700134 name: "libsysv-hash-table-library",
135 defaults: ["bionic_testlib_defaults"],
136 srcs: ["dlext_test_library.cpp"],
137 ldflags: ["-Wl,--hash-style=sysv"],
138}
139
140// -----------------------------------------------------------------------------
141// Library used by dlext tests - with GNU RELRO program header
142// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700143cc_test_library {
144 name: "libdlext_test",
145 defaults: ["bionic_testlib_defaults"],
146 srcs: ["dlext_test_library.cpp"],
147 ldflags: ["-Wl,-z,relro"],
148 shared_libs: ["libtest_simple"],
149}
Colin Cross2722ebb2016-07-11 16:20:06 -0700150
151// -----------------------------------------------------------------------------
152// Library used by dlext tests - without GNU RELRO program header
153// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700154cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700155 name: "libdlext_test_norelro",
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700156 defaults: ["bionic_testlib_defaults"],
Colin Cross2722ebb2016-07-11 16:20:06 -0700157 srcs: ["dlext_test_library.cpp"],
158 ldflags: ["-Wl,-z,norelro"],
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800159 shared_libs: ["libtest_simple"],
Colin Cross2722ebb2016-07-11 16:20:06 -0700160}
161
162// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700163// Library used by dlext tests - recursive use of RELRO sharing
164// -----------------------------------------------------------------------------
165cc_test_library {
166 name: "libdlext_test_recursive",
167 defaults: ["bionic_testlib_defaults"],
168 srcs: ["dlext_test_recursive_library.cpp"],
169 ldflags: ["-Wl,-z,relro"],
170 shared_libs: ["libdlext_test"],
171}
172
173// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -0700174// Library used by dlext tests - different name non-default location
175// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700176cc_test_library {
177 name: "libdlext_test_fd",
178 defaults: ["bionic_testlib_defaults"],
179 host_supported: false,
180 srcs: ["dlext_test_library.cpp"],
181 ldflags: ["-Wl,--rpath,${ORIGIN}/.."],
182 relative_install_path: "bionic-loader-test-libs/libdlext_test_fd",
183 shared_libs: ["libtest_simple"],
184}
Colin Cross2722ebb2016-07-11 16:20:06 -0700185
186// -----------------------------------------------------------------------------
187// Libraries used by dlext tests for open from a zip-file
188// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700189cc_test_library {
190 name: "libdlext_test_zip",
191 defaults: ["bionic_testlib_defaults"],
192 host_supported: false,
193 srcs: ["dlext_test_library.cpp"],
194 shared_libs: ["libatest_simple_zip"],
195 relative_install_path: "bionic-loader-test-libs/libdlext_test_zip",
196}
197
198cc_test_library {
199 name: "libatest_simple_zip",
200 defaults: ["bionic_testlib_defaults"],
201 host_supported: false,
202 srcs: ["dlopen_testlib_simple.cpp"],
203 relative_install_path: "bionic-loader-test-libs/libatest_simple_zip",
204}
Colin Cross2722ebb2016-07-11 16:20:06 -0700205
206// ----------------------------------------------------------------------------
207// Library with soname which does not match filename
208// ----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700209cc_test_library {
210 name: "libdlext_test_different_soname",
211 defaults: ["bionic_testlib_defaults"],
212 srcs: ["dlext_test_library.cpp"],
213 ldflags: ["-Wl,-soname=libdlext_test_soname.so"],
214}
Colin Cross2722ebb2016-07-11 16:20:06 -0700215
216// -----------------------------------------------------------------------------
217// Library used by dlext tests - zipped and aligned
218// -----------------------------------------------------------------------------
219// In Android.mk to support zipped and aligned tests
220
221// -----------------------------------------------------------------------------
222// Library used by dlfcn tests
223// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700224cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700225 name: "libtest_simple",
226 defaults: ["bionic_testlib_defaults"],
227 srcs: ["dlopen_testlib_simple.cpp"],
228}
229
230// -----------------------------------------------------------------------------
dimitry965d06d2017-11-28 16:03:07 +0100231// Library used by dlext direct unload on the namespace boundary tests
232// -----------------------------------------------------------------------------
233cc_test_library {
234 name: "libtest_missing_symbol",
235 defaults: ["bionic_testlib_defaults"],
236 srcs: ["dlopen_testlib_missing_symbol.cpp"],
237 allow_undefined_symbols: true,
238 relative_install_path: "bionic-loader-test-libs/public_namespace_libs",
239}
240
dimitry965d06d2017-11-28 16:03:07 +0100241// -----------------------------------------------------------------------------
242// Library used by dlext indirect unload on the namespace boundary tests
243//
244// These libraries produce following dependency graph:
245// libtest_missing_symbol_root (private ns)
246// +-> libbnstest_public (public ns)
247// +-> libtest_missing_symbol_child_public (public ns)
248// +-> libnstest_public (public ns)
249// +-> libtest_missing_symbol_child_private (private_ns)
250// +-> libnstest_public (public_ns)
251//
252// All libraries except libtest_missing_symbol are located in
253// private_namespace_libs/
254// -----------------------------------------------------------------------------
255cc_test_library {
256 name: "libtest_missing_symbol_child_public",
257 defaults: ["bionic_testlib_defaults"],
258 srcs: ["empty.cpp"],
259 relative_install_path: "bionic-loader-test-libs/public_namespace_libs",
260 shared_libs: ["libnstest_public"],
261}
262
263cc_test_library {
264 name: "libtest_missing_symbol_child_private",
265 defaults: ["bionic_testlib_defaults"],
266 srcs: ["empty.cpp"],
267 relative_install_path: "bionic-loader-test-libs/private_namespace_libs",
268 shared_libs: ["libnstest_public"],
269}
270
271cc_test_library {
272 name: "libtest_missing_symbol_root",
273 defaults: ["bionic_testlib_defaults"],
274 srcs: ["dlopen_testlib_missing_symbol.cpp"],
275 relative_install_path: "bionic-loader-test-libs/private_namespace_libs",
276 allow_undefined_symbols: true,
277 shared_libs: [
278 "libnstest_public",
279 "libtest_missing_symbol_child_public",
280 "libtest_missing_symbol_child_private",
281 ],
282}
283
284// -----------------------------------------------------------------------------
285// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -0700286// Library used by dlfcn nodelete tests
287// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700288cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700289 name: "libtest_nodelete_1",
290 defaults: ["bionic_testlib_defaults"],
291 srcs: ["dlopen_nodelete_1.cpp"],
292}
293
294// -----------------------------------------------------------------------------
295// Library used by dlfcn nodelete tests
296// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700297cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700298 name: "libtest_nodelete_2",
299 defaults: ["bionic_testlib_defaults"],
300 srcs: ["dlopen_nodelete_2.cpp"],
301}
302
303// -----------------------------------------------------------------------------
304// Library used by dlfcn nodelete tests
305// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700306cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700307 name: "libtest_nodelete_dt_flags_1",
308 defaults: ["bionic_testlib_defaults"],
309 srcs: ["dlopen_nodelete_dt_flags_1.cpp"],
310 ldflags: ["-Wl,-z,nodelete"],
311}
312
313// -----------------------------------------------------------------------------
314// Build test helper libraries for linker namespaces
dimitry965d06d2017-11-28 16:03:07 +0100315//
316// This set of libraries is used to verify linker namespaces.
317//
318// Test cases
319// 1. Check that private libraries loaded in different namespaces are
320// different. Check that dlsym does not confuse them.
321// 2. Check that public libraries loaded in different namespaces are shared
322// between them.
323// 3. Check that namespace sticks on dlopen
324// 4. Check that having access to shared library (libnstest_public.so)
325// does not expose symbols from dependent library (libnstest_public_internal.so)
326//
327// Dependency tree (visibility)
328// libnstest_root.so (this should be local to the namespace)
329// +-> libnstest_public.so
330// +-> libnstest_public_internal.so
331// +-> libnstest_private.so
332//
333// libnstest_dlopened.so (library in private namespace dlopened from libnstest_root.so)
Colin Cross2722ebb2016-07-11 16:20:06 -0700334// -----------------------------------------------------------------------------
dimitry965d06d2017-11-28 16:03:07 +0100335cc_test_library {
336 name: "libnstest_root",
337 defaults: ["bionic_testlib_defaults"],
338 srcs: ["namespaces_root.cpp"],
339 relative_install_path: "bionic-loader-test-libs/private_namespace_libs",
340 shared_libs: [
341 "libnstest_public",
342 "libnstest_private",
343 ],
Ryan Prichardcd4e5ba2019-01-17 17:45:42 -0800344 // The dlext.ns_anonymous test copies the loaded segments of this shared
345 // object into a new mapping, so every segment must be readable. Turn off
346 // eXecute-Only-Memory. See http://b/123034666.
347 xom: false,
dimitry965d06d2017-11-28 16:03:07 +0100348}
349
350cc_test_library {
351 name: "libnstest_public_internal",
352 defaults: ["bionic_testlib_defaults"],
353 srcs: ["namespaces_public_internal.cpp"],
354 relative_install_path: "bionic-loader-test-libs/public_namespace_libs",
355}
356
357cc_test_library {
358 name: "libnstest_public",
359 defaults: ["bionic_testlib_defaults"],
360 srcs: ["namespaces_public.cpp"],
361 relative_install_path: "bionic-loader-test-libs/public_namespace_libs",
362 shared_libs: ["libnstest_public_internal"],
363}
364
365cc_test_library {
366 name: "libnstest_private",
367 defaults: ["bionic_testlib_defaults"],
368 srcs: ["namespaces_private.cpp"],
369 relative_install_path: "bionic-loader-test-libs/private_namespace_libs",
370}
371
372cc_test_library {
373 name: "libnstest_dlopened",
374 defaults: ["bionic_testlib_defaults"],
375 srcs: ["namespaces_dlopened.cpp"],
376 relative_install_path: "bionic-loader-test-libs/private_namespace_libs",
377}
Colin Cross2722ebb2016-07-11 16:20:06 -0700378
379// -----------------------------------------------------------------------------
Logan Chien9ee45912018-01-18 12:05:09 +0800380// Build test helper libraries for linker namespaces for allow all shared libs
381//
382// This set of libraries is used to verify linker namespaces for allow all
383// shared libs.
384//
385// Test cases
386// 1. Check that namespace a exposes libnstest_ns_a_public1 to
387// namespace b while keeping libnstest_ns_a_public1_internal as an
388// internal lib.
389// 2. Check that namespace b exposes all libraries to namespace a.
390//
391// Dependency tree (visibility)
392// libnstest_ns_b_public2.so (ns:b)
393// +-> libnstest_ns_a_public1.so (ns:a)
394// +-> libnstest_ns_a_public2_internal.so (ns:a)
395// +-> libnstest_ns_b_public3.so (ns:b)
396//
397// -----------------------------------------------------------------------------
398cc_test_library {
399 name: "libnstest_ns_a_public1",
400 defaults: ["bionic_testlib_defaults"],
401 srcs: ["libnstest_ns_a_public1.cpp"],
402 relative_install_path: "bionic-loader-test-libs/ns_a",
403 shared_libs: [
404 "libnstest_ns_a_public1_internal",
405 "libnstest_ns_b_public3",
406 ],
407}
408
409cc_test_library {
410 name: "libnstest_ns_a_public1_internal",
411 defaults: ["bionic_testlib_defaults"],
412 srcs: ["libnstest_ns_a_public1_internal.cpp"],
413 relative_install_path: "bionic-loader-test-libs/ns_a",
414}
415
416cc_test_library {
417 name: "libnstest_ns_b_public2",
418 defaults: ["bionic_testlib_defaults"],
419 srcs: ["libnstest_ns_b_public2.cpp"],
420 relative_install_path: "bionic-loader-test-libs/ns_b",
421 shared_libs: ["libnstest_ns_a_public1"],
422}
423
424cc_test_library {
425 name: "libnstest_ns_b_public3",
426 defaults: ["bionic_testlib_defaults"],
427 srcs: ["libnstest_ns_b_public3.cpp"],
428 relative_install_path: "bionic-loader-test-libs/ns_b",
429}
430
431// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700432// Build test helper libraries for linker namespaces
433//
434// This set of libraries is to test isolated namespaces
435//
436// Isolated namespaces do not allow loading of the library outside of
437// the search paths.
438//
439// This library cannot be loaded in isolated namespace because one of DT_NEEDED
440// libraries is outside of the search paths.
441//
442// libnstest_root_not_isolated.so (DT_RUNPATH = $ORIGIN/../private_namespace_libs_external/)
443// +-> libnstest_public.so
444// +-> libnstest_private_external.so (located in $ORIGIN/../private_namespace_libs_external/)
445//
446// Search path: $NATIVE_TESTS/private_namespace_libs/
447//
Colin Cross2722ebb2016-07-11 16:20:06 -0700448// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700449
450cc_test_library {
451 name: "libnstest_root_not_isolated",
452 defaults: ["bionic_testlib_defaults"],
453 host_supported: false,
454 srcs: ["namespaces_root.cpp"],
455 shared_libs: [
456 "libnstest_public",
457 "libnstest_private_external",
458 ],
459 relative_install_path: "bionic-loader-test-libs/private_namespace_libs",
460 ldflags: ["-Wl,--rpath,$ORIGIN/../private_namespace_libs_external"],
461}
462
463cc_test_library {
464 name: "libnstest_private_external",
465 defaults: ["bionic_testlib_defaults"],
466 host_supported: false,
467 srcs: ["namespaces_private.cpp"],
468 relative_install_path: "bionic-loader-test-libs/private_namespace_libs_external",
469}
470
471// -----------------------------------------------------------------------------
Ryan Prichard22fa3dd2020-01-31 14:47:48 -0800472// ns_hidden_child linker namespace test
473// -----------------------------------------------------------------------------
474
475cc_test {
476 name: "ns_hidden_child_helper",
477 host_supported: false,
478 defaults: ["bionic_testlib_defaults"],
479 srcs: ["ns_hidden_child_helper.cpp"],
480 shared_libs: [
481 "libns_hidden_child_internal",
482 "libns_hidden_child_global",
483 "libdl_android",
484 ],
485 ldflags: ["-Wl,--rpath,${ORIGIN}/.."],
486}
487
488cc_test_library {
489 name: "libns_hidden_child_global",
490 defaults: ["bionic_testlib_defaults"],
491 host_supported: false,
492 srcs: ["ns_hidden_child_global.cpp"],
493 shared_libs: ["libns_hidden_child_internal"],
494 ldflags: ["-Wl,-z,global"],
495}
496
497cc_test_library {
498 name: "libns_hidden_child_internal",
499 defaults: ["bionic_testlib_defaults"],
500 host_supported: false,
501 srcs: ["ns_hidden_child_internal.cpp"],
502}
503
504cc_test_library {
505 name: "libns_hidden_child_public",
506 defaults: ["bionic_testlib_defaults"],
507 host_supported: false,
508 srcs: ["ns_hidden_child_public.cpp"],
509 shared_libs: ["libns_hidden_child_internal"],
510}
511
512cc_test_library {
513 name: "libns_hidden_child_app",
514 defaults: ["bionic_testlib_defaults"],
515 host_supported: false,
516 srcs: ["ns_hidden_child_app.cpp"],
517 shared_libs: ["libns_hidden_child_public"],
518 relative_install_path: "bionic-loader-test-libs/ns_hidden_child_app",
519}
520
521// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700522// Build DT_RUNPATH test helper libraries
523//
524// Dependencies
525//
526// libtest_dt_runpath_d.so runpath: ${ORIGIN}/dt_runpath_b_c_x, ${ORIGIN}/dt_runpath_y/${LIB}
527// |-> dt_runpath_b_c_x/libtest_dt_runpath_b.so runpath: ${ORIGIN}/../dt_runpath_a
528// | |-> dt_runpath_a/libtest_dt_runpath_a.so
529// |-> dt_runpath_b_c_x/libtest_dt_runpath_c.so runpath: ${ORIGIN}/invalid_dt_runpath
530// | |-> libtest_dt_runpath_a.so (soname)
531// |-> dt_runpath_y/lib[64]/libtest_dt_runpath_y.so
532//
533// This one is used to test dlopen
534// dt_runpath_b_c_x/libtest_dt_runpath_x.so
535//
536// -----------------------------------------------------------------------------
537
538// A leaf library in a non-standard directory.
539cc_test_library {
540 name: "libtest_dt_runpath_a",
541 defaults: ["bionic_testlib_defaults"],
542 srcs: ["empty.cpp"],
543 relative_install_path: "bionic-loader-test-libs/dt_runpath_a",
544}
545
546// Depends on library A with a DT_RUNPATH
547cc_test_library {
548 name: "libtest_dt_runpath_b",
549 defaults: ["bionic_testlib_defaults"],
550 srcs: ["empty.cpp"],
551 shared_libs: ["libtest_dt_runpath_a"],
552 relative_install_path: "bionic-loader-test-libs/dt_runpath_b_c_x",
553 ldflags: ["-Wl,--rpath,${ORIGIN}/../dt_runpath_a"],
554}
555
556// Depends on library A with an incorrect DT_RUNPATH. This does not matter
557// because B is the first in the D (below) dependency order, and library A
558// is already loaded using the correct DT_RUNPATH from library B.
559cc_test_library {
560 name: "libtest_dt_runpath_c",
561 defaults: ["bionic_testlib_defaults"],
562 srcs: ["empty.cpp"],
563 shared_libs: ["libtest_dt_runpath_a"],
564 relative_install_path: "bionic-loader-test-libs/dt_runpath_b_c_x",
565 ldflags: ["-Wl,--rpath,${ORIGIN}/invalid_dt_runpath"],
566}
567
568// D depends on B, C, and Y with DT_RUNPATH.
569cc_test_library {
570 name: "libtest_dt_runpath_d",
571 defaults: ["bionic_testlib_defaults"],
572 srcs: ["dlopen_b.cpp"],
573 shared_libs: [
574 "libtest_dt_runpath_b",
575 "libtest_dt_runpath_c",
576 "libtest_dt_runpath_y",
577 ],
578 ldflags: [
579 "-Wl,--rpath,${ORIGIN}/dt_runpath_b_c_x",
580 "-Wl,--rpath,${ORIGIN}/dt_runpath_y/${LIB}",
581 ],
582}
583
584// D version for open-from-zip test with runpath
585cc_test_library {
586 name: "libtest_dt_runpath_d_zip",
587 srcs: ["dlopen_b.cpp"],
588 shared_libs: [
589 "libtest_dt_runpath_b",
590 "libtest_dt_runpath_c",
591 "libtest_dt_runpath_y",
592 ],
593 cflags: [
594 "-Wall",
595 "-Werror",
596 ],
597 gtest: false,
598 relative_install_path: "libtest_dt_runpath_d_zip",
599 ldflags: [
600 "-Wl,--rpath,${ORIGIN}/dt_runpath_b_c_x",
601 "-Wl,--rpath,${ORIGIN}/dt_runpath_y/${LIB}",
602 ],
603 sanitize: {
604 address: false,
605 fuzzer: false,
606 },
607 stl: "libc++_static",
608 target: {
609 darwin: {
610 enabled: false,
611 },
612 },
613}
614
615// A leaf library in a directory library D has DT_RUNPATH for.
616cc_test_library {
617 name: "libtest_dt_runpath_x",
618 defaults: ["bionic_testlib_defaults"],
619 srcs: ["empty.cpp"],
620 relative_install_path: "bionic-loader-test-libs/dt_runpath_b_c_x",
621}
622
623// A leaf library in lib or lib64 directory
624cc_test_library {
625 name: "libtest_dt_runpath_y",
626 defaults: ["bionic_testlib_defaults"],
627 srcs: ["empty.cpp"],
628
629 multilib: {
630 lib32: {
631 relative_install_path: "bionic-loader-test-libs/dt_runpath_y/lib",
632 },
633 lib64: {
634 relative_install_path: "bionic-loader-test-libs/dt_runpath_y/lib64",
635 },
636 },
637}
Colin Cross2722ebb2016-07-11 16:20:06 -0700638
639// -----------------------------------------------------------------------------
640// Build library with two parents
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700641//
642// Libraries used by dlfcn tests to verify local group ref_counting
643// libtest_two_parents*.so
Colin Cross2722ebb2016-07-11 16:20:06 -0700644// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700645
646// ..._child.so - correct answer
647cc_test_library {
648 name: "libtest_two_parents_child",
649 defaults: ["bionic_testlib_defaults"],
650 srcs: ["dlopen_2_parents_reloc_answer.cpp"],
651}
652
653// ..._parent1.so - correct answer
654cc_test_library {
655 name: "libtest_two_parents_parent1",
656 defaults: ["bionic_testlib_defaults"],
657 srcs: ["dlopen_check_order_reloc_answer_impl.cpp"],
658 shared_libs: ["libtest_two_parents_child"],
659 cflags: ["-D__ANSWER=42"],
660}
661
662// ..._parent2.so - incorrect answer
663cc_test_library {
664 name: "libtest_two_parents_parent2",
665 defaults: ["bionic_testlib_defaults"],
666 srcs: ["dlopen_check_order_reloc_answer_impl.cpp"],
667 shared_libs: ["libtest_two_parents_child"],
668 cflags: ["-D__ANSWER=1"],
669}
Colin Cross2722ebb2016-07-11 16:20:06 -0700670
671// -----------------------------------------------------------------------------
672// Build libtest_check_order_dlsym.so with its dependencies.
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700673//
674// Libraries used by dlfcn tests to verify correct load order:
Colin Cross2722ebb2016-07-11 16:20:06 -0700675// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700676
677// libtest_check_order_2_right.so
678cc_test_library {
679 name: "libtest_check_order_dlsym_2_right",
680 defaults: ["bionic_testlib_defaults"],
681 srcs: ["dlopen_check_order_dlsym_answer.cpp"],
682 cflags: ["-D__ANSWER=42"],
683}
684
685// libtest_check_order_a.so
686cc_test_library {
687 name: "libtest_check_order_dlsym_a",
688 defaults: ["bionic_testlib_defaults"],
689 srcs: ["dlopen_check_order_dlsym_answer.cpp"],
690 cflags: ["-D__ANSWER=1"],
691}
692
693// libtest_check_order_b.so
694cc_test_library {
695 name: "libtest_check_order_dlsym_b",
696 defaults: ["bionic_testlib_defaults"],
697 srcs: ["dlopen_check_order_dlsym_answer.cpp"],
698 cflags: [
699 "-D__ANSWER=2",
700 "-D__ANSWER2=43",
701 ],
702}
703
704// libtest_check_order_c.so
705cc_test_library {
706 name: "libtest_check_order_dlsym_3_c",
707 defaults: ["bionic_testlib_defaults"],
708 srcs: ["dlopen_check_order_dlsym_answer.cpp"],
709 cflags: ["-D__ANSWER=3"],
710}
711
712// libtest_check_order_d.so
713cc_test_library {
714 name: "libtest_check_order_dlsym_d",
715 defaults: ["bionic_testlib_defaults"],
716 shared_libs: ["libtest_check_order_dlsym_b"],
717 srcs: ["dlopen_check_order_dlsym_answer.cpp"],
718 cflags: [
719 "-D__ANSWER=4",
720 "-D__ANSWER2=4",
721 ],
722}
723
724// libtest_check_order_left.so
725cc_test_library {
726 name: "libtest_check_order_dlsym_1_left",
727 defaults: ["bionic_testlib_defaults"],
728 shared_libs: [
729 "libtest_check_order_dlsym_a",
730 "libtest_check_order_dlsym_b",
731 ],
732 srcs: ["empty.cpp"],
733}
734
735// libtest_check_order.so
736cc_test_library {
737 name: "libtest_check_order_dlsym",
738 defaults: ["bionic_testlib_defaults"],
739 shared_libs: [
740 "libtest_check_order_dlsym_1_left",
741 "libtest_check_order_dlsym_2_right",
742 "libtest_check_order_dlsym_3_c",
743 ],
744 srcs: ["empty.cpp"],
745}
Colin Cross2722ebb2016-07-11 16:20:06 -0700746
747// -----------------------------------------------------------------------------
748// Build libtest_check_order_siblings.so with its dependencies.
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700749//
750// Libraries used by dlfcn tests to verify correct relocation order:
751// libtest_check_order_reloc_siblings*.so
Colin Cross2722ebb2016-07-11 16:20:06 -0700752// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700753
754// ..._1.so - empty
755cc_test_library {
756 name: "libtest_check_order_reloc_siblings_1",
757 defaults: ["bionic_testlib_defaults"],
758 shared_libs: [
759 "libtest_check_order_reloc_siblings_a",
760 "libtest_check_order_reloc_siblings_b",
761 ],
762 srcs: ["empty.cpp"],
763}
764
765// ..._2.so - empty
766cc_test_library {
767 name: "libtest_check_order_reloc_siblings_2",
768 defaults: ["bionic_testlib_defaults"],
769 shared_libs: [
770 "libtest_check_order_reloc_siblings_c",
771 "libtest_check_order_reloc_siblings_d",
772 ],
773 srcs: [
774 "dlopen_check_order_reloc_grandchild_answer.cpp",
775 ],
776 allow_undefined_symbols: true,
777}
778
779// ..._3.so - get_answer2();
780cc_test_library {
781 name: "libtest_check_order_reloc_siblings_3",
782 defaults: ["bionic_testlib_defaults"],
783 shared_libs: [
784 "libtest_check_order_reloc_siblings_e",
785 "libtest_check_order_reloc_siblings_f",
786 ],
787 srcs: [
788 "dlopen_check_order_reloc_nephew_answer.cpp",
789 ],
790}
791
792// ..._a.so <- correct impl
793cc_test_library {
794 name: "libtest_check_order_reloc_siblings_a",
795 defaults: ["bionic_testlib_defaults"],
796 srcs: [
797 "dlopen_check_order_reloc_answer_impl.cpp",
798 ],
799 cflags: ["-D__ANSWER=42"],
800}
801
802// ..._b.so
803cc_test_library {
804 name: "libtest_check_order_reloc_siblings_b",
805 defaults: ["bionic_testlib_defaults"],
806 srcs: [
807 "dlopen_check_order_reloc_answer_impl.cpp",
808 ],
809 cflags: ["-D__ANSWER=1"],
810}
811
812// ..._c.so
813cc_test_library {
814 name: "libtest_check_order_reloc_siblings_c",
815 defaults: ["bionic_testlib_defaults"],
816 shared_libs: [
817 "libtest_check_order_reloc_siblings_c_1",
818 "libtest_check_order_reloc_siblings_c_2",
819 ],
820 srcs: [
821 "dlopen_check_order_reloc_answer_impl.cpp",
822 ],
823 cflags: ["-D__ANSWER=2"],
824}
825
826// ..._d.so
827cc_test_library {
828 name: "libtest_check_order_reloc_siblings_d",
829 defaults: ["bionic_testlib_defaults"],
830 srcs: [
831 "dlopen_check_order_reloc_answer_impl.cpp",
832 ],
833 cflags: ["-D__ANSWER=3"],
834}
835
836// ..._e.so
837cc_test_library {
838 name: "libtest_check_order_reloc_siblings_e",
839 defaults: ["bionic_testlib_defaults"],
840 srcs: [
841 "dlopen_check_order_reloc_answer_impl.cpp",
842 ],
843 cflags: [
844 "-D__ANSWER=4",
845 ],
846}
847
848// ..._f.so <- get_answer()
849cc_test_library {
850 name: "libtest_check_order_reloc_siblings_f",
851 defaults: ["bionic_testlib_defaults"],
852 srcs: [
853 "dlopen_check_order_reloc_answer.cpp",
854 ],
855}
856
857// ..._c_1.so
858cc_test_library {
859 name: "libtest_check_order_reloc_siblings_c_1",
860 defaults: ["bionic_testlib_defaults"],
861 srcs: [
862 "dlopen_check_order_reloc_grandchild_answer_impl.cpp",
863 ],
864 cflags: ["-D__ANSWER=42"],
865}
866
867// ..._c_2.so
868cc_test_library {
869 name: "libtest_check_order_reloc_siblings_c_2",
870 defaults: ["bionic_testlib_defaults"],
871 srcs: [
872 "dlopen_check_order_reloc_grandchild_answer_impl.cpp",
873 ],
874 cflags: ["-D__ANSWER=0"],
875}
876
877// libtest_check_order_reloc_siblings.so
878cc_test_library {
879 name: "libtest_check_order_reloc_siblings",
880 defaults: ["bionic_testlib_defaults"],
881 shared_libs: [
882 "libtest_check_order_reloc_siblings_1",
883 "libtest_check_order_reloc_siblings_2",
884 "libtest_check_order_reloc_siblings_3",
885 ],
886 srcs: [
887 "empty.cpp",
888 ],
889}
Colin Cross2722ebb2016-07-11 16:20:06 -0700890
891// -----------------------------------------------------------------------------
892// Build libtest_check_order_root.so with its dependencies.
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700893//
894// Libraries used by dlfcn tests to verify correct relocation order:
895// libtest_check_order_reloc_root*.so
Colin Cross2722ebb2016-07-11 16:20:06 -0700896// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700897
898// ..._1.so - empty
899cc_test_library {
900 name: "libtest_check_order_reloc_root_1",
901 defaults: ["bionic_testlib_defaults"],
902 srcs: ["empty.cpp"],
903}
904
905// ..._2.so - this one has the incorrect answer
906cc_test_library {
907 name: "libtest_check_order_reloc_root_2",
908 defaults: ["bionic_testlib_defaults"],
909 srcs: ["dlopen_check_order_reloc_root_answer_impl.cpp"],
910 cflags: ["-D__ANSWER=2"],
911}
912
913// libtest_check_order_reloc_root.so <- implements get_answer3()
914cc_test_library {
915 name: "libtest_check_order_reloc_root",
916 defaults: ["bionic_testlib_defaults"],
917 srcs: ["dlopen_check_order_reloc_root_answer.cpp"],
918 shared_libs: [
919 "libtest_check_order_reloc_root_1",
920 "libtest_check_order_reloc_root_2",
921 ],
922}
Colin Cross2722ebb2016-07-11 16:20:06 -0700923
924// -----------------------------------------------------------------------------
925// Build libtest_versioned_lib.so with its dependencies.
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700926//
927// Libraries used to test versioned symbols
Colin Cross2722ebb2016-07-11 16:20:06 -0700928// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -0700929
930cc_test_library {
931 name: "libtest_versioned_uselibv1",
932 defaults: ["bionic_testlib_defaults"],
933 srcs: ["versioned_uselib.cpp"],
934 shared_libs: ["libtest_versioned_libv1"],
935}
936
937cc_test_library {
938 name: "libtest_versioned_uselibv2",
939 defaults: ["bionic_testlib_defaults"],
940 srcs: ["versioned_uselib.cpp"],
941 shared_libs: ["libtest_versioned_libv2"],
942 version_script: "versioned_uselib.map",
943}
944
945cc_test_library {
946 name: "libtest_versioned_uselibv2_other",
947 defaults: ["bionic_testlib_defaults"],
948 srcs: ["versioned_uselib.cpp"],
949 shared_libs: [
950 "libtest_versioned_otherlib_empty",
951 "libtest_versioned_libv2",
952 ],
953}
954
955cc_test_library {
956 name: "libtest_versioned_uselibv3_other",
957 defaults: ["bionic_testlib_defaults"],
958 srcs: ["versioned_uselib.cpp"],
959 shared_libs: [
960 "libtest_versioned_otherlib_empty",
961 "libtest_versioned_lib",
962 ],
963}
964
965// lib v1 - this one used during static linking but never used at runtime
966// which forces libtest_versioned_uselibv1 to use function v1 from
967// libtest_versioned_lib.so
968cc_test_library {
969 name: "libtest_versioned_libv1",
970 defaults: ["bionic_testlib_defaults"],
971 srcs: ["versioned_lib_v1.cpp"],
972 version_script: "versioned_lib_v1.map",
973 ldflags: ["-Wl,-soname,libtest_versioned_lib.so"],
974}
975
976// lib v2 - to make libtest_versioned_uselibv2.so use version 2 of versioned_function()
977cc_test_library {
978 name: "libtest_versioned_libv2",
979 defaults: ["bionic_testlib_defaults"],
980 srcs: ["versioned_lib_v2.cpp"],
981 version_script: "versioned_lib_v2.map",
982 ldflags: ["-Wl,-soname,libtest_versioned_lib.so"],
983}
984
985// last version - this one is used at the runtime and exports 3 versions
986// of versioned_symbol().
987cc_test_library {
988 name: "libtest_versioned_lib",
989 defaults: ["bionic_testlib_defaults"],
990 srcs: ["versioned_lib_v3.cpp"],
991 version_script: "versioned_lib_v3.map",
992}
993
994// This library is empty, the actual implementation will provide an unversioned
995// symbol for versioned_function().
996cc_test_library {
997 name: "libtest_versioned_otherlib_empty",
998 defaults: ["bionic_testlib_defaults"],
999 srcs: ["empty.cpp"],
1000 ldflags: ["-Wl,-soname,libtest_versioned_otherlib.so"],
1001}
1002
1003cc_test_library {
1004 name: "libtest_versioned_otherlib",
1005 defaults: ["bionic_testlib_defaults"],
1006 srcs: ["versioned_lib_other.cpp"],
1007 version_script: "versioned_lib_other.map",
1008}
Colin Cross2722ebb2016-07-11 16:20:06 -07001009
1010// -----------------------------------------------------------------------------
1011// Build libraries needed by pthread_atfork tests
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -07001012
1013// This library used to test phtread_atfork handler behaviour
1014// during/after dlclose.
Colin Cross2722ebb2016-07-11 16:20:06 -07001015// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -07001016cc_test_library {
1017 name: "libtest_pthread_atfork",
1018 defaults: ["bionic_testlib_defaults"],
1019 srcs: ["pthread_atfork.cpp"],
1020}
Colin Cross2722ebb2016-07-11 16:20:06 -07001021
1022// -----------------------------------------------------------------------------
1023// Library with dependency loop used by dlfcn tests
1024//
1025// libtest_with_dependency_loop -> a -> b -> c -> a
1026// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001027cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001028 name: "libtest_with_dependency_loop",
1029 defaults: ["bionic_testlib_defaults"],
1030 srcs: ["dlopen_testlib_loopy_root.cpp"],
1031 shared_libs: ["libtest_with_dependency_loop_a"],
1032}
1033
1034// -----------------------------------------------------------------------------
1035// libtest_with_dependency_loop_a.so
1036// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001037cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001038 name: "libtest_with_dependency_loop_a",
1039 defaults: ["bionic_testlib_defaults"],
1040 srcs: ["dlopen_testlib_loopy_a.cpp"],
1041 shared_libs: ["libtest_with_dependency_loop_b_tmp"],
1042}
1043
1044// -----------------------------------------------------------------------------
1045// libtest_with_dependency_loop_b.so
1046//
1047// this is temporary placeholder - will be removed
1048// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001049cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001050 name: "libtest_with_dependency_loop_b_tmp",
1051 defaults: ["bionic_testlib_defaults"],
1052 srcs: ["dlopen_testlib_loopy_invalid.cpp"],
1053 ldflags: ["-Wl,-soname=libtest_with_dependency_loop_b.so"],
1054}
1055
1056// -----------------------------------------------------------------------------
1057// libtest_with_dependency_loop_b.so
1058// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001059cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001060 name: "libtest_with_dependency_loop_b",
1061 defaults: ["bionic_testlib_defaults"],
1062 srcs: ["dlopen_testlib_loopy_b.cpp"],
1063 shared_libs: ["libtest_with_dependency_loop_c"],
1064}
1065
1066// -----------------------------------------------------------------------------
1067// libtest_with_dependency_loop_c.so
1068// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001069cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001070 name: "libtest_with_dependency_loop_c",
1071 defaults: ["bionic_testlib_defaults"],
1072 srcs: ["dlopen_testlib_loopy_c.cpp"],
1073 shared_libs: ["libtest_with_dependency_loop_a"],
1074}
1075
1076// -----------------------------------------------------------------------------
1077// libtest_relo_check_dt_needed_order.so
1078// |
1079// +-> libtest_relo_check_dt_needed_order_1.so
1080// |
1081// +-> libtest_relo_check_dt_needed_order_2.so
1082// -----------------------------------------------------------------------------
1083
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001084cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001085 name: "libtest_relo_check_dt_needed_order",
1086 defaults: ["bionic_testlib_defaults"],
1087 srcs: ["dlopen_testlib_relo_check_dt_needed_order.cpp"],
1088 shared_libs: [
1089 "libtest_relo_check_dt_needed_order_1",
1090 "libtest_relo_check_dt_needed_order_2",
1091 ],
1092}
1093
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001094cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001095 name: "libtest_relo_check_dt_needed_order_1",
1096 defaults: ["bionic_testlib_defaults"],
1097 srcs: ["dlopen_testlib_relo_check_dt_needed_order_1.cpp"],
1098}
1099
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001100cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001101 name: "libtest_relo_check_dt_needed_order_2",
1102 defaults: ["bionic_testlib_defaults"],
1103 srcs: ["dlopen_testlib_relo_check_dt_needed_order_2.cpp"],
1104}
1105
1106// -----------------------------------------------------------------------------
1107// Library with dependency used by dlfcn tests
1108// -----------------------------------------------------------------------------
Dan Willemsen4bcfe3c2019-04-19 14:55:34 -07001109cc_test_library {
1110 name: "libtest_with_dependency",
1111 defaults: ["bionic_testlib_defaults"],
1112 srcs: ["dlopen_testlib_simple.cpp"],
1113 shared_libs: ["libdlext_test"],
1114}
Colin Cross2722ebb2016-07-11 16:20:06 -07001115
1116// -----------------------------------------------------------------------------
1117// Library used by ifunc tests
1118// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001119cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001120 name: "libtest_ifunc",
1121 defaults: ["bionic_testlib_defaults"],
Dimitry Ivanov21975b22017-05-02 16:31:56 -07001122 srcs: ["dlopen_testlib_ifunc.cpp"],
Colin Cross2722ebb2016-07-11 16:20:06 -07001123
Colin Cross2722ebb2016-07-11 16:20:06 -07001124 arch: {
1125 mips: {
1126 enabled: false,
1127 },
1128 mips64: {
1129 enabled: false,
1130 },
1131 },
Dimitry Ivanov21975b22017-05-02 16:31:56 -07001132}
1133
1134cc_test_library {
1135 name: "libtest_ifunc_variable",
1136 defaults: ["bionic_testlib_defaults"],
1137 srcs: ["dlopen_testlib_ifunc_variable.cpp"],
Elliott Hughesd50a1de2018-02-05 17:30:57 -08001138 shared_libs: ["libtest_ifunc_variable_impl"],
Dimitry Ivanov21975b22017-05-02 16:31:56 -07001139
1140 arch: {
1141 mips: {
1142 enabled: false,
1143 },
1144 mips64: {
1145 enabled: false,
1146 },
1147 },
Dimitry Ivanov21975b22017-05-02 16:31:56 -07001148}
1149
1150cc_test_library {
1151 name: "libtest_ifunc_variable_impl",
1152 defaults: ["bionic_testlib_defaults"],
1153 srcs: ["dlopen_testlib_ifunc_variable_impl.cpp"],
1154
1155 arch: {
1156 mips: {
1157 enabled: false,
1158 },
1159 mips64: {
1160 enabled: false,
1161 },
1162 },
Colin Cross2722ebb2016-07-11 16:20:06 -07001163}
1164
1165// -----------------------------------------------------------------------------
1166// Library used by atexit tests
1167// -----------------------------------------------------------------------------
1168
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001169cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001170 name: "libtest_atexit",
1171 defaults: ["bionic_testlib_defaults"],
1172 srcs: ["atexit_testlib.cpp"],
1173}
1174
1175// -----------------------------------------------------------------------------
1176// This library is used by dl_load test to check symbol preempting
1177// by main executable
1178// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001179cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001180 name: "libdl_preempt_test_1",
1181 defaults: ["bionic_testlib_defaults"],
1182 srcs: ["dl_preempt_library_1.cpp"],
1183}
1184
1185// -----------------------------------------------------------------------------
1186// This library is used by dl_load test to check symbol preempting
1187// by libdl_preempt_test_1.so
1188// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001189cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001190 name: "libdl_preempt_test_2",
1191 defaults: ["bionic_testlib_defaults"],
1192 srcs: ["dl_preempt_library_2.cpp"],
1193}
1194
1195// -----------------------------------------------------------------------------
1196// Library with DF_1_GLOBAL
1197// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001198cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001199 name: "libdl_test_df_1_global",
1200 defaults: ["bionic_testlib_defaults"],
1201 srcs: ["dl_df_1_global.cpp"],
1202 ldflags: ["-Wl,-z,global"],
1203
1204 target: {
1205 host: {
1206 // TODO (dimitry): host ld.gold does not yet support -z global
1207 // remove this line once it is updated.
1208 ldflags: ["-fuse-ld=bfd"],
1209 },
1210 },
1211}
1212
1213// -----------------------------------------------------------------------------
1214// Library using symbol from libdl_test_df_1_global
1215// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001216cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001217 name: "libtest_dlsym_df_1_global",
1218 defaults: ["bionic_testlib_defaults"],
1219 srcs: ["dl_df_1_use_global.cpp"],
1220}
1221
1222// -----------------------------------------------------------------------------
Jiyong Park01162f22017-10-16 15:31:09 +09001223// Library with DF_1_GLOBAL which will be dlopened
1224// (note: libdl_test_df_1_global above will be included in DT_NEEDED)
1225// -----------------------------------------------------------------------------
1226cc_test_library {
1227 name: "libtest_dlopen_df_1_global",
1228 defaults: ["bionic_testlib_defaults"],
1229 srcs: ["dl_df_1_global_dummy.cpp"],
1230 ldflags: ["-Wl,-z,global"],
1231
1232 target: {
1233 host: {
1234 // TODO (dimitry): host ld.gold does not yet support -z global
1235 // remove this line once it is updated.
1236 ldflags: ["-fuse-ld=bfd"],
1237 },
1238 },
1239}
1240
Jiyong Park01162f22017-10-16 15:31:09 +09001241// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -07001242// Library with weak function
1243// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001244cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001245 name: "libtest_dlsym_weak_func",
1246 defaults: ["bionic_testlib_defaults"],
1247 srcs: ["dlsym_weak_function.cpp"],
1248}
1249
1250// -----------------------------------------------------------------------------
1251// Library to check RTLD_LOCAL with dlsym in 'this'
1252// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001253cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001254 name: "libtest_dlsym_from_this",
1255 defaults: ["bionic_testlib_defaults"],
1256 srcs: ["dlsym_from_this_symbol.cpp"],
1257 shared_libs: ["libtest_dlsym_from_this_child"],
Colin Cross2722ebb2016-07-11 16:20:06 -07001258}
1259
1260// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001261cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001262 name: "libtest_dlsym_from_this_child",
1263 defaults: ["bionic_testlib_defaults"],
1264 srcs: ["dlsym_from_this_functions.cpp"],
1265 shared_libs: ["libtest_dlsym_from_this_grandchild"],
1266}
1267
1268// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001269cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001270 name: "libtest_dlsym_from_this_grandchild",
1271 defaults: ["bionic_testlib_defaults"],
1272 srcs: ["dlsym_from_this_symbol2.cpp"],
1273}
1274
1275// -----------------------------------------------------------------------------
1276// Empty library
1277// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001278cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001279 name: "libtest_empty",
1280 defaults: ["bionic_testlib_defaults"],
1281 srcs: ["empty.cpp"],
1282}
1283
1284// -----------------------------------------------------------------------------
dimitry8db36a52017-10-23 15:10:10 +02001285// Library for inaccessible shared library test
1286// -----------------------------------------------------------------------------
1287cc_test_library {
1288 name: "libtestshared",
1289 defaults: ["bionic_testlib_defaults"],
1290 srcs: ["empty.cpp"],
Nan Zhangdab0fd52017-11-07 11:05:24 -08001291 relative_install_path: "bionic-loader-test-libs/inaccessible_libs",
dimitry8db36a52017-10-23 15:10:10 +02001292}
1293
1294// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -07001295// Library with weak undefined function
1296// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001297cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001298 name: "libtest_dlopen_weak_undefined_func",
1299 defaults: ["bionic_testlib_defaults"],
1300 srcs: ["dlopen_weak_undefined.cpp"],
1301}
1302
1303// -----------------------------------------------------------------------------
Dimitry Ivanovd0b5c3a2016-11-25 12:23:11 -08001304// Check that RTLD_NEXT of a libc symbol works in dlopened library
1305// -----------------------------------------------------------------------------
1306cc_test_library {
1307 name: "libtest_check_rtld_next_from_library",
1308 defaults: ["bionic_testlib_defaults"],
1309 srcs: ["check_rtld_next_from_library.cpp"],
Dimitry Ivanovd0b5c3a2016-11-25 12:23:11 -08001310}
1311
1312// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -07001313// Library with constructor that calls dlopen() b/7941716
1314// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001315cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001316 name: "libtest_dlopen_from_ctor",
1317 defaults: ["bionic_testlib_defaults"],
1318 srcs: ["dlopen_testlib_dlopen_from_ctor.cpp"],
Colin Cross2722ebb2016-07-11 16:20:06 -07001319}
1320
1321// -----------------------------------------------------------------------------
Dimitry Ivanovec90e242017-02-10 11:04:20 -08001322// Libraries used to check init/fini call order
Dimitry Ivanovea8f3962017-02-09 13:31:57 -08001323// -----------------------------------------------------------------------------
1324cc_test_library {
1325 name: "libtest_init_fini_order_root",
1326 defaults: ["bionic_testlib_defaults"],
1327 srcs: ["dlopen_check_init_fini_root.cpp"],
Dimitry Ivanovec90e242017-02-10 11:04:20 -08001328 shared_libs: [
1329 "libtest_init_fini_order_child",
1330 "libtest_init_fini_order_grand_child",
1331 ],
1332}
1333
1334cc_test_library {
1335 name: "libtest_init_fini_order_root2",
1336 defaults: ["bionic_testlib_defaults"],
1337 srcs: ["dlopen_check_init_fini_root.cpp"],
1338 shared_libs: [
1339 "libtest_init_fini_order_grand_child",
1340 "libtest_init_fini_order_child",
1341 ],
Dimitry Ivanovea8f3962017-02-09 13:31:57 -08001342}
1343
1344cc_test_library {
1345 name: "libtest_init_fini_order_child",
1346 defaults: ["bionic_testlib_defaults"],
1347 srcs: ["dlopen_check_init_fini_child.cpp"],
1348 shared_libs: ["libtest_init_fini_order_grand_child"],
1349}
1350
1351cc_test_library {
1352 name: "libtest_init_fini_order_grand_child",
1353 defaults: ["bionic_testlib_defaults"],
1354 srcs: ["dlopen_check_init_fini_grand_child.cpp"],
1355}
1356
1357// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -07001358// Library that depends on the library with constructor that calls dlopen() b/7941716
1359// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -07001360cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -07001361 name: "libtest_dlopen_from_ctor_main",
1362 defaults: ["bionic_testlib_defaults"],
1363 srcs: ["empty.cpp"],
1364 shared_libs: ["libtest_dlopen_from_ctor"],
1365}
1366
1367// -----------------------------------------------------------------------------
dimitry55547db2018-05-25 14:17:37 +02001368// Libraries with non-trivial thread_local variable to test dlclose()
dimitry06016f22018-01-05 11:39:28 +01001369// -----------------------------------------------------------------------------
1370cc_test_library {
1371 name: "libtest_thread_local_dtor",
1372 defaults: ["bionic_testlib_defaults"],
1373 srcs: ["thread_local_dtor.cpp"],
1374}
1375
dimitry55547db2018-05-25 14:17:37 +02001376cc_test_library {
1377 name: "libtest_thread_local_dtor2",
1378 defaults: ["bionic_testlib_defaults"],
1379 srcs: ["thread_local_dtor2.cpp"],
1380}
1381
1382// -----------------------------------------------------------------------------
1383// Library dt_needs libtest_thread_local_dtor/2 (to check no-unload on load_group)
1384// -----------------------------------------------------------------------------
1385cc_test_library {
1386 name: "libtest_indirect_thread_local_dtor",
1387 defaults: ["bionic_testlib_defaults"],
1388 srcs: ["empty.cpp"],
1389 shared_libs: [
1390 "libtest_thread_local_dtor",
1391 "libtest_thread_local_dtor2",
1392 ],
1393}
1394
dimitry06016f22018-01-05 11:39:28 +01001395// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -07001396// Tool to use to align the shared libraries in a zip file.
1397// -----------------------------------------------------------------------------
1398cc_binary_host {
1399 name: "bionic_tests_zipalign",
1400 srcs: ["bionic_tests_zipalign.cpp"],
1401 cflags: [
1402 "-Wall",
1403 "-Werror",
1404 ],
1405
1406 static_libs: [
1407 "libziparchive",
1408 "liblog",
1409 "libbase",
1410 "libz",
1411 "libutils",
1412 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001413}
Evgenii Stepanov0a3637d2016-07-06 13:20:59 -07001414
1415cc_test_library {
1416 name: "libcfi-test",
1417 defaults: ["bionic_testlib_defaults"],
1418 srcs: ["cfi_test_lib.cpp"],
1419 sanitize: {
1420 cfi: false,
1421 },
1422}
1423
1424cc_test_library {
1425 name: "libcfi-test-bad",
1426 defaults: ["bionic_testlib_defaults"],
1427 srcs: ["cfi_test_bad_lib.cpp"],
1428 sanitize: {
1429 cfi: false,
1430 },
1431}
Evgenii Stepanov68ecec12017-01-31 13:19:30 -08001432
1433cc_test {
1434 name: "cfi_test_helper",
1435 host_supported: false,
1436 defaults: ["bionic_testlib_defaults"],
1437 srcs: ["cfi_test_helper.cpp"],
1438 ldflags: ["-rdynamic"],
1439}
1440
1441cc_test {
1442 name: "cfi_test_helper2",
1443 host_supported: false,
1444 defaults: ["bionic_testlib_defaults"],
1445 srcs: ["cfi_test_helper2.cpp"],
1446 shared_libs: ["libcfi-test"],
1447 ldflags: ["-Wl,--rpath,${ORIGIN}/.."],
1448}
Elliott Hugheseb04ed52017-03-29 13:48:02 -07001449
1450cc_test {
1451 name: "preinit_getauxval_test_helper",
1452 host_supported: false,
1453 defaults: ["bionic_testlib_defaults"],
1454 srcs: ["preinit_getauxval_test_helper.cpp"],
1455}
1456
1457cc_test {
1458 name: "preinit_syscall_test_helper",
1459 host_supported: false,
1460 defaults: ["bionic_testlib_defaults"],
1461 srcs: ["preinit_syscall_test_helper.cpp"],
1462}
Jiyong Park02586a22017-05-20 01:01:24 +09001463
1464cc_test {
1465 name: "ld_preload_test_helper",
1466 host_supported: false,
1467 defaults: ["bionic_testlib_defaults"],
1468 srcs: ["ld_preload_test_helper.cpp"],
1469 shared_libs: ["ld_preload_test_helper_lib1"],
1470 ldflags: ["-Wl,--rpath,${ORIGIN}/.."],
1471}
1472
1473cc_test_library {
1474 name: "ld_preload_test_helper_lib1",
1475 host_supported: false,
1476 defaults: ["bionic_testlib_defaults"],
1477 srcs: ["ld_preload_test_helper_lib1.cpp"],
1478}
1479
1480cc_test_library {
1481 name: "ld_preload_test_helper_lib2",
1482 host_supported: false,
1483 defaults: ["bionic_testlib_defaults"],
1484 srcs: ["ld_preload_test_helper_lib2.cpp"],
1485}
1486
1487cc_test {
1488 name: "ld_config_test_helper",
1489 host_supported: false,
1490 defaults: ["bionic_testlib_defaults"],
1491 srcs: ["ld_config_test_helper.cpp"],
1492 shared_libs: ["ld_config_test_helper_lib1"],
1493 ldflags: ["-Wl,--rpath,${ORIGIN}/.."],
1494}
1495
1496cc_test_library {
1497 name: "ld_config_test_helper_lib1",
1498 host_supported: false,
1499 defaults: ["bionic_testlib_defaults"],
1500 srcs: ["ld_config_test_helper_lib1.cpp"],
1501 shared_libs: ["ld_config_test_helper_lib2"],
Nan Zhangdab0fd52017-11-07 11:05:24 -08001502 relative_install_path: "bionic-loader-test-libs/ns2",
Jiyong Park02586a22017-05-20 01:01:24 +09001503}
1504
1505cc_test_library {
1506 name: "ld_config_test_helper_lib2",
1507 host_supported: false,
1508 defaults: ["bionic_testlib_defaults"],
1509 srcs: ["ld_config_test_helper_lib2.cpp"],
Nan Zhangdab0fd52017-11-07 11:05:24 -08001510 relative_install_path: "bionic-loader-test-libs/ns2",
Jiyong Park02586a22017-05-20 01:01:24 +09001511}
1512
1513cc_test_library {
1514 name: "ld_config_test_helper_lib3",
1515 host_supported: false,
1516 defaults: ["bionic_testlib_defaults"],
1517 srcs: ["ld_config_test_helper_lib3.cpp"],
1518}
Ryan Prichard8f639a42018-10-01 23:10:05 -07001519
1520cc_test {
1521 name: "exec_linker_helper",
1522 host_supported: false,
1523 defaults: ["bionic_testlib_defaults"],
1524 srcs: ["exec_linker_helper.cpp"],
1525 shared_libs: ["exec_linker_helper_lib"],
1526 ldflags: ["-Wl,--rpath,${ORIGIN}/.."],
1527}
1528
1529cc_test_library {
1530 name: "exec_linker_helper_lib",
1531 host_supported: false,
1532 defaults: ["bionic_testlib_defaults"],
1533 srcs: ["exec_linker_helper_lib.cpp"],
1534}
Peter Collingbourneb39cb3c2019-03-01 13:12:49 -08001535
1536cc_test_library {
1537 name: "libsegment_gap_outer",
1538 host_supported: false,
1539 defaults: ["bionic_testlib_defaults"],
1540 srcs: ["segment_gap_outer.cpp"],
1541 ldflags: ["-Wl,-T,bionic/tests/libs/segment_gap_outer.lds"],
1542}
1543
1544cc_test_library {
1545 name: "libsegment_gap_inner",
1546 host_supported: false,
1547 defaults: ["bionic_testlib_defaults"],
1548 srcs: ["segment_gap_inner.cpp"],
1549}
Elliott Hughes6663f552020-01-24 14:36:10 -08001550
1551
1552// -----------------------------------------------------------------------------
Elliott Hughes6dd1f582020-01-28 12:18:35 -08001553// Check that we support all kinds of relocations: regular, "relocation packer",
1554// and both the old and new SHT_RELR constants.
Elliott Hughes6663f552020-01-24 14:36:10 -08001555// -----------------------------------------------------------------------------
1556
Elliott Hughes6dd1f582020-01-28 12:18:35 -08001557// This is what got standardized for SHT_RELR.
Elliott Hughes6663f552020-01-24 14:36:10 -08001558cc_test_library {
Elliott Hughes6dd1f582020-01-28 12:18:35 -08001559 name: "librelocations-RELR",
1560 ldflags: [
1561 "-Wl,--pack-dyn-relocs=relr",
1562 "-Wl,--no-use-android-relr-tags",
1563 ],
Elliott Hughes6663f552020-01-24 14:36:10 -08001564 host_supported: false,
1565 defaults: ["bionic_testlib_defaults"],
Elliott Hughes6dd1f582020-01-28 12:18:35 -08001566 srcs: ["relocations.cpp"],
1567
Elliott Hughes6663f552020-01-24 14:36:10 -08001568 // Hack to ensure we're using llvm-objcopy because our binutils prebuilt
1569 // only supports the old numbers (http://b/141010852).
1570 strip: {
1571 keep_symbols: true,
1572 },
1573}
1574
Elliott Hughes6dd1f582020-01-28 12:18:35 -08001575// This is the same encoding as SHT_RELR, but using OS-specific constants.
Elliott Hughes6663f552020-01-24 14:36:10 -08001576cc_test_library {
Elliott Hughes6dd1f582020-01-28 12:18:35 -08001577 name: "librelocations-ANDROID_RELR",
1578 ldflags: [
1579 "-Wl,--pack-dyn-relocs=relr",
1580 "-Wl,--use-android-relr-tags",
1581 ],
Elliott Hughes6663f552020-01-24 14:36:10 -08001582 host_supported: false,
1583 defaults: ["bionic_testlib_defaults"],
Elliott Hughes6dd1f582020-01-28 12:18:35 -08001584 srcs: ["relocations.cpp"],
1585}
1586
1587// This is the old relocation packer encoding (DT_ANDROID_REL/DT_ANDROID_RELA).
1588cc_test_library {
1589 name: "librelocations-ANDROID_REL",
1590 ldflags: ["-Wl,--pack-dyn-relocs=android"],
1591 host_supported: false,
1592 defaults: ["bionic_testlib_defaults"],
1593 srcs: ["relocations.cpp"],
1594}
1595
1596// This is not packed at all.
1597cc_test_library {
1598 name: "librelocations-fat",
1599 ldflags: ["-Wl,--pack-dyn-relocs=none"],
1600 host_supported: false,
1601 defaults: ["bionic_testlib_defaults"],
1602 srcs: ["relocations.cpp"],
Elliott Hughes6663f552020-01-24 14:36:10 -08001603}