blob: 004f6689cb50494e8df383dea0731fc5ebc914d2 [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,
Dimitry Ivanova36e59b2016-09-01 11:37:39 -070020 ldflags: [
Dimitry Ivanovd11d1e42016-10-05 02:51:17 -070021 "-Wl,--rpath,${ORIGIN}",
Dimitry Ivanova36e59b2016-09-01 11:37:39 -070022 "-Wl,--enable-new-dtags",
23 ],
24 relative_install_path: "bionic-loader-test-libs",
25 gtest: false,
Colin Cross2722ebb2016-07-11 16:20:06 -070026 sanitize: {
27 never: true,
28 },
Yabin Cui1f553ea2017-01-13 12:31:59 -080029 stl: "libc++_static",
Colin Cross2722ebb2016-07-11 16:20:06 -070030 target: {
31 darwin: {
32 enabled: false,
33 },
34 },
35}
36
37// -----------------------------------------------------------------------------
38// Library to test gnu-styled hash
39// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -070040cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -070041 name: "libgnu-hash-table-library",
42 defaults: ["bionic_testlib_defaults"],
43 srcs: ["dlext_test_library.cpp"],
44 ldflags: ["-Wl,--hash-style=gnu"],
45 arch: {
46 mips: {
47 enabled: false,
48 },
49 mips64: {
50 enabled: false,
51 },
52 },
53}
54
55// -----------------------------------------------------------------------------
56// Library to test sysv-styled hash
57// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -070058cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -070059 name: "libsysv-hash-table-library",
60 defaults: ["bionic_testlib_defaults"],
61 srcs: ["dlext_test_library.cpp"],
62 ldflags: ["-Wl,--hash-style=sysv"],
63}
64
65// -----------------------------------------------------------------------------
66// Library used by dlext tests - with GNU RELRO program header
67// -----------------------------------------------------------------------------
68// In Android.mk to support creating symlinks
69
70// -----------------------------------------------------------------------------
71// Library used by dlext tests - without GNU RELRO program header
72// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -070073cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -070074 name: "libdlext_test_norelro",
Dimitry Ivanova36e59b2016-09-01 11:37:39 -070075 defaults: ["bionic_testlib_defaults"],
Colin Cross2722ebb2016-07-11 16:20:06 -070076 srcs: ["dlext_test_library.cpp"],
77 ldflags: ["-Wl,-z,norelro"],
78 shared_libs = ["libtest_simple"],
79}
80
81// -----------------------------------------------------------------------------
82// Library used by dlext tests - different name non-default location
83// -----------------------------------------------------------------------------
84// In Android.mk to support installing to /data
85
86// -----------------------------------------------------------------------------
87// Libraries used by dlext tests for open from a zip-file
88// -----------------------------------------------------------------------------
89// In Android.mk to support installing to /data
90
91// ----------------------------------------------------------------------------
92// Library with soname which does not match filename
93// ----------------------------------------------------------------------------
94// In Android.mk to support zipped and aligned tests
95
96// -----------------------------------------------------------------------------
97// Library used by dlext tests - zipped and aligned
98// -----------------------------------------------------------------------------
99// In Android.mk to support zipped and aligned tests
100
101// -----------------------------------------------------------------------------
102// Library used by dlfcn tests
103// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700104cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700105 name: "libtest_simple",
106 defaults: ["bionic_testlib_defaults"],
107 srcs: ["dlopen_testlib_simple.cpp"],
108}
109
110// -----------------------------------------------------------------------------
111// Library used by dlfcn nodelete tests
112// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700113cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700114 name: "libtest_nodelete_1",
115 defaults: ["bionic_testlib_defaults"],
116 srcs: ["dlopen_nodelete_1.cpp"],
117}
118
119// -----------------------------------------------------------------------------
120// Library used by dlfcn nodelete tests
121// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700122cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700123 name: "libtest_nodelete_2",
124 defaults: ["bionic_testlib_defaults"],
125 srcs: ["dlopen_nodelete_2.cpp"],
126}
127
128// -----------------------------------------------------------------------------
129// Library used by dlfcn nodelete tests
130// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700131cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700132 name: "libtest_nodelete_dt_flags_1",
133 defaults: ["bionic_testlib_defaults"],
134 srcs: ["dlopen_nodelete_dt_flags_1.cpp"],
135 ldflags: ["-Wl,-z,nodelete"],
136}
137
138// -----------------------------------------------------------------------------
139// Build test helper libraries for linker namespaces
140// -----------------------------------------------------------------------------
141// include $(LOCAL_PATH)/Android.build.linker_namespaces.mk
142
143// -----------------------------------------------------------------------------
144// Build DT_RUNPATH test helper libraries
145// -----------------------------------------------------------------------------
146// include $(LOCAL_PATH)/Android.build.dt_runpath.mk
147
148// -----------------------------------------------------------------------------
149// Build library with two parents
150// -----------------------------------------------------------------------------
151// include $(LOCAL_PATH)/Android.build.dlopen_2_parents_reloc.mk
152
153// -----------------------------------------------------------------------------
154// Build libtest_check_order_dlsym.so with its dependencies.
155// -----------------------------------------------------------------------------
156// include $(LOCAL_PATH)/Android.build.dlopen_check_order_dlsym.mk
157
158// -----------------------------------------------------------------------------
159// Build libtest_check_order_siblings.so with its dependencies.
160// -----------------------------------------------------------------------------
161// include $(LOCAL_PATH)/Android.build.dlopen_check_order_reloc_siblings.mk
162
163// -----------------------------------------------------------------------------
164// Build libtest_check_order_root.so with its dependencies.
165// -----------------------------------------------------------------------------
166// include $(LOCAL_PATH)/Android.build.dlopen_check_order_reloc_main_executable.mk
167
168// -----------------------------------------------------------------------------
169// Build libtest_versioned_lib.so with its dependencies.
170// -----------------------------------------------------------------------------
171// include $(LOCAL_PATH)/Android.build.versioned_lib.mk
172
173// -----------------------------------------------------------------------------
174// Build libraries needed by pthread_atfork tests
175// -----------------------------------------------------------------------------
176// include $(LOCAL_PATH)/Android.build.pthread_atfork.mk
177
178// -----------------------------------------------------------------------------
179// Library with dependency loop used by dlfcn tests
180//
181// libtest_with_dependency_loop -> a -> b -> c -> a
182// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700183cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700184 name: "libtest_with_dependency_loop",
185 defaults: ["bionic_testlib_defaults"],
186 srcs: ["dlopen_testlib_loopy_root.cpp"],
187 shared_libs: ["libtest_with_dependency_loop_a"],
188}
189
190// -----------------------------------------------------------------------------
191// libtest_with_dependency_loop_a.so
192// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700193cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700194 name: "libtest_with_dependency_loop_a",
195 defaults: ["bionic_testlib_defaults"],
196 srcs: ["dlopen_testlib_loopy_a.cpp"],
197 shared_libs: ["libtest_with_dependency_loop_b_tmp"],
198}
199
200// -----------------------------------------------------------------------------
201// libtest_with_dependency_loop_b.so
202//
203// this is temporary placeholder - will be removed
204// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700205cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700206 name: "libtest_with_dependency_loop_b_tmp",
207 defaults: ["bionic_testlib_defaults"],
208 srcs: ["dlopen_testlib_loopy_invalid.cpp"],
209 ldflags: ["-Wl,-soname=libtest_with_dependency_loop_b.so"],
210}
211
212// -----------------------------------------------------------------------------
213// libtest_with_dependency_loop_b.so
214// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700215cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700216 name: "libtest_with_dependency_loop_b",
217 defaults: ["bionic_testlib_defaults"],
218 srcs: ["dlopen_testlib_loopy_b.cpp"],
219 shared_libs: ["libtest_with_dependency_loop_c"],
220}
221
222// -----------------------------------------------------------------------------
223// libtest_with_dependency_loop_c.so
224// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700225cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700226 name: "libtest_with_dependency_loop_c",
227 defaults: ["bionic_testlib_defaults"],
228 srcs: ["dlopen_testlib_loopy_c.cpp"],
229 shared_libs: ["libtest_with_dependency_loop_a"],
230}
231
232// -----------------------------------------------------------------------------
233// libtest_relo_check_dt_needed_order.so
234// |
235// +-> libtest_relo_check_dt_needed_order_1.so
236// |
237// +-> libtest_relo_check_dt_needed_order_2.so
238// -----------------------------------------------------------------------------
239
240
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700241cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700242 name: "libtest_relo_check_dt_needed_order",
243 defaults: ["bionic_testlib_defaults"],
244 srcs: ["dlopen_testlib_relo_check_dt_needed_order.cpp"],
245 shared_libs: [
246 "libtest_relo_check_dt_needed_order_1",
247 "libtest_relo_check_dt_needed_order_2",
248 ],
249}
250
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700251cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700252 name: "libtest_relo_check_dt_needed_order_1",
253 defaults: ["bionic_testlib_defaults"],
254 srcs: ["dlopen_testlib_relo_check_dt_needed_order_1.cpp"],
255}
256
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700257cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700258 name: "libtest_relo_check_dt_needed_order_2",
259 defaults: ["bionic_testlib_defaults"],
260 srcs: ["dlopen_testlib_relo_check_dt_needed_order_2.cpp"],
261}
262
263// -----------------------------------------------------------------------------
264// Library with dependency used by dlfcn tests
265// -----------------------------------------------------------------------------
266// In Android.mk to support dependency on libdlext_test
267
268// -----------------------------------------------------------------------------
269// Library used by ifunc tests
270// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700271cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700272 name: "libtest_ifunc",
273 defaults: ["bionic_testlib_defaults"],
274 srcs: ["dlopen_testlib_ifunc.c"],
275
276 // TODO(dimitry): clang does not support ifunc attribute
277 clang: false,
278 arch: {
279 mips: {
280 enabled: false,
281 },
282 mips64: {
283 enabled: false,
284 },
285 },
286}
287
288// -----------------------------------------------------------------------------
289// Library used by atexit tests
290// -----------------------------------------------------------------------------
291
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700292cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700293 name: "libtest_atexit",
294 defaults: ["bionic_testlib_defaults"],
295 srcs: ["atexit_testlib.cpp"],
296}
297
298// -----------------------------------------------------------------------------
299// This library is used by dl_load test to check symbol preempting
300// by main executable
301// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700302cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700303 name: "libdl_preempt_test_1",
304 defaults: ["bionic_testlib_defaults"],
305 srcs: ["dl_preempt_library_1.cpp"],
306}
307
308// -----------------------------------------------------------------------------
309// This library is used by dl_load test to check symbol preempting
310// by libdl_preempt_test_1.so
311// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700312cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700313 name: "libdl_preempt_test_2",
314 defaults: ["bionic_testlib_defaults"],
315 srcs: ["dl_preempt_library_2.cpp"],
316}
317
318// -----------------------------------------------------------------------------
319// Library with DF_1_GLOBAL
320// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700321cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700322 name: "libdl_test_df_1_global",
323 defaults: ["bionic_testlib_defaults"],
324 srcs: ["dl_df_1_global.cpp"],
325 ldflags: ["-Wl,-z,global"],
326
327 target: {
328 host: {
329 // TODO (dimitry): host ld.gold does not yet support -z global
330 // remove this line once it is updated.
331 ldflags: ["-fuse-ld=bfd"],
332 },
333 },
334}
335
336// -----------------------------------------------------------------------------
337// Library using symbol from libdl_test_df_1_global
338// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700339cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700340 name: "libtest_dlsym_df_1_global",
341 defaults: ["bionic_testlib_defaults"],
342 srcs: ["dl_df_1_use_global.cpp"],
343}
344
345// -----------------------------------------------------------------------------
346// Library with weak function
347// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700348cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700349 name: "libtest_dlsym_weak_func",
350 defaults: ["bionic_testlib_defaults"],
351 srcs: ["dlsym_weak_function.cpp"],
352}
353
354// -----------------------------------------------------------------------------
355// Library to check RTLD_LOCAL with dlsym in 'this'
356// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700357cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700358 name: "libtest_dlsym_from_this",
359 defaults: ["bionic_testlib_defaults"],
360 srcs: ["dlsym_from_this_symbol.cpp"],
361 shared_libs: ["libtest_dlsym_from_this_child"],
362
363 target: {
364 android: {
365 shared_libs: ["libdl"],
366 },
Colin Crossd0ba52e2016-10-20 10:39:50 -0700367 host: {
368 host_ldlibs: ["-ldl"],
369 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700370 },
371}
372
373// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700374cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700375 name: "libtest_dlsym_from_this_child",
376 defaults: ["bionic_testlib_defaults"],
377 srcs: ["dlsym_from_this_functions.cpp"],
378 shared_libs: ["libtest_dlsym_from_this_grandchild"],
Colin Crossd0ba52e2016-10-20 10:39:50 -0700379 target: {
380 android: {
381 shared_libs: ["libdl"],
382 },
383 host: {
384 host_ldlibs: ["-ldl"],
385 },
386 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700387}
388
389// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700390cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700391 name: "libtest_dlsym_from_this_grandchild",
392 defaults: ["bionic_testlib_defaults"],
393 srcs: ["dlsym_from_this_symbol2.cpp"],
394}
395
396// -----------------------------------------------------------------------------
397// Empty library
398// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700399cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700400 name: "libtest_empty",
401 defaults: ["bionic_testlib_defaults"],
402 srcs: ["empty.cpp"],
403}
404
405// -----------------------------------------------------------------------------
406// Library with weak undefined function
407// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700408cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700409 name: "libtest_dlopen_weak_undefined_func",
410 defaults: ["bionic_testlib_defaults"],
411 srcs: ["dlopen_weak_undefined.cpp"],
412}
413
414// -----------------------------------------------------------------------------
Dimitry Ivanovd0b5c3a2016-11-25 12:23:11 -0800415// Check that RTLD_NEXT of a libc symbol works in dlopened library
416// -----------------------------------------------------------------------------
417cc_test_library {
418 name: "libtest_check_rtld_next_from_library",
419 defaults: ["bionic_testlib_defaults"],
420 srcs: ["check_rtld_next_from_library.cpp"],
421
422 target: {
423 android: {
424 shared_libs: ["libdl"],
425 },
426 host: {
427 host_ldlibs: ["-ldl"],
428 },
429 },
430}
431
432// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -0700433// Library with constructor that calls dlopen() b/7941716
434// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700435cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700436 name: "libtest_dlopen_from_ctor",
437 defaults: ["bionic_testlib_defaults"],
438 srcs: ["dlopen_testlib_dlopen_from_ctor.cpp"],
439 target: {
440 android: {
441 shared_libs: ["libdl"],
442 },
Colin Crossd0ba52e2016-10-20 10:39:50 -0700443 host: {
444 host_ldlibs: ["-ldl"],
445 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700446 },
447}
448
449// -----------------------------------------------------------------------------
450// Library that depends on the library with constructor that calls dlopen() b/7941716
451// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700452cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700453 name: "libtest_dlopen_from_ctor_main",
454 defaults: ["bionic_testlib_defaults"],
455 srcs: ["empty.cpp"],
456 shared_libs: ["libtest_dlopen_from_ctor"],
457}
458
459// -----------------------------------------------------------------------------
460// Tool to use to align the shared libraries in a zip file.
461// -----------------------------------------------------------------------------
462cc_binary_host {
463 name: "bionic_tests_zipalign",
464 srcs: ["bionic_tests_zipalign.cpp"],
465 cflags: [
466 "-Wall",
467 "-Werror",
468 ],
469
470 static_libs: [
471 "libziparchive",
472 "liblog",
473 "libbase",
474 "libz",
475 "libutils",
476 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700477}