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