Skip to content

Commit 1341760

Browse files
authored
[bazel] Add support for building orc_rt (#87730)
1 parent 7c9c38e commit 1341760

File tree

2 files changed

+82
-0
lines changed

2 files changed

+82
-0
lines changed

utils/bazel/llvm-project-overlay/compiler-rt/BUILD.bazel

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,57 @@ cc_library(
5454
":config",
5555
],
5656
)
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/extensible_rtti.h",
71+
"lib/orc/interval_map.h",
72+
"lib/orc/interval_set.h",
73+
"lib/orc/simple_packed_serialization.h",
74+
"lib/orc/stl_extras.h",
75+
"lib/orc/string_pool.h",
76+
"lib/orc/wrapper_function_utils.h",
77+
],
78+
strip_include_prefix = "lib/orc",
79+
)
80+
81+
cc_library(
82+
name = "orc_rt",
83+
srcs = [
84+
"lib/orc/debug.cpp",
85+
"lib/orc/dlfcn_wrapper.cpp",
86+
"lib/orc/extensible_rtti.cpp",
87+
"lib/orc/log_error_to_stderr.cpp",
88+
"lib/orc/run_program_wrapper.cpp",
89+
] + select({
90+
"@platforms//os:macos": [
91+
"lib/orc/macho_platform.cpp",
92+
"lib/orc/macho_platform.h",
93+
"lib/orc/macho_tlv.arm64.S",
94+
"lib/orc/macho_tlv.x86-64.S",
95+
],
96+
"@platforms//os:linux": [
97+
"lib/orc/elfnix_platform.cpp",
98+
"lib/orc/elfnix_platform.h",
99+
"lib/orc/elfnix_tls.aarch64.S",
100+
"lib/orc/elfnix_tls.ppc64.S",
101+
"lib/orc/elfnix_tls.x86-64.S",
102+
],
103+
}),
104+
hdrs = glob(["include/orc_rt/*.h"]),
105+
includes = ["include"],
106+
linkstatic = True,
107+
deps = [
108+
":orc_rt_common_headers",
109+
],
110+
)
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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+
[
13+
cc_test(
14+
name = "{}".format(file.split(".")[0]),
15+
srcs = [file] + glob(["*.h"]),
16+
deps = [
17+
"//compiler-rt:orc_rt",
18+
"//compiler-rt:orc_rt_common_headers",
19+
"//third-party/unittest:gtest",
20+
"//third-party/unittest:gtest_main",
21+
],
22+
)
23+
for file in glob(
24+
["*.cpp"],
25+
# TODO: Broken with older libc++ versions, currently unused anyways
26+
exclude = ["interval_set_test.cpp"],
27+
)
28+
]

0 commit comments

Comments
 (0)