blob: d6171163279e818e2bafe7225858647f84f794bf [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",
7 "soong",
8 "soong-android",
9 "soong-cc",
10 ],
11 srcs: [
12 "art.go",
13 "codegen.go",
14 "makevars.go",
15 ],
16 pluginFor: ["soong_build"],
17}
18
19art_global_defaults {
20 // Additional flags are computed by art.go
21
22 name: "art_defaults",
23 clang: true,
24 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
71 // Enable missing-noreturn only on non-Mac. As lots of things are not implemented
72 // for Apple, it's a pain.
73 "-Wmissing-noreturn",
74
75 // To use oprofile_android --callgraph, uncomment this and recompile with
76 // mmma -j art
77 // "-fno-omit-frame-pointer",
78 // "-marm",
79 // "-mapcs",
80 ],
81 include_dirs: [
82 // We optimize Thread::Current() with a direct TLS access. This requires access to a
83 // private Bionic header.
84 "bionic/libc/private",
85 ],
86 },
87 linux: {
88 cflags: [
89 // Enable missing-noreturn only on non-Mac. As lots of things are not implemented for
90 // Apple, it's a pain.
91 "-Wmissing-noreturn",
92 ],
Colin Cross38a3ffa2016-09-08 14:19:51 -070093 host_ldlibs: [
94 "-lrt",
95 ],
Colin Cross1f7f3bd2016-07-27 10:12:38 -070096 },
97 host: {
98 cflags: [
99 // Bug: 15446488. We don't omit the frame pointer to work around
100 // clang/libunwind bugs that cause SEGVs in run-test-004-ThreadStress.
101 "-fno-omit-frame-pointer",
Aart Bikf6052572017-07-20 16:47:45 -0700102 // The build assumes that all our x86/x86_64 hosts (such as buildbots and developer
103 // desktops) support at least sse4.2/popcount. This firstly implies that the ART
104 // runtime binary itself may exploit these features. Secondly, this implies that
105 // the ART runtime passes these feature flags to dex2oat and JIT by calling the
106 // method InstructionSetFeatures::FromCppDefines(). Since invoking dex2oat directly
107 // does not pick up these flags, cross-compiling from a x86/x86_64 host to a
108 // x86/x86_64 target should not be affected.
109 "-msse4.2",
110 "-mpopcnt",
Colin Cross1f7f3bd2016-07-27 10:12:38 -0700111 ],
Colin Crossfe6064a2016-08-30 13:49:26 -0700112 host_ldlibs: [
113 "-ldl",
114 "-lpthread",
Colin Crossfe6064a2016-08-30 13:49:26 -0700115 ],
Colin Cross1f7f3bd2016-07-27 10:12:38 -0700116 },
117 },
118
119 codegen: {
120 arm: {
121 cflags: ["-DART_ENABLE_CODEGEN_arm"],
122 },
123 arm64: {
124 cflags: ["-DART_ENABLE_CODEGEN_arm64"],
125 },
126 mips: {
127 cflags: ["-DART_ENABLE_CODEGEN_mips"],
128 },
129 mips64: {
130 cflags: ["-DART_ENABLE_CODEGEN_mips64"],
131 },
132 x86: {
133 cflags: ["-DART_ENABLE_CODEGEN_x86"],
134 },
135 x86_64: {
136 cflags: ["-DART_ENABLE_CODEGEN_x86_64"],
137 },
138 },
139
140 include_dirs: [
Colin Cross1f7f3bd2016-07-27 10:12:38 -0700141 "external/icu/icu4c/source/common",
142 "external/lz4/lib",
143 "external/valgrind/include",
144 "external/valgrind",
145 "external/vixl/src",
146 "external/zlib",
Igor Murashkin3b6f4402017-02-16 16:13:17 -0800147 "libnativehelper/platform_include"
Colin Cross1f7f3bd2016-07-27 10:12:38 -0700148 ],
Andreas Gampe61501212016-11-03 16:48:51 -0700149
150 tidy_checks: [
151 "-google-default-arguments",
Andreas Gampef45d61c2017-06-07 10:29:33 -0700152 // We have local stores that are only used for debug checks.
153 "-clang-analyzer-deadcode.DeadStores",
154 // We are OK with some static globals and that they can, in theory, throw.
155 "-cert-err58-cpp",
156 // We have lots of C-style variadic functions, and are OK with them. JNI ensures
157 // that working around this warning would be extra-painful.
158 "-cert-dcl50-cpp",
159 // No exceptions.
160 "-misc-noexcept-move-constructor",
Andreas Gampe61501212016-11-03 16:48:51 -0700161 ],
George Burgess IV7fb46652017-06-16 15:35:33 -0700162
163 tidy_flags: [
164 // The static analyzer treats DCHECK as always enabled; we sometimes get
165 // false positives when we use DCHECKs with code that relies on NDEBUG.
166 "-extra-arg=-UNDEBUG",
George Burgess IVdd8aa322017-06-21 16:34:35 -0700167 // clang-tidy complains about functions like:
168 // void foo() { CHECK(kIsFooEnabled); /* do foo... */ }
169 // not being marked noreturn if kIsFooEnabled is false.
170 "-extra-arg=-Wno-missing-noreturn",
George Burgess IV7fb46652017-06-16 15:35:33 -0700171 ],
Colin Cross1f7f3bd2016-07-27 10:12:38 -0700172}
173
Colin Crossbe332ed2016-09-21 13:23:53 -0700174art_debug_defaults {
Colin Cross1f7f3bd2016-07-27 10:12:38 -0700175 name: "art_debug_defaults",
176 cflags: [
Colin Cross1f7f3bd2016-07-27 10:12:38 -0700177 "-DDYNAMIC_ANNOTATIONS_ENABLED=1",
178 "-DVIXL_DEBUG",
179 "-UNDEBUG",
Colin Cross1f7f3bd2016-07-27 10:12:38 -0700180 ],
181 asflags: [
182 "-UNDEBUG",
183 ],
Colin Crossc5644062016-08-30 15:41:08 -0700184 target: {
185 // This has to be duplicated for android and host to make sure it
186 // comes after the -Wframe-larger-than warnings inserted by art.go
187 // target-specific properties
188 android: {
189 cflags: ["-Wno-frame-larger-than="],
190 },
191 host: {
192 cflags: ["-Wno-frame-larger-than="],
193 },
194 },
Colin Cross1f7f3bd2016-07-27 10:12:38 -0700195}