[llvm] [bazel] Add support for building orc_rt (PR #87730)
Keith Smiley via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 4 16:59:36 PDT 2024
https://github.com/keith created https://github.com/llvm/llvm-project/pull/87730
None
>From e305b658d3269999e16dfed51b7fe3f6274697a1 Mon Sep 17 00:00:00 2001
From: Keith Smiley <keithbsmiley at gmail.com>
Date: Thu, 4 Apr 2024 16:58:58 -0700
Subject: [PATCH] [bazel] Add support for building orc_rt
---
.../compiler-rt/BUILD.bazel | 54 +++++++++++++++++++
.../lib/orc/tests/unit/BUILD.bazel | 23 ++++++++
2 files changed, 77 insertions(+)
create mode 100644 utils/bazel/llvm-project-overlay/compiler-rt/lib/orc/tests/unit/BUILD.bazel
diff --git a/utils/bazel/llvm-project-overlay/compiler-rt/BUILD.bazel b/utils/bazel/llvm-project-overlay/compiler-rt/BUILD.bazel
index 577e6c033b4e81..9a4e103be01e2c 100644
--- a/utils/bazel/llvm-project-overlay/compiler-rt/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/compiler-rt/BUILD.bazel
@@ -54,3 +54,57 @@ cc_library(
":config",
],
)
+
+cc_library(
+ name = "orc_rt_common_headers",
+ hdrs = [
+ "lib/orc/adt.h",
+ "lib/orc/bitmask_enum.h",
+ "lib/orc/common.h",
+ "lib/orc/compiler.h",
+ "lib/orc/debug.h",
+ "lib/orc/endianness.h",
+ "lib/orc/error.h",
+ "lib/orc/executor_address.h",
+ "lib/orc/executor_symbol_def.h",
+ "lib/orc/extensible_rtti.h",
+ "lib/orc/interval_map.h",
+ "lib/orc/interval_set.h",
+ "lib/orc/simple_packed_serialization.h",
+ "lib/orc/stl_extras.h",
+ "lib/orc/string_pool.h",
+ "lib/orc/wrapper_function_utils.h",
+ ],
+ strip_include_prefix = "lib/orc",
+)
+
+cc_library(
+ name = "orc_rt",
+ srcs = [
+ "lib/orc/debug.cpp",
+ "lib/orc/dlfcn_wrapper.cpp",
+ "lib/orc/extensible_rtti.cpp",
+ "lib/orc/log_error_to_stderr.cpp",
+ "lib/orc/run_program_wrapper.cpp",
+ ] + select({
+ "@platforms//os:macos": [
+ "lib/orc/macho_platform.cpp",
+ "lib/orc/macho_platform.h",
+ "lib/orc/macho_tlv.arm64.S",
+ "lib/orc/macho_tlv.x86-64.S",
+ ],
+ "@platforms//os:linux": [
+ "lib/orc/elfnix_platform.cpp",
+ "lib/orc/elfnix_platform.h",
+ "lib/orc/elfnix_tls.aarch64.S",
+ "lib/orc/elfnix_tls.ppc64.S",
+ "lib/orc/elfnix_tls.x86-64.S",
+ ],
+ }),
+ hdrs = glob(["include/orc_rt/*.h"]),
+ includes = ["include"],
+ linkstatic = True,
+ deps = [
+ ":orc_rt_common_headers",
+ ],
+)
diff --git a/utils/bazel/llvm-project-overlay/compiler-rt/lib/orc/tests/unit/BUILD.bazel b/utils/bazel/llvm-project-overlay/compiler-rt/lib/orc/tests/unit/BUILD.bazel
new file mode 100644
index 00000000000000..29db1d173382ce
--- /dev/null
+++ b/utils/bazel/llvm-project-overlay/compiler-rt/lib/orc/tests/unit/BUILD.bazel
@@ -0,0 +1,23 @@
+# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+package(
+ default_visibility = ["//visibility:public"],
+ features = ["layering_check"],
+)
+
+licenses(["notice"])
+
+[
+ cc_test(
+ name = "{}".format(file.split(".")[0]),
+ srcs = [file] + glob(["*.h"]),
+ deps = [
+ "//compiler-rt:orc_rt",
+ "//compiler-rt:orc_rt_common_headers",
+ "//third-party/unittest:gtest_main",
+ ],
+ )
+ for file in glob(["*.cpp"])
+]
More information about the llvm-commits
mailing list