| 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", |
| 10 | "soong-cc", |
| 11 | ], |
| 12 | srcs: [ |
| 13 | "art.go", |
| 14 | "codegen.go", |
| 15 | "makevars.go", |
| 16 | ], |
| 17 | pluginFor: ["soong_build"], |
| 18 | } |
| 19 | |
| Andreas Gampe | 896583e | 2018-06-15 13:31:58 -0700 | [diff] [blame] | 20 | art_clang_tidy_errors = [ |
| 21 | // Protect scoped things like MutexLock. |
| 22 | "bugprone-unused-raii", |
| Andreas Gampe | 6f4cf6e | 2018-06-19 17:10:48 -0700 | [diff] [blame] | 23 | "performance-for-range-copy", |
| 24 | "performance-unnecessary-copy-initialization", |
| 25 | "performance-unnecessary-value-param", |
| Andreas Gampe | bd39d14 | 2018-07-19 11:14:42 -0700 | [diff] [blame^] | 26 | "misc-unused-using-decls", |
| Andreas Gampe | 896583e | 2018-06-15 13:31:58 -0700 | [diff] [blame] | 27 | ] |
| 28 | // Should be: strings.Join(art_clang_tidy_errors, ","). |
| 29 | art_clang_tidy_errors_str = "bugprone-unused-raii" |
| Andreas Gampe | 6f4cf6e | 2018-06-19 17:10:48 -0700 | [diff] [blame] | 30 | + ",performance-for-range-copy" |
| 31 | + ",performance-unnecessary-copy-initialization" |
| 32 | + ",performance-unnecessary-value-param" |
| Andreas Gampe | bd39d14 | 2018-07-19 11:14:42 -0700 | [diff] [blame^] | 33 | + ",misc-unused-using-decls" |
| Andreas Gampe | 896583e | 2018-06-15 13:31:58 -0700 | [diff] [blame] | 34 | |
| 35 | art_clang_tidy_disabled = [ |
| 36 | "-google-default-arguments", |
| 37 | // We have local stores that are only used for debug checks. |
| 38 | "-clang-analyzer-deadcode.DeadStores", |
| 39 | // We are OK with some static globals and that they can, in theory, throw. |
| 40 | "-cert-err58-cpp", |
| 41 | // We have lots of C-style variadic functions, and are OK with them. JNI ensures |
| 42 | // that working around this warning would be extra-painful. |
| 43 | "-cert-dcl50-cpp", |
| 44 | // No exceptions. |
| 45 | "-misc-noexcept-move-constructor", |
| 46 | "-performance-noexcept-move-constructor", |
| 47 | ] |
| 48 | |
| Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 49 | art_global_defaults { |
| 50 | // Additional flags are computed by art.go |
| 51 | |
| 52 | name: "art_defaults", |
| Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 53 | cflags: [ |
| Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 54 | // Base set of cflags used by all things ART. |
| 55 | "-fno-rtti", |
| 56 | "-ggdb3", |
| 57 | "-Wall", |
| 58 | "-Werror", |
| 59 | "-Wextra", |
| 60 | "-Wstrict-aliasing", |
| 61 | "-fstrict-aliasing", |
| 62 | "-Wunreachable-code", |
| 63 | "-Wredundant-decls", |
| 64 | "-Wshadow", |
| 65 | "-Wunused", |
| 66 | "-fvisibility=protected", |
| 67 | |
| 68 | // Warn about thread safety violations with clang. |
| 69 | "-Wthread-safety", |
| 70 | "-Wthread-safety-negative", |
| 71 | |
| 72 | // Warn if switch fallthroughs aren't annotated. |
| 73 | "-Wimplicit-fallthrough", |
| 74 | |
| 75 | // Enable float equality warnings. |
| 76 | "-Wfloat-equal", |
| 77 | |
| 78 | // Enable warning of converting ints to void*. |
| 79 | "-Wint-to-void-pointer-cast", |
| 80 | |
| 81 | // Enable warning of wrong unused annotations. |
| 82 | "-Wused-but-marked-unused", |
| 83 | |
| 84 | // Enable warning for deprecated language features. |
| 85 | "-Wdeprecated", |
| 86 | |
| 87 | // Enable warning for unreachable break & return. |
| 88 | "-Wunreachable-code-break", |
| 89 | "-Wunreachable-code-return", |
| 90 | |
| David Sehr | ae3bcac | 2017-02-03 15:19:00 -0800 | [diff] [blame] | 91 | // Enable thread annotations for std::mutex, etc. |
| 92 | "-D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS", |
| Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 93 | ], |
| 94 | |
| 95 | target: { |
| 96 | android: { |
| 97 | cflags: [ |
| 98 | "-DART_TARGET", |
| 99 | |
| Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 100 | // To use oprofile_android --callgraph, uncomment this and recompile with |
| 101 | // mmma -j art |
| 102 | // "-fno-omit-frame-pointer", |
| 103 | // "-marm", |
| 104 | // "-mapcs", |
| 105 | ], |
| 106 | include_dirs: [ |
| 107 | // We optimize Thread::Current() with a direct TLS access. This requires access to a |
| 108 | // private Bionic header. |
| 109 | "bionic/libc/private", |
| 110 | ], |
| 111 | }, |
| Dan Willemsen | 057f1e4 | 2017-10-03 14:11:48 -0700 | [diff] [blame] | 112 | linux: { |
| Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 113 | cflags: [ |
| 114 | // Enable missing-noreturn only on non-Mac. As lots of things are not implemented for |
| 115 | // Apple, it's a pain. |
| 116 | "-Wmissing-noreturn", |
| 117 | ], |
| 118 | }, |
| 119 | host: { |
| 120 | cflags: [ |
| 121 | // Bug: 15446488. We don't omit the frame pointer to work around |
| 122 | // clang/libunwind bugs that cause SEGVs in run-test-004-ThreadStress. |
| 123 | "-fno-omit-frame-pointer", |
| Aart Bik | f605257 | 2017-07-20 16:47:45 -0700 | [diff] [blame] | 124 | // The build assumes that all our x86/x86_64 hosts (such as buildbots and developer |
| 125 | // desktops) support at least sse4.2/popcount. This firstly implies that the ART |
| 126 | // runtime binary itself may exploit these features. Secondly, this implies that |
| 127 | // the ART runtime passes these feature flags to dex2oat and JIT by calling the |
| 128 | // method InstructionSetFeatures::FromCppDefines(). Since invoking dex2oat directly |
| 129 | // does not pick up these flags, cross-compiling from a x86/x86_64 host to a |
| 130 | // x86/x86_64 target should not be affected. |
| 131 | "-msse4.2", |
| 132 | "-mpopcnt", |
| Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 133 | ], |
| 134 | }, |
| 135 | }, |
| 136 | |
| 137 | codegen: { |
| 138 | arm: { |
| 139 | cflags: ["-DART_ENABLE_CODEGEN_arm"], |
| 140 | }, |
| 141 | arm64: { |
| 142 | cflags: ["-DART_ENABLE_CODEGEN_arm64"], |
| 143 | }, |
| 144 | mips: { |
| 145 | cflags: ["-DART_ENABLE_CODEGEN_mips"], |
| 146 | }, |
| 147 | mips64: { |
| 148 | cflags: ["-DART_ENABLE_CODEGEN_mips64"], |
| 149 | }, |
| 150 | x86: { |
| 151 | cflags: ["-DART_ENABLE_CODEGEN_x86"], |
| 152 | }, |
| 153 | x86_64: { |
| 154 | cflags: ["-DART_ENABLE_CODEGEN_x86_64"], |
| 155 | }, |
| 156 | }, |
| 157 | |
| 158 | include_dirs: [ |
| Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 159 | "external/vixl/src", |
| Andreas Gampe | 27bd4dd | 2017-08-23 11:27:08 -0700 | [diff] [blame] | 160 | ], |
| Andreas Gampe | 6150121 | 2016-11-03 16:48:51 -0700 | [diff] [blame] | 161 | |
| Andreas Gampe | 896583e | 2018-06-15 13:31:58 -0700 | [diff] [blame] | 162 | tidy_checks: art_clang_tidy_errors + art_clang_tidy_disabled, |
| George Burgess IV | 7fb4665 | 2017-06-16 15:35:33 -0700 | [diff] [blame] | 163 | |
| 164 | tidy_flags: [ |
| 165 | // The static analyzer treats DCHECK as always enabled; we sometimes get |
| 166 | // false positives when we use DCHECKs with code that relies on NDEBUG. |
| 167 | "-extra-arg=-UNDEBUG", |
| George Burgess IV | dd8aa32 | 2017-06-21 16:34:35 -0700 | [diff] [blame] | 168 | // clang-tidy complains about functions like: |
| 169 | // void foo() { CHECK(kIsFooEnabled); /* do foo... */ } |
| 170 | // not being marked noreturn if kIsFooEnabled is false. |
| 171 | "-extra-arg=-Wno-missing-noreturn", |
| Andreas Gampe | 896583e | 2018-06-15 13:31:58 -0700 | [diff] [blame] | 172 | // Use art_clang_tidy_errors for build errors. |
| 173 | "-warnings-as-errors=" + art_clang_tidy_errors_str, |
| George Burgess IV | 7fb4665 | 2017-06-16 15:35:33 -0700 | [diff] [blame] | 174 | ], |
| Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 175 | } |
| 176 | |
| Colin Cross | be332ed | 2016-09-21 13:23:53 -0700 | [diff] [blame] | 177 | art_debug_defaults { |
| Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 178 | name: "art_debug_defaults", |
| 179 | cflags: [ |
| Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 180 | "-DDYNAMIC_ANNOTATIONS_ENABLED=1", |
| 181 | "-DVIXL_DEBUG", |
| 182 | "-UNDEBUG", |
| Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 183 | ], |
| 184 | asflags: [ |
| 185 | "-UNDEBUG", |
| 186 | ], |
| Colin Cross | c564406 | 2016-08-30 15:41:08 -0700 | [diff] [blame] | 187 | target: { |
| 188 | // This has to be duplicated for android and host to make sure it |
| 189 | // comes after the -Wframe-larger-than warnings inserted by art.go |
| 190 | // target-specific properties |
| 191 | android: { |
| 192 | cflags: ["-Wno-frame-larger-than="], |
| 193 | }, |
| 194 | host: { |
| 195 | cflags: ["-Wno-frame-larger-than="], |
| 196 | }, |
| 197 | }, |
| Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 198 | } |