1# This file is licensed under the Apache License v2.0 with LLVM Exceptions. 2# See https://llvm.org/LICENSE.txt for license information. 3# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 4 5package( 6 default_visibility = ["//visibility:public"], 7 features = ["layering_check"], 8) 9 10licenses(["notice"]) 11 12cc_library( 13 name = "config", 14 defines = select({ 15 "@platforms//os:linux": [ 16 "COMPILER_RT_HAS_ATOMICS=1", 17 "COMPILER_RT_HAS_FCNTL_LCK=1", 18 "COMPILER_RT_HAS_UNAME=1", 19 ], 20 # Will raise error unless supported platforms. 21 }), 22 target_compatible_with = select({ 23 "@platforms//os:linux": [], 24 "//conditions:default": ["@platforms//:incompatible"], 25 }), 26) 27 28WIN32_ONLY_FILES = [ 29 "lib/profile/WindowsMMap.c", 30] 31 32cc_library( 33 name = "profile", 34 srcs = glob( 35 [ 36 "lib/profile/*.c", 37 "lib/profile/*.cpp", 38 "lib/profile/*.h", 39 ], 40 exclude = WIN32_ONLY_FILES, 41 ) + select({ 42 "@platforms//os:windows": WIN32_ONLY_FILES, 43 "//conditions:default": [], 44 }), 45 hdrs = glob([ 46 "include/profile/*.h", 47 "include/profile/*.inc", 48 ]), 49 includes = [ 50 "include", 51 ], 52 linkstatic = True, 53 deps = [ 54 ":config", 55 ], 56) 57 58cc_library( 59 name = "orc_rt_common_headers", 60 hdrs = [ 61 "lib/orc/adt.h", 62 "lib/orc/bitmask_enum.h", 63 "lib/orc/common.h", 64 "lib/orc/compiler.h", 65 "lib/orc/debug.h", 66 "lib/orc/endianness.h", 67 "lib/orc/error.h", 68 "lib/orc/executor_address.h", 69 "lib/orc/executor_symbol_def.h", 70 "lib/orc/extensible_rtti.h", 71 "lib/orc/interval_map.h", 72 "lib/orc/interval_set.h", 73 "lib/orc/jit_dispatch.h", 74 "lib/orc/record_section_tracker.h", 75 "lib/orc/simple_packed_serialization.h", 76 "lib/orc/stl_extras.h", 77 "lib/orc/string_pool.h", 78 "lib/orc/wrapper_function_utils.h", 79 ], 80 strip_include_prefix = "lib/orc", 81) 82 83cc_library( 84 name = "orc_rt", 85 srcs = [ 86 "lib/orc/debug.cpp", 87 "lib/orc/dlfcn_wrapper.cpp", 88 "lib/orc/extensible_rtti.cpp", 89 "lib/orc/log_error_to_stderr.cpp", 90 "lib/orc/run_program_wrapper.cpp", 91 ] + select({ 92 "@platforms//os:macos": [ 93 "lib/orc/macho_platform.cpp", 94 "lib/orc/macho_platform.h", 95 "lib/orc/macho_tlv.arm64.S", 96 "lib/orc/macho_tlv.x86-64.S", 97 ], 98 "@platforms//os:linux": [ 99 "lib/orc/elfnix_platform.cpp", 100 "lib/orc/elfnix_platform.h", 101 "lib/orc/elfnix_tls.aarch64.S", 102 "lib/orc/elfnix_tls.ppc64.S", 103 "lib/orc/elfnix_tls.x86-64.S", 104 ], 105 }), 106 hdrs = glob(["include/orc_rt/*.h"]), 107 includes = ["include"], 108 linkstatic = True, 109 deps = [ 110 ":orc_rt_common_headers", 111 ], 112) 113