1// https://ci.android.com/builds/latest/branches/aosp-build-tools/targets/linux/view/soong_build.html 2 3cc_defaults { 4 name: "llvmlibc_defaults", 5 cppflags: [ 6 // Necessary to build. 7 "-DLIBC_NAMESPACE=llvmlibc", 8 ], 9 arch: { 10 // TODO: https://github.com/llvm/llvm-project/issues/93709 11 // llvm-libc does not (yet) support 32b x86. 12 x86: { 13 enabled: false, 14 }, 15 // TODO: https://github.com/llvm/llvm-project/issues/93738 16 // llvm-libc does not (yet) support --target=armv7a-linux -mthumb 17 arm: { 18 cppflags: ["-marm"], 19 }, 20 }, 21} 22 23cc_library_static { 24 name: "llvmlibc", 25 defaults: ["llvmlibc_defaults"], 26 visibility: [ 27 "//bionic/libc", 28 ], 29 include_dirs: [ 30 "external/llvm-libc", 31 ], 32 srcs: [ 33 "src/stdlib/bsearch.cpp", 34 ], 35 cppflags: [ 36 // Necessary for non-namespaced exports. 37 "-DLIBC_COPT_PUBLIC_PACKAGING", 38 ], 39 // No C++ runtime. 40 stl: "none", 41 // No crt_begin and crt_end. 42 nocrt: true, 43 // Needs to be unset from the default value in order to avoid creating a 44 // cyclic dependency between llvm-libc and bionic's libc. 45 system_shared_libs: [], 46 47 // Bionic's libc's dependencies must have these set, or the build will fail 48 // due to missing a "ramdisk", "vendor_ramdisk", and "recovery" variants. 49 native_bridge_supported: true, 50 ramdisk_available: true, 51 recovery_available: true, 52 vendor_ramdisk_available: true, 53 54 // Bionic's dependencies must also set this. 55 apex_available: ["com.android.runtime"], 56 57 // When llvm-libc includes <stdlib.h>, use bionic's headers for these. 58 header_libs: ["libc_headers"], 59} 60 61cc_test_library { 62 name: "llvmlibc_test_harness", 63 defaults: ["llvmlibc_defaults"], 64 srcs: [ 65 "test/UnitTest/LibcTest.cpp", 66 "test/UnitTest/TestLogger.cpp", 67 "test/UnitTest/LibcTestMain.cpp", 68 ], 69} 70 71cc_defaults { 72 name: "llvmlibc_test_defaults", 73 defaults: ["llvmlibc_defaults"], 74 static_libs: [ 75 "llvmlibc", 76 "llvmlibc_test_harness", 77 ], 78 // Do not try to link against gtest. llvm-libc has its own pseudo-gtest 79 // framework. 80 gtest: false, 81 // Needed to avoid the diagnostic: 82 // WARNING: Please add {test name} to either suite: 83 // ['device-tests', 'general-tests'] for this TEST_MAPPING file to work 84 // with TreeHugger. 85 test_suites: ["device-tests"], 86} 87 88cc_test { 89 name: "llvmlibc_stdlib_bsearch_test", 90 defaults: ["llvmlibc_test_defaults"], 91 srcs: ["test/src/stdlib/bsearch_test.cpp"], 92} 93