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