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 cflags: [ 74 "-D_GNU_SOURCE", 75 "-D__STDC_LIMIT_MACROS", 76 "-D__STDC_CONSTANT_MACROS", 77 "-D__STDC_FORMAT_MACROS", 78 "-fomit-frame-pointer", 79 "-Wall", 80 "-W", 81 "-Wno-cast-qual", 82 "-Wno-sign-compare", 83 "-Wno-unused-parameter", 84 "-Wno-maybe-uninitialized", 85 "-Wno-missing-field-initializers", 86 "-Wno-implicit-fallthrough", 87 "-Wwrite-strings", 88 "-Werror", 89 "-Dsprintf=sprintf", 90 ], 91 92 cppflags: [ 93 "-Wno-sign-promo", 94 "-std=c++11", 95 ], 96 97 tidy_checks: [ 98 "-google-build-*", 99 "-google-global-*", 100 ], 101 102 header_libs: ["llvm-headers-no-generated-headers"], 103 104 target: { 105 android: { 106 cflags: [ 107 "-finline-functions", 108 ], 109 }, 110 linux: { 111 cppflags: [ 112 "-Woverloaded-virtual", 113 ], 114 }, 115 host: { 116 cppflags: [ 117 "-fno-rtti", 118 "-fno-exceptions", 119 ], 120 }, 121 windows: { 122 // Disable certain warnings for use with mingw. 123 // We also must undefine WIN32_LEAN_AND_MEAN, since it is being passed globally 124 // on the command line, and LLVM defines this internally itself. 125 cflags: [ 126 "-Wno-array-bounds", 127 "-Wno-comment", 128 "-UWIN32_LEAN_AND_MEAN", 129 ], 130 131 host_ldlibs: ["-luuid"], 132 }, 133 linux_glibc: { 134 host_ldlibs: [ 135 "-lgcc_s", 136 ], 137 }, 138 darwin: { 139 cppflags: [ 140 "-Wno-deprecated-declarations", 141 "-Woverloaded-virtual", 142 ], 143 }, 144 }, 145} 146 147cc_library_headers { 148 name: "llvm-headers-no-generated-headers", 149 vendor_available: true, 150 product_available: true, 151 host_supported: true, 152 // TODO(b/153609531): remove when no longer needed. 153 native_bridge_supported: true, 154 export_include_dirs: ["include"], 155 target: { 156 android: { 157 export_include_dirs: ["device/include"], 158 }, 159 host: { 160 export_include_dirs: ["host/include"], 161 }, 162 linux_bionic: { 163 enabled: true, 164 }, 165 windows: { 166 enabled: true, 167 }, 168 }, 169} 170 171cc_library_headers { 172 name: "llvm-headers", 173 vendor_available: true, 174 product_available: true, 175 host_supported: true, 176 // TODO(b/153609531): remove when no longer needed. 177 native_bridge_supported: true, 178 header_libs: ["llvm-headers-no-generated-headers"], 179 export_header_lib_headers: ["llvm-headers-no-generated-headers"], 180 generated_headers: [ 181 "llvm-gen-attributes", 182 "llvm-gen-intrinsics", 183 ], 184 export_generated_headers: [ 185 "llvm-gen-attributes", 186 "llvm-gen-intrinsics", 187 ], 188 target: { 189 windows: { 190 enabled: true, 191 }, 192 }, 193} 194 195llvm_tblgen { 196 name: "llvm-gen-attributes", 197 in: "include/llvm/IR/Attributes.td", 198 outs: ["llvm/IR/Attributes.inc"], 199} 200 201llvm_tblgen { 202 name: "llvm-gen-intrinsics", 203 in: "include/llvm/IR/Intrinsics.td", 204 outs: ["llvm/IR/Intrinsics.gen"], 205} 206 207force_build_llvm_components_defaults { 208 name: "force_build_llvm_components", 209 // Host build disabled by soong/llvm.go unless FORCE_BUILD_LLVM_COMPONENTS 210 // environment variable is set 211} 212 213// LLVM shared library build 214 215llvm_arm_static_libraries = [ 216 "libLLVMARMCodeGen", 217 "libLLVMARMAsmParser", 218 "libLLVMARMAsmPrinter", 219 "libLLVMARMInfo", 220 "libLLVMARMDesc", 221 "libLLVMARMDisassembler", 222] 223 224llvm_x86_static_libraries = [ 225 "libLLVMX86CodeGen", 226 "libLLVMX86Info", 227 "libLLVMX86Desc", 228 "libLLVMX86AsmParser", 229 "libLLVMX86AsmPrinter", 230 "libLLVMX86Utils", 231 "libLLVMX86Disassembler", 232] 233 234llvm_mips_static_libraries = [ 235 "libLLVMMipsCodeGen", 236 "libLLVMMipsInfo", 237 "libLLVMMipsDesc", 238 "libLLVMMipsAsmParser", 239 "libLLVMMipsAsmPrinter", 240 "libLLVMMipsDisassembler", 241] 242 243llvm_aarch64_static_libraries = [ 244 "libLLVMAArch64CodeGen", 245 "libLLVMAArch64Info", 246 "libLLVMAArch64Desc", 247 "libLLVMAArch64AsmParser", 248 "libLLVMAArch64AsmPrinter", 249 "libLLVMAArch64Utils", 250 "libLLVMAArch64Disassembler", 251] 252 253cc_library { 254 host_supported: true, 255 name: "libLLVM_android", 256 vendor_available: true, 257 product_available: true, 258 defaults: [ 259 "llvm-defaults", 260 "force_build_llvm_components", 261 ], 262 263 whole_static_libs: [ 264 // pre static libraries 265 "libLLVMLinker", 266 "libLLVMipo", 267 "libLLVMDebugInfoDWARF", 268 "libLLVMDebugInfoPDB", 269 "libLLVMSymbolize", 270 "libLLVMIRReader", 271 "libLLVMBitWriter", 272 "libLLVMBitReader", 273 274 // post static libraries 275 "libLLVMLTO", 276 "libLLVMAsmPrinter", 277 "libLLVMSelectionDAG", 278 "libLLVMCodeGen", 279 "libLLVMDebugInfoCodeView", 280 "libLLVMObject", 281 "libLLVMScalarOpts", 282 "libLLVMInstCombine", 283 "libLLVMInstrumentation", 284 "libLLVMTransformObjCARC", 285 "libLLVMTransformUtils", 286 "libLLVMAnalysis", 287 "libLLVMTarget", 288 "libLLVMGlobalISel", 289 "libLLVMMCDisassembler", 290 "libLLVMMC", 291 "libLLVMMCParser", 292 "libLLVMCore", 293 "libLLVMAsmParser", 294 "libLLVMOption", 295 "libLLVMSupport", 296 "libLLVMVectorize", 297 "libLLVMProfileData", 298 "libLLVMProfileDataCoverage", 299 "libLLVMLibDriver", 300 "libLLVMExecutionEngine", 301 "libLLVMRuntimeDyld", 302 "libLLVMMCJIT", 303 "libLLVMOrcJIT", 304 ], 305 306 export_include_dirs: ["include"], 307 308 target: { 309 host: { 310 // Host build pulls in all ARM, Mips, X86 components. 311 whole_static_libs: llvm_arm_static_libraries + 312 llvm_aarch64_static_libraries + 313 llvm_mips_static_libraries + 314 llvm_x86_static_libraries, 315 export_include_dirs: ["host/include"], 316 }, 317 windows: { 318 enabled: true, 319 host_ldlibs: [ 320 "-limagehlp", 321 "-lpsapi", 322 "-lole32", 323 "-lversion", 324 ], 325 }, 326 android: { 327 export_include_dirs: ["device/include"], 328 }, 329 android_arm: { 330 whole_static_libs: llvm_arm_static_libraries + 331 llvm_aarch64_static_libraries, 332 }, 333 android_x86: { 334 whole_static_libs: llvm_x86_static_libraries + 335 llvm_arm_static_libraries + 336 llvm_aarch64_static_libraries, 337 }, 338 android_x86_64: { 339 whole_static_libs: llvm_x86_static_libraries + 340 llvm_arm_static_libraries + 341 llvm_aarch64_static_libraries, 342 }, 343 android_arm64: { 344 whole_static_libs: llvm_aarch64_static_libraries + 345 llvm_arm_static_libraries, 346 }, 347 }, 348} 349 350subdirs = [ 351 "soong", 352 "lib", 353 "tools/*", 354 "utils/*", 355] 356