Skip to content

Commit

Permalink
[compiler-rt][profile] Exclude signal.h on WASI
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
kateinoigakukun committed Oct 15, 2024
1 parent c389b57 commit c181e46
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions compiler-rt/lib/profile/InstrProfilingFile.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#if !defined(__wasi__)
#include <signal.h>
#endif
#ifdef _MSC_VER
/* For _alloca. */
#include <malloc.h>
Expand Down
4 changes: 4 additions & 0 deletions compiler-rt/lib/profile/InstrProfilingUtil.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
#include <sys/utsname.h>
#endif

#if !defined(__wasi__)
#include <signal.h>
#endif
#include <stdlib.h>
#include <string.h>

Expand Down Expand Up @@ -336,6 +338,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));
Expand Down

0 comments on commit c181e46

Please sign in to comment.