Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Completely disable signal handler on 32-bit #1488

Merged
merged 4 commits into from
Jul 21, 2020
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions wasm2c/wasm-rt.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,24 +39,32 @@ extern "C" {
*
* This is usually 10%-25% faster, but requires OS-specific support.
* */
// #define WASM_RT_MEMCHECK_SIGNAL_HANDLER 1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove comment?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was using it as documentation of what the flag is. Maybe I could make that more clear?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it inside the docstring? without the 1?

Something like Set the default value for WASM_RT_MEMCHECK_SIGNAL_HANDLER which determines ...?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.


/** Check whether the signal handler is supported at all. */
#if (defined(__linux__) || defined(__unix__) || defined(__APPLE__)) && \
defined(__WORDSIZE) && __WORDSIZE == 64

/* If the signal handler is supported, then use it by default. */
#ifndef WASM_RT_MEMCHECK_SIGNAL_HANDLER
#define WASM_RT_MEMCHECK_SIGNAL_HANDLER 1
#endif

#if WASM_RT_MEMCHECK_SIGNAL_HANDLER
#if defined(__linux__) || defined(__unix__) || defined(__APPLE__)
#if defined(__WORDSIZE) && __WORDSIZE != 64
#warning "Signal handler is only supported on 64-bit architectures"
#else
#define WASM_RT_MEMCHECK_SIGNAL_HANDLER_POSIX 1
#endif

#else
#error "No signal handler implementation for OS!"
#endif

/* The signal handler is not supported, error out if the user was trying to
* enable it. */
#if WASM_RT_MEMCHECK_SIGNAL_HANDLER
#error "Signal handler is not supported for this OS/Architecture!"
#endif

#ifndef WASM_RT_MEMCHECK_SIGNAL_HANDLER_POSIX
#define WASM_RT_MEMCHECK_SIGNAL_HANDLER 0
#define WASM_RT_MEMCHECK_SIGNAL_HANDLER_POSIX 0

#endif

/** Reason a trap occurred. Provide this to `wasm_rt_trap`. */
Expand Down