[llvm] [bazel] fix libc build (PR #119433)

Nick Desaulniers via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 10 11:35:21 PST 2024


https://github.com/nickdesaulniers updated https://github.com/llvm/llvm-project/pull/119433

>From 3d025d2ec5550469478b98118b8f99b3043808c0 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 1/2] [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",
+    ],
+)

>From 221a65def345f095154657b7df98c36e9e117174 Mon Sep 17 00:00:00 2001
From: Nick Desaulniers <ndesaulniers at google.com>
Date: Tue, 10 Dec 2024 11:35:08 -0800
Subject: [PATCH 2/2] fix paths

---
 .../llvm-project-overlay/libc/test/src/strings/BUILD.bazel  | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

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
index 985887e7183178..a5ea794f9c5e70 100644
--- a/utils/bazel/llvm-project-overlay/libc/test/src/strings/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/test/src/strings/BUILD.bazel
@@ -30,7 +30,7 @@ libc_test(
         "//libc:bcopy",
     ],
     deps = [
-        "//libc/test/string:memory_check_utils",
+        "//libc/test/src/string:memory_check_utils",
         "//libc:__support_cpp_span",
         "//libc/test/UnitTest:memory_matcher",
     ],
@@ -43,7 +43,7 @@ libc_test(
         "//libc:bcmp",
     ],
     deps = [
-        "//libc/test/string:memory_check_utils",
+        "//libc/test/src/string:memory_check_utils",
         "//libc/test/UnitTest:test_logger",
     ],
 )
@@ -55,6 +55,6 @@ libc_test(
         "//libc:bzero",
     ],
     deps = [
-        "//libc/test/string:memory_check_utils",
+        "//libc/test/src/string:memory_check_utils",
     ],
 )



More information about the llvm-commits mailing list