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