From 5b383d3ff5ba2124a55710f1ddbaf74d02f93212 Mon Sep 17 00:00:00 2001 From: Fabrizio Fabbri Date: Tue, 31 May 2016 08:01:58 -0400 Subject: [PATCH 1/2] env->cs_limit error. (Fix #57) * Ensure that operation are performed in the correct order. --- src/c/stacks.d | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/c/stacks.d b/src/c/stacks.d index c8f6a2c13..2fc5c570a 100644 --- a/src/c/stacks.d +++ b/src/c/stacks.d @@ -28,16 +28,16 @@ cs_set_size(cl_env_ptr env, cl_index new_size) { volatile char foo = 0; cl_index margin = ecl_option_values[ECL_OPT_C_STACK_SAFETY_AREA]; - env->cs_limit_size = new_size - 2*margin; + env->cs_limit_size = new_size - (2*margin); #ifdef ECL_DOWN_STACK - if (&foo > env->cs_org - new_size + 16) { - env->cs_limit = env->cs_org - new_size + 2*margin; + if (&foo > (env->cs_org - new_size) + 16) { + env->cs_limit = (env->cs_org - new_size) + (2*margin); if (env->cs_limit < env->cs_barrier) env->cs_barrier = env->cs_limit; } #else - if (&foo < env->cs_org + new_size - 16) { - env->cs_limit = env->cs_org + new_size - 2*margin; + if (&foo < (env->cs_org + new_size) - 16) { + env->cs_limit = (env->cs_org + new_size) - (2*margin); if (env->cs_limit > env->cs_barrier) env->cs_barrier = env->cs_limit; } @@ -96,16 +96,19 @@ ecl_cs_set_org(cl_env_ptr env) { struct rlimit rl; cl_index size; - getrlimit(RLIMIT_STACK, &rl); - if (rl.rlim_cur != RLIM_INFINITY) { + + if (!getrlimit(RLIMIT_STACK, &rl) && + ( rl.rlim_cur != RLIM_INFINITY + || rl.rlim_cur !=RLIM_SAVED_MAX + || rl.rlim_cur != RLIM_SAVED_CUR) ) { env->cs_max_size = rl.rlim_cur; size = rl.rlim_cur / 2; - if (size > (cl_index)ecl_option_values[ECL_OPT_C_STACK_SIZE]) + if (size < (cl_index)ecl_option_values[ECL_OPT_C_STACK_SIZE]) ecl_set_option(ECL_OPT_C_STACK_SIZE, size); #ifdef ECL_DOWN_STACK - env->cs_barrier = env->cs_org - rl.rlim_cur - 1024; + env->cs_barrier = (env->cs_org - rl.rlim_cur) - 1024; #else - env->cs_barrier = env->cs_org + rl.rlim_cur + 1024; + env->cs_barrier = (env->cs_org + rl.rlim_cur) + 1024; #endif } } From 8ba88efb61152db00c58a3539c8368b1f116d404 Mon Sep 17 00:00:00 2001 From: Fabrizio Fabbri Date: Tue, 31 May 2016 08:09:47 -0400 Subject: [PATCH 2/2] Build svr4 like shared object on AIX. --- src/Makefile.in | 3 ++- src/aclocal.m4 | 4 ++-- src/configure | 4 ++-- src/doc/Makefile.in | 1 + 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/Makefile.in b/src/Makefile.in index 69e8008e1..6e60a5869 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -6,6 +6,7 @@ # top_srcdir= @top_srcdir@ srcdir = @srcdir@ +datarootdir = @datarootdir@ mandir=@mandir@ manext=1 @@ -269,7 +270,7 @@ selfbuild: # like "@si::foo" and "@(defun si::foo". # This rule is allowed to fail when etags does not exist. .git/tags: - cd $(srcdir)/../.git && ctags -o tags -R --langmap=c:+.d ../src || true + ( cd $(srcdir)/../.git && ctags -o tags -R --langmap=c:+.d ../src ) || true TAGS: -if test "x$(ETAGS)" != "x"; then \ srcfiles=`find $(srcdir)/c $(srcdir)/h -name '*.[chd]'` && \ diff --git a/src/aclocal.m4 b/src/aclocal.m4 index 1f3e6ab31..2b88971bb 100644 --- a/src/aclocal.m4 +++ b/src/aclocal.m4 @@ -449,8 +449,8 @@ case "${host_os}" in SHARED_LDFLAGS="-G -bsvr4 -brtl ${LDFLAGS}" BUNDLE_LDFLAGS="-G -bsvr4 -brtl ${LDFLAGS}" ECL_LDRPATH="-Wl,-R~A" - #SONAME="${SHAREDPREFIX}ecl.${SHAREDEXT}.SOVERSION" - #SONAME_LDFLAGS="-Wl,-soname,SONAME" + SONAME="${SHAREDPREFIX}ecl.${SHAREDEXT}.SOVERSION" + SONAME_LDFLAGS="-bsvr4 -brtl" ;; *) thehost="$host_os" diff --git a/src/configure b/src/configure index 302c26ed5..4a27fb370 100755 --- a/src/configure +++ b/src/configure @@ -5060,8 +5060,8 @@ LSP_FEATURES="(cons :android ${LSP_FEATURES})" SHARED_LDFLAGS="-G -bsvr4 -brtl ${LDFLAGS}" BUNDLE_LDFLAGS="-G -bsvr4 -brtl ${LDFLAGS}" ECL_LDRPATH="-Wl,-R~A" - #SONAME="${SHAREDPREFIX}ecl.${SHAREDEXT}.SOVERSION" - #SONAME_LDFLAGS="-Wl,-soname,SONAME" + SONAME="${SHAREDPREFIX}ecl.${SHAREDEXT}.SOVERSION" + SONAME_LDFLAGS="-bsvr4 -brtl" ;; *) thehost="$host_os" diff --git a/src/doc/Makefile.in b/src/doc/Makefile.in index 190b4f71f..788512e60 100644 --- a/src/doc/Makefile.in +++ b/src/doc/Makefile.in @@ -6,6 +6,7 @@ exec_prefix=@exec_prefix@ infodir = @infodir@ mandir=@mandir@ docdir=@docdir@ +datarootdir = @datarootdir@ manext=1 INFOEXT = @INFOEXT@