Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 1 | // Copyright (C) 2019 The Android Open Source Project |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
| 15 | package cc |
| 16 | |
| 17 | import ( |
| 18 | "android/soong/android" |
| 19 | ) |
| 20 | |
Paul Duffin | 77980a8 | 2019-12-19 16:01:36 +0000 | [diff] [blame] | 21 | func RegisterRequiredBuildComponentsForTest(ctx android.RegistrationContext) { |
Paul Duffin | d686791 | 2019-12-19 14:38:36 +0000 | [diff] [blame] | 22 | RegisterPrebuiltBuildComponents(ctx) |
Paul Duffin | 036e700 | 2019-12-19 19:16:28 +0000 | [diff] [blame] | 23 | RegisterCCBuildComponents(ctx) |
Paul Duffin | 2ee6979 | 2020-01-16 12:14:42 +0000 | [diff] [blame] | 24 | RegisterBinaryBuildComponents(ctx) |
Paul Duffin | 6c26dc7 | 2019-12-19 15:02:40 +0000 | [diff] [blame] | 25 | RegisterLibraryBuildComponents(ctx) |
Paul Duffin | 1c6c1c7 | 2020-02-21 10:28:43 +0000 | [diff] [blame] | 26 | RegisterLibraryHeadersBuildComponents(ctx) |
Paul Duffin | 6c26dc7 | 2019-12-19 15:02:40 +0000 | [diff] [blame] | 27 | |
| 28 | ctx.RegisterModuleType("toolchain_library", ToolchainLibraryFactory) |
| 29 | ctx.RegisterModuleType("llndk_library", LlndkLibraryFactory) |
| 30 | ctx.RegisterModuleType("cc_object", ObjectFactory) |
Martin Stjernholm | 7feceb2 | 2020-07-11 04:33:29 +0100 | [diff] [blame] | 31 | ctx.RegisterModuleType("cc_genrule", genRuleFactory) |
Colin Cross | f28329d | 2020-02-15 11:00:10 -0800 | [diff] [blame] | 32 | ctx.RegisterModuleType("ndk_prebuilt_shared_stl", NdkPrebuiltSharedStlFactory) |
| 33 | ctx.RegisterModuleType("ndk_prebuilt_object", NdkPrebuiltObjectFactory) |
Dan Albert | de5aade | 2020-06-30 12:32:51 -0700 | [diff] [blame] | 34 | ctx.RegisterModuleType("ndk_library", NdkLibraryFactory) |
Paul Duffin | 77980a8 | 2019-12-19 16:01:36 +0000 | [diff] [blame] | 35 | } |
| 36 | |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 37 | func GatherRequiredDepsForTest(oses ...android.OsType) string { |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 38 | ret := ` |
| 39 | toolchain_library { |
| 40 | name: "libatomic", |
Martin Stjernholm | 7feceb2 | 2020-07-11 04:33:29 +0100 | [diff] [blame] | 41 | defaults: ["linux_bionic_supported"], |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 42 | vendor_available: true, |
| 43 | recovery_available: true, |
Colin Cross | f9aabd7 | 2020-02-15 11:29:50 -0800 | [diff] [blame] | 44 | native_bridge_supported: true, |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 45 | src: "", |
| 46 | } |
| 47 | |
| 48 | toolchain_library { |
| 49 | name: "libcompiler_rt-extras", |
| 50 | vendor_available: true, |
| 51 | recovery_available: true, |
| 52 | src: "", |
| 53 | } |
| 54 | |
| 55 | toolchain_library { |
| 56 | name: "libclang_rt.builtins-arm-android", |
| 57 | vendor_available: true, |
| 58 | recovery_available: true, |
Colin Cross | f9aabd7 | 2020-02-15 11:29:50 -0800 | [diff] [blame] | 59 | native_bridge_supported: true, |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 60 | src: "", |
| 61 | } |
| 62 | |
| 63 | toolchain_library { |
| 64 | name: "libclang_rt.builtins-aarch64-android", |
| 65 | vendor_available: true, |
| 66 | recovery_available: true, |
Colin Cross | f9aabd7 | 2020-02-15 11:29:50 -0800 | [diff] [blame] | 67 | native_bridge_supported: true, |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 68 | src: "", |
| 69 | } |
| 70 | |
Jooyung Han | 7556839 | 2020-03-20 04:29:24 +0900 | [diff] [blame] | 71 | cc_prebuilt_library_shared { |
| 72 | name: "libclang_rt.hwasan-aarch64-android", |
| 73 | nocrt: true, |
| 74 | vendor_available: true, |
| 75 | recovery_available: true, |
| 76 | system_shared_libs: [], |
| 77 | stl: "none", |
| 78 | srcs: [""], |
| 79 | check_elf_files: false, |
| 80 | sanitize: { |
| 81 | never: true, |
| 82 | }, |
| 83 | } |
| 84 | |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 85 | toolchain_library { |
| 86 | name: "libclang_rt.builtins-i686-android", |
| 87 | vendor_available: true, |
| 88 | recovery_available: true, |
Colin Cross | f9aabd7 | 2020-02-15 11:29:50 -0800 | [diff] [blame] | 89 | native_bridge_supported: true, |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 90 | src: "", |
| 91 | } |
| 92 | |
| 93 | toolchain_library { |
| 94 | name: "libclang_rt.builtins-x86_64-android", |
Martin Stjernholm | 7feceb2 | 2020-07-11 04:33:29 +0100 | [diff] [blame] | 95 | defaults: ["linux_bionic_supported"], |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 96 | vendor_available: true, |
| 97 | recovery_available: true, |
Colin Cross | f9aabd7 | 2020-02-15 11:29:50 -0800 | [diff] [blame] | 98 | native_bridge_supported: true, |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 99 | src: "", |
| 100 | } |
| 101 | |
| 102 | toolchain_library { |
Mitch Phillips | da9a463 | 2019-07-15 09:34:09 -0700 | [diff] [blame] | 103 | name: "libclang_rt.fuzzer-arm-android", |
| 104 | vendor_available: true, |
| 105 | recovery_available: true, |
| 106 | src: "", |
| 107 | } |
| 108 | |
| 109 | toolchain_library { |
| 110 | name: "libclang_rt.fuzzer-aarch64-android", |
| 111 | vendor_available: true, |
| 112 | recovery_available: true, |
| 113 | src: "", |
| 114 | } |
| 115 | |
| 116 | toolchain_library { |
| 117 | name: "libclang_rt.fuzzer-i686-android", |
| 118 | vendor_available: true, |
| 119 | recovery_available: true, |
| 120 | src: "", |
| 121 | } |
| 122 | |
| 123 | toolchain_library { |
| 124 | name: "libclang_rt.fuzzer-x86_64-android", |
Martin Stjernholm | 7feceb2 | 2020-07-11 04:33:29 +0100 | [diff] [blame] | 125 | defaults: ["linux_bionic_supported"], |
Mitch Phillips | da9a463 | 2019-07-15 09:34:09 -0700 | [diff] [blame] | 126 | vendor_available: true, |
| 127 | recovery_available: true, |
| 128 | src: "", |
| 129 | } |
| 130 | |
| 131 | toolchain_library { |
| 132 | name: "libclang_rt.fuzzer-x86_64", |
| 133 | vendor_available: true, |
| 134 | recovery_available: true, |
| 135 | src: "", |
| 136 | } |
| 137 | |
Paul Duffin | d686791 | 2019-12-19 14:38:36 +0000 | [diff] [blame] | 138 | // Needed for sanitizer |
| 139 | cc_prebuilt_library_shared { |
| 140 | name: "libclang_rt.ubsan_standalone-aarch64-android", |
| 141 | vendor_available: true, |
| 142 | recovery_available: true, |
Colin Cross | f9aabd7 | 2020-02-15 11:29:50 -0800 | [diff] [blame] | 143 | system_shared_libs: [], |
Paul Duffin | d686791 | 2019-12-19 14:38:36 +0000 | [diff] [blame] | 144 | srcs: [""], |
| 145 | } |
| 146 | |
Mitch Phillips | da9a463 | 2019-07-15 09:34:09 -0700 | [diff] [blame] | 147 | toolchain_library { |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 148 | name: "libgcc", |
Martin Stjernholm | 7feceb2 | 2020-07-11 04:33:29 +0100 | [diff] [blame] | 149 | defaults: ["linux_bionic_supported"], |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 150 | vendor_available: true, |
| 151 | recovery_available: true, |
| 152 | src: "", |
| 153 | } |
| 154 | |
Yi Kong | acee27c | 2019-03-29 20:05:14 -0700 | [diff] [blame] | 155 | toolchain_library { |
| 156 | name: "libgcc_stripped", |
Martin Stjernholm | 7feceb2 | 2020-07-11 04:33:29 +0100 | [diff] [blame] | 157 | defaults: ["linux_bionic_supported"], |
Yi Kong | acee27c | 2019-03-29 20:05:14 -0700 | [diff] [blame] | 158 | vendor_available: true, |
| 159 | recovery_available: true, |
Colin Cross | c511bc5 | 2020-04-07 16:50:32 +0000 | [diff] [blame] | 160 | sdk_version: "current", |
Yi Kong | acee27c | 2019-03-29 20:05:14 -0700 | [diff] [blame] | 161 | src: "", |
| 162 | } |
| 163 | |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 164 | cc_library { |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 165 | name: "libc", |
Martin Stjernholm | 7feceb2 | 2020-07-11 04:33:29 +0100 | [diff] [blame] | 166 | defaults: ["linux_bionic_supported"], |
Yi Kong | e7fe991 | 2019-06-02 00:53:50 -0700 | [diff] [blame] | 167 | no_libcrt: true, |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 168 | nocrt: true, |
Peter Collingbourne | e5ba286 | 2019-12-10 18:37:45 -0800 | [diff] [blame] | 169 | stl: "none", |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 170 | system_shared_libs: [], |
| 171 | recovery_available: true, |
Colin Cross | f9aabd7 | 2020-02-15 11:29:50 -0800 | [diff] [blame] | 172 | stubs: { |
| 173 | versions: ["27", "28", "29"], |
| 174 | }, |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 175 | } |
| 176 | llndk_library { |
| 177 | name: "libc", |
| 178 | symbol_file: "", |
Colin Cross | c511bc5 | 2020-04-07 16:50:32 +0000 | [diff] [blame] | 179 | sdk_version: "current", |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 180 | } |
| 181 | cc_library { |
| 182 | name: "libm", |
Martin Stjernholm | 7feceb2 | 2020-07-11 04:33:29 +0100 | [diff] [blame] | 183 | defaults: ["linux_bionic_supported"], |
Yi Kong | e7fe991 | 2019-06-02 00:53:50 -0700 | [diff] [blame] | 184 | no_libcrt: true, |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 185 | nocrt: true, |
Peter Collingbourne | e5ba286 | 2019-12-10 18:37:45 -0800 | [diff] [blame] | 186 | stl: "none", |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 187 | system_shared_libs: [], |
| 188 | recovery_available: true, |
Colin Cross | f9aabd7 | 2020-02-15 11:29:50 -0800 | [diff] [blame] | 189 | stubs: { |
| 190 | versions: ["27", "28", "29"], |
| 191 | }, |
| 192 | apex_available: [ |
| 193 | "//apex_available:platform", |
| 194 | "myapex" |
| 195 | ], |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 196 | } |
| 197 | llndk_library { |
| 198 | name: "libm", |
| 199 | symbol_file: "", |
Colin Cross | c511bc5 | 2020-04-07 16:50:32 +0000 | [diff] [blame] | 200 | sdk_version: "current", |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 201 | } |
Ivan Lozano | a0cd8f9 | 2020-04-09 09:56:02 -0400 | [diff] [blame] | 202 | |
| 203 | // Coverage libraries |
| 204 | cc_library { |
| 205 | name: "libprofile-extras", |
| 206 | vendor_available: true, |
| 207 | recovery_available: true, |
| 208 | native_coverage: false, |
| 209 | system_shared_libs: [], |
| 210 | stl: "none", |
| 211 | notice: "custom_notice", |
| 212 | } |
| 213 | cc_library { |
| 214 | name: "libprofile-clang-extras", |
| 215 | vendor_available: true, |
| 216 | recovery_available: true, |
| 217 | native_coverage: false, |
| 218 | system_shared_libs: [], |
| 219 | stl: "none", |
| 220 | notice: "custom_notice", |
| 221 | } |
| 222 | cc_library { |
| 223 | name: "libprofile-extras_ndk", |
| 224 | vendor_available: true, |
| 225 | native_coverage: false, |
| 226 | system_shared_libs: [], |
| 227 | stl: "none", |
| 228 | notice: "custom_notice", |
| 229 | sdk_version: "current", |
| 230 | } |
| 231 | cc_library { |
| 232 | name: "libprofile-clang-extras_ndk", |
| 233 | vendor_available: true, |
| 234 | native_coverage: false, |
| 235 | system_shared_libs: [], |
| 236 | stl: "none", |
| 237 | notice: "custom_notice", |
| 238 | sdk_version: "current", |
| 239 | } |
| 240 | |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 241 | cc_library { |
| 242 | name: "libdl", |
Martin Stjernholm | 7feceb2 | 2020-07-11 04:33:29 +0100 | [diff] [blame] | 243 | defaults: ["linux_bionic_supported"], |
Yi Kong | e7fe991 | 2019-06-02 00:53:50 -0700 | [diff] [blame] | 244 | no_libcrt: true, |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 245 | nocrt: true, |
Peter Collingbourne | e5ba286 | 2019-12-10 18:37:45 -0800 | [diff] [blame] | 246 | stl: "none", |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 247 | system_shared_libs: [], |
| 248 | recovery_available: true, |
Colin Cross | f9aabd7 | 2020-02-15 11:29:50 -0800 | [diff] [blame] | 249 | stubs: { |
| 250 | versions: ["27", "28", "29"], |
| 251 | }, |
| 252 | apex_available: [ |
| 253 | "//apex_available:platform", |
| 254 | "myapex" |
| 255 | ], |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 256 | } |
| 257 | llndk_library { |
| 258 | name: "libdl", |
| 259 | symbol_file: "", |
Colin Cross | c511bc5 | 2020-04-07 16:50:32 +0000 | [diff] [blame] | 260 | sdk_version: "current", |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 261 | } |
| 262 | cc_library { |
Jooyung Han | 097087b | 2019-10-22 19:32:18 +0900 | [diff] [blame] | 263 | name: "libft2", |
| 264 | no_libcrt: true, |
| 265 | nocrt: true, |
| 266 | system_shared_libs: [], |
| 267 | recovery_available: true, |
| 268 | } |
| 269 | llndk_library { |
| 270 | name: "libft2", |
| 271 | symbol_file: "", |
| 272 | vendor_available: false, |
Colin Cross | c511bc5 | 2020-04-07 16:50:32 +0000 | [diff] [blame] | 273 | sdk_version: "current", |
Jooyung Han | 097087b | 2019-10-22 19:32:18 +0900 | [diff] [blame] | 274 | } |
| 275 | cc_library { |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 276 | name: "libc++_static", |
Yi Kong | e7fe991 | 2019-06-02 00:53:50 -0700 | [diff] [blame] | 277 | no_libcrt: true, |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 278 | nocrt: true, |
| 279 | system_shared_libs: [], |
| 280 | stl: "none", |
| 281 | vendor_available: true, |
| 282 | recovery_available: true, |
Inseob Kim | 89db15d | 2020-02-03 18:06:46 +0900 | [diff] [blame] | 283 | host_supported: true, |
Jooyung Han | 749dc69 | 2020-04-15 11:03:39 +0900 | [diff] [blame] | 284 | min_sdk_version: "29", |
Jiyong Park | 541142c | 2020-03-07 16:35:46 +0900 | [diff] [blame] | 285 | apex_available: [ |
| 286 | "//apex_available:platform", |
| 287 | "//apex_available:anyapex", |
| 288 | ], |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 289 | } |
| 290 | cc_library { |
| 291 | name: "libc++", |
Yi Kong | e7fe991 | 2019-06-02 00:53:50 -0700 | [diff] [blame] | 292 | no_libcrt: true, |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 293 | nocrt: true, |
| 294 | system_shared_libs: [], |
| 295 | stl: "none", |
| 296 | vendor_available: true, |
| 297 | recovery_available: true, |
Inseob Kim | 89db15d | 2020-02-03 18:06:46 +0900 | [diff] [blame] | 298 | host_supported: true, |
Jooyung Han | 749dc69 | 2020-04-15 11:03:39 +0900 | [diff] [blame] | 299 | min_sdk_version: "29", |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 300 | vndk: { |
| 301 | enabled: true, |
| 302 | support_system_process: true, |
| 303 | }, |
Colin Cross | f9aabd7 | 2020-02-15 11:29:50 -0800 | [diff] [blame] | 304 | apex_available: [ |
| 305 | "//apex_available:platform", |
| 306 | "myapex" |
| 307 | ], |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 308 | } |
| 309 | cc_library { |
Dan Albert | 2da19cb | 2019-07-24 12:17:40 -0700 | [diff] [blame] | 310 | name: "libc++demangle", |
| 311 | no_libcrt: true, |
| 312 | nocrt: true, |
| 313 | system_shared_libs: [], |
| 314 | stl: "none", |
| 315 | host_supported: false, |
| 316 | vendor_available: true, |
| 317 | recovery_available: true, |
Jooyung Han | 749dc69 | 2020-04-15 11:03:39 +0900 | [diff] [blame] | 318 | min_sdk_version: "29", |
Jiyong Park | 541142c | 2020-03-07 16:35:46 +0900 | [diff] [blame] | 319 | apex_available: [ |
| 320 | "//apex_available:platform", |
| 321 | "//apex_available:anyapex", |
| 322 | ], |
Dan Albert | 2da19cb | 2019-07-24 12:17:40 -0700 | [diff] [blame] | 323 | } |
| 324 | cc_library { |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 325 | name: "libunwind_llvm", |
Yi Kong | e7fe991 | 2019-06-02 00:53:50 -0700 | [diff] [blame] | 326 | no_libcrt: true, |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 327 | nocrt: true, |
| 328 | system_shared_libs: [], |
| 329 | stl: "none", |
| 330 | vendor_available: true, |
| 331 | recovery_available: true, |
| 332 | } |
| 333 | |
Jiyong Park | 541142c | 2020-03-07 16:35:46 +0900 | [diff] [blame] | 334 | cc_defaults { |
| 335 | name: "crt_defaults", |
Martin Stjernholm | 7feceb2 | 2020-07-11 04:33:29 +0100 | [diff] [blame] | 336 | defaults: ["linux_bionic_supported"], |
Jiyong Park | 541142c | 2020-03-07 16:35:46 +0900 | [diff] [blame] | 337 | recovery_available: true, |
| 338 | vendor_available: true, |
| 339 | native_bridge_supported: true, |
| 340 | stl: "none", |
| 341 | apex_available: [ |
| 342 | "//apex_available:platform", |
| 343 | "//apex_available:anyapex", |
| 344 | ], |
| 345 | } |
| 346 | |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 347 | cc_object { |
| 348 | name: "crtbegin_so", |
Jiyong Park | 541142c | 2020-03-07 16:35:46 +0900 | [diff] [blame] | 349 | defaults: ["crt_defaults"], |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 350 | recovery_available: true, |
| 351 | vendor_available: true, |
Colin Cross | f9aabd7 | 2020-02-15 11:29:50 -0800 | [diff] [blame] | 352 | native_bridge_supported: true, |
Jooyung Han | 749dc69 | 2020-04-15 11:03:39 +0900 | [diff] [blame] | 353 | min_sdk_version: "29", |
Jiyong Park | a7bc8ad | 2019-10-15 15:20:07 +0900 | [diff] [blame] | 354 | stl: "none", |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 355 | } |
| 356 | |
| 357 | cc_object { |
Colin Cross | 815daf9 | 2019-05-14 16:05:20 -0700 | [diff] [blame] | 358 | name: "crtbegin_dynamic", |
Jiyong Park | 541142c | 2020-03-07 16:35:46 +0900 | [diff] [blame] | 359 | defaults: ["crt_defaults"], |
Colin Cross | 815daf9 | 2019-05-14 16:05:20 -0700 | [diff] [blame] | 360 | recovery_available: true, |
| 361 | vendor_available: true, |
Colin Cross | f9aabd7 | 2020-02-15 11:29:50 -0800 | [diff] [blame] | 362 | native_bridge_supported: true, |
| 363 | stl: "none", |
Colin Cross | 815daf9 | 2019-05-14 16:05:20 -0700 | [diff] [blame] | 364 | } |
| 365 | |
| 366 | cc_object { |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 367 | name: "crtbegin_static", |
Jiyong Park | 541142c | 2020-03-07 16:35:46 +0900 | [diff] [blame] | 368 | defaults: ["crt_defaults"], |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 369 | recovery_available: true, |
| 370 | vendor_available: true, |
Colin Cross | f9aabd7 | 2020-02-15 11:29:50 -0800 | [diff] [blame] | 371 | native_bridge_supported: true, |
| 372 | stl: "none", |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 373 | } |
| 374 | |
| 375 | cc_object { |
| 376 | name: "crtend_so", |
Jiyong Park | 541142c | 2020-03-07 16:35:46 +0900 | [diff] [blame] | 377 | defaults: ["crt_defaults"], |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 378 | recovery_available: true, |
| 379 | vendor_available: true, |
Colin Cross | f9aabd7 | 2020-02-15 11:29:50 -0800 | [diff] [blame] | 380 | native_bridge_supported: true, |
Jooyung Han | 749dc69 | 2020-04-15 11:03:39 +0900 | [diff] [blame] | 381 | min_sdk_version: "29", |
Jiyong Park | a7bc8ad | 2019-10-15 15:20:07 +0900 | [diff] [blame] | 382 | stl: "none", |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 383 | } |
| 384 | |
| 385 | cc_object { |
| 386 | name: "crtend_android", |
Jiyong Park | 541142c | 2020-03-07 16:35:46 +0900 | [diff] [blame] | 387 | defaults: ["crt_defaults"], |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 388 | recovery_available: true, |
| 389 | vendor_available: true, |
Colin Cross | f9aabd7 | 2020-02-15 11:29:50 -0800 | [diff] [blame] | 390 | native_bridge_supported: true, |
| 391 | stl: "none", |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 392 | } |
| 393 | |
| 394 | cc_library { |
| 395 | name: "libprotobuf-cpp-lite", |
| 396 | } |
Colin Cross | f28329d | 2020-02-15 11:00:10 -0800 | [diff] [blame] | 397 | |
| 398 | cc_library { |
| 399 | name: "ndk_libunwind", |
| 400 | sdk_version: "current", |
| 401 | stl: "none", |
| 402 | system_shared_libs: [], |
| 403 | } |
| 404 | |
Dan Albert | de5aade | 2020-06-30 12:32:51 -0700 | [diff] [blame] | 405 | ndk_library { |
| 406 | name: "libc", |
| 407 | first_version: "minimum", |
| 408 | symbol_file: "libc.map.txt", |
Colin Cross | f28329d | 2020-02-15 11:00:10 -0800 | [diff] [blame] | 409 | } |
| 410 | |
Dan Albert | de5aade | 2020-06-30 12:32:51 -0700 | [diff] [blame] | 411 | ndk_library { |
| 412 | name: "libm", |
| 413 | first_version: "minimum", |
| 414 | symbol_file: "libm.map.txt", |
Colin Cross | f28329d | 2020-02-15 11:00:10 -0800 | [diff] [blame] | 415 | } |
| 416 | |
Dan Albert | de5aade | 2020-06-30 12:32:51 -0700 | [diff] [blame] | 417 | ndk_library { |
| 418 | name: "libdl", |
| 419 | first_version: "minimum", |
| 420 | symbol_file: "libdl.map.txt", |
Colin Cross | f28329d | 2020-02-15 11:00:10 -0800 | [diff] [blame] | 421 | } |
| 422 | |
| 423 | ndk_prebuilt_object { |
| 424 | name: "ndk_crtbegin_so.27", |
| 425 | sdk_version: "27", |
| 426 | } |
| 427 | |
| 428 | ndk_prebuilt_object { |
| 429 | name: "ndk_crtend_so.27", |
| 430 | sdk_version: "27", |
| 431 | } |
| 432 | |
Colin Cross | c511bc5 | 2020-04-07 16:50:32 +0000 | [diff] [blame] | 433 | ndk_prebuilt_object { |
| 434 | name: "ndk_crtbegin_dynamic.27", |
| 435 | sdk_version: "27", |
| 436 | } |
| 437 | |
| 438 | ndk_prebuilt_object { |
| 439 | name: "ndk_crtend_android.27", |
| 440 | sdk_version: "27", |
| 441 | } |
| 442 | |
Colin Cross | f28329d | 2020-02-15 11:00:10 -0800 | [diff] [blame] | 443 | ndk_prebuilt_shared_stl { |
| 444 | name: "ndk_libc++_shared", |
| 445 | } |
| 446 | ` |
| 447 | |
Martin Stjernholm | 7feceb2 | 2020-07-11 04:33:29 +0100 | [diff] [blame] | 448 | supportLinuxBionic := false |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 449 | for _, os := range oses { |
| 450 | if os == android.Fuchsia { |
| 451 | ret += ` |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 452 | cc_library { |
| 453 | name: "libbioniccompat", |
| 454 | stl: "none", |
| 455 | } |
| 456 | cc_library { |
| 457 | name: "libcompiler_rt", |
| 458 | stl: "none", |
| 459 | } |
| 460 | ` |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 461 | } |
| 462 | if os == android.Windows { |
| 463 | ret += ` |
| 464 | toolchain_library { |
| 465 | name: "libwinpthread", |
| 466 | host_supported: true, |
| 467 | enabled: false, |
| 468 | target: { |
| 469 | windows: { |
| 470 | enabled: true, |
| 471 | }, |
| 472 | }, |
| 473 | src: "", |
| 474 | } |
| 475 | ` |
| 476 | } |
Martin Stjernholm | 7feceb2 | 2020-07-11 04:33:29 +0100 | [diff] [blame] | 477 | if os == android.LinuxBionic { |
| 478 | supportLinuxBionic = true |
| 479 | ret += ` |
| 480 | cc_binary { |
| 481 | name: "linker", |
| 482 | defaults: ["linux_bionic_supported"], |
| 483 | recovery_available: true, |
| 484 | stl: "none", |
| 485 | nocrt: true, |
| 486 | static_executable: true, |
| 487 | native_coverage: false, |
| 488 | system_shared_libs: [], |
| 489 | } |
| 490 | |
| 491 | cc_genrule { |
| 492 | name: "host_bionic_linker_flags", |
| 493 | host_supported: true, |
| 494 | device_supported: false, |
| 495 | target: { |
| 496 | host: { |
| 497 | enabled: false, |
| 498 | }, |
| 499 | linux_bionic: { |
| 500 | enabled: true, |
| 501 | }, |
| 502 | }, |
| 503 | out: ["linker.flags"], |
| 504 | } |
| 505 | |
| 506 | cc_defaults { |
| 507 | name: "linux_bionic_supported", |
| 508 | host_supported: true, |
| 509 | target: { |
| 510 | host: { |
| 511 | enabled: false, |
| 512 | }, |
| 513 | linux_bionic: { |
| 514 | enabled: true, |
| 515 | }, |
| 516 | }, |
| 517 | } |
| 518 | ` |
| 519 | } |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 520 | } |
Martin Stjernholm | 7feceb2 | 2020-07-11 04:33:29 +0100 | [diff] [blame] | 521 | |
| 522 | if !supportLinuxBionic { |
| 523 | ret += ` |
| 524 | cc_defaults { |
| 525 | name: "linux_bionic_supported", |
| 526 | } |
| 527 | ` |
| 528 | } |
| 529 | |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 530 | return ret |
| 531 | } |
Colin Cross | 9a94287 | 2019-05-14 15:44:26 -0700 | [diff] [blame] | 532 | |
Colin Cross | f28329d | 2020-02-15 11:00:10 -0800 | [diff] [blame] | 533 | func GatherRequiredFilesForTest(fs map[string][]byte) { |
Colin Cross | f28329d | 2020-02-15 11:00:10 -0800 | [diff] [blame] | 534 | } |
| 535 | |
Colin Cross | 98be1bb | 2019-12-13 20:41:13 -0800 | [diff] [blame] | 536 | func TestConfig(buildDir string, os android.OsType, env map[string]string, |
| 537 | bp string, fs map[string][]byte) android.Config { |
Colin Cross | 9a94287 | 2019-05-14 15:44:26 -0700 | [diff] [blame] | 538 | |
Colin Cross | 98be1bb | 2019-12-13 20:41:13 -0800 | [diff] [blame] | 539 | // add some modules that are required by the compiler and/or linker |
| 540 | bp = bp + GatherRequiredDepsForTest(os) |
| 541 | |
Colin Cross | 2fce23a | 2020-06-07 17:02:48 -0700 | [diff] [blame] | 542 | mockFS := map[string][]byte{} |
Colin Cross | 98be1bb | 2019-12-13 20:41:13 -0800 | [diff] [blame] | 543 | |
Colin Cross | f28329d | 2020-02-15 11:00:10 -0800 | [diff] [blame] | 544 | GatherRequiredFilesForTest(mockFS) |
| 545 | |
Colin Cross | 98be1bb | 2019-12-13 20:41:13 -0800 | [diff] [blame] | 546 | for k, v := range fs { |
| 547 | mockFS[k] = v |
| 548 | } |
| 549 | |
| 550 | var config android.Config |
| 551 | if os == android.Fuchsia { |
| 552 | config = android.TestArchConfigFuchsia(buildDir, env, bp, mockFS) |
| 553 | } else { |
| 554 | config = android.TestArchConfig(buildDir, env, bp, mockFS) |
| 555 | } |
| 556 | |
| 557 | return config |
| 558 | } |
| 559 | |
| 560 | func CreateTestContext() *android.TestContext { |
Colin Cross | 9a94287 | 2019-05-14 15:44:26 -0700 | [diff] [blame] | 561 | ctx := android.NewTestArchContext() |
Colin Cross | 4b49b76 | 2019-11-22 15:25:03 -0800 | [diff] [blame] | 562 | ctx.RegisterModuleType("cc_fuzz", FuzzFactory) |
Colin Cross | 4b49b76 | 2019-11-22 15:25:03 -0800 | [diff] [blame] | 563 | ctx.RegisterModuleType("cc_test", TestFactory) |
Chris Parsons | 79d66a5 | 2020-06-05 17:26:16 -0400 | [diff] [blame] | 564 | ctx.RegisterModuleType("cc_test_library", TestLibraryFactory) |
Colin Cross | 4b49b76 | 2019-11-22 15:25:03 -0800 | [diff] [blame] | 565 | ctx.RegisterModuleType("llndk_headers", llndkHeadersFactory) |
| 566 | ctx.RegisterModuleType("vendor_public_library", vendorPublicLibraryFactory) |
Colin Cross | 4b49b76 | 2019-11-22 15:25:03 -0800 | [diff] [blame] | 567 | ctx.RegisterModuleType("filegroup", android.FileGroupFactory) |
| 568 | ctx.RegisterModuleType("vndk_prebuilt_shared", VndkPrebuiltSharedFactory) |
| 569 | ctx.RegisterModuleType("vndk_libraries_txt", VndkLibrariesTxtFactory) |
Colin Cross | e1bb5d0 | 2019-09-24 14:55:04 -0700 | [diff] [blame] | 570 | ctx.PreArchMutators(android.RegisterDefaultsPreArchMutators) |
Paul Duffin | 021f4e5 | 2020-07-30 16:04:17 +0100 | [diff] [blame^] | 571 | android.RegisterPrebuiltMutators(ctx) |
Paul Duffin | c988c8e | 2020-04-29 18:27:14 +0100 | [diff] [blame] | 572 | RegisterRequiredBuildComponentsForTest(ctx) |
Colin Cross | 4b49b76 | 2019-11-22 15:25:03 -0800 | [diff] [blame] | 573 | ctx.RegisterSingletonType("vndk-snapshot", VndkSnapshotSingleton) |
Inseob Kim | 8471cda | 2019-11-15 09:59:12 +0900 | [diff] [blame] | 574 | ctx.RegisterSingletonType("vendor-snapshot", VendorSnapshotSingleton) |
Colin Cross | 9a94287 | 2019-05-14 15:44:26 -0700 | [diff] [blame] | 575 | |
Colin Cross | 9a94287 | 2019-05-14 15:44:26 -0700 | [diff] [blame] | 576 | return ctx |
| 577 | } |