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