1package { 2 // See: http://go/android-license-faq 3 // A large-scale-change added 'default_applicable_licenses' to import 4 // all of the 'license_kinds' from "art_license" 5 // to get the below license kinds: 6 // SPDX-license-identifier-Apache-2.0 7 default_applicable_licenses: ["art_license"], 8 default_team: "trendy_team_art_mainline", 9} 10 11bootstrap_go_package { 12 name: "soong-art", 13 pkgPath: "android/soong/art", 14 deps: [ 15 "blueprint", 16 "blueprint-pathtools", 17 "blueprint-proptools", 18 "soong", 19 "soong-android", 20 "soong-apex", 21 "soong-cc", 22 ], 23 srcs: [ 24 "art.go", 25 "codegen.go", 26 "makevars.go", 27 ], 28 pluginFor: ["soong_build"], 29} 30 31art_clang_tidy_errors = [ 32 "android-cloexec-dup", 33 "android-cloexec-fopen", 34 "android-cloexec-open", 35 "bugprone-argument-comment", 36 "bugprone-lambda-function-name", 37 "bugprone-macro-parentheses", 38 "bugprone-macro-repeated-side-effects", 39 "bugprone-unused-raii", // Protect scoped things like MutexLock. 40 "bugprone-unused-return-value", 41 "bugprone-use-after-move", 42 "bugprone-virtual-near-miss", 43 "misc-unused-using-decls", 44 "modernize-use-bool-literals", 45 "modernize-use-nullptr", 46 "performance-faster-string-find", 47 "performance-for-range-copy", 48 "performance-implicit-conversion-in-loop", 49 "performance-inefficient-string-concatenation", 50 "performance-inefficient-vector-operation", 51 "performance-no-automatic-move", 52 "performance-noexcept-move-constructor", 53 "performance-unnecessary-copy-initialization", 54 "performance-unnecessary-value-param", 55 "readability-duplicate-include", 56 "readability-redundant-string-cstr", 57] 58 59art_clang_tidy_disabled = [ 60 "-google-default-arguments", 61 // We have local stores that are only used for debug checks. 62 "-clang-analyzer-deadcode.DeadStores", 63 // We are OK with some static globals and that they can, in theory, throw. 64 "-cert-err58-cpp", 65 // We have lots of C-style variadic functions, and are OK with them. JNI ensures 66 // that working around this warning would be extra-painful. 67 "-cert-dcl50-cpp", 68 "-misc-redundant-expression", 69 // "Modernization" we don't agree with. 70 "-modernize-use-auto", 71 "-modernize-return-braced-init-list", 72 "-modernize-use-default-member-init", 73 "-modernize-pass-by-value", 74 // The only two remaining offenders are art/openjdkjvmti/include/jvmti.h and 75 // libcore/ojluni/src/main/native/jvm.h, which are both external files by Oracle 76 "-modernize-use-using", 77] 78 79art_global_defaults { 80 // Additional flags are computed by art.go 81 82 name: "art_defaults", 83 84 // This is the default visibility for the //art package, but we repeat it 85 // here so that it gets merged with other visibility rules in modules 86 // extending these defaults. 87 visibility: ["//art:__subpackages__"], 88 89 cflags: [ 90 // Base set of cflags used by all things ART. 91 "-fno-rtti", 92 "-ggdb3", 93 "-Wall", 94 "-Werror", 95 "-Wextra", 96 "-Wstrict-aliasing", 97 "-fstrict-aliasing", 98 "-Wunreachable-code", 99 "-Wredundant-decls", 100 "-Wshadow", 101 "-Wunused", 102 "-fvisibility=protected", 103 104 // Warn about thread safety violations with clang. 105 "-Wthread-safety", 106 // TODO(b/144045034): turn on -Wthread-safety-negative 107 //"-Wthread-safety-negative", 108 109 // Warn if switch fallthroughs aren't annotated. 110 "-Wimplicit-fallthrough", 111 112 // Enable float equality warnings. 113 "-Wfloat-equal", 114 115 // Enable warning of converting ints to void*. 116 "-Wint-to-void-pointer-cast", 117 118 // Enable warning of wrong unused annotations. 119 "-Wused-but-marked-unused", 120 121 // Enable warning for deprecated language features. 122 "-Wdeprecated", 123 124 // Enable warning for unreachable break & return. 125 "-Wunreachable-code-break", 126 "-Wunreachable-code-return", 127 128 // Disable warning for use of offsetof on non-standard layout type. 129 // We use it to implement OFFSETOF_MEMBER - see macros.h. 130 "-Wno-invalid-offsetof", 131 132 // Enable inconsistent-missing-override warning. This warning is disabled by default in 133 // Android. 134 "-Winconsistent-missing-override", 135 136 // Enable thread annotations for std::mutex, etc. 137 "-D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS", 138 ], 139 140 arch: { 141 x86: { 142 avx2: { 143 cflags: [ 144 "-mavx2", 145 "-mfma", 146 ], 147 }, 148 }, 149 x86_64: { 150 avx2: { 151 cflags: [ 152 "-mavx2", 153 "-mfma", 154 ], 155 }, 156 }, 157 }, 158 159 target: { 160 android: { 161 cflags: [ 162 // To use oprofile_android --callgraph, uncomment this and recompile with 163 // mmma -j art 164 // "-fno-omit-frame-pointer", 165 // "-marm", 166 // "-mapcs", 167 ], 168 }, 169 linux: { 170 cflags: [ 171 // Enable missing-noreturn only on non-Mac. As lots of things are not implemented for 172 // Apple, it's a pain. 173 "-Wmissing-noreturn", 174 ], 175 // Don't export symbols of statically linked libziparchive. 176 // Workaround to fix ODR violations (b/264235288) in gtests. 177 // `--exclude-libs` flag is not supported on windows/darwin. 178 ldflags: ["-Wl,--exclude-libs=libziparchive.a"], 179 }, 180 linux_bionic: { 181 strip: { 182 // Do not strip art libs when building for linux-bionic. 183 // Otherwise we can't get any symbols out of crashes. 184 none: true, 185 }, 186 }, 187 darwin: { 188 enabled: false, 189 }, 190 windows: { 191 // When the module is enabled globally in the soong_config_variables 192 // stanza above, it may get enabled on windows too for some module 193 // types. Hence we need to disable it explicitly. 194 // TODO(b/172480617): Clean up with that. 195 enabled: false, 196 }, 197 host: { 198 cflags: [ 199 // Bug: 15446488. We don't omit the frame pointer to work around 200 // clang/libunwind bugs that cause SEGVs in run-test-004-ThreadStress. 201 "-fno-omit-frame-pointer", 202 ], 203 }, 204 // The build assumes that all our x86/x86_64 hosts (such as buildbots and developer 205 // desktops) support at least sse4.2/popcount. This firstly implies that the ART 206 // runtime binary itself may exploit these features. Secondly, this implies that 207 // the ART runtime passes these feature flags to dex2oat and JIT by calling the 208 // method InstructionSetFeatures::FromCppDefines(). Since invoking dex2oat directly 209 // does not pick up these flags, cross-compiling from a x86/x86_64 host to a 210 // x86/x86_64 target should not be affected. 211 linux_x86: { 212 cflags: [ 213 "-msse4.2", 214 "-mpopcnt", 215 ], 216 }, 217 linux_x86_64: { 218 cflags: [ 219 "-msse4.2", 220 "-mpopcnt", 221 ], 222 }, 223 }, 224 225 codegen: { 226 arm: { 227 cflags: ["-DART_ENABLE_CODEGEN_arm"], 228 }, 229 arm64: { 230 cflags: ["-DART_ENABLE_CODEGEN_arm64"], 231 }, 232 riscv64: { 233 cflags: ["-DART_ENABLE_CODEGEN_riscv64"], 234 }, 235 x86: { 236 cflags: ["-DART_ENABLE_CODEGEN_x86"], 237 }, 238 x86_64: { 239 cflags: ["-DART_ENABLE_CODEGEN_x86_64"], 240 }, 241 }, 242 243 tidy_checks: art_clang_tidy_errors + art_clang_tidy_disabled, 244 245 tidy_checks_as_errors: art_clang_tidy_errors, 246 247 tidy_flags: [ 248 // The static analyzer treats DCHECK as always enabled; we sometimes get 249 // false positives when we use DCHECKs with code that relies on NDEBUG. 250 "-extra-arg=-UNDEBUG", 251 // clang-tidy complains about functions like: 252 // void foo() { CHECK(kIsFooEnabled); /* do foo... */ } 253 // not being marked noreturn if kIsFooEnabled is false. 254 "-extra-arg=-Wno-missing-noreturn", 255 // Because tidy doesn't like our flow checks for compile-time configuration and thinks that 256 // the following code is dead (it is, but not for all configurations), disable unreachable 257 // code detection in Clang for tidy builds. It is still on for regular build steps, so we 258 // will still get the "real" errors. 259 "-extra-arg=-Wno-unreachable-code", 260 ], 261 262 min_sdk_version: "31", 263} 264 265// Used to generate binaries that can be backed by transparent hugepages. 266cc_defaults { 267 name: "art_hugepage_defaults", 268 arch: { 269 arm64: { 270 ldflags: ["-z max-page-size=0x200000"], 271 }, 272 riscv64: { 273 ldflags: ["-z max-page-size=0x200000"], 274 }, 275 x86_64: { 276 ldflags: ["-z max-page-size=0x200000"], 277 }, 278 }, 279} 280 281cc_defaults { 282 name: "art_debug_defaults", 283 defaults: ["art_defaults"], 284 visibility: ["//art:__subpackages__"], 285 cflags: [ 286 "-DDYNAMIC_ANNOTATIONS_ENABLED=1", 287 "-DVIXL_DEBUG", 288 "-UNDEBUG", 289 ] + select(soong_config_variable("art_module", "art_debug_opt_flag"), { 290 any @ flag_val: [flag_val], 291 default: ["-Og"], 292 }), 293 asflags: [ 294 "-UNDEBUG", 295 ], 296 target: { 297 // This has to be duplicated for android and host to make sure it 298 // comes after the -Wframe-larger-than warnings inserted by art.go 299 // target-specific properties 300 android: { 301 cflags: ["-Wno-frame-larger-than="], 302 }, 303 host: { 304 cflags: ["-Wno-frame-larger-than="], 305 }, 306 }, 307} 308 309// A version of conscrypt only for enabling the "-hostdex" version to test ART on host. 310java_library { 311 // We need our own name to not clash with the conscrypt library. 312 name: "conscrypt-host", 313 installable: true, 314 hostdex: true, 315 static_libs: ["conscrypt-for-host"], 316 317 // Tests and build files rely on this file to be installed as "conscrypt-hostdex", 318 // therefore set a stem. Without it, the file would be installed as 319 // "conscrypt-host-hostdex". 320 stem: "conscrypt", 321 sdk_version: "core_platform", 322 target: { 323 hostdex: { 324 required: ["libjavacrypto"], 325 }, 326 darwin: { 327 // required module "libjavacrypto" is disabled on darwin 328 enabled: false, 329 }, 330 }, 331} 332 333// A version of conscrypt only for the ART fuzzer. 334java_library { 335 name: "conscrypt-fuzzer", 336 visibility: [ 337 "//art/tools/fuzzer", 338 ], 339 static_libs: ["conscrypt-for-host"], 340 stem: "conscrypt", 341 compile_dex: true, 342 sdk_version: "none", 343 system_modules: "none", 344} 345 346// A version of core-icu4j only for enabling the "-hostdex" version to test ART on host. 347java_library { 348 // We need our own name to not clash with the core-icu4j library. 349 name: "core-icu4j-host", 350 installable: true, 351 hostdex: true, 352 static_libs: ["core-icu4j-for-host"], 353 354 // Tests and build files rely on this file to be installed as "core-icu4j-hostdex", 355 // therefore set a stem. Without it, the file would be installed as 356 // "core-icu4j-host-hostdex". 357 stem: "core-icu4j", 358 sdk_version: "core_platform", 359 target: { 360 hostdex: { 361 required: ["libicu_jni"], 362 }, 363 }, 364} 365