1bootstrap_go_package { 2 name: "soong-art", 3 pkgPath: "android/soong/art", 4 deps: [ 5 "blueprint", 6 "blueprint-pathtools", 7 "blueprint-proptools", 8 "soong", 9 "soong-android", 10 "soong-apex", 11 "soong-cc", 12 ], 13 srcs: [ 14 "art.go", 15 "codegen.go", 16 "makevars.go", 17 ], 18 pluginFor: ["soong_build"], 19} 20 21art_clang_tidy_errors = [ 22 "android-cloexec-dup", 23 "android-cloexec-open", 24 "bugprone-argument-comment", 25 "bugprone-lambda-function-name", 26 "bugprone-unused-raii", // Protect scoped things like MutexLock. 27 "bugprone-unused-return-value", 28 "bugprone-virtual-near-miss", 29 "modernize-use-bool-literals", 30 "modernize-use-nullptr", 31 "modernize-use-using", 32 "performance-faster-string-find", 33 "performance-for-range-copy", 34 "performance-implicit-conversion-in-loop", 35 "performance-noexcept-move-constructor", 36 "performance-unnecessary-copy-initialization", 37 "performance-unnecessary-value-param", 38 "misc-unused-using-decls", 39] 40 41art_clang_tidy_disabled = [ 42 "-google-default-arguments", 43 // We have local stores that are only used for debug checks. 44 "-clang-analyzer-deadcode.DeadStores", 45 // We are OK with some static globals and that they can, in theory, throw. 46 "-cert-err58-cpp", 47 // We have lots of C-style variadic functions, and are OK with them. JNI ensures 48 // that working around this warning would be extra-painful. 49 "-cert-dcl50-cpp", 50 // "Modernization" we don't agree with. 51 "-modernize-use-auto", 52 "-modernize-return-braced-init-list", 53 "-modernize-use-default-member-init", 54 "-modernize-pass-by-value", 55] 56 57art_global_defaults { 58 // Additional flags are computed by art.go 59 60 name: "art_defaults", 61 62 // This is the default visibility for the //art package, but we repeat it 63 // here so that it gets merged with other visibility rules in modules 64 // extending these defaults. 65 visibility: ["//art:__subpackages__"], 66 67 cflags: [ 68 // Base set of cflags used by all things ART. 69 "-fno-rtti", 70 "-ggdb3", 71 "-Wall", 72 "-Werror", 73 "-Wextra", 74 "-Wstrict-aliasing", 75 "-fstrict-aliasing", 76 "-Wunreachable-code", 77 "-Wredundant-decls", 78 "-Wshadow", 79 "-Wunused", 80 "-fvisibility=protected", 81 82 // Warn about thread safety violations with clang. 83 "-Wthread-safety", 84 // TODO(b/144045034): turn on -Wthread-safety-negative 85 //"-Wthread-safety-negative", 86 87 // Warn if switch fallthroughs aren't annotated. 88 "-Wimplicit-fallthrough", 89 90 // Enable float equality warnings. 91 "-Wfloat-equal", 92 93 // Enable warning of converting ints to void*. 94 "-Wint-to-void-pointer-cast", 95 96 // Enable warning of wrong unused annotations. 97 "-Wused-but-marked-unused", 98 99 // Enable warning for deprecated language features. 100 "-Wdeprecated", 101 102 // Enable warning for unreachable break & return. 103 "-Wunreachable-code-break", 104 "-Wunreachable-code-return", 105 106 // Disable warning for use of offsetof on non-standard layout type. 107 // We use it to implement OFFSETOF_MEMBER - see macros.h. 108 "-Wno-invalid-offsetof", 109 110 // Enable inconsistent-missing-override warning. This warning is disabled by default in 111 // Android. 112 "-Winconsistent-missing-override", 113 114 // Enable thread annotations for std::mutex, etc. 115 "-D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS", 116 ], 117 118 arch: { 119 x86: { 120 avx2: { 121 cflags: [ 122 "-mavx2", 123 "-mfma", 124 ], 125 }, 126 }, 127 x86_64: { 128 avx2: { 129 cflags: [ 130 "-mavx2", 131 "-mfma", 132 ], 133 }, 134 }, 135 }, 136 137 target: { 138 android: { 139 cflags: [ 140 "-DART_TARGET", 141 142 // To use oprofile_android --callgraph, uncomment this and recompile with 143 // mmma -j art 144 // "-fno-omit-frame-pointer", 145 // "-marm", 146 // "-mapcs", 147 ], 148 header_libs: [ 149 // We optimize Thread::Current() with a direct TLS access. This requires access to a 150 // platform specific Bionic header. 151 "bionic_libc_platform_headers", 152 ], 153 }, 154 linux: { 155 cflags: [ 156 // Enable missing-noreturn only on non-Mac. As lots of things are not implemented for 157 // Apple, it's a pain. 158 "-Wmissing-noreturn", 159 ], 160 }, 161 linux_bionic: { 162 header_libs: [ 163 // We optimize Thread::Current() with a direct TLS access. This requires access to a 164 // platform specific Bionic header. 165 "bionic_libc_platform_headers", 166 ], 167 strip: { 168 // Do not strip art libs when building for linux-bionic. 169 // Otherwise we can't get any symbols out of crashes. 170 none: true, 171 }, 172 }, 173 darwin: { 174 enabled: false, 175 }, 176 host: { 177 cflags: [ 178 // Bug: 15446488. We don't omit the frame pointer to work around 179 // clang/libunwind bugs that cause SEGVs in run-test-004-ThreadStress. 180 "-fno-omit-frame-pointer", 181 // The build assumes that all our x86/x86_64 hosts (such as buildbots and developer 182 // desktops) support at least sse4.2/popcount. This firstly implies that the ART 183 // runtime binary itself may exploit these features. Secondly, this implies that 184 // the ART runtime passes these feature flags to dex2oat and JIT by calling the 185 // method InstructionSetFeatures::FromCppDefines(). Since invoking dex2oat directly 186 // does not pick up these flags, cross-compiling from a x86/x86_64 host to a 187 // x86/x86_64 target should not be affected. 188 "-msse4.2", 189 "-mpopcnt", 190 ], 191 }, 192 }, 193 194 codegen: { 195 arm: { 196 cflags: ["-DART_ENABLE_CODEGEN_arm"], 197 }, 198 arm64: { 199 cflags: ["-DART_ENABLE_CODEGEN_arm64"], 200 }, 201 x86: { 202 cflags: ["-DART_ENABLE_CODEGEN_x86"], 203 }, 204 x86_64: { 205 cflags: ["-DART_ENABLE_CODEGEN_x86_64"], 206 }, 207 }, 208 209 tidy_checks: art_clang_tidy_errors + art_clang_tidy_disabled, 210 tidy_checks_as_errors: art_clang_tidy_errors, 211 212 tidy_flags: [ 213 // The static analyzer treats DCHECK as always enabled; we sometimes get 214 // false positives when we use DCHECKs with code that relies on NDEBUG. 215 "-extra-arg=-UNDEBUG", 216 // clang-tidy complains about functions like: 217 // void foo() { CHECK(kIsFooEnabled); /* do foo... */ } 218 // not being marked noreturn if kIsFooEnabled is false. 219 "-extra-arg=-Wno-missing-noreturn", 220 // Because tidy doesn't like our flow checks for compile-time configuration and thinks that 221 // the following code is dead (it is, but not for all configurations), disable unreachable 222 // code detection in Clang for tidy builds. It is still on for regular build steps, so we 223 // will still get the "real" errors. 224 "-extra-arg=-Wno-unreachable-code", 225 ], 226} 227 228art_debug_defaults { 229 name: "art_debug_defaults", 230 visibility: ["//art:__subpackages__"], 231 cflags: [ 232 "-DDYNAMIC_ANNOTATIONS_ENABLED=1", 233 "-DVIXL_DEBUG", 234 "-UNDEBUG", 235 ], 236 asflags: [ 237 "-UNDEBUG", 238 ], 239 target: { 240 // This has to be duplicated for android and host to make sure it 241 // comes after the -Wframe-larger-than warnings inserted by art.go 242 // target-specific properties 243 android: { 244 cflags: ["-Wno-frame-larger-than="], 245 }, 246 host: { 247 cflags: ["-Wno-frame-larger-than="], 248 }, 249 }, 250} 251 252// A version of conscrypt only for enabling the "-hostdex" version to test ART on host. 253java_library { 254 // We need our own name to not clash with the conscrypt library. 255 name: "conscrypt-host", 256 installable: true, 257 hostdex: true, 258 static_libs: ["conscrypt"], 259 260 // Tests and build files rely on this file to be installed as "conscrypt-hostdex", 261 // therefore set a stem. Without it, the file would be installed as 262 // "conscrypt-host-hostdex". 263 stem: "conscrypt", 264 sdk_version: "core_platform", 265 target: { 266 hostdex: { 267 required: ["libjavacrypto"], 268 }, 269 }, 270} 271 272// A version of core-icu4j only for enabling the "-hostdex" version to test ART on host. 273java_library { 274 // We need our own name to not clash with the core-icu4j library. 275 name: "core-icu4j-host", 276 installable: true, 277 hostdex: true, 278 static_libs: ["core-icu4j"], 279 280 // Tests and build files rely on this file to be installed as "core-icu4j-hostdex", 281 // therefore set a stem. Without it, the file would be installed as 282 // "core-icu4j-host-hostdex". 283 stem: "core-icu4j", 284 sdk_version: "core_platform", 285 target: { 286 hostdex: { 287 required: ["libicu_jni"], 288 }, 289 }, 290} 291