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 79soong_config_module_type_import { 80 from: "art/build/SoongConfig.bp", 81 module_types: [ 82 "art_debug_defaults", 83 ], 84} 85 86art_global_defaults { 87 // Additional flags are computed by art.go 88 89 name: "art_defaults", 90 91 // This is the default visibility for the //art package, but we repeat it 92 // here so that it gets merged with other visibility rules in modules 93 // extending these defaults. 94 visibility: ["//art:__subpackages__"], 95 96 cflags: [ 97 // Base set of cflags used by all things ART. 98 "-fno-rtti", 99 "-ggdb3", 100 "-Wall", 101 "-Werror", 102 "-Wextra", 103 "-Wstrict-aliasing", 104 "-fstrict-aliasing", 105 "-Wunreachable-code", 106 "-Wredundant-decls", 107 "-Wshadow", 108 "-Wunused", 109 "-fvisibility=protected", 110 111 // Warn about thread safety violations with clang. 112 "-Wthread-safety", 113 // TODO(b/144045034): turn on -Wthread-safety-negative 114 //"-Wthread-safety-negative", 115 116 // Warn if switch fallthroughs aren't annotated. 117 "-Wimplicit-fallthrough", 118 119 // Enable float equality warnings. 120 "-Wfloat-equal", 121 122 // Enable warning of converting ints to void*. 123 "-Wint-to-void-pointer-cast", 124 125 // Enable warning of wrong unused annotations. 126 "-Wused-but-marked-unused", 127 128 // Enable warning for deprecated language features. 129 "-Wdeprecated", 130 131 // Enable warning for unreachable break & return. 132 "-Wunreachable-code-break", 133 "-Wunreachable-code-return", 134 135 // Disable warning for use of offsetof on non-standard layout type. 136 // We use it to implement OFFSETOF_MEMBER - see macros.h. 137 "-Wno-invalid-offsetof", 138 139 // Enable inconsistent-missing-override warning. This warning is disabled by default in 140 // Android. 141 "-Winconsistent-missing-override", 142 143 // Enable thread annotations for std::mutex, etc. 144 "-D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS", 145 ], 146 147 arch: { 148 x86: { 149 avx2: { 150 cflags: [ 151 "-mavx2", 152 "-mfma", 153 ], 154 }, 155 }, 156 x86_64: { 157 avx2: { 158 cflags: [ 159 "-mavx2", 160 "-mfma", 161 ], 162 }, 163 }, 164 }, 165 166 target: { 167 android: { 168 cflags: [ 169 // To use oprofile_android --callgraph, uncomment this and recompile with 170 // mmma -j art 171 // "-fno-omit-frame-pointer", 172 // "-marm", 173 // "-mapcs", 174 ], 175 }, 176 linux: { 177 cflags: [ 178 // Enable missing-noreturn only on non-Mac. As lots of things are not implemented for 179 // Apple, it's a pain. 180 "-Wmissing-noreturn", 181 ], 182 // Don't export symbols of statically linked libziparchive. 183 // Workaround to fix ODR violations (b/264235288) in gtests. 184 // `--exclude-libs` flag is not supported on windows/darwin. 185 ldflags: ["-Wl,--exclude-libs=libziparchive.a"], 186 }, 187 linux_bionic: { 188 strip: { 189 // Do not strip art libs when building for linux-bionic. 190 // Otherwise we can't get any symbols out of crashes. 191 none: true, 192 }, 193 }, 194 darwin: { 195 enabled: false, 196 }, 197 windows: { 198 // When the module is enabled globally in the soong_config_variables 199 // stanza above, it may get enabled on windows too for some module 200 // types. Hence we need to disable it explicitly. 201 // TODO(b/172480617): Clean up with that. 202 enabled: false, 203 }, 204 host: { 205 cflags: [ 206 // Bug: 15446488. We don't omit the frame pointer to work around 207 // clang/libunwind bugs that cause SEGVs in run-test-004-ThreadStress. 208 "-fno-omit-frame-pointer", 209 ], 210 }, 211 // The build assumes that all our x86/x86_64 hosts (such as buildbots and developer 212 // desktops) support at least sse4.2/popcount. This firstly implies that the ART 213 // runtime binary itself may exploit these features. Secondly, this implies that 214 // the ART runtime passes these feature flags to dex2oat and JIT by calling the 215 // method InstructionSetFeatures::FromCppDefines(). Since invoking dex2oat directly 216 // does not pick up these flags, cross-compiling from a x86/x86_64 host to a 217 // x86/x86_64 target should not be affected. 218 linux_x86: { 219 cflags: [ 220 "-msse4.2", 221 "-mpopcnt", 222 ], 223 }, 224 linux_x86_64: { 225 cflags: [ 226 "-msse4.2", 227 "-mpopcnt", 228 ], 229 }, 230 }, 231 232 codegen: { 233 arm: { 234 cflags: ["-DART_ENABLE_CODEGEN_arm"], 235 }, 236 arm64: { 237 cflags: ["-DART_ENABLE_CODEGEN_arm64"], 238 }, 239 riscv64: { 240 cflags: ["-DART_ENABLE_CODEGEN_riscv64"], 241 }, 242 x86: { 243 cflags: ["-DART_ENABLE_CODEGEN_x86"], 244 }, 245 x86_64: { 246 cflags: ["-DART_ENABLE_CODEGEN_x86_64"], 247 }, 248 }, 249 250 tidy_checks: art_clang_tidy_errors + art_clang_tidy_disabled, 251 252 tidy_checks_as_errors: art_clang_tidy_errors, 253 254 tidy_flags: [ 255 // The static analyzer treats DCHECK as always enabled; we sometimes get 256 // false positives when we use DCHECKs with code that relies on NDEBUG. 257 "-extra-arg=-UNDEBUG", 258 // clang-tidy complains about functions like: 259 // void foo() { CHECK(kIsFooEnabled); /* do foo... */ } 260 // not being marked noreturn if kIsFooEnabled is false. 261 "-extra-arg=-Wno-missing-noreturn", 262 // Because tidy doesn't like our flow checks for compile-time configuration and thinks that 263 // the following code is dead (it is, but not for all configurations), disable unreachable 264 // code detection in Clang for tidy builds. It is still on for regular build steps, so we 265 // will still get the "real" errors. 266 "-extra-arg=-Wno-unreachable-code", 267 ], 268 269 min_sdk_version: "31", 270} 271 272// Used to generate binaries that can be backed by transparent hugepages. 273cc_defaults { 274 name: "art_hugepage_defaults", 275 arch: { 276 arm64: { 277 ldflags: ["-z max-page-size=0x200000"], 278 }, 279 riscv64: { 280 ldflags: ["-z max-page-size=0x200000"], 281 }, 282 x86_64: { 283 ldflags: ["-z max-page-size=0x200000"], 284 }, 285 }, 286} 287 288art_debug_defaults { 289 name: "art_debug_defaults", 290 defaults: ["art_defaults"], 291 visibility: ["//art:__subpackages__"], 292 cflags: [ 293 "-DDYNAMIC_ANNOTATIONS_ENABLED=1", 294 "-DVIXL_DEBUG", 295 "-UNDEBUG", 296 ], 297 asflags: [ 298 "-UNDEBUG", 299 ], 300 target: { 301 // This has to be duplicated for android and host to make sure it 302 // comes after the -Wframe-larger-than warnings inserted by art.go 303 // target-specific properties 304 android: { 305 cflags: ["-Wno-frame-larger-than="], 306 }, 307 host: { 308 cflags: ["-Wno-frame-larger-than="], 309 }, 310 }, 311 soong_config_variables: { 312 art_debug_opt_flag: { 313 cflags: ["%s"], 314 conditions_default: { 315 cflags: ["-Og"], 316 }, 317 }, 318 }, 319} 320 321// A version of conscrypt only for enabling the "-hostdex" version to test ART on host. 322java_library { 323 // We need our own name to not clash with the conscrypt library. 324 name: "conscrypt-host", 325 installable: true, 326 hostdex: true, 327 static_libs: ["conscrypt-for-host"], 328 329 // Tests and build files rely on this file to be installed as "conscrypt-hostdex", 330 // therefore set a stem. Without it, the file would be installed as 331 // "conscrypt-host-hostdex". 332 stem: "conscrypt", 333 sdk_version: "core_platform", 334 target: { 335 hostdex: { 336 required: ["libjavacrypto"], 337 }, 338 darwin: { 339 // required module "libjavacrypto" is disabled on darwin 340 enabled: false, 341 }, 342 }, 343} 344 345// A version of core-icu4j only for enabling the "-hostdex" version to test ART on host. 346java_library { 347 // We need our own name to not clash with the core-icu4j library. 348 name: "core-icu4j-host", 349 installable: true, 350 hostdex: true, 351 static_libs: ["core-icu4j-for-host"], 352 353 // Tests and build files rely on this file to be installed as "core-icu4j-hostdex", 354 // therefore set a stem. Without it, the file would be installed as 355 // "core-icu4j-host-hostdex". 356 stem: "core-icu4j", 357 sdk_version: "core_platform", 358 target: { 359 hostdex: { 360 required: ["libicu_jni"], 361 }, 362 }, 363} 364