mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Haiku now best effort support
* configure.in: remove obsolete workarounds for Haiku. * dln.c, file.c, io.c: remove obsolete Haiku workarounds. * thread_pthread.c: add stack bounds detection for Haiku. * signal.c: get stack pointer from signal context on Haiku. [ruby-core:67923] [Bug #10811] [Fix GH-1109] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52721 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
e3120abd58
commit
e29c109d2a
10 changed files with 72 additions and 31 deletions
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
||||||
|
Mon Nov 23 12:54:39 2015 Hamish Morrison <hamishm53@gmail.com>
|
||||||
|
|
||||||
|
* configure.in: remove obsolete workarounds for Haiku.
|
||||||
|
|
||||||
|
* dln.c, file.c, io.c: remove obsolete Haiku workarounds.
|
||||||
|
|
||||||
|
* thread_pthread.c: add stack bounds detection for Haiku.
|
||||||
|
|
||||||
|
* signal.c: get stack pointer from signal context on Haiku.
|
||||||
|
[ruby-core:67923] [Bug #10811] [Fix GH-1109]
|
||||||
|
|
||||||
Mon Nov 23 11:44:11 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
|
Mon Nov 23 11:44:11 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
|
||||||
|
|
||||||
* gems/bundled_gems: bump version to minitest-5.8.3
|
* gems/bundled_gems: bump version to minitest-5.8.3
|
||||||
|
|
4
NEWS
4
NEWS
|
@ -239,5 +239,9 @@ with all sufficient information, see the ChangeLog file.
|
||||||
=== Build system updates
|
=== Build system updates
|
||||||
|
|
||||||
=== Implementation changes
|
=== Implementation changes
|
||||||
|
|
||||||
* OS/2 is no longer supported
|
* OS/2 is no longer supported
|
||||||
|
|
||||||
* Borland-C is no longer supported
|
* Borland-C is no longer supported
|
||||||
|
|
||||||
|
* Haiku now stable and best effort
|
||||||
|
|
46
configure.in
46
configure.in
|
@ -871,7 +871,7 @@ if test "$GCC" = yes; then
|
||||||
|
|
||||||
# -fstack-protector
|
# -fstack-protector
|
||||||
AS_CASE(["$target_os"],
|
AS_CASE(["$target_os"],
|
||||||
[mingw*|nacl|haiku], [
|
[mingw*|nacl], [
|
||||||
stack_protector=no
|
stack_protector=no
|
||||||
])
|
])
|
||||||
if test -z "${stack_protector+set}"; then
|
if test -z "${stack_protector+set}"; then
|
||||||
|
@ -896,11 +896,6 @@ if test "$GCC" = yes; then
|
||||||
[cygwin*|darwin*|netbsd*|nacl], [
|
[cygwin*|darwin*|netbsd*|nacl], [
|
||||||
# need lgamma_r(), finite()
|
# need lgamma_r(), finite()
|
||||||
],
|
],
|
||||||
[haiku], [
|
|
||||||
# Haiku R1/alpha3 uses gcc-4.4.4 which can not handle anonymous union
|
|
||||||
# with ANSI standard flags. Anonumous union is required to compile
|
|
||||||
# socket extension where <net/if.h> uses anonymous union.
|
|
||||||
],
|
|
||||||
[
|
[
|
||||||
# ANSI (no XCFLAGS because this is C only)
|
# ANSI (no XCFLAGS because this is C only)
|
||||||
for ansi_options in -std=iso9899:1999 "-ansi -std=iso9899:199409"; do
|
for ansi_options in -std=iso9899:1999 "-ansi -std=iso9899:199409"; do
|
||||||
|
@ -1137,14 +1132,15 @@ main()
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
],
|
],
|
||||||
[beos*|haiku*], [
|
[beos*], [
|
||||||
ac_cv_func_link=no
|
ac_cv_func_link=no
|
||||||
ac_cv_func_sched_yield=no
|
ac_cv_func_sched_yield=no
|
||||||
ac_cv_func_pthread_attr_setinheritsched=no
|
ac_cv_func_pthread_attr_setinheritsched=no
|
||||||
AS_CASE(["$target_os"],
|
ac_cv_header_net_socket_h=yes
|
||||||
[beos*], [ ac_cv_header_net_socket_h=yes],
|
LIBS="$LIBS" # m lib is include in root under BeOS
|
||||||
[haiku*], [ ac_cv_func_shutdown=no])
|
],
|
||||||
LIBS="$LIBS" # m lib is include in root under BeOS/Haiku
|
[haiku*], [
|
||||||
|
LIBS="$LIBS"
|
||||||
],
|
],
|
||||||
[cygwin*], [ ac_cv_header_langinfo_h=yes
|
[cygwin*], [ ac_cv_header_langinfo_h=yes
|
||||||
AC_CHECK_FUNCS(cygwin_conv_path)
|
AC_CHECK_FUNCS(cygwin_conv_path)
|
||||||
|
@ -2901,10 +2897,24 @@ if test x"$enable_pthread" = xyes; then
|
||||||
AC_DEFINE_UNQUOTED(SET_THREAD_NAME(name), pthread_set_name_np(pthread_self(), name))
|
AC_DEFINE_UNQUOTED(SET_THREAD_NAME(name), pthread_set_name_np(pthread_self(), name))
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if test x"$ac_cv_header_ucontext_h" = xyes; then
|
|
||||||
|
if test x"$ac_cv_header_ucontext_h" = xno; then
|
||||||
|
AC_CACHE_CHECK([if signal.h defines ucontext_t], [rb_cv_ucontext_in_signal_h],
|
||||||
|
[AC_TRY_COMPILE([@%:@include <signal.h>],
|
||||||
|
[size_t size = sizeof(ucontext_t);],
|
||||||
|
[rb_cv_ucontext_in_signal_h=yes], [rb_cv_ucontext_in_signal_h=no])])
|
||||||
|
if test x"$rb_cv_ucontext_in_signal_h" = xyes; then
|
||||||
|
AC_DEFINE_UNQUOTED(UCONTEXT_IN_SIGNAL_H, 1)
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if test x"$ac_cv_header_ucontext_h" = xyes -o x"$rb_cv_ucontext_in_signal_h" = xyes; then
|
||||||
AC_CACHE_CHECK([if mcontext_t is a pointer], [rb_cv_mcontext_t_ptr],
|
AC_CACHE_CHECK([if mcontext_t is a pointer], [rb_cv_mcontext_t_ptr],
|
||||||
[AC_TRY_COMPILE([@%:@include <ucontext.h>
|
[AC_TRY_COMPILE([
|
||||||
mcontext_t test(mcontext_t mc) {return mc+1;}
|
@%:@include <signal.h>
|
||||||
|
@%:@ifdef HAVE_UCONTEXT_H
|
||||||
|
@%:@include <ucontext.h>
|
||||||
|
@%:@endif
|
||||||
|
mcontext_t test(mcontext_t mc) {return mc+1;}
|
||||||
],
|
],
|
||||||
[test(0);],
|
[test(0);],
|
||||||
[rb_cv_mcontext_t_ptr=yes], [rb_cv_mcontext_t_ptr=no])])
|
[rb_cv_mcontext_t_ptr=yes], [rb_cv_mcontext_t_ptr=no])])
|
||||||
|
@ -3055,7 +3065,7 @@ if test "$with_dln_a_out" != yes; then
|
||||||
# mkmf.rb's have_header() to fail if the desired resource happens to be
|
# mkmf.rb's have_header() to fail if the desired resource happens to be
|
||||||
# installed in the /usr/local tree.
|
# installed in the /usr/local tree.
|
||||||
RUBY_APPEND_OPTION(CCDLFLAGS, -fno-common)],
|
RUBY_APPEND_OPTION(CCDLFLAGS, -fno-common)],
|
||||||
[bsdi*|beos*|haiku*|cygwin*|mingw*|aix*|interix*], [ ],
|
[bsdi*|beos*|cygwin*|mingw*|aix*|interix*], [ ],
|
||||||
[
|
[
|
||||||
RUBY_APPEND_OPTION(CCDLFLAGS, -fPIC)])
|
RUBY_APPEND_OPTION(CCDLFLAGS, -fPIC)])
|
||||||
else
|
else
|
||||||
|
@ -3616,7 +3626,7 @@ AS_CASE("$enable_shared", [yes], [
|
||||||
[sunos4*], [
|
[sunos4*], [
|
||||||
LIBRUBY_ALIASES='lib$(RUBY_SO_NAME).so.$(MAJOR).$(MINOR) lib$(RUBY_SO_NAME).so'
|
LIBRUBY_ALIASES='lib$(RUBY_SO_NAME).so.$(MAJOR).$(MINOR) lib$(RUBY_SO_NAME).so'
|
||||||
],
|
],
|
||||||
[linux* | gnu* | k*bsd*-gnu | atheos* | kopensolaris*-gnu], [
|
[linux* | gnu* | k*bsd*-gnu | atheos* | kopensolaris*-gnu | haiku*], [
|
||||||
LIBRUBY_DLDFLAGS='-Wl,-soname,lib$(RUBY_SO_NAME).so.$(MAJOR).$(MINOR)'" $LDFLAGS_OPTDIR"
|
LIBRUBY_DLDFLAGS='-Wl,-soname,lib$(RUBY_SO_NAME).so.$(MAJOR).$(MINOR)'" $LDFLAGS_OPTDIR"
|
||||||
LIBRUBY_ALIASES='lib$(RUBY_SO_NAME).so.$(MAJOR).$(MINOR) lib$(RUBY_SO_NAME).so'
|
LIBRUBY_ALIASES='lib$(RUBY_SO_NAME).so.$(MAJOR).$(MINOR) lib$(RUBY_SO_NAME).so'
|
||||||
if test "$load_relative" = yes; then
|
if test "$load_relative" = yes; then
|
||||||
|
@ -3708,10 +3718,6 @@ AS_CASE("$enable_shared", [yes], [
|
||||||
AS_HELP_STRING([--disable-pie], [disable PIE feature]),
|
AS_HELP_STRING([--disable-pie], [disable PIE feature]),
|
||||||
[pie=$enableval], [pie=])
|
[pie=$enableval], [pie=])
|
||||||
AS_CASE(["$target_os"],
|
AS_CASE(["$target_os"],
|
||||||
[haiku], [
|
|
||||||
# gcc supports PIE, but doesn't work correctly in Haiku
|
|
||||||
pie=no
|
|
||||||
],
|
|
||||||
[nacl], [
|
[nacl], [
|
||||||
# -pie implies -shared for NaCl.
|
# -pie implies -shared for NaCl.
|
||||||
pie=no
|
pie=no
|
||||||
|
|
6
dln.c
6
dln.c
|
@ -85,7 +85,7 @@ char *getenv();
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__BEOS__) || defined(__HAIKU__)
|
#if defined(__BEOS__)
|
||||||
# include <image.h>
|
# include <image.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1442,7 +1442,7 @@ dln_load(const char *file)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__BEOS__) || defined(__HAIKU__)
|
#if defined(__BEOS__)
|
||||||
# define DLN_DEFINED
|
# define DLN_DEFINED
|
||||||
{
|
{
|
||||||
status_t err_stat; /* BeOS error status code */
|
status_t err_stat; /* BeOS error status code */
|
||||||
|
@ -1488,7 +1488,7 @@ dln_load(const char *file)
|
||||||
(*init_fct)();
|
(*init_fct)();
|
||||||
return (void*)img_id;
|
return (void*)img_id;
|
||||||
}
|
}
|
||||||
#endif /* __BEOS__ || __HAIKU__ */
|
#endif /* __BEOS__ */
|
||||||
|
|
||||||
#ifndef DLN_DEFINED
|
#ifndef DLN_DEFINED
|
||||||
dln_notimplement();
|
dln_notimplement();
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
# undef HAVE_TYPE_STRUCT_SOCKADDR_DL
|
# undef HAVE_TYPE_STRUCT_SOCKADDR_DL
|
||||||
# endif
|
# endif
|
||||||
#else
|
#else
|
||||||
# if defined(__BEOS__) && !defined(__HAIKU__) && !defined(BONE)
|
# if defined(__BEOS__) && !defined(BONE)
|
||||||
# include <net/socket.h>
|
# include <net/socket.h>
|
||||||
# else
|
# else
|
||||||
# include <sys/socket.h>
|
# include <sys/socket.h>
|
||||||
|
|
4
file.c
4
file.c
|
@ -120,7 +120,7 @@ int flock(int, int);
|
||||||
#define STAT(p, s) stat((p), (s))
|
#define STAT(p, s) stat((p), (s))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__BEOS__) || defined(__HAIKU__) /* should not change ID if -1 */
|
#if defined(__BEOS__) /* should not change ID if -1 */
|
||||||
static int
|
static int
|
||||||
be_chown(const char *path, uid_t owner, gid_t group)
|
be_chown(const char *path, uid_t owner, gid_t group)
|
||||||
{
|
{
|
||||||
|
@ -145,7 +145,7 @@ be_fchown(int fd, uid_t owner, gid_t group)
|
||||||
return fchown(fd, owner, group);
|
return fchown(fd, owner, group);
|
||||||
}
|
}
|
||||||
#define fchown be_fchown
|
#define fchown be_fchown
|
||||||
#endif /* __BEOS__ || __HAIKU__ */
|
#endif /* __BEOS__ */
|
||||||
|
|
||||||
VALUE rb_cFile;
|
VALUE rb_cFile;
|
||||||
VALUE rb_mFileTest;
|
VALUE rb_mFileTest;
|
||||||
|
|
|
@ -168,7 +168,7 @@ void xfree(void*);
|
||||||
#include "ruby/win32.h"
|
#include "ruby/win32.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__BEOS__) && !defined(__HAIKU__) && !defined(BONE)
|
#if defined(__BEOS__) && !defined(BONE)
|
||||||
#include <net/socket.h> /* intern.h needs fd_set definition */
|
#include <net/socket.h> /* intern.h needs fd_set definition */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
4
io.c
4
io.c
|
@ -35,7 +35,7 @@
|
||||||
# include <sys/socket.h>
|
# include <sys/socket.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__BOW__) || defined(__CYGWIN__) || defined(_WIN32) || defined(__BEOS__) || defined(__HAIKU__)
|
#if defined(__BOW__) || defined(__CYGWIN__) || defined(_WIN32) || defined(__BEOS__)
|
||||||
# define NO_SAFE_RENAME
|
# define NO_SAFE_RENAME
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@
|
||||||
# include <sys/wait.h> /* for WNOHANG on BSD */
|
# include <sys/wait.h> /* for WNOHANG on BSD */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__BEOS__) || defined(__HAIKU__)
|
#if defined(__BEOS__)
|
||||||
# ifndef NOFILE
|
# ifndef NOFILE
|
||||||
# define NOFILE (OPEN_MAX)
|
# define NOFILE (OPEN_MAX)
|
||||||
# endif
|
# endif
|
||||||
|
|
12
signal.c
12
signal.c
|
@ -69,7 +69,7 @@ ruby_atomic_compare_and_swap(rb_atomic_t *ptr, rb_atomic_t cmp,
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__BEOS__) || defined(__HAIKU__)
|
#if defined(__BEOS__)
|
||||||
#undef SIGBUS
|
#undef SIGBUS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -759,7 +759,9 @@ static const char *received_signal;
|
||||||
|
|
||||||
#if defined(USE_SIGALTSTACK) || defined(_WIN32)
|
#if defined(USE_SIGALTSTACK) || defined(_WIN32)
|
||||||
NORETURN(void ruby_thread_stack_overflow(rb_thread_t *th));
|
NORETURN(void ruby_thread_stack_overflow(rb_thread_t *th));
|
||||||
# if !(defined(HAVE_UCONTEXT_H) && (defined __i386__ || defined __x86_64__ || defined __amd64__))
|
# if defined __HAIKU__
|
||||||
|
# define USE_UCONTEXT_REG 1
|
||||||
|
# elif !(defined(HAVE_UCONTEXT_H) && (defined __i386__ || defined __x86_64__ || defined __amd64__))
|
||||||
# elif defined __linux__
|
# elif defined __linux__
|
||||||
# define USE_UCONTEXT_REG 1
|
# define USE_UCONTEXT_REG 1
|
||||||
# elif defined __APPLE__
|
# elif defined __APPLE__
|
||||||
|
@ -790,6 +792,12 @@ check_stack_overflow(const uintptr_t addr, const ucontext_t *ctx)
|
||||||
# else
|
# else
|
||||||
const __register_t sp = mctx->mc_esp;
|
const __register_t sp = mctx->mc_esp;
|
||||||
# endif
|
# endif
|
||||||
|
# elif defined __HAIKU__
|
||||||
|
# if defined(__amd64__)
|
||||||
|
const unsigned long sp = mctx->rsp;
|
||||||
|
# else
|
||||||
|
const unsigned long sp = mctx->esp;
|
||||||
|
# endif
|
||||||
# endif
|
# endif
|
||||||
enum {pagesize = 4096};
|
enum {pagesize = 4096};
|
||||||
const uintptr_t sp_page = (uintptr_t)sp / pagesize;
|
const uintptr_t sp_page = (uintptr_t)sp / pagesize;
|
||||||
|
|
|
@ -33,6 +33,9 @@
|
||||||
#if defined(HAVE_SYS_TIME_H)
|
#if defined(HAVE_SYS_TIME_H)
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(__HAIKU__)
|
||||||
|
#include <kernel/OS.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
static void native_mutex_lock(rb_nativethread_lock_t *lock);
|
static void native_mutex_lock(rb_nativethread_lock_t *lock);
|
||||||
static void native_mutex_unlock(rb_nativethread_lock_t *lock);
|
static void native_mutex_unlock(rb_nativethread_lock_t *lock);
|
||||||
|
@ -497,6 +500,8 @@ size_t pthread_get_stacksize_np(pthread_t);
|
||||||
#define STACKADDR_AVAILABLE 1
|
#define STACKADDR_AVAILABLE 1
|
||||||
#elif defined HAVE_PTHREAD_GETTHRDS_NP
|
#elif defined HAVE_PTHREAD_GETTHRDS_NP
|
||||||
#define STACKADDR_AVAILABLE 1
|
#define STACKADDR_AVAILABLE 1
|
||||||
|
#elif defined __HAIKU__
|
||||||
|
#define STACKADDR_AVAILABLE 1
|
||||||
#elif defined __ia64 && defined _HPUX_SOURCE
|
#elif defined __ia64 && defined _HPUX_SOURCE
|
||||||
#include <sys/dyntune.h>
|
#include <sys/dyntune.h>
|
||||||
|
|
||||||
|
@ -615,6 +620,13 @@ get_stack(void **addr, size_t *size)
|
||||||
*addr = thinfo.__pi_stackaddr;
|
*addr = thinfo.__pi_stackaddr;
|
||||||
*size = thinfo.__pi_stacksize;
|
*size = thinfo.__pi_stacksize;
|
||||||
STACK_DIR_UPPER((void)0, (void)(*addr = (char *)*addr + *size));
|
STACK_DIR_UPPER((void)0, (void)(*addr = (char *)*addr + *size));
|
||||||
|
#elif defined __HAIKU__
|
||||||
|
thread_info info;
|
||||||
|
STACK_GROW_DIR_DETECTION;
|
||||||
|
CHECK_ERR(get_thread_info(find_thread(NULL), &info));
|
||||||
|
*addr = info.stack_base;
|
||||||
|
*size = (uintptr_t)info.stack_end - (uintptr_t)info.stack_base;
|
||||||
|
STACK_DIR_UPPER((void)0, (void)(*addr = (char *)*addr + *size));
|
||||||
#else
|
#else
|
||||||
#error STACKADDR_AVAILABLE is defined but not implemented.
|
#error STACKADDR_AVAILABLE is defined but not implemented.
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Reference in a new issue