[llvm] [Bazel] Support opt-driver library, like clang-driver (PR #79205)
William Moses via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 23 12:18:54 PST 2024
https://github.com/wsmoses created https://github.com/llvm/llvm-project/pull/79205
In Bazel, Clang current separates the clang executable into a clang-driver library, and the actual clang executable. This allows downstream users to make their own variations of clang, without having to redo/maintain separate build pipelines.
This adds the same for opt.
>From 1c9d5c6760a5d150e6c7c8478ae1fffe15741dcf Mon Sep 17 00:00:00 2001
From: "William S. Moses" <gh at wsmoses.com>
Date: Tue, 23 Jan 2024 15:17:10 -0500
Subject: [PATCH] [Bazel] Support opt-driver library, like clang-driver
---
utils/bazel/llvm-project-overlay/llvm/BUILD.bazel | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel b/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel
index b22ec01376be6d4..21466a79af61b53 100644
--- a/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel
@@ -4808,8 +4808,8 @@ cc_binary(
],
)
-cc_binary(
- name = "opt",
+cc_library(
+ name = "opt-driver",
srcs = glob([
"tools/opt/*.cpp",
"tools/opt/*.h",
@@ -4820,7 +4820,6 @@ cc_binary(
"@platforms//os:macos": [],
"//conditions:default": ["-Wl,--export-dynamic"],
}),
- stamp = 0,
deps = [
":AllTargetsAsmParsers",
":AllTargetsCodeGens",
@@ -4847,6 +4846,12 @@ cc_binary(
],
)
+cc_binary(
+ name = "opt",
+ stamp = 0,
+ deps = [":opt-driver"]
+)
+
gentbl(
name = "SancovOptsTableGen",
strip_include_prefix = "tools/sancov",
More information about the llvm-commits
mailing list