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 "-Wall", 77 "-Werror", 78 "-Wimplicit-fallthrough", 79 ], 80 cppflags: [ 81 "-DVIXL_GENERATE_SIMULATOR_INSTRUCTIONS_VALUE=0", 82 "-Wextra", 83 "-fdiagnostics-show-option", 84 "-Wredundant-decls", 85 "-Wunreachable-code", 86 "-pedantic", 87 88 // Explicitly enable the write-strings warning. VIXL uses 89 // const correctly when handling string constants. 90 "-Wwrite-strings", 91 92 // Explicitly disable 'missing-return' warnings because a lot of them are false positive. 93 // VIXL often creates stubs and compile-time configurations with things like 94 // VIXL_UNIMPLEMENTED(). Properly satisfying -Wmissing-noreturn requires that functions are 95 // annotated at their _declarations_, which means #ifdefs in header files. 96 // Conditional compilation in headers can result in incorrect behaviour when 97 // libvixl.so is built with different flags than the code using it. Disabling this 98 // warning allows VIXL to simplify the headers, and should make VIXL more robust. 99 "-Wno-missing-noreturn", 100 101 "-DVIXL_CODE_BUFFER_MALLOC", 102 ], 103 native_coverage: false, 104 sanitize: { 105 recover: ["shift-exponent"], 106 }, 107} 108 109art_cc_defaults { 110 name: "vixl-arm", 111 defaults: ["vixl-common"], 112 codegen: { 113 arm: { 114 srcs: ["src/aarch32/*.cc"], 115 cppflags: [ 116 "-DVIXL_INCLUDE_TARGET_T32", 117 ], 118 }, 119 }, 120} 121 122art_cc_defaults { 123 name: "vixl-arm64", 124 defaults: ["vixl-common"], 125 codegen: { 126 arm64: { 127 srcs: ["src/aarch64/*.cc"], 128 cppflags: [ 129 "-DVIXL_INCLUDE_SIMULATOR_AARCH64", 130 "-DVIXL_INCLUDE_TARGET_A64", 131 ], 132 }, 133 }, 134} 135 136cc_defaults { 137 name: "vixl-debug", 138 defaults: ["vixl-common"], 139 cppflags: [ 140 "-DVIXL_DEBUG", 141 "-UNDEBUG", 142 143 "-O2", 144 "-ggdb3", 145 ], 146} 147 148cc_defaults { 149 name: "vixl-release", 150 defaults: ["vixl-common"], 151 cppflags: [ 152 "-O3", 153 ], 154} 155 156libvixl_visibility = [ 157 "//art:__subpackages__", 158] 159 160// Defaults for the libvixl[d] libraries 161cc_defaults { 162 name: "libvixl-defaults", 163 srcs: ["src/*.cc"], 164 export_include_dirs: ["src"], 165 min_sdk_version: "S", 166 167 static: { 168 cflags: [ 169 "-fvisibility=hidden", 170 ], 171 }, 172 shared: { 173 cflags: [ 174 "-fvisibility=protected", 175 ], 176 }, 177} 178 179art_cc_library { 180 name: "libvixl", 181 visibility: libvixl_visibility, 182 defaults: [ 183 "libvixl-defaults", 184 "vixl-release", 185 "vixl-arm", 186 "vixl-arm64", 187 ], 188 189 target: { 190 android: { 191 lto: { 192 thin: true, 193 }, 194 }, 195 }, 196 197 apex_available: [ 198 "com.android.art", 199 "com.android.art.debug", 200 ], 201} 202 203art_cc_library { 204 name: "libvixld", 205 visibility: libvixl_visibility, 206 defaults: [ 207 "libvixl-defaults", 208 "vixl-debug", 209 "vixl-arm", 210 "vixl-arm64", 211 ], 212 213 apex_available: [ 214 "com.android.art", 215 "com.android.art.debug", 216 ], 217} 218 219//######## VIXL HOST TESTS ######### 220// 221// We only support 64bit host builds for now. 222// To run all the tests: vixl-test-runner --run_all 223// 224cc_test_host { 225 name: "vixl-test-runner", 226 gtest: false, 227 defaults: [ 228 "vixl-debug", 229 "vixl-arm", 230 "vixl-arm64", 231 ], 232 local_include_dirs: [ 233 "test", 234 ], 235 exclude_srcs: [ 236 "test/test-donkey.cc", 237 ], 238 srcs: [ 239 "test/*.cc", 240 "test/aarch32/*.cc", 241 "test/aarch64/*.cc", 242 ], 243 static_libs: [ 244 "libvixld", 245 ], 246 data: [ 247 "test/test-trace-reference/*", 248 ], 249 enabled: false, 250 target: { 251 linux_glibc_x86_64: { 252 enabled: true, 253 }, 254 linux_musl_x86_64: { 255 enabled: true, 256 }, 257 }, 258} 259 260cc_genrule { 261 name: "vixl-test-timestamp", 262 srcs: [ 263 ":libc++", 264 ":vixl-test-runner", 265 "test/test-trace-reference/**/*", 266 ], 267 compile_multilib: "first", 268 host_supported: true, 269 device_supported: false, 270 cmd: "echo 'Running vixl tests' && " + 271 "cp $(location :vixl-test-runner) $(genDir)/ && " + 272 // Copy needed share libs for vixl-test-runner 273 "cp $(location :libc++) $(genDir)/ && " + 274 "mkdir -p $(genDir)/test/test-trace-reference/ && " + 275 "cp $(locations test/test-trace-reference/**/*) $(genDir)/test/test-trace-reference/ && " + 276 "cd $(genDir) && " + 277 "./vixl-test-runner --run_all 2>&1 && " + 278 "./vixl-test-runner --run_all --debugger 2>&1 && " + 279 "echo 'vixl tests PASSED' && " + 280 "touch vixl-test-timestamp.txt", 281 out: ["vixl-test-timestamp.txt"], 282 enabled: false, 283 target: { 284 linux_glibc_x86_64: { 285 enabled: true, 286 }, 287 linux_musl_x86_64: { 288 enabled: true, 289 }, 290 }, 291} 292 293phony_rule { 294 name: "run-vixl-tests", 295 phony_deps: [ 296 "vixl-test-timestamp", 297 ], 298} 299