[llvm] [bazel] fix libc build (PR #119433)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 10 10:58:52 PST 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-libc
Author: Nick Desaulniers (nickdesaulniers)
<details>
<summary>Changes</summary>
- **[bazel] update .bazelversion to 8.0.0**
- **add --enable_workspace to .bazelrc**
- **add explict http_archive for rules_cc**
- **upgrade rules_python to 1.0.0**
- **remove useless comment**
- **[bazel] fix libc build**
---
Full diff: https://github.com/llvm/llvm-project/pull/119433.diff
6 Files Affected:
- (modified) utils/bazel/.bazelrc (+1-1)
- (modified) utils/bazel/.bazelversion (+1-1)
- (modified) utils/bazel/WORKSPACE (+11-3)
- (modified) utils/bazel/llvm-project-overlay/libc/BUILD.bazel (+6-6)
- (modified) utils/bazel/llvm-project-overlay/libc/test/src/string/BUILD.bazel (-34)
- (added) utils/bazel/llvm-project-overlay/libc/test/src/strings/BUILD.bazel (+60)
``````````diff
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
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
diff --git a/utils/bazel/WORKSPACE b/utils/bazel/WORKSPACE
index 66ba1ac1b17e1e..b24dfd17afcd2c 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",
@@ -29,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(
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",
+ ],
+)
``````````
</details>
https://github.com/llvm/llvm-project/pull/119433
More information about the llvm-commits
mailing list