blob: ae5f78a006f62c99711f92b8471fc9b2d9ec4211 [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"],
50}
51
52// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -070053// Library to test gnu-styled hash
54// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -070055cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -070056 name: "libgnu-hash-table-library",
57 defaults: ["bionic_testlib_defaults"],
58 srcs: ["dlext_test_library.cpp"],
59 ldflags: ["-Wl,--hash-style=gnu"],
60 arch: {
61 mips: {
62 enabled: false,
63 },
64 mips64: {
65 enabled: false,
66 },
67 },
68}
69
70// -----------------------------------------------------------------------------
71// Library to test sysv-styled hash
72// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -070073cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -070074 name: "libsysv-hash-table-library",
75 defaults: ["bionic_testlib_defaults"],
76 srcs: ["dlext_test_library.cpp"],
77 ldflags: ["-Wl,--hash-style=sysv"],
78}
79
80// -----------------------------------------------------------------------------
81// Library used by dlext tests - with GNU RELRO program header
82// -----------------------------------------------------------------------------
83// In Android.mk to support creating symlinks
84
85// -----------------------------------------------------------------------------
86// Library used by dlext tests - without GNU RELRO program header
87// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -070088cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -070089 name: "libdlext_test_norelro",
Dimitry Ivanova36e59b2016-09-01 11:37:39 -070090 defaults: ["bionic_testlib_defaults"],
Colin Cross2722ebb2016-07-11 16:20:06 -070091 srcs: ["dlext_test_library.cpp"],
92 ldflags: ["-Wl,-z,norelro"],
Elliott Hughesd50a1de2018-02-05 17:30:57 -080093 shared_libs: ["libtest_simple"],
Colin Cross2722ebb2016-07-11 16:20:06 -070094}
95
96// -----------------------------------------------------------------------------
97// Library used by dlext tests - different name non-default location
98// -----------------------------------------------------------------------------
99// In Android.mk to support installing to /data
100
101// -----------------------------------------------------------------------------
102// Libraries used by dlext tests for open from a zip-file
103// -----------------------------------------------------------------------------
104// In Android.mk to support installing to /data
105
106// ----------------------------------------------------------------------------
107// Library with soname which does not match filename
108// ----------------------------------------------------------------------------
109// In Android.mk to support zipped and aligned tests
110
111// -----------------------------------------------------------------------------
112// Library used by dlext tests - zipped and aligned
113// -----------------------------------------------------------------------------
114// In Android.mk to support zipped and aligned tests
115
116// -----------------------------------------------------------------------------
117// Library used by dlfcn tests
118// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700119cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700120 name: "libtest_simple",
121 defaults: ["bionic_testlib_defaults"],
122 srcs: ["dlopen_testlib_simple.cpp"],
123}
124
125// -----------------------------------------------------------------------------
dimitry965d06d2017-11-28 16:03:07 +0100126// Library used by dlext direct unload on the namespace boundary tests
127// -----------------------------------------------------------------------------
128cc_test_library {
129 name: "libtest_missing_symbol",
130 defaults: ["bionic_testlib_defaults"],
131 srcs: ["dlopen_testlib_missing_symbol.cpp"],
132 allow_undefined_symbols: true,
133 relative_install_path: "bionic-loader-test-libs/public_namespace_libs",
134}
135
dimitry965d06d2017-11-28 16:03:07 +0100136// -----------------------------------------------------------------------------
137// Library used by dlext indirect unload on the namespace boundary tests
138//
139// These libraries produce following dependency graph:
140// libtest_missing_symbol_root (private ns)
141// +-> libbnstest_public (public ns)
142// +-> libtest_missing_symbol_child_public (public ns)
143// +-> libnstest_public (public ns)
144// +-> libtest_missing_symbol_child_private (private_ns)
145// +-> libnstest_public (public_ns)
146//
147// All libraries except libtest_missing_symbol are located in
148// private_namespace_libs/
149// -----------------------------------------------------------------------------
150cc_test_library {
151 name: "libtest_missing_symbol_child_public",
152 defaults: ["bionic_testlib_defaults"],
153 srcs: ["empty.cpp"],
154 relative_install_path: "bionic-loader-test-libs/public_namespace_libs",
155 shared_libs: ["libnstest_public"],
156}
157
158cc_test_library {
159 name: "libtest_missing_symbol_child_private",
160 defaults: ["bionic_testlib_defaults"],
161 srcs: ["empty.cpp"],
162 relative_install_path: "bionic-loader-test-libs/private_namespace_libs",
163 shared_libs: ["libnstest_public"],
164}
165
166cc_test_library {
167 name: "libtest_missing_symbol_root",
168 defaults: ["bionic_testlib_defaults"],
169 srcs: ["dlopen_testlib_missing_symbol.cpp"],
170 relative_install_path: "bionic-loader-test-libs/private_namespace_libs",
171 allow_undefined_symbols: true,
172 shared_libs: [
173 "libnstest_public",
174 "libtest_missing_symbol_child_public",
175 "libtest_missing_symbol_child_private",
176 ],
177}
178
179// -----------------------------------------------------------------------------
180// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -0700181// Library used by dlfcn nodelete tests
182// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700183cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700184 name: "libtest_nodelete_1",
185 defaults: ["bionic_testlib_defaults"],
186 srcs: ["dlopen_nodelete_1.cpp"],
187}
188
189// -----------------------------------------------------------------------------
190// Library used by dlfcn nodelete tests
191// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700192cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700193 name: "libtest_nodelete_2",
194 defaults: ["bionic_testlib_defaults"],
195 srcs: ["dlopen_nodelete_2.cpp"],
196}
197
198// -----------------------------------------------------------------------------
199// Library used by dlfcn nodelete tests
200// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700201cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700202 name: "libtest_nodelete_dt_flags_1",
203 defaults: ["bionic_testlib_defaults"],
204 srcs: ["dlopen_nodelete_dt_flags_1.cpp"],
205 ldflags: ["-Wl,-z,nodelete"],
206}
207
208// -----------------------------------------------------------------------------
209// Build test helper libraries for linker namespaces
dimitry965d06d2017-11-28 16:03:07 +0100210//
211// This set of libraries is used to verify linker namespaces.
212//
213// Test cases
214// 1. Check that private libraries loaded in different namespaces are
215// different. Check that dlsym does not confuse them.
216// 2. Check that public libraries loaded in different namespaces are shared
217// between them.
218// 3. Check that namespace sticks on dlopen
219// 4. Check that having access to shared library (libnstest_public.so)
220// does not expose symbols from dependent library (libnstest_public_internal.so)
221//
222// Dependency tree (visibility)
223// libnstest_root.so (this should be local to the namespace)
224// +-> libnstest_public.so
225// +-> libnstest_public_internal.so
226// +-> libnstest_private.so
227//
228// libnstest_dlopened.so (library in private namespace dlopened from libnstest_root.so)
Colin Cross2722ebb2016-07-11 16:20:06 -0700229// -----------------------------------------------------------------------------
dimitry965d06d2017-11-28 16:03:07 +0100230cc_test_library {
231 name: "libnstest_root",
232 defaults: ["bionic_testlib_defaults"],
233 srcs: ["namespaces_root.cpp"],
234 relative_install_path: "bionic-loader-test-libs/private_namespace_libs",
235 shared_libs: [
236 "libnstest_public",
237 "libnstest_private",
238 ],
239}
240
241cc_test_library {
242 name: "libnstest_public_internal",
243 defaults: ["bionic_testlib_defaults"],
244 srcs: ["namespaces_public_internal.cpp"],
245 relative_install_path: "bionic-loader-test-libs/public_namespace_libs",
246}
247
248cc_test_library {
249 name: "libnstest_public",
250 defaults: ["bionic_testlib_defaults"],
251 srcs: ["namespaces_public.cpp"],
252 relative_install_path: "bionic-loader-test-libs/public_namespace_libs",
253 shared_libs: ["libnstest_public_internal"],
254}
255
256cc_test_library {
257 name: "libnstest_private",
258 defaults: ["bionic_testlib_defaults"],
259 srcs: ["namespaces_private.cpp"],
260 relative_install_path: "bionic-loader-test-libs/private_namespace_libs",
261}
262
263cc_test_library {
264 name: "libnstest_dlopened",
265 defaults: ["bionic_testlib_defaults"],
266 srcs: ["namespaces_dlopened.cpp"],
267 relative_install_path: "bionic-loader-test-libs/private_namespace_libs",
268}
Colin Cross2722ebb2016-07-11 16:20:06 -0700269
270// -----------------------------------------------------------------------------
Logan Chien9ee45912018-01-18 12:05:09 +0800271// Build test helper libraries for linker namespaces for allow all shared libs
272//
273// This set of libraries is used to verify linker namespaces for allow all
274// shared libs.
275//
276// Test cases
277// 1. Check that namespace a exposes libnstest_ns_a_public1 to
278// namespace b while keeping libnstest_ns_a_public1_internal as an
279// internal lib.
280// 2. Check that namespace b exposes all libraries to namespace a.
281//
282// Dependency tree (visibility)
283// libnstest_ns_b_public2.so (ns:b)
284// +-> libnstest_ns_a_public1.so (ns:a)
285// +-> libnstest_ns_a_public2_internal.so (ns:a)
286// +-> libnstest_ns_b_public3.so (ns:b)
287//
288// -----------------------------------------------------------------------------
289cc_test_library {
290 name: "libnstest_ns_a_public1",
291 defaults: ["bionic_testlib_defaults"],
292 srcs: ["libnstest_ns_a_public1.cpp"],
293 relative_install_path: "bionic-loader-test-libs/ns_a",
294 shared_libs: [
295 "libnstest_ns_a_public1_internal",
296 "libnstest_ns_b_public3",
297 ],
298}
299
300cc_test_library {
301 name: "libnstest_ns_a_public1_internal",
302 defaults: ["bionic_testlib_defaults"],
303 srcs: ["libnstest_ns_a_public1_internal.cpp"],
304 relative_install_path: "bionic-loader-test-libs/ns_a",
305}
306
307cc_test_library {
308 name: "libnstest_ns_b_public2",
309 defaults: ["bionic_testlib_defaults"],
310 srcs: ["libnstest_ns_b_public2.cpp"],
311 relative_install_path: "bionic-loader-test-libs/ns_b",
312 shared_libs: ["libnstest_ns_a_public1"],
313}
314
315cc_test_library {
316 name: "libnstest_ns_b_public3",
317 defaults: ["bionic_testlib_defaults"],
318 srcs: ["libnstest_ns_b_public3.cpp"],
319 relative_install_path: "bionic-loader-test-libs/ns_b",
320}
321
322// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -0700323// Build DT_RUNPATH test helper libraries
324// -----------------------------------------------------------------------------
325// include $(LOCAL_PATH)/Android.build.dt_runpath.mk
326
327// -----------------------------------------------------------------------------
328// Build library with two parents
329// -----------------------------------------------------------------------------
330// include $(LOCAL_PATH)/Android.build.dlopen_2_parents_reloc.mk
331
332// -----------------------------------------------------------------------------
333// Build libtest_check_order_dlsym.so with its dependencies.
334// -----------------------------------------------------------------------------
335// include $(LOCAL_PATH)/Android.build.dlopen_check_order_dlsym.mk
336
337// -----------------------------------------------------------------------------
338// Build libtest_check_order_siblings.so with its dependencies.
339// -----------------------------------------------------------------------------
340// include $(LOCAL_PATH)/Android.build.dlopen_check_order_reloc_siblings.mk
341
342// -----------------------------------------------------------------------------
343// Build libtest_check_order_root.so with its dependencies.
344// -----------------------------------------------------------------------------
345// include $(LOCAL_PATH)/Android.build.dlopen_check_order_reloc_main_executable.mk
346
347// -----------------------------------------------------------------------------
348// Build libtest_versioned_lib.so with its dependencies.
349// -----------------------------------------------------------------------------
350// include $(LOCAL_PATH)/Android.build.versioned_lib.mk
351
352// -----------------------------------------------------------------------------
353// Build libraries needed by pthread_atfork tests
354// -----------------------------------------------------------------------------
355// include $(LOCAL_PATH)/Android.build.pthread_atfork.mk
356
357// -----------------------------------------------------------------------------
358// Library with dependency loop used by dlfcn tests
359//
360// libtest_with_dependency_loop -> a -> b -> c -> a
361// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700362cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700363 name: "libtest_with_dependency_loop",
364 defaults: ["bionic_testlib_defaults"],
365 srcs: ["dlopen_testlib_loopy_root.cpp"],
366 shared_libs: ["libtest_with_dependency_loop_a"],
367}
368
369// -----------------------------------------------------------------------------
370// libtest_with_dependency_loop_a.so
371// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700372cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700373 name: "libtest_with_dependency_loop_a",
374 defaults: ["bionic_testlib_defaults"],
375 srcs: ["dlopen_testlib_loopy_a.cpp"],
376 shared_libs: ["libtest_with_dependency_loop_b_tmp"],
377}
378
379// -----------------------------------------------------------------------------
380// libtest_with_dependency_loop_b.so
381//
382// this is temporary placeholder - will be removed
383// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700384cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700385 name: "libtest_with_dependency_loop_b_tmp",
386 defaults: ["bionic_testlib_defaults"],
387 srcs: ["dlopen_testlib_loopy_invalid.cpp"],
388 ldflags: ["-Wl,-soname=libtest_with_dependency_loop_b.so"],
389}
390
391// -----------------------------------------------------------------------------
392// libtest_with_dependency_loop_b.so
393// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700394cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700395 name: "libtest_with_dependency_loop_b",
396 defaults: ["bionic_testlib_defaults"],
397 srcs: ["dlopen_testlib_loopy_b.cpp"],
398 shared_libs: ["libtest_with_dependency_loop_c"],
399}
400
401// -----------------------------------------------------------------------------
402// libtest_with_dependency_loop_c.so
403// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700404cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700405 name: "libtest_with_dependency_loop_c",
406 defaults: ["bionic_testlib_defaults"],
407 srcs: ["dlopen_testlib_loopy_c.cpp"],
408 shared_libs: ["libtest_with_dependency_loop_a"],
409}
410
411// -----------------------------------------------------------------------------
412// libtest_relo_check_dt_needed_order.so
413// |
414// +-> libtest_relo_check_dt_needed_order_1.so
415// |
416// +-> libtest_relo_check_dt_needed_order_2.so
417// -----------------------------------------------------------------------------
418
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700419cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700420 name: "libtest_relo_check_dt_needed_order",
421 defaults: ["bionic_testlib_defaults"],
422 srcs: ["dlopen_testlib_relo_check_dt_needed_order.cpp"],
423 shared_libs: [
424 "libtest_relo_check_dt_needed_order_1",
425 "libtest_relo_check_dt_needed_order_2",
426 ],
427}
428
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700429cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700430 name: "libtest_relo_check_dt_needed_order_1",
431 defaults: ["bionic_testlib_defaults"],
432 srcs: ["dlopen_testlib_relo_check_dt_needed_order_1.cpp"],
433}
434
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700435cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700436 name: "libtest_relo_check_dt_needed_order_2",
437 defaults: ["bionic_testlib_defaults"],
438 srcs: ["dlopen_testlib_relo_check_dt_needed_order_2.cpp"],
439}
440
441// -----------------------------------------------------------------------------
442// Library with dependency used by dlfcn tests
443// -----------------------------------------------------------------------------
444// In Android.mk to support dependency on libdlext_test
445
446// -----------------------------------------------------------------------------
447// Library used by ifunc tests
448// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700449cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700450 name: "libtest_ifunc",
451 defaults: ["bionic_testlib_defaults"],
Dimitry Ivanov21975b22017-05-02 16:31:56 -0700452 srcs: ["dlopen_testlib_ifunc.cpp"],
Colin Cross2722ebb2016-07-11 16:20:06 -0700453
Colin Cross2722ebb2016-07-11 16:20:06 -0700454 arch: {
455 mips: {
456 enabled: false,
457 },
458 mips64: {
459 enabled: false,
460 },
461 },
Dimitry Ivanov21975b22017-05-02 16:31:56 -0700462}
463
464cc_test_library {
465 name: "libtest_ifunc_variable",
466 defaults: ["bionic_testlib_defaults"],
467 srcs: ["dlopen_testlib_ifunc_variable.cpp"],
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800468 shared_libs: ["libtest_ifunc_variable_impl"],
Dimitry Ivanov21975b22017-05-02 16:31:56 -0700469
470 arch: {
471 mips: {
472 enabled: false,
473 },
474 mips64: {
475 enabled: false,
476 },
477 },
Dimitry Ivanov21975b22017-05-02 16:31:56 -0700478}
479
480cc_test_library {
481 name: "libtest_ifunc_variable_impl",
482 defaults: ["bionic_testlib_defaults"],
483 srcs: ["dlopen_testlib_ifunc_variable_impl.cpp"],
484
485 arch: {
486 mips: {
487 enabled: false,
488 },
489 mips64: {
490 enabled: false,
491 },
492 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700493}
494
495// -----------------------------------------------------------------------------
496// Library used by atexit tests
497// -----------------------------------------------------------------------------
498
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700499cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700500 name: "libtest_atexit",
501 defaults: ["bionic_testlib_defaults"],
502 srcs: ["atexit_testlib.cpp"],
503}
504
505// -----------------------------------------------------------------------------
506// This library is used by dl_load test to check symbol preempting
507// by main executable
508// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700509cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700510 name: "libdl_preempt_test_1",
511 defaults: ["bionic_testlib_defaults"],
512 srcs: ["dl_preempt_library_1.cpp"],
513}
514
515// -----------------------------------------------------------------------------
516// This library is used by dl_load test to check symbol preempting
517// by libdl_preempt_test_1.so
518// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700519cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700520 name: "libdl_preempt_test_2",
521 defaults: ["bionic_testlib_defaults"],
522 srcs: ["dl_preempt_library_2.cpp"],
523}
524
525// -----------------------------------------------------------------------------
526// Library with DF_1_GLOBAL
527// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700528cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700529 name: "libdl_test_df_1_global",
530 defaults: ["bionic_testlib_defaults"],
531 srcs: ["dl_df_1_global.cpp"],
532 ldflags: ["-Wl,-z,global"],
533
534 target: {
535 host: {
536 // TODO (dimitry): host ld.gold does not yet support -z global
537 // remove this line once it is updated.
538 ldflags: ["-fuse-ld=bfd"],
539 },
540 },
541}
542
543// -----------------------------------------------------------------------------
544// Library using symbol from libdl_test_df_1_global
545// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700546cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700547 name: "libtest_dlsym_df_1_global",
548 defaults: ["bionic_testlib_defaults"],
549 srcs: ["dl_df_1_use_global.cpp"],
550}
551
552// -----------------------------------------------------------------------------
Jiyong Park01162f22017-10-16 15:31:09 +0900553// Library with DF_1_GLOBAL which will be dlopened
554// (note: libdl_test_df_1_global above will be included in DT_NEEDED)
555// -----------------------------------------------------------------------------
556cc_test_library {
557 name: "libtest_dlopen_df_1_global",
558 defaults: ["bionic_testlib_defaults"],
559 srcs: ["dl_df_1_global_dummy.cpp"],
560 ldflags: ["-Wl,-z,global"],
561
562 target: {
563 host: {
564 // TODO (dimitry): host ld.gold does not yet support -z global
565 // remove this line once it is updated.
566 ldflags: ["-fuse-ld=bfd"],
567 },
568 },
569}
570
Jiyong Park01162f22017-10-16 15:31:09 +0900571// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -0700572// Library with weak function
573// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700574cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700575 name: "libtest_dlsym_weak_func",
576 defaults: ["bionic_testlib_defaults"],
577 srcs: ["dlsym_weak_function.cpp"],
578}
579
580// -----------------------------------------------------------------------------
581// Library to check RTLD_LOCAL with dlsym in 'this'
582// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700583cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700584 name: "libtest_dlsym_from_this",
585 defaults: ["bionic_testlib_defaults"],
586 srcs: ["dlsym_from_this_symbol.cpp"],
587 shared_libs: ["libtest_dlsym_from_this_child"],
Colin Cross2722ebb2016-07-11 16:20:06 -0700588}
589
590// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700591cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700592 name: "libtest_dlsym_from_this_child",
593 defaults: ["bionic_testlib_defaults"],
594 srcs: ["dlsym_from_this_functions.cpp"],
595 shared_libs: ["libtest_dlsym_from_this_grandchild"],
596}
597
598// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700599cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700600 name: "libtest_dlsym_from_this_grandchild",
601 defaults: ["bionic_testlib_defaults"],
602 srcs: ["dlsym_from_this_symbol2.cpp"],
603}
604
605// -----------------------------------------------------------------------------
606// Empty library
607// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700608cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700609 name: "libtest_empty",
610 defaults: ["bionic_testlib_defaults"],
611 srcs: ["empty.cpp"],
612}
613
614// -----------------------------------------------------------------------------
dimitry8db36a52017-10-23 15:10:10 +0200615// Library for inaccessible shared library test
616// -----------------------------------------------------------------------------
617cc_test_library {
618 name: "libtestshared",
619 defaults: ["bionic_testlib_defaults"],
620 srcs: ["empty.cpp"],
Nan Zhangdab0fd52017-11-07 11:05:24 -0800621 relative_install_path: "bionic-loader-test-libs/inaccessible_libs",
dimitry8db36a52017-10-23 15:10:10 +0200622}
623
624// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -0700625// Library with weak undefined function
626// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700627cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700628 name: "libtest_dlopen_weak_undefined_func",
629 defaults: ["bionic_testlib_defaults"],
630 srcs: ["dlopen_weak_undefined.cpp"],
631}
632
633// -----------------------------------------------------------------------------
Dimitry Ivanovd0b5c3a2016-11-25 12:23:11 -0800634// Check that RTLD_NEXT of a libc symbol works in dlopened library
635// -----------------------------------------------------------------------------
636cc_test_library {
637 name: "libtest_check_rtld_next_from_library",
638 defaults: ["bionic_testlib_defaults"],
639 srcs: ["check_rtld_next_from_library.cpp"],
Dimitry Ivanovd0b5c3a2016-11-25 12:23:11 -0800640}
641
642// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -0700643// Library with constructor that calls dlopen() b/7941716
644// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700645cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700646 name: "libtest_dlopen_from_ctor",
647 defaults: ["bionic_testlib_defaults"],
648 srcs: ["dlopen_testlib_dlopen_from_ctor.cpp"],
Colin Cross2722ebb2016-07-11 16:20:06 -0700649}
650
651// -----------------------------------------------------------------------------
Dimitry Ivanovec90e242017-02-10 11:04:20 -0800652// Libraries used to check init/fini call order
Dimitry Ivanovea8f3962017-02-09 13:31:57 -0800653// -----------------------------------------------------------------------------
654cc_test_library {
655 name: "libtest_init_fini_order_root",
656 defaults: ["bionic_testlib_defaults"],
657 srcs: ["dlopen_check_init_fini_root.cpp"],
Dimitry Ivanovec90e242017-02-10 11:04:20 -0800658 shared_libs: [
659 "libtest_init_fini_order_child",
660 "libtest_init_fini_order_grand_child",
661 ],
662}
663
664cc_test_library {
665 name: "libtest_init_fini_order_root2",
666 defaults: ["bionic_testlib_defaults"],
667 srcs: ["dlopen_check_init_fini_root.cpp"],
668 shared_libs: [
669 "libtest_init_fini_order_grand_child",
670 "libtest_init_fini_order_child",
671 ],
Dimitry Ivanovea8f3962017-02-09 13:31:57 -0800672}
673
674cc_test_library {
675 name: "libtest_init_fini_order_child",
676 defaults: ["bionic_testlib_defaults"],
677 srcs: ["dlopen_check_init_fini_child.cpp"],
678 shared_libs: ["libtest_init_fini_order_grand_child"],
679}
680
681cc_test_library {
682 name: "libtest_init_fini_order_grand_child",
683 defaults: ["bionic_testlib_defaults"],
684 srcs: ["dlopen_check_init_fini_grand_child.cpp"],
685}
686
687// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -0700688// Library that depends on the library with constructor that calls dlopen() b/7941716
689// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700690cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700691 name: "libtest_dlopen_from_ctor_main",
692 defaults: ["bionic_testlib_defaults"],
693 srcs: ["empty.cpp"],
694 shared_libs: ["libtest_dlopen_from_ctor"],
695}
696
697// -----------------------------------------------------------------------------
dimitry06016f22018-01-05 11:39:28 +0100698// Library with non-trivial thread_local variable to test dlclose()
699// -----------------------------------------------------------------------------
700cc_test_library {
701 name: "libtest_thread_local_dtor",
702 defaults: ["bionic_testlib_defaults"],
703 srcs: ["thread_local_dtor.cpp"],
704}
705
dimitry06016f22018-01-05 11:39:28 +0100706// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -0700707// Tool to use to align the shared libraries in a zip file.
708// -----------------------------------------------------------------------------
709cc_binary_host {
710 name: "bionic_tests_zipalign",
711 srcs: ["bionic_tests_zipalign.cpp"],
712 cflags: [
713 "-Wall",
714 "-Werror",
715 ],
716
717 static_libs: [
718 "libziparchive",
719 "liblog",
720 "libbase",
721 "libz",
722 "libutils",
723 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700724}
Evgenii Stepanov0a3637d2016-07-06 13:20:59 -0700725
726cc_test_library {
727 name: "libcfi-test",
728 defaults: ["bionic_testlib_defaults"],
729 srcs: ["cfi_test_lib.cpp"],
730 sanitize: {
731 cfi: false,
732 },
733}
734
735cc_test_library {
736 name: "libcfi-test-bad",
737 defaults: ["bionic_testlib_defaults"],
738 srcs: ["cfi_test_bad_lib.cpp"],
739 sanitize: {
740 cfi: false,
741 },
742}
Evgenii Stepanov68ecec12017-01-31 13:19:30 -0800743
744cc_test {
745 name: "cfi_test_helper",
746 host_supported: false,
747 defaults: ["bionic_testlib_defaults"],
748 srcs: ["cfi_test_helper.cpp"],
749 ldflags: ["-rdynamic"],
750}
751
752cc_test {
753 name: "cfi_test_helper2",
754 host_supported: false,
755 defaults: ["bionic_testlib_defaults"],
756 srcs: ["cfi_test_helper2.cpp"],
757 shared_libs: ["libcfi-test"],
758 ldflags: ["-Wl,--rpath,${ORIGIN}/.."],
759}
Elliott Hugheseb04ed52017-03-29 13:48:02 -0700760
761cc_test {
762 name: "preinit_getauxval_test_helper",
763 host_supported: false,
764 defaults: ["bionic_testlib_defaults"],
765 srcs: ["preinit_getauxval_test_helper.cpp"],
766}
767
768cc_test {
769 name: "preinit_syscall_test_helper",
770 host_supported: false,
771 defaults: ["bionic_testlib_defaults"],
772 srcs: ["preinit_syscall_test_helper.cpp"],
773}
Jiyong Park02586a22017-05-20 01:01:24 +0900774
775cc_test {
776 name: "ld_preload_test_helper",
777 host_supported: false,
778 defaults: ["bionic_testlib_defaults"],
779 srcs: ["ld_preload_test_helper.cpp"],
780 shared_libs: ["ld_preload_test_helper_lib1"],
781 ldflags: ["-Wl,--rpath,${ORIGIN}/.."],
782}
783
784cc_test_library {
785 name: "ld_preload_test_helper_lib1",
786 host_supported: false,
787 defaults: ["bionic_testlib_defaults"],
788 srcs: ["ld_preload_test_helper_lib1.cpp"],
789}
790
791cc_test_library {
792 name: "ld_preload_test_helper_lib2",
793 host_supported: false,
794 defaults: ["bionic_testlib_defaults"],
795 srcs: ["ld_preload_test_helper_lib2.cpp"],
796}
797
798cc_test {
799 name: "ld_config_test_helper",
800 host_supported: false,
801 defaults: ["bionic_testlib_defaults"],
802 srcs: ["ld_config_test_helper.cpp"],
803 shared_libs: ["ld_config_test_helper_lib1"],
804 ldflags: ["-Wl,--rpath,${ORIGIN}/.."],
805}
806
807cc_test_library {
808 name: "ld_config_test_helper_lib1",
809 host_supported: false,
810 defaults: ["bionic_testlib_defaults"],
811 srcs: ["ld_config_test_helper_lib1.cpp"],
812 shared_libs: ["ld_config_test_helper_lib2"],
Nan Zhangdab0fd52017-11-07 11:05:24 -0800813 relative_install_path: "bionic-loader-test-libs/ns2",
Jiyong Park02586a22017-05-20 01:01:24 +0900814}
815
816cc_test_library {
817 name: "ld_config_test_helper_lib2",
818 host_supported: false,
819 defaults: ["bionic_testlib_defaults"],
820 srcs: ["ld_config_test_helper_lib2.cpp"],
Nan Zhangdab0fd52017-11-07 11:05:24 -0800821 relative_install_path: "bionic-loader-test-libs/ns2",
Jiyong Park02586a22017-05-20 01:01:24 +0900822}
823
824cc_test_library {
825 name: "ld_config_test_helper_lib3",
826 host_supported: false,
827 defaults: ["bionic_testlib_defaults"],
828 srcs: ["ld_config_test_helper_lib3.cpp"],
829}