| 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 |
|
| 5 |
package( |
| 6 |
default_visibility = ["//visibility:public"], |
| 7 |
features = ["layering_check"], |
| 8 |
) |
| 9 |
|
| 10 |
licenses(["notice"]) |
| 11 |
|
| 12 |
cc_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 |
|
| 28 |
WIN32_ONLY_FILES = [ |
| 29 |
"lib/profile/WindowsMMap.c", |
| 30 |
] |
| 31 |
|
| 32 |
cc_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 |
|
| 58 |
cc_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/interval_map.h", |
| 71 |
"lib/orc/interval_set.h", |
| 72 |
"lib/orc/jit_dispatch.h", |
| 73 |
"lib/orc/record_section_tracker.h", |
| 74 |
"lib/orc/rtti.h", |
| 75 |
"lib/orc/simple_packed_serialization.h", |
| 76 |
"lib/orc/stl_extras.h", |
| 77 |
"lib/orc/string_pool.h", |
| 78 |
"lib/orc/unique_function.h", |
| 79 |
"lib/orc/wrapper_function_utils.h", |
| 80 |
], |
| 81 |
strip_include_prefix = "lib/orc", |
| 82 |
) |
| 83 |
|
| 84 |
cc_library( |
| 85 |
name = "orc_rt", |
| 86 |
srcs = [ |
| 87 |
"lib/orc/debug.cpp", |
| 88 |
"lib/orc/dlfcn_wrapper.cpp", |
| 89 |
"lib/orc/log_error_to_stderr.cpp", |
| 90 |
"lib/orc/rtti.cpp", |
| 91 |
"lib/orc/run_program_wrapper.cpp", |
| 92 |
] + select({ |
| 93 |
"@platforms//os:macos": [ |
| 94 |
"lib/orc/macho_platform.cpp", |
| 95 |
"lib/orc/macho_platform.h", |
| 96 |
"lib/orc/macho_tlv.arm64.S", |
| 97 |
"lib/orc/macho_tlv.x86-64.S", |
| 98 |
], |
| 99 |
"@platforms//os:linux": [ |
| 100 |
"lib/orc/elfnix_platform.cpp", |
| 101 |
"lib/orc/elfnix_platform.h", |
| 102 |
"lib/orc/elfnix_tls.aarch64.S", |
| 103 |
"lib/orc/elfnix_tls.ppc64.S", |
| 104 |
"lib/orc/elfnix_tls.x86-64.S", |
| 105 |
], |
| 106 |
}), |
| 107 |
hdrs = glob(["include/orc_rt/*.h"]), |
| 108 |
includes = ["include"], |
| 109 |
linkstatic = True, |
| 110 |
deps = [ |
| 111 |
":orc_rt_common_headers", |
| 112 |
], |
| 113 |
) |