Colin Cross | 2722ebb | 2016-07-11 16:20:06 -0700 | [diff] [blame] | 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 | cc_defaults { |
| 18 | name: "bionic_testlib_defaults", |
| 19 | host_supported: true, |
| 20 | sanitize: { |
| 21 | never: true, |
| 22 | }, |
| 23 | target: { |
| 24 | darwin: { |
| 25 | enabled: false, |
| 26 | }, |
| 27 | }, |
| 28 | } |
| 29 | |
| 30 | // ----------------------------------------------------------------------------- |
| 31 | // Library to test gnu-styled hash |
| 32 | // ----------------------------------------------------------------------------- |
| 33 | cc_library { |
| 34 | name: "libgnu-hash-table-library", |
| 35 | defaults: ["bionic_testlib_defaults"], |
| 36 | srcs: ["dlext_test_library.cpp"], |
| 37 | ldflags: ["-Wl,--hash-style=gnu"], |
| 38 | arch: { |
| 39 | mips: { |
| 40 | enabled: false, |
| 41 | }, |
| 42 | mips64: { |
| 43 | enabled: false, |
| 44 | }, |
| 45 | }, |
| 46 | } |
| 47 | |
| 48 | // ----------------------------------------------------------------------------- |
| 49 | // Library to test sysv-styled hash |
| 50 | // ----------------------------------------------------------------------------- |
| 51 | cc_library { |
| 52 | name: "libsysv-hash-table-library", |
| 53 | defaults: ["bionic_testlib_defaults"], |
| 54 | srcs: ["dlext_test_library.cpp"], |
| 55 | ldflags: ["-Wl,--hash-style=sysv"], |
| 56 | } |
| 57 | |
| 58 | // ----------------------------------------------------------------------------- |
| 59 | // Library used by dlext tests - with GNU RELRO program header |
| 60 | // ----------------------------------------------------------------------------- |
| 61 | // In Android.mk to support creating symlinks |
| 62 | |
| 63 | // ----------------------------------------------------------------------------- |
| 64 | // Library used by dlext tests - without GNU RELRO program header |
| 65 | // ----------------------------------------------------------------------------- |
| 66 | cc_library { |
| 67 | name: "libdlext_test_norelro", |
| 68 | srcs: ["dlext_test_library.cpp"], |
| 69 | ldflags: ["-Wl,-z,norelro"], |
| 70 | shared_libs = ["libtest_simple"], |
| 71 | } |
| 72 | |
| 73 | // ----------------------------------------------------------------------------- |
| 74 | // Library used by dlext tests - different name non-default location |
| 75 | // ----------------------------------------------------------------------------- |
| 76 | // In Android.mk to support installing to /data |
| 77 | |
| 78 | // ----------------------------------------------------------------------------- |
| 79 | // Libraries used by dlext tests for open from a zip-file |
| 80 | // ----------------------------------------------------------------------------- |
| 81 | // In Android.mk to support installing to /data |
| 82 | |
| 83 | // ---------------------------------------------------------------------------- |
| 84 | // Library with soname which does not match filename |
| 85 | // ---------------------------------------------------------------------------- |
| 86 | // In Android.mk to support zipped and aligned tests |
| 87 | |
| 88 | // ----------------------------------------------------------------------------- |
| 89 | // Library used by dlext tests - zipped and aligned |
| 90 | // ----------------------------------------------------------------------------- |
| 91 | // In Android.mk to support zipped and aligned tests |
| 92 | |
| 93 | // ----------------------------------------------------------------------------- |
| 94 | // Library used by dlfcn tests |
| 95 | // ----------------------------------------------------------------------------- |
| 96 | cc_library { |
| 97 | name: "libtest_simple", |
| 98 | defaults: ["bionic_testlib_defaults"], |
| 99 | srcs: ["dlopen_testlib_simple.cpp"], |
| 100 | } |
| 101 | |
| 102 | // ----------------------------------------------------------------------------- |
| 103 | // Library used by dlfcn nodelete tests |
| 104 | // ----------------------------------------------------------------------------- |
| 105 | cc_library { |
| 106 | name: "libtest_nodelete_1", |
| 107 | defaults: ["bionic_testlib_defaults"], |
| 108 | srcs: ["dlopen_nodelete_1.cpp"], |
| 109 | } |
| 110 | |
| 111 | // ----------------------------------------------------------------------------- |
| 112 | // Library used by dlfcn nodelete tests |
| 113 | // ----------------------------------------------------------------------------- |
| 114 | cc_library { |
| 115 | name: "libtest_nodelete_2", |
| 116 | defaults: ["bionic_testlib_defaults"], |
| 117 | srcs: ["dlopen_nodelete_2.cpp"], |
| 118 | } |
| 119 | |
| 120 | // ----------------------------------------------------------------------------- |
| 121 | // Library used by dlfcn nodelete tests |
| 122 | // ----------------------------------------------------------------------------- |
| 123 | cc_library { |
| 124 | name: "libtest_nodelete_dt_flags_1", |
| 125 | defaults: ["bionic_testlib_defaults"], |
| 126 | srcs: ["dlopen_nodelete_dt_flags_1.cpp"], |
| 127 | ldflags: ["-Wl,-z,nodelete"], |
| 128 | } |
| 129 | |
| 130 | // ----------------------------------------------------------------------------- |
| 131 | // Build test helper libraries for linker namespaces |
| 132 | // ----------------------------------------------------------------------------- |
| 133 | // include $(LOCAL_PATH)/Android.build.linker_namespaces.mk |
| 134 | |
| 135 | // ----------------------------------------------------------------------------- |
| 136 | // Build DT_RUNPATH test helper libraries |
| 137 | // ----------------------------------------------------------------------------- |
| 138 | // include $(LOCAL_PATH)/Android.build.dt_runpath.mk |
| 139 | |
| 140 | // ----------------------------------------------------------------------------- |
| 141 | // Build library with two parents |
| 142 | // ----------------------------------------------------------------------------- |
| 143 | // include $(LOCAL_PATH)/Android.build.dlopen_2_parents_reloc.mk |
| 144 | |
| 145 | // ----------------------------------------------------------------------------- |
| 146 | // Build libtest_check_order_dlsym.so with its dependencies. |
| 147 | // ----------------------------------------------------------------------------- |
| 148 | // include $(LOCAL_PATH)/Android.build.dlopen_check_order_dlsym.mk |
| 149 | |
| 150 | // ----------------------------------------------------------------------------- |
| 151 | // Build libtest_check_order_siblings.so with its dependencies. |
| 152 | // ----------------------------------------------------------------------------- |
| 153 | // include $(LOCAL_PATH)/Android.build.dlopen_check_order_reloc_siblings.mk |
| 154 | |
| 155 | // ----------------------------------------------------------------------------- |
| 156 | // Build libtest_check_order_root.so with its dependencies. |
| 157 | // ----------------------------------------------------------------------------- |
| 158 | // include $(LOCAL_PATH)/Android.build.dlopen_check_order_reloc_main_executable.mk |
| 159 | |
| 160 | // ----------------------------------------------------------------------------- |
| 161 | // Build libtest_versioned_lib.so with its dependencies. |
| 162 | // ----------------------------------------------------------------------------- |
| 163 | // include $(LOCAL_PATH)/Android.build.versioned_lib.mk |
| 164 | |
| 165 | // ----------------------------------------------------------------------------- |
| 166 | // Build libraries needed by pthread_atfork tests |
| 167 | // ----------------------------------------------------------------------------- |
| 168 | // include $(LOCAL_PATH)/Android.build.pthread_atfork.mk |
| 169 | |
| 170 | // ----------------------------------------------------------------------------- |
| 171 | // Library with dependency loop used by dlfcn tests |
| 172 | // |
| 173 | // libtest_with_dependency_loop -> a -> b -> c -> a |
| 174 | // ----------------------------------------------------------------------------- |
| 175 | cc_library { |
| 176 | name: "libtest_with_dependency_loop", |
| 177 | defaults: ["bionic_testlib_defaults"], |
| 178 | srcs: ["dlopen_testlib_loopy_root.cpp"], |
| 179 | shared_libs: ["libtest_with_dependency_loop_a"], |
| 180 | } |
| 181 | |
| 182 | // ----------------------------------------------------------------------------- |
| 183 | // libtest_with_dependency_loop_a.so |
| 184 | // ----------------------------------------------------------------------------- |
| 185 | cc_library { |
| 186 | name: "libtest_with_dependency_loop_a", |
| 187 | defaults: ["bionic_testlib_defaults"], |
| 188 | srcs: ["dlopen_testlib_loopy_a.cpp"], |
| 189 | shared_libs: ["libtest_with_dependency_loop_b_tmp"], |
| 190 | } |
| 191 | |
| 192 | // ----------------------------------------------------------------------------- |
| 193 | // libtest_with_dependency_loop_b.so |
| 194 | // |
| 195 | // this is temporary placeholder - will be removed |
| 196 | // ----------------------------------------------------------------------------- |
| 197 | cc_library { |
| 198 | name: "libtest_with_dependency_loop_b_tmp", |
| 199 | defaults: ["bionic_testlib_defaults"], |
| 200 | srcs: ["dlopen_testlib_loopy_invalid.cpp"], |
| 201 | ldflags: ["-Wl,-soname=libtest_with_dependency_loop_b.so"], |
| 202 | } |
| 203 | |
| 204 | // ----------------------------------------------------------------------------- |
| 205 | // libtest_with_dependency_loop_b.so |
| 206 | // ----------------------------------------------------------------------------- |
| 207 | cc_library { |
| 208 | name: "libtest_with_dependency_loop_b", |
| 209 | defaults: ["bionic_testlib_defaults"], |
| 210 | srcs: ["dlopen_testlib_loopy_b.cpp"], |
| 211 | shared_libs: ["libtest_with_dependency_loop_c"], |
| 212 | } |
| 213 | |
| 214 | // ----------------------------------------------------------------------------- |
| 215 | // libtest_with_dependency_loop_c.so |
| 216 | // ----------------------------------------------------------------------------- |
| 217 | cc_library { |
| 218 | name: "libtest_with_dependency_loop_c", |
| 219 | defaults: ["bionic_testlib_defaults"], |
| 220 | srcs: ["dlopen_testlib_loopy_c.cpp"], |
| 221 | shared_libs: ["libtest_with_dependency_loop_a"], |
| 222 | } |
| 223 | |
| 224 | // ----------------------------------------------------------------------------- |
| 225 | // libtest_relo_check_dt_needed_order.so |
| 226 | // | |
| 227 | // +-> libtest_relo_check_dt_needed_order_1.so |
| 228 | // | |
| 229 | // +-> libtest_relo_check_dt_needed_order_2.so |
| 230 | // ----------------------------------------------------------------------------- |
| 231 | |
| 232 | |
| 233 | cc_library { |
| 234 | name: "libtest_relo_check_dt_needed_order", |
| 235 | defaults: ["bionic_testlib_defaults"], |
| 236 | srcs: ["dlopen_testlib_relo_check_dt_needed_order.cpp"], |
| 237 | shared_libs: [ |
| 238 | "libtest_relo_check_dt_needed_order_1", |
| 239 | "libtest_relo_check_dt_needed_order_2", |
| 240 | ], |
| 241 | } |
| 242 | |
| 243 | cc_library { |
| 244 | name: "libtest_relo_check_dt_needed_order_1", |
| 245 | defaults: ["bionic_testlib_defaults"], |
| 246 | srcs: ["dlopen_testlib_relo_check_dt_needed_order_1.cpp"], |
| 247 | } |
| 248 | |
| 249 | cc_library { |
| 250 | name: "libtest_relo_check_dt_needed_order_2", |
| 251 | defaults: ["bionic_testlib_defaults"], |
| 252 | srcs: ["dlopen_testlib_relo_check_dt_needed_order_2.cpp"], |
| 253 | } |
| 254 | |
| 255 | // ----------------------------------------------------------------------------- |
| 256 | // Library with dependency used by dlfcn tests |
| 257 | // ----------------------------------------------------------------------------- |
| 258 | // In Android.mk to support dependency on libdlext_test |
| 259 | |
| 260 | // ----------------------------------------------------------------------------- |
| 261 | // Library used by ifunc tests |
| 262 | // ----------------------------------------------------------------------------- |
| 263 | cc_library { |
| 264 | name: "libtest_ifunc", |
| 265 | defaults: ["bionic_testlib_defaults"], |
| 266 | srcs: ["dlopen_testlib_ifunc.c"], |
| 267 | |
| 268 | // TODO(dimitry): clang does not support ifunc attribute |
| 269 | clang: false, |
| 270 | arch: { |
| 271 | mips: { |
| 272 | enabled: false, |
| 273 | }, |
| 274 | mips64: { |
| 275 | enabled: false, |
| 276 | }, |
| 277 | }, |
| 278 | } |
| 279 | |
| 280 | // ----------------------------------------------------------------------------- |
| 281 | // Library used by atexit tests |
| 282 | // ----------------------------------------------------------------------------- |
| 283 | |
| 284 | cc_library { |
| 285 | name: "libtest_atexit", |
| 286 | defaults: ["bionic_testlib_defaults"], |
| 287 | srcs: ["atexit_testlib.cpp"], |
| 288 | } |
| 289 | |
| 290 | // ----------------------------------------------------------------------------- |
| 291 | // This library is used by dl_load test to check symbol preempting |
| 292 | // by main executable |
| 293 | // ----------------------------------------------------------------------------- |
| 294 | cc_library { |
| 295 | name: "libdl_preempt_test_1", |
| 296 | defaults: ["bionic_testlib_defaults"], |
| 297 | srcs: ["dl_preempt_library_1.cpp"], |
| 298 | } |
| 299 | |
| 300 | // ----------------------------------------------------------------------------- |
| 301 | // This library is used by dl_load test to check symbol preempting |
| 302 | // by libdl_preempt_test_1.so |
| 303 | // ----------------------------------------------------------------------------- |
| 304 | cc_library { |
| 305 | name: "libdl_preempt_test_2", |
| 306 | defaults: ["bionic_testlib_defaults"], |
| 307 | srcs: ["dl_preempt_library_2.cpp"], |
| 308 | } |
| 309 | |
| 310 | // ----------------------------------------------------------------------------- |
| 311 | // Library with DF_1_GLOBAL |
| 312 | // ----------------------------------------------------------------------------- |
| 313 | cc_library { |
| 314 | name: "libdl_test_df_1_global", |
| 315 | defaults: ["bionic_testlib_defaults"], |
| 316 | srcs: ["dl_df_1_global.cpp"], |
| 317 | ldflags: ["-Wl,-z,global"], |
| 318 | |
| 319 | target: { |
| 320 | host: { |
| 321 | // TODO (dimitry): host ld.gold does not yet support -z global |
| 322 | // remove this line once it is updated. |
| 323 | ldflags: ["-fuse-ld=bfd"], |
| 324 | }, |
| 325 | }, |
| 326 | } |
| 327 | |
| 328 | // ----------------------------------------------------------------------------- |
| 329 | // Library using symbol from libdl_test_df_1_global |
| 330 | // ----------------------------------------------------------------------------- |
| 331 | cc_library { |
| 332 | name: "libtest_dlsym_df_1_global", |
| 333 | defaults: ["bionic_testlib_defaults"], |
| 334 | srcs: ["dl_df_1_use_global.cpp"], |
| 335 | } |
| 336 | |
| 337 | // ----------------------------------------------------------------------------- |
| 338 | // Library with weak function |
| 339 | // ----------------------------------------------------------------------------- |
| 340 | cc_library { |
| 341 | name: "libtest_dlsym_weak_func", |
| 342 | defaults: ["bionic_testlib_defaults"], |
| 343 | srcs: ["dlsym_weak_function.cpp"], |
| 344 | } |
| 345 | |
| 346 | // ----------------------------------------------------------------------------- |
| 347 | // Library to check RTLD_LOCAL with dlsym in 'this' |
| 348 | // ----------------------------------------------------------------------------- |
| 349 | cc_library { |
| 350 | name: "libtest_dlsym_from_this", |
| 351 | defaults: ["bionic_testlib_defaults"], |
| 352 | srcs: ["dlsym_from_this_symbol.cpp"], |
| 353 | shared_libs: ["libtest_dlsym_from_this_child"], |
| 354 | |
| 355 | target: { |
| 356 | android: { |
| 357 | shared_libs: ["libdl"], |
| 358 | }, |
| 359 | }, |
| 360 | } |
| 361 | |
| 362 | // ----------------------------------------------------------------------------- |
| 363 | cc_library { |
| 364 | name: "libtest_dlsym_from_this_child", |
| 365 | defaults: ["bionic_testlib_defaults"], |
| 366 | srcs: ["dlsym_from_this_functions.cpp"], |
| 367 | shared_libs: ["libtest_dlsym_from_this_grandchild"], |
| 368 | } |
| 369 | |
| 370 | // ----------------------------------------------------------------------------- |
| 371 | cc_library { |
| 372 | name: "libtest_dlsym_from_this_grandchild", |
| 373 | defaults: ["bionic_testlib_defaults"], |
| 374 | srcs: ["dlsym_from_this_symbol2.cpp"], |
| 375 | } |
| 376 | |
| 377 | // ----------------------------------------------------------------------------- |
| 378 | // Empty library |
| 379 | // ----------------------------------------------------------------------------- |
| 380 | cc_library { |
| 381 | name: "libtest_empty", |
| 382 | defaults: ["bionic_testlib_defaults"], |
| 383 | srcs: ["empty.cpp"], |
| 384 | } |
| 385 | |
| 386 | // ----------------------------------------------------------------------------- |
| 387 | // Library with weak undefined function |
| 388 | // ----------------------------------------------------------------------------- |
| 389 | cc_library { |
| 390 | name: "libtest_dlopen_weak_undefined_func", |
| 391 | defaults: ["bionic_testlib_defaults"], |
| 392 | srcs: ["dlopen_weak_undefined.cpp"], |
| 393 | } |
| 394 | |
| 395 | // ----------------------------------------------------------------------------- |
| 396 | // Library with constructor that calls dlopen() b/7941716 |
| 397 | // ----------------------------------------------------------------------------- |
| 398 | cc_library { |
| 399 | name: "libtest_dlopen_from_ctor", |
| 400 | defaults: ["bionic_testlib_defaults"], |
| 401 | srcs: ["dlopen_testlib_dlopen_from_ctor.cpp"], |
| 402 | target: { |
| 403 | android: { |
| 404 | shared_libs: ["libdl"], |
| 405 | }, |
| 406 | }, |
| 407 | } |
| 408 | |
| 409 | // ----------------------------------------------------------------------------- |
| 410 | // Library that depends on the library with constructor that calls dlopen() b/7941716 |
| 411 | // ----------------------------------------------------------------------------- |
| 412 | cc_library { |
| 413 | name: "libtest_dlopen_from_ctor_main", |
| 414 | defaults: ["bionic_testlib_defaults"], |
| 415 | srcs: ["empty.cpp"], |
| 416 | shared_libs: ["libtest_dlopen_from_ctor"], |
| 417 | } |
| 418 | |
| 419 | // ----------------------------------------------------------------------------- |
| 420 | // Tool to use to align the shared libraries in a zip file. |
| 421 | // ----------------------------------------------------------------------------- |
| 422 | cc_binary_host { |
| 423 | name: "bionic_tests_zipalign", |
| 424 | srcs: ["bionic_tests_zipalign.cpp"], |
| 425 | cflags: [ |
| 426 | "-Wall", |
| 427 | "-Werror", |
| 428 | ], |
| 429 | |
| 430 | static_libs: [ |
| 431 | "libziparchive", |
| 432 | "liblog", |
| 433 | "libbase", |
| 434 | "libz", |
| 435 | "libutils", |
| 436 | ], |
| 437 | |
| 438 | target: { |
| 439 | windows: { |
| 440 | enabled: true, |
| 441 | }, |
| 442 | }, |
| 443 | } |