1// Copyright (C) 2016 The Android Open Source Project 2// All rights reserved. 3// 4// Redistribution and use in source and binary forms, with or without 5// modification, are permitted provided that the following conditions 6// are met: 7// * Redistributions of source code must retain the above copyright 8// notice, this list of conditions and the following disclaimer. 9// * Redistributions in binary form must reproduce the above copyright 10// notice, this list of conditions and the following disclaimer in 11// the documentation and/or other materials provided with the 12// distribution. 13// 14// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 15// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 16// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 17// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 18// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 19// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 20// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 21// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 22// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 23// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 24// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25// SUCH DAMAGE. 26// 27// 28// Copyright (c) 2016 VIXL authors 29// All rights reserved. 30// 31// Redistribution and use in source and binary forms, with or without 32// modification, are permitted provided that the following conditions 33// are met: 34// 1. Redistributions of source code must retain the above copyright 35// notice, this list of conditions and the following disclaimer. 36// 2. Redistributions in binary form must reproduce the above copyright 37// notice, this list of conditions and the following disclaimer in the 38// documentation and/or other materials provided with the distribution. 39// 3. The name of the company may not be used to endorse or promote 40// products derived from this software without specific prior written 41// permission. 42// 43// THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS'' AND ANY EXPRESS OR IMPLIED 44// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 45// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 46// IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 47// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 48// TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 49// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 50// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 51// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 52// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 53 54package { 55 default_visibility: ["//visibility:private"], 56 default_applicable_licenses: ["external_vixl_license"], 57} 58 59// Added automatically by a large-scale-change 60// See: http://go/android-license-faq 61license { 62 name: "external_vixl_license", 63 visibility: [":__subpackages__"], 64 license_kinds: [ 65 "SPDX-license-identifier-BSD", 66 ], 67 license_text: [ 68 "LICENCE", 69 ], 70} 71 72cc_defaults { 73 name: "vixl-common", 74 host_supported: true, 75 cflags: [ 76 "-Wimplicit-fallthrough", 77 ], 78 cppflags: [ 79 "-DVIXL_GENERATE_SIMULATOR_INSTRUCTIONS_VALUE=0", 80 "-fdiagnostics-show-option", 81 "-Wredundant-decls", 82 "-Wunreachable-code", 83 84 // Explicitly enable the write-strings warning. VIXL uses 85 // const correctly when handling string constants. 86 "-Wwrite-strings", 87 88 // Explicitly disable 'missing-return' warnings because a lot of them are false positive. 89 // VIXL often creates stubs and compile-time configurations with things like 90 // VIXL_UNIMPLEMENTED(). Properly satisfying -Wmissing-noreturn requires that functions are 91 // annotated at their _declarations_, which means #ifdefs in header files. 92 // Conditional compilation in headers can result in incorrect behaviour when 93 // libvixl.so is built with different flags than the code using it. Disabling this 94 // warning allows VIXL to simplify the headers, and should make VIXL more robust. 95 "-Wno-missing-noreturn", 96 97 "-DVIXL_CODE_BUFFER_MALLOC", 98 ], 99 native_coverage: false, 100 sanitize: { 101 recover: ["shift-exponent"], 102 }, 103} 104 105art_cc_defaults { 106 name: "vixl-arm", 107 defaults: ["vixl-common"], 108 codegen: { 109 arm: { 110 srcs: ["src/aarch32/*.cc"], 111 cppflags: [ 112 "-DVIXL_INCLUDE_TARGET_T32", 113 ], 114 }, 115 }, 116} 117 118art_cc_defaults { 119 name: "vixl-arm64", 120 defaults: ["vixl-common"], 121 codegen: { 122 arm64: { 123 srcs: ["src/aarch64/*.cc"], 124 cppflags: [ 125 "-DVIXL_INCLUDE_SIMULATOR_AARCH64", 126 "-DVIXL_INCLUDE_TARGET_A64", 127 ], 128 }, 129 }, 130} 131 132cc_defaults { 133 name: "vixl-debug", 134 defaults: ["vixl-common"], 135 cppflags: [ 136 "-DVIXL_DEBUG", 137 "-UNDEBUG", 138 139 "-O2", 140 "-ggdb3", 141 ], 142} 143 144cc_defaults { 145 name: "vixl-release", 146 defaults: ["vixl-common"], 147 cppflags: [ 148 "-O3", 149 ], 150} 151 152libvixl_visibility = [ 153 "//art:__subpackages__", 154] 155 156// Defaults for the libvixl[d] libraries 157cc_defaults { 158 name: "libvixl-defaults", 159 srcs: ["src/*.cc"], 160 export_include_dirs: ["src"], 161 min_sdk_version: "S", 162 163 static: { 164 cflags: [ 165 "-fvisibility=hidden", 166 ], 167 }, 168 shared: { 169 cflags: [ 170 "-fvisibility=protected", 171 ], 172 }, 173} 174 175art_cc_library { 176 name: "libvixl", 177 visibility: libvixl_visibility, 178 defaults: [ 179 "libvixl-defaults", 180 "vixl-release", 181 "vixl-arm", 182 "vixl-arm64", 183 ], 184 185 target: { 186 android: { 187 lto: { 188 thin: true, 189 }, 190 }, 191 }, 192 193 apex_available: [ 194 "com.android.art", 195 "com.android.art.debug", 196 ], 197} 198 199art_cc_library { 200 name: "libvixld", 201 visibility: libvixl_visibility, 202 defaults: [ 203 "libvixl-defaults", 204 "vixl-debug", 205 "vixl-arm", 206 "vixl-arm64", 207 ], 208 209 apex_available: [ 210 "com.android.art", 211 "com.android.art.debug", 212 ], 213} 214 215//######## VIXL HOST TESTS ######### 216// 217// We only support 64bit host builds for now. 218// To run all the tests: vixl-test-runner --run_all 219// 220cc_test_host { 221 name: "vixl-test-runner", 222 gtest: false, 223 defaults: [ 224 "vixl-debug", 225 "vixl-arm", 226 "vixl-arm64", 227 ], 228 local_include_dirs: [ 229 "test", 230 ], 231 exclude_srcs: [ 232 "test/test-donkey.cc", 233 ], 234 srcs: [ 235 "test/*.cc", 236 "test/aarch32/*.cc", 237 "test/aarch64/*.cc", 238 ], 239 static_libs: [ 240 "libvixld", 241 ], 242 data: [ 243 "test/test-trace-reference/*", 244 ], 245 enabled: false, 246 target: { 247 linux_glibc_x86_64: { 248 enabled: true, 249 }, 250 linux_musl_x86_64: { 251 enabled: true, 252 }, 253 }, 254} 255 256cc_genrule { 257 name: "vixl-test-timestamp", 258 srcs: [ 259 ":libc++", 260 ":vixl-test-runner", 261 "test/test-trace-reference/**/*", 262 ], 263 compile_multilib: "first", 264 host_supported: true, 265 device_supported: false, 266 cmd: "echo 'Running vixl tests' && " + 267 "cp $(location :vixl-test-runner) $(genDir)/ && " + 268 // Copy needed share libs for vixl-test-runner 269 "cp $(location :libc++) $(genDir)/ && " + 270 "mkdir -p $(genDir)/test/test-trace-reference/ && " + 271 "cp $(locations test/test-trace-reference/**/*) $(genDir)/test/test-trace-reference/ && " + 272 "cd $(genDir) && " + 273 "./vixl-test-runner --run_all 2>&1 && " + 274 "./vixl-test-runner --run_all --debugger 2>&1 && " + 275 "echo 'vixl tests PASSED' && " + 276 "touch vixl-test-timestamp.txt", 277 out: ["vixl-test-timestamp.txt"], 278 enabled: false, 279 target: { 280 linux_glibc_x86_64: { 281 enabled: true, 282 }, 283 linux_musl_x86_64: { 284 enabled: true, 285 }, 286 }, 287} 288 289phony_rule { 290 name: "run-vixl-tests", 291 phony_deps: [ 292 "vixl-test-timestamp", 293 ], 294} 295