[llvm] [bazel] Add rules for clang-fuzzer protobuf-related libraries (PR #123126)
Jorge Gorbe Moya via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 15 14:04:28 PST 2025
https://github.com/slackito created https://github.com/llvm/llvm-project/pull/123126
Also bumped up bazel_skylib to the latest version because the proto rules were complaining about a missing feature.
>From 08da2bada110b07f4f105da64e7a29b1acb6541c Mon Sep 17 00:00:00 2001
From: Jorge Gorbe Moya <jgorbe at google.com>
Date: Wed, 15 Jan 2025 11:54:26 -0800
Subject: [PATCH] [bazel] Add rules for clang-fuzzer protobuf-related libraries
---
utils/bazel/WORKSPACE | 10 ++++----
.../llvm-project-overlay/clang/BUILD.bazel | 24 +++++++++++++++++++
2 files changed, 29 insertions(+), 5 deletions(-)
diff --git a/utils/bazel/WORKSPACE b/utils/bazel/WORKSPACE
index 69373ed574e2ae..eeb1c692ac8712 100644
--- a/utils/bazel/WORKSPACE
+++ b/utils/bazel/WORKSPACE
@@ -5,11 +5,11 @@
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
-SKYLIB_VERSION = "1.3.0"
+SKYLIB_VERSION = "1.7.1"
http_archive(
name = "bazel_skylib",
- sha256 = "74d544d96f4a5bb630d465ca8bbcfe231e3594e5aae57e1edbf17a6eb3ca2506",
+ sha256 = "bc283cdfcd526a52c3201279cda4bc298652efa898b10b4db0837dc51652756f",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/{version}/bazel-skylib-{version}.tar.gz".format(version = SKYLIB_VERSION),
"https://github.com/bazelbuild/bazel-skylib/releases/download/{version}/bazel-skylib-{version}.tar.gz".format(version = SKYLIB_VERSION),
@@ -18,9 +18,9 @@ http_archive(
http_archive(
name = "rules_cc",
- urls = ["https://github.com/bazelbuild/rules_cc/releases/download/0.0.17/rules_cc-0.0.17.tar.gz"],
sha256 = "abc605dd850f813bb37004b77db20106a19311a96b2da1c92b789da529d28fe1",
strip_prefix = "rules_cc-0.0.17",
+ urls = ["https://github.com/bazelbuild/rules_cc/releases/download/0.0.17/rules_cc-0.0.17.tar.gz"],
)
new_local_repository(
@@ -158,9 +158,9 @@ maybe(
maybe(
http_archive,
name = "robin_map",
- strip_prefix = "robin-map-1.3.0",
- sha256 = "a8424ad3b0affd4c57ed26f0f3d8a29604f0e1f2ef2089f497f614b1c94c7236",
build_file = "@llvm-raw//utils/bazel/third_party_build:robin_map.BUILD",
+ sha256 = "a8424ad3b0affd4c57ed26f0f3d8a29604f0e1f2ef2089f497f614b1c94c7236",
+ strip_prefix = "robin-map-1.3.0",
url = "https://github.com/Tessil/robin-map/archive/refs/tags/v1.3.0.tar.gz",
)
diff --git a/utils/bazel/llvm-project-overlay/clang/BUILD.bazel b/utils/bazel/llvm-project-overlay/clang/BUILD.bazel
index 47e632098a41b9..200bc688737220 100644
--- a/utils/bazel/llvm-project-overlay/clang/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/clang/BUILD.bazel
@@ -2763,6 +2763,30 @@ cc_library(
],
)
+proto_library(
+ name = "cxx-proto",
+ srcs = ["tools/clang-fuzzer/cxx_proto.proto"],
+)
+
+cc_proto_library(
+ name = "cxx_cc_proto",
+ deps = [":cxx-proto"],
+)
+
+cc_library(
+ name = "proto-to-cxx-lib",
+ srcs = ["tools/clang-fuzzer/proto-to-cxx/proto_to_cxx.cpp"],
+ hdrs = ["tools/clang-fuzzer/proto-to-cxx/proto_to_cxx.h"],
+ includes = ["tools/clang-fuzzer"],
+ deps = [":cxx_cc_proto"],
+)
+
+cc_binary(
+ name = "clang-proto-to-cxx",
+ srcs = ["tools/clang-fuzzer/proto-to-cxx/proto_to_cxx_main.cpp"],
+ deps = [":proto-to-cxx-lib"],
+)
+
cc_library(
name = "clang-fuzzer-initialize",
srcs = ["tools/clang-fuzzer/fuzzer-initialize/fuzzer_initialize.cpp"],
More information about the llvm-commits
mailing list