Skip to content

[bazel] fix libc build #119433

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions utils/bazel/llvm-project-overlay/libc/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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 = [
Expand All @@ -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 = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand All @@ -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"],
)
Original file line number Diff line number Diff line change
@@ -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",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't quite right, not sure the correct incantation:

ERROR: no such package '@@llvm-project//libc/test/string': BUILD file not found in directory 'libc/test/string' of external repository @@llvm-project. Add a BUILD file to a directory to mark it as a package.
ERROR: /usr/local/google/home/ndesaulniers/.cache/bazel/_bazel_ndesaulniers/02cf1b716d72de9bb7498bab3b083b83/external/llvm-project/libc/test/src/strings/BUILD.bazel:39:10: no such package '@@llvm-project//libc/test/string': BUILD file not found in directory 'libc/test/string' of external repository @@llvm-project. Add a BUILD file to a directory to mark it as a package. and referenced by '@@llvm-project//libc/test/src/strings:bcmp_test'
ERROR: Analysis of target '@@llvm-project//libc/test/src/strings:bcmp_test' failed; build aborted: Analysis failed

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"//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",
],
)
Loading