1# Copyright (c) 2023 Huawei Device Co., Ltd. 2# Licensed under the Apache License, Version 2.0 (the "License"); 3# you may not use this file except in compliance with the License. 4# You may obtain a copy of the License at 5# 6# http://www.apache.org/licenses/LICENSE-2.0 7# 8# Unless required by applicable law or agreed to in writing, software 9# distributed under the License is distributed on an "AS IS" BASIS, 10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11# See the License for the specific language governing permissions and 12# limitations under the License. 13 14import("//build/config/clang/clang.gni") 15import("../../../../../../test_template.gni") 16 17group("ldso_libs") { 18 testonly = true 19 deps = [ 20 ":dlopen_004", 21 ":dlopen_005", 22 ":dlopen_009_1", 23 ":dlopen_009_2", 24 ":dlopen_010", 25 ":dlopen_common", 26 ":dlopen_common_close", 27 ":dlopen_common_relro", 28 ":dlopen_global", 29 ":dlopen_gnu_hash", 30 ":dlopen_init_finalize", 31 ":dlopen_load_so", 32 ":dlopen_nodelete", 33 ":dlopen_nodelete_1", 34 ":dlopen_order_003", 35 ":dlopen_order_02", 36 ":dlopen_relocation", 37 ":dlopen_rpath", 38 ":dlopen_sysv_hash", 39 ":dlopen_test_dependency", 40 ":dlsym_get_answer", 41 ":dlsym_get_symbol", 42 ":dlsym_get_symbol_impl", 43 ":dlsym_global_symbol", 44 ":dlsym_lib_use_rtld_next", 45 ":dlsym_symbol_impl_v1", 46 ":dlsym_symbol_impl_v2", 47 ":dlsym_symbol_v1", 48 ":dlsym_symbol_v2_relro", 49 ":dlsym_symbol_v2_second", 50 ":dlsym_symbol_v3_relro", 51 ":dlsym_symbol_version_2", 52 ":dlsym_symbol_version_3", 53 ":dlsym_symbol_version_empty", 54 ":dlsym_to_use_global_symbol", 55 ":dlsym_weak_func", 56 ":dlsym_weak_func_undefined", 57 ":empty", 58 ":ldso_cfi_lib", 59 ":ldso_cfi_lib_exit", 60 ":ldso_dlclose_test_a", 61 ":ldso_dlclose_test_b", 62 ":ldso_dlclose_test_c", 63 ":ldso_dlsym_dependent", 64 ":ldso_dlsym_dependent_impl", 65 ":ldso_norelro_test", 66 ":ldso_ns_empty", 67 ":ldso_ns_root", 68 ":ldso_ns_test_permitted_root", 69 ":ldso_relro_recursive_test", 70 ":ldso_thread_test", 71 ":ldso_thread_test_2", 72 ] 73 if ("${musl_arch}" == "arm" || "${musl_arch}" == "aarch64") { 74 deps += [ ":copy_zip_lib" ] 75 } 76} 77 78root_libs_dir = "/data/tmp/libcgtest/libs" 79 80ohos_shared_library("dlopen_relocation_1") { 81 include_dirs = [ "." ] 82 sources = [ "dlopen_relocation_1.c" ] 83 output_name = "dlopen_relocation_1" 84 output_extension = "so" 85 subsystem_name = "musl" 86 part_name = "libc-gtest-lib" 87} 88 89ohos_shared_library("dlopen_relocation_2") { 90 include_dirs = [ "." ] 91 sources = [ "dlopen_relocation_2.c" ] 92 output_name = "dlopen_relocation_2" 93 output_extension = "so" 94 subsystem_name = "musl" 95 part_name = "libc-gtest-lib" 96} 97 98ohos_shared_library("dlopen_relocation") { 99 include_dirs = [ "." ] 100 sources = [ "dlopen_relocation.c" ] 101 output_name = "dlopen_relocation" 102 output_extension = "so" 103 deps = [ 104 ":dlopen_relocation_1", 105 ":dlopen_relocation_2", 106 ] 107 subsystem_name = "musl" 108 part_name = "libc-gtest-lib" 109} 110 111ohos_shared_library("dlopen_order_1") { 112 include_dirs = [ "." ] 113 sources = [ "dlopen_order_1.c" ] 114 output_name = "dlopen_order_1" 115 output_extension = "so" 116 subsystem_name = "musl" 117 part_name = "libc-gtest-lib" 118} 119 120ohos_shared_library("dlopen_order_2") { 121 include_dirs = [ "." ] 122 sources = [ "dlopen_order_2.c" ] 123 output_name = "dlopen_order_2" 124 output_extension = "so" 125 subsystem_name = "musl" 126 part_name = "libc-gtest-lib" 127} 128 129ohos_shared_library("dlopen_order_3") { 130 include_dirs = [ "." ] 131 sources = [ "dlopen_order_3.c" ] 132 output_name = "dlopen_order_3" 133 output_extension = "so" 134 subsystem_name = "musl" 135 part_name = "libc-gtest-lib" 136} 137 138ohos_shared_library("dlopen_order_1_2") { 139 include_dirs = [ "." ] 140 sources = [ "dlopen_order_1_2.c" ] 141 output_name = "dlopen_order_1_2" 142 output_extension = "so" 143 deps = [ 144 ":dlopen_order_1", 145 ":dlopen_order_2", 146 ] 147 subsystem_name = "musl" 148 part_name = "libc-gtest-lib" 149} 150 151ohos_shared_library("dlopen_order_02") { 152 include_dirs = [ "." ] 153 sources = [ "dlopen_order.c" ] 154 output_name = "dlopen_order_02" 155 output_extension = "so" 156 deps = [ 157 ":dlopen_order_1_2", 158 ":dlopen_order_3", 159 ] 160 subsystem_name = "musl" 161 part_name = "libc-gtest-lib" 162} 163 164ohos_shared_library("dlopen_order_003_1_1") { 165 include_dirs = [ "." ] 166 sources = [ "dlopen_order_003_1_1.c" ] 167 output_name = "dlopen_order_003_1_1" 168 output_extension = "so" 169 subsystem_name = "musl" 170 part_name = "libc-gtest-lib" 171} 172 173ohos_shared_library("dlopen_order_003_1_2") { 174 include_dirs = [ "." ] 175 sources = [ "dlopen_order_003_1_2.c" ] 176 output_name = "dlopen_order_003_1_2" 177 output_extension = "so" 178 subsystem_name = "musl" 179 part_name = "libc-gtest-lib" 180} 181 182ohos_shared_library("dlopen_order_003_1") { 183 include_dirs = [ "." ] 184 sources = [ "dlopen_order_003_1.c" ] 185 output_name = "dlopen_order_003_1" 186 output_extension = "so" 187 deps = [ 188 ":dlopen_order_003_1_1", 189 ":dlopen_order_003_1_2", 190 ] 191 subsystem_name = "musl" 192 part_name = "libc-gtest-lib" 193} 194 195ohos_shared_library("dlopen_order_003_2_1") { 196 include_dirs = [ "." ] 197 sources = [ "dlopen_order_003_2_1.c" ] 198 output_name = "dlopen_order_003_2_1" 199 output_extension = "so" 200 subsystem_name = "musl" 201 part_name = "libc-gtest-lib" 202} 203 204ohos_shared_library("dlopen_order_003_2_2") { 205 include_dirs = [ "." ] 206 sources = [ "dlopen_order_003_2_2.c" ] 207 output_name = "dlopen_order_003_2_2" 208 output_extension = "so" 209 subsystem_name = "musl" 210 part_name = "libc-gtest-lib" 211} 212 213ohos_shared_library("dlopen_order_003_2") { 214 include_dirs = [ "." ] 215 sources = [ "dlopen_order_003_2.c" ] 216 output_name = "dlopen_order_003_2" 217 output_extension = "so" 218 deps = [ 219 ":dlopen_order_003_2_1", 220 ":dlopen_order_003_2_2", 221 ] 222 subsystem_name = "musl" 223 part_name = "libc-gtest-lib" 224} 225 226ohos_shared_library("dlopen_order_003") { 227 include_dirs = [ "." ] 228 sources = [ "dlopen_order_003.c" ] 229 output_name = "dlopen_order_003" 230 output_extension = "so" 231 deps = [ 232 ":dlopen_order_003_1", 233 ":dlopen_order_003_2", 234 ] 235 subsystem_name = "musl" 236 part_name = "libc-gtest-lib" 237} 238 239ohos_shared_library("dlopen_common") { 240 include_dirs = [ "." ] 241 sources = [ "dlopen_common.c" ] 242 output_name = "dlopen_common" 243 output_extension = "so" 244 ldflags = [ "-Wl,-soname=libdlopen_common_soname.so" ] 245 subsystem_name = "musl" 246 part_name = "libc-gtest-lib" 247} 248 249ohos_shared_library("dlopen_004_1_1") { 250 include_dirs = [ "." ] 251 sources = [ "dlopen_004_1_1.c" ] 252 output_name = "dlopen_004_1_1" 253 output_extension = "so" 254 subsystem_name = "musl" 255 part_name = "libc-gtest-lib" 256} 257 258ohos_shared_library("dlopen_004_1_2") { 259 include_dirs = [ "." ] 260 sources = [ "dlopen_004_1_2.c" ] 261 output_name = "dlopen_004_1_2" 262 output_extension = "so" 263 subsystem_name = "musl" 264 part_name = "libc-gtest-lib" 265} 266 267ohos_shared_library("dlopen_004_1") { 268 include_dirs = [ "." ] 269 sources = [ "dlopen_004_1.c" ] 270 output_name = "dlopen_004_1" 271 output_extension = "so" 272 deps = [ 273 ":dlopen_004_1_1", 274 ":dlopen_004_1_2", 275 ] 276 subsystem_name = "musl" 277 part_name = "libc-gtest-lib" 278} 279 280ohos_shared_library("dlopen_004") { 281 include_dirs = [ "." ] 282 sources = [ "dlopen_004.c" ] 283 output_name = "dlopen_004" 284 output_extension = "so" 285 deps = [ ":dlopen_004_1" ] 286 subsystem_name = "musl" 287 part_name = "libc-gtest-lib" 288 289 ldflags = [ "-Wl,--allow-shlib-undefined" ] 290} 291 292ohos_shared_library("dlopen_005_1_1") { 293 include_dirs = [ "." ] 294 sources = [ "dlopen_005_1_1.c" ] 295 output_name = "dlopen_005_1_1" 296 output_extension = "so" 297 subsystem_name = "musl" 298 part_name = "libc-gtest-lib" 299} 300 301ohos_shared_library("dlopen_005_1_2") { 302 include_dirs = [ "." ] 303 sources = [ "dlopen_005_1_2.c" ] 304 output_name = "dlopen_005_1_2" 305 output_extension = "so" 306 subsystem_name = "musl" 307 part_name = "libc-gtest-lib" 308} 309 310ohos_shared_library("dlopen_005_2_1") { 311 include_dirs = [ "." ] 312 sources = [ "dlopen_005_2_1.c" ] 313 output_name = "dlopen_005_2_1" 314 output_extension = "so" 315 subsystem_name = "musl" 316 part_name = "libc-gtest-lib" 317} 318 319ohos_shared_library("dlopen_005_1") { 320 include_dirs = [ "." ] 321 sources = [ "dlopen_005_1.c" ] 322 output_name = "dlopen_005_1" 323 output_extension = "so" 324 deps = [ 325 ":dlopen_005_1_1", 326 ":dlopen_005_1_2", 327 ] 328 subsystem_name = "musl" 329 part_name = "libc-gtest-lib" 330} 331 332ohos_shared_library("dlopen_005_2") { 333 include_dirs = [ "." ] 334 sources = [ "dlopen_005_2.c" ] 335 output_name = "dlopen_005_2" 336 output_extension = "so" 337 deps = [ ":dlopen_005_2_1" ] 338 subsystem_name = "musl" 339 part_name = "libc-gtest-lib" 340} 341 342ohos_shared_library("dlopen_005") { 343 include_dirs = [ "." ] 344 sources = [ "dlopen_005.c" ] 345 output_name = "dlopen_005" 346 output_extension = "so" 347 deps = [ 348 ":dlopen_005_1", 349 ":dlopen_005_2", 350 ] 351 subsystem_name = "musl" 352 part_name = "libc-gtest-lib" 353} 354 355ohos_shared_library("dlopen_009") { 356 include_dirs = [ "." ] 357 sources = [ "dlopen_009.c" ] 358 output_name = "dlopen_009" 359 output_extension = "so" 360 subsystem_name = "musl" 361 part_name = "libc-gtest-lib" 362} 363 364ohos_shared_library("dlopen_009_1") { 365 include_dirs = [ "." ] 366 sources = [ "dlopen_009_1.c" ] 367 output_name = "dlopen_009_1" 368 output_extension = "so" 369 deps = [ ":dlopen_009" ] 370 subsystem_name = "musl" 371 part_name = "libc-gtest-lib" 372} 373 374ohos_shared_library("dlopen_009_2") { 375 include_dirs = [ "." ] 376 sources = [ "dlopen_009_2.c" ] 377 output_name = "dlopen_009_2" 378 output_extension = "so" 379 deps = [ ":dlopen_009" ] 380 subsystem_name = "musl" 381 part_name = "libc-gtest-lib" 382} 383 384ohos_shared_library("dlopen_010") { 385 include_dirs = [ "." ] 386 sources = [ "dlopen_location.c" ] 387 output_name = "dlopen_010" 388 output_extension = "so" 389 deps = [ ":dlopen_relocation_1" ] 390 subsystem_name = "musl" 391 part_name = "libc-gtest-lib" 392} 393 394ohos_shared_library("dlopen_load_so_1") { 395 include_dirs = [ "." ] 396 sources = [ "dlopen_load_so_1.c" ] 397 output_name = "dlopen_load_so_1" 398 output_extension = "so" 399 subsystem_name = "musl" 400 part_name = "libc-gtest-lib" 401} 402 403ohos_shared_library("dlopen_load_so") { 404 include_dirs = [ "." ] 405 sources = [ "dlopen_load_so.c" ] 406 output_name = "dlopen_load_so" 407 output_extension = "so" 408 deps = [ ":dlopen_load_so_1" ] 409 subsystem_name = "musl" 410 part_name = "libc-gtest-lib" 411} 412 413ohos_shared_library("dlopen_test_dependency_1_1_invalid") { 414 include_dirs = [ "." ] 415 sources = [ "ldso_empty.c" ] 416 output_name = "dlopen_test_dependency_1_1_invalid" 417 output_extension = "so" 418 ldflags = [ "-Wl,-soname=libdlopen_test_dependency_1_1.so" ] 419 subsystem_name = "musl" 420 part_name = "libc-gtest-lib" 421} 422 423ohos_shared_library("dlopen_test_dependency_1_1") { 424 include_dirs = [ "." ] 425 sources = [ "dlopen_test_dependency_1_1.c" ] 426 output_name = "dlopen_test_dependency_1_1" 427 output_extension = "so" 428 deps = [ ":dlopen_test_dependency_1_1_1" ] 429 subsystem_name = "musl" 430 part_name = "libc-gtest-lib" 431} 432 433ohos_shared_library("dlopen_test_dependency_1_1_1") { 434 include_dirs = [ "." ] 435 sources = [ "dlopen_test_dependency_1_1_1.c" ] 436 output_name = "dlopen_test_dependency_1_1_1" 437 output_extension = "so" 438 deps = [ ":dlopen_test_dependency_1" ] 439 subsystem_name = "musl" 440 part_name = "libc-gtest-lib" 441} 442 443ohos_shared_library("dlopen_test_dependency_1") { 444 include_dirs = [ "." ] 445 sources = [ "dlopen_test_dependency_1.c" ] 446 output_name = "dlopen_test_dependency_1" 447 output_extension = "so" 448 deps = [ ":dlopen_test_dependency_1_1_invalid" ] 449 subsystem_name = "musl" 450 part_name = "libc-gtest-lib" 451} 452 453ohos_shared_library("dlopen_test_dependency") { 454 include_dirs = [ "." ] 455 sources = [ "dlopen_test_dependency.c" ] 456 output_name = "dlopen_test_dependency" 457 output_extension = "so" 458 deps = [ ":dlopen_test_dependency_1" ] 459 subsystem_name = "musl" 460 part_name = "libc-gtest-lib" 461} 462 463ohos_shared_library("dlopen_nodelete") { 464 include_dirs = [ "." ] 465 sources = [ "dlopen_nodelete.c" ] 466 output_name = "dlopen_nodelete" 467 output_extension = "so" 468 subsystem_name = "musl" 469 part_name = "libc-gtest-lib" 470} 471 472ohos_shared_library("dlopen_nodelete_1") { 473 include_dirs = [ "." ] 474 sources = [ "dlopen_nodelete.c" ] 475 output_name = "dlopen_nodelete_1" 476 output_extension = "so" 477 ldflags = [ "-Wl,-z,nodelete" ] 478 subsystem_name = "musl" 479 part_name = "libc-gtest-lib" 480} 481 482ohos_shared_library("dlopen_init_finalize") { 483 include_dirs = [ "." ] 484 sources = [ "dlopen_init_finalize.c" ] 485 output_name = "dlopen_init_finalize" 486 output_extension = "so" 487 deps = [ 488 ":dlopen_init_finalize_1", 489 ":dlopen_init_finalize_2", 490 ] 491 subsystem_name = "musl" 492 part_name = "libc-gtest-lib" 493} 494 495ohos_shared_library("dlopen_init_finalize_1") { 496 include_dirs = [ "." ] 497 sources = [ "dlopen_init_finalize_1.c" ] 498 output_name = "dlopen_init_finalize_1" 499 output_extension = "so" 500 deps = [ ":dlopen_init_finalize_2" ] 501 subsystem_name = "musl" 502 part_name = "libc-gtest-lib" 503} 504 505ohos_shared_library("dlopen_init_finalize_2") { 506 include_dirs = [ "." ] 507 sources = [ "dlopen_init_finalize_2.c" ] 508 output_name = "dlopen_init_finalize_2" 509 output_extension = "so" 510 subsystem_name = "musl" 511 part_name = "libc-gtest-lib" 512} 513 514ohos_shared_library("dlopen_gnu_hash") { 515 include_dirs = [ "." ] 516 sources = [ "dlopen_common.c" ] 517 output_name = "dlopen_gnu_hash" 518 output_extension = "so" 519 ldflags = [ "-Wl,--hash-style=gnu" ] 520 subsystem_name = "musl" 521 part_name = "libc-gtest-lib" 522} 523 524ohos_shared_library("dlopen_sysv_hash") { 525 include_dirs = [ "." ] 526 sources = [ "dlopen_common.c" ] 527 output_name = "dlopen_sysv_hash" 528 output_extension = "so" 529 ldflags = [ "-Wl,--hash-style=sysv" ] 530 subsystem_name = "musl" 531 part_name = "libc-gtest-lib" 532} 533 534ohos_shared_library("dlopen_global") { 535 include_dirs = [ "." ] 536 sources = [ "dlopen_common.c" ] 537 output_name = "dlopen_global" 538 output_extension = "so" 539 ldflags = [ "-Wl,-z,global" ] 540 subsystem_name = "musl" 541 part_name = "libc-gtest-lib" 542} 543 544ohos_shared_library("dlopen_rpath") { 545 include_dirs = [ "." ] 546 sources = [ "dlopen_005.c" ] 547 output_name = "dlopen_rpath" 548 output_extension = "so" 549 deps = [ 550 ":dlopen_rpath_1", 551 ":dlopen_rpath_2", 552 ] 553 ldflags = [ 554 "-Wl,-rpath=${root_libs_dir}/rpath-test/", 555 "-Wl,--enable-new-dtags", 556 ] 557 subsystem_name = "musl" 558 part_name = "libc-gtest-lib" 559} 560 561ohos_shared_library("dlopen_rpath_1") { 562 include_dirs = [ "." ] 563 sources = [ "dlopen_005_1.c" ] 564 output_name = "dlopen_rpath_1" 565 output_extension = "so" 566 deps = [ 567 ":dlopen_rpath_1_1", 568 ":dlopen_rpath_1_2", 569 ] 570 ldflags = [ "-Wl,-rpath=${root_libs_dir}/rpath-test/" ] 571 subsystem_name = "musl" 572 part_name = "libc-gtest-lib" 573} 574 575ohos_shared_library("dlopen_rpath_2") { 576 include_dirs = [ "." ] 577 sources = [ "dlopen_005_2.c" ] 578 output_name = "dlopen_rpath_2" 579 output_extension = "so" 580 deps = [ ":dlopen_rpath_2_1" ] 581 ldflags = [ "-Wl,-rpath=${root_libs_dir}/rpath-test/" ] 582 subsystem_name = "musl" 583 part_name = "libc-gtest-lib" 584} 585 586ohos_shared_library("dlopen_rpath_1_1") { 587 include_dirs = [ "." ] 588 sources = [ "dlopen_005_1_1.c" ] 589 output_name = "dlopen_rpath_1_1" 590 output_extension = "so" 591 subsystem_name = "musl" 592 part_name = "libc-gtest-lib" 593} 594 595ohos_shared_library("dlopen_rpath_1_2") { 596 include_dirs = [ "." ] 597 sources = [ "dlopen_005_1_2.c" ] 598 output_name = "dlopen_rpath_1_2" 599 output_extension = "so" 600 subsystem_name = "musl" 601 part_name = "libc-gtest-lib" 602} 603 604ohos_shared_library("dlopen_rpath_2_1") { 605 include_dirs = [ "." ] 606 sources = [ "dlopen_005_2_1.c" ] 607 output_name = "dlopen_rpath_2_1" 608 output_extension = "so" 609 subsystem_name = "musl" 610 part_name = "libc-gtest-lib" 611} 612 613ohos_shared_library("dlopen_common_close") { 614 include_dirs = [ "." ] 615 sources = [ "dlopen_common.c" ] 616 output_name = "dlopen_common_close" 617 output_extension = "so" 618 subsystem_name = "musl" 619 part_name = "libc-gtest-lib" 620} 621 622ohos_shared_library("ldso_dlclose_test_a") { 623 include_dirs = [ "." ] 624 sources = [ "ldso_dlclose_test_a.c" ] 625 deps = [ 626 ":ldso_dlclose_test_b", 627 ":ldso_dlclose_test_c", 628 ] 629 output_name = "ldso_dlclose_test_a" 630 output_extension = "so" 631 subsystem_name = "musl" 632 part_name = "libc-gtest-lib" 633} 634 635ohos_shared_library("ldso_dlclose_test_b") { 636 include_dirs = [ "." ] 637 sources = [ "ldso_dlclose_test_b.c" ] 638 output_name = "ldso_dlclose_test_b" 639 output_extension = "so" 640 subsystem_name = "musl" 641 part_name = "libc-gtest-lib" 642} 643 644ohos_shared_library("ldso_dlclose_test_c") { 645 include_dirs = [ "." ] 646 sources = [ "ldso_dlclose_test_c.c" ] 647 deps = [ ":ldso_dlclose_test_b" ] 648 output_name = "ldso_dlclose_test_c" 649 output_extension = "so" 650 subsystem_name = "musl" 651 part_name = "libc-gtest-lib" 652} 653 654ohos_shared_library("ldso_thread_test") { 655 include_dirs = [ "." ] 656 sources = [ "ldso_thread_test.cpp" ] 657 output_name = "ldso_thread_test" 658 output_extension = "so" 659 subsystem_name = "musl" 660 part_name = "libc-gtest-lib" 661} 662 663ohos_shared_library("ldso_thread_test_1") { 664 include_dirs = [ "." ] 665 sources = [ "ldso_thread_test_1.cpp" ] 666 output_name = "ldso_thread_test_1" 667 output_extension = "so" 668 subsystem_name = "musl" 669 part_name = "libc-gtest-lib" 670} 671 672ohos_shared_library("ldso_thread_test_2") { 673 include_dirs = [ "." ] 674 sources = [ "ldso_thread_test_2.cpp" ] 675 output_name = "ldso_thread_test_2" 676 output_extension = "so" 677 deps = [ 678 ":ldso_thread_test", 679 ":ldso_thread_test_1", 680 ] 681 subsystem_name = "musl" 682 part_name = "libc-gtest-lib" 683} 684 685ohos_shared_library("dlopen_common_relro") { 686 include_dirs = [ "." ] 687 sources = [ "dlopen_common.c" ] 688 output_name = "dlopen_common_relro" 689 output_extension = "so" 690 ldflags = [ "-Wl,-z,relro" ] 691 subsystem_name = "musl" 692 part_name = "libc-gtest-lib" 693} 694 695ohos_shared_library("ldso_relro_test") { 696 include_dirs = [ "." ] 697 sources = [ "ldso_relro_test.c" ] 698 output_name = "ldso_relro_test" 699 output_extension = "so" 700 deps = [ ":dlopen_common" ] 701 ldflags = [ "-Wl,-z,relro" ] 702 subsystem_name = "musl" 703 part_name = "libc-gtest-lib" 704} 705 706ohos_shared_library("ldso_relro_recursive_test") { 707 include_dirs = [ "." ] 708 sources = [ "ldso_relro_recursive_test.c" ] 709 output_name = "ldso_relro_recursive_test" 710 output_extension = "so" 711 deps = [ ":ldso_relro_test" ] 712 ldflags = [ "-Wl,-z,relro" ] 713 subsystem_name = "musl" 714 part_name = "libc-gtest-lib" 715} 716 717ohos_shared_library("ldso_norelro_test") { 718 include_dirs = [ "." ] 719 sources = [ "ldso_relro_test.c" ] 720 output_name = "ldso_norelro_test" 721 output_extension = "so" 722 deps = [ ":dlopen_common" ] 723 ldflags = [ "-Wl,-z,norelro" ] 724 subsystem_name = "musl" 725 part_name = "libc-gtest-lib" 726} 727 728ohos_shared_library("ldso_ns_root") { 729 include_dirs = [ "." ] 730 sources = [ "ldso_ns_root.c" ] 731 output_name = "ldso_ns_root" 732 output_extension = "so" 733 deps = [ 734 ":ldso_ns_one", 735 ":ldso_ns_two", 736 ] 737 subsystem_name = "musl" 738 part_name = "libc-gtest-lib" 739} 740 741ohos_shared_library("ldso_ns_one") { 742 include_dirs = [ "." ] 743 sources = [ "ldso_ns_one.c" ] 744 output_name = "ldso_ns_one" 745 output_extension = "so" 746 deps = [ ":ldso_ns_one_impl" ] 747 subsystem_name = "musl" 748 part_name = "libc-gtest-lib" 749} 750 751ohos_shared_library("ldso_ns_one_impl") { 752 include_dirs = [ "." ] 753 sources = [ "ldso_ns_one_impl.c" ] 754 output_name = "ldso_ns_one_impl" 755 output_extension = "so" 756 subsystem_name = "musl" 757 part_name = "libc-gtest-lib" 758} 759 760ohos_shared_library("ldso_ns_two") { 761 include_dirs = [ "." ] 762 sources = [ "ldso_ns_two.c" ] 763 output_name = "ldso_ns_two" 764 output_extension = "so" 765 subsystem_name = "musl" 766 part_name = "libc-gtest-lib" 767} 768 769ohos_shared_library("ldso_ns_no_symbol") { 770 include_dirs = [ "." ] 771 sources = [ "ldso_ns_no_symbol.c" ] 772 output_name = "ldso_ns_no_symbol" 773 output_extension = "so" 774 ldflags = [ "-Wl,--allow-shlib-undefined" ] 775 subsystem_name = "musl" 776 part_name = "libc-gtest-lib" 777} 778 779ohos_shared_library("ldso_ns_test_permitted_root") { 780 include_dirs = [ "." ] 781 sources = [ "ldso_ns_root.c" ] 782 output_name = "ldso_ns_test_permitted_root" 783 output_extension = "so" 784 deps = [ 785 ":ldso_ns_one", 786 ":ldso_ns_two_impl", 787 ] 788 ldflags = [ 789 "-Wl,-rpath=${root_libs_dir}/namespace_two_impl_libs/", 790 "-Wl,--enable-new-dtags", 791 ] 792 subsystem_name = "musl" 793 part_name = "libc-gtest-lib" 794} 795 796ohos_shared_library("ldso_ns_two_impl") { 797 include_dirs = [ "." ] 798 sources = [ "ldso_ns_two.c" ] 799 output_name = "ldso_ns_two_impl" 800 output_extension = "so" 801 subsystem_name = "musl" 802 part_name = "libc-gtest-lib" 803} 804 805ohos_shared_library("dlopen_zip_test") { 806 include_dirs = [ "." ] 807 sources = [ "dlopen_common.c" ] 808 output_name = "dlopen_zip_test" 809 output_extension = "so" 810 subsystem_name = "musl" 811 part_name = "libc-gtest-lib" 812} 813 814action("copy_zip_lib") { 815 script = "//third_party/musl/scripts/copy_libs.sh" 816 817 libs_dir = [] 818 if ("${musl_arch}" == "arm") { 819 libs_dir += [ "//third_party/musl/libc-test/src/functionalext/supplement/ldso/ldso_gtest/libs/ziplibs_32" ] 820 } else if ("${musl_arch}" == "aarch64") { 821 libs_dir += [ "//third_party/musl/libc-test/src/functionalext/supplement/ldso/ldso_gtest/libs/ziplibs_64" ] 822 } 823 824 target_dir = [ "${root_out_dir}/musl/libc-gtest-lib" ] 825 826 outputs = [ "$target_out_dir" ] 827 828 args = [ "-i" ] + rebase_path(libs_dir) 829 args += [ "-o" ] + rebase_path(target_dir) 830 831 deps = [ 832 ":dlopen_common", 833 ":dlopen_rpath", 834 ] 835} 836 837ohos_shared_library("ldso_dlsym_dependent") { 838 include_dirs = [ "." ] 839 840 sources = [ "ldso_dlsym_dependent.c" ] 841 842 output_name = "ldso_dlsym_dependent" 843 844 output_extension = "so" 845 846 deps = [ ":ldso_dlsym_dependent_impl" ] 847 848 subsystem_name = "musl" 849 part_name = "libc-gtest-lib" 850} 851 852ohos_shared_library("ldso_dlsym_dependent_impl") { 853 include_dirs = [ "." ] 854 855 sources = [ "ldso_dlsym_dependent_impl.c" ] 856 857 output_name = "ldso_dlsym_dependent_impl" 858 859 output_extension = "so" 860 861 subsystem_name = "musl" 862 part_name = "libc-gtest-lib" 863} 864 865ohos_shared_library("empty") { 866 include_dirs = [ "." ] 867 868 sources = [ "ldso_empty.c" ] 869 870 output_name = "empty" 871 872 output_extension = "so" 873 874 subsystem_name = "musl" 875 part_name = "libc-gtest-lib" 876} 877 878ohos_shared_library("dlsym_get_answer") { 879 include_dirs = [ "." ] 880 881 sources = [ "ldso_dlsym_get_answer.c" ] 882 883 output_name = "dlsym_get_answer" 884 885 deps = [ ":dlsym_get_symbol_impl" ] 886 887 output_extension = "so" 888 889 subsystem_name = "musl" 890 part_name = "libc-gtest-lib" 891} 892 893ohos_shared_library("dlsym_get_symbol_impl") { 894 include_dirs = [ "." ] 895 896 sources = [ "ldso_dlsym_get_symbol_impl.c" ] 897 898 output_name = "dlsym_get_symbol_impl" 899 900 output_extension = "so" 901 902 subsystem_name = "musl" 903 part_name = "libc-gtest-lib" 904} 905 906ohos_shared_library("dlsym_get_symbol") { 907 include_dirs = [ "." ] 908 909 sources = [ "ldso_dlsym_get_symbol.c" ] 910 911 output_name = "dlsym_get_symbol" 912 913 output_extension = "so" 914 915 deps = [ ":dlsym_get_symbol_impl" ] 916 917 subsystem_name = "musl" 918 part_name = "libc-gtest-lib" 919} 920 921ohos_shared_library("test_so") { 922 include_dirs = [ "." ] 923 924 sources = [ "ldso_test_so.c" ] 925 926 output_name = "test_so" 927 928 output_extension = "so" 929 930 cflags = [ "-Wl,-Bstatic -lempty.so" ] 931 932 subsystem_name = "musl" 933 part_name = "libc-gtest-lib" 934} 935 936ohos_shared_library("dlsym_weak_func") { 937 include_dirs = [ "." ] 938 939 sources = [ "ldso_dlsym_weak_func.c" ] 940 941 output_name = "dlsym_weak_func" 942 943 output_extension = "so" 944 945 subsystem_name = "musl" 946 part_name = "libc-gtest-lib" 947} 948 949ohos_shared_library("dlsym_weak_func_undefined") { 950 include_dirs = [ "." ] 951 952 sources = [ "ldso_dlsym_weak_func_undefined.c" ] 953 954 output_name = "dlsym_weak_func_undefined" 955 956 output_extension = "so" 957 958 subsystem_name = "musl" 959 part_name = "libc-gtest-lib" 960} 961 962ohos_shared_library("dlsym_lib_use_rtld_next") { 963 include_dirs = [ "." ] 964 965 sources = [ "ldso_dlsym_lib_use_rtld_next.c" ] 966 967 output_name = "dlsym_lib_use_rtld_next" 968 969 output_extension = "so" 970 971 subsystem_name = "musl" 972 part_name = "libc-gtest-lib" 973} 974 975ohos_shared_library("dlsym_global_symbol") { 976 include_dirs = [ "." ] 977 978 sources = [ "ldso_dlsym_global_symbol.c" ] 979 980 output_name = "dlsym_global_symbol" 981 982 output_extension = "so" 983 984 ldflags = [ 985 "-Wl,-z,global", 986 "-fuse-ld=bfd", 987 ] 988 subsystem_name = "musl" 989 part_name = "libc-gtest-lib" 990} 991 992ohos_shared_library("dlsym_to_use_global_symbol") { 993 include_dirs = [ "." ] 994 995 sources = [ "ldso_dlsym_to_use_global_symbol.c" ] 996 997 output_name = "dlsym_to_use_global_symbol" 998 999 output_extension = "so" 1000 1001 subsystem_name = "musl" 1002 part_name = "libc-gtest-lib" 1003} 1004 1005ohos_shared_library("dlsym_symbol_v1") { 1006 include_dirs = [ "." ] 1007 1008 sources = [ "ldso_dlsym_symbol_v1.c" ] 1009 1010 output_name = "dlsym_symbol_v1" 1011 1012 output_extension = "so" 1013 1014 version_script = "dlsym_symbol_v1.map" 1015 1016 subsystem_name = "musl" 1017 part_name = "libc-gtest-lib" 1018} 1019 1020ohos_shared_library("dlsym_symbol_version_2") { 1021 include_dirs = [ "." ] 1022 1023 sources = [ "ldso_dlsym_symbol_v2.c" ] 1024 1025 output_name = "dlsym_symbol_version_2" 1026 1027 output_extension = "so" 1028 1029 version_script = "dlsym_symbol_v2.map" 1030 1031 subsystem_name = "musl" 1032 part_name = "libc-gtest-lib" 1033} 1034 1035ohos_shared_library("dlsym_symbol_version_3") { 1036 include_dirs = [ "." ] 1037 1038 sources = [ "ldso_dlsym_symbol_v3.c" ] 1039 1040 output_name = "dlsym_symbol_version_3" 1041 1042 version_script = "dlsym_symbol_v3.map" 1043 1044 output_extension = "so" 1045 1046 subsystem_name = "musl" 1047 part_name = "libc-gtest-lib" 1048} 1049 1050ohos_shared_library("dlsym_symbol_impl_v1") { 1051 include_dirs = [ "." ] 1052 1053 sources = [ "ldso_dlsym_symbol_impl.c" ] 1054 1055 output_name = "dlsym_symbol_impl_v1" 1056 1057 output_extension = "so" 1058 1059 deps = [ ":dlsym_symbol_v1" ] 1060 1061 subsystem_name = "musl" 1062 part_name = "libc-gtest-lib" 1063} 1064 1065ohos_shared_library("dlsym_symbol_impl_v2") { 1066 include_dirs = [ "." ] 1067 1068 sources = [ "ldso_dlsym_symbol_impl.c" ] 1069 1070 output_name = "dlsym_symbol_impl_v2" 1071 1072 output_extension = "so" 1073 1074 deps = [ ":dlsym_symbol_version_2" ] 1075 1076 subsystem_name = "musl" 1077 part_name = "libc-gtest-lib" 1078} 1079 1080ohos_shared_library("dlsym_symbol_v2_second") { 1081 include_dirs = [ "." ] 1082 1083 sources = [ "ldso_dlsym_symbol_v2_second.c" ] 1084 1085 output_name = "dlsym_symbol_v2_second" 1086 1087 output_extension = "so" 1088 1089 version_script = "dlsym_symbol_v2_second.map" 1090 1091 subsystem_name = "musl" 1092 part_name = "libc-gtest-lib" 1093} 1094 1095ohos_shared_library("dlsym_symbol_v2_relro") { 1096 include_dirs = [ "." ] 1097 1098 sources = [ "ldso_dlsym_symbol_impl.c" ] 1099 1100 output_name = "dlsym_symbol_v2_relro" 1101 1102 output_extension = "so" 1103 1104 deps = [ 1105 ":dlsym_symbol_v2_second", 1106 ":dlsym_symbol_version_2", 1107 ] 1108 1109 subsystem_name = "musl" 1110 part_name = "libc-gtest-lib" 1111} 1112 1113ohos_shared_library("dlsym_symbol_v3_relro") { 1114 include_dirs = [ "." ] 1115 1116 sources = [ "ldso_dlsym_symbol_impl.c" ] 1117 1118 output_name = "dlsym_symbol_v3_relro" 1119 1120 output_extension = "so" 1121 1122 deps = [ 1123 ":dlsym_symbol_version_3", 1124 ":dlsym_symbol_version_empty", 1125 ] 1126 1127 subsystem_name = "musl" 1128 part_name = "libc-gtest-lib" 1129} 1130 1131ohos_shared_library("dlsym_symbol_version_empty") { 1132 include_dirs = [ "." ] 1133 1134 sources = [ "ldso_empty.c" ] 1135 1136 output_name = "dlsym_symbol_version_empty" 1137 1138 output_extension = "so" 1139 1140 ldflags = [ "-Wl,-soname,dlsym_symbol_v2_second.so" ] 1141 1142 subsystem_name = "musl" 1143 part_name = "libc-gtest-lib" 1144} 1145 1146ohos_shared_library("ldso_ns_empty") { 1147 include_dirs = [ "." ] 1148 sources = [ "ldso_empty.c" ] 1149 output_name = "ldso_ns_empty" 1150 output_extension = "so" 1151 subsystem_name = "musl" 1152 part_name = "libc-gtest-lib" 1153} 1154 1155ohos_shared_library("ldso_cfi_lib") { 1156 include_dirs = [ "." ] 1157 sources = [ "ldso_cfi_lib.c" ] 1158 output_name = "ldso_cfi_lib" 1159 output_extension = "so" 1160 subsystem_name = "musl" 1161 part_name = "libc-gtest-lib" 1162} 1163 1164ohos_shared_library("ldso_cfi_lib_exit") { 1165 include_dirs = [ "." ] 1166 sources = [ "ldso_cfi_lib.c" ] 1167 output_name = "ldso_cfi_lib_exit" 1168 output_extension = "so" 1169 subsystem_name = "musl" 1170 part_name = "libc-gtest-lib" 1171} 1172