blob: 2d35c510da38f5d9e75ba4fabc202efd1d9ce83d [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 ],
240}
241
242cc_test_library {
243 name: "libnstest_public_internal",
244 defaults: ["bionic_testlib_defaults"],
245 srcs: ["namespaces_public_internal.cpp"],
246 relative_install_path: "bionic-loader-test-libs/public_namespace_libs",
247}
248
249cc_test_library {
250 name: "libnstest_public",
251 defaults: ["bionic_testlib_defaults"],
252 srcs: ["namespaces_public.cpp"],
253 relative_install_path: "bionic-loader-test-libs/public_namespace_libs",
254 shared_libs: ["libnstest_public_internal"],
255}
256
257cc_test_library {
258 name: "libnstest_private",
259 defaults: ["bionic_testlib_defaults"],
260 srcs: ["namespaces_private.cpp"],
261 relative_install_path: "bionic-loader-test-libs/private_namespace_libs",
262}
263
264cc_test_library {
265 name: "libnstest_dlopened",
266 defaults: ["bionic_testlib_defaults"],
267 srcs: ["namespaces_dlopened.cpp"],
268 relative_install_path: "bionic-loader-test-libs/private_namespace_libs",
269}
Colin Cross2722ebb2016-07-11 16:20:06 -0700270
271// -----------------------------------------------------------------------------
Logan Chien9ee45912018-01-18 12:05:09 +0800272// Build test helper libraries for linker namespaces for allow all shared libs
273//
274// This set of libraries is used to verify linker namespaces for allow all
275// shared libs.
276//
277// Test cases
278// 1. Check that namespace a exposes libnstest_ns_a_public1 to
279// namespace b while keeping libnstest_ns_a_public1_internal as an
280// internal lib.
281// 2. Check that namespace b exposes all libraries to namespace a.
282//
283// Dependency tree (visibility)
284// libnstest_ns_b_public2.so (ns:b)
285// +-> libnstest_ns_a_public1.so (ns:a)
286// +-> libnstest_ns_a_public2_internal.so (ns:a)
287// +-> libnstest_ns_b_public3.so (ns:b)
288//
289// -----------------------------------------------------------------------------
290cc_test_library {
291 name: "libnstest_ns_a_public1",
292 defaults: ["bionic_testlib_defaults"],
293 srcs: ["libnstest_ns_a_public1.cpp"],
294 relative_install_path: "bionic-loader-test-libs/ns_a",
295 shared_libs: [
296 "libnstest_ns_a_public1_internal",
297 "libnstest_ns_b_public3",
298 ],
299}
300
301cc_test_library {
302 name: "libnstest_ns_a_public1_internal",
303 defaults: ["bionic_testlib_defaults"],
304 srcs: ["libnstest_ns_a_public1_internal.cpp"],
305 relative_install_path: "bionic-loader-test-libs/ns_a",
306}
307
308cc_test_library {
309 name: "libnstest_ns_b_public2",
310 defaults: ["bionic_testlib_defaults"],
311 srcs: ["libnstest_ns_b_public2.cpp"],
312 relative_install_path: "bionic-loader-test-libs/ns_b",
313 shared_libs: ["libnstest_ns_a_public1"],
314}
315
316cc_test_library {
317 name: "libnstest_ns_b_public3",
318 defaults: ["bionic_testlib_defaults"],
319 srcs: ["libnstest_ns_b_public3.cpp"],
320 relative_install_path: "bionic-loader-test-libs/ns_b",
321}
322
323// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -0700324// Build DT_RUNPATH test helper libraries
325// -----------------------------------------------------------------------------
326// include $(LOCAL_PATH)/Android.build.dt_runpath.mk
327
328// -----------------------------------------------------------------------------
329// Build library with two parents
330// -----------------------------------------------------------------------------
331// include $(LOCAL_PATH)/Android.build.dlopen_2_parents_reloc.mk
332
333// -----------------------------------------------------------------------------
334// Build libtest_check_order_dlsym.so with its dependencies.
335// -----------------------------------------------------------------------------
336// include $(LOCAL_PATH)/Android.build.dlopen_check_order_dlsym.mk
337
338// -----------------------------------------------------------------------------
339// Build libtest_check_order_siblings.so with its dependencies.
340// -----------------------------------------------------------------------------
341// include $(LOCAL_PATH)/Android.build.dlopen_check_order_reloc_siblings.mk
342
343// -----------------------------------------------------------------------------
344// Build libtest_check_order_root.so with its dependencies.
345// -----------------------------------------------------------------------------
346// include $(LOCAL_PATH)/Android.build.dlopen_check_order_reloc_main_executable.mk
347
348// -----------------------------------------------------------------------------
349// Build libtest_versioned_lib.so with its dependencies.
350// -----------------------------------------------------------------------------
351// include $(LOCAL_PATH)/Android.build.versioned_lib.mk
352
353// -----------------------------------------------------------------------------
354// Build libraries needed by pthread_atfork tests
355// -----------------------------------------------------------------------------
356// include $(LOCAL_PATH)/Android.build.pthread_atfork.mk
357
358// -----------------------------------------------------------------------------
359// Library with dependency loop used by dlfcn tests
360//
361// libtest_with_dependency_loop -> a -> b -> c -> a
362// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700363cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700364 name: "libtest_with_dependency_loop",
365 defaults: ["bionic_testlib_defaults"],
366 srcs: ["dlopen_testlib_loopy_root.cpp"],
367 shared_libs: ["libtest_with_dependency_loop_a"],
368}
369
370// -----------------------------------------------------------------------------
371// libtest_with_dependency_loop_a.so
372// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700373cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700374 name: "libtest_with_dependency_loop_a",
375 defaults: ["bionic_testlib_defaults"],
376 srcs: ["dlopen_testlib_loopy_a.cpp"],
377 shared_libs: ["libtest_with_dependency_loop_b_tmp"],
378}
379
380// -----------------------------------------------------------------------------
381// libtest_with_dependency_loop_b.so
382//
383// this is temporary placeholder - will be removed
384// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700385cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700386 name: "libtest_with_dependency_loop_b_tmp",
387 defaults: ["bionic_testlib_defaults"],
388 srcs: ["dlopen_testlib_loopy_invalid.cpp"],
389 ldflags: ["-Wl,-soname=libtest_with_dependency_loop_b.so"],
390}
391
392// -----------------------------------------------------------------------------
393// libtest_with_dependency_loop_b.so
394// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700395cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700396 name: "libtest_with_dependency_loop_b",
397 defaults: ["bionic_testlib_defaults"],
398 srcs: ["dlopen_testlib_loopy_b.cpp"],
399 shared_libs: ["libtest_with_dependency_loop_c"],
400}
401
402// -----------------------------------------------------------------------------
403// libtest_with_dependency_loop_c.so
404// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700405cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700406 name: "libtest_with_dependency_loop_c",
407 defaults: ["bionic_testlib_defaults"],
408 srcs: ["dlopen_testlib_loopy_c.cpp"],
409 shared_libs: ["libtest_with_dependency_loop_a"],
410}
411
412// -----------------------------------------------------------------------------
413// libtest_relo_check_dt_needed_order.so
414// |
415// +-> libtest_relo_check_dt_needed_order_1.so
416// |
417// +-> libtest_relo_check_dt_needed_order_2.so
418// -----------------------------------------------------------------------------
419
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700420cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700421 name: "libtest_relo_check_dt_needed_order",
422 defaults: ["bionic_testlib_defaults"],
423 srcs: ["dlopen_testlib_relo_check_dt_needed_order.cpp"],
424 shared_libs: [
425 "libtest_relo_check_dt_needed_order_1",
426 "libtest_relo_check_dt_needed_order_2",
427 ],
428}
429
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700430cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700431 name: "libtest_relo_check_dt_needed_order_1",
432 defaults: ["bionic_testlib_defaults"],
433 srcs: ["dlopen_testlib_relo_check_dt_needed_order_1.cpp"],
434}
435
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700436cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700437 name: "libtest_relo_check_dt_needed_order_2",
438 defaults: ["bionic_testlib_defaults"],
439 srcs: ["dlopen_testlib_relo_check_dt_needed_order_2.cpp"],
440}
441
442// -----------------------------------------------------------------------------
443// Library with dependency used by dlfcn tests
444// -----------------------------------------------------------------------------
445// In Android.mk to support dependency on libdlext_test
446
447// -----------------------------------------------------------------------------
448// Library used by ifunc tests
449// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700450cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700451 name: "libtest_ifunc",
452 defaults: ["bionic_testlib_defaults"],
Dimitry Ivanov21975b22017-05-02 16:31:56 -0700453 srcs: ["dlopen_testlib_ifunc.cpp"],
Colin Cross2722ebb2016-07-11 16:20:06 -0700454
Colin Cross2722ebb2016-07-11 16:20:06 -0700455 arch: {
456 mips: {
457 enabled: false,
458 },
459 mips64: {
460 enabled: false,
461 },
462 },
Dimitry Ivanov21975b22017-05-02 16:31:56 -0700463}
464
465cc_test_library {
466 name: "libtest_ifunc_variable",
467 defaults: ["bionic_testlib_defaults"],
468 srcs: ["dlopen_testlib_ifunc_variable.cpp"],
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800469 shared_libs: ["libtest_ifunc_variable_impl"],
Dimitry Ivanov21975b22017-05-02 16:31:56 -0700470
471 arch: {
472 mips: {
473 enabled: false,
474 },
475 mips64: {
476 enabled: false,
477 },
478 },
Dimitry Ivanov21975b22017-05-02 16:31:56 -0700479}
480
481cc_test_library {
482 name: "libtest_ifunc_variable_impl",
483 defaults: ["bionic_testlib_defaults"],
484 srcs: ["dlopen_testlib_ifunc_variable_impl.cpp"],
485
486 arch: {
487 mips: {
488 enabled: false,
489 },
490 mips64: {
491 enabled: false,
492 },
493 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700494}
495
496// -----------------------------------------------------------------------------
497// Library used by atexit tests
498// -----------------------------------------------------------------------------
499
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700500cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700501 name: "libtest_atexit",
502 defaults: ["bionic_testlib_defaults"],
503 srcs: ["atexit_testlib.cpp"],
504}
505
506// -----------------------------------------------------------------------------
507// This library is used by dl_load test to check symbol preempting
508// by main executable
509// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700510cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700511 name: "libdl_preempt_test_1",
512 defaults: ["bionic_testlib_defaults"],
513 srcs: ["dl_preempt_library_1.cpp"],
514}
515
516// -----------------------------------------------------------------------------
517// This library is used by dl_load test to check symbol preempting
518// by libdl_preempt_test_1.so
519// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700520cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700521 name: "libdl_preempt_test_2",
522 defaults: ["bionic_testlib_defaults"],
523 srcs: ["dl_preempt_library_2.cpp"],
524}
525
526// -----------------------------------------------------------------------------
527// Library with DF_1_GLOBAL
528// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700529cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700530 name: "libdl_test_df_1_global",
531 defaults: ["bionic_testlib_defaults"],
532 srcs: ["dl_df_1_global.cpp"],
533 ldflags: ["-Wl,-z,global"],
Chih-Hung Hsieh8e462d42018-05-21 23:49:31 -0700534 // b/80109858, clang lld ignores -z,global
535 use_clang_lld: false,
Colin Cross2722ebb2016-07-11 16:20:06 -0700536
537 target: {
538 host: {
539 // TODO (dimitry): host ld.gold does not yet support -z global
540 // remove this line once it is updated.
541 ldflags: ["-fuse-ld=bfd"],
542 },
543 },
544}
545
546// -----------------------------------------------------------------------------
547// Library using symbol from libdl_test_df_1_global
548// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700549cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700550 name: "libtest_dlsym_df_1_global",
551 defaults: ["bionic_testlib_defaults"],
552 srcs: ["dl_df_1_use_global.cpp"],
553}
554
555// -----------------------------------------------------------------------------
Jiyong Park01162f22017-10-16 15:31:09 +0900556// Library with DF_1_GLOBAL which will be dlopened
557// (note: libdl_test_df_1_global above will be included in DT_NEEDED)
558// -----------------------------------------------------------------------------
559cc_test_library {
560 name: "libtest_dlopen_df_1_global",
561 defaults: ["bionic_testlib_defaults"],
562 srcs: ["dl_df_1_global_dummy.cpp"],
563 ldflags: ["-Wl,-z,global"],
Chih-Hung Hsieh8e462d42018-05-21 23:49:31 -0700564 // b/80109858, clang lld ignores -z,global
565 use_clang_lld: false,
Jiyong Park01162f22017-10-16 15:31:09 +0900566
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}