[llvm] [bazel] Rework liblldb (PR #91549)

Aaron Siddhartha Mondal via llvm-commits llvm-commits at lists.llvm.org
Thu May 9 04:28:08 PDT 2024


================
@@ -728,37 +728,57 @@ cc_library(
     ],
 )
 
-cc_library(
-    name = "liblldb.static",
-    deps = [
-        ":API",
-        ":Interpreter",
-    ],
+genrule(
+    name = "gen_exports_file_linux",
+    srcs = ["//lldb:source/API/liblldb-private.exports"],
+    outs = ["exports_linux.txt"],
+    cmd = """
+cat > $(OUTS) <<EOF
+{
+  global:
+    $$(sed 's/$$/;/g' $(SRCS))
+};
+EOF
+""",
 )
 
-cc_shared_library(
-    name = "liblldb",
-    # TODO: Remove once fixed https://github.com/bazelbuild/bazel/issues/21893
+genrule(
+    name = "gen_exports_file_macos",
+    srcs = ["//lldb:source/API/liblldb-private.exports"],
+    outs = ["exports_macos.txt"],
+    cmd = "sed 's/^/_/g' $(SRCS) > $(OUTS)",
+)
+
+cc_binary(
+    name = "lldb{}".format(PACKAGE_VERSION),
----------------
aaronmondal wrote:

Not sure whether `select` works in the `name` attribute. If it does, how about naming this `"liblldb{}.so".format(PACKAGE_VERSION)` (or `.dylib`) explicitly?

On another note, the fact that we're using a `cc_binary` here is a fairly subtle detail. It might make sense to have a short comment explaining why we can't use `cc_shared_library` or `cc_library`.

https://github.com/llvm/llvm-project/pull/91549


More information about the llvm-commits mailing list