Fixed leaked global symbols

This commit is contained in:
Nobuyoshi Nakada 2020-12-25 23:36:25 +09:00
parent 73cd4951de
commit 292230cbf9
Notes: git 2020-12-26 09:40:25 +09:00
5 changed files with 20 additions and 13 deletions

14
gc.c
View File

@ -4640,7 +4640,7 @@ static void read_barrier_handler(intptr_t address)
} }
#if defined(_WIN32) #if defined(_WIN32)
LPTOP_LEVEL_EXCEPTION_FILTER old_handler; static LPTOP_LEVEL_EXCEPTION_FILTER old_handler;
typedef void (*signal_handler)(int); typedef void (*signal_handler)(int);
static signal_handler old_sigsegv_handler; static signal_handler old_sigsegv_handler;
@ -4659,13 +4659,15 @@ static LONG WINAPI read_barrier_signal(EXCEPTION_POINTERS * info)
} }
} }
static void uninstall_handlers(void) static void
uninstall_handlers(void)
{ {
signal(SIGSEGV, old_sigsegv_handler); signal(SIGSEGV, old_sigsegv_handler);
SetUnhandledExceptionFilter(old_handler); SetUnhandledExceptionFilter(old_handler);
} }
static void install_handlers(void) static void
install_handlers(void)
{ {
/* Remove SEGV handler so that the Unhandled Exception Filter handles it */ /* Remove SEGV handler so that the Unhandled Exception Filter handles it */
old_sigsegv_handler = signal(SIGSEGV, NULL); old_sigsegv_handler = signal(SIGSEGV, NULL);
@ -4701,13 +4703,15 @@ read_barrier_signal(int sig, siginfo_t * info, void * data)
sigprocmask(SIG_SETMASK, &prev_set, NULL); sigprocmask(SIG_SETMASK, &prev_set, NULL);
} }
static void uninstall_handlers(void) static void
uninstall_handlers(void)
{ {
sigaction(SIGBUS, &old_sigbus_handler, NULL); sigaction(SIGBUS, &old_sigbus_handler, NULL);
sigaction(SIGSEGV, &old_sigsegv_handler, NULL); sigaction(SIGSEGV, &old_sigsegv_handler, NULL);
} }
static void install_handlers(void) static void
install_handlers(void)
{ {
struct sigaction action; struct sigaction action;
memset(&action, 0, sizeof(struct sigaction)); memset(&action, 0, sizeof(struct sigaction));

View File

@ -237,7 +237,7 @@ static bool vm_stack_canary_was_born = false;
#ifndef MJIT_HEADER #ifndef MJIT_HEADER
MJIT_FUNC_EXPORTED void MJIT_FUNC_EXPORTED void
vm_check_canary(const rb_execution_context_t *ec, VALUE *sp) rb_vm_check_canary(const rb_execution_context_t *ec, VALUE *sp)
{ {
const struct rb_control_frame_struct *reg_cfp = ec->cfp; const struct rb_control_frame_struct *reg_cfp = ec->cfp;
const struct rb_iseq_struct *iseq; const struct rb_iseq_struct *iseq;
@ -284,6 +284,7 @@ vm_check_canary(const rb_execution_context_t *ec, VALUE *sp)
rb_bug("see above."); rb_bug("see above.");
} }
#endif #endif
#define vm_check_canary(ec, sp) rb_vm_check_canary(ec, sp)
#else #else
#define vm_check_canary(ec, sp) #define vm_check_canary(ec, sp)
@ -5334,7 +5335,7 @@ vm_trace(rb_execution_context_t *ec, rb_control_frame_t *reg_cfp)
#if VM_CHECK_MODE > 0 #if VM_CHECK_MODE > 0
NORETURN( NOINLINE( COLDFUNC NORETURN( NOINLINE( COLDFUNC
void vm_canary_is_found_dead(enum ruby_vminsn_type i, VALUE c))); void rb_vm_canary_is_found_dead(enum ruby_vminsn_type i, VALUE c)));
void void
Init_vm_stack_canary(void) Init_vm_stack_canary(void)
@ -5349,7 +5350,7 @@ Init_vm_stack_canary(void)
#ifndef MJIT_HEADER #ifndef MJIT_HEADER
MJIT_FUNC_EXPORTED void MJIT_FUNC_EXPORTED void
vm_canary_is_found_dead(enum ruby_vminsn_type i, VALUE c) rb_vm_canary_is_found_dead(enum ruby_vminsn_type i, VALUE c)
{ {
/* Because a method has already been called, why not call /* Because a method has already been called, why not call
* another one. */ * another one. */

View File

@ -153,7 +153,7 @@ CC_SET_FASTPATH(const struct rb_callcache *cc, vm_call_handler func, bool enable
*canary = Qfalse; /* cleanup */ \ *canary = Qfalse; /* cleanup */ \
} \ } \
else { \ else { \
vm_canary_is_found_dead(insn, *canary); \ rb_vm_canary_is_found_dead(insn, *canary); \
} \ } \
} }
#else #else

View File

@ -14,7 +14,7 @@ vm_locked(rb_vm_t *vm)
#if RUBY_DEBUG > 0 #if RUBY_DEBUG > 0
void void
ASSERT_vm_locking(void) RUBY_ASSERT_vm_locking(void)
{ {
if (rb_multi_ractor_p()) { if (rb_multi_ractor_p()) {
rb_vm_t *vm = GET_VM(); rb_vm_t *vm = GET_VM();
@ -23,7 +23,7 @@ ASSERT_vm_locking(void)
} }
void void
ASSERT_vm_unlocking(void) RUBY_ASSERT_vm_unlocking(void)
{ {
if (rb_multi_ractor_p()) { if (rb_multi_ractor_p()) {
rb_vm_t *vm = GET_VM(); rb_vm_t *vm = GET_VM();

View File

@ -126,8 +126,10 @@ rb_vm_lock_leave_cr(struct rb_ractor_struct *cr, unsigned int *levp, const char
#define RB_VM_LOCK_LEAVE_NO_BARRIER() RB_VM_LOCK_LEAVE_LEV(&_lev); } #define RB_VM_LOCK_LEAVE_NO_BARRIER() RB_VM_LOCK_LEAVE_LEV(&_lev); }
#if RUBY_DEBUG > 0 #if RUBY_DEBUG > 0
void ASSERT_vm_locking(void); void RUBY_ASSERT_vm_locking(void);
void ASSERT_vm_unlocking(void); void RUBY_ASSERT_vm_unlocking(void);
#define ASSERT_vm_locking() RUBY_ASSERT_vm_locking()
#define ASSERT_vm_unlocking() RUBY_ASSERT_vm_unlocking()
#else #else
#define ASSERT_vm_locking() #define ASSERT_vm_locking()
#define ASSERT_vm_unlocking() #define ASSERT_vm_unlocking()