Skip to content

Commit 4cceea1

Browse files
vonosmasAlexey Samsonov
andauthored
[libc][bazel] Remove customization from several libc BUILD rules. (llvm#121843)
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. Co-authored-by: Alexey Samsonov <[email protected]>
1 parent 32d761b commit 4cceea1

File tree

2 files changed

+1
-56
lines changed

2 files changed

+1
-56
lines changed

utils/bazel/llvm-project-overlay/libc/BUILD.bazel

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1395,10 +1395,6 @@ libc_support_library(
13951395
hdrs = [
13961396
"src/__support/threads/linux/raw_mutex.h",
13971397
],
1398-
defines = [
1399-
"LIBC_COPT_TIMEOUT_ENSURE_MONOTONICITY",
1400-
"LIBC_COPT_RAW_MUTEX_DEFAULT_SPIN_COUNT",
1401-
],
14021398
target_compatible_with = select({
14031399
"@platforms//os:linux": [],
14041400
"//conditions:default": ["@platforms//:incompatible"],
@@ -3594,13 +3590,6 @@ libc_function(
35943590

35953591
############################### string targets ###############################
35963592

3597-
no_sanitize_features = [
3598-
"-asan",
3599-
"-msan",
3600-
"-tsan",
3601-
"-ubsan",
3602-
]
3603-
36043593
libc_support_library(
36053594
name = "string_memory_utils",
36063595
hdrs = [
@@ -3678,7 +3667,6 @@ libc_function(
36783667
name = "memcpy",
36793668
srcs = ["src/string/memcpy.cpp"],
36803669
hdrs = ["src/string/memcpy.h"],
3681-
features = no_sanitize_features,
36823670
weak = True,
36833671
deps = [
36843672
":__support_common",
@@ -3690,7 +3678,6 @@ libc_function(
36903678
name = "memset",
36913679
srcs = ["src/string/memset.cpp"],
36923680
hdrs = ["src/string/memset.h"],
3693-
features = no_sanitize_features,
36943681
weak = True,
36953682
deps = [
36963683
":__support_common",
@@ -3702,7 +3689,6 @@ libc_function(
37023689
name = "memmove",
37033690
srcs = ["src/string/memmove.cpp"],
37043691
hdrs = ["src/string/memmove.h"],
3705-
features = no_sanitize_features,
37063692
weak = True,
37073693
deps = [
37083694
":__support_common",
@@ -3714,7 +3700,6 @@ libc_function(
37143700
name = "mempcpy",
37153701
srcs = ["src/string/mempcpy.cpp"],
37163702
hdrs = ["src/string/mempcpy.h"],
3717-
features = no_sanitize_features,
37183703
weak = True,
37193704
deps = [
37203705
":__support_common",
@@ -3726,7 +3711,6 @@ libc_function(
37263711
name = "bcopy",
37273712
srcs = ["src/strings/bcopy.cpp"],
37283713
hdrs = ["src/strings/bcopy.h"],
3729-
features = no_sanitize_features,
37303714
deps = [
37313715
":__support_common",
37323716
":string_memory_utils",
@@ -3737,7 +3721,6 @@ libc_function(
37373721
name = "memcmp",
37383722
srcs = ["src/string/memcmp.cpp"],
37393723
hdrs = ["src/string/memcmp.h"],
3740-
features = no_sanitize_features,
37413724
weak = True,
37423725
deps = [
37433726
":__support_common",
@@ -3750,7 +3733,6 @@ libc_function(
37503733
name = "bcmp",
37513734
srcs = ["src/strings/bcmp.cpp"],
37523735
hdrs = ["src/strings/bcmp.h"],
3753-
features = no_sanitize_features,
37543736
weak = True,
37553737
deps = [
37563738
":__support_common",
@@ -3762,7 +3744,6 @@ libc_function(
37623744
name = "bzero",
37633745
srcs = ["src/strings/bzero.cpp"],
37643746
hdrs = ["src/strings/bzero.h"],
3765-
features = no_sanitize_features,
37663747
weak = True,
37673748
deps = [
37683749
":__support_common",
@@ -3784,7 +3765,6 @@ libc_function(
37843765
name = "strlen",
37853766
srcs = ["src/string/strlen.cpp"],
37863767
hdrs = ["src/string/strlen.h"],
3787-
features = no_sanitize_features,
37883768
deps = [
37893769
":__support_common",
37903770
":string_utils",
@@ -3795,21 +3775,6 @@ libc_function(
37953775
name = "strcpy",
37963776
srcs = ["src/string/strcpy.cpp"],
37973777
hdrs = ["src/string/strcpy.h"],
3798-
features = no_sanitize_features,
3799-
deps = [
3800-
":__support_common",
3801-
":memcpy",
3802-
":string_memory_utils",
3803-
":string_utils",
3804-
],
3805-
)
3806-
3807-
# A sanitizer instrumented flavor of strcpy to be used with unittests.
3808-
libc_function(
3809-
name = "strcpy_sanitized",
3810-
testonly = 1,
3811-
srcs = ["src/string/strcpy.cpp"],
3812-
hdrs = ["src/string/strcpy.h"],
38133778
deps = [
38143779
":__support_common",
38153780
":memcpy",
@@ -4465,26 +4430,6 @@ libc_support_library(
44654430
],
44664431
)
44674432

4468-
# Only used for testing.
4469-
libc_support_library(
4470-
name = "printf_mock_parser",
4471-
hdrs = ["src/stdio/printf_core/parser.h"],
4472-
local_defines = ["LIBC_COPT_MOCK_ARG_LIST"],
4473-
deps = [
4474-
":__support_arg_list",
4475-
":__support_common",
4476-
":__support_cpp_bit",
4477-
":__support_cpp_optional",
4478-
":__support_cpp_string_view",
4479-
":__support_cpp_type_traits",
4480-
":__support_ctype_utils",
4481-
":__support_fputil_fp_bits",
4482-
":__support_str_to_integer",
4483-
":printf_config",
4484-
":printf_core_structs",
4485-
],
4486-
)
4487-
44884433
libc_support_library(
44894434
name = "printf_writer",
44904435
srcs = ["src/stdio/printf_core/writer.cpp"],

utils/bazel/llvm-project-overlay/libc/test/src/string/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ libc_test(
2323
name = "strcpy_test",
2424
srcs = ["strcpy_test.cpp"],
2525
libc_function_deps = [
26-
"//libc:strcpy_sanitized",
26+
"//libc:strcpy",
2727
],
2828
)
2929

0 commit comments

Comments
 (0)