Skip to content

Commit b44508c

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 5592252 commit b44508c

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
@@ -34,7 +34,9 @@ typedef uint_t uint;
3434
#include <sys/utsname.h>
3535
#endif
3636

37+
#if !defined(__wasi__)
3738
#include <signal.h>
39+
#endif
3840
#include <stdlib.h>
3941
#include <string.h>
4042

@@ -462,6 +464,8 @@ COMPILER_RT_VISIBILITY void lprofInstallSignalHandler(int sig,
462464
if (err == SIG_ERR)
463465
PROF_WARN("Unable to install an exit signal handler for %d (errno = %d).\n",
464466
sig, errno);
467+
#elif defined(__wasi__)
468+
// WASI doesn't support signal.
465469
#else
466470
struct sigaction sigact;
467471
memset(&sigact, 0, sizeof(sigact));

0 commit comments

Comments
 (0)