-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[libc][bazel] Remove customization from several libc BUILD rules. #121843
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
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Get rid of the following arguments to libc_support_library and libc_function rules: * `defines` (for raw_mutex.h) - it wasn't used correctly (e.g. didn't provide actual value for spin count), and we can instead fallback to defaults set in the header itself (or rely on library-level configure options). * `features` - there's no need to disable sanitization for a subset of memory functions -- it generally should be the vendor / user responsibility to control it (e.g. don't include instrumented libc functions in the build, since they would be provided by sanitizer runtimes instead). * `local_defines` (for printf_parser) - no longer needed, since LIBC_COPT_MOCK_ARG_LIST has been removed in e0be78b This also removes two ad-hoc BUILD rules (strcpy_sanitized and printf_mock_parser) which are no longer needed and can be replaced by strcpy and printf_parser, respectively.
Member
|
@llvm/pr-subscribers-libc Author: Alexey Samsonov (vonosmas) ChangesGet rid of the following arguments to libc_support_library and libc_function rules:
This also removes two ad-hoc BUILD rules (strcpy_sanitized and printf_mock_parser) which are no longer needed and can be replaced by strcpy and printf_parser, respectively. Full diff: https://github.com/llvm/llvm-project/pull/121843.diff 2 Files Affected:
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index 91c7db9029a660..18019b3757f8ae 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -1395,10 +1395,6 @@ libc_support_library(
hdrs = [
"src/__support/threads/linux/raw_mutex.h",
],
- defines = [
- "LIBC_COPT_TIMEOUT_ENSURE_MONOTONICITY",
- "LIBC_COPT_RAW_MUTEX_DEFAULT_SPIN_COUNT",
- ],
target_compatible_with = select({
"@platforms//os:linux": [],
"//conditions:default": ["@platforms//:incompatible"],
@@ -3596,13 +3592,6 @@ libc_function(
############################### string targets ###############################
-no_sanitize_features = [
- "-asan",
- "-msan",
- "-tsan",
- "-ubsan",
-]
-
libc_support_library(
name = "string_memory_utils",
hdrs = [
@@ -3680,7 +3669,6 @@ libc_function(
name = "memcpy",
srcs = ["src/string/memcpy.cpp"],
hdrs = ["src/string/memcpy.h"],
- features = no_sanitize_features,
weak = True,
deps = [
":__support_common",
@@ -3692,7 +3680,6 @@ libc_function(
name = "memset",
srcs = ["src/string/memset.cpp"],
hdrs = ["src/string/memset.h"],
- features = no_sanitize_features,
weak = True,
deps = [
":__support_common",
@@ -3704,7 +3691,6 @@ libc_function(
name = "memmove",
srcs = ["src/string/memmove.cpp"],
hdrs = ["src/string/memmove.h"],
- features = no_sanitize_features,
weak = True,
deps = [
":__support_common",
@@ -3716,7 +3702,6 @@ libc_function(
name = "mempcpy",
srcs = ["src/string/mempcpy.cpp"],
hdrs = ["src/string/mempcpy.h"],
- features = no_sanitize_features,
weak = True,
deps = [
":__support_common",
@@ -3728,7 +3713,6 @@ libc_function(
name = "bcopy",
srcs = ["src/strings/bcopy.cpp"],
hdrs = ["src/strings/bcopy.h"],
- features = no_sanitize_features,
deps = [
":__support_common",
":string_memory_utils",
@@ -3739,7 +3723,6 @@ libc_function(
name = "memcmp",
srcs = ["src/string/memcmp.cpp"],
hdrs = ["src/string/memcmp.h"],
- features = no_sanitize_features,
weak = True,
deps = [
":__support_common",
@@ -3752,7 +3735,6 @@ libc_function(
name = "bcmp",
srcs = ["src/strings/bcmp.cpp"],
hdrs = ["src/strings/bcmp.h"],
- features = no_sanitize_features,
weak = True,
deps = [
":__support_common",
@@ -3764,7 +3746,6 @@ libc_function(
name = "bzero",
srcs = ["src/strings/bzero.cpp"],
hdrs = ["src/strings/bzero.h"],
- features = no_sanitize_features,
weak = True,
deps = [
":__support_common",
@@ -3786,7 +3767,6 @@ libc_function(
name = "strlen",
srcs = ["src/string/strlen.cpp"],
hdrs = ["src/string/strlen.h"],
- features = no_sanitize_features,
deps = [
":__support_common",
":string_utils",
@@ -3797,21 +3777,6 @@ libc_function(
name = "strcpy",
srcs = ["src/string/strcpy.cpp"],
hdrs = ["src/string/strcpy.h"],
- features = no_sanitize_features,
- deps = [
- ":__support_common",
- ":memcpy",
- ":string_memory_utils",
- ":string_utils",
- ],
-)
-
-# A sanitizer instrumented flavor of strcpy to be used with unittests.
-libc_function(
- name = "strcpy_sanitized",
- testonly = 1,
- srcs = ["src/string/strcpy.cpp"],
- hdrs = ["src/string/strcpy.h"],
deps = [
":__support_common",
":memcpy",
@@ -4467,26 +4432,6 @@ libc_support_library(
],
)
-# Only used for testing.
-libc_support_library(
- name = "printf_mock_parser",
- hdrs = ["src/stdio/printf_core/parser.h"],
- local_defines = ["LIBC_COPT_MOCK_ARG_LIST"],
- deps = [
- ":__support_arg_list",
- ":__support_common",
- ":__support_cpp_bit",
- ":__support_cpp_optional",
- ":__support_cpp_string_view",
- ":__support_cpp_type_traits",
- ":__support_ctype_utils",
- ":__support_fputil_fp_bits",
- ":__support_str_to_integer",
- ":printf_config",
- ":printf_core_structs",
- ],
-)
-
libc_support_library(
name = "printf_writer",
srcs = ["src/stdio/printf_core/writer.cpp"],
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 a31c67cfcea80c..a36cf2e0cb7d90 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
@@ -23,7 +23,7 @@ libc_test(
name = "strcpy_test",
srcs = ["strcpy_test.cpp"],
libc_function_deps = [
- "//libc:strcpy_sanitized",
+ "//libc:strcpy",
],
)
|
michaelrj-google
approved these changes
Jan 6, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Get rid of the following arguments to libc_support_library and libc_function rules:
defines(for raw_mutex.h) - it wasn't used correctly (e.g. didn't provide actual value for spin count), and we can instead fallback to defaults set in the header itself (or rely on library-level configure options).features- there's no need to disable sanitization for a subset of memory functions -- it generally should be the vendor / user responsibility to control it (e.g. don't include instrumented libc functions in the build, since they would be provided by sanitizer runtimes instead).local_defines(for printf_parser) - no longer needed, since LIBC_COPT_MOCK_ARG_LIST has been removed in e0be78bThis also removes two ad-hoc BUILD rules (strcpy_sanitized and printf_mock_parser) which are no longer needed and can be replaced by strcpy and printf_parser, respectively.