Android.mk revision 933332462d37dfa121fa691095cdce218a0139bf
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
17LOCAL_PATH := $(call my-dir)
18TEST_PATH := $(LOCAL_PATH)/..
19
20common_cppflags += -std=gnu++11
21common_additional_dependencies := \
22    $(LOCAL_PATH)/Android.mk \
23    $(LOCAL_PATH)/Android.build.dlext_testzip.mk \
24    $(LOCAL_PATH)/Android.build.dlopen_2_parents_reloc.mk \
25    $(LOCAL_PATH)/Android.build.dlopen_check_order_dlsym.mk \
26    $(LOCAL_PATH)/Android.build.dlopen_check_order_reloc_siblings.mk \
27    $(LOCAL_PATH)/Android.build.dlopen_check_order_reloc_main_executable.mk \
28    $(LOCAL_PATH)/Android.build.pthread_atfork.mk \
29    $(LOCAL_PATH)/Android.build.testlib.mk \
30    $(LOCAL_PATH)/Android.build.versioned_lib.mk \
31    $(TEST_PATH)/Android.build.mk
32
33# -----------------------------------------------------------------------------
34# Library to test gnu-styled hash
35# -----------------------------------------------------------------------------
36ifneq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),mips mips64))
37libgnu-hash-table-library_src_files := \
38    dlext_test_library.cpp \
39
40libgnu-hash-table-library_ldflags := \
41    -Wl,--hash-style=gnu \
42
43module := libgnu-hash-table-library
44module_tag := optional
45include $(LOCAL_PATH)/Android.build.testlib.mk
46endif
47
48# -----------------------------------------------------------------------------
49# Library to test sysv-styled hash
50# -----------------------------------------------------------------------------
51libsysv-hash-table-library_src_files := \
52    dlext_test_library.cpp \
53
54libsysv-hash-table-library_ldflags := \
55    -Wl,--hash-style=sysv \
56
57module := libsysv-hash-table-library
58module_tag := optional
59include $(LOCAL_PATH)/Android.build.testlib.mk
60
61# -----------------------------------------------------------------------------
62# Library used by dlext tests - with GNU RELRO program header
63# -----------------------------------------------------------------------------
64libdlext_test_src_files := \
65    dlext_test_library.cpp \
66
67libdlext_test_ldflags := \
68    -Wl,-z,relro \
69
70module := libdlext_test
71module_tag := optional
72include $(LOCAL_PATH)/Android.build.testlib.mk
73
74# -----------------------------------------------------------------------------
75# create symlink to libdlext_test.so for symlink test
76# -----------------------------------------------------------------------------
77# Use = instead of := to defer the evaluation of $@
78$(TARGET_OUT)/lib/libdlext_test.so: PRIVATE_POST_INSTALL_CMD = \
79    $(hide) cd $(dir $@) && ln -sf $(notdir $@) libdlext_test_v2.so
80
81ifneq ($(TARGET_2ND_ARCH),)
82# link 64 bit .so
83$(TARGET_OUT)/lib64/libdlext_test.so: PRIVATE_POST_INSTALL_CMD = \
84    $(hide) cd $(dir $@) && ln -sf $(notdir $@) libdlext_test_v2.so
85endif
86
87# host symlinks
88$(HOST_OUT)/lib64/libdlext_test.so: PRIVATE_POST_INSTALL_CMD = \
89    $(hide) cd $(dir $@) && ln -sf $(notdir $@) libdlext_test_v2.so
90
91$(HOST_OUT)/lib/libdlext_test.so: PRIVATE_POST_INSTALL_CMD = \
92    $(hide) cd $(dir $@) && ln -sf $(notdir $@) libdlext_test_v2.so
93
94# -----------------------------------------------------------------------------
95# Library used by dlext tests - without GNU RELRO program header
96# -----------------------------------------------------------------------------
97libdlext_test_norelro_src_files := \
98    dlext_test_library.cpp \
99
100libdlext_test_norelro_ldflags := \
101    -Wl,-z,norelro \
102
103module := libdlext_test_norelro
104module_tag := optional
105build_type := target
106build_target := SHARED_LIBRARY
107include $(TEST_PATH)/Android.build.mk
108
109# -----------------------------------------------------------------------------
110# Library used by dlext tests - different name non-default location
111# -----------------------------------------------------------------------------
112libdlext_test_fd_src_files := \
113    dlext_test_library.cpp \
114
115libdlext_test_fd_install_to_out_data := true
116module := libdlext_test_fd
117module_tag := optional
118build_type := target
119build_target := SHARED_LIBRARY
120include $(TEST_PATH)/Android.build.mk
121
122# ----------------------------------------------------------------------------
123# Library with soname which does not match filename
124# ----------------------------------------------------------------------------
125libdlext_test_different_soname_src_files := \
126    dlext_test_library.cpp \
127
128module := libdlext_test_different_soname
129module_tag := optional
130libdlext_test_different_soname_ldflags := -Wl,-soname=libdlext_test_soname.so
131include $(LOCAL_PATH)/Android.build.testlib.mk
132
133# -----------------------------------------------------------------------------
134# Library used by dlext tests - zipped and aligned
135# -----------------------------------------------------------------------------
136include $(CLEAR_VARS)
137bionic_2nd_arch_prefix :=
138include $(LOCAL_PATH)/Android.build.dlext_testzip.mk
139ifneq ($(TARGET_2ND_ARCH),)
140  bionic_2nd_arch_prefix := $(TARGET_2ND_ARCH_VAR_PREFIX)
141  include $(LOCAL_PATH)/Android.build.dlext_testzip.mk
142endif
143
144# -----------------------------------------------------------------------------
145# Library used by dlfcn tests
146# -----------------------------------------------------------------------------
147libtest_simple_src_files := \
148    dlopen_testlib_simple.cpp
149
150module := libtest_simple
151include $(LOCAL_PATH)/Android.build.testlib.mk
152
153# -----------------------------------------------------------------------------
154# Library used by dlfcn nodelete tests
155# -----------------------------------------------------------------------------
156libtest_nodelete_1_src_files := \
157    dlopen_nodelete_1.cpp
158
159module := libtest_nodelete_1
160include $(LOCAL_PATH)/Android.build.testlib.mk
161
162# -----------------------------------------------------------------------------
163# Library used by dlfcn nodelete tests
164# -----------------------------------------------------------------------------
165libtest_nodelete_2_src_files := \
166    dlopen_nodelete_2.cpp
167
168module := libtest_nodelete_2
169include $(LOCAL_PATH)/Android.build.testlib.mk
170
171# -----------------------------------------------------------------------------
172# Library used by dlfcn nodelete tests
173# -----------------------------------------------------------------------------
174libtest_nodelete_dt_flags_1_src_files := \
175    dlopen_nodelete_dt_flags_1.cpp
176
177libtest_nodelete_dt_flags_1_ldflags := -Wl,-z,nodelete
178
179module := libtest_nodelete_dt_flags_1
180include $(LOCAL_PATH)/Android.build.testlib.mk
181
182# -----------------------------------------------------------------------------
183# Build library with two parents
184# -----------------------------------------------------------------------------
185include $(LOCAL_PATH)/Android.build.dlopen_2_parents_reloc.mk
186
187# -----------------------------------------------------------------------------
188# Build libtest_check_order_dlsym.so with its dependencies.
189# -----------------------------------------------------------------------------
190include $(LOCAL_PATH)/Android.build.dlopen_check_order_dlsym.mk
191
192# -----------------------------------------------------------------------------
193# Build libtest_check_order_siblings.so with its dependencies.
194# -----------------------------------------------------------------------------
195include $(LOCAL_PATH)/Android.build.dlopen_check_order_reloc_siblings.mk
196
197# -----------------------------------------------------------------------------
198# Build libtest_check_order_root.so with its dependencies.
199# -----------------------------------------------------------------------------
200include $(LOCAL_PATH)/Android.build.dlopen_check_order_reloc_main_executable.mk
201
202# -----------------------------------------------------------------------------
203# Build libtest_versioned_lib.so with its dependencies.
204# -----------------------------------------------------------------------------
205include $(LOCAL_PATH)/Android.build.versioned_lib.mk
206
207# -----------------------------------------------------------------------------
208# Build libraries needed by pthread_atfork tests
209# -----------------------------------------------------------------------------
210include $(LOCAL_PATH)/Android.build.pthread_atfork.mk
211
212# -----------------------------------------------------------------------------
213# Library with dependency loop used by dlfcn tests
214#
215# libtest_with_dependency_loop -> a -> b -> c -> a
216# -----------------------------------------------------------------------------
217libtest_with_dependency_loop_src_files := dlopen_testlib_loopy_root.cpp
218
219libtest_with_dependency_loop_shared_libraries := \
220    libtest_with_dependency_loop_a
221
222module := libtest_with_dependency_loop
223include $(LOCAL_PATH)/Android.build.testlib.mk
224
225# -----------------------------------------------------------------------------
226# libtest_with_dependency_loop_a.so
227# -----------------------------------------------------------------------------
228libtest_with_dependency_loop_a_src_files := dlopen_testlib_loopy_a.cpp
229
230libtest_with_dependency_loop_a_shared_libraries := \
231    libtest_with_dependency_loop_b_tmp
232
233module := libtest_with_dependency_loop_a
234include $(LOCAL_PATH)/Android.build.testlib.mk
235
236# -----------------------------------------------------------------------------
237# libtest_with_dependency_loop_b.so
238#
239# this is temporary placeholder - will be removed
240# -----------------------------------------------------------------------------
241libtest_with_dependency_loop_b_tmp_src_files := dlopen_testlib_loopy_invalid.cpp
242libtest_with_dependency_loop_b_tmp_ldflags := -Wl,-soname=libtest_with_dependency_loop_b.so
243
244module := libtest_with_dependency_loop_b_tmp
245include $(LOCAL_PATH)/Android.build.testlib.mk
246
247# -----------------------------------------------------------------------------
248# libtest_with_dependency_loop_b.so
249# -----------------------------------------------------------------------------
250libtest_with_dependency_loop_b_src_files := dlopen_testlib_loopy_b.cpp
251libtest_with_dependency_loop_b_shared_libraries := libtest_with_dependency_loop_c
252
253module := libtest_with_dependency_loop_b
254include $(LOCAL_PATH)/Android.build.testlib.mk
255
256# -----------------------------------------------------------------------------
257# libtest_with_dependency_loop_c.so
258# -----------------------------------------------------------------------------
259libtest_with_dependency_loop_c_src_files := dlopen_testlib_loopy_c.cpp
260
261libtest_with_dependency_loop_c_shared_libraries := \
262    libtest_with_dependency_loop_a
263
264module := libtest_with_dependency_loop_c
265include $(LOCAL_PATH)/Android.build.testlib.mk
266
267# -----------------------------------------------------------------------------
268# libtest_relo_check_dt_needed_order.so
269# |
270# +-> libtest_relo_check_dt_needed_order_1.so
271# |
272# +-> libtest_relo_check_dt_needed_order_2.so
273# -----------------------------------------------------------------------------
274libtest_relo_check_dt_needed_order_shared_libraries := \
275    libtest_relo_check_dt_needed_order_1 libtest_relo_check_dt_needed_order_2
276
277libtest_relo_check_dt_needed_order_src_files := dlopen_testlib_relo_check_dt_needed_order.cpp
278libtest_relo_check_dt_needed_order_1_src_files := dlopen_testlib_relo_check_dt_needed_order_1.cpp
279libtest_relo_check_dt_needed_order_2_src_files := dlopen_testlib_relo_check_dt_needed_order_2.cpp
280
281module := libtest_relo_check_dt_needed_order
282include $(LOCAL_PATH)/Android.build.testlib.mk
283module := libtest_relo_check_dt_needed_order_1
284include $(LOCAL_PATH)/Android.build.testlib.mk
285module := libtest_relo_check_dt_needed_order_2
286include $(LOCAL_PATH)/Android.build.testlib.mk
287
288# -----------------------------------------------------------------------------
289# Library with dependency used by dlfcn tests
290# -----------------------------------------------------------------------------
291libtest_with_dependency_src_files := \
292    dlopen_testlib_simple.cpp
293
294libtest_with_dependency_shared_libraries := libdlext_test
295
296module := libtest_with_dependency
297include $(LOCAL_PATH)/Android.build.testlib.mk
298
299# -----------------------------------------------------------------------------
300# Library used by ifunc tests
301# -----------------------------------------------------------------------------
302libtest_ifunc_src_files := \
303    dlopen_testlib_ifunc.c
304
305libtest_ifunc_clang_host := false
306module := libtest_ifunc
307build_target := SHARED_LIBRARY
308
309build_type := host
310include $(TEST_PATH)/Android.build.mk
311
312ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),arm64 x86 x86_64))
313    ifeq ($(TARGET_ARCH),arm64)
314      libtest_ifunc_multilib := 64
315      # TODO: This is a workaround - remove it once gcc
316      # removes its Android ifunc checks
317      libtest_ifunc_cflags := -mglibc
318    endif
319
320    build_type := target
321    libtest_ifunc_clang_target := false
322    include $(TEST_PATH)/Android.build.mk
323endif
324
325# -----------------------------------------------------------------------------
326# Library used by atexit tests
327# -----------------------------------------------------------------------------
328
329libtest_atexit_src_files := \
330    atexit_testlib.cpp
331
332module := libtest_atexit
333include $(LOCAL_PATH)/Android.build.testlib.mk
334
335# -----------------------------------------------------------------------------
336# This library is used by dl_load test to check symbol preempting
337# by main executable
338# -----------------------------------------------------------------------------
339libdl_preempt_test_1_src_files := dl_preempt_library_1.cpp
340
341module := libdl_preempt_test_1
342include $(LOCAL_PATH)/Android.build.testlib.mk
343
344# -----------------------------------------------------------------------------
345# This library is used by dl_load test to check symbol preempting
346# by libdl_preempt_test_1.so
347# -----------------------------------------------------------------------------
348libdl_preempt_test_2_src_files := dl_preempt_library_2.cpp
349
350module := libdl_preempt_test_2
351include $(LOCAL_PATH)/Android.build.testlib.mk
352
353# -----------------------------------------------------------------------------
354# Library with DF_1_GLOBAL
355# -----------------------------------------------------------------------------
356libdl_test_df_1_global_src_files := dl_df_1_global.cpp
357libdl_test_df_1_global_ldflags := -Wl,-z,global
358
359# TODO (dimitry): host ld.gold does not yet support -z global
360# remove this line once it is updated.
361libdl_test_df_1_global_ldflags_host := -fuse-ld=bfd
362
363module := libdl_test_df_1_global
364include $(LOCAL_PATH)/Android.build.testlib.mk
365
366# -----------------------------------------------------------------------------
367# Library using symbol from libdl_test_df_1_global
368# -----------------------------------------------------------------------------
369libtest_dlsym_df_1_global_src_files := dl_df_1_use_global.cpp
370module := libtest_dlsym_df_1_global
371include $(LOCAL_PATH)/Android.build.testlib.mk
372
373# -----------------------------------------------------------------------------
374# Library with weak function
375# -----------------------------------------------------------------------------
376libtest_dlsym_weak_func_src_files := \
377    dlsym_weak_function.cpp
378
379module := libtest_dlsym_weak_func
380include $(LOCAL_PATH)/Android.build.testlib.mk
381
382# -----------------------------------------------------------------------------
383# Library to check RTLD_LOCAL with dlsym in 'this'
384# -----------------------------------------------------------------------------
385libtest_dlsym_from_this_src_files := dlsym_from_this_symbol.cpp
386
387libtest_dlsym_from_this_shared_libraries_target := libdl
388libtest_dlsym_from_this_shared_libraries := libtest_dlsym_from_this_child
389
390module := libtest_dlsym_from_this
391include $(LOCAL_PATH)/Android.build.testlib.mk
392
393# -----------------------------------------------------------------------------
394libtest_dlsym_from_this_child_src_files := dlsym_from_this_functions.cpp
395
396libtest_dlsym_from_this_child_shared_libraries := libtest_dlsym_from_this_grandchild
397
398module := libtest_dlsym_from_this_child
399include $(LOCAL_PATH)/Android.build.testlib.mk
400
401# -----------------------------------------------------------------------------
402libtest_dlsym_from_this_grandchild_src_files := dlsym_from_this_symbol2.cpp
403
404module := libtest_dlsym_from_this_grandchild
405include $(LOCAL_PATH)/Android.build.testlib.mk
406
407# -----------------------------------------------------------------------------
408# Library with weak undefined function
409# -----------------------------------------------------------------------------
410libtest_dlopen_weak_undefined_func_src_files := \
411    dlopen_weak_undefined.cpp
412
413module := libtest_dlopen_weak_undefined_func
414include $(LOCAL_PATH)/Android.build.testlib.mk
415
416# -----------------------------------------------------------------------------
417# Library with constructor that calls dlopen() b/7941716
418# -----------------------------------------------------------------------------
419libtest_dlopen_from_ctor_src_files := \
420   dlopen_testlib_dlopen_from_ctor.cpp
421
422module := libtest_dlopen_from_ctor
423
424libtest_dlopen_from_ctor_shared_libraries_target := libdl
425
426include $(LOCAL_PATH)/Android.build.testlib.mk
427
428# -----------------------------------------------------------------------------
429# Library that depends on the library with constructor that calls dlopen() b/7941716
430# -----------------------------------------------------------------------------
431
432libtest_dlopen_from_ctor_main_src_files := empty.cpp
433libtest_dlopen_from_ctor_main_shared_libraries := libtest_dlopen_from_ctor
434
435module := libtest_dlopen_from_ctor_main
436include $(LOCAL_PATH)/Android.build.testlib.mk
437