blob: c06cb124f33412e8b202d09813649c8cf5f9bb9b [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,
32 coverage: 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// -----------------------------------------------------------------------------
Elliott Hughes9724e932018-03-23 18:46:07 -070043// Library to test ELF TLS
44// -----------------------------------------------------------------------------
45cc_test_library {
46 name: "libelf-tls-library",
47 defaults: ["bionic_testlib_defaults"],
48 srcs: ["elf_tls_test_library.cpp"],
49 cflags: ["-fno-emulated-tls"],
Chih-Hung Hsiehd6b56c92018-04-12 13:40:54 -070050 allow_undefined_symbols: true, // __tls_get_addr is undefined.
Elliott Hughes9724e932018-03-23 18:46:07 -070051}
52
53// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -070054// Library to test gnu-styled hash
55// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -070056cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -070057 name: "libgnu-hash-table-library",
58 defaults: ["bionic_testlib_defaults"],
59 srcs: ["dlext_test_library.cpp"],
60 ldflags: ["-Wl,--hash-style=gnu"],
61 arch: {
62 mips: {
63 enabled: false,
64 },
65 mips64: {
66 enabled: false,
67 },
68 },
69}
70
71// -----------------------------------------------------------------------------
72// Library to test sysv-styled hash
73// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -070074cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -070075 name: "libsysv-hash-table-library",
76 defaults: ["bionic_testlib_defaults"],
77 srcs: ["dlext_test_library.cpp"],
78 ldflags: ["-Wl,--hash-style=sysv"],
79}
80
81// -----------------------------------------------------------------------------
82// Library used by dlext tests - with GNU RELRO program header
83// -----------------------------------------------------------------------------
84// In Android.mk to support creating symlinks
85
86// -----------------------------------------------------------------------------
87// Library used by dlext tests - without GNU RELRO program header
88// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -070089cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -070090 name: "libdlext_test_norelro",
Dimitry Ivanova36e59b2016-09-01 11:37:39 -070091 defaults: ["bionic_testlib_defaults"],
Colin Cross2722ebb2016-07-11 16:20:06 -070092 srcs: ["dlext_test_library.cpp"],
93 ldflags: ["-Wl,-z,norelro"],
Elliott Hughesd50a1de2018-02-05 17:30:57 -080094 shared_libs: ["libtest_simple"],
Colin Cross2722ebb2016-07-11 16:20:06 -070095}
96
97// -----------------------------------------------------------------------------
98// Library used by dlext tests - different name non-default location
99// -----------------------------------------------------------------------------
100// In Android.mk to support installing to /data
101
102// -----------------------------------------------------------------------------
103// Libraries used by dlext tests for open from a zip-file
104// -----------------------------------------------------------------------------
105// In Android.mk to support installing to /data
106
107// ----------------------------------------------------------------------------
108// Library with soname which does not match filename
109// ----------------------------------------------------------------------------
110// In Android.mk to support zipped and aligned tests
111
112// -----------------------------------------------------------------------------
113// Library used by dlext tests - zipped and aligned
114// -----------------------------------------------------------------------------
115// In Android.mk to support zipped and aligned tests
116
117// -----------------------------------------------------------------------------
118// Library used by dlfcn tests
119// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700120cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700121 name: "libtest_simple",
122 defaults: ["bionic_testlib_defaults"],
123 srcs: ["dlopen_testlib_simple.cpp"],
124}
125
126// -----------------------------------------------------------------------------
dimitry965d06d2017-11-28 16:03:07 +0100127// Library used by dlext direct unload on the namespace boundary tests
128// -----------------------------------------------------------------------------
129cc_test_library {
130 name: "libtest_missing_symbol",
131 defaults: ["bionic_testlib_defaults"],
132 srcs: ["dlopen_testlib_missing_symbol.cpp"],
133 allow_undefined_symbols: true,
134 relative_install_path: "bionic-loader-test-libs/public_namespace_libs",
135}
136
dimitry965d06d2017-11-28 16:03:07 +0100137// -----------------------------------------------------------------------------
138// Library used by dlext indirect unload on the namespace boundary tests
139//
140// These libraries produce following dependency graph:
141// libtest_missing_symbol_root (private ns)
142// +-> libbnstest_public (public ns)
143// +-> libtest_missing_symbol_child_public (public ns)
144// +-> libnstest_public (public ns)
145// +-> libtest_missing_symbol_child_private (private_ns)
146// +-> libnstest_public (public_ns)
147//
148// All libraries except libtest_missing_symbol are located in
149// private_namespace_libs/
150// -----------------------------------------------------------------------------
151cc_test_library {
152 name: "libtest_missing_symbol_child_public",
153 defaults: ["bionic_testlib_defaults"],
154 srcs: ["empty.cpp"],
155 relative_install_path: "bionic-loader-test-libs/public_namespace_libs",
156 shared_libs: ["libnstest_public"],
157}
158
159cc_test_library {
160 name: "libtest_missing_symbol_child_private",
161 defaults: ["bionic_testlib_defaults"],
162 srcs: ["empty.cpp"],
163 relative_install_path: "bionic-loader-test-libs/private_namespace_libs",
164 shared_libs: ["libnstest_public"],
165}
166
167cc_test_library {
168 name: "libtest_missing_symbol_root",
169 defaults: ["bionic_testlib_defaults"],
170 srcs: ["dlopen_testlib_missing_symbol.cpp"],
171 relative_install_path: "bionic-loader-test-libs/private_namespace_libs",
172 allow_undefined_symbols: true,
173 shared_libs: [
174 "libnstest_public",
175 "libtest_missing_symbol_child_public",
176 "libtest_missing_symbol_child_private",
177 ],
178}
179
180// -----------------------------------------------------------------------------
181// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -0700182// Library used by dlfcn nodelete tests
183// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700184cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700185 name: "libtest_nodelete_1",
186 defaults: ["bionic_testlib_defaults"],
187 srcs: ["dlopen_nodelete_1.cpp"],
188}
189
190// -----------------------------------------------------------------------------
191// Library used by dlfcn nodelete tests
192// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700193cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700194 name: "libtest_nodelete_2",
195 defaults: ["bionic_testlib_defaults"],
196 srcs: ["dlopen_nodelete_2.cpp"],
197}
198
199// -----------------------------------------------------------------------------
200// Library used by dlfcn nodelete tests
201// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700202cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700203 name: "libtest_nodelete_dt_flags_1",
204 defaults: ["bionic_testlib_defaults"],
205 srcs: ["dlopen_nodelete_dt_flags_1.cpp"],
206 ldflags: ["-Wl,-z,nodelete"],
207}
208
209// -----------------------------------------------------------------------------
210// Build test helper libraries for linker namespaces
dimitry965d06d2017-11-28 16:03:07 +0100211//
212// This set of libraries is used to verify linker namespaces.
213//
214// Test cases
215// 1. Check that private libraries loaded in different namespaces are
216// different. Check that dlsym does not confuse them.
217// 2. Check that public libraries loaded in different namespaces are shared
218// between them.
219// 3. Check that namespace sticks on dlopen
220// 4. Check that having access to shared library (libnstest_public.so)
221// does not expose symbols from dependent library (libnstest_public_internal.so)
222//
223// Dependency tree (visibility)
224// libnstest_root.so (this should be local to the namespace)
225// +-> libnstest_public.so
226// +-> libnstest_public_internal.so
227// +-> libnstest_private.so
228//
229// libnstest_dlopened.so (library in private namespace dlopened from libnstest_root.so)
Colin Cross2722ebb2016-07-11 16:20:06 -0700230// -----------------------------------------------------------------------------
dimitry965d06d2017-11-28 16:03:07 +0100231cc_test_library {
232 name: "libnstest_root",
233 defaults: ["bionic_testlib_defaults"],
234 srcs: ["namespaces_root.cpp"],
235 relative_install_path: "bionic-loader-test-libs/private_namespace_libs",
236 shared_libs: [
237 "libnstest_public",
238 "libnstest_private",
239 ],
Ryan Prichardcd4e5ba2019-01-17 17:45:42 -0800240 // The dlext.ns_anonymous test copies the loaded segments of this shared
241 // object into a new mapping, so every segment must be readable. Turn off
242 // eXecute-Only-Memory. See http://b/123034666.
243 xom: false,
dimitry965d06d2017-11-28 16:03:07 +0100244}
245
246cc_test_library {
247 name: "libnstest_public_internal",
248 defaults: ["bionic_testlib_defaults"],
249 srcs: ["namespaces_public_internal.cpp"],
250 relative_install_path: "bionic-loader-test-libs/public_namespace_libs",
251}
252
253cc_test_library {
254 name: "libnstest_public",
255 defaults: ["bionic_testlib_defaults"],
256 srcs: ["namespaces_public.cpp"],
257 relative_install_path: "bionic-loader-test-libs/public_namespace_libs",
258 shared_libs: ["libnstest_public_internal"],
259}
260
261cc_test_library {
262 name: "libnstest_private",
263 defaults: ["bionic_testlib_defaults"],
264 srcs: ["namespaces_private.cpp"],
265 relative_install_path: "bionic-loader-test-libs/private_namespace_libs",
266}
267
268cc_test_library {
269 name: "libnstest_dlopened",
270 defaults: ["bionic_testlib_defaults"],
271 srcs: ["namespaces_dlopened.cpp"],
272 relative_install_path: "bionic-loader-test-libs/private_namespace_libs",
273}
Colin Cross2722ebb2016-07-11 16:20:06 -0700274
275// -----------------------------------------------------------------------------
Logan Chien9ee45912018-01-18 12:05:09 +0800276// Build test helper libraries for linker namespaces for allow all shared libs
277//
278// This set of libraries is used to verify linker namespaces for allow all
279// shared libs.
280//
281// Test cases
282// 1. Check that namespace a exposes libnstest_ns_a_public1 to
283// namespace b while keeping libnstest_ns_a_public1_internal as an
284// internal lib.
285// 2. Check that namespace b exposes all libraries to namespace a.
286//
287// Dependency tree (visibility)
288// libnstest_ns_b_public2.so (ns:b)
289// +-> libnstest_ns_a_public1.so (ns:a)
290// +-> libnstest_ns_a_public2_internal.so (ns:a)
291// +-> libnstest_ns_b_public3.so (ns:b)
292//
293// -----------------------------------------------------------------------------
294cc_test_library {
295 name: "libnstest_ns_a_public1",
296 defaults: ["bionic_testlib_defaults"],
297 srcs: ["libnstest_ns_a_public1.cpp"],
298 relative_install_path: "bionic-loader-test-libs/ns_a",
299 shared_libs: [
300 "libnstest_ns_a_public1_internal",
301 "libnstest_ns_b_public3",
302 ],
303}
304
305cc_test_library {
306 name: "libnstest_ns_a_public1_internal",
307 defaults: ["bionic_testlib_defaults"],
308 srcs: ["libnstest_ns_a_public1_internal.cpp"],
309 relative_install_path: "bionic-loader-test-libs/ns_a",
310}
311
312cc_test_library {
313 name: "libnstest_ns_b_public2",
314 defaults: ["bionic_testlib_defaults"],
315 srcs: ["libnstest_ns_b_public2.cpp"],
316 relative_install_path: "bionic-loader-test-libs/ns_b",
317 shared_libs: ["libnstest_ns_a_public1"],
318}
319
320cc_test_library {
321 name: "libnstest_ns_b_public3",
322 defaults: ["bionic_testlib_defaults"],
323 srcs: ["libnstest_ns_b_public3.cpp"],
324 relative_install_path: "bionic-loader-test-libs/ns_b",
325}
326
327// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -0700328// Build DT_RUNPATH test helper libraries
329// -----------------------------------------------------------------------------
330// include $(LOCAL_PATH)/Android.build.dt_runpath.mk
331
332// -----------------------------------------------------------------------------
333// Build library with two parents
334// -----------------------------------------------------------------------------
335// include $(LOCAL_PATH)/Android.build.dlopen_2_parents_reloc.mk
336
337// -----------------------------------------------------------------------------
338// Build libtest_check_order_dlsym.so with its dependencies.
339// -----------------------------------------------------------------------------
340// include $(LOCAL_PATH)/Android.build.dlopen_check_order_dlsym.mk
341
342// -----------------------------------------------------------------------------
343// Build libtest_check_order_siblings.so with its dependencies.
344// -----------------------------------------------------------------------------
345// include $(LOCAL_PATH)/Android.build.dlopen_check_order_reloc_siblings.mk
346
347// -----------------------------------------------------------------------------
348// Build libtest_check_order_root.so with its dependencies.
349// -----------------------------------------------------------------------------
350// include $(LOCAL_PATH)/Android.build.dlopen_check_order_reloc_main_executable.mk
351
352// -----------------------------------------------------------------------------
353// Build libtest_versioned_lib.so with its dependencies.
354// -----------------------------------------------------------------------------
355// include $(LOCAL_PATH)/Android.build.versioned_lib.mk
356
357// -----------------------------------------------------------------------------
358// Build libraries needed by pthread_atfork tests
359// -----------------------------------------------------------------------------
360// include $(LOCAL_PATH)/Android.build.pthread_atfork.mk
361
362// -----------------------------------------------------------------------------
363// Library with dependency loop used by dlfcn tests
364//
365// libtest_with_dependency_loop -> a -> b -> c -> a
366// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700367cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700368 name: "libtest_with_dependency_loop",
369 defaults: ["bionic_testlib_defaults"],
370 srcs: ["dlopen_testlib_loopy_root.cpp"],
371 shared_libs: ["libtest_with_dependency_loop_a"],
372}
373
374// -----------------------------------------------------------------------------
375// libtest_with_dependency_loop_a.so
376// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700377cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700378 name: "libtest_with_dependency_loop_a",
379 defaults: ["bionic_testlib_defaults"],
380 srcs: ["dlopen_testlib_loopy_a.cpp"],
381 shared_libs: ["libtest_with_dependency_loop_b_tmp"],
382}
383
384// -----------------------------------------------------------------------------
385// libtest_with_dependency_loop_b.so
386//
387// this is temporary placeholder - will be removed
388// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700389cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700390 name: "libtest_with_dependency_loop_b_tmp",
391 defaults: ["bionic_testlib_defaults"],
392 srcs: ["dlopen_testlib_loopy_invalid.cpp"],
393 ldflags: ["-Wl,-soname=libtest_with_dependency_loop_b.so"],
394}
395
396// -----------------------------------------------------------------------------
397// libtest_with_dependency_loop_b.so
398// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700399cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700400 name: "libtest_with_dependency_loop_b",
401 defaults: ["bionic_testlib_defaults"],
402 srcs: ["dlopen_testlib_loopy_b.cpp"],
403 shared_libs: ["libtest_with_dependency_loop_c"],
404}
405
406// -----------------------------------------------------------------------------
407// libtest_with_dependency_loop_c.so
408// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700409cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700410 name: "libtest_with_dependency_loop_c",
411 defaults: ["bionic_testlib_defaults"],
412 srcs: ["dlopen_testlib_loopy_c.cpp"],
413 shared_libs: ["libtest_with_dependency_loop_a"],
414}
415
416// -----------------------------------------------------------------------------
417// libtest_relo_check_dt_needed_order.so
418// |
419// +-> libtest_relo_check_dt_needed_order_1.so
420// |
421// +-> libtest_relo_check_dt_needed_order_2.so
422// -----------------------------------------------------------------------------
423
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700424cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700425 name: "libtest_relo_check_dt_needed_order",
426 defaults: ["bionic_testlib_defaults"],
427 srcs: ["dlopen_testlib_relo_check_dt_needed_order.cpp"],
428 shared_libs: [
429 "libtest_relo_check_dt_needed_order_1",
430 "libtest_relo_check_dt_needed_order_2",
431 ],
432}
433
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700434cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700435 name: "libtest_relo_check_dt_needed_order_1",
436 defaults: ["bionic_testlib_defaults"],
437 srcs: ["dlopen_testlib_relo_check_dt_needed_order_1.cpp"],
438}
439
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700440cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700441 name: "libtest_relo_check_dt_needed_order_2",
442 defaults: ["bionic_testlib_defaults"],
443 srcs: ["dlopen_testlib_relo_check_dt_needed_order_2.cpp"],
444}
445
446// -----------------------------------------------------------------------------
447// Library with dependency used by dlfcn tests
448// -----------------------------------------------------------------------------
449// In Android.mk to support dependency on libdlext_test
450
451// -----------------------------------------------------------------------------
452// Library used by ifunc tests
453// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700454cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700455 name: "libtest_ifunc",
456 defaults: ["bionic_testlib_defaults"],
Dimitry Ivanov21975b22017-05-02 16:31:56 -0700457 srcs: ["dlopen_testlib_ifunc.cpp"],
Colin Cross2722ebb2016-07-11 16:20:06 -0700458
Colin Cross2722ebb2016-07-11 16:20:06 -0700459 arch: {
460 mips: {
461 enabled: false,
462 },
463 mips64: {
464 enabled: false,
465 },
466 },
Dimitry Ivanov21975b22017-05-02 16:31:56 -0700467}
468
469cc_test_library {
470 name: "libtest_ifunc_variable",
471 defaults: ["bionic_testlib_defaults"],
472 srcs: ["dlopen_testlib_ifunc_variable.cpp"],
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800473 shared_libs: ["libtest_ifunc_variable_impl"],
Dimitry Ivanov21975b22017-05-02 16:31:56 -0700474
475 arch: {
476 mips: {
477 enabled: false,
478 },
479 mips64: {
480 enabled: false,
481 },
482 },
Dimitry Ivanov21975b22017-05-02 16:31:56 -0700483}
484
485cc_test_library {
486 name: "libtest_ifunc_variable_impl",
487 defaults: ["bionic_testlib_defaults"],
488 srcs: ["dlopen_testlib_ifunc_variable_impl.cpp"],
489
490 arch: {
491 mips: {
492 enabled: false,
493 },
494 mips64: {
495 enabled: false,
496 },
497 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700498}
499
500// -----------------------------------------------------------------------------
501// Library used by atexit tests
502// -----------------------------------------------------------------------------
503
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700504cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700505 name: "libtest_atexit",
506 defaults: ["bionic_testlib_defaults"],
507 srcs: ["atexit_testlib.cpp"],
508}
509
510// -----------------------------------------------------------------------------
511// This library is used by dl_load test to check symbol preempting
512// by main executable
513// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700514cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700515 name: "libdl_preempt_test_1",
516 defaults: ["bionic_testlib_defaults"],
517 srcs: ["dl_preempt_library_1.cpp"],
518}
519
520// -----------------------------------------------------------------------------
521// This library is used by dl_load test to check symbol preempting
522// by libdl_preempt_test_1.so
523// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700524cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700525 name: "libdl_preempt_test_2",
526 defaults: ["bionic_testlib_defaults"],
527 srcs: ["dl_preempt_library_2.cpp"],
528}
529
530// -----------------------------------------------------------------------------
531// Library with DF_1_GLOBAL
532// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700533cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700534 name: "libdl_test_df_1_global",
535 defaults: ["bionic_testlib_defaults"],
536 srcs: ["dl_df_1_global.cpp"],
537 ldflags: ["-Wl,-z,global"],
538
539 target: {
540 host: {
541 // TODO (dimitry): host ld.gold does not yet support -z global
542 // remove this line once it is updated.
543 ldflags: ["-fuse-ld=bfd"],
544 },
545 },
546}
547
548// -----------------------------------------------------------------------------
549// Library using symbol from libdl_test_df_1_global
550// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700551cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700552 name: "libtest_dlsym_df_1_global",
553 defaults: ["bionic_testlib_defaults"],
554 srcs: ["dl_df_1_use_global.cpp"],
555}
556
557// -----------------------------------------------------------------------------
Jiyong Park01162f22017-10-16 15:31:09 +0900558// Library with DF_1_GLOBAL which will be dlopened
559// (note: libdl_test_df_1_global above will be included in DT_NEEDED)
560// -----------------------------------------------------------------------------
561cc_test_library {
562 name: "libtest_dlopen_df_1_global",
563 defaults: ["bionic_testlib_defaults"],
564 srcs: ["dl_df_1_global_dummy.cpp"],
565 ldflags: ["-Wl,-z,global"],
566
567 target: {
568 host: {
569 // TODO (dimitry): host ld.gold does not yet support -z global
570 // remove this line once it is updated.
571 ldflags: ["-fuse-ld=bfd"],
572 },
573 },
574}
575
Jiyong Park01162f22017-10-16 15:31:09 +0900576// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -0700577// Library with weak function
578// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700579cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700580 name: "libtest_dlsym_weak_func",
581 defaults: ["bionic_testlib_defaults"],
582 srcs: ["dlsym_weak_function.cpp"],
583}
584
585// -----------------------------------------------------------------------------
586// Library to check RTLD_LOCAL with dlsym in 'this'
587// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700588cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700589 name: "libtest_dlsym_from_this",
590 defaults: ["bionic_testlib_defaults"],
591 srcs: ["dlsym_from_this_symbol.cpp"],
592 shared_libs: ["libtest_dlsym_from_this_child"],
Colin Cross2722ebb2016-07-11 16:20:06 -0700593}
594
595// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700596cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700597 name: "libtest_dlsym_from_this_child",
598 defaults: ["bionic_testlib_defaults"],
599 srcs: ["dlsym_from_this_functions.cpp"],
600 shared_libs: ["libtest_dlsym_from_this_grandchild"],
601}
602
603// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700604cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700605 name: "libtest_dlsym_from_this_grandchild",
606 defaults: ["bionic_testlib_defaults"],
607 srcs: ["dlsym_from_this_symbol2.cpp"],
608}
609
610// -----------------------------------------------------------------------------
611// Empty library
612// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700613cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700614 name: "libtest_empty",
615 defaults: ["bionic_testlib_defaults"],
616 srcs: ["empty.cpp"],
617}
618
619// -----------------------------------------------------------------------------
dimitry8db36a52017-10-23 15:10:10 +0200620// Library for inaccessible shared library test
621// -----------------------------------------------------------------------------
622cc_test_library {
623 name: "libtestshared",
624 defaults: ["bionic_testlib_defaults"],
625 srcs: ["empty.cpp"],
Nan Zhangdab0fd52017-11-07 11:05:24 -0800626 relative_install_path: "bionic-loader-test-libs/inaccessible_libs",
dimitry8db36a52017-10-23 15:10:10 +0200627}
628
629// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -0700630// Library with weak undefined function
631// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700632cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700633 name: "libtest_dlopen_weak_undefined_func",
634 defaults: ["bionic_testlib_defaults"],
635 srcs: ["dlopen_weak_undefined.cpp"],
636}
637
638// -----------------------------------------------------------------------------
Dimitry Ivanovd0b5c3a2016-11-25 12:23:11 -0800639// Check that RTLD_NEXT of a libc symbol works in dlopened library
640// -----------------------------------------------------------------------------
641cc_test_library {
642 name: "libtest_check_rtld_next_from_library",
643 defaults: ["bionic_testlib_defaults"],
644 srcs: ["check_rtld_next_from_library.cpp"],
Dimitry Ivanovd0b5c3a2016-11-25 12:23:11 -0800645}
646
647// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -0700648// Library with constructor that calls dlopen() b/7941716
649// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700650cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700651 name: "libtest_dlopen_from_ctor",
652 defaults: ["bionic_testlib_defaults"],
653 srcs: ["dlopen_testlib_dlopen_from_ctor.cpp"],
Colin Cross2722ebb2016-07-11 16:20:06 -0700654}
655
656// -----------------------------------------------------------------------------
Dimitry Ivanovec90e242017-02-10 11:04:20 -0800657// Libraries used to check init/fini call order
Dimitry Ivanovea8f3962017-02-09 13:31:57 -0800658// -----------------------------------------------------------------------------
659cc_test_library {
660 name: "libtest_init_fini_order_root",
661 defaults: ["bionic_testlib_defaults"],
662 srcs: ["dlopen_check_init_fini_root.cpp"],
Dimitry Ivanovec90e242017-02-10 11:04:20 -0800663 shared_libs: [
664 "libtest_init_fini_order_child",
665 "libtest_init_fini_order_grand_child",
666 ],
667}
668
669cc_test_library {
670 name: "libtest_init_fini_order_root2",
671 defaults: ["bionic_testlib_defaults"],
672 srcs: ["dlopen_check_init_fini_root.cpp"],
673 shared_libs: [
674 "libtest_init_fini_order_grand_child",
675 "libtest_init_fini_order_child",
676 ],
Dimitry Ivanovea8f3962017-02-09 13:31:57 -0800677}
678
679cc_test_library {
680 name: "libtest_init_fini_order_child",
681 defaults: ["bionic_testlib_defaults"],
682 srcs: ["dlopen_check_init_fini_child.cpp"],
683 shared_libs: ["libtest_init_fini_order_grand_child"],
684}
685
686cc_test_library {
687 name: "libtest_init_fini_order_grand_child",
688 defaults: ["bionic_testlib_defaults"],
689 srcs: ["dlopen_check_init_fini_grand_child.cpp"],
690}
691
692// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -0700693// Library that depends on the library with constructor that calls dlopen() b/7941716
694// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700695cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700696 name: "libtest_dlopen_from_ctor_main",
697 defaults: ["bionic_testlib_defaults"],
698 srcs: ["empty.cpp"],
699 shared_libs: ["libtest_dlopen_from_ctor"],
700}
701
702// -----------------------------------------------------------------------------
dimitry55547db2018-05-25 14:17:37 +0200703// Libraries with non-trivial thread_local variable to test dlclose()
dimitry06016f22018-01-05 11:39:28 +0100704// -----------------------------------------------------------------------------
705cc_test_library {
706 name: "libtest_thread_local_dtor",
707 defaults: ["bionic_testlib_defaults"],
708 srcs: ["thread_local_dtor.cpp"],
709}
710
dimitry55547db2018-05-25 14:17:37 +0200711cc_test_library {
712 name: "libtest_thread_local_dtor2",
713 defaults: ["bionic_testlib_defaults"],
714 srcs: ["thread_local_dtor2.cpp"],
715}
716
717// -----------------------------------------------------------------------------
718// Library dt_needs libtest_thread_local_dtor/2 (to check no-unload on load_group)
719// -----------------------------------------------------------------------------
720cc_test_library {
721 name: "libtest_indirect_thread_local_dtor",
722 defaults: ["bionic_testlib_defaults"],
723 srcs: ["empty.cpp"],
724 shared_libs: [
725 "libtest_thread_local_dtor",
726 "libtest_thread_local_dtor2",
727 ],
728}
729
730
dimitry06016f22018-01-05 11:39:28 +0100731// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -0700732// Tool to use to align the shared libraries in a zip file.
733// -----------------------------------------------------------------------------
734cc_binary_host {
735 name: "bionic_tests_zipalign",
736 srcs: ["bionic_tests_zipalign.cpp"],
737 cflags: [
738 "-Wall",
739 "-Werror",
740 ],
741
742 static_libs: [
743 "libziparchive",
744 "liblog",
745 "libbase",
746 "libz",
747 "libutils",
748 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700749}
Evgenii Stepanov0a3637d2016-07-06 13:20:59 -0700750
751cc_test_library {
752 name: "libcfi-test",
753 defaults: ["bionic_testlib_defaults"],
754 srcs: ["cfi_test_lib.cpp"],
755 sanitize: {
756 cfi: false,
757 },
758}
759
760cc_test_library {
761 name: "libcfi-test-bad",
762 defaults: ["bionic_testlib_defaults"],
763 srcs: ["cfi_test_bad_lib.cpp"],
764 sanitize: {
765 cfi: false,
766 },
767}
Evgenii Stepanov68ecec12017-01-31 13:19:30 -0800768
769cc_test {
770 name: "cfi_test_helper",
771 host_supported: false,
772 defaults: ["bionic_testlib_defaults"],
773 srcs: ["cfi_test_helper.cpp"],
774 ldflags: ["-rdynamic"],
775}
776
777cc_test {
778 name: "cfi_test_helper2",
779 host_supported: false,
780 defaults: ["bionic_testlib_defaults"],
781 srcs: ["cfi_test_helper2.cpp"],
782 shared_libs: ["libcfi-test"],
783 ldflags: ["-Wl,--rpath,${ORIGIN}/.."],
784}
Elliott Hugheseb04ed52017-03-29 13:48:02 -0700785
786cc_test {
787 name: "preinit_getauxval_test_helper",
788 host_supported: false,
789 defaults: ["bionic_testlib_defaults"],
790 srcs: ["preinit_getauxval_test_helper.cpp"],
791}
792
793cc_test {
794 name: "preinit_syscall_test_helper",
795 host_supported: false,
796 defaults: ["bionic_testlib_defaults"],
797 srcs: ["preinit_syscall_test_helper.cpp"],
798}
Jiyong Park02586a22017-05-20 01:01:24 +0900799
800cc_test {
801 name: "ld_preload_test_helper",
802 host_supported: false,
803 defaults: ["bionic_testlib_defaults"],
804 srcs: ["ld_preload_test_helper.cpp"],
805 shared_libs: ["ld_preload_test_helper_lib1"],
806 ldflags: ["-Wl,--rpath,${ORIGIN}/.."],
807}
808
809cc_test_library {
810 name: "ld_preload_test_helper_lib1",
811 host_supported: false,
812 defaults: ["bionic_testlib_defaults"],
813 srcs: ["ld_preload_test_helper_lib1.cpp"],
814}
815
816cc_test_library {
817 name: "ld_preload_test_helper_lib2",
818 host_supported: false,
819 defaults: ["bionic_testlib_defaults"],
820 srcs: ["ld_preload_test_helper_lib2.cpp"],
821}
822
823cc_test {
824 name: "ld_config_test_helper",
825 host_supported: false,
826 defaults: ["bionic_testlib_defaults"],
827 srcs: ["ld_config_test_helper.cpp"],
828 shared_libs: ["ld_config_test_helper_lib1"],
829 ldflags: ["-Wl,--rpath,${ORIGIN}/.."],
830}
831
832cc_test_library {
833 name: "ld_config_test_helper_lib1",
834 host_supported: false,
835 defaults: ["bionic_testlib_defaults"],
836 srcs: ["ld_config_test_helper_lib1.cpp"],
837 shared_libs: ["ld_config_test_helper_lib2"],
Nan Zhangdab0fd52017-11-07 11:05:24 -0800838 relative_install_path: "bionic-loader-test-libs/ns2",
Jiyong Park02586a22017-05-20 01:01:24 +0900839}
840
841cc_test_library {
842 name: "ld_config_test_helper_lib2",
843 host_supported: false,
844 defaults: ["bionic_testlib_defaults"],
845 srcs: ["ld_config_test_helper_lib2.cpp"],
Nan Zhangdab0fd52017-11-07 11:05:24 -0800846 relative_install_path: "bionic-loader-test-libs/ns2",
Jiyong Park02586a22017-05-20 01:01:24 +0900847}
848
849cc_test_library {
850 name: "ld_config_test_helper_lib3",
851 host_supported: false,
852 defaults: ["bionic_testlib_defaults"],
853 srcs: ["ld_config_test_helper_lib3.cpp"],
854}
Ryan Prichard8f639a42018-10-01 23:10:05 -0700855
856cc_test {
857 name: "exec_linker_helper",
858 host_supported: false,
859 defaults: ["bionic_testlib_defaults"],
860 srcs: ["exec_linker_helper.cpp"],
861 shared_libs: ["exec_linker_helper_lib"],
862 ldflags: ["-Wl,--rpath,${ORIGIN}/.."],
863}
864
865cc_test_library {
866 name: "exec_linker_helper_lib",
867 host_supported: false,
868 defaults: ["bionic_testlib_defaults"],
869 srcs: ["exec_linker_helper_lib.cpp"],
870}