From b44508c057503d1552ec087fc7a2cf0a57c93794 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Tue, 15 Oct 2024 08:04:03 +0000 Subject: [PATCH] [compiler-rt][profile] Exclude signal.h on WASI WASI doesn't support signal, so we should exclude signal.h on WASI. This patch is only for the swiftlang fork of compiler-rt because those signal usages don't exist in the upstream. --- compiler-rt/lib/profile/InstrProfilingFile.c | 2 ++ compiler-rt/lib/profile/InstrProfilingUtil.c | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/compiler-rt/lib/profile/InstrProfilingFile.c b/compiler-rt/lib/profile/InstrProfilingFile.c index 47fcc575c7dac..2553fbb5454b5 100644 --- a/compiler-rt/lib/profile/InstrProfilingFile.c +++ b/compiler-rt/lib/profile/InstrProfilingFile.c @@ -13,7 +13,9 @@ #include #include #include +#if !defined(__wasi__) #include +#endif #ifdef _MSC_VER /* For _alloca. */ #include diff --git a/compiler-rt/lib/profile/InstrProfilingUtil.c b/compiler-rt/lib/profile/InstrProfilingUtil.c index 95c308350b6d1..137b7f5d5643a 100644 --- a/compiler-rt/lib/profile/InstrProfilingUtil.c +++ b/compiler-rt/lib/profile/InstrProfilingUtil.c @@ -34,7 +34,9 @@ typedef uint_t uint; #include #endif +#if !defined(__wasi__) #include +#endif #include #include @@ -462,6 +464,8 @@ COMPILER_RT_VISIBILITY void lprofInstallSignalHandler(int sig, if (err == SIG_ERR) PROF_WARN("Unable to install an exit signal handler for %d (errno = %d).\n", sig, errno); +#elif defined(__wasi__) + // WASI doesn't support signal. #else struct sigaction sigact; memset(&sigact, 0, sizeof(sigact));