blob: 605d4681f7abd3ffb4d20138a5703a4e7712e72b [file] [log] [blame]
Colin Cross1f7f3bd2016-07-27 10:12:38 -07001bootstrap_go_package {
2 name: "soong-art",
3 pkgPath: "android/soong/art",
4 deps: [
5 "blueprint",
6 "blueprint-pathtools",
Colin Cross84b69332017-11-01 14:23:17 -07007 "blueprint-proptools",
Colin Cross1f7f3bd2016-07-27 10:12:38 -07008 "soong",
9 "soong-android",
Alex Lightda948ce2018-12-06 17:05:41 +000010 "soong-apex",
Colin Cross1f7f3bd2016-07-27 10:12:38 -070011 "soong-cc",
12 ],
13 srcs: [
14 "art.go",
15 "codegen.go",
16 "makevars.go",
17 ],
18 pluginFor: ["soong_build"],
19}
20
Andreas Gampe896583e2018-06-15 13:31:58 -070021art_clang_tidy_errors = [
Andreas Gampedfcd82c2018-10-16 20:22:37 -070022 "android-cloexec-dup",
23 "android-cloexec-open",
Andreas Gampe6cd83902018-10-03 20:03:03 -070024 "bugprone-argument-comment",
Andreas Gampe322c0892018-09-18 13:50:29 -070025 "bugprone-lambda-function-name",
Andreas Gampe0dc93b12019-05-15 10:30:22 -070026 "bugprone-unused-raii", // Protect scoped things like MutexLock.
Andreas Gampeafaf7f82018-10-16 11:32:38 -070027 "bugprone-unused-return-value",
Andreas Gampe322c0892018-09-18 13:50:29 -070028 "bugprone-virtual-near-miss",
Andreas Gampe8351aac2018-09-10 12:37:49 -070029 "modernize-use-bool-literals",
Andreas Gampe322c0892018-09-18 13:50:29 -070030 "modernize-use-nullptr",
Andreas Gampec55bb392018-09-21 00:02:02 +000031 "modernize-use-using",
Andreas Gampe322c0892018-09-18 13:50:29 -070032 "performance-faster-string-find",
Andreas Gampe6f4cf6e2018-06-19 17:10:48 -070033 "performance-for-range-copy",
Andreas Gampe322c0892018-09-18 13:50:29 -070034 "performance-implicit-conversion-in-loop",
Andreas Gampe44b31742018-10-01 19:30:57 -070035 "performance-noexcept-move-constructor",
Andreas Gampe6f4cf6e2018-06-19 17:10:48 -070036 "performance-unnecessary-copy-initialization",
37 "performance-unnecessary-value-param",
Andreas Gampebd39d142018-07-19 11:14:42 -070038 "misc-unused-using-decls",
Andreas Gampe896583e2018-06-15 13:31:58 -070039]
Andreas Gampe896583e2018-06-15 13:31:58 -070040
41art_clang_tidy_disabled = [
42 "-google-default-arguments",
43 // We have local stores that are only used for debug checks.
44 "-clang-analyzer-deadcode.DeadStores",
45 // We are OK with some static globals and that they can, in theory, throw.
46 "-cert-err58-cpp",
47 // We have lots of C-style variadic functions, and are OK with them. JNI ensures
48 // that working around this warning would be extra-painful.
49 "-cert-dcl50-cpp",
Andreas Gampe322c0892018-09-18 13:50:29 -070050 // "Modernization" we don't agree with.
51 "-modernize-use-auto",
52 "-modernize-return-braced-init-list",
53 "-modernize-use-default-member-init",
54 "-modernize-pass-by-value",
Andreas Gampe896583e2018-06-15 13:31:58 -070055]
56
Colin Cross1f7f3bd2016-07-27 10:12:38 -070057art_global_defaults {
58 // Additional flags are computed by art.go
59
60 name: "art_defaults",
Colin Cross1f7f3bd2016-07-27 10:12:38 -070061 cflags: [
Colin Cross1f7f3bd2016-07-27 10:12:38 -070062 // Base set of cflags used by all things ART.
63 "-fno-rtti",
64 "-ggdb3",
65 "-Wall",
66 "-Werror",
67 "-Wextra",
68 "-Wstrict-aliasing",
69 "-fstrict-aliasing",
70 "-Wunreachable-code",
71 "-Wredundant-decls",
72 "-Wshadow",
73 "-Wunused",
74 "-fvisibility=protected",
75
76 // Warn about thread safety violations with clang.
77 "-Wthread-safety",
78 "-Wthread-safety-negative",
79
80 // Warn if switch fallthroughs aren't annotated.
81 "-Wimplicit-fallthrough",
82
83 // Enable float equality warnings.
84 "-Wfloat-equal",
85
86 // Enable warning of converting ints to void*.
87 "-Wint-to-void-pointer-cast",
88
89 // Enable warning of wrong unused annotations.
90 "-Wused-but-marked-unused",
91
92 // Enable warning for deprecated language features.
93 "-Wdeprecated",
94
95 // Enable warning for unreachable break & return.
96 "-Wunreachable-code-break",
97 "-Wunreachable-code-return",
98
David Srbecky56de89a2018-10-01 15:32:20 +010099 // Disable warning for use of offsetof on non-standard layout type.
100 // We use it to implement OFFSETOF_MEMBER - see macros.h.
101 "-Wno-invalid-offsetof",
102
Yi Kong39402542019-03-24 02:47:16 -0700103 // Enable inconsistent-missing-override warning. This warning is disabled by default in
104 // Android.
105 "-Winconsistent-missing-override",
106
David Sehrae3bcac2017-02-03 15:19:00 -0800107 // Enable thread annotations for std::mutex, etc.
108 "-D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS",
Colin Cross1f7f3bd2016-07-27 10:12:38 -0700109 ],
110
jaishankbf7ce252019-06-10 16:16:47 +0530111 arch: {
112 x86: {
113 avx2: {
114 cflags: [
115 "-mavx2",
116 "-mfma",
117 ],
118 },
119 },
120 x86_64: {
121 avx2: {
122 cflags: [
123 "-mavx2",
124 "-mfma",
125 ],
126 },
127 },
128 },
129
Colin Cross1f7f3bd2016-07-27 10:12:38 -0700130 target: {
131 android: {
132 cflags: [
133 "-DART_TARGET",
134
Colin Cross1f7f3bd2016-07-27 10:12:38 -0700135 // To use oprofile_android --callgraph, uncomment this and recompile with
136 // mmma -j art
137 // "-fno-omit-frame-pointer",
138 // "-marm",
139 // "-mapcs",
140 ],
Paul Duffin34ac9f72019-07-18 13:03:24 +0100141 header_libs: [
Colin Cross1f7f3bd2016-07-27 10:12:38 -0700142 // We optimize Thread::Current() with a direct TLS access. This requires access to a
143 // private Bionic header.
Paul Duffin34ac9f72019-07-18 13:03:24 +0100144 "bionic_libc_private_headers",
Colin Cross1f7f3bd2016-07-27 10:12:38 -0700145 ],
146 },
Dan Willemsen057f1e42017-10-03 14:11:48 -0700147 linux: {
Colin Cross1f7f3bd2016-07-27 10:12:38 -0700148 cflags: [
149 // Enable missing-noreturn only on non-Mac. As lots of things are not implemented for
150 // Apple, it's a pain.
151 "-Wmissing-noreturn",
152 ],
153 },
Andreas Gampea47a6e82019-07-24 09:46:16 -0700154 linux_bionic: {
155 header_libs: [
156 // We optimize Thread::Current() with a direct TLS access. This requires access to a
157 // private Bionic header.
158 "bionic_libc_private_headers",
159 ],
160 },
David Srbeckyd53f6062019-03-22 14:55:21 +0000161 darwin: {
162 enabled: false,
163 },
Colin Cross1f7f3bd2016-07-27 10:12:38 -0700164 host: {
165 cflags: [
166 // Bug: 15446488. We don't omit the frame pointer to work around
167 // clang/libunwind bugs that cause SEGVs in run-test-004-ThreadStress.
168 "-fno-omit-frame-pointer",
Aart Bikf6052572017-07-20 16:47:45 -0700169 // The build assumes that all our x86/x86_64 hosts (such as buildbots and developer
170 // desktops) support at least sse4.2/popcount. This firstly implies that the ART
171 // runtime binary itself may exploit these features. Secondly, this implies that
172 // the ART runtime passes these feature flags to dex2oat and JIT by calling the
173 // method InstructionSetFeatures::FromCppDefines(). Since invoking dex2oat directly
174 // does not pick up these flags, cross-compiling from a x86/x86_64 host to a
175 // x86/x86_64 target should not be affected.
176 "-msse4.2",
177 "-mpopcnt",
Colin Cross1f7f3bd2016-07-27 10:12:38 -0700178 ],
179 },
180 },
181
182 codegen: {
183 arm: {
184 cflags: ["-DART_ENABLE_CODEGEN_arm"],
185 },
186 arm64: {
187 cflags: ["-DART_ENABLE_CODEGEN_arm64"],
188 },
189 mips: {
190 cflags: ["-DART_ENABLE_CODEGEN_mips"],
191 },
192 mips64: {
193 cflags: ["-DART_ENABLE_CODEGEN_mips64"],
194 },
195 x86: {
196 cflags: ["-DART_ENABLE_CODEGEN_x86"],
197 },
198 x86_64: {
199 cflags: ["-DART_ENABLE_CODEGEN_x86_64"],
200 },
201 },
202
Andreas Gampe896583e2018-06-15 13:31:58 -0700203 tidy_checks: art_clang_tidy_errors + art_clang_tidy_disabled,
Nikita Ioffe08417352019-03-28 12:47:38 +0000204 tidy_checks_as_errors: art_clang_tidy_errors,
George Burgess IV7fb46652017-06-16 15:35:33 -0700205
206 tidy_flags: [
207 // The static analyzer treats DCHECK as always enabled; we sometimes get
208 // false positives when we use DCHECKs with code that relies on NDEBUG.
209 "-extra-arg=-UNDEBUG",
George Burgess IVdd8aa322017-06-21 16:34:35 -0700210 // clang-tidy complains about functions like:
211 // void foo() { CHECK(kIsFooEnabled); /* do foo... */ }
212 // not being marked noreturn if kIsFooEnabled is false.
213 "-extra-arg=-Wno-missing-noreturn",
Andreas Gampe020020f2018-07-10 12:34:23 -0700214 // Because tidy doesn't like our flow checks for compile-time configuration and thinks that
215 // the following code is dead (it is, but not for all configurations), disable unreachable
216 // code detection in Clang for tidy builds. It is still on for regular build steps, so we
217 // will still get the "real" errors.
218 "-extra-arg=-Wno-unreachable-code",
George Burgess IV7fb46652017-06-16 15:35:33 -0700219 ],
Colin Cross1f7f3bd2016-07-27 10:12:38 -0700220}
221
Colin Crossbe332ed2016-09-21 13:23:53 -0700222art_debug_defaults {
Colin Cross1f7f3bd2016-07-27 10:12:38 -0700223 name: "art_debug_defaults",
224 cflags: [
Colin Cross1f7f3bd2016-07-27 10:12:38 -0700225 "-DDYNAMIC_ANNOTATIONS_ENABLED=1",
226 "-DVIXL_DEBUG",
227 "-UNDEBUG",
Colin Cross1f7f3bd2016-07-27 10:12:38 -0700228 ],
229 asflags: [
230 "-UNDEBUG",
231 ],
Colin Crossc5644062016-08-30 15:41:08 -0700232 target: {
233 // This has to be duplicated for android and host to make sure it
234 // comes after the -Wframe-larger-than warnings inserted by art.go
235 // target-specific properties
236 android: {
237 cflags: ["-Wno-frame-larger-than="],
238 },
239 host: {
240 cflags: ["-Wno-frame-larger-than="],
241 },
242 },
Colin Cross1f7f3bd2016-07-27 10:12:38 -0700243}