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