blob: 2a5598fb7a33ef6512115faf666f84fb540925a6 [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
20art_global_defaults {
21 // Additional flags are computed by art.go
22
23 name: "art_defaults",
Colin Cross1f7f3bd2016-07-27 10:12:38 -070024 cflags: [
Colin Cross1f7f3bd2016-07-27 10:12:38 -070025 // 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 Sehrae3bcac2017-02-03 15:19:00 -080062 // Enable thread annotations for std::mutex, etc.
63 "-D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS",
Colin Cross1f7f3bd2016-07-27 10:12:38 -070064 ],
65
66 target: {
67 android: {
68 cflags: [
69 "-DART_TARGET",
70
Colin Cross1f7f3bd2016-07-27 10:12:38 -070071 // To use oprofile_android --callgraph, uncomment this and recompile with
72 // mmma -j art
73 // "-fno-omit-frame-pointer",
74 // "-marm",
75 // "-mapcs",
76 ],
77 include_dirs: [
78 // We optimize Thread::Current() with a direct TLS access. This requires access to a
79 // private Bionic header.
80 "bionic/libc/private",
81 ],
82 },
Dan Willemsen057f1e42017-10-03 14:11:48 -070083 linux: {
Colin Cross1f7f3bd2016-07-27 10:12:38 -070084 cflags: [
85 // Enable missing-noreturn only on non-Mac. As lots of things are not implemented for
86 // Apple, it's a pain.
87 "-Wmissing-noreturn",
88 ],
89 },
90 host: {
91 cflags: [
92 // Bug: 15446488. We don't omit the frame pointer to work around
93 // clang/libunwind bugs that cause SEGVs in run-test-004-ThreadStress.
94 "-fno-omit-frame-pointer",
Aart Bikf6052572017-07-20 16:47:45 -070095 // The build assumes that all our x86/x86_64 hosts (such as buildbots and developer
96 // desktops) support at least sse4.2/popcount. This firstly implies that the ART
97 // runtime binary itself may exploit these features. Secondly, this implies that
98 // the ART runtime passes these feature flags to dex2oat and JIT by calling the
99 // method InstructionSetFeatures::FromCppDefines(). Since invoking dex2oat directly
100 // does not pick up these flags, cross-compiling from a x86/x86_64 host to a
101 // x86/x86_64 target should not be affected.
102 "-msse4.2",
103 "-mpopcnt",
Colin Cross1f7f3bd2016-07-27 10:12:38 -0700104 ],
105 },
106 },
107
108 codegen: {
109 arm: {
110 cflags: ["-DART_ENABLE_CODEGEN_arm"],
111 },
112 arm64: {
113 cflags: ["-DART_ENABLE_CODEGEN_arm64"],
114 },
115 mips: {
116 cflags: ["-DART_ENABLE_CODEGEN_mips"],
117 },
118 mips64: {
119 cflags: ["-DART_ENABLE_CODEGEN_mips64"],
120 },
121 x86: {
122 cflags: ["-DART_ENABLE_CODEGEN_x86"],
123 },
124 x86_64: {
125 cflags: ["-DART_ENABLE_CODEGEN_x86_64"],
126 },
127 },
128
129 include_dirs: [
Colin Cross1f7f3bd2016-07-27 10:12:38 -0700130 "external/valgrind/include",
131 "external/valgrind",
132 "external/vixl/src",
Andreas Gampe27bd4dd2017-08-23 11:27:08 -0700133 ],
Andreas Gampe61501212016-11-03 16:48:51 -0700134
135 tidy_checks: [
136 "-google-default-arguments",
Andreas Gampef45d61c2017-06-07 10:29:33 -0700137 // We have local stores that are only used for debug checks.
138 "-clang-analyzer-deadcode.DeadStores",
139 // We are OK with some static globals and that they can, in theory, throw.
140 "-cert-err58-cpp",
141 // We have lots of C-style variadic functions, and are OK with them. JNI ensures
142 // that working around this warning would be extra-painful.
143 "-cert-dcl50-cpp",
144 // No exceptions.
145 "-misc-noexcept-move-constructor",
Andreas Gampe61501212016-11-03 16:48:51 -0700146 ],
George Burgess IV7fb46652017-06-16 15:35:33 -0700147
148 tidy_flags: [
149 // The static analyzer treats DCHECK as always enabled; we sometimes get
150 // false positives when we use DCHECKs with code that relies on NDEBUG.
151 "-extra-arg=-UNDEBUG",
George Burgess IVdd8aa322017-06-21 16:34:35 -0700152 // clang-tidy complains about functions like:
153 // void foo() { CHECK(kIsFooEnabled); /* do foo... */ }
154 // not being marked noreturn if kIsFooEnabled is false.
155 "-extra-arg=-Wno-missing-noreturn",
George Burgess IV7fb46652017-06-16 15:35:33 -0700156 ],
Colin Cross1f7f3bd2016-07-27 10:12:38 -0700157}
158
Colin Crossbe332ed2016-09-21 13:23:53 -0700159art_debug_defaults {
Colin Cross1f7f3bd2016-07-27 10:12:38 -0700160 name: "art_debug_defaults",
161 cflags: [
Colin Cross1f7f3bd2016-07-27 10:12:38 -0700162 "-DDYNAMIC_ANNOTATIONS_ENABLED=1",
163 "-DVIXL_DEBUG",
164 "-UNDEBUG",
Colin Cross1f7f3bd2016-07-27 10:12:38 -0700165 ],
166 asflags: [
167 "-UNDEBUG",
168 ],
Colin Crossc5644062016-08-30 15:41:08 -0700169 target: {
170 // This has to be duplicated for android and host to make sure it
171 // comes after the -Wframe-larger-than warnings inserted by art.go
172 // target-specific properties
173 android: {
174 cflags: ["-Wno-frame-larger-than="],
175 },
176 host: {
177 cflags: ["-Wno-frame-larger-than="],
178 },
179 },
Colin Cross1f7f3bd2016-07-27 10:12:38 -0700180}