blob: 9ca1476663f05b3a959ae27534f500748d353666 [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: [
21 "-Wl,--rpath,\\$${ORIGIN}",
22 "-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 },
29 target: {
30 darwin: {
31 enabled: false,
32 },
33 },
34}
35
36// -----------------------------------------------------------------------------
37// Library to test gnu-styled hash
38// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -070039cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -070040 name: "libgnu-hash-table-library",
41 defaults: ["bionic_testlib_defaults"],
42 srcs: ["dlext_test_library.cpp"],
43 ldflags: ["-Wl,--hash-style=gnu"],
44 arch: {
45 mips: {
46 enabled: false,
47 },
48 mips64: {
49 enabled: false,
50 },
51 },
52}
53
54// -----------------------------------------------------------------------------
55// Library to test sysv-styled hash
56// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -070057cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -070058 name: "libsysv-hash-table-library",
59 defaults: ["bionic_testlib_defaults"],
60 srcs: ["dlext_test_library.cpp"],
61 ldflags: ["-Wl,--hash-style=sysv"],
62}
63
64// -----------------------------------------------------------------------------
65// Library used by dlext tests - with GNU RELRO program header
66// -----------------------------------------------------------------------------
67// In Android.mk to support creating symlinks
68
69// -----------------------------------------------------------------------------
70// Library used by dlext tests - without GNU RELRO program header
71// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -070072cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -070073 name: "libdlext_test_norelro",
Dimitry Ivanova36e59b2016-09-01 11:37:39 -070074 defaults: ["bionic_testlib_defaults"],
Colin Cross2722ebb2016-07-11 16:20:06 -070075 srcs: ["dlext_test_library.cpp"],
76 ldflags: ["-Wl,-z,norelro"],
77 shared_libs = ["libtest_simple"],
78}
79
80// -----------------------------------------------------------------------------
81// Library used by dlext tests - different name non-default location
82// -----------------------------------------------------------------------------
83// In Android.mk to support installing to /data
84
85// -----------------------------------------------------------------------------
86// Libraries used by dlext tests for open from a zip-file
87// -----------------------------------------------------------------------------
88// In Android.mk to support installing to /data
89
90// ----------------------------------------------------------------------------
91// Library with soname which does not match filename
92// ----------------------------------------------------------------------------
93// In Android.mk to support zipped and aligned tests
94
95// -----------------------------------------------------------------------------
96// Library used by dlext tests - zipped and aligned
97// -----------------------------------------------------------------------------
98// In Android.mk to support zipped and aligned tests
99
100// -----------------------------------------------------------------------------
101// Library used by dlfcn tests
102// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700103cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700104 name: "libtest_simple",
105 defaults: ["bionic_testlib_defaults"],
106 srcs: ["dlopen_testlib_simple.cpp"],
107}
108
109// -----------------------------------------------------------------------------
110// Library used by dlfcn nodelete tests
111// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700112cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700113 name: "libtest_nodelete_1",
114 defaults: ["bionic_testlib_defaults"],
115 srcs: ["dlopen_nodelete_1.cpp"],
116}
117
118// -----------------------------------------------------------------------------
119// Library used by dlfcn nodelete tests
120// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700121cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700122 name: "libtest_nodelete_2",
123 defaults: ["bionic_testlib_defaults"],
124 srcs: ["dlopen_nodelete_2.cpp"],
125}
126
127// -----------------------------------------------------------------------------
128// Library used by dlfcn nodelete tests
129// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700130cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700131 name: "libtest_nodelete_dt_flags_1",
132 defaults: ["bionic_testlib_defaults"],
133 srcs: ["dlopen_nodelete_dt_flags_1.cpp"],
134 ldflags: ["-Wl,-z,nodelete"],
135}
136
137// -----------------------------------------------------------------------------
138// Build test helper libraries for linker namespaces
139// -----------------------------------------------------------------------------
140// include $(LOCAL_PATH)/Android.build.linker_namespaces.mk
141
142// -----------------------------------------------------------------------------
143// Build DT_RUNPATH test helper libraries
144// -----------------------------------------------------------------------------
145// include $(LOCAL_PATH)/Android.build.dt_runpath.mk
146
147// -----------------------------------------------------------------------------
148// Build library with two parents
149// -----------------------------------------------------------------------------
150// include $(LOCAL_PATH)/Android.build.dlopen_2_parents_reloc.mk
151
152// -----------------------------------------------------------------------------
153// Build libtest_check_order_dlsym.so with its dependencies.
154// -----------------------------------------------------------------------------
155// include $(LOCAL_PATH)/Android.build.dlopen_check_order_dlsym.mk
156
157// -----------------------------------------------------------------------------
158// Build libtest_check_order_siblings.so with its dependencies.
159// -----------------------------------------------------------------------------
160// include $(LOCAL_PATH)/Android.build.dlopen_check_order_reloc_siblings.mk
161
162// -----------------------------------------------------------------------------
163// Build libtest_check_order_root.so with its dependencies.
164// -----------------------------------------------------------------------------
165// include $(LOCAL_PATH)/Android.build.dlopen_check_order_reloc_main_executable.mk
166
167// -----------------------------------------------------------------------------
168// Build libtest_versioned_lib.so with its dependencies.
169// -----------------------------------------------------------------------------
170// include $(LOCAL_PATH)/Android.build.versioned_lib.mk
171
172// -----------------------------------------------------------------------------
173// Build libraries needed by pthread_atfork tests
174// -----------------------------------------------------------------------------
175// include $(LOCAL_PATH)/Android.build.pthread_atfork.mk
176
177// -----------------------------------------------------------------------------
178// Library with dependency loop used by dlfcn tests
179//
180// libtest_with_dependency_loop -> a -> b -> c -> a
181// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700182cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700183 name: "libtest_with_dependency_loop",
184 defaults: ["bionic_testlib_defaults"],
185 srcs: ["dlopen_testlib_loopy_root.cpp"],
186 shared_libs: ["libtest_with_dependency_loop_a"],
187}
188
189// -----------------------------------------------------------------------------
190// libtest_with_dependency_loop_a.so
191// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700192cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700193 name: "libtest_with_dependency_loop_a",
194 defaults: ["bionic_testlib_defaults"],
195 srcs: ["dlopen_testlib_loopy_a.cpp"],
196 shared_libs: ["libtest_with_dependency_loop_b_tmp"],
197}
198
199// -----------------------------------------------------------------------------
200// libtest_with_dependency_loop_b.so
201//
202// this is temporary placeholder - will be removed
203// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700204cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700205 name: "libtest_with_dependency_loop_b_tmp",
206 defaults: ["bionic_testlib_defaults"],
207 srcs: ["dlopen_testlib_loopy_invalid.cpp"],
208 ldflags: ["-Wl,-soname=libtest_with_dependency_loop_b.so"],
209}
210
211// -----------------------------------------------------------------------------
212// libtest_with_dependency_loop_b.so
213// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700214cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700215 name: "libtest_with_dependency_loop_b",
216 defaults: ["bionic_testlib_defaults"],
217 srcs: ["dlopen_testlib_loopy_b.cpp"],
218 shared_libs: ["libtest_with_dependency_loop_c"],
219}
220
221// -----------------------------------------------------------------------------
222// libtest_with_dependency_loop_c.so
223// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700224cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700225 name: "libtest_with_dependency_loop_c",
226 defaults: ["bionic_testlib_defaults"],
227 srcs: ["dlopen_testlib_loopy_c.cpp"],
228 shared_libs: ["libtest_with_dependency_loop_a"],
229}
230
231// -----------------------------------------------------------------------------
232// libtest_relo_check_dt_needed_order.so
233// |
234// +-> libtest_relo_check_dt_needed_order_1.so
235// |
236// +-> libtest_relo_check_dt_needed_order_2.so
237// -----------------------------------------------------------------------------
238
239
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700240cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700241 name: "libtest_relo_check_dt_needed_order",
242 defaults: ["bionic_testlib_defaults"],
243 srcs: ["dlopen_testlib_relo_check_dt_needed_order.cpp"],
244 shared_libs: [
245 "libtest_relo_check_dt_needed_order_1",
246 "libtest_relo_check_dt_needed_order_2",
247 ],
248}
249
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700250cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700251 name: "libtest_relo_check_dt_needed_order_1",
252 defaults: ["bionic_testlib_defaults"],
253 srcs: ["dlopen_testlib_relo_check_dt_needed_order_1.cpp"],
254}
255
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700256cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700257 name: "libtest_relo_check_dt_needed_order_2",
258 defaults: ["bionic_testlib_defaults"],
259 srcs: ["dlopen_testlib_relo_check_dt_needed_order_2.cpp"],
260}
261
262// -----------------------------------------------------------------------------
263// Library with dependency used by dlfcn tests
264// -----------------------------------------------------------------------------
265// In Android.mk to support dependency on libdlext_test
266
267// -----------------------------------------------------------------------------
268// Library used by ifunc tests
269// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700270cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700271 name: "libtest_ifunc",
272 defaults: ["bionic_testlib_defaults"],
273 srcs: ["dlopen_testlib_ifunc.c"],
274
275 // TODO(dimitry): clang does not support ifunc attribute
276 clang: false,
277 arch: {
278 mips: {
279 enabled: false,
280 },
281 mips64: {
282 enabled: false,
283 },
284 },
285}
286
287// -----------------------------------------------------------------------------
288// Library used by atexit tests
289// -----------------------------------------------------------------------------
290
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700291cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700292 name: "libtest_atexit",
293 defaults: ["bionic_testlib_defaults"],
294 srcs: ["atexit_testlib.cpp"],
295}
296
297// -----------------------------------------------------------------------------
298// This library is used by dl_load test to check symbol preempting
299// by main executable
300// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700301cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700302 name: "libdl_preempt_test_1",
303 defaults: ["bionic_testlib_defaults"],
304 srcs: ["dl_preempt_library_1.cpp"],
305}
306
307// -----------------------------------------------------------------------------
308// This library is used by dl_load test to check symbol preempting
309// by libdl_preempt_test_1.so
310// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700311cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700312 name: "libdl_preempt_test_2",
313 defaults: ["bionic_testlib_defaults"],
314 srcs: ["dl_preempt_library_2.cpp"],
315}
316
317// -----------------------------------------------------------------------------
318// Library with DF_1_GLOBAL
319// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700320cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700321 name: "libdl_test_df_1_global",
322 defaults: ["bionic_testlib_defaults"],
323 srcs: ["dl_df_1_global.cpp"],
324 ldflags: ["-Wl,-z,global"],
325
326 target: {
327 host: {
328 // TODO (dimitry): host ld.gold does not yet support -z global
329 // remove this line once it is updated.
330 ldflags: ["-fuse-ld=bfd"],
331 },
332 },
333}
334
335// -----------------------------------------------------------------------------
336// Library using symbol from libdl_test_df_1_global
337// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700338cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700339 name: "libtest_dlsym_df_1_global",
340 defaults: ["bionic_testlib_defaults"],
341 srcs: ["dl_df_1_use_global.cpp"],
342}
343
344// -----------------------------------------------------------------------------
345// Library with weak function
346// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700347cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700348 name: "libtest_dlsym_weak_func",
349 defaults: ["bionic_testlib_defaults"],
350 srcs: ["dlsym_weak_function.cpp"],
351}
352
353// -----------------------------------------------------------------------------
354// Library to check RTLD_LOCAL with dlsym in 'this'
355// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700356cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700357 name: "libtest_dlsym_from_this",
358 defaults: ["bionic_testlib_defaults"],
359 srcs: ["dlsym_from_this_symbol.cpp"],
360 shared_libs: ["libtest_dlsym_from_this_child"],
361
362 target: {
363 android: {
364 shared_libs: ["libdl"],
365 },
366 },
367}
368
369// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700370cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700371 name: "libtest_dlsym_from_this_child",
372 defaults: ["bionic_testlib_defaults"],
373 srcs: ["dlsym_from_this_functions.cpp"],
374 shared_libs: ["libtest_dlsym_from_this_grandchild"],
375}
376
377// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700378cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700379 name: "libtest_dlsym_from_this_grandchild",
380 defaults: ["bionic_testlib_defaults"],
381 srcs: ["dlsym_from_this_symbol2.cpp"],
382}
383
384// -----------------------------------------------------------------------------
385// Empty library
386// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700387cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700388 name: "libtest_empty",
389 defaults: ["bionic_testlib_defaults"],
390 srcs: ["empty.cpp"],
391}
392
393// -----------------------------------------------------------------------------
394// Library with weak undefined function
395// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700396cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700397 name: "libtest_dlopen_weak_undefined_func",
398 defaults: ["bionic_testlib_defaults"],
399 srcs: ["dlopen_weak_undefined.cpp"],
400}
401
402// -----------------------------------------------------------------------------
403// Library with constructor that calls dlopen() b/7941716
404// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700405cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700406 name: "libtest_dlopen_from_ctor",
407 defaults: ["bionic_testlib_defaults"],
408 srcs: ["dlopen_testlib_dlopen_from_ctor.cpp"],
409 target: {
410 android: {
411 shared_libs: ["libdl"],
412 },
413 },
414}
415
416// -----------------------------------------------------------------------------
417// Library that depends on the library with constructor that calls dlopen() b/7941716
418// -----------------------------------------------------------------------------
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700419cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700420 name: "libtest_dlopen_from_ctor_main",
421 defaults: ["bionic_testlib_defaults"],
422 srcs: ["empty.cpp"],
423 shared_libs: ["libtest_dlopen_from_ctor"],
424}
425
426// -----------------------------------------------------------------------------
427// Tool to use to align the shared libraries in a zip file.
428// -----------------------------------------------------------------------------
429cc_binary_host {
430 name: "bionic_tests_zipalign",
431 srcs: ["bionic_tests_zipalign.cpp"],
432 cflags: [
433 "-Wall",
434 "-Werror",
435 ],
436
437 static_libs: [
438 "libziparchive",
439 "liblog",
440 "libbase",
441 "libz",
442 "libutils",
443 ],
444
445 target: {
446 windows: {
447 enabled: true,
448 },
449 },
450}