blob: 499d9b99f5c43a80347f1b4daa5315f6d1660e15 [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",
10 "soong-cc",
11 ],
12 srcs: [
13 "art.go",
14 "codegen.go",
15 "makevars.go",
16 ],
17 pluginFor: ["soong_build"],
18}
19
Andreas Gampe896583e2018-06-15 13:31:58 -070020art_clang_tidy_errors = [
21 // Protect scoped things like MutexLock.
22 "bugprone-unused-raii",
Andreas Gampe6f4cf6e2018-06-19 17:10:48 -070023 "performance-for-range-copy",
24 "performance-unnecessary-copy-initialization",
25 "performance-unnecessary-value-param",
Andreas Gampe896583e2018-06-15 13:31:58 -070026]
27// Should be: strings.Join(art_clang_tidy_errors, ",").
28art_clang_tidy_errors_str = "bugprone-unused-raii"
Andreas Gampe6f4cf6e2018-06-19 17:10:48 -070029 + ",performance-for-range-copy"
30 + ",performance-unnecessary-copy-initialization"
31 + ",performance-unnecessary-value-param"
Andreas Gampe896583e2018-06-15 13:31:58 -070032
33art_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 Cross1f7f3bd2016-07-27 10:12:38 -070047art_global_defaults {
48 // Additional flags are computed by art.go
49
50 name: "art_defaults",
Colin Cross1f7f3bd2016-07-27 10:12:38 -070051 cflags: [
Colin Cross1f7f3bd2016-07-27 10:12:38 -070052 // 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 Sehrae3bcac2017-02-03 15:19:00 -080089 // Enable thread annotations for std::mutex, etc.
90 "-D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS",
Colin Cross1f7f3bd2016-07-27 10:12:38 -070091 ],
92
93 target: {
94 android: {
95 cflags: [
96 "-DART_TARGET",
97
Colin Cross1f7f3bd2016-07-27 10:12:38 -070098 // 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 Willemsen057f1e42017-10-03 14:11:48 -0700110 linux: {
Colin Cross1f7f3bd2016-07-27 10:12:38 -0700111 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 Bikf6052572017-07-20 16:47:45 -0700122 // 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 Cross1f7f3bd2016-07-27 10:12:38 -0700131 ],
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 Cross1f7f3bd2016-07-27 10:12:38 -0700157 "external/vixl/src",
Andreas Gampe27bd4dd2017-08-23 11:27:08 -0700158 ],
Andreas Gampe61501212016-11-03 16:48:51 -0700159
Andreas Gampe896583e2018-06-15 13:31:58 -0700160 tidy_checks: art_clang_tidy_errors + art_clang_tidy_disabled,
George Burgess IV7fb46652017-06-16 15:35:33 -0700161
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 IVdd8aa322017-06-21 16:34:35 -0700166 // 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 Gampe896583e2018-06-15 13:31:58 -0700170 // Use art_clang_tidy_errors for build errors.
171 "-warnings-as-errors=" + art_clang_tidy_errors_str,
George Burgess IV7fb46652017-06-16 15:35:33 -0700172 ],
Colin Cross1f7f3bd2016-07-27 10:12:38 -0700173}
174
Colin Crossbe332ed2016-09-21 13:23:53 -0700175art_debug_defaults {
Colin Cross1f7f3bd2016-07-27 10:12:38 -0700176 name: "art_debug_defaults",
177 cflags: [
Colin Cross1f7f3bd2016-07-27 10:12:38 -0700178 "-DDYNAMIC_ANNOTATIONS_ENABLED=1",
179 "-DVIXL_DEBUG",
180 "-UNDEBUG",
Colin Cross1f7f3bd2016-07-27 10:12:38 -0700181 ],
182 asflags: [
183 "-UNDEBUG",
184 ],
Colin Crossc5644062016-08-30 15:41:08 -0700185 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 Cross1f7f3bd2016-07-27 10:12:38 -0700196}