-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[libc][bazel] Mark socket functions weak #115088
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
Conversation
Downstream ther'es a user that needs the syscall wrappers to be weak. I intend to set up a proper mechanism for just listing which functions should be weak eventually, but for now this is necessary.
|
@llvm/pr-subscribers-libc Author: Michael Jones (michaelrj-google) ChangesDownstream ther'es a user that needs the syscall wrappers to be weak. I Full diff: https://github.com/llvm/llvm-project/pull/115088.diff 1 Files Affected:
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index f6648c9bffa730..089592bc0bc17c 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -4650,6 +4650,7 @@ libc_function(
name = "socket",
srcs = ["src/sys/socket/linux/socket.cpp"],
hdrs = ["src/sys/socket/socket.h"],
+ weak = True,
deps = [
":__support_common",
":__support_osutil_syscall",
@@ -4661,6 +4662,7 @@ libc_function(
name = "socketpair",
srcs = ["src/sys/socket/linux/socketpair.cpp"],
hdrs = ["src/sys/socket/socketpair.h"],
+ weak = True,
deps = [
":__support_common",
":__support_osutil_syscall",
@@ -4672,6 +4674,7 @@ libc_function(
name = "send",
srcs = ["src/sys/socket/linux/send.cpp"],
hdrs = ["src/sys/socket/send.h"],
+ weak = True,
deps = [
":__support_common",
":__support_osutil_syscall",
@@ -4686,6 +4689,7 @@ libc_function(
name = "sendto",
srcs = ["src/sys/socket/linux/sendto.cpp"],
hdrs = ["src/sys/socket/sendto.h"],
+ weak = True,
deps = [
":__support_common",
":__support_osutil_syscall",
@@ -4700,6 +4704,7 @@ libc_function(
name = "sendmsg",
srcs = ["src/sys/socket/linux/sendmsg.cpp"],
hdrs = ["src/sys/socket/sendmsg.h"],
+ weak = True,
deps = [
":__support_common",
":__support_osutil_syscall",
@@ -4713,6 +4718,7 @@ libc_function(
name = "recv",
srcs = ["src/sys/socket/linux/recv.cpp"],
hdrs = ["src/sys/socket/recv.h"],
+ weak = True,
deps = [
":__support_common",
":__support_osutil_syscall",
@@ -4727,6 +4733,7 @@ libc_function(
name = "recvfrom",
srcs = ["src/sys/socket/linux/recvfrom.cpp"],
hdrs = ["src/sys/socket/recvfrom.h"],
+ weak = True,
deps = [
":__support_common",
":__support_osutil_syscall",
@@ -4741,6 +4748,7 @@ libc_function(
name = "recvmsg",
srcs = ["src/sys/socket/linux/recvmsg.cpp"],
hdrs = ["src/sys/socket/recvmsg.h"],
+ weak = True,
deps = [
":__support_common",
":__support_osutil_syscall",
|
|
We also define Is there any reason why we shouldn't just define all libc functions as "weak"? Would this mean that in static link mode we allow the user to provide their own implementations / wrappers / proxies of libc functions? (they would also be able to call real implementations by calling a namespace-d version, I think?) |
Note that declaring a function as having |
|
Right, I agree with Nick's comment that we probably don't want to blanket-define all functions as weak. I do think we need to let Bazel build downstream users decide which functions should be made weak, however -- but let's postpone this update to |
Downstream ther'es a user that needs the syscall wrappers to be weak. I
intend to set up a proper mechanism for just listing which functions
should be weak eventually, but for now this is necessary.