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