Skip to content

Commit e46f6de

Browse files
committed
[bazel] Improve libc build on macOS
This isn't enough to get everything in libc working, but I started down this path and these were the first required fixes. I might get back to more changes later.
1 parent 1b5b4ee commit e46f6de

File tree

1 file changed

+31
-14
lines changed

1 file changed

+31
-14
lines changed

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

Lines changed: 31 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -742,12 +742,12 @@ libc_support_library(
742742
deps = [
743743
":__support_common",
744744
":__support_cpp_bit",
745-
":__support_sign",
746745
":__support_cpp_type_traits",
747746
":__support_libc_assert",
748747
":__support_macros_attributes",
749748
":__support_macros_properties_types",
750749
":__support_math_extras",
750+
":__support_sign",
751751
":__support_uint128",
752752
],
753753
)
@@ -964,11 +964,17 @@ libc_support_library(
964964
libc_support_library(
965965
name = "__support_osutil_syscall",
966966
hdrs = ["src/__support/OSUtil/syscall.h"],
967-
textual_hdrs = [
968-
"src/__support/OSUtil/linux/syscall.h",
969-
"src/__support/OSUtil/linux/aarch64/syscall.h",
970-
"src/__support/OSUtil/linux/x86_64/syscall.h",
971-
],
967+
textual_hdrs = select({
968+
"@platforms//os:macos": [
969+
"src/__support/OSUtil/darwin/syscall.h",
970+
"src/__support/OSUtil/darwin/arm/syscall.h",
971+
],
972+
"//conditions:default": [
973+
"src/__support/OSUtil/linux/syscall.h",
974+
"src/__support/OSUtil/linux/aarch64/syscall.h",
975+
"src/__support/OSUtil/linux/x86_64/syscall.h",
976+
],
977+
}),
972978
deps = [
973979
":__support_common",
974980
":__support_cpp_bit",
@@ -978,9 +984,10 @@ libc_support_library(
978984
libc_support_library(
979985
name = "__support_osutil_io",
980986
hdrs = ["src/__support/OSUtil/io.h"],
981-
textual_hdrs = [
982-
"src/__support/OSUtil/linux/io.h",
983-
],
987+
textual_hdrs = select({
988+
"@platforms//os:macos": ["src/__support/OSUtil/darwin/io.h"],
989+
"//conditions:default": ["src/__support/OSUtil/linux/io.h"],
990+
}),
984991
deps = [
985992
":__support_common",
986993
":__support_cpp_string_view",
@@ -992,10 +999,15 @@ libc_support_library(
992999
libc_support_library(
9931000
name = "__support_osutil_quick_exit",
9941001
hdrs = ["src/__support/OSUtil/quick_exit.h"],
995-
textual_hdrs = [
996-
"src/__support/OSUtil/linux/quick_exit.h",
997-
#TODO: add support for GPU quick_exit (isn't just in a header.)
998-
],
1002+
textual_hdrs = select({
1003+
"@platforms//os:macos": [
1004+
"src/__support/OSUtil/darwin/quick_exit.h",
1005+
],
1006+
"//conditions:default": [
1007+
"src/__support/OSUtil/linux/quick_exit.h",
1008+
#TODO: add support for GPU quick_exit (isn't just in a header.)
1009+
],
1010+
}),
9991011
deps = [
10001012
":__support_osutil_syscall",
10011013
],
@@ -1927,7 +1939,12 @@ libc_math_function(name = "copysignf")
19271939

19281940
libc_math_function(name = "copysignl")
19291941

1930-
libc_math_function(name = "copysignf128")
1942+
libc_math_function(
1943+
name = "copysignf128",
1944+
additional_deps = [
1945+
":llvm_libc_types_float128",
1946+
],
1947+
)
19311948

19321949
libc_math_function(name = "ilogb")
19331950

0 commit comments

Comments
 (0)