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