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", |
| 7 | "soong", |
| 8 | "soong-android", |
| 9 | "soong-cc", |
| 10 | ], |
| 11 | srcs: [ |
| 12 | "art.go", |
| 13 | "codegen.go", |
| 14 | "makevars.go", |
| 15 | ], |
| 16 | pluginFor: ["soong_build"], |
| 17 | } |
| 18 | |
| 19 | art_global_defaults { |
| 20 | // Additional flags are computed by art.go |
| 21 | |
| 22 | name: "art_defaults", |
| 23 | clang: true, |
| 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 | |
| 71 | // Enable missing-noreturn only on non-Mac. As lots of things are not implemented |
| 72 | // for Apple, it's a pain. |
| 73 | "-Wmissing-noreturn", |
| 74 | |
| 75 | // To use oprofile_android --callgraph, uncomment this and recompile with |
| 76 | // mmma -j art |
| 77 | // "-fno-omit-frame-pointer", |
| 78 | // "-marm", |
| 79 | // "-mapcs", |
| 80 | ], |
| 81 | include_dirs: [ |
| 82 | // We optimize Thread::Current() with a direct TLS access. This requires access to a |
| 83 | // private Bionic header. |
| 84 | "bionic/libc/private", |
| 85 | ], |
| 86 | }, |
| 87 | linux: { |
| 88 | cflags: [ |
| 89 | // Enable missing-noreturn only on non-Mac. As lots of things are not implemented for |
| 90 | // Apple, it's a pain. |
| 91 | "-Wmissing-noreturn", |
| 92 | ], |
Colin Cross | 38a3ffa | 2016-09-08 14:19:51 -0700 | [diff] [blame] | 93 | host_ldlibs: [ |
| 94 | "-lrt", |
| 95 | ], |
Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 96 | }, |
| 97 | host: { |
| 98 | cflags: [ |
| 99 | // Bug: 15446488. We don't omit the frame pointer to work around |
| 100 | // clang/libunwind bugs that cause SEGVs in run-test-004-ThreadStress. |
| 101 | "-fno-omit-frame-pointer", |
Aart Bik | f605257 | 2017-07-20 16:47:45 -0700 | [diff] [blame] | 102 | // The build assumes that all our x86/x86_64 hosts (such as buildbots and developer |
| 103 | // desktops) support at least sse4.2/popcount. This firstly implies that the ART |
| 104 | // runtime binary itself may exploit these features. Secondly, this implies that |
| 105 | // the ART runtime passes these feature flags to dex2oat and JIT by calling the |
| 106 | // method InstructionSetFeatures::FromCppDefines(). Since invoking dex2oat directly |
| 107 | // does not pick up these flags, cross-compiling from a x86/x86_64 host to a |
| 108 | // x86/x86_64 target should not be affected. |
| 109 | "-msse4.2", |
| 110 | "-mpopcnt", |
Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 111 | ], |
Colin Cross | fe6064a | 2016-08-30 13:49:26 -0700 | [diff] [blame] | 112 | host_ldlibs: [ |
| 113 | "-ldl", |
| 114 | "-lpthread", |
Colin Cross | fe6064a | 2016-08-30 13:49:26 -0700 | [diff] [blame] | 115 | ], |
Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 116 | }, |
| 117 | }, |
| 118 | |
| 119 | codegen: { |
| 120 | arm: { |
| 121 | cflags: ["-DART_ENABLE_CODEGEN_arm"], |
| 122 | }, |
| 123 | arm64: { |
| 124 | cflags: ["-DART_ENABLE_CODEGEN_arm64"], |
| 125 | }, |
| 126 | mips: { |
| 127 | cflags: ["-DART_ENABLE_CODEGEN_mips"], |
| 128 | }, |
| 129 | mips64: { |
| 130 | cflags: ["-DART_ENABLE_CODEGEN_mips64"], |
| 131 | }, |
| 132 | x86: { |
| 133 | cflags: ["-DART_ENABLE_CODEGEN_x86"], |
| 134 | }, |
| 135 | x86_64: { |
| 136 | cflags: ["-DART_ENABLE_CODEGEN_x86_64"], |
| 137 | }, |
| 138 | }, |
| 139 | |
| 140 | include_dirs: [ |
Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 141 | "external/icu/icu4c/source/common", |
| 142 | "external/lz4/lib", |
| 143 | "external/valgrind/include", |
| 144 | "external/valgrind", |
| 145 | "external/vixl/src", |
| 146 | "external/zlib", |
Igor Murashkin | 3b6f440 | 2017-02-16 16:13:17 -0800 | [diff] [blame] | 147 | "libnativehelper/platform_include" |
Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 148 | ], |
Andreas Gampe | 6150121 | 2016-11-03 16:48:51 -0700 | [diff] [blame] | 149 | |
| 150 | tidy_checks: [ |
| 151 | "-google-default-arguments", |
Andreas Gampe | f45d61c | 2017-06-07 10:29:33 -0700 | [diff] [blame] | 152 | // We have local stores that are only used for debug checks. |
| 153 | "-clang-analyzer-deadcode.DeadStores", |
| 154 | // We are OK with some static globals and that they can, in theory, throw. |
| 155 | "-cert-err58-cpp", |
| 156 | // We have lots of C-style variadic functions, and are OK with them. JNI ensures |
| 157 | // that working around this warning would be extra-painful. |
| 158 | "-cert-dcl50-cpp", |
| 159 | // No exceptions. |
| 160 | "-misc-noexcept-move-constructor", |
Andreas Gampe | 6150121 | 2016-11-03 16:48:51 -0700 | [diff] [blame] | 161 | ], |
George Burgess IV | 7fb4665 | 2017-06-16 15:35:33 -0700 | [diff] [blame] | 162 | |
| 163 | tidy_flags: [ |
| 164 | // The static analyzer treats DCHECK as always enabled; we sometimes get |
| 165 | // false positives when we use DCHECKs with code that relies on NDEBUG. |
| 166 | "-extra-arg=-UNDEBUG", |
George Burgess IV | dd8aa32 | 2017-06-21 16:34:35 -0700 | [diff] [blame] | 167 | // clang-tidy complains about functions like: |
| 168 | // void foo() { CHECK(kIsFooEnabled); /* do foo... */ } |
| 169 | // not being marked noreturn if kIsFooEnabled is false. |
| 170 | "-extra-arg=-Wno-missing-noreturn", |
George Burgess IV | 7fb4665 | 2017-06-16 15:35:33 -0700 | [diff] [blame] | 171 | ], |
Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 172 | } |
| 173 | |
Colin Cross | be332ed | 2016-09-21 13:23:53 -0700 | [diff] [blame] | 174 | art_debug_defaults { |
Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 175 | name: "art_debug_defaults", |
| 176 | cflags: [ |
Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 177 | "-DDYNAMIC_ANNOTATIONS_ENABLED=1", |
| 178 | "-DVIXL_DEBUG", |
| 179 | "-UNDEBUG", |
Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 180 | ], |
| 181 | asflags: [ |
| 182 | "-UNDEBUG", |
| 183 | ], |
Colin Cross | c564406 | 2016-08-30 15:41:08 -0700 | [diff] [blame] | 184 | target: { |
| 185 | // This has to be duplicated for android and host to make sure it |
| 186 | // comes after the -Wframe-larger-than warnings inserted by art.go |
| 187 | // target-specific properties |
| 188 | android: { |
| 189 | cflags: ["-Wno-frame-larger-than="], |
| 190 | }, |
| 191 | host: { |
| 192 | cflags: ["-Wno-frame-larger-than="], |
| 193 | }, |
| 194 | }, |
Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 195 | } |