Android.mk revision 4e446b19d8710cd2004785db4a00f18f249fe73f
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_check_order_dlsym.mk \
25    $(LOCAL_PATH)/Android.build.dlopen_check_order_reloc_siblings.mk \
26    $(LOCAL_PATH)/Android.build.dlopen_check_order_reloc_main_executable.mk \
27    $(LOCAL_PATH)/Android.build.testlib.mk \
28    $(TEST_PATH)/Android.build.mk
29
30# -----------------------------------------------------------------------------
31# Library used by dlfcn tests.
32# -----------------------------------------------------------------------------
33ifneq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),mips mips64))
34no-elf-hash-table-library_src_files := \
35    empty.cpp \
36
37no-elf-hash-table-library_ldflags := \
38    -Wl,--hash-style=gnu \
39
40module := no-elf-hash-table-library
41module_tag := optional
42include $(LOCAL_PATH)/Android.build.testlib.mk
43endif
44
45# -----------------------------------------------------------------------------
46# Library used by dlext tests - with GNU RELRO program header
47# -----------------------------------------------------------------------------
48libdlext_test_src_files := \
49    dlext_test_library.cpp \
50
51libdlext_test_ldflags := \
52    -Wl,-z,relro \
53
54module := libdlext_test
55module_tag := optional
56include $(LOCAL_PATH)/Android.build.testlib.mk
57
58# -----------------------------------------------------------------------------
59# create symlink to libdlext_test.so for symlink test
60# -----------------------------------------------------------------------------
61# Use = instead of := to defer the evaluation of $@
62$(TARGET_OUT)/lib/libdlext_test.so: PRIVATE_POST_INSTALL_CMD = \
63    $(hide) cd $(dir $@) && ln -sf $(notdir $@) libdlext_test_v2.so
64
65ifneq ($(TARGET_2ND_ARCH),)
66# link 64 bit .so
67$(TARGET_OUT)/lib64/libdlext_test.so: PRIVATE_POST_INSTALL_CMD = \
68    $(hide) cd $(dir $@) && ln -sf $(notdir $@) libdlext_test_v2.so
69endif
70
71# host symlinks
72$(HOST_OUT)/lib64/libdlext_test.so: PRIVATE_POST_INSTALL_CMD = \
73    $(hide) cd $(dir $@) && ln -sf $(notdir $@) libdlext_test_v2.so
74
75$(HOST_OUT)/lib/libdlext_test.so: PRIVATE_POST_INSTALL_CMD = \
76    $(hide) cd $(dir $@) && ln -sf $(notdir $@) libdlext_test_v2.so
77
78# -----------------------------------------------------------------------------
79# Library used by dlext tests - without GNU RELRO program header
80# -----------------------------------------------------------------------------
81libdlext_test_norelro_src_files := \
82    dlext_test_library.cpp \
83
84libdlext_test_norelro_ldflags := \
85    -Wl,-z,norelro \
86
87module := libdlext_test_norelro
88module_tag := optional
89build_type := target
90build_target := SHARED_LIBRARY
91include $(TEST_PATH)/Android.build.mk
92
93# -----------------------------------------------------------------------------
94# Library used by dlext tests - different name non-default location
95# -----------------------------------------------------------------------------
96libdlext_test_fd_src_files := \
97    dlext_test_library.cpp \
98
99libdlext_test_fd_install_to_out_data := true
100module := libdlext_test_fd
101module_tag := optional
102build_type := target
103build_target := SHARED_LIBRARY
104include $(TEST_PATH)/Android.build.mk
105
106# -----------------------------------------------------------------------------
107# Library used by dlext tests - zipped and aligned
108# -----------------------------------------------------------------------------
109include $(CLEAR_VARS)
110bionic_2nd_arch_prefix :=
111include $(LOCAL_PATH)/Android.build.dlext_testzip.mk
112ifneq ($(TARGET_2ND_ARCH),)
113  bionic_2nd_arch_prefix := $(TARGET_2ND_ARCH_VAR_PREFIX)
114  include $(LOCAL_PATH)/Android.build.dlext_testzip.mk
115endif
116
117# -----------------------------------------------------------------------------
118# Library used by dlfcn tests
119# -----------------------------------------------------------------------------
120libtest_simple_src_files := \
121    dlopen_testlib_simple.cpp
122
123module := libtest_simple
124include $(LOCAL_PATH)/Android.build.testlib.mk
125
126# -----------------------------------------------------------------------------
127# Library used by dlfcn nodelete tests
128# -----------------------------------------------------------------------------
129libtest_nodelete_1_src_files := \
130    dlopen_nodelete_1.cpp
131
132module := libtest_nodelete_1
133include $(LOCAL_PATH)/Android.build.testlib.mk
134
135# -----------------------------------------------------------------------------
136# Library used by dlfcn nodelete tests
137# -----------------------------------------------------------------------------
138libtest_nodelete_2_src_files := \
139    dlopen_nodelete_2.cpp
140
141module := libtest_nodelete_2
142include $(LOCAL_PATH)/Android.build.testlib.mk
143
144# -----------------------------------------------------------------------------
145# Library used by dlfcn nodelete tests
146# -----------------------------------------------------------------------------
147libtest_nodelete_dt_flags_1_src_files := \
148    dlopen_nodelete_dt_flags_1.cpp
149
150libtest_nodelete_dt_flags_1_ldflags := -Wl,-z,nodelete
151
152module := libtest_nodelete_dt_flags_1
153include $(LOCAL_PATH)/Android.build.testlib.mk
154
155# -----------------------------------------------------------------------------
156# Build libtest_check_order_dlsym.so with its dependencies.
157# -----------------------------------------------------------------------------
158include $(LOCAL_PATH)/Android.build.dlopen_check_order_dlsym.mk
159
160# -----------------------------------------------------------------------------
161# Build libtest_check_order_siblings.so with its dependencies.
162# -----------------------------------------------------------------------------
163include $(LOCAL_PATH)/Android.build.dlopen_check_order_reloc_siblings.mk
164
165# -----------------------------------------------------------------------------
166# Build libtest_check_order_root.so with its dependencies.
167# -----------------------------------------------------------------------------
168include $(LOCAL_PATH)/Android.build.dlopen_check_order_reloc_main_executable.mk
169
170# -----------------------------------------------------------------------------
171# Library with dependency loop used by dlfcn tests
172#
173# libtest_with_dependency_loop -> a -> b -> c -> a
174# -----------------------------------------------------------------------------
175libtest_with_dependency_loop_src_files := dlopen_testlib_invalid.cpp
176
177libtest_with_dependency_loop_shared_libraries := \
178    libtest_with_dependency_loop_a
179
180module := libtest_with_dependency_loop
181include $(LOCAL_PATH)/Android.build.testlib.mk
182
183# -----------------------------------------------------------------------------
184# libtest_with_dependency_loop_a.so
185# -----------------------------------------------------------------------------
186libtest_with_dependency_loop_a_src_files := dlopen_testlib_invalid.cpp
187
188libtest_with_dependency_loop_a_shared_libraries := \
189    libtest_with_dependency_loop_b_tmp
190
191module := libtest_with_dependency_loop_a
192include $(LOCAL_PATH)/Android.build.testlib.mk
193
194# -----------------------------------------------------------------------------
195# libtest_with_dependency_loop_b.so
196#
197# this is temporary placeholder - will be removed
198# -----------------------------------------------------------------------------
199libtest_with_dependency_loop_b_tmp_src_files := dlopen_testlib_invalid.cpp
200libtest_with_dependency_loop_b_tmp_ldflags := -Wl,-soname=libtest_with_dependency_loop_b.so
201
202module := libtest_with_dependency_loop_b_tmp
203include $(LOCAL_PATH)/Android.build.testlib.mk
204
205# -----------------------------------------------------------------------------
206# libtest_with_dependency_loop_b.so
207# -----------------------------------------------------------------------------
208libtest_with_dependency_loop_b_src_files := dlopen_testlib_invalid.cpp
209libtest_with_dependency_loop_b_shared_libraries := libtest_with_dependency_loop_c
210
211module := libtest_with_dependency_loop_b
212include $(LOCAL_PATH)/Android.build.testlib.mk
213
214# -----------------------------------------------------------------------------
215# libtest_with_dependency_loop_c.so
216# -----------------------------------------------------------------------------
217libtest_with_dependency_loop_c_src_files := dlopen_testlib_invalid.cpp
218
219libtest_with_dependency_loop_c_shared_libraries := \
220    libtest_with_dependency_loop_a
221
222module := libtest_with_dependency_loop_c
223include $(LOCAL_PATH)/Android.build.testlib.mk
224
225# -----------------------------------------------------------------------------
226# libtest_relo_check_dt_needed_order.so
227# |
228# +-> libtest_relo_check_dt_needed_order_1.so
229# |
230# +-> libtest_relo_check_dt_needed_order_2.so
231# -----------------------------------------------------------------------------
232libtest_relo_check_dt_needed_order_shared_libraries := \
233    libtest_relo_check_dt_needed_order_1 libtest_relo_check_dt_needed_order_2
234
235libtest_relo_check_dt_needed_order_src_files := dlopen_testlib_relo_check_dt_needed_order.cpp
236libtest_relo_check_dt_needed_order_1_src_files := dlopen_testlib_relo_check_dt_needed_order_1.cpp
237libtest_relo_check_dt_needed_order_2_src_files := dlopen_testlib_relo_check_dt_needed_order_2.cpp
238
239module := libtest_relo_check_dt_needed_order
240include $(LOCAL_PATH)/Android.build.testlib.mk
241module := libtest_relo_check_dt_needed_order_1
242include $(LOCAL_PATH)/Android.build.testlib.mk
243module := libtest_relo_check_dt_needed_order_2
244include $(LOCAL_PATH)/Android.build.testlib.mk
245
246# -----------------------------------------------------------------------------
247# Library with dependency used by dlfcn tests
248# -----------------------------------------------------------------------------
249libtest_with_dependency_src_files := \
250    dlopen_testlib_simple.cpp
251
252libtest_with_dependency_shared_libraries := libdlext_test
253
254module := libtest_with_dependency
255include $(LOCAL_PATH)/Android.build.testlib.mk
256
257# -----------------------------------------------------------------------------
258# Library used by ifunc tests
259# -----------------------------------------------------------------------------
260libtest_ifunc_src_files := \
261    dlopen_testlib_ifunc.c
262
263libtest_ifunc_clang_host := false
264module := libtest_ifunc
265build_target := SHARED_LIBRARY
266
267build_type := host
268include $(TEST_PATH)/Android.build.mk
269
270ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),arm64 x86 x86_64))
271    ifeq ($(TARGET_ARCH),arm64)
272      libtest_ifunc_multilib := 64
273      # TODO: This is a workaround - remove it once gcc
274      # removes its Android ifunc checks
275      libtest_ifunc_cflags := -mglibc
276    endif
277
278    build_type := target
279    libtest_ifunc_clang_target := false
280    include $(TEST_PATH)/Android.build.mk
281endif
282
283# -----------------------------------------------------------------------------
284# Library used by atexit tests
285# -----------------------------------------------------------------------------
286
287libtest_atexit_src_files := \
288    atexit_testlib.cpp
289
290module := libtest_atexit
291include $(LOCAL_PATH)/Android.build.testlib.mk
292
293# -----------------------------------------------------------------------------
294# This library is used by dl_load test to check symbol preempting
295# by main executable
296# -----------------------------------------------------------------------------
297libdl_preempt_test_1_src_files := dl_preempt_library_1.cpp
298
299module := libdl_preempt_test_1
300include $(LOCAL_PATH)/Android.build.testlib.mk
301
302# -----------------------------------------------------------------------------
303# This library is used by dl_load test to check symbol preempting
304# by libdl_preempt_test_1.so
305# -----------------------------------------------------------------------------
306libdl_preempt_test_2_src_files := dl_preempt_library_2.cpp
307
308module := libdl_preempt_test_2
309include $(LOCAL_PATH)/Android.build.testlib.mk
310
311# -----------------------------------------------------------------------------
312# Library with DF_1_GLOBAL
313# -----------------------------------------------------------------------------
314# TODO: re-enable arm once b/18137520 or b/18130452 are fixed
315ifeq ($(filter $(TARGET_ARCH),arm arm64),)
316libdl_test_df_1_global_src_files := dl_df_1_global.cpp
317libdl_test_df_1_global_ldflags := -fuse-ld=bfd -Wl,-z,global
318module := libdl_test_df_1_global
319include $(LOCAL_PATH)/Android.build.testlib.mk
320endif
321
322# -----------------------------------------------------------------------------
323# Library using symbol from libdl_test_df_1_global
324# -----------------------------------------------------------------------------
325libtest_dlsym_df_1_global_src_files := dl_df_1_use_global.cpp
326module := libtest_dlsym_df_1_global
327include $(LOCAL_PATH)/Android.build.testlib.mk
328
329# -----------------------------------------------------------------------------
330# Library with weak function
331# -----------------------------------------------------------------------------
332libtest_dlsym_weak_func_src_files := \
333    dlsym_weak_function.cpp
334
335module := libtest_dlsym_weak_func
336include $(LOCAL_PATH)/Android.build.testlib.mk
337