| Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 1 | bootstrap_go_package { |
| 2 | name: "soong-art", |
| 3 | pkgPath: "android/soong/art", |
| 4 | deps: [ |
| 5 | "blueprint", |
| 6 | "blueprint-pathtools", |
| Colin Cross | 84b6933 | 2017-11-01 14:23:17 -0700 | [diff] [blame] | 7 | "blueprint-proptools", |
| Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 8 | "soong", |
| 9 | "soong-android", |
| Alex Light | da948ce | 2018-12-06 17:05:41 +0000 | [diff] [blame] | 10 | "soong-apex", |
| Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 11 | "soong-cc", |
| 12 | ], |
| 13 | srcs: [ |
| 14 | "art.go", |
| 15 | "codegen.go", |
| 16 | "makevars.go", |
| 17 | ], |
| 18 | pluginFor: ["soong_build"], |
| 19 | } |
| 20 | |
| Andreas Gampe | 896583e | 2018-06-15 13:31:58 -0700 | [diff] [blame] | 21 | art_clang_tidy_errors = [ |
| Andreas Gampe | dfcd82c | 2018-10-16 20:22:37 -0700 | [diff] [blame] | 22 | "android-cloexec-dup", |
| 23 | "android-cloexec-open", |
| Andreas Gampe | 6cd8390 | 2018-10-03 20:03:03 -0700 | [diff] [blame] | 24 | "bugprone-argument-comment", |
| Andreas Gampe | 322c089 | 2018-09-18 13:50:29 -0700 | [diff] [blame] | 25 | "bugprone-lambda-function-name", |
| Andreas Gampe | 0dc93b1 | 2019-05-15 10:30:22 -0700 | [diff] [blame] | 26 | "bugprone-unused-raii", // Protect scoped things like MutexLock. |
| Andreas Gampe | afaf7f8 | 2018-10-16 11:32:38 -0700 | [diff] [blame] | 27 | "bugprone-unused-return-value", |
| Andreas Gampe | 322c089 | 2018-09-18 13:50:29 -0700 | [diff] [blame] | 28 | "bugprone-virtual-near-miss", |
| Andreas Gampe | 8351aac | 2018-09-10 12:37:49 -0700 | [diff] [blame] | 29 | "modernize-use-bool-literals", |
| Andreas Gampe | 322c089 | 2018-09-18 13:50:29 -0700 | [diff] [blame] | 30 | "modernize-use-nullptr", |
| Andreas Gampe | c55bb39 | 2018-09-21 00:02:02 +0000 | [diff] [blame] | 31 | "modernize-use-using", |
| Andreas Gampe | 322c089 | 2018-09-18 13:50:29 -0700 | [diff] [blame] | 32 | "performance-faster-string-find", |
| Andreas Gampe | 6f4cf6e | 2018-06-19 17:10:48 -0700 | [diff] [blame] | 33 | "performance-for-range-copy", |
| Andreas Gampe | 322c089 | 2018-09-18 13:50:29 -0700 | [diff] [blame] | 34 | "performance-implicit-conversion-in-loop", |
| Andreas Gampe | 44b3174 | 2018-10-01 19:30:57 -0700 | [diff] [blame] | 35 | "performance-noexcept-move-constructor", |
| Andreas Gampe | 6f4cf6e | 2018-06-19 17:10:48 -0700 | [diff] [blame] | 36 | "performance-unnecessary-copy-initialization", |
| 37 | "performance-unnecessary-value-param", |
| Andreas Gampe | bd39d14 | 2018-07-19 11:14:42 -0700 | [diff] [blame] | 38 | "misc-unused-using-decls", |
| Andreas Gampe | 896583e | 2018-06-15 13:31:58 -0700 | [diff] [blame] | 39 | ] |
| Andreas Gampe | 896583e | 2018-06-15 13:31:58 -0700 | [diff] [blame] | 40 | |
| 41 | art_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", |
| Andreas Gampe | 322c089 | 2018-09-18 13:50:29 -0700 | [diff] [blame] | 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", |
| Andreas Gampe | 896583e | 2018-06-15 13:31:58 -0700 | [diff] [blame] | 55 | ] |
| 56 | |
| Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 57 | art_global_defaults { |
| 58 | // Additional flags are computed by art.go |
| 59 | |
| 60 | name: "art_defaults", |
| Martin Stjernholm | b4abe0a | 2019-05-17 19:22:55 +0100 | [diff] [blame] | 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 | |
| Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 67 | cflags: [ |
| Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 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", |
| Colin Cross | 62f62f3 | 2019-11-05 15:55:45 -0800 | [diff] [blame] | 84 | // TODO(b/144045034): turn on -Wthread-safety-negative |
| 85 | //"-Wthread-safety-negative", |
| Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 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 | |
| David Srbecky | 56de89a | 2018-10-01 15:32:20 +0100 | [diff] [blame] | 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 | |
| Yi Kong | 3940254 | 2019-03-24 02:47:16 -0700 | [diff] [blame] | 110 | // Enable inconsistent-missing-override warning. This warning is disabled by default in |
| 111 | // Android. |
| 112 | "-Winconsistent-missing-override", |
| 113 | |
| David Sehr | ae3bcac | 2017-02-03 15:19:00 -0800 | [diff] [blame] | 114 | // Enable thread annotations for std::mutex, etc. |
| 115 | "-D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS", |
| Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 116 | ], |
| 117 | |
| jaishank | bf7ce25 | 2019-06-10 16:16:47 +0530 | [diff] [blame] | 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 | |
| Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 137 | target: { |
| 138 | android: { |
| 139 | cflags: [ |
| Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 140 | // To use oprofile_android --callgraph, uncomment this and recompile with |
| 141 | // mmma -j art |
| 142 | // "-fno-omit-frame-pointer", |
| 143 | // "-marm", |
| 144 | // "-mapcs", |
| 145 | ], |
| Paul Duffin | 34ac9f7 | 2019-07-18 13:03:24 +0100 | [diff] [blame] | 146 | header_libs: [ |
| Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 147 | // We optimize Thread::Current() with a direct TLS access. This requires access to a |
| Christopher Ferris | fd64e56 | 2019-09-25 17:58:26 -0700 | [diff] [blame] | 148 | // platform specific Bionic header. |
| 149 | "bionic_libc_platform_headers", |
| Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 150 | ], |
| 151 | }, |
| Dan Willemsen | 057f1e4 | 2017-10-03 14:11:48 -0700 | [diff] [blame] | 152 | linux: { |
| Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 153 | cflags: [ |
| 154 | // Enable missing-noreturn only on non-Mac. As lots of things are not implemented for |
| 155 | // Apple, it's a pain. |
| 156 | "-Wmissing-noreturn", |
| 157 | ], |
| 158 | }, |
| Andreas Gampe | a47a6e8 | 2019-07-24 09:46:16 -0700 | [diff] [blame] | 159 | linux_bionic: { |
| 160 | header_libs: [ |
| 161 | // We optimize Thread::Current() with a direct TLS access. This requires access to a |
| Christopher Ferris | fd64e56 | 2019-09-25 17:58:26 -0700 | [diff] [blame] | 162 | // platform specific Bionic header. |
| 163 | "bionic_libc_platform_headers", |
| Andreas Gampe | a47a6e8 | 2019-07-24 09:46:16 -0700 | [diff] [blame] | 164 | ], |
| Calin Juravle | 542e393 | 2019-12-09 19:54:18 -0800 | [diff] [blame] | 165 | strip: { |
| Calin Juravle | 3bdb977 | 2019-12-10 11:31:53 -0800 | [diff] [blame] | 166 | // Do not strip art libs when building for linux-bionic. |
| 167 | // Otherwise we can't get any symbols out of crashes. |
| Calin Juravle | 542e393 | 2019-12-09 19:54:18 -0800 | [diff] [blame] | 168 | none: true, |
| 169 | }, |
| Andreas Gampe | a47a6e8 | 2019-07-24 09:46:16 -0700 | [diff] [blame] | 170 | }, |
| David Srbecky | d53f606 | 2019-03-22 14:55:21 +0000 | [diff] [blame] | 171 | darwin: { |
| 172 | enabled: false, |
| 173 | }, |
| Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 174 | host: { |
| 175 | cflags: [ |
| 176 | // Bug: 15446488. We don't omit the frame pointer to work around |
| 177 | // clang/libunwind bugs that cause SEGVs in run-test-004-ThreadStress. |
| 178 | "-fno-omit-frame-pointer", |
| Aart Bik | f605257 | 2017-07-20 16:47:45 -0700 | [diff] [blame] | 179 | // The build assumes that all our x86/x86_64 hosts (such as buildbots and developer |
| 180 | // desktops) support at least sse4.2/popcount. This firstly implies that the ART |
| 181 | // runtime binary itself may exploit these features. Secondly, this implies that |
| 182 | // the ART runtime passes these feature flags to dex2oat and JIT by calling the |
| 183 | // method InstructionSetFeatures::FromCppDefines(). Since invoking dex2oat directly |
| 184 | // does not pick up these flags, cross-compiling from a x86/x86_64 host to a |
| 185 | // x86/x86_64 target should not be affected. |
| 186 | "-msse4.2", |
| 187 | "-mpopcnt", |
| Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 188 | ], |
| 189 | }, |
| 190 | }, |
| 191 | |
| 192 | codegen: { |
| 193 | arm: { |
| 194 | cflags: ["-DART_ENABLE_CODEGEN_arm"], |
| 195 | }, |
| 196 | arm64: { |
| 197 | cflags: ["-DART_ENABLE_CODEGEN_arm64"], |
| 198 | }, |
| Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 199 | x86: { |
| 200 | cflags: ["-DART_ENABLE_CODEGEN_x86"], |
| 201 | }, |
| 202 | x86_64: { |
| 203 | cflags: ["-DART_ENABLE_CODEGEN_x86_64"], |
| 204 | }, |
| 205 | }, |
| 206 | |
| Andreas Gampe | 896583e | 2018-06-15 13:31:58 -0700 | [diff] [blame] | 207 | tidy_checks: art_clang_tidy_errors + art_clang_tidy_disabled, |
| Nikita Ioffe | 0841735 | 2019-03-28 12:47:38 +0000 | [diff] [blame] | 208 | tidy_checks_as_errors: art_clang_tidy_errors, |
| George Burgess IV | 7fb4665 | 2017-06-16 15:35:33 -0700 | [diff] [blame] | 209 | |
| 210 | tidy_flags: [ |
| 211 | // The static analyzer treats DCHECK as always enabled; we sometimes get |
| 212 | // false positives when we use DCHECKs with code that relies on NDEBUG. |
| 213 | "-extra-arg=-UNDEBUG", |
| George Burgess IV | dd8aa32 | 2017-06-21 16:34:35 -0700 | [diff] [blame] | 214 | // clang-tidy complains about functions like: |
| 215 | // void foo() { CHECK(kIsFooEnabled); /* do foo... */ } |
| 216 | // not being marked noreturn if kIsFooEnabled is false. |
| 217 | "-extra-arg=-Wno-missing-noreturn", |
| Andreas Gampe | 020020f | 2018-07-10 12:34:23 -0700 | [diff] [blame] | 218 | // Because tidy doesn't like our flow checks for compile-time configuration and thinks that |
| 219 | // the following code is dead (it is, but not for all configurations), disable unreachable |
| 220 | // code detection in Clang for tidy builds. It is still on for regular build steps, so we |
| 221 | // will still get the "real" errors. |
| 222 | "-extra-arg=-Wno-unreachable-code", |
| George Burgess IV | 7fb4665 | 2017-06-16 15:35:33 -0700 | [diff] [blame] | 223 | ], |
| Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 224 | } |
| 225 | |
| Colin Cross | be332ed | 2016-09-21 13:23:53 -0700 | [diff] [blame] | 226 | art_debug_defaults { |
| Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 227 | name: "art_debug_defaults", |
| Martin Stjernholm | b4abe0a | 2019-05-17 19:22:55 +0100 | [diff] [blame] | 228 | visibility: ["//art:__subpackages__"], |
| Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 229 | cflags: [ |
| Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 230 | "-DDYNAMIC_ANNOTATIONS_ENABLED=1", |
| 231 | "-DVIXL_DEBUG", |
| 232 | "-UNDEBUG", |
| Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 233 | ], |
| 234 | asflags: [ |
| 235 | "-UNDEBUG", |
| 236 | ], |
| Colin Cross | c564406 | 2016-08-30 15:41:08 -0700 | [diff] [blame] | 237 | target: { |
| 238 | // This has to be duplicated for android and host to make sure it |
| 239 | // comes after the -Wframe-larger-than warnings inserted by art.go |
| 240 | // target-specific properties |
| 241 | android: { |
| 242 | cflags: ["-Wno-frame-larger-than="], |
| 243 | }, |
| 244 | host: { |
| 245 | cflags: ["-Wno-frame-larger-than="], |
| 246 | }, |
| 247 | }, |
| Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 248 | } |
| Nicolas Geoffray | f6c3784 | 2020-03-31 14:00:47 +0100 | [diff] [blame] | 249 | |
| 250 | // A version of conscrypt only for enabling the "-hostdex" version to test ART on host. |
| 251 | java_library { |
| Victor Chang | d20e51d | 2020-05-05 16:01:19 +0100 | [diff] [blame] | 252 | // We need our own name to not clash with the conscrypt library. |
| Nicolas Geoffray | f6c3784 | 2020-03-31 14:00:47 +0100 | [diff] [blame] | 253 | name: "conscrypt-host", |
| 254 | installable: true, |
| 255 | hostdex: true, |
| 256 | static_libs: ["conscrypt"], |
| 257 | |
| 258 | // Tests and build files rely on this file to be installed as "conscrypt-hostdex", |
| 259 | // therefore set a stem. Without it, the file would be installed as |
| 260 | // "conscrypt-host-hostdex". |
| 261 | stem: "conscrypt", |
| 262 | sdk_version: "core_platform", |
| 263 | target: { |
| 264 | hostdex: { |
| 265 | required: ["libjavacrypto"], |
| 266 | }, |
| Yo Chiang | e492f7e | 2020-08-07 04:22:18 +0000 | [diff] [blame] | 267 | darwin: { |
| 268 | // required module "libjavacrypto" is disabled on darwin |
| 269 | enabled: false, |
| 270 | }, |
| Nicolas Geoffray | f6c3784 | 2020-03-31 14:00:47 +0100 | [diff] [blame] | 271 | }, |
| 272 | } |
| Victor Chang | d20e51d | 2020-05-05 16:01:19 +0100 | [diff] [blame] | 273 | |
| 274 | // A version of core-icu4j only for enabling the "-hostdex" version to test ART on host. |
| 275 | java_library { |
| 276 | // We need our own name to not clash with the core-icu4j library. |
| 277 | name: "core-icu4j-host", |
| 278 | installable: true, |
| 279 | hostdex: true, |
| 280 | static_libs: ["core-icu4j"], |
| 281 | |
| 282 | // Tests and build files rely on this file to be installed as "core-icu4j-hostdex", |
| 283 | // therefore set a stem. Without it, the file would be installed as |
| 284 | // "core-icu4j-host-hostdex". |
| 285 | stem: "core-icu4j", |
| 286 | sdk_version: "core_platform", |
| 287 | target: { |
| 288 | hostdex: { |
| 289 | required: ["libicu_jni"], |
| 290 | }, |
| 291 | }, |
| 292 | } |