[compiler-rt] Fix rtsan build with musl (PR #119674)

Yi Kong via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 12 00:34:35 PST 2024


https://github.com/kongy created https://github.com/llvm/llvm-project/pull/119674

fd_set is defined by sys/select.h. On musl, this header is not transitively included by the other headers.

Failure message:
compiler-rt/lib/rtsan/rtsan_interceptors_posix.cpp:761:37: error: unknown type name 'fd_set'; did you mean 'fd_t'?
  761 | INTERCEPTOR(int, pselect, int nfds, fd_set *readfds, fd_set *writefds,
      |                                     ^~~~~~
      |                                     fd_t

>From 15367e7c66bd5fcf7cbc577d253dfea179dfbb2d Mon Sep 17 00:00:00 2001
From: Yi Kong <yikong at google.com>
Date: Thu, 12 Dec 2024 17:31:43 +0900
Subject: [PATCH] Fix rtsan build with musl

fd_set is defined by sys/select.h. On musl, this header is not
transitively included by the other headers.

Failure message:
compiler-rt/lib/rtsan/rtsan_interceptors_posix.cpp:761:37: error: unknown type name 'fd_set'; did you mean 'fd_t'?
  761 | INTERCEPTOR(int, pselect, int nfds, fd_set *readfds, fd_set *writefds,
      |                                     ^~~~~~
      |                                     fd_t
---
 compiler-rt/lib/rtsan/rtsan_interceptors_posix.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/compiler-rt/lib/rtsan/rtsan_interceptors_posix.cpp b/compiler-rt/lib/rtsan/rtsan_interceptors_posix.cpp
index f076c7eae9a226..f000deb3039a8c 100644
--- a/compiler-rt/lib/rtsan/rtsan_interceptors_posix.cpp
+++ b/compiler-rt/lib/rtsan/rtsan_interceptors_posix.cpp
@@ -46,6 +46,7 @@ void OSSpinLockLock(volatile OSSpinLock *__lock);
 #include <pthread.h>
 #include <stdarg.h>
 #include <stdio.h>
+#include <sys/select.h>
 #include <sys/socket.h>
 #include <sys/stat.h>
 #include <time.h>



More information about the llvm-commits mailing list