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