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