ruby-changes:17593
From: nobu <ko1@a...>
Date: Tue, 26 Oct 2010 18:09:57 +0900 (JST)
Subject: [ruby-changes:17593] Ruby:r29598 (trunk): * Makefile.in (ASFLAGS): needs INCFLAGS.
nobu 2010-10-26 18:09:45 +0900 (Tue, 26 Oct 2010) New Revision: 29598 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=29598 Log: * Makefile.in (ASFLAGS): needs INCFLAGS. * configure.in (rb_cv_dynamic_alloca): check if extra source for dynamic size alloca. * missing/x86_64-chkstk.s (___chkstk): necessary for alloca of amd64-mingw32msvc-gcc on Ubutu. * thread_win32.c (ruby_alloca_chkstk): check stack overflow Added files: trunk/missing/x86_64-chkstk.s Modified files: trunk/ChangeLog trunk/Makefile.in trunk/configure.in trunk/thread_win32.c Index: thread_win32.c =================================================================== --- thread_win32.c (revision 29597) +++ thread_win32.c (revision 29598) @@ -597,4 +597,17 @@ } } +#ifdef RUBY_ALLOCA_CHKSTK +void +ruby_alloca_chkstk(size_t len, void *sp) +{ + if (ruby_stack_length(NULL) * sizeof(VALUE) >= len) { + rb_thread_t *th = GET_THREAD(); + if (!rb_thread_raised_p(th, RAISED_STACKOVERFLOW)) { + rb_thread_raised_set(th, RAISED_STACKOVERFLOW); + rb_exc_raise(sysstack_error); + } + } +} +#endif #endif /* THREAD_SYSTEM_DEPENDENT_IMPLEMENTATION */ Index: configure.in =================================================================== --- configure.in (revision 29597) +++ configure.in (revision 29598) @@ -1199,6 +1199,27 @@ [ AC_FUNC_ALLOCA ]) +if test "x$ALLOCA" = "x"; then + AC_CACHE_CHECK([for dynamic size alloca], rb_cv_dynamic_alloca, [ + for chk in ok __chkstk; do + AC_TRY_LINK([ + @%:@ifdef HAVE_ALLOCA_H + @%:@include <alloca.h> + @%:@endif + void $chk() {} + int dynamic_alloca_test; + int dynamic_alloca_result;], + [dynamic_alloca_result = alloca(dynamic_alloca_test) != 0;], + [rb_cv_dynamic_alloca=$chk; break]) + done]) + if test "x$rb_cv_dynamic_alloca" = "x__chkstk"; then + AC_DEFINE_UNQUOTED(RUBY_ALLOCA_CHKSTK, _$rb_cv_dynamic_alloca) + AS_CASE("$target_cpu", + [x64|x86_64], [ + AC_SUBST([ALLOCA], [\${LIBOBJDIR}x86_64-chkstk.${ac_objext}]) + ],) + fi +fi AC_FUNC_MEMCMP # http://sources.redhat.com/ml/libc-hacker/2005-08/msg00008.html Index: ChangeLog =================================================================== --- ChangeLog (revision 29597) +++ ChangeLog (revision 29598) @@ -1,3 +1,15 @@ +Tue Oct 26 18:09:36 2010 Nobuyoshi Nakada <nobu@r...> + + * Makefile.in (ASFLAGS): needs INCFLAGS. + + * configure.in (rb_cv_dynamic_alloca): check if extra source for + dynamic size alloca. + + * missing/x86_64-chkstk.s (___chkstk): necessary for alloca of + amd64-mingw32msvc-gcc on Ubutu. + + * thread_win32.c (ruby_alloca_chkstk): check stack overflow + Tue Oct 26 18:04:53 2010 Nobuyoshi Nakada <nobu@r...> * template/ruby.pc.in (Libs): needs DLDFLAGS. Index: Makefile.in =================================================================== --- Makefile.in (revision 29597) +++ Makefile.in (revision 29598) @@ -52,8 +52,9 @@ optflags = @optflags@ debugflags = @debugflags@ warnflags = @warnflags@ -XCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir) -I$(srcdir) @XCFLAGS@ -CPPFLAGS = @CPPFLAGS@ +INCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir) -I$(srcdir) +XCFLAGS = @XCFLAGS@ +CPPFLAGS = @CPPFLAGS@ $(INCFLAGS) LDFLAGS = @STATIC@ $(CFLAGS) @LDFLAGS@ EXTLDFLAGS = XLDFLAGS = @XLDFLAGS@ $(EXTLDFLAGS) @@ -122,7 +123,7 @@ ARFLAGS = rcu RANLIB = @RANLIB@ AS = @AS@ -ASFLAGS = @ASFLAGS@ +ASFLAGS = @ASFLAGS@ $(INCFLAGS) IFCHANGE = $(srcdir)/tool/ifchange SET_LC_MESSAGES = env LC_MESSAGES=C OBJDUMP = @OBJDUMP@ Index: missing/x86_64-chkstk.s =================================================================== --- missing/x86_64-chkstk.s (revision 0) +++ missing/x86_64-chkstk.s (revision 29598) @@ -0,0 +1,10 @@ + .text +.globl ___chkstk +___chkstk: + pushq %rax + movq %rax, %rcx + movq %rsp, %rdx + call _ruby_alloca_chkstk + popq %rax + subq %rax, %rsp + ret Property changes on: missing/x86_64-chkstk.s ___________________________________________________________________ Added: svn:eol-style + LF -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/