• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1//
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,
20    ldflags: [
21        "-Wl,--rpath,${ORIGIN}",
22        "-Wl,--enable-new-dtags",
23    ],
24    relative_install_path: "bionic-loader-test-libs",
25    gtest: false,
26    sanitize: {
27        address: false,
28        coverage: false,
29    },
30    stl: "libc++_static",
31    target: {
32        darwin: {
33            enabled: false,
34        },
35    },
36}
37
38// -----------------------------------------------------------------------------
39// Library to test gnu-styled hash
40// -----------------------------------------------------------------------------
41cc_test_library {
42    name: "libgnu-hash-table-library",
43    defaults: ["bionic_testlib_defaults"],
44    srcs: ["dlext_test_library.cpp"],
45    ldflags: ["-Wl,--hash-style=gnu"],
46    arch: {
47        mips: {
48            enabled: false,
49        },
50        mips64: {
51            enabled: false,
52        },
53    },
54}
55
56// -----------------------------------------------------------------------------
57// Library to test sysv-styled hash
58// -----------------------------------------------------------------------------
59cc_test_library {
60    name: "libsysv-hash-table-library",
61    defaults: ["bionic_testlib_defaults"],
62    srcs: ["dlext_test_library.cpp"],
63    ldflags: ["-Wl,--hash-style=sysv"],
64}
65
66// -----------------------------------------------------------------------------
67// Library used by dlext tests - with GNU RELRO program header
68// -----------------------------------------------------------------------------
69// In Android.mk to support creating symlinks
70
71// -----------------------------------------------------------------------------
72// Library used by dlext tests - without GNU RELRO program header
73// -----------------------------------------------------------------------------
74cc_test_library {
75    name: "libdlext_test_norelro",
76    defaults: ["bionic_testlib_defaults"],
77    srcs: ["dlext_test_library.cpp"],
78    ldflags: ["-Wl,-z,norelro"],
79    shared_libs = ["libtest_simple"],
80}
81
82// -----------------------------------------------------------------------------
83// Library used by dlext tests - different name non-default location
84// -----------------------------------------------------------------------------
85// In Android.mk to support installing to /data
86
87// -----------------------------------------------------------------------------
88// Libraries used by dlext tests for open from a zip-file
89// -----------------------------------------------------------------------------
90// In Android.mk to support installing to /data
91
92// ----------------------------------------------------------------------------
93// Library with soname which does not match filename
94// ----------------------------------------------------------------------------
95// In Android.mk to support zipped and aligned tests
96
97// -----------------------------------------------------------------------------
98// Library used by dlext tests - zipped and aligned
99// -----------------------------------------------------------------------------
100// In Android.mk to support zipped and aligned tests
101
102// -----------------------------------------------------------------------------
103// Library used by dlfcn tests
104// -----------------------------------------------------------------------------
105cc_test_library {
106    name: "libtest_simple",
107    defaults: ["bionic_testlib_defaults"],
108    srcs: ["dlopen_testlib_simple.cpp"],
109}
110
111// -----------------------------------------------------------------------------
112// Library used by dlfcn nodelete tests
113// -----------------------------------------------------------------------------
114cc_test_library {
115    name: "libtest_nodelete_1",
116    defaults: ["bionic_testlib_defaults"],
117    srcs: ["dlopen_nodelete_1.cpp"],
118}
119
120// -----------------------------------------------------------------------------
121// Library used by dlfcn nodelete tests
122// -----------------------------------------------------------------------------
123cc_test_library {
124    name: "libtest_nodelete_2",
125    defaults: ["bionic_testlib_defaults"],
126    srcs: ["dlopen_nodelete_2.cpp"],
127}
128
129// -----------------------------------------------------------------------------
130// Library used by dlfcn nodelete tests
131// -----------------------------------------------------------------------------
132cc_test_library {
133    name: "libtest_nodelete_dt_flags_1",
134    defaults: ["bionic_testlib_defaults"],
135    srcs: ["dlopen_nodelete_dt_flags_1.cpp"],
136    ldflags: ["-Wl,-z,nodelete"],
137}
138
139// -----------------------------------------------------------------------------
140// Build test helper libraries for linker namespaces
141// -----------------------------------------------------------------------------
142// include $(LOCAL_PATH)/Android.build.linker_namespaces.mk
143
144// -----------------------------------------------------------------------------
145// Build DT_RUNPATH test helper libraries
146// -----------------------------------------------------------------------------
147// include $(LOCAL_PATH)/Android.build.dt_runpath.mk
148
149// -----------------------------------------------------------------------------
150// Build library with two parents
151// -----------------------------------------------------------------------------
152// include $(LOCAL_PATH)/Android.build.dlopen_2_parents_reloc.mk
153
154// -----------------------------------------------------------------------------
155// Build libtest_check_order_dlsym.so with its dependencies.
156// -----------------------------------------------------------------------------
157// include $(LOCAL_PATH)/Android.build.dlopen_check_order_dlsym.mk
158
159// -----------------------------------------------------------------------------
160// Build libtest_check_order_siblings.so with its dependencies.
161// -----------------------------------------------------------------------------
162// include $(LOCAL_PATH)/Android.build.dlopen_check_order_reloc_siblings.mk
163
164// -----------------------------------------------------------------------------
165// Build libtest_check_order_root.so with its dependencies.
166// -----------------------------------------------------------------------------
167// include $(LOCAL_PATH)/Android.build.dlopen_check_order_reloc_main_executable.mk
168
169// -----------------------------------------------------------------------------
170// Build libtest_versioned_lib.so with its dependencies.
171// -----------------------------------------------------------------------------
172// include $(LOCAL_PATH)/Android.build.versioned_lib.mk
173
174// -----------------------------------------------------------------------------
175// Build libraries needed by pthread_atfork tests
176// -----------------------------------------------------------------------------
177// include $(LOCAL_PATH)/Android.build.pthread_atfork.mk
178
179// -----------------------------------------------------------------------------
180// Library with dependency loop used by dlfcn tests
181//
182// libtest_with_dependency_loop -> a -> b -> c -> a
183// -----------------------------------------------------------------------------
184cc_test_library {
185    name: "libtest_with_dependency_loop",
186    defaults: ["bionic_testlib_defaults"],
187    srcs: ["dlopen_testlib_loopy_root.cpp"],
188    shared_libs: ["libtest_with_dependency_loop_a"],
189}
190
191// -----------------------------------------------------------------------------
192// libtest_with_dependency_loop_a.so
193// -----------------------------------------------------------------------------
194cc_test_library {
195    name: "libtest_with_dependency_loop_a",
196    defaults: ["bionic_testlib_defaults"],
197    srcs: ["dlopen_testlib_loopy_a.cpp"],
198    shared_libs: ["libtest_with_dependency_loop_b_tmp"],
199}
200
201// -----------------------------------------------------------------------------
202// libtest_with_dependency_loop_b.so
203//
204// this is temporary placeholder - will be removed
205// -----------------------------------------------------------------------------
206cc_test_library {
207    name: "libtest_with_dependency_loop_b_tmp",
208    defaults: ["bionic_testlib_defaults"],
209    srcs: ["dlopen_testlib_loopy_invalid.cpp"],
210    ldflags: ["-Wl,-soname=libtest_with_dependency_loop_b.so"],
211}
212
213// -----------------------------------------------------------------------------
214// libtest_with_dependency_loop_b.so
215// -----------------------------------------------------------------------------
216cc_test_library {
217    name: "libtest_with_dependency_loop_b",
218    defaults: ["bionic_testlib_defaults"],
219    srcs: ["dlopen_testlib_loopy_b.cpp"],
220    shared_libs: ["libtest_with_dependency_loop_c"],
221}
222
223// -----------------------------------------------------------------------------
224// libtest_with_dependency_loop_c.so
225// -----------------------------------------------------------------------------
226cc_test_library {
227    name: "libtest_with_dependency_loop_c",
228    defaults: ["bionic_testlib_defaults"],
229    srcs: ["dlopen_testlib_loopy_c.cpp"],
230    shared_libs: ["libtest_with_dependency_loop_a"],
231}
232
233// -----------------------------------------------------------------------------
234// libtest_relo_check_dt_needed_order.so
235// |
236// +-> libtest_relo_check_dt_needed_order_1.so
237// |
238// +-> libtest_relo_check_dt_needed_order_2.so
239// -----------------------------------------------------------------------------
240
241
242cc_test_library {
243    name: "libtest_relo_check_dt_needed_order",
244    defaults: ["bionic_testlib_defaults"],
245    srcs: ["dlopen_testlib_relo_check_dt_needed_order.cpp"],
246    shared_libs: [
247        "libtest_relo_check_dt_needed_order_1",
248        "libtest_relo_check_dt_needed_order_2",
249    ],
250}
251
252cc_test_library {
253    name: "libtest_relo_check_dt_needed_order_1",
254    defaults: ["bionic_testlib_defaults"],
255    srcs: ["dlopen_testlib_relo_check_dt_needed_order_1.cpp"],
256}
257
258cc_test_library {
259    name: "libtest_relo_check_dt_needed_order_2",
260    defaults: ["bionic_testlib_defaults"],
261    srcs: ["dlopen_testlib_relo_check_dt_needed_order_2.cpp"],
262}
263
264// -----------------------------------------------------------------------------
265// Library with dependency used by dlfcn tests
266// -----------------------------------------------------------------------------
267// In Android.mk to support dependency on libdlext_test
268
269// -----------------------------------------------------------------------------
270// Library used by ifunc tests
271// -----------------------------------------------------------------------------
272cc_test_library {
273    name: "libtest_ifunc",
274    defaults: ["bionic_testlib_defaults"],
275    srcs: ["dlopen_testlib_ifunc.c"],
276
277    // TODO(dimitry): clang does not support ifunc attribute
278    clang: false,
279    arch: {
280        mips: {
281            enabled: false,
282        },
283        mips64: {
284            enabled: false,
285        },
286    },
287}
288
289// -----------------------------------------------------------------------------
290// Library used by atexit tests
291// -----------------------------------------------------------------------------
292
293cc_test_library {
294    name: "libtest_atexit",
295    defaults: ["bionic_testlib_defaults"],
296    srcs: ["atexit_testlib.cpp"],
297}
298
299// -----------------------------------------------------------------------------
300// This library is used by dl_load test to check symbol preempting
301// by main executable
302// -----------------------------------------------------------------------------
303cc_test_library {
304    name: "libdl_preempt_test_1",
305    defaults: ["bionic_testlib_defaults"],
306    srcs: ["dl_preempt_library_1.cpp"],
307}
308
309// -----------------------------------------------------------------------------
310// This library is used by dl_load test to check symbol preempting
311// by libdl_preempt_test_1.so
312// -----------------------------------------------------------------------------
313cc_test_library {
314    name: "libdl_preempt_test_2",
315    defaults: ["bionic_testlib_defaults"],
316    srcs: ["dl_preempt_library_2.cpp"],
317}
318
319// -----------------------------------------------------------------------------
320// Library with DF_1_GLOBAL
321// -----------------------------------------------------------------------------
322cc_test_library {
323    name: "libdl_test_df_1_global",
324    defaults: ["bionic_testlib_defaults"],
325    srcs: ["dl_df_1_global.cpp"],
326    ldflags: ["-Wl,-z,global"],
327
328    target: {
329        host: {
330            // TODO (dimitry): host ld.gold does not yet support -z global
331            // remove this line once it is updated.
332            ldflags: ["-fuse-ld=bfd"],
333        },
334    },
335}
336
337// -----------------------------------------------------------------------------
338// Library using symbol from libdl_test_df_1_global
339// -----------------------------------------------------------------------------
340cc_test_library {
341    name: "libtest_dlsym_df_1_global",
342    defaults: ["bionic_testlib_defaults"],
343    srcs: ["dl_df_1_use_global.cpp"],
344}
345
346// -----------------------------------------------------------------------------
347// Library with weak function
348// -----------------------------------------------------------------------------
349cc_test_library {
350    name: "libtest_dlsym_weak_func",
351    defaults: ["bionic_testlib_defaults"],
352    srcs: ["dlsym_weak_function.cpp"],
353}
354
355// -----------------------------------------------------------------------------
356// Library to check RTLD_LOCAL with dlsym in 'this'
357// -----------------------------------------------------------------------------
358cc_test_library {
359    name: "libtest_dlsym_from_this",
360    defaults: ["bionic_testlib_defaults"],
361    srcs: ["dlsym_from_this_symbol.cpp"],
362    shared_libs: ["libtest_dlsym_from_this_child"],
363
364    target: {
365        android: {
366            shared_libs: ["libdl"],
367        },
368        host: {
369            host_ldlibs: ["-ldl"],
370        },
371    },
372}
373
374// -----------------------------------------------------------------------------
375cc_test_library {
376    name: "libtest_dlsym_from_this_child",
377    defaults: ["bionic_testlib_defaults"],
378    srcs: ["dlsym_from_this_functions.cpp"],
379    shared_libs: ["libtest_dlsym_from_this_grandchild"],
380    target: {
381        android: {
382            shared_libs: ["libdl"],
383        },
384        host: {
385            host_ldlibs: ["-ldl"],
386        },
387    },
388}
389
390// -----------------------------------------------------------------------------
391cc_test_library {
392    name: "libtest_dlsym_from_this_grandchild",
393    defaults: ["bionic_testlib_defaults"],
394    srcs: ["dlsym_from_this_symbol2.cpp"],
395}
396
397// -----------------------------------------------------------------------------
398// Empty library
399// -----------------------------------------------------------------------------
400cc_test_library {
401    name: "libtest_empty",
402    defaults: ["bionic_testlib_defaults"],
403    srcs: ["empty.cpp"],
404}
405
406// -----------------------------------------------------------------------------
407// Library with weak undefined function
408// -----------------------------------------------------------------------------
409cc_test_library {
410    name: "libtest_dlopen_weak_undefined_func",
411    defaults: ["bionic_testlib_defaults"],
412    srcs: ["dlopen_weak_undefined.cpp"],
413}
414
415// -----------------------------------------------------------------------------
416// Check that RTLD_NEXT of a libc symbol works in dlopened library
417// -----------------------------------------------------------------------------
418cc_test_library {
419    name: "libtest_check_rtld_next_from_library",
420    defaults: ["bionic_testlib_defaults"],
421    srcs: ["check_rtld_next_from_library.cpp"],
422
423    target: {
424        android: {
425            shared_libs: ["libdl"],
426        },
427        host: {
428            host_ldlibs: ["-ldl"],
429        },
430    },
431}
432
433// -----------------------------------------------------------------------------
434// Library with constructor that calls dlopen() b/7941716
435// -----------------------------------------------------------------------------
436cc_test_library {
437    name: "libtest_dlopen_from_ctor",
438    defaults: ["bionic_testlib_defaults"],
439    srcs: ["dlopen_testlib_dlopen_from_ctor.cpp"],
440    target: {
441        android: {
442            shared_libs: ["libdl"],
443        },
444        host: {
445            host_ldlibs: ["-ldl"],
446        },
447    },
448}
449
450// -----------------------------------------------------------------------------
451// Libraries used to check init/fini call order
452// -----------------------------------------------------------------------------
453cc_test_library {
454    name: "libtest_init_fini_order_root",
455    defaults: ["bionic_testlib_defaults"],
456    srcs: ["dlopen_check_init_fini_root.cpp"],
457    shared_libs: [
458        "libtest_init_fini_order_child",
459        "libtest_init_fini_order_grand_child",
460    ],
461}
462
463cc_test_library {
464    name: "libtest_init_fini_order_root2",
465    defaults: ["bionic_testlib_defaults"],
466    srcs: ["dlopen_check_init_fini_root.cpp"],
467    shared_libs: [
468        "libtest_init_fini_order_grand_child",
469        "libtest_init_fini_order_child",
470    ],
471}
472
473cc_test_library {
474    name: "libtest_init_fini_order_child",
475    defaults: ["bionic_testlib_defaults"],
476    srcs: ["dlopen_check_init_fini_child.cpp"],
477    shared_libs: ["libtest_init_fini_order_grand_child"],
478}
479
480cc_test_library {
481    name: "libtest_init_fini_order_grand_child",
482    defaults: ["bionic_testlib_defaults"],
483    srcs: ["dlopen_check_init_fini_grand_child.cpp"],
484}
485
486// -----------------------------------------------------------------------------
487// Library that depends on the library with constructor that calls dlopen() b/7941716
488// -----------------------------------------------------------------------------
489cc_test_library {
490    name: "libtest_dlopen_from_ctor_main",
491    defaults: ["bionic_testlib_defaults"],
492    srcs: ["empty.cpp"],
493    shared_libs: ["libtest_dlopen_from_ctor"],
494}
495
496// -----------------------------------------------------------------------------
497// Tool to use to align the shared libraries in a zip file.
498// -----------------------------------------------------------------------------
499cc_binary_host {
500    name: "bionic_tests_zipalign",
501    srcs: ["bionic_tests_zipalign.cpp"],
502    cflags: [
503        "-Wall",
504        "-Werror",
505    ],
506
507    static_libs: [
508        "libziparchive",
509        "liblog",
510        "libbase",
511        "libz",
512        "libutils",
513    ],
514}
515
516cc_test_library {
517    name: "libcfi-test",
518    defaults: ["bionic_testlib_defaults"],
519    srcs: ["cfi_test_lib.cpp"],
520    sanitize: {
521        cfi: false,
522    },
523}
524
525cc_test_library {
526    name: "libcfi-test-bad",
527    defaults: ["bionic_testlib_defaults"],
528    srcs: ["cfi_test_bad_lib.cpp"],
529    sanitize: {
530        cfi: false,
531    },
532}
533
534cc_test {
535    name: "cfi_test_helper",
536    host_supported: false,
537    defaults: ["bionic_testlib_defaults"],
538    srcs: ["cfi_test_helper.cpp"],
539    ldflags: ["-rdynamic"],
540}
541
542cc_test {
543    name: "cfi_test_helper2",
544    host_supported: false,
545    defaults: ["bionic_testlib_defaults"],
546    srcs: ["cfi_test_helper2.cpp"],
547    shared_libs: ["libcfi-test"],
548    ldflags: ["-Wl,--rpath,${ORIGIN}/.."],
549}
550
551cc_test {
552    name: "preinit_getauxval_test_helper",
553    host_supported: false,
554    defaults: ["bionic_testlib_defaults"],
555    srcs: ["preinit_getauxval_test_helper.cpp"],
556}
557
558cc_test {
559    name: "preinit_syscall_test_helper",
560    host_supported: false,
561    defaults: ["bionic_testlib_defaults"],
562    srcs: ["preinit_syscall_test_helper.cpp"],
563}
564