Skip to content

Commit aba2a08

Browse files
committed
librdmacm: Use overloadable function attribute with clang
This is to fix build warnings seen with upcoming clang19 and glibc 2.40, since glibc 2.40 has improved fortyfying this function with clang, it ends up with build errors like below librdmacm/preload.c:796:9: error: at most one overload for a given name may lack the 'overloadable' attribute | 796 | ssize_t recvfrom(int socket, void *buf, size_t len, int flags, | | ^ | /mnt/b/yoe/master/build/tmp/work/core2-64-yoe-linux/rdma-core/51.0/recipe-sysroot/usr/include/sys/socket.h:163:16: note: previous unmarked overload of function is here | 163 | extern ssize_t recvfrom (int __fd, void *__restrict __buf, size_t __n, | | ^ Upstream-Status: Submitted [#1475] Signed-off-by: Khem Raj <[email protected]>
1 parent d9bff23 commit aba2a08

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

librdmacm/preload.c

+5-2
Original file line numberDiff line numberDiff line change
@@ -792,8 +792,11 @@ ssize_t recv(int socket, void *buf, size_t len, int flags)
792792
return (fd_fork_get(socket, &fd) == fd_rsocket) ?
793793
rrecv(fd, buf, len, flags) : real.recv(fd, buf, len, flags);
794794
}
795-
796-
ssize_t recvfrom(int socket, void *buf, size_t len, int flags,
795+
ssize_t
796+
#if defined(__clang__) && defined(__GLIBC__)
797+
__attribute__((overloadable))
798+
#endif
799+
recvfrom(int socket, void *buf, size_t len, int flags,
797800
struct sockaddr *src_addr, socklen_t *addrlen)
798801
{
799802
int fd;

0 commit comments

Comments
 (0)