Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 0 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1746,7 +1746,6 @@ AS_IF([test "$GCC" = yes], [
[rb_cv_gcc_atomic_builtins=no])])
AS_IF([test "$rb_cv_gcc_atomic_builtins" = yes], [
AC_DEFINE(HAVE_GCC_ATOMIC_BUILTINS)
AC_CHECK_LIB([atomic], [__atomic_fetch_add_8])
AC_CACHE_CHECK([for 64bit __atomic builtins], [rb_cv_gcc_atomic_builtins_64], [
AC_LINK_IFELSE([AC_LANG_PROGRAM([[@%:@include <stdint.h>
uint64_t atomic_var;]],
Expand Down
7 changes: 2 additions & 5 deletions ruby_atomic.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
#define INTERNAL_ATOMIC_H

#include "ruby/atomic.h"
#ifdef HAVE_STDATOMIC_H
# include <stdatomic.h>
#endif

#define RUBY_ATOMIC_VALUE_LOAD(x) rbimpl_atomic_value_load(&(x), RBIMPL_ATOMIC_SEQ_CST)

Expand Down Expand Up @@ -79,9 +76,9 @@ rbimpl_atomic_u64_fetch_add(volatile rbimpl_atomic_uint64_t *ptr, uint64_t val)
return InterlockedExchangeAdd64((volatile LONG64 *)ptr, val);
#elif defined(__sun) && defined(HAVE_ATOMIC_H) && (defined(_LP64) || defined(_I32LPx))
return atomic_add_64_nv(ptr, val) - val;
#elif defined(HAVE_STDATOMIC_H)
return atomic_fetch_add_explicit((_Atomic uint64_t *)ptr, val, memory_order_seq_cst);
#else
// TODO: stdatomic

// Fallback using mutex for platforms without 64-bit atomics
static rb_native_mutex_t lock = RB_NATIVE_MUTEX_INITIALIZER;
rb_native_mutex_lock(&lock);
Expand Down
18 changes: 18 additions & 0 deletions signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -949,6 +949,20 @@ sigsegv(int sig SIGINFO_ARG)
}
#endif

#ifdef SIGABRT

static sighandler_t default_sigabrt_handler;
NORETURN(static ruby_sigaction_t sigabrt);

static void
sigabrt(int sig SIGINFO_ARG)
{
check_reserved_signal("ABRT");
CHECK_STACK_OVERFLOW();
rb_bug_for_fatal_signal(default_sigabrt_handler, sig, SIGINFO_CTX, "Aborted" MESSAGE_FAULT_ADDRESS);
}
#endif

#ifdef SIGILL

static sighandler_t default_sigill_handler;
Expand Down Expand Up @@ -1558,6 +1572,10 @@ Init_signal(void)
RB_ALTSTACK_INIT(GET_VM()->main_altstack, rb_allocate_sigaltstack());
force_install_sighandler(SIGSEGV, (sighandler_t)sigsegv, &default_sigsegv_handler);
#endif

#ifdef SIGABRT
force_install_sighandler(SIGABRT, (sighandler_t)sigabrt, &default_sigabrt_handler);
#endif
}
#ifdef SIGPIPE
install_sighandler(SIGPIPE, sig_do_nothing);
Expand Down
2 changes: 1 addition & 1 deletion spec/bundler/commands/exec_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1020,7 +1020,7 @@ def bin_path(a,b,c)
context "signal handling" do
let(:test_signals) do
open3_reserved_signals = %w[CHLD CLD PIPE]
reserved_signals = %w[SEGV BUS ILL FPE VTALRM KILL STOP EXIT]
reserved_signals = %w[SEGV BUS ILL FPE ABRT IOT VTALRM KILL STOP EXIT]
bundler_signals = %w[INT]

Signal.list.keys - (bundler_signals + reserved_signals + open3_reserved_signals)
Expand Down