Skip to content

Commit a1a7a17

Browse files
[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.
1 parent 6e1c52d commit a1a7a17

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

compiler-rt/lib/profile/InstrProfilingFile.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313
#include <stdio.h>
1414
#include <stdlib.h>
1515
#include <string.h>
16+
#if !defined(__wasi__)
1617
#include <signal.h>
18+
#endif
1719
#ifdef _MSC_VER
1820
/* For _alloca. */
1921
#include <malloc.h>

compiler-rt/lib/profile/InstrProfilingUtil.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@
2525
#include <sys/utsname.h>
2626
#endif
2727

28+
#if !defined(__wasi__)
2829
#include <signal.h>
30+
#endif
2931
#include <stdlib.h>
3032
#include <string.h>
3133

@@ -336,6 +338,8 @@ COMPILER_RT_VISIBILITY void lprofInstallSignalHandler(int sig,
336338
if (err == SIG_ERR)
337339
PROF_WARN("Unable to install an exit signal handler for %d (errno = %d).\n",
338340
sig, errno);
341+
#elif defined(__wasi__)
342+
// WASI doesn't support signal.
339343
#else
340344
struct sigaction sigact;
341345
memset(&sigact, 0, sizeof(sigact));

0 commit comments

Comments
 (0)