1package { 2 default_applicable_licenses: ["external_llvm_license"], 3} 4 5// Added automatically by a large-scale-change that took the approach of 6// 'apply every license found to every target'. While this makes sure we respect 7// every license restriction, it may not be entirely correct. 8// 9// e.g. GPL in an MIT project might only apply to the contrib/ directory. 10// 11// Please consider splitting the single license below into multiple licenses, 12// taking care not to lose any license_kind information, and overriding the 13// default license using the 'licenses: [...]' property on targets as needed. 14// 15// For unused files, consider creating a 'fileGroup' with "//visibility:private" 16// to attach the license to, and including a comment whether the files may be 17// used in the current project. 18// 19// large-scale-change included anything that looked like it might be a license 20// text as a license_text. e.g. LICENSE, NOTICE, COPYING etc. 21// 22// Please consider removing redundant or irrelevant files from 'license_text:'. 23// 24// large-scale-change filtered out the below license kinds as false-positives: 25// SPDX-license-identifier-GPL 26// SPDX-license-identifier-GPL-3.0 27// See: http://go/android-license-faq 28license { 29 name: "external_llvm_license", 30 visibility: [":__subpackages__"], 31 license_kinds: [ 32 "SPDX-license-identifier-Apache-2.0", 33 "SPDX-license-identifier-BSD", 34 "SPDX-license-identifier-MIT", 35 "SPDX-license-identifier-NCSA", 36 "legacy_permissive", 37 "legacy_unencumbered", 38 ], 39 license_text: [ 40 "LICENSE.TXT", 41 "NOTICE", 42 ], 43} 44 45cc_defaults { 46 name: "llvm-defaults", 47 defaults: ["llvm-defaults-no-generated-headers"], 48 header_libs: ["llvm-headers"], 49 tidy_checks: [ 50 "-google-build-*", 51 "-google-global-*", 52 ], 53 sanitize: { 54 hwaddress: false, // code size b/112437884 55 }, 56 arch: { 57 riscv64: { 58 enabled: false, 59 }, 60 }, 61} 62 63// This module defines all of the defaults used to compiled llvm, except for 64// the generated headers. It is necessary to avoid a circular dependency 65// from the tblgen tool used to generate the headers to the generated headers. 66llvm_defaults { 67 name: "llvm-defaults-no-generated-headers", 68 69 host_supported: true, 70 // TODO(b/153609531): remove when no longer needed. 71 native_bridge_supported: true, 72 73 cpp_std: "c++11", 74 75 // Optimize for size. It is only used by Renderscript, which is deprecated and is rarely 76 // used. 77 optimize_for_size: true, 78 79 cflags: [ 80 "-D_GNU_SOURCE", 81 "-D__STDC_LIMIT_MACROS", 82 "-D__STDC_CONSTANT_MACROS", 83 "-D__STDC_FORMAT_MACROS", 84 "-fomit-frame-pointer", 85 "-Wall", 86 "-W", 87 "-Wno-cast-qual", 88 "-Wno-sign-compare", 89 "-Wno-unused-parameter", 90 "-Wno-maybe-uninitialized", 91 "-Wno-missing-field-initializers", 92 "-Wno-implicit-fallthrough", 93 "-Wno-deprecated-declarations", 94 "-Wwrite-strings", 95 "-Werror", 96 "-Dsprintf=sprintf", 97 ], 98 99 cppflags: [ 100 "-Wno-sign-promo", 101 ], 102 103 tidy_checks: [ 104 "-google-build-*", 105 "-google-global-*", 106 ], 107 108 header_libs: ["llvm-headers-no-generated-headers"], 109 110 target: { 111 android: { 112 cflags: [ 113 "-finline-functions", 114 ], 115 }, 116 linux: { 117 cppflags: [ 118 "-Woverloaded-virtual", 119 ], 120 }, 121 host: { 122 cppflags: [ 123 "-fno-rtti", 124 "-fno-exceptions", 125 ], 126 }, 127 windows: { 128 // Disable certain warnings for use with mingw. 129 // We also must undefine WIN32_LEAN_AND_MEAN, since it is being passed globally 130 // on the command line, and LLVM defines this internally itself. 131 cflags: [ 132 "-Wno-array-bounds", 133 "-Wno-comment", 134 "-UWIN32_LEAN_AND_MEAN", 135 ], 136 137 host_ldlibs: ["-luuid"], 138 }, 139 linux_glibc: { 140 host_ldlibs: [ 141 "-lgcc_s", 142 ], 143 }, 144 darwin: { 145 cppflags: [ 146 "-Wno-deprecated-declarations", 147 "-Woverloaded-virtual", 148 ], 149 }, 150 }, 151} 152 153cc_library_headers { 154 name: "llvm-headers-no-generated-headers", 155 vendor_available: true, 156 product_available: true, 157 host_supported: true, 158 // TODO(b/153609531): remove when no longer needed. 159 native_bridge_supported: true, 160 export_include_dirs: ["include"], 161 target: { 162 android: { 163 export_include_dirs: ["device/include"], 164 }, 165 host: { 166 export_include_dirs: ["host/include"], 167 }, 168 linux_bionic: { 169 enabled: true, 170 }, 171 windows: { 172 enabled: true, 173 }, 174 }, 175} 176 177cc_library_headers { 178 name: "llvm-headers", 179 vendor_available: true, 180 product_available: true, 181 host_supported: true, 182 // TODO(b/153609531): remove when no longer needed. 183 native_bridge_supported: true, 184 header_libs: ["llvm-headers-no-generated-headers"], 185 export_header_lib_headers: ["llvm-headers-no-generated-headers"], 186 generated_headers: [ 187 "llvm-gen-attributes", 188 "llvm-gen-intrinsics", 189 ], 190 export_generated_headers: [ 191 "llvm-gen-attributes", 192 "llvm-gen-intrinsics", 193 ], 194 target: { 195 windows: { 196 enabled: true, 197 }, 198 }, 199} 200 201llvm_tblgen { 202 name: "llvm-gen-attributes", 203 in: "include/llvm/IR/Attributes.td", 204 outs: ["llvm/IR/Attributes.inc"], 205} 206 207llvm_tblgen { 208 name: "llvm-gen-intrinsics", 209 in: "include/llvm/IR/Intrinsics.td", 210 outs: ["llvm/IR/Intrinsics.gen"], 211} 212 213force_build_llvm_components_defaults { 214 name: "force_build_llvm_components", 215 // Host build disabled by soong/llvm.go unless FORCE_BUILD_LLVM_COMPONENTS 216 // environment variable is set 217} 218 219// LLVM shared library build 220 221llvm_arm_static_libraries = [ 222 "libLLVMARMCodeGen", 223 "libLLVMARMAsmParser", 224 "libLLVMARMAsmPrinter", 225 "libLLVMARMInfo", 226 "libLLVMARMDesc", 227 "libLLVMARMDisassembler", 228] 229 230llvm_x86_static_libraries = [ 231 "libLLVMX86CodeGen", 232 "libLLVMX86Info", 233 "libLLVMX86Desc", 234 "libLLVMX86AsmParser", 235 "libLLVMX86AsmPrinter", 236 "libLLVMX86Utils", 237 "libLLVMX86Disassembler", 238] 239 240llvm_mips_static_libraries = [ 241 "libLLVMMipsCodeGen", 242 "libLLVMMipsInfo", 243 "libLLVMMipsDesc", 244 "libLLVMMipsAsmParser", 245 "libLLVMMipsAsmPrinter", 246 "libLLVMMipsDisassembler", 247] 248 249llvm_aarch64_static_libraries = [ 250 "libLLVMAArch64CodeGen", 251 "libLLVMAArch64Info", 252 "libLLVMAArch64Desc", 253 "libLLVMAArch64AsmParser", 254 "libLLVMAArch64AsmPrinter", 255 "libLLVMAArch64Utils", 256 "libLLVMAArch64Disassembler", 257] 258 259cc_library { 260 host_supported: true, 261 name: "libLLVM_android", 262 vendor_available: true, 263 product_available: true, 264 defaults: [ 265 "llvm-defaults", 266 "force_build_llvm_components", 267 ], 268 269 whole_static_libs: [ 270 // pre static libraries 271 "libLLVMLinker", 272 "libLLVMipo", 273 "libLLVMDebugInfoDWARF", 274 "libLLVMDebugInfoPDB", 275 "libLLVMSymbolize", 276 "libLLVMIRReader", 277 "libLLVMBitWriter", 278 "libLLVMBitReader", 279 280 // post static libraries 281 "libLLVMLTO", 282 "libLLVMAsmPrinter", 283 "libLLVMSelectionDAG", 284 "libLLVMCodeGen", 285 "libLLVMDebugInfoCodeView", 286 "libLLVMObject", 287 "libLLVMScalarOpts", 288 "libLLVMInstCombine", 289 "libLLVMInstrumentation", 290 "libLLVMTransformObjCARC", 291 "libLLVMTransformUtils", 292 "libLLVMAnalysis", 293 "libLLVMTarget", 294 "libLLVMGlobalISel", 295 "libLLVMMCDisassembler", 296 "libLLVMMC", 297 "libLLVMMCParser", 298 "libLLVMCore", 299 "libLLVMAsmParser", 300 "libLLVMOption", 301 "libLLVMSupport", 302 "libLLVMVectorize", 303 "libLLVMProfileData", 304 "libLLVMProfileDataCoverage", 305 "libLLVMLibDriver", 306 "libLLVMExecutionEngine", 307 "libLLVMRuntimeDyld", 308 "libLLVMMCJIT", 309 "libLLVMOrcJIT", 310 ], 311 312 export_include_dirs: ["include"], 313 314 target: { 315 host: { 316 // Host build pulls in all ARM, Mips, X86 components. 317 whole_static_libs: llvm_arm_static_libraries + 318 llvm_aarch64_static_libraries + 319 llvm_mips_static_libraries + 320 llvm_x86_static_libraries, 321 export_include_dirs: ["host/include"], 322 }, 323 windows: { 324 enabled: true, 325 host_ldlibs: [ 326 "-limagehlp", 327 "-lpsapi", 328 "-lole32", 329 "-lversion", 330 ], 331 }, 332 android: { 333 export_include_dirs: ["device/include"], 334 }, 335 android_arm: { 336 whole_static_libs: llvm_arm_static_libraries + 337 llvm_aarch64_static_libraries, 338 }, 339 android_x86: { 340 whole_static_libs: llvm_x86_static_libraries + 341 llvm_arm_static_libraries + 342 llvm_aarch64_static_libraries, 343 }, 344 android_x86_64: { 345 whole_static_libs: llvm_x86_static_libraries + 346 llvm_arm_static_libraries + 347 llvm_aarch64_static_libraries, 348 }, 349 android_arm64: { 350 whole_static_libs: llvm_aarch64_static_libraries + 351 llvm_arm_static_libraries, 352 }, 353 }, 354} 355 356subdirs = [ 357 "soong", 358 "lib", 359 "tools/*", 360 "utils/*", 361] 362