1# Copyright 2019 Google LLC 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# https://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14 15cc_library( 16 name = "libffi", 17 srcs = [ 18 "src/closures.c", 19 "src/debug.c", 20 "src/java_raw_api.c", 21 "src/prep_cif.c", 22 "src/raw_api.c", 23 "src/types.c", 24 ] + select({ 25 "@bazel_tools//src/conditions:linux_x86_64": [ 26 "src/x86/asmnames.h", 27 "src/x86/ffi.c", 28 "src/x86/ffi64.c", 29 "src/x86/ffiw64.c", 30 "src/x86/internal.h", 31 "src/x86/internal64.h", 32 "src/x86/sysv.S", 33 "src/x86/unix64.S", 34 "src/x86/win64.S", 35 ], 36 "@bazel_tools//src/conditions:linux_ppc": [ 37 "src/powerpc/ffi.c", 38 "src/powerpc/ffi_linux64.c", 39 "src/powerpc/ffi_sysv.c", 40 "src/powerpc/linux64.S", 41 "src/powerpc/linux64_closure.S", 42 "src/powerpc/ppc_closure.S", 43 "src/powerpc/sysv.S", 44 ], 45 "@bazel_tools//src/conditions:linux_aarch64": [ 46 "src/aarch64/ffi.c", 47 "src/aarch64/internal.h", 48 "src/aarch64/sysv.S", 49 ], 50 }), 51 hdrs = [ 52 "configure-bazel-gen/fficonfig.h", 53 "configure-bazel-gen/include/ffi.h", 54 "configure-bazel-gen/include/ffitarget.h", 55 "include/ffi_cfi.h", 56 "include/ffi_common.h", 57 ], 58 copts = [ 59 # libffi-3.3-rc0 uses variable length arrays for closures on all 60 # platforms. 61 "-Wno-vla", 62 # libffi does not check the result of ftruncate. 63 "-Wno-unused-result", 64 ], 65 includes = [ 66 "configure-bazel-gen", 67 "configure-bazel-gen/include", 68 "include", 69 ], 70 textual_hdrs = ["src/dlmalloc.c"], 71 visibility = ["//visibility:public"], 72) 73