[llvm] libc bazel (PR #119433)
Nick Desaulniers via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 10 10:58:37 PST 2024
https://github.com/nickdesaulniers updated https://github.com/llvm/llvm-project/pull/119433
>From 12fca092ecc7fa2c14c8e812deb948f1c0c3d7f6 Mon Sep 17 00:00:00 2001
From: Nick Desaulniers <ndesaulniers at google.com>
Date: Tue, 10 Dec 2024 10:08:25 -0800
Subject: [PATCH 1/5] [bazel] update .bazelversion to 8.0.0
Fixes:
ERROR: The project you're trying to build requires Bazel 7.3.0 (specified
in llvm-project/utils/bazel/.bazelversion), but it wasn't found in
/usr/bin.
You can install the required Bazel version via apt:
sudo apt update && sudo apt install bazel-7.3.0
If this doesn't work, check Bazel's installation instructions for help:
https://bazel.build/install/ubuntu
Link: https://blog.bazel.build/2024/12/09/bazel-8-release.html
---
utils/bazel/.bazelversion | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/utils/bazel/.bazelversion b/utils/bazel/.bazelversion
index 1502020768a7b4..ae9a76b9249ada 100644
--- a/utils/bazel/.bazelversion
+++ b/utils/bazel/.bazelversion
@@ -1 +1 @@
-7.3.0
+8.0.0
>From 64f6c1dc10b275f247cfcc66a3ae605d09615c67 Mon Sep 17 00:00:00 2001
From: Nick Desaulniers <ndesaulniers at google.com>
Date: Tue, 10 Dec 2024 10:40:20 -0800
Subject: [PATCH 2/5] add --enable_workspace to .bazelrc
---
utils/bazel/.bazelrc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/utils/bazel/.bazelrc b/utils/bazel/.bazelrc
index 2628352f5162b6..3a49d4e0898c0c 100644
--- a/utils/bazel/.bazelrc
+++ b/utils/bazel/.bazelrc
@@ -9,7 +9,7 @@
# Flip off to disable MODULE.bazel until we're ready.
# https://github.com/llvm/llvm-project/issues/55924
-common --enable_bzlmod=false
+common --enable_bzlmod=false --enable_workspace
# Prevent invalid caching if input files are modified during a build.
build --experimental_guard_against_concurrent_changes
>From b8bd85c35c093e86f455c2186eb2389381a04a31 Mon Sep 17 00:00:00 2001
From: Nick Desaulniers <ndesaulniers at google.com>
Date: Tue, 10 Dec 2024 10:40:45 -0800
Subject: [PATCH 3/5] add explict http_archive for rules_cc
---
utils/bazel/WORKSPACE | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/utils/bazel/WORKSPACE b/utils/bazel/WORKSPACE
index 66ba1ac1b17e1e..b6b1a0c3bd0f3e 100644
--- a/utils/bazel/WORKSPACE
+++ b/utils/bazel/WORKSPACE
@@ -16,6 +16,14 @@ http_archive(
],
)
+# https://github.com/bazelbuild/rules_cc/releases/tag/0.0.17
+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",
+)
+
new_local_repository(
name = "llvm-raw",
build_file_content = "# empty",
>From 3168b9fc0b2dbc468c4e3d170caf38ec6f327fd6 Mon Sep 17 00:00:00 2001
From: Nick Desaulniers <ndesaulniers at google.com>
Date: Tue, 10 Dec 2024 10:44:45 -0800
Subject: [PATCH 4/5] upgrade rules_python to 1.0.0
---
utils/bazel/WORKSPACE | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/utils/bazel/WORKSPACE b/utils/bazel/WORKSPACE
index b6b1a0c3bd0f3e..b24dfd17afcd2c 100644
--- a/utils/bazel/WORKSPACE
+++ b/utils/bazel/WORKSPACE
@@ -37,9 +37,9 @@ llvm_configure(name = "llvm-project")
maybe(
http_archive,
name = "rules_python",
- sha256 = "778aaeab3e6cfd56d681c89f5c10d7ad6bf8d2f1a72de9de55b23081b2d31618",
- strip_prefix = "rules_python-0.34.0",
- url = "https://github.com/bazelbuild/rules_python/releases/download/0.34.0/rules_python-0.34.0.tar.gz",
+ sha256 = "4f7e2aa1eb9aa722d96498f5ef514f426c1f55161c3c9ae628c857a7128ceb07",
+ strip_prefix = "rules_python-1.0.0",
+ url = "https://github.com/bazelbuild/rules_python/releases/download/1.0.0/rules_python-1.0.0.tar.gz",
)
maybe(
>From 80bd08948c448bc7a3073e19ec8a741f02567989 Mon Sep 17 00:00:00 2001
From: Nick Desaulniers <ndesaulniers at google.com>
Date: Tue, 10 Dec 2024 10:57:26 -0800
Subject: [PATCH 5/5] [bazel] fix libc build
Link: #118899
---
.../llvm-project-overlay/libc/BUILD.bazel | 12 ++--
.../libc/test/src/string/BUILD.bazel | 34 -----------
.../libc/test/src/strings/BUILD.bazel | 60 +++++++++++++++++++
3 files changed, 66 insertions(+), 40 deletions(-)
create mode 100644 utils/bazel/llvm-project-overlay/libc/test/src/strings/BUILD.bazel
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index 5fea4449e1b9ed..5331a0409d2a25 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -3708,8 +3708,8 @@ libc_function(
libc_function(
name = "bcopy",
- srcs = ["src/string/bcopy.cpp"],
- hdrs = ["src/string/bcopy.h"],
+ srcs = ["src/strings/bcopy.cpp"],
+ hdrs = ["src/strings/bcopy.h"],
features = no_sanitize_features,
deps = [
":__support_common",
@@ -3732,8 +3732,8 @@ libc_function(
libc_function(
name = "bcmp",
- srcs = ["src/string/bcmp.cpp"],
- hdrs = ["src/string/bcmp.h"],
+ srcs = ["src/strings/bcmp.cpp"],
+ hdrs = ["src/strings/bcmp.h"],
features = no_sanitize_features,
weak = True,
deps = [
@@ -3744,8 +3744,8 @@ libc_function(
libc_function(
name = "bzero",
- srcs = ["src/string/bzero.cpp"],
- hdrs = ["src/string/bzero.h"],
+ srcs = ["src/strings/bzero.cpp"],
+ hdrs = ["src/strings/bzero.h"],
features = no_sanitize_features,
weak = True,
deps = [
diff --git a/utils/bazel/llvm-project-overlay/libc/test/src/string/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/src/string/BUILD.bazel
index b11bf163473be1..a31c67cfcea80c 100644
--- a/utils/bazel/llvm-project-overlay/libc/test/src/string/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/test/src/string/BUILD.bazel
@@ -184,19 +184,6 @@ libc_test(
],
)
-libc_test(
- name = "bcopy_test",
- srcs = ["bcopy_test.cpp"],
- libc_function_deps = [
- "//libc:bcopy",
- ],
- deps = [
- ":memory_check_utils",
- "//libc:__support_cpp_span",
- "//libc/test/UnitTest:memory_matcher",
- ],
-)
-
libc_test(
name = "memcmp_test",
srcs = ["memcmp_test.cpp"],
@@ -208,24 +195,3 @@ libc_test(
"//libc/test/UnitTest:test_logger",
],
)
-
-libc_test(
- name = "bcmp_test",
- srcs = ["bcmp_test.cpp"],
- libc_function_deps = [
- "//libc:bcmp",
- ],
- deps = [
- ":memory_check_utils",
- "//libc/test/UnitTest:test_logger",
- ],
-)
-
-libc_test(
- name = "bzero_test",
- srcs = ["bzero_test.cpp"],
- libc_function_deps = [
- "//libc:bzero",
- ],
- deps = [":memory_check_utils"],
-)
diff --git a/utils/bazel/llvm-project-overlay/libc/test/src/strings/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/src/strings/BUILD.bazel
new file mode 100644
index 00000000000000..985887e7183178
--- /dev/null
+++ b/utils/bazel/llvm-project-overlay/libc/test/src/strings/BUILD.bazel
@@ -0,0 +1,60 @@
+# 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
+
+# Tests for LLVM libc string.h functions.
+
+load("//libc:libc_build_rules.bzl", "libc_support_library")
+load("//libc/test:libc_test_rules.bzl", "libc_test")
+
+package(default_visibility = ["//visibility:public"])
+
+licenses(["notice"])
+
+# libc_support_library(
+# name = "memory_check_utils",
+# hdrs = ["memory_utils/memory_check_utils.h"],
+# deps = [
+# "//libc:__support_cpp_span",
+# "//libc:__support_libc_assert",
+# "//libc:__support_macros_config",
+# "//libc:__support_macros_sanitizer",
+# "//libc:string_memory_utils",
+# ],
+# )
+
+libc_test(
+ name = "bcopy_test",
+ srcs = ["bcopy_test.cpp"],
+ libc_function_deps = [
+ "//libc:bcopy",
+ ],
+ deps = [
+ "//libc/test/string:memory_check_utils",
+ "//libc:__support_cpp_span",
+ "//libc/test/UnitTest:memory_matcher",
+ ],
+)
+
+libc_test(
+ name = "bcmp_test",
+ srcs = ["bcmp_test.cpp"],
+ libc_function_deps = [
+ "//libc:bcmp",
+ ],
+ deps = [
+ "//libc/test/string:memory_check_utils",
+ "//libc/test/UnitTest:test_logger",
+ ],
+)
+
+libc_test(
+ name = "bzero_test",
+ srcs = ["bzero_test.cpp"],
+ libc_function_deps = [
+ "//libc:bzero",
+ ],
+ deps = [
+ "//libc/test/string:memory_check_utils",
+ ],
+)
More information about the llvm-commits
mailing list